@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.
Files changed (317) hide show
  1. package/.gitlab-ci.yml +29 -0
  2. package/.husky/commit-msg +14 -0
  3. package/.husky/pre-push +1 -0
  4. package/CHANGELOG.md +0 -0
  5. package/README.md +27 -18
  6. package/coverage/base.css +224 -0
  7. package/coverage/block-navigation.js +87 -0
  8. package/coverage/clover.xml +17210 -0
  9. package/coverage/coverage-final.json +160 -0
  10. package/coverage/favicon.png +0 -0
  11. package/coverage/index.html +1241 -0
  12. package/coverage/prettify.css +1 -0
  13. package/coverage/prettify.js +2 -0
  14. package/coverage/sort-arrow-sprite.png +0 -0
  15. package/coverage/sorter.js +196 -0
  16. package/coverage/ui-kit/index.html +116 -0
  17. package/coverage/ui-kit/index.js.html +88 -0
  18. package/coverage/ui-kit/src/assets/wrappedImages/arrowIcon.jsx.html +142 -0
  19. package/coverage/ui-kit/src/assets/wrappedImages/arrowTosca.jsx.html +145 -0
  20. package/coverage/ui-kit/src/assets/wrappedImages/arrowWhite.jsx.html +145 -0
  21. package/coverage/ui-kit/src/assets/wrappedImages/darkRectangle.jsx.html +139 -0
  22. package/coverage/ui-kit/src/assets/wrappedImages/determinedError.jsx.html +472 -0
  23. package/coverage/ui-kit/src/assets/wrappedImages/failedValidationIcon.jsx.html +244 -0
  24. package/coverage/ui-kit/src/assets/wrappedImages/index.html +251 -0
  25. package/coverage/ui-kit/src/assets/wrappedImages/infoIcon.jsx.html +151 -0
  26. package/coverage/ui-kit/src/assets/wrappedImages/noticeQuestionIcon.jsx.html +265 -0
  27. package/coverage/ui-kit/src/assets/wrappedImages/successfulValidationIcon.jsx.html +205 -0
  28. package/coverage/ui-kit/src/assets/wrappedImages/walletIcon.jsx.html +199 -0
  29. package/coverage/ui-kit/src/common/adapters/axiosAdapter.js.html +190 -0
  30. package/coverage/ui-kit/src/common/adapters/index.html +131 -0
  31. package/coverage/ui-kit/src/common/adapters/qrUtils.js.html +139 -0
  32. package/coverage/ui-kit/src/common/amountUtils.js.html +1393 -0
  33. package/coverage/ui-kit/src/common/errorUtils.js.html +211 -0
  34. package/coverage/ui-kit/src/common/external-apis/apiGroups.js.html +250 -0
  35. package/coverage/ui-kit/src/common/external-apis/index.html +131 -0
  36. package/coverage/ui-kit/src/common/external-apis/ipAddressProviders.js.html +499 -0
  37. package/coverage/ui-kit/src/common/fiatCurrenciesService.js.html +568 -0
  38. package/coverage/ui-kit/src/common/index.html +146 -0
  39. package/coverage/ui-kit/src/common/models/blockchain.js.html +115 -0
  40. package/coverage/ui-kit/src/common/models/coin.js.html +556 -0
  41. package/coverage/ui-kit/src/common/models/index.html +146 -0
  42. package/coverage/ui-kit/src/common/models/protocol.js.html +100 -0
  43. package/coverage/ui-kit/src/common/utils/cache.js.html +889 -0
  44. package/coverage/ui-kit/src/common/utils/emailAPI.js.html +139 -0
  45. package/coverage/ui-kit/src/common/utils/index.html +161 -0
  46. package/coverage/ui-kit/src/common/utils/logging/index.html +131 -0
  47. package/coverage/ui-kit/src/common/utils/logging/logger.js.html +229 -0
  48. package/coverage/ui-kit/src/common/utils/logging/logsStorage.js.html +268 -0
  49. package/coverage/ui-kit/src/common/utils/postponeExecution.js.html +118 -0
  50. package/coverage/ui-kit/src/common/utils/safeStringify.js.html +235 -0
  51. package/coverage/ui-kit/src/components/atoms/AssetIcon/AssetIcon.jsx.html +277 -0
  52. package/coverage/ui-kit/src/components/atoms/AssetIcon/index.html +116 -0
  53. package/coverage/ui-kit/src/components/atoms/AssetSelection/AssetSelection.jsx.html +310 -0
  54. package/coverage/ui-kit/src/components/atoms/AssetSelection/index.html +116 -0
  55. package/coverage/ui-kit/src/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +217 -0
  56. package/coverage/ui-kit/src/components/atoms/BackgroundTitle/index.html +116 -0
  57. package/coverage/ui-kit/src/components/atoms/InformationMessage/InformationMessage.jsx.html +265 -0
  58. package/coverage/ui-kit/src/components/atoms/InformationMessage/index.html +116 -0
  59. package/coverage/ui-kit/src/components/atoms/Input/Input.jsx.html +679 -0
  60. package/coverage/ui-kit/src/components/atoms/Input/index.html +116 -0
  61. package/coverage/ui-kit/src/components/atoms/LoadingDots/LoadingDots.jsx.html +256 -0
  62. package/coverage/ui-kit/src/components/atoms/LoadingDots/index.html +116 -0
  63. package/coverage/ui-kit/src/components/atoms/NoticeIcon/NoticeIcon.jsx.html +298 -0
  64. package/coverage/ui-kit/src/components/atoms/NoticeIcon/index.html +116 -0
  65. package/coverage/ui-kit/src/components/atoms/QrCode/QrCode.jsx.html +187 -0
  66. package/coverage/ui-kit/src/components/atoms/QrCode/index.html +116 -0
  67. package/coverage/ui-kit/src/components/atoms/RateSelector/RateSelector.jsx.html +196 -0
  68. package/coverage/ui-kit/src/components/atoms/RateSelector/index.html +116 -0
  69. package/coverage/ui-kit/src/components/atoms/SupportChat/SupportChat.jsx.html +229 -0
  70. package/coverage/ui-kit/src/components/atoms/SupportChat/index.html +116 -0
  71. package/coverage/ui-kit/src/components/atoms/Textarea/Textarea.jsx.html +559 -0
  72. package/coverage/ui-kit/src/components/atoms/Textarea/index.html +116 -0
  73. package/coverage/ui-kit/src/components/atoms/TitleBox/TitleBox.jsx.html +577 -0
  74. package/coverage/ui-kit/src/components/atoms/TitleBox/index.html +116 -0
  75. package/coverage/ui-kit/src/components/atoms/Tooltip/Tooltip.jsx.html +295 -0
  76. package/coverage/ui-kit/src/components/atoms/Tooltip/index.html +116 -0
  77. package/coverage/ui-kit/src/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +325 -0
  78. package/coverage/ui-kit/src/components/atoms/TwoLinesOfText/index.html +116 -0
  79. package/coverage/ui-kit/src/components/atoms/Validation/Validation.jsx.html +202 -0
  80. package/coverage/ui-kit/src/components/atoms/Validation/index.html +116 -0
  81. package/coverage/ui-kit/src/components/atoms/buttons/Button/Button.jsx.html +802 -0
  82. package/coverage/ui-kit/src/components/atoms/buttons/Button/index.html +116 -0
  83. package/coverage/ui-kit/src/components/atoms/buttons/Close/Close.jsx.html +262 -0
  84. package/coverage/ui-kit/src/components/atoms/buttons/Close/index.html +116 -0
  85. package/coverage/ui-kit/src/components/atoms/buttons/LinkButton/LinkButton.jsx.html +430 -0
  86. package/coverage/ui-kit/src/components/atoms/buttons/LinkButton/index.html +116 -0
  87. package/coverage/ui-kit/src/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +469 -0
  88. package/coverage/ui-kit/src/components/atoms/buttons/RadioButtonWithText/index.html +116 -0
  89. package/coverage/ui-kit/src/components/hooks/index.html +131 -0
  90. package/coverage/ui-kit/src/components/hooks/useCallHandlingErrors.js.html +163 -0
  91. package/coverage/ui-kit/src/components/hooks/useReferredState.js.html +157 -0
  92. package/coverage/ui-kit/src/components/molecules/AmountInput/AmountInput.jsx.html +1348 -0
  93. package/coverage/ui-kit/src/components/molecules/AmountInput/index.html +116 -0
  94. package/coverage/ui-kit/src/components/molecules/CoinPicker/CoinPicker.jsx.html +2011 -0
  95. package/coverage/ui-kit/src/components/molecules/CoinPicker/index.html +116 -0
  96. package/coverage/ui-kit/src/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +205 -0
  97. package/coverage/ui-kit/src/components/molecules/LineWithIconLink/index.html +116 -0
  98. package/coverage/ui-kit/src/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +175 -0
  99. package/coverage/ui-kit/src/components/molecules/TitledLineWithIconLink/index.html +116 -0
  100. package/coverage/ui-kit/src/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +283 -0
  101. package/coverage/ui-kit/src/components/organisms/CoinPickerDialogStep/index.html +116 -0
  102. package/coverage/ui-kit/src/components/organisms/Dialog/Dialog.jsx.html +1630 -0
  103. package/coverage/ui-kit/src/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +451 -0
  104. package/coverage/ui-kit/src/components/organisms/Dialog/DialogButtons/index.html +116 -0
  105. package/coverage/ui-kit/src/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +2146 -0
  106. package/coverage/ui-kit/src/components/organisms/Dialog/DialogStep/index.html +116 -0
  107. package/coverage/ui-kit/src/components/organisms/Dialog/index.html +116 -0
  108. package/coverage/ui-kit/src/components/organisms/SwapForm/SwapForm.jsx.html +3883 -0
  109. package/coverage/ui-kit/src/components/organisms/SwapForm/index.html +116 -0
  110. package/coverage/ui-kit/src/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +316 -0
  111. package/coverage/ui-kit/src/components/templates/DeterminedErrorDialogStep/index.html +116 -0
  112. package/coverage/ui-kit/src/components/utils/index.html +161 -0
  113. package/coverage/ui-kit/src/components/utils/inputValueProviders.js.html +259 -0
  114. package/coverage/ui-kit/src/components/utils/textUtils.js.html +139 -0
  115. package/coverage/ui-kit/src/components/utils/uiUtils.js.html +127 -0
  116. package/coverage/ui-kit/src/components/utils/urlQueryUtils.js.html +346 -0
  117. package/coverage/ui-kit/src/constants/atoms/Close/close.jsx.html +100 -0
  118. package/coverage/ui-kit/src/constants/atoms/Close/index.html +116 -0
  119. package/coverage/ui-kit/src/constants/atoms/LinkButton/index.html +116 -0
  120. package/coverage/ui-kit/src/constants/atoms/LinkButton/linkButton.jsx.html +103 -0
  121. package/coverage/ui-kit/src/constants/atoms/Tooltip/index.html +116 -0
  122. package/coverage/ui-kit/src/constants/atoms/Tooltip/tooltip.jsx.html +109 -0
  123. package/coverage/ui-kit/src/constants/globalConstants.jsx.html +97 -0
  124. package/coverage/ui-kit/src/constants/index.html +116 -0
  125. package/coverage/ui-kit/src/constants/organisms/dialog/DialogStep/dialogStep.js.html +88 -0
  126. package/coverage/ui-kit/src/constants/organisms/dialog/DialogStep/index.html +116 -0
  127. package/coverage/ui-kit/src/constants/organisms/dialog/dialog.js.html +172 -0
  128. package/coverage/ui-kit/src/constants/organisms/dialog/index.html +116 -0
  129. package/coverage/ui-kit/src/index.html +116 -0
  130. package/coverage/ui-kit/src/index.js.html +367 -0
  131. package/coverage/ui-kit/src/robustExteranlApiCallerService/cacheAndConcurrentRequestsResolver.js.html +1762 -0
  132. package/coverage/ui-kit/src/robustExteranlApiCallerService/cachedRobustExternalApiCallerService.js.html +649 -0
  133. package/coverage/ui-kit/src/robustExteranlApiCallerService/cancelProcessing.js.html +172 -0
  134. package/coverage/ui-kit/src/robustExteranlApiCallerService/concurrentCalculationsMetadataHolder.js.html +394 -0
  135. package/coverage/ui-kit/src/robustExteranlApiCallerService/externalApiProvider.js.html +553 -0
  136. package/coverage/ui-kit/src/robustExteranlApiCallerService/externalServicesStatsCollector.js.html +331 -0
  137. package/coverage/ui-kit/src/robustExteranlApiCallerService/index.html +206 -0
  138. package/coverage/ui-kit/src/robustExteranlApiCallerService/robustExternalAPICallerService.js.html +1249 -0
  139. package/coverage/ui-kit/src/swaps-lib/external-apis/index.html +131 -0
  140. package/coverage/ui-kit/src/swaps-lib/external-apis/swapProvider.js.html +727 -0
  141. package/coverage/ui-kit/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +2899 -0
  142. package/coverage/ui-kit/src/swaps-lib/models/baseSwapCreationInfo.js.html +214 -0
  143. package/coverage/ui-kit/src/swaps-lib/models/existingSwap.js.html +304 -0
  144. package/coverage/ui-kit/src/swaps-lib/models/existingSwapWithFiatData.js.html +487 -0
  145. package/coverage/ui-kit/src/swaps-lib/models/index.html +146 -0
  146. package/coverage/ui-kit/src/swaps-lib/services/index.html +116 -0
  147. package/coverage/ui-kit/src/swaps-lib/services/publicSwapService.js.html +2191 -0
  148. package/coverage/ui-kit/src/swaps-lib/utils/index.html +116 -0
  149. package/coverage/ui-kit/src/swaps-lib/utils/swapUtils.js.html +742 -0
  150. package/coverage/ui-kit/stories/atoms/BackgroundTitle.stories.jsx.html +202 -0
  151. package/coverage/ui-kit/stories/atoms/LinesOfText.stories.jsx.html +283 -0
  152. package/coverage/ui-kit/stories/atoms/LoadingDots.stories.jsx.html +226 -0
  153. package/coverage/ui-kit/stories/atoms/QrCode.stories.jsx.html +175 -0
  154. package/coverage/ui-kit/stories/atoms/RateSelector.stories.jsx.html +136 -0
  155. package/coverage/ui-kit/stories/atoms/Validation.stories.jsx.html +178 -0
  156. package/coverage/ui-kit/stories/atoms/buttons/Button.stories.jsx.html +946 -0
  157. package/coverage/ui-kit/stories/atoms/buttons/Close.stories.jsx.html +214 -0
  158. package/coverage/ui-kit/stories/atoms/buttons/LinkButton.stories.jsx.html +295 -0
  159. package/coverage/ui-kit/stories/atoms/buttons/index.html +146 -0
  160. package/coverage/ui-kit/stories/atoms/index.html +191 -0
  161. package/coverage/ui-kit/stories/molecules/LineWithIconLink.stories.jsx.html +154 -0
  162. package/coverage/ui-kit/stories/molecules/TitledLineWithIconLink.stories.jsx.html +160 -0
  163. package/coverage/ui-kit/stories/molecules/index.html +131 -0
  164. package/coverage/ui-kit/stories/organisms/Dialog/Dialog.stories.jsx.html +589 -0
  165. package/coverage/ui-kit/stories/organisms/Dialog/DialogButtons/DialogButtons.stories.jsx.html +328 -0
  166. package/coverage/ui-kit/stories/organisms/Dialog/DialogButtons/index.html +116 -0
  167. package/coverage/ui-kit/stories/organisms/Dialog/DialogStep/DialogStep.stories.jsx.html +337 -0
  168. package/coverage/ui-kit/stories/organisms/Dialog/DialogStep/index.html +116 -0
  169. package/coverage/ui-kit/stories/organisms/Dialog/index.html +116 -0
  170. package/coverage/ui-kit/stories/stubs/exampleContent.jsx.html +145 -0
  171. package/coverage/ui-kit/stories/stubs/index.html +116 -0
  172. package/coverage/ui-kit/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +193 -0
  173. package/coverage/ui-kit/stories/templates/index.html +116 -0
  174. package/dist/index.cjs +9963 -9
  175. package/dist/index.cjs.map +1 -1
  176. package/dist/index.css +71409 -1641
  177. package/dist/index.css.map +1 -1
  178. package/dist/index.modern.js +7672 -11
  179. package/dist/index.modern.js.map +1 -1
  180. package/dist/index.module.js +9883 -11
  181. package/dist/index.module.js.map +1 -1
  182. package/dist/index.umd.js +9954 -12
  183. package/dist/index.umd.js.map +1 -1
  184. package/index.js +1 -1
  185. package/package.json +27 -5
  186. package/src/assets/image/icons/arrow-tosca.svg +3 -0
  187. package/src/assets/wrappedImages/arrowIcon.jsx +19 -0
  188. package/src/assets/wrappedImages/arrowTosca.jsx +20 -0
  189. package/src/assets/wrappedImages/arrowWhite.jsx +20 -0
  190. package/src/assets/wrappedImages/darkRectangle.jsx +18 -0
  191. package/src/assets/wrappedImages/determinedError.jsx +129 -0
  192. package/src/assets/wrappedImages/failedValidationIcon.jsx +53 -0
  193. package/src/assets/wrappedImages/infoIcon.jsx +22 -0
  194. package/src/assets/wrappedImages/noticeQuestionIcon.jsx +60 -0
  195. package/src/assets/wrappedImages/successfulValidationIcon.jsx +40 -0
  196. package/src/assets/wrappedImages/walletIcon.jsx +38 -0
  197. package/src/common/adapters/axiosAdapter.js +35 -0
  198. package/src/common/adapters/qrUtils.js +18 -0
  199. package/src/common/amountUtils.js +436 -0
  200. package/src/common/errorUtils.js +42 -0
  201. package/src/common/external-apis/apiGroups.js +55 -0
  202. package/src/common/external-apis/ipAddressProviders.js +138 -0
  203. package/src/common/fiatCurrenciesService.js +161 -0
  204. package/src/common/models/blockchain.js +10 -0
  205. package/src/common/models/coin.js +157 -0
  206. package/src/common/models/protocol.js +5 -0
  207. package/src/common/tests/integration/external-apis/ipAddressProviders/getClientIpAddress.test.js +14 -0
  208. package/src/common/utils/cache.js +268 -0
  209. package/src/common/utils/emailAPI.js +18 -0
  210. package/src/common/utils/logging/logger.js +48 -0
  211. package/src/common/utils/logging/logsStorage.js +61 -0
  212. package/src/common/utils/postponeExecution.js +11 -0
  213. package/src/common/utils/safeStringify.js +50 -0
  214. package/src/components/atoms/AssetIcon/AssetIcon.jsx +64 -0
  215. package/src/components/atoms/AssetIcon/asset-icon.module.scss +42 -0
  216. package/src/components/atoms/AssetSelection/AssetSelection.jsx +75 -0
  217. package/src/components/atoms/AssetSelection/asset-selection.module.scss +55 -0
  218. package/src/components/atoms/BackgroundTitle/BackgroundTitle.jsx +44 -0
  219. package/src/components/atoms/BackgroundTitle/background-title.module.scss +52 -0
  220. package/src/components/atoms/InformationMessage/InformationMessage.jsx +60 -0
  221. package/src/components/atoms/InformationMessage/information-message.module.scss +36 -0
  222. package/src/components/atoms/Input/Input.jsx +198 -0
  223. package/src/components/atoms/Input/input.module.scss +107 -0
  224. package/{stories → src/components}/atoms/LoadingDots/LoadingDots.module.scss +1 -1
  225. package/src/components/atoms/NoticeIcon/NoticeIcon.jsx +71 -0
  226. package/src/components/atoms/NoticeIcon/notice-icon.module.scss +14 -0
  227. package/src/components/atoms/QrCode/QrCode.jsx +34 -0
  228. package/src/components/atoms/QrCode/qr-code.module.scss +9 -0
  229. package/src/components/atoms/RateSelector/RateSelector.jsx +37 -0
  230. package/src/components/atoms/RateSelector/rate-selector.module.scss +47 -0
  231. package/src/components/atoms/SupportChat/SupportChat.jsx +48 -0
  232. package/src/components/atoms/Textarea/Textarea.jsx +158 -0
  233. package/src/components/atoms/Textarea/textarea.module.scss +71 -0
  234. package/src/components/atoms/TitleBox/TitleBox.jsx +164 -0
  235. package/src/components/atoms/TitleBox/title-box.module.scss +30 -0
  236. package/src/components/atoms/Tooltip/Tooltip.jsx +70 -0
  237. package/src/components/atoms/Tooltip/tooltip.module.scss +237 -0
  238. package/src/components/atoms/TwoLinesOfText/LinesOfText.jsx +80 -0
  239. package/src/components/atoms/TwoLinesOfText/lines-of-text.module.scss +65 -0
  240. package/src/components/atoms/Validation/Validation.jsx +39 -0
  241. package/src/components/atoms/Validation/validation.module.scss +15 -0
  242. package/{stories → src/components}/atoms/buttons/Button/Button.jsx +5 -1
  243. package/{stories → src/components}/atoms/buttons/Button/Button.module.scss +1 -1
  244. package/src/components/atoms/buttons/Close/Close.jsx +59 -0
  245. package/src/components/atoms/buttons/Close/close.module.scss +75 -0
  246. package/src/components/atoms/buttons/LinkButton/LinkButton.jsx +115 -0
  247. package/src/components/atoms/buttons/LinkButton/link-button.module.scss +49 -0
  248. package/src/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx +128 -0
  249. package/src/components/atoms/buttons/RadioButtonWithText/radio-button-with-text.module.scss +86 -0
  250. package/src/components/hooks/useCallHandlingErrors.js +26 -0
  251. package/src/components/hooks/useReferredState.js +24 -0
  252. package/src/components/molecules/AmountInput/AmountInput.jsx +421 -0
  253. package/src/components/molecules/AmountInput/amount-input.module.scss +189 -0
  254. package/src/components/molecules/CoinPicker/CoinPicker.jsx +642 -0
  255. package/src/components/molecules/CoinPicker/coin-picker.module.scss +210 -0
  256. package/src/components/molecules/LineWithIconLink/LineWithIconLink.jsx +40 -0
  257. package/src/components/molecules/LineWithIconLink/line-with-icon-link.module.scss +25 -0
  258. package/src/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx +30 -0
  259. package/src/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx +66 -0
  260. package/src/components/organisms/Dialog/Dialog.jsx +515 -0
  261. package/src/components/organisms/Dialog/DialogButtons/DialogButtons.jsx +122 -0
  262. package/src/components/organisms/Dialog/DialogButtons/dialog-buttons.module.scss +25 -0
  263. package/src/components/organisms/Dialog/DialogStep/DialogStep.jsx +687 -0
  264. package/src/components/organisms/Dialog/DialogStep/dialog-step.module.scss +383 -0
  265. package/src/components/organisms/Dialog/dialog.module.scss +226 -0
  266. package/src/components/organisms/SwapForm/SwapForm.jsx +1266 -0
  267. package/src/components/organisms/SwapForm/swap-form.module.scss +134 -0
  268. package/src/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx +77 -0
  269. package/src/components/tests/utils/inputValueProviders/provideFormatOfFloatValueByInputString.test.js +139 -0
  270. package/src/components/tests/utils/urlQueryUtils/getQueryParameterValues.test.js +71 -0
  271. package/src/components/tests/utils/urlQueryUtils/saveQueryParameterAndValues.test.js +144 -0
  272. package/src/components/utils/inputValueProviders.js +58 -0
  273. package/src/components/utils/textUtils.js +18 -0
  274. package/src/components/utils/uiUtils.js +14 -0
  275. package/src/components/utils/urlQueryUtils.js +87 -0
  276. package/src/constants/atoms/Close/close.jsx +5 -0
  277. package/src/constants/atoms/LinkButton/linkButton.jsx +6 -0
  278. package/src/constants/atoms/Tooltip/tooltip.jsx +8 -0
  279. package/src/constants/globalConstants.jsx +4 -0
  280. package/src/constants/organisms/dialog/DialogStep/dialogStep.js +1 -0
  281. package/src/constants/organisms/dialog/dialog.js +29 -0
  282. package/src/index.js +94 -0
  283. package/src/robustExteranlApiCallerService/cacheAndConcurrentRequestsResolver.js +559 -0
  284. package/src/robustExteranlApiCallerService/cachedRobustExternalApiCallerService.js +188 -0
  285. package/src/robustExteranlApiCallerService/cancelProcessing.js +29 -0
  286. package/src/robustExteranlApiCallerService/concurrentCalculationsMetadataHolder.js +103 -0
  287. package/src/robustExteranlApiCallerService/externalApiProvider.js +156 -0
  288. package/src/robustExteranlApiCallerService/externalServicesStatsCollector.js +82 -0
  289. package/src/robustExteranlApiCallerService/robustExternalAPICallerService.js +388 -0
  290. package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/_performCallAttempt.test.js +787 -0
  291. package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/callExternalAPI.test.js +745 -0
  292. package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/constructor.test.js +31 -0
  293. package/src/swaps-lib/external-apis/swapProvider.js +214 -0
  294. package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +938 -0
  295. package/src/swaps-lib/models/baseSwapCreationInfo.js +43 -0
  296. package/src/swaps-lib/models/existingSwap.js +73 -0
  297. package/src/swaps-lib/models/existingSwapWithFiatData.js +134 -0
  298. package/src/swaps-lib/services/publicSwapService.js +702 -0
  299. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +506 -0
  300. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/createSwap.test.js +1311 -0
  301. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getAllSupportedCurrencies.test.js +76 -0
  302. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getDepositCurrencies.test.js +82 -0
  303. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getSwapInfo.test.js +1892 -0
  304. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getWithdrawalCurrencies.test.js +111 -0
  305. package/src/swaps-lib/test/utils/swapUtils/safeHandleRequestsLimitExceeding.test.js +88 -0
  306. package/src/swaps-lib/utils/swapUtils.js +219 -0
  307. package/stories/stubs/exampleContent.jsx +20 -0
  308. package/styles/_placeholder.scss +1 -1
  309. package/styles/fonts/NunitoSans-Bold.ttf +0 -0
  310. package/styles/fonts/NunitoSans-ExtraBold.ttf +0 -0
  311. package/styles/fonts/NunitoSans-Light.ttf +0 -0
  312. package/styles/fonts/NunitoSans-Regular.ttf +0 -0
  313. package/styles/fonts/NunitoSans-SemiBold.ttf +0 -0
  314. package/styles/global-styles-index.scss +1 -1
  315. package/styles/index.scss +5 -3
  316. package/stories/index.js +0 -2
  317. /package/{stories → src/components}/atoms/LoadingDots/LoadingDots.jsx +0 -0
