@rabbitio/ui-kit 1.0.0-beta.64 → 1.0.0-beta.66
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/coverage/clover.xml +6325 -4201
- package/coverage/coverage-final.json +160 -99
- package/coverage/index.html +444 -189
- package/coverage/{rabbit-ui-kit → ui-kit}/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/index.js.html +3 -3
- package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/arrowTosca.jsx.html → ui-kit/src/assets/wrappedImages/arrowIcon.jsx.html} +8 -29
- package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/arrowIcon.jsx.html → ui-kit/src/assets/wrappedImages/arrowTosca.jsx.html} +9 -24
- package/coverage/{rabbit-ui-kit → ui-kit}/src/assets/wrappedImages/arrowWhite.jsx.html +7 -25
- package/coverage/ui-kit/src/assets/wrappedImages/darkRectangle.jsx.html +106 -0
- package/coverage/{rabbit-ui-kit → ui-kit}/src/assets/wrappedImages/determinedError.jsx.html +9 -42
- package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/successfulValidationIcon.jsx.html → ui-kit/src/assets/wrappedImages/failedValidationIcon.jsx.html} +28 -31
- package/coverage/{rabbit-ui-kit → ui-kit}/src/assets/wrappedImages/index.html +25 -25
- package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/darkRectangle.jsx.html → ui-kit/src/assets/wrappedImages/infoIcon.jsx.html} +13 -19
- package/coverage/{rabbit-ui-kit → ui-kit}/src/assets/wrappedImages/noticeQuestionIcon.jsx.html +7 -25
- package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/walletIcon.jsx.html → ui-kit/src/assets/wrappedImages/successfulValidationIcon.jsx.html} +23 -59
- package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/infoIcon.jsx.html → ui-kit/src/assets/wrappedImages/walletIcon.jsx.html} +16 -16
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/adapters/axiosAdapter.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/adapters/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/adapters/qrUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/amountUtils.js.html +44 -308
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/errorUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/external-apis/apiGroups.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/external-apis/index.html +14 -14
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/external-apis/ipAddressProviders.js.html +31 -178
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/fiatCurrenciesService.js.html +12 -36
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/index.html +20 -20
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/models/blockchain.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/models/coin.js.html +10 -22
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/models/index.html +13 -13
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/models/protocol.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/cache.js.html +23 -101
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/emailAPI.js.html +9 -15
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/index.html +19 -19
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/logging/index.html +9 -9
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/logging/logger.js.html +14 -35
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/logging/logsStorage.js.html +5 -5
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/postponeExecution.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/safeStringify.js.html +29 -29
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/AssetIcon/AssetIcon.jsx.html +11 -41
- package/coverage/ui-kit/src/components/atoms/AssetIcon/index.html +116 -0
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/AssetSelection/AssetSelection.jsx.html +9 -33
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/AssetSelection/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +8 -38
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/BackgroundTitle/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/InformationMessage/InformationMessage.jsx.html +8 -38
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/InformationMessage/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Input/Input.jsx.html +15 -63
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Input/index.html +7 -7
- package/coverage/ui-kit/src/components/atoms/LoadingDots/LoadingDots.jsx.html +196 -0
- package/coverage/{rabbit-ui-kit/src/components/atoms/RateSelector → ui-kit/src/components/atoms/LoadingDots}/index.html +4 -4
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/NoticeIcon/NoticeIcon.jsx.html +10 -40
- package/coverage/{rabbit-ui-kit/src/components/atoms/AssetIcon → ui-kit/src/components/atoms/NoticeIcon}/index.html +4 -4
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/QrCode/QrCode.jsx.html +8 -26
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/QrCode/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/RateSelector/RateSelector.jsx.html +10 -34
- package/coverage/ui-kit/src/components/atoms/RateSelector/index.html +116 -0
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/SupportChat/SupportChat.jsx.html +7 -22
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/SupportChat/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Textarea/Textarea.jsx.html +17 -53
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Textarea/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/TitleBox/TitleBox.jsx.html +13 -82
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/TitleBox/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Tooltip/Tooltip.jsx.html +12 -18
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Tooltip/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +12 -30
- package/coverage/{rabbit-ui-kit/src/components/atoms/NoticeIcon → ui-kit/src/components/atoms/TwoLinesOfText}/index.html +4 -4
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Validation/Validation.jsx.html +19 -13
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Validation/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/Button/Button.jsx.html +23 -113
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/Button/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/Close/Close.jsx.html +9 -27
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/Close/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/LinkButton/LinkButton.jsx.html +11 -38
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/LinkButton/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +13 -67
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/RadioButtonWithText/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/hooks/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/hooks/useCallHandlingErrors.js.html +7 -19
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/hooks/useReferredState.js.html +4 -4
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/AmountInput/AmountInput.jsx.html +56 -407
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/AmountInput/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/CoinPicker/CoinPicker.jsx.html +67 -466
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/CoinPicker/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +7 -22
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/LineWithIconLink/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/TitledLineWithIconLink/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +9 -15
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/CoinPickerDialogStep/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/Dialog.jsx.html +44 -194
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/DialogButtons/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +63 -525
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/DialogStep/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/SwapForm/SwapForm.jsx.html +145 -670
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/SwapForm/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/templates/DeterminedErrorDialogStep/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/index.html +20 -20
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/inputValueProviders.js.html +11 -35
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/textUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/uiUtils.js.html +7 -13
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/urlQueryUtils.js.html +18 -93
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/Close/close.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/Close/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/LinkButton/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/LinkButton/linkButton.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/Tooltip/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/Tooltip/tooltip.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/globalConstants.jsx.html +7 -10
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/organisms/dialog/DialogStep/dialogStep.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/organisms/dialog/DialogStep/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/organisms/dialog/dialog.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/organisms/dialog/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/index.js.html +8 -26
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/cacheAndConcurrentRequestsResolver.js.html +30 -222
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/cachedRobustExternalApiCallerService.js.html +24 -147
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/cancelProcessing.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/concurrentCalculationsMetadataHolder.js.html +19 -103
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/externalApiProvider.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/externalServicesStatsCollector.js.html +11 -23
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/index.html +38 -38
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/robustExternalAPICallerService.js.html +53 -305
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/index.html +24 -24
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/swapProvider.js.html +10 -28
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +277 -1009
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/baseSwapCreationInfo.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/existingSwap.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/existingSwapWithFiatData.js.html +9 -27
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/index.html +13 -13
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/services/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/services/publicSwapService.js.html +53 -374
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/utils/index.html +13 -13
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/utils/swapUtils.js.html +32 -179
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/BackgroundTitle.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/LinesOfText.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/LoadingDots.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/QrCode.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/RateSelector.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/Validation.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/Button.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/Close.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/LinkButton.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/LineWithIconLink.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/TitledLineWithIconLink.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/Dialog.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogButtons/DialogButtons.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogButtons/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogStep/DialogStep.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogStep/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/stubs/exampleContent.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/stubs/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/templates/index.html +3 -3
- package/dist/index.cjs +65 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +5 -2
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +43 -28
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +65 -49
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +65 -49
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -3
- package/src/assets/wrappedImages/arrowIcon.jsx +1 -7
- package/src/assets/wrappedImages/arrowTosca.jsx +1 -7
- package/src/assets/wrappedImages/arrowWhite.jsx +1 -7
- package/src/assets/wrappedImages/darkRectangle.jsx +2 -13
- package/src/assets/wrappedImages/determinedError.jsx +2 -13
- package/src/assets/wrappedImages/failedValidationIcon.jsx +2 -16
- package/src/assets/wrappedImages/infoIcon.jsx +1 -7
- package/src/assets/wrappedImages/noticeQuestionIcon.jsx +1 -7
- package/src/assets/wrappedImages/successfulValidationIcon.jsx +2 -16
- package/src/assets/wrappedImages/walletIcon.jsx +3 -19
- package/src/common/amountUtils.js +36 -124
- package/src/common/external-apis/ipAddressProviders.js +22 -71
- package/src/common/fiatCurrenciesService.js +4 -12
- package/src/common/models/coin.js +2 -6
- package/src/common/tests/amountUtils/composeRateText.test.js +12 -69
- package/src/common/tests/integration/external-apis/ipAddressProviders/getClientIpAddress.test.js +1 -3
- package/src/common/utils/cache.js +10 -36
- package/src/common/utils/emailAPI.js +1 -3
- package/src/common/utils/logging/logger.js +5 -12
- package/src/components/atoms/AssetIcon/AssetIcon.jsx +4 -14
- package/src/components/atoms/AssetSelection/AssetSelection.jsx +3 -11
- package/src/components/atoms/BackgroundTitle/BackgroundTitle.jsx +2 -12
- package/src/components/atoms/InformationMessage/InformationMessage.jsx +2 -12
- package/src/components/atoms/InformationMessage/information-message.module.scss +4 -2
- package/src/components/atoms/Input/Input.jsx +9 -25
- package/src/components/atoms/LoadingDots/LoadingDots.jsx +8 -28
- package/src/components/atoms/NoticeIcon/NoticeIcon.jsx +4 -14
- package/src/components/atoms/QrCode/QrCode.jsx +2 -8
- package/src/components/atoms/RateSelector/RateSelector.jsx +4 -12
- package/src/components/atoms/SupportChat/SupportChat.jsx +1 -6
- package/src/components/atoms/Textarea/Textarea.jsx +11 -23
- package/src/components/atoms/TitleBox/TitleBox.jsx +7 -30
- package/src/components/atoms/TitleBox/title-box.module.scss +2 -0
- package/src/components/atoms/Tooltip/Tooltip.jsx +6 -8
- package/src/components/atoms/TwoLinesOfText/LinesOfText.jsx +5 -11
- package/src/components/atoms/Validation/Validation.jsx +9 -7
- package/src/components/atoms/buttons/Button/Button.jsx +17 -47
- package/src/components/atoms/buttons/Close/Close.jsx +3 -9
- package/src/components/atoms/buttons/LinkButton/LinkButton.jsx +5 -14
- package/src/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx +7 -25
- package/src/components/hooks/useCallHandlingErrors.js +1 -5
- package/src/components/hooks/useReferredState.js +1 -1
- package/src/components/molecules/AmountInput/AmountInput.jsx +50 -167
- package/src/components/molecules/CoinPicker/CoinPicker.jsx +61 -194
- package/src/components/molecules/CoinPicker/coin-picker.module.scss +1 -4
- package/src/components/molecules/LineWithIconLink/LineWithIconLink.jsx +1 -6
- package/src/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx +3 -5
- package/src/components/organisms/Dialog/Dialog.jsx +38 -88
- package/src/components/organisms/Dialog/DialogStep/DialogStep.jsx +57 -211
- package/src/components/organisms/Dialog/DialogStep/dialog-step.module.scss +2 -4
- package/src/components/organisms/SwapForm/SwapForm.jsx +139 -314
- package/src/components/tests/utils/inputValueProviders/provideFormatOfFloatValueByInputString.test.js +5 -12
- package/src/components/tests/utils/urlQueryUtils/getQueryParameterValues.test.js +3 -9
- package/src/components/tests/utils/urlQueryUtils/saveQueryParameterAndValues.test.js +11 -51
- package/src/components/utils/inputValueProviders.js +3 -11
- package/src/components/utils/uiUtils.js +1 -3
- package/src/components/utils/urlQueryUtils.js +10 -35
- package/src/constants/globalConstants.jsx +1 -2
- package/src/index.js +2 -8
- package/src/robustExteranlApiCallerService/cacheAndConcurrentRequestsResolver.js +22 -86
- package/src/robustExteranlApiCallerService/cachedRobustExternalApiCallerService.js +15 -56
- package/src/robustExteranlApiCallerService/concurrentCalculationsMetadataHolder.js +11 -39
- package/src/robustExteranlApiCallerService/externalServicesStatsCollector.js +3 -7
- package/src/robustExteranlApiCallerService/robustExternalAPICallerService.js +45 -129
- package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/_performCallAttempt.test.js +76 -330
- package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/callExternalAPI.test.js +57 -270
- package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/constructor.test.js +3 -15
- package/src/swaps-lib/external-apis/swapProvider.js +1 -7
- package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +117 -361
- package/src/swaps-lib/models/existingSwapWithFiatData.js +1 -7
- package/src/swaps-lib/services/publicSwapService.js +47 -154
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +33 -118
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/createSwap.test.js +23 -85
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getAllSupportedCurrencies.test.js +4 -14
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getDepositCurrencies.test.js +3 -9
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getSwapInfo.test.js +148 -460
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getWithdrawalCurrencies.test.js +5 -11
- package/src/swaps-lib/test/utils/swapUtils/safeHandleRequestsLimitExceeding.test.js +2 -10
- package/src/swaps-lib/utils/swapUtils.js +24 -73
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/failedValidationIcon.jsx.html +0 -244
- package/coverage/rabbit-ui-kit/src/components/atoms/LoadingDots/LoadingDots.jsx.html +0 -256
- package/coverage/rabbit-ui-kit/src/components/atoms/LoadingDots/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/components/atoms/TwoLinesOfText/index.html +0 -116
|
@@ -18,16 +18,14 @@ describe("InputValueProviders", function () {
|
|
|
18
18
|
maxSuffix: 2,
|
|
19
19
|
test: "1989401950928592501985.3243",
|
|
20
20
|
expected: "92501985.32",
|
|
21
|
-
message:
|
|
22
|
-
"Should left no more than max digits count for prefix - some prefix case",
|
|
21
|
+
message: "Should left no more than max digits count for prefix - some prefix case",
|
|
23
22
|
},
|
|
24
23
|
{
|
|
25
24
|
max: 3,
|
|
26
25
|
maxSuffix: 2,
|
|
27
26
|
test: "1989401950928592501985.3243",
|
|
28
27
|
expected: "5.32",
|
|
29
|
-
message:
|
|
30
|
-
"Should left no more than max digits count for prefix - min prefix case",
|
|
28
|
+
message: "Should left no more than max digits count for prefix - min prefix case",
|
|
31
29
|
},
|
|
32
30
|
{
|
|
33
31
|
max: 21000000,
|
|
@@ -110,7 +108,7 @@ describe("InputValueProviders", function () {
|
|
|
110
108
|
expected: "32.219",
|
|
111
109
|
message: "Should replace the series of commas with the only",
|
|
112
110
|
},
|
|
113
|
-
].forEach(
|
|
111
|
+
].forEach(testData => {
|
|
114
112
|
it(testData.message, function () {
|
|
115
113
|
InputValuesProviders.provideFormatOfFloatValueByInputString(
|
|
116
114
|
testData.test,
|
|
@@ -123,17 +121,12 @@ describe("InputValueProviders", function () {
|
|
|
123
121
|
it("Should throw an error if passed suffix length less than 0", function () {
|
|
124
122
|
let error = null;
|
|
125
123
|
try {
|
|
126
|
-
InputValuesProviders.provideFormatOfFloatValueByInputString(
|
|
127
|
-
"23232",
|
|
128
|
-
-1
|
|
129
|
-
);
|
|
124
|
+
InputValuesProviders.provideFormatOfFloatValueByInputString("23232", -1);
|
|
130
125
|
} catch (e) {
|
|
131
126
|
error = e;
|
|
132
127
|
}
|
|
133
128
|
|
|
134
|
-
(error?.message ?? "").should.startWith(
|
|
135
|
-
"Min suffix length is 0, got"
|
|
136
|
-
);
|
|
129
|
+
(error?.message ?? "").should.startWith("Min suffix length is 0, got");
|
|
137
130
|
});
|
|
138
131
|
});
|
|
139
132
|
});
|
|
@@ -21,14 +21,10 @@ describe("urlQueryUtils", function () {
|
|
|
21
21
|
|
|
22
22
|
it("Should unescape parameter values", function () {
|
|
23
23
|
const parameterValuesWithSpecialSymbols = "#a@se /wer|*|##eee$";
|
|
24
|
-
setCustomQueryString(
|
|
25
|
-
`?a=${encodeURIComponent(parameterValuesWithSpecialSymbols)}`
|
|
26
|
-
);
|
|
24
|
+
setCustomQueryString(`?a=${encodeURIComponent(parameterValuesWithSpecialSymbols)}`);
|
|
27
25
|
const result = getQueryParameterValues("a");
|
|
28
26
|
|
|
29
|
-
result.should.be.deepEqual([
|
|
30
|
-
...parameterValuesWithSpecialSymbols.split("|*|"),
|
|
31
|
-
]);
|
|
27
|
+
result.should.be.deepEqual([...parameterValuesWithSpecialSymbols.split("|*|")]);
|
|
32
28
|
});
|
|
33
29
|
|
|
34
30
|
it("Should return empty array if there is no such parameter in the query", function () {
|
|
@@ -60,9 +56,7 @@ describe("urlQueryUtils", function () {
|
|
|
60
56
|
});
|
|
61
57
|
|
|
62
58
|
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
|
-
);
|
|
59
|
+
setCustomQueryString(`?a=${encodeURIComponent("val1|*|val2")}&a=val3`);
|
|
66
60
|
const result = getQueryParameterValues("a");
|
|
67
61
|
|
|
68
62
|
result.should.be.deepEqual(["val1", "val2", "val3"]);
|
|
@@ -25,11 +25,7 @@ describe("urlQueryUtils", function () {
|
|
|
25
25
|
|
|
26
26
|
it("Should escape parameter values", function () {
|
|
27
27
|
setCustomQueryString("");
|
|
28
|
-
const result = saveQueryParameterAndValues(
|
|
29
|
-
"a",
|
|
30
|
-
["e #e"],
|
|
31
|
-
callbackStub
|
|
32
|
-
);
|
|
28
|
+
const result = saveQueryParameterAndValues("a", ["e #e"], callbackStub);
|
|
33
29
|
result.should.be.equal(`?a=${encodeURIComponent("e #e")}`);
|
|
34
30
|
});
|
|
35
31
|
|
|
@@ -59,85 +55,49 @@ describe("urlQueryUtils", function () {
|
|
|
59
55
|
|
|
60
56
|
it("Should add parameter with one value - Case query is empty", function () {
|
|
61
57
|
setCustomQueryString("");
|
|
62
|
-
const result = saveQueryParameterAndValues(
|
|
63
|
-
"a",
|
|
64
|
-
["1"],
|
|
65
|
-
callbackStub
|
|
66
|
-
);
|
|
58
|
+
const result = saveQueryParameterAndValues("a", ["1"], callbackStub);
|
|
67
59
|
result.should.be.equal("?a=1");
|
|
68
60
|
});
|
|
69
61
|
|
|
70
62
|
it("Should add parameter with one value - Case query contains one parameter", function () {
|
|
71
63
|
setCustomQueryString("?one=val");
|
|
72
|
-
const result = saveQueryParameterAndValues(
|
|
73
|
-
"a",
|
|
74
|
-
["1"],
|
|
75
|
-
callbackStub
|
|
76
|
-
);
|
|
64
|
+
const result = saveQueryParameterAndValues("a", ["1"], callbackStub);
|
|
77
65
|
result.should.be.equal("?one=val&a=1");
|
|
78
66
|
});
|
|
79
67
|
|
|
80
68
|
it("Should add parameter with one value - Case query contains several parameters", function () {
|
|
81
69
|
setCustomQueryString("?one=val&err=week");
|
|
82
|
-
const result = saveQueryParameterAndValues(
|
|
83
|
-
"a",
|
|
84
|
-
["1"],
|
|
85
|
-
callbackStub
|
|
86
|
-
);
|
|
70
|
+
const result = saveQueryParameterAndValues("a", ["1"], callbackStub);
|
|
87
71
|
result.should.be.equal("?one=val&err=week&a=1");
|
|
88
72
|
});
|
|
89
73
|
|
|
90
74
|
it("Should add parameter with several values using separator - Case query is empty", function () {
|
|
91
75
|
setCustomQueryString("");
|
|
92
|
-
const result = saveQueryParameterAndValues(
|
|
93
|
-
"a",
|
|
94
|
-
["1", "aa", "err"],
|
|
95
|
-
callbackStub
|
|
96
|
-
);
|
|
76
|
+
const result = saveQueryParameterAndValues("a", ["1", "aa", "err"], callbackStub);
|
|
97
77
|
result.should.be.equal(`?a=${encodeURIComponent("1|*|aa|*|err")}`);
|
|
98
78
|
});
|
|
99
79
|
|
|
100
80
|
it("Should add parameter with several values using separator - Case query contains one parameter", function () {
|
|
101
81
|
setCustomQueryString("?one=val");
|
|
102
|
-
const result = saveQueryParameterAndValues(
|
|
103
|
-
|
|
104
|
-
["1", "aa", "err"],
|
|
105
|
-
callbackStub
|
|
106
|
-
);
|
|
107
|
-
result.should.be.equal(
|
|
108
|
-
`?one=val&a=${encodeURIComponent("1|*|aa|*|err")}`
|
|
109
|
-
);
|
|
82
|
+
const result = saveQueryParameterAndValues("a", ["1", "aa", "err"], callbackStub);
|
|
83
|
+
result.should.be.equal(`?one=val&a=${encodeURIComponent("1|*|aa|*|err")}`);
|
|
110
84
|
});
|
|
111
85
|
|
|
112
86
|
it("Should add parameter with several values using separator - Case query contains several parameters", function () {
|
|
113
87
|
setCustomQueryString("?one=val&err=week");
|
|
114
|
-
const result = saveQueryParameterAndValues(
|
|
115
|
-
|
|
116
|
-
["1", "aa", "err"],
|
|
117
|
-
callbackStub
|
|
118
|
-
);
|
|
119
|
-
result.should.be.equal(
|
|
120
|
-
`?one=val&err=week&a=${encodeURIComponent("1|*|aa|*|err")}`
|
|
121
|
-
);
|
|
88
|
+
const result = saveQueryParameterAndValues("a", ["1", "aa", "err"], callbackStub);
|
|
89
|
+
result.should.be.equal(`?one=val&err=week&a=${encodeURIComponent("1|*|aa|*|err")}`);
|
|
122
90
|
});
|
|
123
91
|
|
|
124
92
|
it("Should replace existing parameter value - Case query contains one parameter", function () {
|
|
125
93
|
setCustomQueryString("?a=val");
|
|
126
|
-
const result = saveQueryParameterAndValues(
|
|
127
|
-
"a",
|
|
128
|
-
["1"],
|
|
129
|
-
callbackStub
|
|
130
|
-
);
|
|
94
|
+
const result = saveQueryParameterAndValues("a", ["1"], callbackStub);
|
|
131
95
|
result.should.be.equal("?a=1");
|
|
132
96
|
});
|
|
133
97
|
|
|
134
98
|
it("Should replace existing parameter value - Case query contains several parameters", function () {
|
|
135
99
|
setCustomQueryString("?one=val&a=week");
|
|
136
|
-
const result = saveQueryParameterAndValues(
|
|
137
|
-
"a",
|
|
138
|
-
["1"],
|
|
139
|
-
callbackStub
|
|
140
|
-
);
|
|
100
|
+
const result = saveQueryParameterAndValues("a", ["1"], callbackStub);
|
|
141
101
|
result.should.be.equal("?one=val&a=1");
|
|
142
102
|
});
|
|
143
103
|
});
|
|
@@ -11,11 +11,7 @@ export class InputValuesProviders {
|
|
|
11
11
|
* @param digitsAfterDot {number} count of digits after the dot that this method should provide, min 0
|
|
12
12
|
* @return {string} corrected float value string
|
|
13
13
|
*/
|
|
14
|
-
static provideFormatOfFloatValueByInputString(
|
|
15
|
-
inputString,
|
|
16
|
-
digitsAfterDot = 2,
|
|
17
|
-
maxValue = null
|
|
18
|
-
) {
|
|
14
|
+
static provideFormatOfFloatValueByInputString(inputString, digitsAfterDot = 2, maxValue = null) {
|
|
19
15
|
let value = inputString;
|
|
20
16
|
if (!value) {
|
|
21
17
|
return "";
|
|
@@ -37,14 +33,10 @@ export class InputValuesProviders {
|
|
|
37
33
|
}
|
|
38
34
|
|
|
39
35
|
if (maxValue != null) {
|
|
40
|
-
const maxDigitsCountBeforeTheDot =
|
|
41
|
-
BigNumber(maxValue).toFixed(0).length;
|
|
36
|
+
const maxDigitsCountBeforeTheDot = BigNumber(maxValue).toFixed(0).length;
|
|
42
37
|
if (parts[0]?.length > maxDigitsCountBeforeTheDot) {
|
|
43
38
|
// removes redundant prefix digits
|
|
44
|
-
parts[0] = parts[0].substring(
|
|
45
|
-
parts[0].length - maxDigitsCountBeforeTheDot,
|
|
46
|
-
parts[0].length
|
|
47
|
-
);
|
|
39
|
+
parts[0] = parts[0].substring(parts[0].length - maxDigitsCountBeforeTheDot, parts[0].length);
|
|
48
40
|
}
|
|
49
41
|
}
|
|
50
42
|
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export const handleClickOutside = (exceptionsRefs, callback) => {
|
|
2
2
|
function handleClick(event) {
|
|
3
|
-
const isExceptionClicked = exceptionsRefs.find(
|
|
4
|
-
(ref) => ref?.current && ref.current.contains(event.target)
|
|
5
|
-
);
|
|
3
|
+
const isExceptionClicked = exceptionsRefs.find(ref => ref?.current && ref.current.contains(event.target));
|
|
6
4
|
if (!isExceptionClicked) {
|
|
7
5
|
callback();
|
|
8
6
|
}
|
|
@@ -7,22 +7,12 @@ const PARAMETER_VALUES_SEPARATOR = "|*|"; // Sting that with high probability wi
|
|
|
7
7
|
* @param values - Array of String values
|
|
8
8
|
* @param updateURLCallback - callback that will be called with the updated query string. Can be used to save it to URL
|
|
9
9
|
*/
|
|
10
|
-
export function saveQueryParameterAndValues(
|
|
11
|
-
parameterName,
|
|
12
|
-
values,
|
|
13
|
-
updateURLCallback = (newQueryString) => {}
|
|
14
|
-
) {
|
|
10
|
+
export function saveQueryParameterAndValues(parameterName, values, updateURLCallback = newQueryString => {}) {
|
|
15
11
|
let parametersAndValues = parseSearchString();
|
|
16
|
-
parametersAndValues = parametersAndValues.filter(
|
|
17
|
-
|
|
18
|
-
);
|
|
19
|
-
const parameterValuesForURL = encodeURIComponent(
|
|
20
|
-
values.join(PARAMETER_VALUES_SEPARATOR)
|
|
21
|
-
);
|
|
12
|
+
parametersAndValues = parametersAndValues.filter(parameterAndValues => parameterAndValues[0] !== parameterName);
|
|
13
|
+
const parameterValuesForURL = encodeURIComponent(values.join(PARAMETER_VALUES_SEPARATOR));
|
|
22
14
|
parametersAndValues.push([parameterName, parameterValuesForURL]);
|
|
23
|
-
const newQueryString = `?${parametersAndValues
|
|
24
|
-
.map((parameterAndValues) => parameterAndValues.join("="))
|
|
25
|
-
.join("&")}`;
|
|
15
|
+
const newQueryString = `?${parametersAndValues.map(parameterAndValues => parameterAndValues.join("=")).join("&")}`;
|
|
26
16
|
updateURLCallback(newQueryString);
|
|
27
17
|
|
|
28
18
|
return newQueryString;
|
|
@@ -35,17 +25,10 @@ export function saveQueryParameterAndValues(
|
|
|
35
25
|
* @param updateURLCallback - callback that will be called with the updated query string. Can be used to save it to URL
|
|
36
26
|
*/
|
|
37
27
|
// TODO: [tests, moderate] units required the same as or other functions in this module
|
|
38
|
-
export function removeQueryParameterAndValues(
|
|
39
|
-
parameterName,
|
|
40
|
-
updateURLCallback = (newQueryString) => {}
|
|
41
|
-
) {
|
|
28
|
+
export function removeQueryParameterAndValues(parameterName, updateURLCallback = newQueryString => {}) {
|
|
42
29
|
let parametersAndValues = parseSearchString();
|
|
43
|
-
parametersAndValues = parametersAndValues.filter(
|
|
44
|
-
|
|
45
|
-
);
|
|
46
|
-
const newQueryString = `?${parametersAndValues
|
|
47
|
-
.map((parameterAndValues) => parameterAndValues.join("="))
|
|
48
|
-
.join("&")}`;
|
|
30
|
+
parametersAndValues = parametersAndValues.filter(parameterAndValues => parameterAndValues[0] !== parameterName);
|
|
31
|
+
const newQueryString = `?${parametersAndValues.map(parameterAndValues => parameterAndValues.join("=")).join("&")}`;
|
|
49
32
|
updateURLCallback(newQueryString);
|
|
50
33
|
|
|
51
34
|
return newQueryString;
|
|
@@ -61,11 +44,9 @@ export function removeQueryParameterAndValues(
|
|
|
61
44
|
*/
|
|
62
45
|
export function getQueryParameterValues(name) {
|
|
63
46
|
return parseSearchString()
|
|
64
|
-
.filter(
|
|
47
|
+
.filter(parameterAndValue => parameterAndValue[0] === name)
|
|
65
48
|
.reduce((allValues, parameterAndValue) => {
|
|
66
|
-
const values = decodeURIComponent(parameterAndValue[1] || "").split(
|
|
67
|
-
PARAMETER_VALUES_SEPARATOR
|
|
68
|
-
);
|
|
49
|
+
const values = decodeURIComponent(parameterAndValue[1] || "").split(PARAMETER_VALUES_SEPARATOR);
|
|
69
50
|
return [...allValues, ...values];
|
|
70
51
|
}, []);
|
|
71
52
|
}
|
|
@@ -73,13 +54,7 @@ export function getQueryParameterValues(name) {
|
|
|
73
54
|
function parseSearchString() {
|
|
74
55
|
const trimmed = (window.location.search?.slice(1) || "").trim();
|
|
75
56
|
|
|
76
|
-
return (
|
|
77
|
-
(trimmed &&
|
|
78
|
-
trimmed
|
|
79
|
-
.split("&")
|
|
80
|
-
.map((parameterAndValue) => parameterAndValue.split("="))) ||
|
|
81
|
-
[]
|
|
82
|
-
);
|
|
57
|
+
return (trimmed && trimmed.split("&").map(parameterAndValue => parameterAndValue.split("="))) || [];
|
|
83
58
|
}
|
|
84
59
|
|
|
85
60
|
export function getQueryParameterSingleValue(name) {
|
package/src/index.js
CHANGED
|
@@ -25,10 +25,7 @@ export { TitledLineWithIconLink } from "./components/molecules/TitledLineWithIco
|
|
|
25
25
|
export { RadioButtonWithText } from "./components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx";
|
|
26
26
|
export { InformationMessage } from "./components/atoms/InformationMessage/InformationMessage.jsx";
|
|
27
27
|
export { Input } from "./components/atoms/Input/Input.jsx";
|
|
28
|
-
export {
|
|
29
|
-
COIN_PICKER_MODES,
|
|
30
|
-
CoinPicker,
|
|
31
|
-
} from "./components/molecules/CoinPicker/CoinPicker.jsx";
|
|
28
|
+
export { COIN_PICKER_MODES, CoinPicker } from "./components/molecules/CoinPicker/CoinPicker.jsx";
|
|
32
29
|
export { CoinPickerDialogStep } from "./components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx";
|
|
33
30
|
|
|
34
31
|
// UI-KIT constants
|
|
@@ -37,10 +34,7 @@ export { DIALOG_STEP_CLASS } from "./constants/organisms/dialog/DialogStep/dialo
|
|
|
37
34
|
export { ICON_ROTATE_OPTIONS } from "./constants/atoms/LinkButton/linkButton.jsx";
|
|
38
35
|
export { TOOLTIP_POSITIONS } from "./constants/atoms/Tooltip/tooltip.jsx";
|
|
39
36
|
export { CLOSE_COLORS } from "./constants/atoms/Close/close.jsx";
|
|
40
|
-
export {
|
|
41
|
-
FALLBACK_ASSET_ICON_URL,
|
|
42
|
-
DEFAULT_CRYPTO_DECIMAL_COUNT,
|
|
43
|
-
} from "./constants/globalConstants.jsx";
|
|
37
|
+
export { FALLBACK_ASSET_ICON_URL, DEFAULT_CRYPTO_DECIMAL_COUNT } from "./constants/globalConstants.jsx";
|
|
44
38
|
|
|
45
39
|
export { useCallHandlingErrors } from "./components/hooks/useCallHandlingErrors.js";
|
|
46
40
|
export { useReferredState } from "./components/hooks/useReferredState.js";
|
|
@@ -50,12 +50,7 @@ export class CacheAndConcurrentRequestsResolver {
|
|
|
50
50
|
maxCallAttemptsToWaitForAlreadyRunningRequest = 100,
|
|
51
51
|
timeoutBetweenAttemptsToCheckWhetherAlreadyRunningRequestFinished = 1000
|
|
52
52
|
) {
|
|
53
|
-
if (
|
|
54
|
-
cacheTtl != null &&
|
|
55
|
-
cacheTtl <
|
|
56
|
-
timeoutBetweenAttemptsToCheckWhetherAlreadyRunningRequestFinished *
|
|
57
|
-
2
|
|
58
|
-
) {
|
|
53
|
+
if (cacheTtl != null && cacheTtl < timeoutBetweenAttemptsToCheckWhetherAlreadyRunningRequestFinished * 2) {
|
|
59
54
|
/*
|
|
60
55
|
* During the lifetime of this service e.g. if the data is being retrieved slowly we can get
|
|
61
56
|
* RACE CONDITION when we constantly retrieve data and during retrieval it is expired, so we are trying
|
|
@@ -110,12 +105,8 @@ export class CacheAndConcurrentRequestsResolver {
|
|
|
110
105
|
let cached = this._cache.get(cacheId);
|
|
111
106
|
let cachedDataBackupIsPresentButExpired = null;
|
|
112
107
|
if (cached != null && !this._removeExpiredCacheAutomatically) {
|
|
113
|
-
const lastUpdateTimestamp =
|
|
114
|
-
|
|
115
|
-
if (
|
|
116
|
-
(lastUpdateTimestamp ?? 0) + this._cacheTtlMs <
|
|
117
|
-
Date.now()
|
|
118
|
-
) {
|
|
108
|
+
const lastUpdateTimestamp = this._cache.getLastUpdateTimestamp(cacheId);
|
|
109
|
+
if ((lastUpdateTimestamp ?? 0) + this._cacheTtlMs < Date.now()) {
|
|
119
110
|
/*
|
|
120
111
|
* Here we are manually clearing 'cached' value retrieved from cache to force the data loading.
|
|
121
112
|
* But we save its value first to the backup variable to be able to return this value if ongoing
|
|
@@ -135,18 +126,12 @@ export class CacheAndConcurrentRequestsResolver {
|
|
|
135
126
|
isRetrievedCacheExpired &&
|
|
136
127
|
weStillHaveSomeTimeToProceedExecution
|
|
137
128
|
) {
|
|
138
|
-
const result =
|
|
139
|
-
await this._requestsManager.startCalculationOrWaitForActiveToFinish(
|
|
140
|
-
cacheId
|
|
141
|
-
);
|
|
129
|
+
const result = await this._requestsManager.startCalculationOrWaitForActiveToFinish(cacheId);
|
|
142
130
|
calculationId = typeof result === "string" ? result : null;
|
|
143
|
-
isWaitingForActiveCalculationSucceeded =
|
|
144
|
-
typeof result === "boolean" ? result : null;
|
|
131
|
+
isWaitingForActiveCalculationSucceeded = typeof result === "boolean" ? result : null;
|
|
145
132
|
cached = this._cache.get(cacheId);
|
|
146
|
-
isRetrievedCacheExpired =
|
|
147
|
-
|
|
148
|
-
weStillHaveSomeTimeToProceedExecution =
|
|
149
|
-
Date.now() - startedAtTimestamp < this._maxExecutionTimeMs;
|
|
133
|
+
isRetrievedCacheExpired = isWaitingForActiveCalculationSucceeded && cached == null;
|
|
134
|
+
weStillHaveSomeTimeToProceedExecution = Date.now() - startedAtTimestamp < this._maxExecutionTimeMs;
|
|
150
135
|
}
|
|
151
136
|
if (calculationId) {
|
|
152
137
|
return {
|
|
@@ -161,10 +146,7 @@ export class CacheAndConcurrentRequestsResolver {
|
|
|
161
146
|
cachedData: cached ?? cachedDataBackupIsPresentButExpired,
|
|
162
147
|
};
|
|
163
148
|
} catch (e) {
|
|
164
|
-
improveAndRethrow(
|
|
165
|
-
e,
|
|
166
|
-
`${this._bio}.getCachedOrWaitForCachedOrAcquireLock`
|
|
167
|
-
);
|
|
149
|
+
improveAndRethrow(e, `${this._bio}.getCachedOrWaitForCachedOrAcquireLock`);
|
|
168
150
|
}
|
|
169
151
|
}
|
|
170
152
|
|
|
@@ -242,11 +224,7 @@ export class CacheAndConcurrentRequestsResolver {
|
|
|
242
224
|
* till the end).
|
|
243
225
|
*/
|
|
244
226
|
if (sessionDependentData) {
|
|
245
|
-
this._cache.putSessionDependentData(
|
|
246
|
-
cacheId,
|
|
247
|
-
data,
|
|
248
|
-
this._getTtl()
|
|
249
|
-
);
|
|
227
|
+
this._cache.putSessionDependentData(cacheId, data, this._getTtl());
|
|
250
228
|
} else {
|
|
251
229
|
this._cache.put(cacheId, data, this._getTtl());
|
|
252
230
|
}
|
|
@@ -285,21 +263,13 @@ export class CacheAndConcurrentRequestsResolver {
|
|
|
285
263
|
* the flag signals whether data was changed during the processing or not
|
|
286
264
|
* @param [sessionDependent=true] {boolean} whether to mark the cache entry as session-dependent
|
|
287
265
|
*/
|
|
288
|
-
actualizeCachedData(
|
|
289
|
-
cacheId,
|
|
290
|
-
synchronousCurrentCacheProcessor,
|
|
291
|
-
sessionDependent = true
|
|
292
|
-
) {
|
|
266
|
+
actualizeCachedData(cacheId, synchronousCurrentCacheProcessor, sessionDependent = true) {
|
|
293
267
|
try {
|
|
294
268
|
const cached = this._cache.get(cacheId);
|
|
295
269
|
const result = synchronousCurrentCacheProcessor(cached);
|
|
296
270
|
if (result?.isModified && result?.data != null) {
|
|
297
271
|
if (sessionDependent) {
|
|
298
|
-
this._cache.putSessionDependentData(
|
|
299
|
-
cacheId,
|
|
300
|
-
result?.data,
|
|
301
|
-
this._getTtl()
|
|
302
|
-
);
|
|
272
|
+
this._cache.putSessionDependentData(cacheId, result?.data, this._getTtl());
|
|
303
273
|
} else {
|
|
304
274
|
this._cache.put(cacheId, result?.data, this._getTtl());
|
|
305
275
|
}
|
|
@@ -336,15 +306,9 @@ export class CacheAndConcurrentRequestsResolver {
|
|
|
336
306
|
|
|
337
307
|
markAsExpiredButDontRemove(key) {
|
|
338
308
|
if (this._removeExpiredCacheAutomatically) {
|
|
339
|
-
this._cache.markCacheItemAsExpiredButDontRemove(
|
|
340
|
-
key,
|
|
341
|
-
this._cacheTtlMs
|
|
342
|
-
);
|
|
309
|
+
this._cache.markCacheItemAsExpiredButDontRemove(key, this._cacheTtlMs);
|
|
343
310
|
} else {
|
|
344
|
-
this._cache.setLastUpdateTimestamp(
|
|
345
|
-
key,
|
|
346
|
-
Date.now() - this._cacheTtlMs - 1
|
|
347
|
-
);
|
|
311
|
+
this._cache.setLastUpdateTimestamp(key, Date.now() - this._cacheTtlMs - 1);
|
|
348
312
|
}
|
|
349
313
|
this._requestsManager.finishAllActiveCalculations(key);
|
|
350
314
|
}
|
|
@@ -378,24 +342,16 @@ class ManagerOfRequestsToTheSameResource {
|
|
|
378
342
|
*/
|
|
379
343
|
async startCalculationOrWaitForActiveToFinish(requestHash) {
|
|
380
344
|
try {
|
|
381
|
-
const activeCalculationIdForHash =
|
|
382
|
-
this._activeCalculationsIds.get(requestHash);
|
|
345
|
+
const activeCalculationIdForHash = this._activeCalculationsIds.get(requestHash);
|
|
383
346
|
if (activeCalculationIdForHash == null) {
|
|
384
347
|
const id = v4();
|
|
385
348
|
this._activeCalculationsIds.set(requestHash, id);
|
|
386
349
|
return id;
|
|
387
350
|
}
|
|
388
351
|
|
|
389
|
-
return await this._waitForCalculationIdToFinish(
|
|
390
|
-
requestHash,
|
|
391
|
-
activeCalculationIdForHash,
|
|
392
|
-
0
|
|
393
|
-
);
|
|
352
|
+
return await this._waitForCalculationIdToFinish(requestHash, activeCalculationIdForHash, 0);
|
|
394
353
|
} catch (e) {
|
|
395
|
-
Logger.logError(
|
|
396
|
-
e,
|
|
397
|
-
`startCalculationOrWaitForActiveToFinish_${this.bio}`
|
|
398
|
-
);
|
|
354
|
+
Logger.logError(e, `startCalculationOrWaitForActiveToFinish_${this.bio}`);
|
|
399
355
|
}
|
|
400
356
|
|
|
401
357
|
return null;
|
|
@@ -422,12 +378,7 @@ class ManagerOfRequestsToTheSameResource {
|
|
|
422
378
|
currentNext.push(nextId);
|
|
423
379
|
this._nextCalculationIds.set(requestHash, currentNext);
|
|
424
380
|
|
|
425
|
-
const waitingResult = await this._waitForCalculationIdToFinish(
|
|
426
|
-
requestHash,
|
|
427
|
-
activeId,
|
|
428
|
-
0,
|
|
429
|
-
nextId
|
|
430
|
-
);
|
|
381
|
+
const waitingResult = await this._waitForCalculationIdToFinish(requestHash, activeId, 0, nextId);
|
|
431
382
|
return {
|
|
432
383
|
result: waitingResult,
|
|
433
384
|
lockId: waitingResult ? nextId : undefined,
|
|
@@ -458,11 +409,8 @@ class ManagerOfRequestsToTheSameResource {
|
|
|
458
409
|
|
|
459
410
|
finishAllActiveCalculations(keyPart = "") {
|
|
460
411
|
try {
|
|
461
|
-
Array.from(this._activeCalculationsIds.keys()).forEach(
|
|
462
|
-
if (
|
|
463
|
-
typeof hash === "string" &&
|
|
464
|
-
new RegExp(keyPart).test(hash)
|
|
465
|
-
) {
|
|
412
|
+
Array.from(this._activeCalculationsIds.keys()).forEach(hash => {
|
|
413
|
+
if (typeof hash === "string" && new RegExp(keyPart).test(hash)) {
|
|
466
414
|
this.finishActiveCalculation(hash);
|
|
467
415
|
}
|
|
468
416
|
});
|
|
@@ -509,11 +457,7 @@ class ManagerOfRequestsToTheSameResource {
|
|
|
509
457
|
}
|
|
510
458
|
|
|
511
459
|
const currentId = this._activeCalculationsIds.get(requestHash);
|
|
512
|
-
if (
|
|
513
|
-
waitForCalculationId == null
|
|
514
|
-
? currentId !== activeCalculationId
|
|
515
|
-
: currentId === waitForCalculationId
|
|
516
|
-
) {
|
|
460
|
+
if (waitForCalculationId == null ? currentId !== activeCalculationId : currentId === waitForCalculationId) {
|
|
517
461
|
/* We return true depending on the usage of this function:
|
|
518
462
|
* 1. if there is calculation id that we should wait for to become an active then we return true only
|
|
519
463
|
* if this id becomes the active one.
|
|
@@ -535,11 +479,7 @@ class ManagerOfRequestsToTheSameResource {
|
|
|
535
479
|
setTimeout(function () {
|
|
536
480
|
try {
|
|
537
481
|
resolve(
|
|
538
|
-
it._waitForCalculationIdToFinish(
|
|
539
|
-
requestHash,
|
|
540
|
-
activeCalculationId,
|
|
541
|
-
attemptIndex + 1
|
|
542
|
-
)
|
|
482
|
+
it._waitForCalculationIdToFinish(requestHash, activeCalculationId, attemptIndex + 1)
|
|
543
483
|
);
|
|
544
484
|
} catch (e) {
|
|
545
485
|
reject(e);
|
|
@@ -548,11 +488,7 @@ class ManagerOfRequestsToTheSameResource {
|
|
|
548
488
|
});
|
|
549
489
|
}
|
|
550
490
|
} catch (e) {
|
|
551
|
-
Logger.logError(
|
|
552
|
-
e,
|
|
553
|
-
"_waitForCalculationIdToFinish",
|
|
554
|
-
"Failed to wait for active calculation id change."
|
|
555
|
-
);
|
|
491
|
+
Logger.logError(e, "_waitForCalculationIdToFinish", "Failed to wait for active calculation id change.");
|
|
556
492
|
return false;
|
|
557
493
|
}
|
|
558
494
|
}
|