@rabbitio/ui-kit 1.0.0-beta.9 → 1.0.0-beta.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (369) hide show
  1. package/.gitlab-ci.yml +29 -0
  2. package/.husky/commit-msg +19 -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 +16765 -0
  9. package/coverage/coverage-final.json +116 -0
  10. package/coverage/favicon.png +0 -0
  11. package/coverage/index.html +1001 -0
  12. package/coverage/prettify.css +1 -0
  13. package/coverage/prettify.js +2 -0
  14. package/coverage/rabbit-ui-kit/index.html +116 -0
  15. package/coverage/rabbit-ui-kit/index.js.html +88 -0
  16. package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/googleAnalyticsAdapter.js.html +148 -0
  17. package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/index.html +146 -0
  18. package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/metrikaAdapter.js.html +169 -0
  19. package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/mixpanelAdapter.js.html +199 -0
  20. package/coverage/rabbit-ui-kit/src/common-apis/adapters/axiosAdapter.js.html +190 -0
  21. package/coverage/rabbit-ui-kit/src/common-apis/adapters/index.html +131 -0
  22. package/coverage/rabbit-ui-kit/src/common-apis/adapters/qrUtils.js.html +139 -0
  23. package/coverage/rabbit-ui-kit/src/common-apis/external-apis/apiGroups.js.html +250 -0
  24. package/coverage/rabbit-ui-kit/src/common-apis/external-apis/emailAPI.js.html +133 -0
  25. package/coverage/rabbit-ui-kit/src/common-apis/external-apis/index.html +146 -0
  26. package/coverage/rabbit-ui-kit/src/common-apis/external-apis/ipAddressProviders.js.html +352 -0
  27. package/coverage/rabbit-ui-kit/src/common-apis/globalConstants.jsx.html +94 -0
  28. package/coverage/rabbit-ui-kit/src/common-apis/index.html +116 -0
  29. package/coverage/rabbit-ui-kit/src/common-apis/models/blockchain.js.html +115 -0
  30. package/coverage/rabbit-ui-kit/src/common-apis/models/coin.js.html +829 -0
  31. package/coverage/rabbit-ui-kit/src/common-apis/models/index.html +146 -0
  32. package/coverage/rabbit-ui-kit/src/common-apis/models/protocol.js.html +100 -0
  33. package/coverage/rabbit-ui-kit/src/common-apis/services/fiatCurrenciesService.js.html +544 -0
  34. package/coverage/rabbit-ui-kit/src/common-apis/services/index.html +116 -0
  35. package/coverage/rabbit-ui-kit/src/common-apis/utils/amountUtils.js.html +1162 -0
  36. package/coverage/rabbit-ui-kit/src/common-apis/utils/cache.js.html +811 -0
  37. package/coverage/rabbit-ui-kit/src/common-apis/utils/errorUtils.js.html +211 -0
  38. package/coverage/rabbit-ui-kit/src/common-apis/utils/index.html +191 -0
  39. package/coverage/rabbit-ui-kit/src/common-apis/utils/logging/index.html +131 -0
  40. package/coverage/rabbit-ui-kit/src/common-apis/utils/logging/logger.js.html +208 -0
  41. package/coverage/rabbit-ui-kit/src/common-apis/utils/logging/logsStorage.js.html +268 -0
  42. package/coverage/rabbit-ui-kit/src/common-apis/utils/postponeExecution.js.html +118 -0
  43. package/coverage/rabbit-ui-kit/src/common-apis/utils/rabbitTicker.js.html +157 -0
  44. package/coverage/rabbit-ui-kit/src/common-apis/utils/safeStringify.js.html +235 -0
  45. package/coverage/rabbit-ui-kit/src/index.html +116 -0
  46. package/coverage/rabbit-ui-kit/src/index.js.html +376 -0
  47. package/coverage/rabbit-ui-kit/src/robust-api-caller/cacheAndConcurrentRequestsResolver.js.html +1570 -0
  48. package/coverage/rabbit-ui-kit/src/robust-api-caller/cachedRobustExternalApiCallerService.js.html +526 -0
  49. package/coverage/rabbit-ui-kit/src/robust-api-caller/cancelProcessing.js.html +172 -0
  50. package/coverage/rabbit-ui-kit/src/robust-api-caller/concurrentCalculationsMetadataHolder.js.html +310 -0
  51. package/coverage/rabbit-ui-kit/src/robust-api-caller/externalApiProvider.js.html +553 -0
  52. package/coverage/rabbit-ui-kit/src/robust-api-caller/externalServicesStatsCollector.js.html +319 -0
  53. package/coverage/rabbit-ui-kit/src/robust-api-caller/index.html +206 -0
  54. package/coverage/rabbit-ui-kit/src/robust-api-caller/robustExternalAPICallerService.js.html +997 -0
  55. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/exolixSwapProvider.js.html +1825 -0
  56. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/index.html +161 -0
  57. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/letsExchangeSwapProvider.js.html +1618 -0
  58. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapProvider.js.html +1819 -0
  59. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +1861 -0
  60. package/coverage/rabbit-ui-kit/src/swaps-lib/models/baseSwapCreationInfo.js.html +319 -0
  61. package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwap.js.html +514 -0
  62. package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwapWithFiatData.js.html +529 -0
  63. package/coverage/rabbit-ui-kit/src/swaps-lib/models/index.html +176 -0
  64. package/coverage/rabbit-ui-kit/src/swaps-lib/models/partner.js.html +166 -0
  65. package/coverage/rabbit-ui-kit/src/swaps-lib/models/swapProviderCoinInfo.js.html +331 -0
  66. package/coverage/rabbit-ui-kit/src/swaps-lib/services/index.html +116 -0
  67. package/coverage/rabbit-ui-kit/src/swaps-lib/services/publicSwapService.js.html +1555 -0
  68. package/coverage/rabbit-ui-kit/src/swaps-lib/utils/index.html +116 -0
  69. package/coverage/rabbit-ui-kit/src/swaps-lib/utils/swapUtils.js.html +670 -0
  70. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowIcon.jsx.html +124 -0
  71. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowTosca.jsx.html +127 -0
  72. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowWhite.jsx.html +127 -0
  73. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/darkRectangle.jsx.html +106 -0
  74. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/determinedError.jsx.html +439 -0
  75. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/failedValidationIcon.jsx.html +202 -0
  76. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/index.html +281 -0
  77. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/infoIcon.jsx.html +133 -0
  78. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/messageIcon.jsx.html +346 -0
  79. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/noticeQuestionIcon.jsx.html +247 -0
  80. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/successfulValidationIcon.jsx.html +163 -0
  81. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/supportDialogImage.jsx.html +268 -0
  82. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/walletIcon.jsx.html +151 -0
  83. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetIcon/AssetIcon.jsx.html +256 -0
  84. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetIcon/index.html +116 -0
  85. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetSelection/AssetSelection.jsx.html +289 -0
  86. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetSelection/index.html +116 -0
  87. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +187 -0
  88. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/BackgroundTitle/index.html +116 -0
  89. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/InformationMessage/InformationMessage.jsx.html +238 -0
  90. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/InformationMessage/index.html +116 -0
  91. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Input/Input.jsx.html +634 -0
  92. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Input/index.html +116 -0
  93. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/LoadingDots/LoadingDots.jsx.html +196 -0
  94. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/LoadingDots/index.html +116 -0
  95. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx.html +277 -0
  96. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/NoticeIcon/index.html +116 -0
  97. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/QrCode/QrCode.jsx.html +217 -0
  98. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/QrCode/index.html +116 -0
  99. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/RateSelector/RateSelector.jsx.html +175 -0
  100. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/RateSelector/index.html +116 -0
  101. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/SupportChat/SupportChat.jsx.html +217 -0
  102. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/SupportChat/index.html +116 -0
  103. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Textarea/Textarea.jsx.html +529 -0
  104. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Textarea/index.html +116 -0
  105. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TitleBox/TitleBox.jsx.html +508 -0
  106. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TitleBox/index.html +116 -0
  107. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Tooltip/Tooltip.jsx.html +316 -0
  108. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Tooltip/index.html +116 -0
  109. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +313 -0
  110. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TwoLinesOfText/index.html +116 -0
  111. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Validation/Validation.jsx.html +202 -0
  112. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Validation/index.html +116 -0
  113. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Button/Button.jsx.html +712 -0
  114. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Button/index.html +116 -0
  115. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Close/Close.jsx.html +259 -0
  116. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Close/index.html +116 -0
  117. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx.html +421 -0
  118. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/LinkButton/index.html +116 -0
  119. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +415 -0
  120. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/RadioButtonWithText/index.html +116 -0
  121. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/AmountInput/AmountInput.jsx.html +1429 -0
  122. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/AmountInput/index.html +116 -0
  123. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx.html +1474 -0
  124. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/CoinPicker/index.html +116 -0
  125. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/ColoredNotice/ColoredNotice.jsx.html +211 -0
  126. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/ColoredNotice/index.html +116 -0
  127. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +190 -0
  128. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LineWithIconLink/index.html +116 -0
  129. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LogoCarousel/LogoCarousel.jsx.html +307 -0
  130. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LogoCarousel/index.html +116 -0
  131. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/SearchableCoinsList/SearchableCoinsList.jsx.html +496 -0
  132. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/SearchableCoinsList/index.html +116 -0
  133. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +181 -0
  134. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/TitledLineWithIconLink/index.html +116 -0
  135. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +283 -0
  136. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/CoinPickerDialogStep/index.html +116 -0
  137. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/Dialog.jsx.html +1567 -0
  138. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +481 -0
  139. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogButtons/index.html +116 -0
  140. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +1747 -0
  141. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogStep/index.html +116 -0
  142. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/index.html +116 -0
  143. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx.html +4207 -0
  144. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/SwapForm/index.html +116 -0
  145. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/WaitlistSubscription/WaitlistSubscription.jsx.html +559 -0
  146. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/WaitlistSubscription/index.html +116 -0
  147. package/coverage/rabbit-ui-kit/src/ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +316 -0
  148. package/coverage/rabbit-ui-kit/src/ui-kit/components/templates/DeterminedErrorDialogStep/index.html +116 -0
  149. package/coverage/rabbit-ui-kit/src/ui-kit/hooks/index.html +146 -0
  150. package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useCallHandlingErrors.js.html +151 -0
  151. package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useIsHydrated.js.html +121 -0
  152. package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useReferredState.js.html +157 -0
  153. package/coverage/rabbit-ui-kit/src/ui-kit/utils/index.html +161 -0
  154. package/coverage/rabbit-ui-kit/src/ui-kit/utils/inputValueProviders.js.html +235 -0
  155. package/coverage/rabbit-ui-kit/src/ui-kit/utils/textUtils.js.html +139 -0
  156. package/coverage/rabbit-ui-kit/src/ui-kit/utils/uiUtils.js.html +121 -0
  157. package/coverage/rabbit-ui-kit/src/ui-kit/utils/urlQueryUtils.js.html +271 -0
  158. package/coverage/rabbit-ui-kit/stories/atoms/BackgroundTitle.stories.jsx.html +202 -0
  159. package/coverage/rabbit-ui-kit/stories/atoms/LinesOfText.stories.jsx.html +283 -0
  160. package/coverage/rabbit-ui-kit/stories/atoms/LoadingDots.stories.jsx.html +226 -0
  161. package/coverage/rabbit-ui-kit/stories/atoms/QrCode.stories.jsx.html +175 -0
  162. package/coverage/rabbit-ui-kit/stories/atoms/RateSelector.stories.jsx.html +136 -0
  163. package/coverage/rabbit-ui-kit/stories/atoms/Validation.stories.jsx.html +178 -0
  164. package/coverage/rabbit-ui-kit/stories/atoms/buttons/Button.stories.jsx.html +883 -0
  165. package/coverage/rabbit-ui-kit/stories/atoms/buttons/Close.stories.jsx.html +211 -0
  166. package/coverage/rabbit-ui-kit/stories/atoms/buttons/LinkButton.stories.jsx.html +301 -0
  167. package/coverage/rabbit-ui-kit/stories/atoms/buttons/index.html +146 -0
  168. package/coverage/rabbit-ui-kit/stories/atoms/index.html +191 -0
  169. package/coverage/rabbit-ui-kit/stories/molecules/AmountInput.stories.jsx.html +289 -0
  170. package/coverage/rabbit-ui-kit/stories/molecules/CoinPicker.stories.jsx.html +322 -0
  171. package/coverage/rabbit-ui-kit/stories/molecules/ColoredNotice.stories.jsx.html +178 -0
  172. package/coverage/rabbit-ui-kit/stories/molecules/LineWithIconLink.stories.jsx.html +154 -0
  173. package/coverage/rabbit-ui-kit/stories/molecules/LogoCarousel.stories.jsx.html +235 -0
  174. package/coverage/rabbit-ui-kit/stories/molecules/TitledLineWithIconLink.stories.jsx.html +160 -0
  175. package/coverage/rabbit-ui-kit/stories/molecules/index.html +191 -0
  176. package/coverage/rabbit-ui-kit/stories/organisms/Dialog/Dialog.stories.jsx.html +523 -0
  177. package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogButtons/DialogButtons.stories.jsx.html +328 -0
  178. package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogButtons/index.html +116 -0
  179. package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogStep/DialogStep.stories.jsx.html +337 -0
  180. package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogStep/index.html +116 -0
  181. package/coverage/rabbit-ui-kit/stories/organisms/Dialog/index.html +116 -0
  182. package/coverage/rabbit-ui-kit/stories/organisms/WaitlistSubscription.stories.jsx.html +151 -0
  183. package/coverage/rabbit-ui-kit/stories/organisms/index.html +116 -0
  184. package/coverage/rabbit-ui-kit/stories/stubs/coins.jsx.html +6880 -0
  185. package/coverage/rabbit-ui-kit/stories/stubs/exampleContent.jsx.html +145 -0
  186. package/coverage/rabbit-ui-kit/stories/stubs/index.html +131 -0
  187. package/coverage/rabbit-ui-kit/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +190 -0
  188. package/coverage/rabbit-ui-kit/stories/templates/index.html +116 -0
  189. package/coverage/sort-arrow-sprite.png +0 -0
  190. package/coverage/sorter.js +196 -0
  191. package/dist/global.css +197 -0
  192. package/dist/global.css.map +1 -0
  193. package/dist/index.cjs +12451 -25
  194. package/dist/index.cjs.map +1 -1
  195. package/dist/index.css +2339 -8491
  196. package/dist/index.css.map +1 -1
  197. package/dist/index.modern.js +9597 -26
  198. package/dist/index.modern.js.map +1 -1
  199. package/dist/index.module.js +12357 -27
  200. package/dist/index.module.js.map +1 -1
  201. package/dist/index.umd.js +12442 -29
  202. package/dist/index.umd.js.map +1 -1
  203. package/package.json +35 -9
  204. package/raw +1000 -0
  205. package/src/common-apis/adapters/analyticsAdapters/googleAnalyticsAdapter.js +21 -0
  206. package/src/common-apis/adapters/analyticsAdapters/metrikaAdapter.js +28 -0
  207. package/src/common-apis/adapters/analyticsAdapters/mixpanelAdapter.js +38 -0
  208. package/src/common-apis/adapters/axiosAdapter.js +35 -0
  209. package/src/common-apis/adapters/qrUtils.js +18 -0
  210. package/src/common-apis/external-apis/apiGroups.js +55 -0
  211. package/src/common-apis/external-apis/emailAPI.js +16 -0
  212. package/src/common-apis/external-apis/ipAddressProviders.js +89 -0
  213. package/src/common-apis/globalConstants.jsx +3 -0
  214. package/src/common-apis/models/blockchain.js +10 -0
  215. package/src/common-apis/models/coin.js +248 -0
  216. package/src/common-apis/models/protocol.js +5 -0
  217. package/src/{common → common-apis/services}/fiatCurrenciesService.js +4 -12
  218. package/src/common-apis/tests/integration/external-apis/ipAddressProviders/getClientIpAddress.test.js +12 -0
  219. package/src/common-apis/tests/units/utils/amountUtils/composeRateText.test.js +152 -0
  220. package/src/{common → common-apis/utils}/amountUtils.js +72 -136
  221. package/src/common-apis/utils/cache.js +242 -0
  222. package/src/{common → common-apis/utils}/errorUtils.js +15 -0
  223. package/src/common-apis/utils/logging/logger.js +41 -0
  224. package/src/common-apis/utils/logging/logsStorage.js +61 -0
  225. package/src/common-apis/utils/postponeExecution.js +11 -0
  226. package/src/common-apis/utils/rabbitTicker.js +24 -0
  227. package/src/common-apis/utils/safeStringify.js +50 -0
  228. package/src/index.js +96 -9
  229. package/src/robust-api-caller/cacheAndConcurrentRequestsResolver.js +495 -0
  230. package/src/robust-api-caller/cachedRobustExternalApiCallerService.js +147 -0
  231. package/src/robust-api-caller/cancelProcessing.js +29 -0
  232. package/src/robust-api-caller/concurrentCalculationsMetadataHolder.js +75 -0
  233. package/src/robust-api-caller/externalApiProvider.js +156 -0
  234. package/src/robust-api-caller/externalServicesStatsCollector.js +78 -0
  235. package/src/robust-api-caller/robustExternalAPICallerService.js +304 -0
  236. package/src/robust-api-caller/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/_performCallAttempt.test.js +533 -0
  237. package/src/robust-api-caller/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/callExternalAPI.test.js +532 -0
  238. package/src/robust-api-caller/tests/robustExternalAPICallerService/robustExternalAPICallerService/constructor.test.js +19 -0
  239. package/src/swaps-lib/external-apis/exolixSwapProvider.js +580 -0
  240. package/src/swaps-lib/external-apis/letsExchangeSwapProvider.js +511 -0
  241. package/src/swaps-lib/external-apis/swapProvider.js +578 -0
  242. package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +592 -0
  243. package/src/swaps-lib/models/baseSwapCreationInfo.js +78 -0
  244. package/src/swaps-lib/models/existingSwap.js +143 -0
  245. package/src/swaps-lib/models/existingSwapWithFiatData.js +148 -0
  246. package/src/swaps-lib/models/partner.js +27 -0
  247. package/src/swaps-lib/models/swapProviderCoinInfo.js +82 -0
  248. package/src/swaps-lib/services/publicSwapService.js +490 -0
  249. package/src/swaps-lib/test/external-apis/exolixSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +34 -0
  250. package/src/swaps-lib/test/external-apis/exolixSwapProvider/createSwap.test.js +1043 -0
  251. package/src/swaps-lib/test/external-apis/exolixSwapProvider/getSwapInfo.test.js +611 -0
  252. package/src/swaps-lib/test/external-apis/swapProvider/getAllSupportedCurrencies.test.js +63 -0
  253. package/src/swaps-lib/test/external-apis/swapProvider/getDepositCurrencies.test.js +73 -0
  254. package/src/swaps-lib/test/external-apis/swapProvider/getWithdrawalCurrencies.test.js +102 -0
  255. package/src/swaps-lib/test/external-apis/swapProvider/removeProtocolNameFromCoinName.test.js +152 -0
  256. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +536 -0
  257. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/createSwap.test.js +1214 -0
  258. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getSwapInfo.test.js +1707 -0
  259. package/src/swaps-lib/test/utils/swapUtils/safeHandleRequestsLimitExceeding.test.js +80 -0
  260. package/src/swaps-lib/utils/swapUtils.js +195 -0
  261. package/{styles → src/ui-kit/assets/styles}/_functions.scss +5 -0
  262. package/{styles → src/ui-kit/assets/styles}/_mixins.scss +2 -2
  263. package/{styles → src/ui-kit/assets/styles}/_placeholder.scss +3 -3
  264. package/{styles → src/ui-kit/assets/styles}/_variables.scss +17 -15
  265. package/src/ui-kit/assets/styles/fonts/NunitoSans-Bold.ttf +0 -0
  266. package/src/ui-kit/assets/styles/fonts/NunitoSans-ExtraBold.ttf +0 -0
  267. package/src/ui-kit/assets/styles/fonts/NunitoSans-Light.ttf +0 -0
  268. package/src/ui-kit/assets/styles/fonts/NunitoSans-Regular.ttf +0 -0
  269. package/src/ui-kit/assets/styles/fonts/NunitoSans-SemiBold.ttf +0 -0
  270. package/src/ui-kit/assets/styles/global.scss +171 -0
  271. package/src/ui-kit/assets/styles/index.scss +10 -0
  272. package/src/ui-kit/assets/wrappedImages/arrowIcon.jsx +13 -0
  273. package/src/ui-kit/assets/wrappedImages/arrowTosca.jsx +14 -0
  274. package/src/ui-kit/assets/wrappedImages/arrowWhite.jsx +14 -0
  275. package/src/ui-kit/assets/wrappedImages/darkRectangle.jsx +7 -0
  276. package/src/ui-kit/assets/wrappedImages/determinedError.jsx +118 -0
  277. package/src/ui-kit/assets/wrappedImages/failedValidationIcon.jsx +39 -0
  278. package/src/ui-kit/assets/wrappedImages/infoIcon.jsx +16 -0
  279. package/src/ui-kit/assets/wrappedImages/messageIcon.jsx +87 -0
  280. package/src/ui-kit/assets/wrappedImages/noticeQuestionIcon.jsx +54 -0
  281. package/src/ui-kit/assets/wrappedImages/successfulValidationIcon.jsx +26 -0
  282. package/src/ui-kit/assets/wrappedImages/supportDialogImage.jsx +61 -0
  283. package/src/ui-kit/assets/wrappedImages/walletIcon.jsx +22 -0
  284. package/src/ui-kit/components/atoms/AssetIcon/AssetIcon.jsx +57 -0
  285. package/src/{components → ui-kit/components}/atoms/AssetIcon/asset-icon.module.scss +1 -1
  286. package/src/ui-kit/components/atoms/AssetSelection/AssetSelection.jsx +68 -0
  287. package/src/ui-kit/components/atoms/AssetSelection/asset-selection.module.scss +56 -0
  288. package/src/ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx +34 -0
  289. package/src/ui-kit/components/atoms/BackgroundTitle/background-title.module.scss +52 -0
  290. package/src/ui-kit/components/atoms/InformationMessage/InformationMessage.jsx +51 -0
  291. package/src/ui-kit/components/atoms/InformationMessage/information-message.module.scss +38 -0
  292. package/src/ui-kit/components/atoms/Input/Input.jsx +183 -0
  293. package/src/ui-kit/components/atoms/Input/input.module.scss +107 -0
  294. package/src/{components → ui-kit/components}/atoms/LoadingDots/LoadingDots.jsx +8 -28
  295. package/src/{components → ui-kit/components}/atoms/LoadingDots/LoadingDots.module.scss +3 -2
  296. package/src/ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx +64 -0
  297. package/src/ui-kit/components/atoms/NoticeIcon/notice-icon.module.scss +14 -0
  298. package/src/ui-kit/components/atoms/QrCode/QrCode.jsx +44 -0
  299. package/src/ui-kit/components/atoms/QrCode/qr-code.module.scss +15 -0
  300. package/src/ui-kit/components/atoms/RateSelector/RateSelector.jsx +30 -0
  301. package/src/ui-kit/components/atoms/RateSelector/rate-selector.module.scss +47 -0
  302. package/src/{components → ui-kit/components}/atoms/SupportChat/SupportChat.jsx +5 -1
  303. package/src/ui-kit/components/atoms/Textarea/Textarea.jsx +148 -0
  304. package/src/ui-kit/components/atoms/Textarea/textarea.module.scss +71 -0
  305. package/src/ui-kit/components/atoms/TitleBox/TitleBox.jsx +141 -0
  306. package/src/ui-kit/components/atoms/TitleBox/title-box.module.scss +32 -0
  307. package/src/ui-kit/components/atoms/Tooltip/Tooltip.jsx +77 -0
  308. package/src/ui-kit/components/atoms/Tooltip/tooltip.module.scss +237 -0
  309. package/src/ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx +76 -0
  310. package/src/ui-kit/components/atoms/TwoLinesOfText/lines-of-text.module.scss +65 -0
  311. package/src/ui-kit/components/atoms/Validation/Validation.jsx +39 -0
  312. package/src/ui-kit/components/atoms/Validation/validation.module.scss +19 -0
  313. package/src/{components → ui-kit/components}/atoms/buttons/Button/Button.jsx +24 -50
  314. package/src/{components → ui-kit/components}/atoms/buttons/Button/Button.module.scss +1 -1
  315. package/src/ui-kit/components/atoms/buttons/Close/Close.jsx +58 -0
  316. package/src/ui-kit/components/atoms/buttons/Close/close.module.scss +75 -0
  317. package/src/ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx +112 -0
  318. package/src/ui-kit/components/atoms/buttons/LinkButton/link-button.module.scss +49 -0
  319. package/src/ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx +110 -0
  320. package/src/ui-kit/components/atoms/buttons/RadioButtonWithText/radio-button-with-text.module.scss +86 -0
  321. package/src/ui-kit/components/molecules/AmountInput/AmountInput.jsx +448 -0
  322. package/src/ui-kit/components/molecules/AmountInput/amount-input.module.scss +233 -0
  323. package/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx +463 -0
  324. package/src/ui-kit/components/molecules/CoinPicker/coin-picker.module.scss +207 -0
  325. package/src/ui-kit/components/molecules/ColoredNotice/ColoredNotice.jsx +42 -0
  326. package/src/ui-kit/components/molecules/ColoredNotice/colored-notice.module.scss +20 -0
  327. package/src/ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx +35 -0
  328. package/src/ui-kit/components/molecules/LineWithIconLink/line-with-icon-link.module.scss +25 -0
  329. package/src/ui-kit/components/molecules/LogoCarousel/LogoCarousel.jsx +74 -0
  330. package/src/ui-kit/components/molecules/LogoCarousel/logo-carousel.module.scss +106 -0
  331. package/src/ui-kit/components/molecules/SearchableCoinsList/SearchableCoinsList.jsx +137 -0
  332. package/src/ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx +32 -0
  333. package/src/ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx +66 -0
  334. package/src/ui-kit/components/organisms/Dialog/Dialog.jsx +494 -0
  335. package/src/ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx +132 -0
  336. package/src/ui-kit/components/organisms/Dialog/DialogButtons/dialog-buttons.module.scss +25 -0
  337. package/src/ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx +554 -0
  338. package/src/ui-kit/components/organisms/Dialog/DialogStep/dialog-step.module.scss +381 -0
  339. package/src/ui-kit/components/organisms/Dialog/dialog.module.scss +226 -0
  340. package/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx +1374 -0
  341. package/src/ui-kit/components/organisms/SwapForm/swap-form.module.scss +134 -0
  342. package/src/ui-kit/components/organisms/WaitlistSubscription/WaitlistSubscription.jsx +158 -0
  343. package/src/ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx +77 -0
  344. package/src/ui-kit/hooks/useCallHandlingErrors.js +22 -0
  345. package/src/ui-kit/hooks/useIsHydrated.js +12 -0
  346. package/src/ui-kit/hooks/useReferredState.js +24 -0
  347. package/src/ui-kit/tests/utils/inputValueProviders/provideFormatOfFloatValueByInputString.test.js +146 -0
  348. package/src/ui-kit/tests/utils/urlQueryUtils/getQueryParameterValues.test.js +65 -0
  349. package/src/ui-kit/tests/utils/urlQueryUtils/saveQueryParameterAndValues.test.js +104 -0
  350. package/src/ui-kit/utils/inputValueProviders.js +50 -0
  351. package/src/ui-kit/utils/textUtils.js +18 -0
  352. package/src/ui-kit/utils/uiUtils.js +12 -0
  353. package/src/ui-kit/utils/urlQueryUtils.js +62 -0
  354. package/stories/font.scss +40 -0
  355. package/stories/stubs/coins.jsx +2266 -0
  356. package/stories/stubs/exampleContent.jsx +20 -0
  357. package/src/components/atoms/AssetIcon/AssetIcon.jsx +0 -55
  358. package/styles/_global-classes.scss +0 -433
  359. package/styles/fonts/NunitoSans-Bold.ttf +0 -0
  360. package/styles/fonts/NunitoSans-ExtraBold.ttf +0 -0
  361. package/styles/fonts/NunitoSans-Light.ttf +0 -0
  362. package/styles/fonts/NunitoSans-Regular.ttf +0 -0
  363. package/styles/fonts/NunitoSans-SemiBold.ttf +0 -0
  364. package/styles/global-styles-index.scss +0 -74
  365. package/styles/index.scss +0 -33
  366. /package/{styles → src/ui-kit/assets/styles}/colors/_light-colors.scss +0 -0
  367. /package/{styles → src/ui-kit/assets/styles}/colors/_solid-colors.scss +0 -0
  368. /package/{styles → src/ui-kit/assets/styles}/size/_margin-size.scss +0 -0
  369. /package/{styles → src/ui-kit/assets/styles}/size/_padding-size.scss +0 -0
