@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,198 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
import s from "./input.module.scss";
|
|
5
|
+
|
|
6
|
+
import { useCallHandlingErrors } from "../../hooks/useCallHandlingErrors.js";
|
|
7
|
+
import { logErrorOrOutputToConsole } from "../../../common/errorUtils.js";
|
|
8
|
+
|
|
9
|
+
import { Close } from "../buttons/Close/Close.jsx";
|
|
10
|
+
import { Validation } from "../Validation/Validation.jsx";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Input component for forms.
|
|
14
|
+
*
|
|
15
|
+
* @component
|
|
16
|
+
* @param {string} [type="text"] - The type of input (e.g., "text", "number", "email").
|
|
17
|
+
* @param {string} [name=""] - The name of the input field.
|
|
18
|
+
* @param {function} [onChange=() => {}] - Function called when the input value changes.
|
|
19
|
+
* @param {string} [alertText=""] - Text for alert messages.
|
|
20
|
+
* @param {string} [placeholder=""] - Placeholder text for the input.
|
|
21
|
+
* @param {string} [className=""] - Additional CSS classes for styling.
|
|
22
|
+
* @param {string} [defaultValue=""] - Default value for the input.
|
|
23
|
+
* @param {boolean} [isBigHeight=false] - Whether the input has a larger height.
|
|
24
|
+
* @param {boolean} [isSmallHeight=false] - Whether the input has a smaller height.
|
|
25
|
+
* @param {string} [label=""] - Label text for the input.
|
|
26
|
+
* @param {string} [id=null] - Unique ID for the input.
|
|
27
|
+
* @param {string} [value=""] - Value of the input.
|
|
28
|
+
* @param {string} [successAlertText=""] - Text for success alert messages.
|
|
29
|
+
* @param {boolean} [disabled=false] - Whether the input is disabled.
|
|
30
|
+
* @param {function} [onKeyUp=() => {}] - Function called on key up event.
|
|
31
|
+
* @param {boolean} [autoFocus=false] - Whether the input should be autofocused.
|
|
32
|
+
* @param {boolean} [fillWidth=false] - Whether the input should fill the width of its container.
|
|
33
|
+
* @param {boolean} [clearButton=false] - Whether to show a clear button for the input.
|
|
34
|
+
* @param {boolean} [imageBackground=false] - Whether the input has an image background.
|
|
35
|
+
* @param {boolean} [errorEncountered=false] - Whether an error has been encountered for the input.
|
|
36
|
+
*/
|
|
37
|
+
export const Input = forwardRef(
|
|
38
|
+
(
|
|
39
|
+
{
|
|
40
|
+
type = "text",
|
|
41
|
+
name = "",
|
|
42
|
+
onChange = () => {},
|
|
43
|
+
alertText = "",
|
|
44
|
+
placeholder = "",
|
|
45
|
+
className = "",
|
|
46
|
+
defaultValue = "",
|
|
47
|
+
isBigHeight = false,
|
|
48
|
+
isSmallHeight = false,
|
|
49
|
+
label = "",
|
|
50
|
+
id = null,
|
|
51
|
+
value = "",
|
|
52
|
+
successAlertText = "",
|
|
53
|
+
disabled = false,
|
|
54
|
+
onKeyUp = (event) => {},
|
|
55
|
+
autoFocus = false,
|
|
56
|
+
fillWidth = false,
|
|
57
|
+
clearButton = false,
|
|
58
|
+
imageBackground = false,
|
|
59
|
+
errorEncountered = false,
|
|
60
|
+
},
|
|
61
|
+
ref
|
|
62
|
+
) => {
|
|
63
|
+
const handleError = useCallHandlingErrors();
|
|
64
|
+
|
|
65
|
+
const handleClearButtonClick = () => {
|
|
66
|
+
onChange({ target: { value: "" } });
|
|
67
|
+
try {
|
|
68
|
+
ref.current.focus();
|
|
69
|
+
} catch (e) {
|
|
70
|
+
logErrorOrOutputToConsole(
|
|
71
|
+
"Input clear button will not work unless you provide a ref to the Input. Please pass a 'ref' parameter to the Input or disable the clear button."
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<div
|
|
78
|
+
className={[
|
|
79
|
+
s["input"],
|
|
80
|
+
isBigHeight ? s["big-height"] : "",
|
|
81
|
+
isSmallHeight ? s["small-height"] : "",
|
|
82
|
+
disabled ? s["disabled"] : "",
|
|
83
|
+
fillWidth ? s["fill-width"] : "",
|
|
84
|
+
imageBackground ? s["image-background"] : "",
|
|
85
|
+
].join(" ")}
|
|
86
|
+
>
|
|
87
|
+
{label ? (
|
|
88
|
+
<label htmlFor={id} className={s["input-label"]}>
|
|
89
|
+
{label}
|
|
90
|
+
</label>
|
|
91
|
+
) : null}
|
|
92
|
+
|
|
93
|
+
{clearButton ? (
|
|
94
|
+
<div className={s["input-clear-button"]}>
|
|
95
|
+
<Close
|
|
96
|
+
onClick={handleClearButtonClick}
|
|
97
|
+
color={"dark-invert"}
|
|
98
|
+
/>
|
|
99
|
+
</div>
|
|
100
|
+
) : (
|
|
101
|
+
""
|
|
102
|
+
)}
|
|
103
|
+
|
|
104
|
+
{defaultValue ? (
|
|
105
|
+
<input
|
|
106
|
+
id={id}
|
|
107
|
+
type={type}
|
|
108
|
+
name={name}
|
|
109
|
+
onChange={(e) => handleError(onChange, e)}
|
|
110
|
+
placeholder={placeholder}
|
|
111
|
+
className={
|
|
112
|
+
className +
|
|
113
|
+
(errorEncountered
|
|
114
|
+
? " " + s["error-encountered"]
|
|
115
|
+
: "")
|
|
116
|
+
}
|
|
117
|
+
defaultValue={defaultValue}
|
|
118
|
+
disabled={disabled}
|
|
119
|
+
onKeyUp={(event) => onKeyUp(event)}
|
|
120
|
+
autoFocus={autoFocus}
|
|
121
|
+
ref={ref}
|
|
122
|
+
/>
|
|
123
|
+
) : (
|
|
124
|
+
<input
|
|
125
|
+
id={id}
|
|
126
|
+
type={type}
|
|
127
|
+
name={name}
|
|
128
|
+
onChange={(e) => handleError(onChange, e)}
|
|
129
|
+
placeholder={placeholder}
|
|
130
|
+
className={
|
|
131
|
+
className +
|
|
132
|
+
(errorEncountered
|
|
133
|
+
? " " + s["error-encountered"]
|
|
134
|
+
: "")
|
|
135
|
+
}
|
|
136
|
+
value={value}
|
|
137
|
+
disabled={disabled}
|
|
138
|
+
onKeyUp={(event) => onKeyUp(event)}
|
|
139
|
+
autoFocus={autoFocus}
|
|
140
|
+
ref={ref}
|
|
141
|
+
/>
|
|
142
|
+
)}
|
|
143
|
+
|
|
144
|
+
{alertText || successAlertText ? (
|
|
145
|
+
<Validation
|
|
146
|
+
text={alertText || successAlertText}
|
|
147
|
+
isSuccessAlert={!alertText}
|
|
148
|
+
/>
|
|
149
|
+
) : null}
|
|
150
|
+
</div>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
Input.propTypes = {
|
|
156
|
+
type: PropTypes.string,
|
|
157
|
+
name: PropTypes.string,
|
|
158
|
+
onChange: PropTypes.func,
|
|
159
|
+
alertText: PropTypes.string,
|
|
160
|
+
placeholder: PropTypes.string,
|
|
161
|
+
className: PropTypes.string,
|
|
162
|
+
defaultValue: PropTypes.string,
|
|
163
|
+
isBigHeight: PropTypes.bool,
|
|
164
|
+
isSmallHeight: PropTypes.bool,
|
|
165
|
+
label: PropTypes.string,
|
|
166
|
+
id: PropTypes.string,
|
|
167
|
+
value: PropTypes.string,
|
|
168
|
+
successAlertText: PropTypes.string,
|
|
169
|
+
disabled: PropTypes.bool,
|
|
170
|
+
onKeyUp: PropTypes.func,
|
|
171
|
+
autoFocus: PropTypes.bool,
|
|
172
|
+
fillWidth: PropTypes.bool,
|
|
173
|
+
clearButton: PropTypes.bool,
|
|
174
|
+
imageBackground: PropTypes.bool,
|
|
175
|
+
errorEncountered: PropTypes.bool,
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
Input.defaultProps = {
|
|
179
|
+
type: "text",
|
|
180
|
+
onChange: () => {},
|
|
181
|
+
alertText: "",
|
|
182
|
+
placeholder: "",
|
|
183
|
+
className: "",
|
|
184
|
+
defaultValue: "",
|
|
185
|
+
isBigHeight: false,
|
|
186
|
+
isSmallHeight: false,
|
|
187
|
+
label: "",
|
|
188
|
+
id: null,
|
|
189
|
+
value: "",
|
|
190
|
+
successAlertText: "",
|
|
191
|
+
disabled: false,
|
|
192
|
+
onKeyUp: () => {},
|
|
193
|
+
autoFocus: false,
|
|
194
|
+
fillWidth: false,
|
|
195
|
+
clearButton: false,
|
|
196
|
+
imageBackground: false,
|
|
197
|
+
errorEncountered: false,
|
|
198
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
@import "../../../../styles/index";
|
|
2
|
+
|
|
3
|
+
.input {
|
|
4
|
+
position: relative;
|
|
5
|
+
|
|
6
|
+
&.big-height {
|
|
7
|
+
input {
|
|
8
|
+
min-height: 117px;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&.small-height {
|
|
13
|
+
input {
|
|
14
|
+
min-height: 48px;
|
|
15
|
+
padding: Padding("2") Padding("5");
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&.disabled > input {
|
|
20
|
+
opacity: 0.5;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.fill-width {
|
|
24
|
+
width: 100%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
input {
|
|
28
|
+
@extend %text-medium;
|
|
29
|
+
padding: Padding("5");
|
|
30
|
+
border-radius: 7px;
|
|
31
|
+
background: SolidColor(lightsmoke);
|
|
32
|
+
border: 0;
|
|
33
|
+
color: SolidColor("grey");
|
|
34
|
+
width: 100%;
|
|
35
|
+
min-height: 66px;
|
|
36
|
+
font-size: 16px;
|
|
37
|
+
vertical-align: center;
|
|
38
|
+
appearance: none;
|
|
39
|
+
transition: 0.2s all ease;
|
|
40
|
+
box-shadow: $shadowOutlineStatic;
|
|
41
|
+
|
|
42
|
+
&.error-encountered {
|
|
43
|
+
box-shadow: $shadowOutlineError !important;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&::placeholder {
|
|
47
|
+
color: SolidColor("grey");
|
|
48
|
+
font-size: 16px;
|
|
49
|
+
vertical-align: center;
|
|
50
|
+
@extend %text-medium;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@media (hover: hover) {
|
|
55
|
+
&-clear-button:hover:not(:active) + input,
|
|
56
|
+
input:hover {
|
|
57
|
+
&:not(:focus) {
|
|
58
|
+
box-shadow: $shadowOutlineHover;
|
|
59
|
+
transition: 0.02s all ease;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&-clear-button:active + input,
|
|
65
|
+
input:focus {
|
|
66
|
+
box-shadow: $shadowOutlineActive;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&.image-background {
|
|
70
|
+
input {
|
|
71
|
+
box-shadow: 0px 10px 30px rgba(0, 0, 0, 0);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@media (hover: hover) {
|
|
75
|
+
&-clear-button:hover:not(:active) + input,
|
|
76
|
+
input:hover {
|
|
77
|
+
&:not(:focus) {
|
|
78
|
+
background-color: $white;
|
|
79
|
+
box-shadow: 0px 10px 30px rgba(0, 0, 0, 0);
|
|
80
|
+
transition: 0.02s all ease;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
input:focus {
|
|
86
|
+
background-color: $white;
|
|
87
|
+
box-shadow: 0px 10px 30px rgba(0, 0, 0, 0.1);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&-clear-button {
|
|
92
|
+
position: absolute;
|
|
93
|
+
right: 20px;
|
|
94
|
+
top: 0;
|
|
95
|
+
height: 100%;
|
|
96
|
+
display: flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&-label {
|
|
101
|
+
@include typograpy(h6);
|
|
102
|
+
font-weight: $semi-bold;
|
|
103
|
+
color: SolidColor("grey");
|
|
104
|
+
margin-bottom: Margin("2");
|
|
105
|
+
display: block;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
import s from "./notice-icon.module.scss";
|
|
5
|
+
|
|
6
|
+
import { handleClickOutside } from "../../utils/uiUtils.js";
|
|
7
|
+
import { Tooltip } from "../Tooltip/Tooltip.jsx";
|
|
8
|
+
import NoticeQuestionIcon from "../../../assets/wrappedImages/noticeQuestionIcon.jsx";
|
|
9
|
+
|
|
10
|
+
import { TOOLTIP_POSITIONS } from "../../../constants/atoms/Tooltip/tooltip.jsx";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A component that displays a notice icon with optional tooltip.
|
|
14
|
+
*
|
|
15
|
+
* @component
|
|
16
|
+
* @param {string} noticeText - The text to display inside the tooltip.
|
|
17
|
+
* @param {string} [titleNoticeIcon] - The source URL for the icon displayed on the notice.
|
|
18
|
+
* @param {string} tooltipPosition - Position for the tooltip relative to the icon.
|
|
19
|
+
*/
|
|
20
|
+
export const NoticeIcon = ({
|
|
21
|
+
noticeText,
|
|
22
|
+
titleNoticeIcon = "",
|
|
23
|
+
tooltipPosition = TOOLTIP_POSITIONS.TOP,
|
|
24
|
+
}) => {
|
|
25
|
+
const [showTooltip, setShowTooltip] = useState(false);
|
|
26
|
+
|
|
27
|
+
const noticeRef = useRef();
|
|
28
|
+
|
|
29
|
+
useEffect(
|
|
30
|
+
() => handleClickOutside([noticeRef], () => setShowTooltip(false)),
|
|
31
|
+
[]
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div ref={noticeRef} className={s["notice-icon"]}>
|
|
36
|
+
{titleNoticeIcon ? (
|
|
37
|
+
<img
|
|
38
|
+
src={titleNoticeIcon}
|
|
39
|
+
alt="title icon"
|
|
40
|
+
onClick={() => setShowTooltip((prev) => !prev)}
|
|
41
|
+
className={s["notice-icon-image"]}
|
|
42
|
+
/>
|
|
43
|
+
) : (
|
|
44
|
+
<div className={s["notice-icon-image"]}>
|
|
45
|
+
<NoticeQuestionIcon />
|
|
46
|
+
</div>
|
|
47
|
+
)}
|
|
48
|
+
<div className={s["notice-icon-tooltip"]}>
|
|
49
|
+
<Tooltip
|
|
50
|
+
showTooltip={showTooltip}
|
|
51
|
+
handleClick={() => setShowTooltip(false)}
|
|
52
|
+
wide={true}
|
|
53
|
+
position={tooltipPosition}
|
|
54
|
+
>
|
|
55
|
+
{noticeText}
|
|
56
|
+
</Tooltip>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
NoticeIcon.propTypes = {
|
|
63
|
+
noticeText: PropTypes.string.isRequired,
|
|
64
|
+
titleNoticeIcon: PropTypes.string,
|
|
65
|
+
tooltipPosition: PropTypes.oneOf(Object.values(TOOLTIP_POSITIONS)),
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
NoticeIcon.defaultProps = {
|
|
69
|
+
titleNoticeIcon: "",
|
|
70
|
+
tooltipPosition: TOOLTIP_POSITIONS.TOP,
|
|
71
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
import { logErrorOrOutputToConsole } from "../../../common/errorUtils";
|
|
5
|
+
import { generateQrAndShowInCanvas } from "../../../common/adapters/qrUtils";
|
|
6
|
+
|
|
7
|
+
import s from "./qr-code.module.scss";
|
|
8
|
+
|
|
9
|
+
export const QrCode = ({ address }) => {
|
|
10
|
+
const canvasRef = useRef();
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
(async () => {
|
|
14
|
+
try {
|
|
15
|
+
if (address) {
|
|
16
|
+
canvasRef.current.innerHTML =
|
|
17
|
+
await generateQrAndShowInCanvas(address);
|
|
18
|
+
}
|
|
19
|
+
} catch (e) {
|
|
20
|
+
logErrorOrOutputToConsole(e);
|
|
21
|
+
}
|
|
22
|
+
})();
|
|
23
|
+
}, [address]);
|
|
24
|
+
|
|
25
|
+
return <div className={s["qr-code"]} ref={canvasRef} />;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
QrCode.propTypes = {
|
|
29
|
+
address: PropTypes.string.isRequired,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
QrCode.defaultProps = {
|
|
33
|
+
address: "",
|
|
34
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import s from "./rate-selector.module.scss";
|
|
4
|
+
|
|
5
|
+
export const RateSelector = ({
|
|
6
|
+
isFixed = false,
|
|
7
|
+
setIsFixed = () => {},
|
|
8
|
+
translations = {
|
|
9
|
+
floatingRate: "Floating rate",
|
|
10
|
+
fixedRate: "Fixed rate",
|
|
11
|
+
},
|
|
12
|
+
}) => {
|
|
13
|
+
return (
|
|
14
|
+
<div className={s["rate-selector"]}>
|
|
15
|
+
<div
|
|
16
|
+
className={`${s["rate-selector-item"]} ${
|
|
17
|
+
!isFixed ? s["selected"] : ""
|
|
18
|
+
}`}
|
|
19
|
+
onClick={() => setIsFixed(false)}
|
|
20
|
+
>
|
|
21
|
+
<div className={s["rate-selector-item-text"]}>
|
|
22
|
+
{translations.floatingRate}
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
<div
|
|
26
|
+
className={`${s["rate-selector-item"]} ${
|
|
27
|
+
isFixed ? s["selected"] : ""
|
|
28
|
+
}`}
|
|
29
|
+
onClick={() => setIsFixed(true)}
|
|
30
|
+
>
|
|
31
|
+
<div className={s["rate-selector-item-text"]}>
|
|
32
|
+
{translations.fixedRate}
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@import "../../../../styles/index";
|
|
2
|
+
|
|
3
|
+
.rate-selector {
|
|
4
|
+
background-color: SolidColor("lightsmoke");
|
|
5
|
+
border-radius: 8px;
|
|
6
|
+
padding: 4px;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
gap: Margin("1");
|
|
10
|
+
user-select: none;
|
|
11
|
+
width: 100%;
|
|
12
|
+
|
|
13
|
+
&-item {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: row;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
align-items: center;
|
|
18
|
+
padding: Padding("3") Padding("3");
|
|
19
|
+
flex: 1 1;
|
|
20
|
+
border-radius: 4px;
|
|
21
|
+
gap: Margin("1");
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
transition: 0.2s all $transitionEaseOut;
|
|
24
|
+
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0);
|
|
25
|
+
|
|
26
|
+
@media (hover: hover) {
|
|
27
|
+
&:not(.selected):hover {
|
|
28
|
+
box-shadow: 0px 0px 0px 1px SolidColor("smoke");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&:not(.selected):active {
|
|
33
|
+
box-shadow: 0px 0px 0px 1px SolidColor("smoke");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&.selected {
|
|
37
|
+
background: $white;
|
|
38
|
+
color: SolidColor("tosca");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&-text {
|
|
42
|
+
font-weight: $semi-bold;
|
|
43
|
+
text-align: center;
|
|
44
|
+
font-size: 16px;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
export const SupportChat = ({
|
|
5
|
+
url,
|
|
6
|
+
websiteToken,
|
|
7
|
+
welcomeMessage = "",
|
|
8
|
+
locale = "en",
|
|
9
|
+
}) => {
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
window.chatwootSettings = {
|
|
12
|
+
position: "right",
|
|
13
|
+
type: "standard",
|
|
14
|
+
launcherTitle: welcomeMessage,
|
|
15
|
+
locale: locale,
|
|
16
|
+
};
|
|
17
|
+
(function (d, t) {
|
|
18
|
+
var BASE_URL = url;
|
|
19
|
+
var g = d.createElement(t),
|
|
20
|
+
s = d.getElementsByTagName(t)[0];
|
|
21
|
+
g.src = BASE_URL + "/packs/js/sdk.js";
|
|
22
|
+
g.defer = true;
|
|
23
|
+
g.async = true;
|
|
24
|
+
s.parentNode.insertBefore(g, s);
|
|
25
|
+
g.onload = function () {
|
|
26
|
+
window.chatwootSDK.run({
|
|
27
|
+
websiteToken: websiteToken,
|
|
28
|
+
baseUrl: BASE_URL,
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
})(document, "script");
|
|
32
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
33
|
+
}, []);
|
|
34
|
+
|
|
35
|
+
return null;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
SupportChat.propTypes = {
|
|
39
|
+
url: PropTypes.string.isRequired,
|
|
40
|
+
websiteToken: PropTypes.string.isRequired,
|
|
41
|
+
welcomeMessage: PropTypes.string,
|
|
42
|
+
locale: PropTypes.string,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
SupportChat.defaultProps = {
|
|
46
|
+
welcomeMessage: "",
|
|
47
|
+
locale: "en",
|
|
48
|
+
};
|