@@ -0,0 +1,642 @@
1
+ import React, { useEffect, useState, useRef } from "react";
2
+ import PropTypes from "prop-types";
3
+
4
+ import s from "./coin-picker.module.scss";
5
+ import ArrowIcon from "../../../assets/wrappedImages/arrowIcon.jsx";
6
+
7
+ import { useReferredState } from "../../hooks/useReferredState.js";
8
+ import { useCallHandlingErrors } from "../../hooks/useCallHandlingErrors.js";
9
+ import { logErrorOrOutputToConsole } from "../../../common/errorUtils.js";
10
+
11
+ import { RadioButtonWithText } from "../../atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx";
12
+ import { Input } from "../../atoms/Input/Input.jsx";
13
+ import { InformationMessage } from "../../atoms/InformationMessage/InformationMessage.jsx";
14
+ import { FALLBACK_ASSET_ICON_URL } from "../../../constants/globalConstants.jsx";
15
+ import { AssetIcon } from "../../atoms/AssetIcon/AssetIcon.jsx";
16
+ import { Button } from "../../atoms/buttons/Button/Button.jsx";
17
+ import { LoadingDots } from "../../atoms/LoadingDots/LoadingDots.jsx";
18
+
19
+ export const COIN_PICKER_MODES = {
20
+ BUTTON: "BUTTON",
21
+ CHECKBOX: "CHECKBOX",
22
+ };
23
+
24
+ const defaultTexts = {
25
+ searchPlaceholder: "Search..",
26
+ noAssetsMessage: "No matching assets found",
27
+ loadMoreButton: "Load more",
28
+ assetSuggestionMessage: {
29
+ part1: "Need more?",
30
+ part2: "Let us know",
31
+ part3: "which coin to add next.",
32
+ },
33
+ };
34
+
35
+ /**
36
+ * Component that can be used either for one-time selection of an asset, or
37
+ * for a multi-selection in a CHECKBOX format.
38
+ * CoinPicker can show all assets with a subtitle.
39
+ *
40
+ * Usage rules:
41
+ * 1. for CHECKBOX mode
42
+ * - you MUST pass allCoins, initiallyEnabledCoinsList and setCoinPickerValue
43
+ * 2. for BUTTON mode
44
+ * - you MUST NOT pass setCoinPickerValue (it will be ignored)
45
+ * - if you don't pass loadCoinsAndContent function, you MUST pass allCoins
46
+ *
47
+ * @param [mode] {string} one-time button selection or multi-selection via toggles, available options are located in COIN_PICKER_MODES
48
+ * @param [allCoins] {Coin[]} all coins despite on their enabled/disabled status. Pass this list if you use CHECKBOX mode or you don't pass the loadCoinsAndContent function
49
+ * @param [initiallyEnabledCoinsList] {Coin[]} - pass this when using CHECKBOX mode
50
+ * @param [handleClick] {function} handler function for the event when an asset is clicked
51
+ * @param [triggerToReloadData] {number|undefined} trigger to reload the component when some related data changes
52
+ * @param [search=false] {boolean} whether to show the search bar above the assets list, when enabled overrides searchAdaptive and locks the list height
53
+ * @param [searchAdaptive=true] {boolean} show search bar only after six assets in the list
54
+ * @param [setCoinPickerValue] {function} is called with the only parameter (final enabled tickers list) when closing/confirming dialog in CHECKBOX mode
55
+ * @param [setCoinPickerListChanged] {function} is called with the only parameter (flag signalling that the list of enabled coins was changed - true, or was not changed - false) when closing/confirming dialog in CHECKBOX mode
56
+ * @param [loadCoinsAndContent] {function} optional, you can provide it if you need custom logic for coins list composing or custom subtitles
57
+ * {
58
+ * coins: Coin[],
59
+ * content: { coin: Coin, subtitle: string }[],
60
+ * isCoinsDataReloadable: boolean
61
+ * }
62
+ * @param [showRequestMissingCoinsInfoMessage=true] {boolean} whether to show message about advising missing coins
63
+ * @param [supportUrl] {string} needed when showRequestMissingCoinsInfoMessage=true
64
+ * @param coinToIconPaths {function}
65
+ * @param [partialLoadingEnabled=true] {boolean} enables only partialLoadingIncrement items are shown by default and user can show more clicking the load-more button
66
+ * @param [partialLoadingIncrement=100]
67
+ * @param [texts] {object} texts translated to desired locale, default texts use english locale
68
+ */
69
+ export const CoinPicker = ({
70
+ mode = COIN_PICKER_MODES.BUTTON,
71
+ allCoins,
72
+ initiallyEnabledCoinsList,
73
+ handleClick = (ticker) => {},
74
+ triggerToReloadData,
75
+ search = false,
76
+ searchAdaptive = true,
77
+ setCoinPickerValue = () => {},
78
+ setCoinPickerListChanged = () => {},
79
+ loadCoinsAndContent = null,
80
+ showRequestMissingCoinsInfoMessage = true,
81
+ supportUrl = null,
82
+ coinToIconPaths = (coin) => ({
83
+ assetIconSrc: undefined,
84
+ assetIconProtocolSrc: undefined,
85
+ }),
86
+ partialLoadingEnabled = true,
87
+ partialLoadingIncrement = 100,
88
+ texts = defaultTexts,
89
+ }) => {
90
+ const handleError = useCallHandlingErrors();
91
+
92
+ const [coins, setCoins] = useState(null);
93
+ const [filteredCoins, setFilteredCoins] = useState([]);
94
+ const [initiallyEnabledCoins, setInitiallyEnabledCoins] = useReferredState(
95
+ {}
96
+ );
97
+ const [currentlyEnabledCoins, setCurrentlyEnabledCoins] = useReferredState(
98
+ {}
99
+ );
100
+ const [searchFieldValue, setSearchFieldValue] = useState("");
101
+ const [scrollWrapperClass, setScrollWrapperClass] = useState("");
102
+
103
+ const [searchEnabled, setSearchEnabled] = useState(false);
104
+ const [coinsContent, setCoinsContent] = useState(null);
105
+ const [isCoinsDataReloadable, setIsCoinsDataReloadable] = useState(false);
106
+
107
+ const [limitedCoinsNumber, setLimitedCoinsNumber] = useState(0);
108
+ const [displayedCoins, setDisplayedCoins] = useState([]);
109
+ const [isListFull, setIsListFull] = useState(true);
110
+
111
+ const searchRef = useRef();
112
+ const scrollContainerRef = useRef();
113
+ const skeletonItemsCount =
114
+ initiallyEnabledCoinsList?.length ||
115
+ (partialLoadingEnabled ? partialLoadingIncrement : 6);
116
+
117
+ const defaultLoadCoinsAndContent = async () => {
118
+ const allCoinsSorted = sortCoinsArrayByAlphabet(
119
+ allCoins,
120
+ composeEnabledCoinsObject(allCoins)
121
+ );
122
+ return {
123
+ coins: allCoinsSorted,
124
+ content: allCoinsSorted.map((c) => ({
125
+ coin: c,
126
+ subtitle: c.blockchain?.name,
127
+ })),
128
+ isCoinsDataReloadable: false,
129
+ };
130
+ };
131
+
132
+ const sortCoinsArrayByAlphabet = (coinsToSort, enabledCoinsObject) => {
133
+ return [
134
+ ...coinsToSort
135
+ .filter((coin) => enabledCoinsObject[coin.ticker])
136
+ .sort(
137
+ (a, b) =>
138
+ a.latinName.toUpperCase() > b.latinName.toUpperCase()
139
+ ),
140
+ ...coinsToSort
141
+ .filter((coin) => !enabledCoinsObject[coin.ticker])
142
+ .sort(
143
+ (a, b) =>
144
+ a.latinName.toUpperCase() > b.latinName.toUpperCase()
145
+ ),
146
+ ];
147
+ };
148
+
149
+ const composeEnabledCoinsObject = (coins) => {
150
+ if (mode === COIN_PICKER_MODES.CHECKBOX) {
151
+ return coins.reduce((prev, coin) => {
152
+ return {
153
+ ...prev,
154
+ [coin.ticker]: !!initiallyEnabledCoinsList.find(
155
+ (enabledCoin) => enabledCoin.ticker === coin.ticker
156
+ ),
157
+ };
158
+ }, {});
159
+ }
160
+ return {};
161
+ };
162
+
163
+ const handleToggleClick = (ticker, resetButtonLoader = () => {}) => {
164
+ resetButtonLoader && resetButtonLoader();
165
+ setCurrentlyEnabledCoins((prev) => {
166
+ return { ...prev, [ticker]: !prev[ticker] };
167
+ });
168
+ };
169
+
170
+ const handleCoinClick = (coin) => {
171
+ if (mode === COIN_PICKER_MODES.CHECKBOX) handleToggleClick(coin.ticker);
172
+ handleClick(coin.ticker);
173
+ };
174
+
175
+ const handleSearchAsset = (value) => {
176
+ // TODO: [refactoring, high] use unified search function. task_id=be0475316f374dd4a926c948d969e704
177
+ setSearchFieldValue(value); // Trim the input to handle leading/trailing spaces
178
+ const searchTerm = value.trim().toLowerCase();
179
+ if (searchTerm !== "") {
180
+ const searchWords = searchTerm.split(/\s+/); // Split search terms on whitespace
181
+
182
+ const filteredAndSortedCoins = coins
183
+ .filter((coin) => {
184
+ // Check if all search words are found in any of the given properties
185
+ return searchWords.every(
186
+ (word) =>
187
+ coin?.latinName?.toLowerCase().includes(word) ||
188
+ coin?.ticker?.toLowerCase().includes(word) ||
189
+ coin?.tickerPrintable?.toLowerCase().includes(word)
190
+ );
191
+ })
192
+ .sort((a, b) => {
193
+ // Check for exact matches
194
+ const aMatch =
195
+ a.latinName.toLowerCase() === searchTerm ||
196
+ a.ticker.toLowerCase() === searchTerm ||
197
+ a.tickerPrintable.toLowerCase() === searchTerm
198
+ ? 1
199
+ : 0;
200
+ const bMatch =
201
+ b.latinName.toLowerCase() === searchTerm ||
202
+ b.ticker.toLowerCase() === searchTerm ||
203
+ b.tickerPrintable.toLowerCase() === searchTerm
204
+ ? 1
205
+ : 0;
206
+ if (bMatch - aMatch !== 0) {
207
+ // Prioritize exact matches to the top
208
+ return bMatch - aMatch;
209
+ } else {
210
+ // Sort remaining items alphabetically by latinName
211
+ return a.latinName
212
+ .toLowerCase()
213
+ .localeCompare(b.latinName.toLowerCase());
214
+ }
215
+ });
216
+
217
+ setFilteredCoins(filteredAndSortedCoins);
218
+ } else {
219
+ setFilteredCoins(coins); // Reset to original list if search term is empty
220
+ }
221
+ };
222
+
223
+ const loadCoinsAndSaveToState = () => {
224
+ (async () => {
225
+ try {
226
+ const data = loadCoinsAndContent
227
+ ? await loadCoinsAndContent()
228
+ : await defaultLoadCoinsAndContent();
229
+ setCoins(data.coins);
230
+ setFilteredCoins(data.coins);
231
+ setCoinsContent(data.content);
232
+ setIsCoinsDataReloadable(!!data.isCoinsDataReloadable);
233
+ } catch (e) {
234
+ logErrorOrOutputToConsole(e);
235
+ }
236
+ })();
237
+ };
238
+
239
+ // Initializes enabled coins logic if the mode is CHECKBOX
240
+ useEffect(() => {
241
+ if (mode === COIN_PICKER_MODES.CHECKBOX) {
242
+ const enabledCoinsObject = composeEnabledCoinsObject(allCoins);
243
+ setInitiallyEnabledCoins(enabledCoinsObject);
244
+ setCurrentlyEnabledCoins(enabledCoinsObject);
245
+ }
246
+ // eslint-disable-next-line react-hooks/exhaustive-deps
247
+ }, [mode]);
248
+
249
+ useEffect(() => {
250
+ loadCoinsAndSaveToState();
251
+ if (isCoinsDataReloadable) {
252
+ const intervalId = setInterval(loadCoinsAndSaveToState, 60000);
253
+ return () => clearInterval(intervalId);
254
+ }
255
+ // eslint-disable-next-line react-hooks/exhaustive-deps
256
+ }, [triggerToReloadData]);
257
+
258
+ useEffect(() => {
259
+ const enabled = currentlyEnabledCoins.current;
260
+ if (enabled) {
261
+ const enabledCoinsTickers = Object.keys(enabled).filter(
262
+ (ticker) => enabled[ticker]
263
+ );
264
+ setCoinPickerValue(enabledCoinsTickers);
265
+ setCoinPickerListChanged(
266
+ JSON.stringify(initiallyEnabledCoins.current) !==
267
+ JSON.stringify(currentlyEnabledCoins.current)
268
+ );
269
+ }
270
+ // eslint-disable-next-line react-hooks/exhaustive-deps
271
+ }, [currentlyEnabledCoins.current]);
272
+
273
+ useEffect(() => {
274
+ setSearchEnabled(
275
+ search
276
+ ? true
277
+ : searchAdaptive && initiallyEnabledCoinsList
278
+ ? initiallyEnabledCoinsList.length > 6
279
+ : false
280
+ );
281
+ // eslint-disable-next-line react-hooks/exhaustive-deps
282
+ }, [search, searchAdaptive, coins]);
283
+
284
+ useEffect(() => {
285
+ if (
286
+ filteredCoins?.length > partialLoadingIncrement &&
287
+ partialLoadingEnabled
288
+ ) {
289
+ setLimitedCoinsNumber(partialLoadingIncrement);
290
+ } else {
291
+ setLimitedCoinsNumber(0);
292
+ setDisplayedCoins(filteredCoins);
293
+ setIsListFull(true);
294
+ }
295
+ // eslint-disable-next-line react-hooks/exhaustive-deps
296
+ }, [filteredCoins]);
297
+
298
+ useEffect(() => {
299
+ if (limitedCoinsNumber > 0) {
300
+ const coinsToDisplay = filteredCoins.slice(0, limitedCoinsNumber);
301
+ setDisplayedCoins(coinsToDisplay);
302
+ setIsListFull(coinsToDisplay.length === filteredCoins.length);
303
+ }
304
+ // eslint-disable-next-line react-hooks/exhaustive-deps
305
+ }, [limitedCoinsNumber]);
306
+
307
+ const displayMoreCoins = () => {
308
+ setLimitedCoinsNumber((prev) => prev + partialLoadingIncrement);
309
+ };
310
+
311
+ const skeleton = () => {
312
+ let skeletonItems = [];
313
+ for (let i = 0; i < skeletonItemsCount; i++) {
314
+ skeletonItems.push(
315
+ <div className={s["item"]} key={"coin-picker-skeleton-" + i}>
316
+ <div className={s["link"] + " " + s["loading"]}>
317
+ <div
318
+ className={s["icon"] + " " + s["skeleton-dark"]}
319
+ ></div>
320
+ <div className={s["content"]}>
321
+ <div
322
+ className={s["name"] + " " + s["skeleton-dark"]}
323
+ ></div>
324
+ <div
325
+ className={
326
+ s["amount"] + " " + s["skeleton-dark"]
327
+ }
328
+ ></div>
329
+ </div>
330
+ </div>
331
+ </div>
332
+ );
333
+ }
334
+ return skeletonItems;
335
+ };
336
+
337
+ const handleScroll = () => {
338
+ if (scrollWrapperClass !== "") setScrollWrapperClass("");
339
+
340
+ if (scrollContainerRef.current?.scrollTop === 0)
341
+ setScrollWrapperClass(
342
+ s["reached-top"] +
343
+ (scrollContainerRef.current?.scrollHeight -
344
+ scrollContainerRef.current?.clientHeight ===
345
+ 0
346
+ ? " " + s["reached-bottom"]
347
+ : "")
348
+ );
349
+
350
+ if (
351
+ scrollContainerRef.current?.scrollTop > 0 &&
352
+ scrollContainerRef.current?.scrollTop ===
353
+ scrollContainerRef.current?.scrollHeight -
354
+ scrollContainerRef.current?.clientHeight
355
+ )
356
+ setScrollWrapperClass(s["reached-bottom"]);
357
+ };
358
+
359
+ // eslint-disable-next-line react-hooks/exhaustive-deps
360
+ useEffect(handleScroll, []);
361
+
362
+ // eslint-disable-next-line react-hooks/exhaustive-deps
363
+ useEffect(handleScroll, [filteredCoins]);
364
+
365
+ const shouldShowSkeleton = coins == null;
366
+
367
+ return coins ? (
368
+ <>
369
+ <div
370
+ className={
371
+ s["coin-picker"] +
372
+ (shouldShowSkeleton ? " " + s["loading"] : "")
373
+ }
374
+ >
375
+ {searchEnabled ? (
376
+ <div className={s["coin-picker-search"]}>
377
+ <Input
378
+ value={searchFieldValue}
379
+ onChange={(e) => handleSearchAsset(e.target.value)}
380
+ placeholder={texts.searchPlaceholder}
381
+ isSmallHeight={true}
382
+ clearButton
383
+ ref={searchRef}
384
+ disabled={shouldShowSkeleton}
385
+ />
386
+ </div>
387
+ ) : (
388
+ ""
389
+ )}
390
+ <div
391
+ className={
392
+ s["coin-picker-wrapper"] +
393
+ " " +
394
+ scrollWrapperClass +
395
+ (searchEnabled ? " " + s["fixed-height"] : "")
396
+ }
397
+ >
398
+ <div
399
+ className={
400
+ s["coin-picker-wrapper-content"] +
401
+ (searchEnabled ? " " + s["fixed-height"] : "")
402
+ }
403
+ ref={scrollContainerRef}
404
+ onScroll={handleScroll}
405
+ >
406
+ <div
407
+ className={s["coin-picker-wrapper-content-assets"]}
408
+ >
409
+ {shouldShowSkeleton
410
+ ? skeleton()
411
+ : displayedCoins.map((coin, index) => {
412
+ const {
413
+ assetIconSrc,
414
+ assetIconProtocolSrc,
415
+ } = coinToIconPaths(coin);
416
+
417
+ return (
418
+ <div
419
+ className={s["item"]}
420
+ key={`picker-${coin.ticker}-${index}`}
421
+ onClick={(e) =>
422
+ handleError(
423
+ () =>
424
+ handleCoinClick(coin),
425
+ e
426
+ )
427
+ }
428
+ >
429
+ <div
430
+ className={
431
+ s["link"] +
432
+ (currentlyEnabledCoins
433
+ .current[
434
+ coin.ticker
435
+ ] !==
436
+ initiallyEnabledCoins
437
+ .current[coin.ticker]
438
+ ? " " + s["outline"]
439
+ : "")
440
+ }
441
+ >
442
+ <AssetIcon
443
+ assetIconSrc={
444
+ assetIconSrc
445
+ }
446
+ assetIconProtocolSrc={
447
+ assetIconProtocolSrc
448
+ }
449
+ fallbackSrc={
450
+ FALLBACK_ASSET_ICON_URL
451
+ }
452
+ />
453
+ <div
454
+ className={s["content"]}
455
+ key={coin.ticker}
456
+ >
457
+ <p className={s["name"]}>
458
+ {coin.latinName}
459
+ </p>
460
+ <p
461
+ className={
462
+ s["amount"]
463
+ }
464
+ >
465
+ {coinsContent?.find(
466
+ (i) =>
467
+ i.coin ===
468
+ coin
469
+ )?.subtitle ?? ""}
470
+ </p>
471
+ </div>
472
+ {mode ===
473
+ COIN_PICKER_MODES.BUTTON ? (
474
+ <div
475
+ className={s["arrow"]}
476
+ >
477
+ <ArrowIcon />
478
+ </div>
479
+ ) : mode ===
480
+ COIN_PICKER_MODES.CHECKBOX ? (
481
+ <div
482
+ className={
483
+ s[
484
+ "toggle-container"
485
+ ]
486
+ }
487
+ >
488
+ <RadioButtonWithText
489
+ onStateChange={(
490
+ resetButtonLoader
491
+ ) =>
492
+ handleToggleClick(
493
+ coin.ticker,
494
+ resetButtonLoader
495
+ )
496
+ }
497
+ isSwitchedOn={
498
+ currentlyEnabledCoins
499
+ .current[
500
+ coin
501
+ .ticker
502
+ ]
503
+ }
504
+ id={index}
505
+ />
506
+ </div>
507
+ ) : (
508
+ ""
509
+ )}
510
+ </div>
511
+ </div>
512
+ );
513
+ })}
514
+ </div>
515
+
516
+ {filteredCoins?.length === 0 &&
517
+ searchFieldValue !== "" ? (
518
+ <div
519
+ className={
520
+ s[
521
+ "coin-picker-wrapper-content-asset-not-found"
522
+ ]
523
+ }
524
+ >
525
+ <h6>{texts.noAssetsMessage}</h6>
526
+ </div>
527
+ ) : (
528
+ ""
529
+ )}
530
+ {partialLoadingEnabled && !isListFull ? (
531
+ <div
532
+ className={
533
+ s[
534
+ "coin-picker-wrapper-content-load-more-button"
535
+ ]
536
+ }
537
+ >
538
+ <Button
539
+ mode="primary-transparent"
540
+ size="sm"
541
+ loader={false}
542
+ content={texts.loadMoreButton}
543
+ onClick={displayMoreCoins}
544
+ handleError={handleError}
545
+ />
546
+ </div>
547
+ ) : (
548
+ ""
549
+ )}
550
+ {searchEnabled && showRequestMissingCoinsInfoMessage ? (
551
+ <div
552
+ className={
553
+ s[
554
+ "coin-picker-wrapper-content-bottom-message"
555
+ ]
556
+ }
557
+ >
558
+ <InformationMessage
559
+ text={
560
+ <>
561
+ {texts.assetSuggestionMessage.part1}
562
+ <a
563
+ target="_blank"
564
+ rel="noreferrer"
565
+ href={supportUrl}
566
+ className={
567
+ s[
568
+ "coin-picker-wrapper-content-bottom-message-link"
569
+ ]
570
+ }
571
+ >
572
+ {" " +
573
+ texts.assetSuggestionMessage
574
+ .part2 +
575
+ " "}
576
+ </a>
577
+ {texts.assetSuggestionMessage.part3}
578
+ </>
579
+ }
580
+ />
581
+ </div>
582
+ ) : (
583
+ ""
584
+ )}
585
+ </div>
586
+ </div>
587
+ </div>
588
+ </>
589
+ ) : (
590
+ <LoadingDots />
591
+ );
592
+ };
593
+
594
+ CoinPicker.propTypes = {
595
+ mode: PropTypes.oneOf([
596
+ COIN_PICKER_MODES.BUTTON,
597
+ COIN_PICKER_MODES.CHECKBOX,
598
+ ]),
599
+ allCoins: PropTypes.array,
600
+ initiallyEnabledCoinsList: PropTypes.array,
601
+ handleClick: PropTypes.func,
602
+ triggerToReloadData: PropTypes.number,
603
+ search: PropTypes.bool,
604
+ searchAdaptive: PropTypes.bool,
605
+ setCoinPickerValue: PropTypes.func,
606
+ setCoinPickerListChanged: PropTypes.func,
607
+ loadCoinsAndContent: PropTypes.func,
608
+ showRequestMissingCoinsInfoMessage: PropTypes.bool,
609
+ supportUrl: PropTypes.string,
610
+ coinToIconPaths: PropTypes.func,
611
+ partialLoadingEnabled: PropTypes.bool,
612
+ partialLoadingIncrement: PropTypes.number,
613
+ texts: PropTypes.shape({
614
+ searchPlaceholder: PropTypes.string,
615
+ noAssetsMessage: PropTypes.string,
616
+ loadMoreButton: PropTypes.string,
617
+ assetSuggestionMessage: PropTypes.shape({
618
+ part1: PropTypes.string,
619
+ part2: PropTypes.string,
620
+ part3: PropTypes.string,
621
+ }),
622
+ }),
623
+ };
624
+
625
+ CoinPicker.defaultProps = {
626
+ mode: COIN_PICKER_MODES.BUTTON,
627
+ handleClick: (ticker) => {},
628
+ search: false,
629
+ searchAdaptive: true,
630
+ setCoinPickerValue: () => {},
631
+ setCoinPickerListChanged: () => {},
632
+ loadCoinsAndContent: null,
633
+ showRequestMissingCoinsInfoMessage: true,
634
+ supportUrl: null,
635
+ coinToIconPaths: (coin) => ({
636
+ assetIconSrc: undefined,
637
+ assetIconProtocolSrc: undefined,
638
+ }),
639
+ partialLoadingEnabled: true,
640
+ partialLoadingIncrement: 100,
641
+ texts: defaultTexts,
642
+ };