@@ -0,0 +1,134 @@
1
+ @use "../../../assets/styles/index" as *;
2
+
3
+ .swap-form {
4
+ width: 100%;
5
+
6
+ &-inputs {
7
+ position: relative;
8
+ z-index: 2;
9
+
10
+ &-separator {
11
+ height: 4px;
12
+ display: flex;
13
+ justify-content: center;
14
+ align-items: center;
15
+ user-select: none;
16
+
17
+ img {
18
+ margin: -13px 0;
19
+ }
20
+
21
+ &:not(.disabled) {
22
+ @extend %hover-state;
23
+ }
24
+
25
+ &.disabled {
26
+ opacity: 0.7;
27
+ }
28
+ }
29
+ }
30
+
31
+ &-information-field {
32
+ z-index: 1;
33
+ background-color: SolidColor("lightsmoke");
34
+ margin-top: 4px;
35
+ border-radius: 0 0 8px 8px;
36
+ padding: 10px 20px;
37
+ position: relative;
38
+ text-align: left;
39
+
40
+ .semi-transparent {
41
+ opacity: 0.5;
42
+ }
43
+
44
+ p {
45
+ color: SolidColor("grey");
46
+
47
+ .interactable {
48
+ text-decoration: underline;
49
+ cursor: pointer;
50
+ transition: 0.3s;
51
+
52
+ @media (hover: hover) {
53
+ &:hover {
54
+ opacity: 0.7;
55
+ transition: 0s;
56
+ }
57
+ }
58
+
59
+ &:active {
60
+ text-decoration: none;
61
+ }
62
+ }
63
+
64
+ .red {
65
+ color: SolidColor("red");
66
+ }
67
+ }
68
+
69
+ &::before {
70
+ z-index: 0;
71
+ content: "";
72
+ position: absolute;
73
+ left: 0;
74
+ bottom: calc(100% + 4px);
75
+
76
+ width: 100%;
77
+ height: 20px;
78
+ border-radius: 8px;
79
+ background-color: transparent;
80
+ box-shadow:
81
+ 0px 0px 0px 4px $white,
82
+ 0px 10px 0px 0px SolidColor("lightsmoke");
83
+ }
84
+ }
85
+
86
+ &-address-field {
87
+ margin-top: Margin("5");
88
+ display: flex;
89
+ flex-direction: column;
90
+ gap: Margin("3");
91
+ }
92
+
93
+ &-rate-selector {
94
+ margin-bottom: Margin("5");
95
+ display: block;
96
+ width: 100%;
97
+ }
98
+
99
+ &-validation-text {
100
+ margin-top: Margin("5");
101
+ }
102
+
103
+ &-button-container {
104
+ &-consent-text {
105
+ text-align: end;
106
+ color: SolidColor("grey");
107
+ font-size: 13px;
108
+ font-style: italic;
109
+
110
+ @media (max-width: $phone-width) {
111
+ text-align: center;
112
+ }
113
+
114
+ &-link {
115
+ color: SolidColor("grey");
116
+ text-decoration: underline;
117
+
118
+ &:active {
119
+ text-decoration: none;
120
+ }
121
+ }
122
+ }
123
+
124
+ display: flex;
125
+ justify-content: flex-end;
126
+ align-items: center;
127
+ margin-top: Margin("10");
128
+ gap: Margin("3");
129
+
130
+ @media (max-width: $phone-width) {
131
+ flex-direction: column-reverse;
132
+ }
133
+ }
134
+ }
@@ -0,0 +1,158 @@
1
+ import React, { useEffect, useState } from "react";
2
+ import PropTypes from "prop-types";
3
+
4
+ import { logErrorOrOutputToConsole } from "../../../../common-apis/utils/errorUtils.js";
5
+ import { Coin } from "../../../../common-apis/models/coin";
6
+
7
+ import { ColoredNotice } from "../../molecules/ColoredNotice/ColoredNotice";
8
+ import { Dialog } from "../Dialog/Dialog";
9
+ import { DialogStep } from "../Dialog/DialogStep/DialogStep";
10
+ import { Input } from "../../atoms/Input/Input";
11
+ import { TitleBox } from "../../atoms/TitleBox/TitleBox";
12
+ import { Validation } from "../../atoms/Validation/Validation";
13
+
14
+ import messageIcon from "../../../assets/wrappedImages/messageIcon";
15
+ import supportDialogImage from "../../../assets/wrappedImages/supportDialogImage";
16
+
17
+ /**
18
+ * Saves a user's subscription to receive notifications about a specific coin.
19
+ * This function sends an email to subscribe the user to notifications for the specified coin.
20
+ *
21
+ * @function
22
+ * @name saveSubscription
23
+ * @param {Coin} coin - The coin object containing information about the coin, including its ticker symbol.
24
+ * @param {string} address - The email address of the user who wishes to subscribe.
25
+ * @returns {Promise<boolean>} A promise that resolves to `true` if the subscription email was sent successfully, or `false` if an error occurred during the process.
26
+ */
27
+
28
+ /**
29
+ * WaitlistSubscription component handles user subscription to a waitlist for coin notifications.
30
+ * It displays a notice with a button to open a dialog where the user can enter their email to subscribe.
31
+ *
32
+ * @component
33
+ * @param {Object} props - The component props.
34
+ * @param {Coin} props.coin - The coin object containing information about the coin.
35
+ * @param {Object} props.translations - The text translations for the component.
36
+ * @param {saveSubscription} props.saveSubscription - Function to handle/save the subscription.
37
+ * @returns {JSX.Element} The WaitlistSubscription component.
38
+ */
39
+ export const WaitlistSubscription = ({ coin, translations, saveSubscription }) => {
40
+ const [controls, initControls] = useState();
41
+ const [showDialog, setShowDialog] = useState(false);
42
+ const [inputValue, setInputValue] = useState("");
43
+ const [isEmailValid, setIsEmailValid] = useState(false);
44
+ const [errorEncountered, setErrorEncountered] = useState(false);
45
+
46
+ const defaultTranslations = {
47
+ coloredNotice: {
48
+ text: "This is a pre-listed coin, meaning that the swap is not yet available. As soon as this coin allows exchanges, it will be automatically enabled. If you want to get a notification as soon as this coin becomes available for swap - sign up for the waitlist below!",
49
+ buttonTitle: "Subscribe for updates",
50
+ },
51
+ signUpStep: {
52
+ title: coin.latinName + " (" + coin.ticker + ") listing notification",
53
+ subtitle:
54
+ "To be notified as soon as " +
55
+ coin.latinName +
56
+ " becomes available for swaps, please provide your email address. We’ll send you a single notification when it’s listed.",
57
+ actionButtonTitle: "Subscribe",
58
+ inputTitle: "Your email address:",
59
+ error: "Something went wrong. Please try again later.",
60
+ },
61
+ successStep: {
62
+ title: "Subscribed successfully!",
63
+ subtitle:
64
+ "We’ll notify you as soon as " +
65
+ coin.latinName +
66
+ " becomes available for swaps. Keep an eye on your inbox for the update.",
67
+ actionButtonTitle: "Close",
68
+ },
69
+ };
70
+
71
+ const t = translations ?? defaultTranslations;
72
+
73
+ const STEPS = {
74
+ signUp: "signUp",
75
+ success: "success",
76
+ };
77
+
78
+ const subscribe = async resetButtonLoader => {
79
+ try {
80
+ setErrorEncountered(false);
81
+ const result = await saveSubscription(coin, inputValue);
82
+ if (result) {
83
+ controls?.goToStep(STEPS.success);
84
+ } else {
85
+ setErrorEncountered(true);
86
+ }
87
+ resetButtonLoader();
88
+ } catch (e) {
89
+ resetButtonLoader();
90
+ logErrorOrOutputToConsole(e);
91
+ setShowDialog(false);
92
+ }
93
+ };
94
+
95
+ const openDialog = () => {
96
+ setErrorEncountered(false);
97
+ setInputValue("");
98
+ setIsEmailValid(false);
99
+ controls?.toFirstStep(false);
100
+ setShowDialog(true);
101
+ };
102
+
103
+ useEffect(() => {
104
+ setIsEmailValid(/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(inputValue));
105
+ // eslint-disable-next-line react-hooks/exhaustive-deps
106
+ }, [inputValue]);
107
+
108
+ return (
109
+ <>
110
+ <Dialog
111
+ initControls={controls => initControls(controls)}
112
+ showDialog={showDialog}
113
+ onClose={() => setShowDialog(false)}
114
+ >
115
+ <DialogStep
116
+ stepName={STEPS.signUp}
117
+ controls={controls}
118
+ title={t.signUpStep.title}
119
+ subtitle={t.signUpStep.subtitle}
120
+ confirmButtonClick={subscribe}
121
+ confirmButtonEnabled={isEmailValid}
122
+ confirmButtonText={t.signUpStep.actionButtonTitle}
123
+ primaryButtonLoader={true}
124
+ subtitleSmallMargin
125
+ showBackgroundTitle={false}
126
+ ImageRaw={messageIcon}
127
+ >
128
+ <TitleBox title={t.signUpStep.inputTitle}>
129
+ <Input type="text" onChange={e => setInputValue(e.target.value)} value={inputValue} />
130
+ {errorEncountered ? <Validation text={t.signUpStep.error} /> : null}
131
+ </TitleBox>
132
+ </DialogStep>
133
+ <DialogStep
134
+ stepName={STEPS.success}
135
+ controls={controls}
136
+ title={t.successStep.title}
137
+ subtitle={t.successStep.subtitle}
138
+ confirmButtonClick={() => setShowDialog(false)}
139
+ confirmButtonText={t.successStep.actionButtonTitle}
140
+ showBackgroundTitle={false}
141
+ ImageRaw={supportDialogImage}
142
+ showCornerBackButton={false}
143
+ subtitleSmallMargin
144
+ />
145
+ </Dialog>
146
+ <ColoredNotice
147
+ text={t.coloredNotice.text}
148
+ buttonTitle={t.coloredNotice.buttonTitle}
149
+ onButtonClick={openDialog}
150
+ />
151
+ </>
152
+ );
153
+ };
154
+
155
+ WaitlistSubscription.propTypes = {
156
+ coin: PropTypes.object.isRequired,
157
+ translations: PropTypes.object,
158
+ };
@@ -0,0 +1,77 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+
4
+ import { DialogStep } from "../../organisms/Dialog/DialogStep/DialogStep.jsx";
5
+
6
+ import determinedErrorImage from "../../../assets/wrappedImages/determinedError.jsx";
7
+
8
+ /**
9
+ * Template dialog step to display an error through the title and subtitle.
10
+ * You can insert it into any dialog windows and implement them into flows.
11
+ *
12
+ * @param {object} props - Component props.
13
+ * @param {object} props.controls - Control elements for the dialog.
14
+ * @param {string} props.stepName - Name of the current step.
15
+ * @param {string} props.title - Title of the dialog.
16
+ * @param {string} props.subtitle - Subtitle of the dialog.
17
+ * @param {string} props.backButtonText - Text for the back button.
18
+ * @param {Function} props.backButtonClick - Handler for back button click.
19
+ * @param {string} props.backButtonLink - Link for the back button.
20
+ * @param {string} props.confirmButtonText - Text for the confirm button.
21
+ * @param {Function} props.confirmButtonClick - Handler for confirm button click.
22
+ * @param {string} props.confirmButtonLink - Link for the confirm button.
23
+ * @param {boolean} props.showCornerBackButton - Whether to show the corner back button.
24
+ * @returns {JSX.Element} React component
25
+ */
26
+ export const DeterminedErrorDialogStep = ({
27
+ controls,
28
+ stepName,
29
+ title,
30
+ subtitle,
31
+ backButtonText,
32
+ backButtonClick,
33
+ backButtonLink,
34
+ confirmButtonText,
35
+ confirmButtonClick,
36
+ confirmButtonLink,
37
+ showCornerBackButton,
38
+ }) => {
39
+ return (
40
+ <DialogStep
41
+ controls={controls}
42
+ stepName={stepName}
43
+ ImageRaw={determinedErrorImage}
44
+ title={title}
45
+ subtitle={subtitle}
46
+ backButtonText={backButtonText}
47
+ backButtonClick={backButtonClick}
48
+ backButtonTo={backButtonLink}
49
+ confirmButtonText={confirmButtonText}
50
+ confirmButtonClick={confirmButtonClick}
51
+ confirmButtonLink={confirmButtonLink}
52
+ showCornerBackButton={showCornerBackButton}
53
+ />
54
+ );
55
+ };
56
+
57
+ DeterminedErrorDialogStep.propTypes = {
58
+ controls: PropTypes.object,
59
+ stepName: PropTypes.string,
60
+ title: PropTypes.string.isRequired,
61
+ subtitle: PropTypes.string.isRequired,
62
+ backButtonText: PropTypes.string,
63
+ backButtonClick: PropTypes.func,
64
+ backButtonLink: PropTypes.string,
65
+ confirmButtonText: PropTypes.string,
66
+ confirmButtonClick: PropTypes.func,
67
+ confirmButtonLink: PropTypes.string,
68
+ showCornerBackButton: PropTypes.bool,
69
+ };
70
+
71
+ DeterminedErrorDialogStep.defaultProps = {
72
+ backButtonText: "",
73
+ backButtonClick: null,
74
+ confirmButtonText: "",
75
+ confirmButtonClick: null,
76
+ showCornerBackButton: false,
77
+ };
@@ -0,0 +1,22 @@
1
+ import { useCallback, useState } from "react";
2
+
3
+ import { Logger } from "../../common-apis/utils/logging/logger.js";
4
+
5
+ export function useCallHandlingErrors() {
6
+ const [, setState] = useState();
7
+ return useCallback(
8
+ async (functionToBeCalled, event) => {
9
+ try {
10
+ await functionToBeCalled(event);
11
+ } catch (error) {
12
+ Logger.logError(error, functionToBeCalled?.name || "errorBoundaryTrigger", "Caught by ErrorBoundary");
13
+ // Triggering ErrorBoundary
14
+ setState(() => {
15
+ throw error;
16
+ });
17
+ }
18
+ },
19
+
20
+ []
21
+ );
22
+ }
@@ -0,0 +1,12 @@
1
+ import { useState, useEffect } from "react";
2
+
3
+ // Custom hook to check if the component is hydrated
4
+ export function useIsHydrated() {
5
+ const [isHydrated, setIsHydrated] = useState(false);
6
+
7
+ useEffect(() => {
8
+ setIsHydrated(true);
9
+ }, []);
10
+
11
+ return isHydrated;
12
+ }
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+
3
+ /**
4
+ * Adds reference to standard state variable. It is helpful to be able to use state variable value inside
5
+ * event handlers and other callbacks without the need to call setState(prev => { value = prev; return prev; }).
6
+ *
7
+ * @param initialValue {any} to be passed to useState
8
+ * @return {[React.Ref, function]} reference to state variable and its setter
9
+ */
10
+ export function useReferredState(initialValue) {
11
+ const [state, setState] = React.useState(initialValue);
12
+ const reference = React.useRef(state);
13
+
14
+ const setReferredState = value => {
15
+ if (value && {}.toString.call(value) === "[object Function]") {
16
+ value = value(reference.current);
17
+ }
18
+
19
+ reference.current = value;
20
+ setState(value);
21
+ };
22
+
23
+ return [reference, setReferredState];
24
+ }
@@ -0,0 +1,146 @@
1
+ import should from "should";
2
+
3
+ import { describe, it } from "vitest";
4
+ import { InputValuesProviders } from "../../../utils/inputValueProviders.js";
5
+
6
+ describe("InputValueProviders", function () {
7
+ describe("#provideFormatOfFloatValueByInputString", function () {
8
+ [
9
+ {
10
+ max: null,
11
+ maxSuffix: 2,
12
+ test: "1989401950928592501985.3233",
13
+ expected: "1989401950928592501985.32",
14
+ message: "Should not touch prefix if max is null",
15
+ },
16
+ {
17
+ max: null,
18
+ maxSuffix: 2,
19
+ test: "1989.",
20
+ expected: "1989.",
21
+ message: "Should correctly handle ending dot",
22
+ },
23
+ {
24
+ max: null,
25
+ maxSuffix: 2,
26
+ test: "1989,",
27
+ expected: "1989.",
28
+ message: "Should correctly handle ending comma",
29
+ },
30
+ {
31
+ max: 21000000,
32
+ maxSuffix: 2,
33
+ test: "1989401950928592501985.3243",
34
+ expected: "92501985.32",
35
+ message: "Should left no more than max digits count for prefix - some prefix case",
36
+ },
37
+ {
38
+ max: 3,
39
+ maxSuffix: 2,
40
+ test: "1989401950928592501985.3243",
41
+ expected: "5.32",
42
+ message: "Should left no more than max digits count for prefix - min prefix case",
43
+ },
44
+ {
45
+ max: 21000000,
46
+ maxSuffix: 1,
47
+ test: "232.1243",
48
+ expected: "232.1",
49
+ message:
50
+ "Should left no more than maxSuffix digits count in suffix - case maxSuffix is minimal = 1 and actual is londer",
51
+ },
52
+ {
53
+ max: 21000000,
54
+ maxSuffix: 1,
55
+ test: "232.1",
56
+ expected: "232.1",
57
+ message:
58
+ "Should left no more than maxSuffix digits count in suffix - case maxSuffix is minimal = 1 and actual is the same length",
59
+ },
60
+ {
61
+ max: 21000000,
62
+ maxSuffix: 8,
63
+ test: "232.1243909909",
64
+ expected: "232.12439099",
65
+ message:
66
+ "Should left no more than maxSuffix digits count in suffix - some maxSuffix case and actual suffix longer",
67
+ },
68
+ {
69
+ max: 21000000,
70
+ maxSuffix: 8,
71
+ test: "232.1243",
72
+ expected: "232.1243",
73
+ message:
74
+ "Should left no more than maxSuffix digits count in suffix - some maxSuffix case and actual suffix shorter",
75
+ },
76
+ {
77
+ max: null,
78
+ maxSuffix: 2,
79
+ test: "1323,23",
80
+ expected: "1323.23",
81
+ message: "Should replace comma with dot",
82
+ },
83
+ {
84
+ max: null,
85
+ maxSuffix: 8,
86
+ test: "434,343,3423",
87
+ expected: "434.343",
88
+ message: "Should remove all after the second comma and itself",
89
+ },
90
+ {
91
+ max: null,
92
+ maxSuffix: 8,
93
+ test: "434.343.3423",
94
+ expected: "434.343",
95
+ message: "Should remove all after the second dot and itself",
96
+ },
97
+ {
98
+ max: null,
99
+ maxSuffix: 8,
100
+ test: "`3|49(3.3@43f",
101
+ expected: "3493.343",
102
+ message: "Should remove all non-digits and non-dot symbols",
103
+ },
104
+ {
105
+ max: null,
106
+ maxSuffix: 8,
107
+ test: ".219",
108
+ expected: "0.219",
109
+ message: "Should add leading zero",
110
+ },
111
+ {
112
+ max: null,
113
+ maxSuffix: 8,
114
+ test: "32..219",
115
+ expected: "32.219",
116
+ message: "Should replace the series of dots with the only",
117
+ },
118
+ {
119
+ max: null,
120
+ maxSuffix: 8,
121
+ test: "32,,219",
122
+ expected: "32.219",
123
+ message: "Should replace the series of commas with the only",
124
+ },
125
+ ].forEach(testData => {
126
+ it(testData.message, function () {
127
+ InputValuesProviders.provideFormatOfFloatValueByInputString(
128
+ testData.test,
129
+ testData.maxSuffix,
130
+ testData.max
131
+ ).should.be.equal(testData.expected);
132
+ });
133
+ });
134
+
135
+ it("Should throw an error if passed suffix length less than 0", function () {
136
+ let error = null;
137
+ try {
138
+ InputValuesProviders.provideFormatOfFloatValueByInputString("23232", -1);
139
+ } catch (e) {
140
+ error = e;
141
+ }
142
+
143
+ (error?.message ?? "").should.startWith("Min suffix length is 0, got");
144
+ });
145
+ });
146
+ });
@@ -0,0 +1,65 @@
1
+ import should from "should";
2
+
3
+ import { beforeEach, afterEach, describe, it } from "vitest";
4
+ import { getQueryParameterValues } from "../../../utils/urlQueryUtils.js";
5
+
6
+ describe("urlQueryUtils", function () {
7
+ describe("#getQueryParameterValues", function () {
8
+ beforeEach(function () {});
9
+
10
+ afterEach(function () {
11
+ global.window = {};
12
+ });
13
+
14
+ function setCustomQueryString(query) {
15
+ global.window = {
16
+ location: {
17
+ search: query,
18
+ },
19
+ };
20
+ }
21
+
22
+ it("Should unescape parameter values", function () {
23
+ const parameterValuesWithSpecialSymbols = "#a@se /wer|*|##eee$";
24
+ setCustomQueryString(`?a=${encodeURIComponent(parameterValuesWithSpecialSymbols)}`);
25
+ const result = getQueryParameterValues("a");
26
+
27
+ result.should.be.deepEqual([...parameterValuesWithSpecialSymbols.split("|*|")]);
28
+ });
29
+
30
+ it("Should return empty array if there is no such parameter in the query", function () {
31
+ setCustomQueryString(`?a=val&b=val2`);
32
+ const result = getQueryParameterValues("c");
33
+
34
+ result.should.be.deepEqual([]);
35
+ });
36
+
37
+ it("Should return array with the only empty string element if the value of the parameter is empty", function () {
38
+ setCustomQueryString(`?a=`);
39
+ const result = getQueryParameterValues("a");
40
+
41
+ result.should.be.deepEqual([""]);
42
+ });
43
+
44
+ it("Should return array with one value", function () {
45
+ setCustomQueryString(`?a=val1`);
46
+ const result = getQueryParameterValues("a");
47
+
48
+ result.should.be.deepEqual(["val1"]);
49
+ });
50
+
51
+ it("Should return array with several values", function () {
52
+ setCustomQueryString(`?a=${encodeURIComponent("val1|*|val2")}`);
53
+ const result = getQueryParameterValues("a");
54
+
55
+ result.should.be.deepEqual(["val1", "val2"]);
56
+ });
57
+
58
+ it("Should return array of all values if parameter is defined several times in the query", function () {
59
+ setCustomQueryString(`?a=${encodeURIComponent("val1|*|val2")}&a=val3`);
60
+ const result = getQueryParameterValues("a");
61
+
62
+ result.should.be.deepEqual(["val1", "val2", "val3"]);
63
+ });
64
+ });
65
+ });