@stokr/components-library 3.0.16 → 3.0.17

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 (379) hide show
  1. package/README.md +261 -262
  2. package/dist/analytics/index.js +180 -0
  3. package/dist/api/auth.js +15 -0
  4. package/dist/api/fetchData.js +27 -0
  5. package/dist/api/fetchDataPublic.js +19 -0
  6. package/dist/auth/index.js +32 -0
  7. package/dist/components/2FA/Connect2FA.js +55 -0
  8. package/dist/components/2FA/EnterCode.js +63 -0
  9. package/dist/components/2FA/InstallAuthApp.js +64 -0
  10. package/dist/components/2FA/ResetCode.js +33 -0
  11. package/dist/components/2FA/Sucess2FA.js +51 -0
  12. package/dist/components/2FA/disable-2fa-flow.js +91 -0
  13. package/dist/components/2FA/enable-2fa-flow.js +137 -0
  14. package/dist/components/2FA/login-with-otp-flow.js +206 -0
  15. package/dist/components/2FA/main-flow.js +217 -0
  16. package/dist/components/AccountBalance/AccountBalance.js +35 -0
  17. package/dist/components/AccountBalance/AccountBalance.styles.js +48 -0
  18. package/dist/components/AdminDashboard/Table/ReactTable.js +266 -0
  19. package/dist/components/AdminDashboard/Table/ReactTableWrapper.js +65 -0
  20. package/dist/components/AdminDashboard/Table/Table.js +123 -0
  21. package/dist/components/AdminDashboard/Table/Table.styles.js +263 -0
  22. package/dist/components/AgreementItem/AgreementItem.js +39 -0
  23. package/dist/components/AgreementItem/AgreementItem.styles.js +32 -0
  24. package/dist/components/BackButton/BackButton.js +34 -0
  25. package/dist/components/BackButton/BackButton.styles.js +123 -0
  26. package/dist/components/Background/Background.js +45 -0
  27. package/dist/components/Background/Background.styles.js +119 -0
  28. package/dist/components/BasicTable/BasicTable.js +25 -0
  29. package/dist/components/BasicTable/BasicTable.styles.js +76 -0
  30. package/dist/components/BlogPost/BlogPost.js +98 -0
  31. package/dist/components/BlogPost/BlogPost.styles.js +230 -0
  32. package/dist/components/Button/Button.styles.js +207 -0
  33. package/dist/components/ButtonContainer/ButtonContainer.styles.js +51 -0
  34. package/dist/components/CapitalRaisedSummary/CaptialRaisedSummary.js +18 -0
  35. package/dist/components/CapitalRaisedSummary/CaptialRaisedSummary.styles.js +41 -0
  36. package/dist/components/Card/Card.styles.js +97 -0
  37. package/dist/components/ChartLegend/ChartLegend.js +62 -0
  38. package/dist/components/ChartLegend/ChartLegend.styles.js +133 -0
  39. package/dist/components/Checkbox/Checkbox.js +80 -0
  40. package/dist/components/Checkbox/Checkbox.styles.js +133 -0
  41. package/dist/components/Checklist/ChecklistCard.js +71 -0
  42. package/dist/components/Checklist/ChecklistCard.styles.js +82 -0
  43. package/dist/components/Chips/Chip.js +23 -0
  44. package/dist/components/Chips/Chip.styles.js +72 -0
  45. package/dist/components/Chips/ChipWrapper.js +50 -0
  46. package/dist/components/ComponentScroll/ComponentScroll.js +70 -0
  47. package/dist/components/ComponentScroll/ComponentScroll.styles.js +127 -0
  48. package/dist/components/ComponentWrapper/ComponentWrapper.styles.js +165 -0
  49. package/dist/components/ConfirmModal/ConfirmModal.js +187 -0
  50. package/dist/components/ConfirmModal/ConfirmModal.styles.js +44 -0
  51. package/dist/components/CryptoAddress/ComponentWrap.js +16 -0
  52. package/dist/components/CryptoAddress/CryptoAddress.js +151 -0
  53. package/dist/components/CryptoAddress/CryptoAddress.styles.js +443 -0
  54. package/dist/components/CryptoAddress/RadioWrap.js +47 -0
  55. package/dist/components/CryptoAddressDetails/CryptoAddressDetails.js +34 -0
  56. package/dist/components/CryptoAddressDetails/CryptoAddressDetails.styles.js +125 -0
  57. package/dist/components/CryptoAddressWrapper/CryptoAddressWrapper.js +25 -0
  58. package/dist/components/CryptoAddressWrapper/CryptoAddressWrapper.styles.js +111 -0
  59. package/dist/components/DoubleButton/DoubleButton.styles.js +27 -0
  60. package/dist/components/ErrorMessage/ErrorMessage.styles.js +9 -0
  61. package/dist/components/FAQ/FAQ.js +73 -0
  62. package/dist/components/FAQ/FAQ.styles.js +128 -0
  63. package/dist/components/Footer/Footer.js +55 -0
  64. package/dist/components/Footer/Footer.styles.js +256 -0
  65. package/dist/components/Footer/FooterLayout.js +145 -0
  66. package/dist/components/Footer/FooterMenu.js +100 -0
  67. package/dist/components/Footer/FooterMenu.styles.js +321 -0
  68. package/dist/components/ForgotPasswordModal/ForgotPasswordModal.js +100 -0
  69. package/dist/components/Form/Form.js +21 -0
  70. package/dist/components/Form/Form.styles.js +72 -0
  71. package/dist/components/Grid/Grid.styles.js +212 -0
  72. package/dist/components/Header/Header.js +425 -0
  73. package/dist/components/Header/Header.styles.js +567 -0
  74. package/dist/components/HeroBlock/HeroVideoBlock.js +105 -0
  75. package/dist/components/Icon/Icon.style.js +92 -0
  76. package/dist/components/Icon/Icon2.js +12 -0
  77. package/dist/components/InfoIcon/InfoIcon.js +62 -0
  78. package/dist/components/InfoIcon/InfoIcon.styles.js +64 -0
  79. package/dist/components/Input/DatePickerInput.js +139 -0
  80. package/dist/components/Input/DatePickerInput.styles.js +165 -0
  81. package/dist/components/Input/Input.js +108 -0
  82. package/dist/components/Input/Input.styles.js +154 -0
  83. package/dist/components/Input/InputPassword.js +122 -0
  84. package/dist/components/Input/InputPassword.styles.js +166 -0
  85. package/dist/components/Input/InputUsername.js +92 -0
  86. package/dist/components/Input/InputWithButton.js +53 -0
  87. package/dist/components/Input/InputWithButton.styles.js +57 -0
  88. package/dist/components/Input/MultiSelect.js +306 -0
  89. package/dist/components/Input/OtpInput.js +70 -0
  90. package/dist/components/Input/RangeInput.js +80 -0
  91. package/dist/components/Input/RangeInput.styles.js +129 -0
  92. package/dist/components/Input/SearchInput.js +68 -0
  93. package/dist/components/Input/SearchInput.styles.js +92 -0
  94. package/dist/components/Input/Select.js +151 -0
  95. package/dist/components/Input/Select.styles.js +148 -0
  96. package/dist/components/Input/TableFilterDropdown.js +247 -0
  97. package/dist/components/Input/Textarea.js +51 -0
  98. package/dist/components/Input/Textarea.styles.js +62 -0
  99. package/dist/components/InvestCalculator/InvestCalculator.js +283 -0
  100. package/dist/components/InvestCalculator/InvestCalculator.styles.js +94 -0
  101. package/dist/components/InvestmentStat/InvestmentStat.js +24 -0
  102. package/dist/components/InvestmentStat/InvestmentStat.styles.js +62 -0
  103. package/dist/components/LatestUpdate/LatestUpdate.js +24 -0
  104. package/dist/components/LatestUpdate/LatestUpdate.styles.js +90 -0
  105. package/dist/components/Layout/Layout.js +69 -0
  106. package/dist/components/LearnMoreCarousel/LearnMoreCarousel.js +32 -0
  107. package/dist/components/LearnMoreCarousel/LearnMoreCarousel.styles.js +208 -0
  108. package/dist/components/LearnMorePage/LearnMore.js +190 -0
  109. package/dist/components/LearnMorePage/LearnMore.propTypes.js +20 -0
  110. package/dist/components/LearnMorePage/LearnMore.shared.styles.js +56 -0
  111. package/dist/components/LearnMorePage/LearnMore.styles.js +276 -0
  112. package/dist/components/LearnMorePage/LearnMoreExampleObject.js +120 -0
  113. package/dist/components/LearnMorePage/LearnMoreItem.js +57 -0
  114. package/dist/components/LearnMorePage/LearnMoreItem.styles.js +234 -0
  115. package/dist/components/LearnMoreSection/LearnMore.js +138 -0
  116. package/dist/components/LearnMoreSection/LearnMore.styles.js +147 -0
  117. package/dist/components/LearnMoreSection/LearnMoreItem.js +33 -0
  118. package/dist/components/LearnMoreSection/LearnMoreItem.styles.js +60 -0
  119. package/dist/components/LoginModal/LoginModal.js +142 -0
  120. package/dist/components/MainMenu/DynamicMainMenu.js +38 -0
  121. package/dist/components/MainMenu/MainMenu.js +210 -0
  122. package/dist/components/MainMenu/MainMenu.styles.js +362 -0
  123. package/dist/components/MenuNav/MenuNav.styles.js +66 -0
  124. package/dist/components/Modal/Modal.js +119 -0
  125. package/dist/components/Modal/Modal.styles.js +450 -0
  126. package/dist/components/Modal/NewVentureModal/NewVentureModal.js +262 -0
  127. package/dist/components/Modal/PaymentModal.js +149 -0
  128. package/dist/components/Modal/SideModal.js +89 -0
  129. package/dist/components/Modal/SideModal.styles.js +55 -0
  130. package/dist/components/Modal/SuccessModal/SuccessModal.js +170 -0
  131. package/dist/components/Modal/SuccessModal/SuccessModal.styles.js +53 -0
  132. package/dist/components/MultiProgressBar/MultiProgressBar.js +30 -0
  133. package/dist/components/MultiProgressBar/MultiProgressBar.styles.js +105 -0
  134. package/dist/components/Newsletter/Newsletter.js +122 -0
  135. package/dist/components/Newsletter/Newsletter.styles.js +186 -0
  136. package/dist/components/NotificationCounter/NotificationCounter.styles.js +38 -0
  137. package/dist/components/Number/Number.js +50 -0
  138. package/dist/components/Number/Number.styles.js +23 -0
  139. package/dist/components/PageTransition/PageTransition.js +51 -0
  140. package/dist/components/Pagination/Pagination.js +58 -0
  141. package/dist/components/Pagination/Pagination.styles.js +59 -0
  142. package/dist/components/Pagination/PaginationControls.js +113 -0
  143. package/dist/components/Pagination/usePagination.js +40 -0
  144. package/dist/components/Payment/PaymentDetailsCard.js +224 -0
  145. package/dist/components/Payment/PaymentDisplay.js +199 -0
  146. package/dist/components/Payment/TimerComponent.js +92 -0
  147. package/dist/components/Process/Process.styles.js +84 -0
  148. package/dist/components/ProfileBadge/ProfileBadge.js +35 -0
  149. package/dist/components/ProfileBadge/ProfileBadge.styles.js +53 -0
  150. package/dist/components/ProfileBox/ProfileBox.js +27 -0
  151. package/dist/components/ProfileBox/ProfileBox.styles.js +67 -0
  152. package/dist/components/ProfileStat/ProfileStat.js +29 -0
  153. package/dist/components/ProfileStat/ProfileStat.styles.js +90 -0
  154. package/dist/components/QRCode/QRCode.js +51 -0
  155. package/dist/components/Radio/Radio.js +51 -0
  156. package/dist/components/Radio/Radio.styles.js +100 -0
  157. package/dist/components/RefreshButton/RefreshButton.js +21 -0
  158. package/dist/components/RefreshButton/RefreshButton.styles.js +64 -0
  159. package/dist/components/RegisterConfirmModal/RegisterConfirmModal.js +65 -0
  160. package/dist/components/RegisterConfirmModal/RegisterConfirmModal.styles.js +20 -0
  161. package/dist/components/RegisterModal/RegisterModal.js +248 -0
  162. package/dist/components/RequestDataBox/RequestDataBox.js +21 -0
  163. package/dist/components/RequestDataBox/RequestDataBox.styles.js +43 -0
  164. package/dist/components/ResetConfirmModal/ResetConfirmModal.js +44 -0
  165. package/dist/components/ResetConfirmModal/ResetConfirmModal.styles.js +41 -0
  166. package/dist/components/ResetPasswordModal/ResetPasswordModal.js +134 -0
  167. package/dist/components/SEO/SEO.js +66 -0
  168. package/dist/components/SectionTitle/SectionTitle.styles.js +26 -0
  169. package/dist/components/SideLine/SideLine.js +7 -0
  170. package/dist/components/SideLine/SideLine.styles.js +33 -0
  171. package/dist/components/Slider/Slider.js +31 -0
  172. package/dist/components/Slider/Slider.styles.js +120 -0
  173. package/dist/components/Snackbar/Snackbar.js +111 -0
  174. package/dist/components/Snackbar/Snackbar.styles.js +230 -0
  175. package/dist/components/Snackbar/SnackbarProvider.js +66 -0
  176. package/dist/components/Snackbar/useSnackbar.js +12 -0
  177. package/dist/components/SpanButton/SpanButton.styles.js +19 -0
  178. package/dist/components/StatusBadge/StatusBadge.styles.js +18 -0
  179. package/dist/components/StatusTag/StatusTag.js +105 -0
  180. package/dist/components/StatusTag/StatusTag.styles.js +88 -0
  181. package/dist/components/StepController/StepController.js +86 -0
  182. package/dist/components/StepController/StepController.styles.js +33 -0
  183. package/dist/components/StepController/StepControllerContext.js +65 -0
  184. package/dist/components/StepController/StepControllerProgress.js +37 -0
  185. package/dist/components/StepsProgress/StepIndicator.js +40 -0
  186. package/dist/components/StepsProgress/StepIndicator.styles.js +69 -0
  187. package/dist/components/StepsProgress/StepsProgress.js +67 -0
  188. package/dist/components/StepsProgress/StepsProgress.styles.js +105 -0
  189. package/dist/components/StokrLoader/StokrLoader.js +111 -0
  190. package/dist/components/StokrLoader/media.js +23 -0
  191. package/dist/components/SvgIcons/AdminBadgeSvg.js +27 -0
  192. package/dist/components/SvgIcons/CameraSvg.js +31 -0
  193. package/dist/components/SvgIcons/CapsLockSvg.js +36 -0
  194. package/dist/components/SvgIcons/DocumentBackSvg.js +20 -0
  195. package/dist/components/SvgIcons/DocumentSmallSvg.js +41 -0
  196. package/dist/components/SvgIcons/DocumentSvg.js +39 -0
  197. package/dist/components/SvgIcons/EthSvg.js +28 -0
  198. package/dist/components/SvgIcons/EurSvg.js +27 -0
  199. package/dist/components/SvgIcons/FaceScanIconSvg.js +17 -0
  200. package/dist/components/SvgIcons/FourSvg.js +7 -0
  201. package/dist/components/SvgIcons/Glassess.js +26 -0
  202. package/dist/components/SvgIcons/LogoSvg.js +17 -0
  203. package/dist/components/SvgIcons/OneSvg.js +10 -0
  204. package/dist/components/SvgIcons/PassportSvg.js +37 -0
  205. package/dist/components/SvgIcons/RefreshSvg.js +28 -0
  206. package/dist/components/SvgIcons/SocialFacebook.js +22 -0
  207. package/dist/components/SvgIcons/SocialInstagram.js +13 -0
  208. package/dist/components/SvgIcons/SocialLinkedIn.js +31 -0
  209. package/dist/components/SvgIcons/SocialMedium.js +21 -0
  210. package/dist/components/SvgIcons/SocialReddit.js +21 -0
  211. package/dist/components/SvgIcons/SocialTelegram.js +60 -0
  212. package/dist/components/SvgIcons/SocialTwitter.js +62 -0
  213. package/dist/components/SvgIcons/SocialYoutube.js +22 -0
  214. package/dist/components/SvgIcons/ThreeSvg.js +7 -0
  215. package/dist/components/SvgIcons/TwoSidedDocumentSvg.js +48 -0
  216. package/dist/components/SvgIcons/TwoSvg.js +10 -0
  217. package/dist/components/SvgIcons/UpdateDefaultSvg.js +12 -0
  218. package/dist/components/SvgIcons/UpdateHardSvg.js +10 -0
  219. package/dist/components/SvgIcons/UpdateSoftSvg.js +11 -0
  220. package/dist/components/SvgIcons/UploadSvg.js +12 -0
  221. package/dist/components/SvgIcons/VerifiedBadge.js +16 -0
  222. package/dist/components/Switch/Switch.js +63 -0
  223. package/dist/components/Switch/Switch.styles.js +126 -0
  224. package/dist/components/Tabs/Tabs.js +54 -0
  225. package/dist/components/Tabs/Tabs.styles.js +15 -0
  226. package/dist/components/TabsNav/TabNav.js +16 -0
  227. package/dist/components/TabsNav/TabsNav.js +30 -0
  228. package/dist/components/TabsNav/TabsNav.styles.js +103 -0
  229. package/dist/components/TeamOverview/TeamOverview.js +80 -0
  230. package/dist/components/TeamOverview/TeamOverview.styles.js +167 -0
  231. package/dist/components/TermsModal/TermsModal.js +145 -0
  232. package/dist/components/TermsModal/_styles.js +313 -0
  233. package/dist/components/Text/Text.styles.js +220 -0
  234. package/dist/components/TextLink/TextLink.styles.js +67 -0
  235. package/dist/components/Timeline/Timeline.js +44 -0
  236. package/dist/components/Timeline/Timeline.styles.js +147 -0
  237. package/dist/components/Timeline/TimelineStep.js +58 -0
  238. package/dist/components/ToDoList/ToDoList.js +172 -0
  239. package/dist/components/ToDoList/ToDoList.styles.js +122 -0
  240. package/dist/components/ToDoList/ToDoListTask.js +95 -0
  241. package/dist/components/ToDoList/ToDoListTask.styles.js +119 -0
  242. package/dist/components/TransactionDetails/TransactionDetails.js +27 -0
  243. package/dist/components/TransactionDetails/TransactionDetails.styles.js +38 -0
  244. package/dist/components/TransactionInfo/TransactionInfo.js +41 -0
  245. package/dist/components/TransactionInfo/TransactionInfo.styles.js +75 -0
  246. package/dist/components/VerifyEmailModal/VerifyEmailModal.js +122 -0
  247. package/dist/components/breakdown/Breakdown.js +126 -0
  248. package/dist/components/headerHo/HeaderHo.js +709 -0
  249. package/dist/components/icons/Arrow.js +38 -0
  250. package/dist/components/icons/ArrowSimple.js +34 -0
  251. package/dist/components/icons/Check.js +16 -0
  252. package/dist/components/icons/Facebook.js +10 -0
  253. package/dist/components/icons/Info.js +27 -0
  254. package/dist/components/icons/Instagram.js +10 -0
  255. package/dist/components/icons/LinkIcon.js +49 -0
  256. package/dist/components/icons/LinkedIn.js +13 -0
  257. package/dist/components/icons/Medium.js +13 -0
  258. package/dist/components/icons/Reddit.js +16 -0
  259. package/dist/components/icons/Share.js +31 -0
  260. package/dist/components/icons/Telegram.js +13 -0
  261. package/dist/components/icons/Twitter.js +10 -0
  262. package/dist/components/icons/X.js +10 -0
  263. package/dist/components/icons/Youtube.js +10 -0
  264. package/dist/components/icons/index.js +32 -0
  265. package/dist/components/landing-page/List.js +51 -0
  266. package/dist/components/landing-page/PageContent.js +65 -0
  267. package/dist/components/landing-page/PageText.js +171 -0
  268. package/dist/components/landing-page/PageTitle.js +259 -0
  269. package/dist/components/logo/Logo.js +57 -0
  270. package/dist/components/taxId/complete.js +24 -0
  271. package/dist/components/taxId/flow.js +53 -0
  272. package/dist/components/taxId/register-taxid.js +166 -0
  273. package/dist/config.js +44 -0
  274. package/dist/constants/globalVariables.js +87 -0
  275. package/dist/constants/style.js +48 -0
  276. package/dist/context/Auth.js +396 -0
  277. package/dist/context/AuthContext.js +781 -0
  278. package/dist/context/Checkbox/CheckboxContext.js +151 -0
  279. package/dist/firebase-config.js +73 -0
  280. package/dist/hooks/useNewVentureForm.js +262 -0
  281. package/dist/hooks/useTimer.js +89 -0
  282. package/dist/index.js +628 -25463
  283. package/dist/model/axios.js +10 -0
  284. package/dist/model/axiosPublic.js +9 -0
  285. package/dist/services/TimerService.js +80 -0
  286. package/dist/static/animations/checked.lottie.js +4 -0
  287. package/dist/static/animations/progress.lottie.js +4 -0
  288. package/dist/static/fonts/Ionicons/Ionicons.ttf.js +4 -0
  289. package/dist/static/fonts/Ionicons/Ionicons.woff.js +4 -0
  290. package/dist/static/fonts/Ionicons/Ionicons.woff2.js +4 -0
  291. package/dist/static/fonts/Ionicons/ionicons.min.css.js +4 -0
  292. package/dist/static/fonts/OpenSans/OpenSans-Bold.ttf.js +4 -0
  293. package/dist/static/fonts/OpenSans/OpenSans-Bold.woff.js +4 -0
  294. package/dist/static/fonts/OpenSans/OpenSans-Bold.woff2.js +4 -0
  295. package/dist/static/fonts/OpenSans/OpenSans-ExtraBold.ttf.js +4 -0
  296. package/dist/static/fonts/OpenSans/OpenSans-ExtraBold.woff.js +4 -0
  297. package/dist/static/fonts/OpenSans/OpenSans-ExtraBold.woff2.js +4 -0
  298. package/dist/static/fonts/OpenSans/OpenSans-Light.ttf.js +4 -0
  299. package/dist/static/fonts/OpenSans/OpenSans-Light.woff.js +4 -0
  300. package/dist/static/fonts/OpenSans/OpenSans-Light.woff2.js +4 -0
  301. package/dist/static/fonts/OpenSans/OpenSans-Regular.ttf.js +4 -0
  302. package/dist/static/fonts/OpenSans/OpenSans-Regular.woff.js +4 -0
  303. package/dist/static/fonts/OpenSans/OpenSans-Regular.woff2.js +4 -0
  304. package/dist/static/fonts/OpenSans/OpenSans-SemiBold.ttf.js +4 -0
  305. package/dist/static/fonts/OpenSans/OpenSans-SemiBold.woff.js +4 -0
  306. package/dist/static/fonts/OpenSans/OpenSans-SemiBold.woff2.js +4 -0
  307. package/dist/static/fonts/icomoon/icomoon.eot.js +4 -0
  308. package/dist/static/fonts/icomoon/icomoon.svg.js +4 -0
  309. package/dist/static/fonts/icomoon/icomoon.ttf.js +4 -0
  310. package/dist/static/fonts/icomoon/icomoon.woff.js +4 -0
  311. package/dist/static/images/add-folder-icon.svg.js +5 -0
  312. package/dist/static/images/address-refreshing.gif.js +4 -0
  313. package/dist/static/images/arrow-down-black.svg.js +4 -0
  314. package/dist/static/images/avatar-placeholder.png.js +4 -0
  315. package/dist/static/images/background3.png.js +4 -0
  316. package/dist/static/images/bitcoin-logo.svg.js +4 -0
  317. package/dist/static/images/bmn2-logo.svg.js +4 -0
  318. package/dist/static/images/check-icon.svg.js +5 -0
  319. package/dist/static/images/checkmark-circle-icon.svg.js +5 -0
  320. package/dist/static/images/close-circle-icon.svg.js +5 -0
  321. package/dist/static/images/copy_icon.svg.js +5 -0
  322. package/dist/static/images/cross-icon.svg.js +5 -0
  323. package/dist/static/images/early-adopter.png.js +4 -0
  324. package/dist/static/images/eth_logo.svg.js +4 -0
  325. package/dist/static/images/filter-icon.svg.js +5 -0
  326. package/dist/static/images/google_auth.png.js +4 -0
  327. package/dist/static/images/graduation.png.js +4 -0
  328. package/dist/static/images/mangopay.svg.js +4 -0
  329. package/dist/static/images/numbers/number_eight.svg.js +5 -0
  330. package/dist/static/images/numbers/number_five.svg.js +5 -0
  331. package/dist/static/images/numbers/number_four.svg.js +5 -0
  332. package/dist/static/images/numbers/number_nine.svg.js +5 -0
  333. package/dist/static/images/numbers/number_one.svg.js +5 -0
  334. package/dist/static/images/numbers/number_seven.svg.js +5 -0
  335. package/dist/static/images/numbers/number_six.svg.js +5 -0
  336. package/dist/static/images/numbers/number_three.svg.js +5 -0
  337. package/dist/static/images/numbers/number_two.svg.js +5 -0
  338. package/dist/static/images/numbers/number_zero.svg.js +5 -0
  339. package/dist/static/images/process-waiting.gif.js +4 -0
  340. package/dist/static/images/search-icon.svg.js +5 -0
  341. package/dist/static/images/social/Facebook_Logo.png.js +4 -0
  342. package/dist/static/images/social/LI-In-Bug.png.js +4 -0
  343. package/dist/static/images/social/Telegram-Logo.png.js +4 -0
  344. package/dist/static/images/social/X-logo-black.png.js +4 -0
  345. package/dist/static/images/social/youtube_social_circle_red.png.js +4 -0
  346. package/dist/static/images/transfer-icon.svg.js +5 -0
  347. package/dist/static/images/usdc-logo.svg.js +4 -0
  348. package/dist/static/images/usdq-logo.png.js +4 -0
  349. package/dist/static/images/warning-filled.svg.js +5 -0
  350. package/dist/styles/colors.js +56 -0
  351. package/dist/styles/fonts.js +100 -0
  352. package/dist/styles/global.js +74 -0
  353. package/dist/styles/grid.js +11 -0
  354. package/dist/styles/ioniconsStyles.js +31 -0
  355. package/dist/styles/reactTippy.js +40 -0
  356. package/dist/styles/rwd.js +56 -0
  357. package/dist/styles/semanticUi.js +84 -0
  358. package/dist/styles/spacing.js +8 -0
  359. package/dist/styles/theme.js +34 -0
  360. package/dist/utils/check-sale-time-left.js +85 -0
  361. package/dist/utils/check-todo-status.js +11 -0
  362. package/dist/utils/checklistGenerator.js +195 -0
  363. package/dist/utils/copyToClipboard.js +92 -0
  364. package/dist/utils/customHooks.js +126 -0
  365. package/dist/utils/delete-redirect-cookie-and-navigate.js +12 -0
  366. package/dist/utils/fix-decimals.js +5 -0
  367. package/dist/utils/formatCurrencyValue.js +95 -0
  368. package/dist/utils/get-cookie-domain.js +10 -0
  369. package/dist/utils/get-short-address.js +4 -0
  370. package/dist/utils/isUSInvestor.js +6 -0
  371. package/dist/utils/km_ify.js +33 -0
  372. package/dist/utils/moment.js +26 -0
  373. package/dist/utils/redirect-url.js +5 -0
  374. package/dist/utils/saveAs.js +17 -0
  375. package/dist/utils/scrollUtils.js +63 -0
  376. package/dist/utils/set-redirect-cookie.js +16 -0
  377. package/dist/utils/transition.js +101 -0
  378. package/dist/utils/withRouter.js +24 -0
  379. package/package.json +146 -146
@@ -0,0 +1,151 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { createContext, useState, useCallback, useMemo, useContext } from "react";
3
+ import fetchDataPublic from "../../api/fetchDataPublic.js";
4
+ import fetchData from "../../api/fetchData.js";
5
+ const CheckboxContext = createContext();
6
+ const CheckboxProvider = ({ children }) => {
7
+ const [checkboxes, setCheckboxes] = useState({});
8
+ const [loadingStates, setLoadingStates] = useState({});
9
+ const [errorStates, setErrorStates] = useState({});
10
+ const fetchCheckboxes = useCallback(
11
+ async (key, options = {}) => {
12
+ const { group, labels } = options;
13
+ if (loadingStates[key] || checkboxes[key] !== void 0 || errorStates[key]) {
14
+ return;
15
+ }
16
+ setLoadingStates((prev) => ({ ...prev, [key]: true }));
17
+ setErrorStates((prev) => {
18
+ const newState = { ...prev };
19
+ delete newState[key];
20
+ return newState;
21
+ });
22
+ try {
23
+ let response;
24
+ if (group) {
25
+ response = await fetchDataPublic("compliance/get-checkbox-group", {
26
+ group
27
+ });
28
+ } else if (labels) {
29
+ response = await fetchDataPublic("compliance/get-checkboxes", {
30
+ labels
31
+ });
32
+ } else {
33
+ throw new Error("Must provide either group or labels");
34
+ }
35
+ setCheckboxes((prev) => ({ ...prev, [key]: response }));
36
+ } catch (error) {
37
+ console.error(`Failed to fetch checkboxes for key: ${key}`, error);
38
+ setErrorStates((prev) => ({ ...prev, [key]: error }));
39
+ setCheckboxes((prev) => ({ ...prev, [key]: null }));
40
+ } finally {
41
+ setLoadingStates((prev) => ({ ...prev, [key]: false }));
42
+ }
43
+ },
44
+ [checkboxes, loadingStates, errorStates]
45
+ );
46
+ const getCheckboxes = useCallback(
47
+ (key, options = {}) => {
48
+ if (checkboxes[key] === void 0 && !loadingStates[key] && !errorStates[key]) {
49
+ fetchCheckboxes(key, options);
50
+ }
51
+ return {
52
+ checkboxes: checkboxes[key] || null,
53
+ isLoading: loadingStates[key] || false,
54
+ error: errorStates[key] || null,
55
+ refetch: () => {
56
+ setErrorStates((prev) => {
57
+ const newState = { ...prev };
58
+ delete newState[key];
59
+ return newState;
60
+ });
61
+ setCheckboxes((prev) => {
62
+ const newState = { ...prev };
63
+ delete newState[key];
64
+ return newState;
65
+ });
66
+ fetchCheckboxes(key, options);
67
+ }
68
+ };
69
+ },
70
+ [checkboxes, loadingStates, errorStates, fetchCheckboxes]
71
+ );
72
+ const checkCheckbox = useCallback(async (checkboxId, data = {}) => {
73
+ const { userId, investmentId = "", privateInvestorId = "" } = data;
74
+ if (!userId) {
75
+ throw new Error("userId is required to check checkbox");
76
+ }
77
+ if (!checkboxId) {
78
+ throw new Error("checkboxId is required");
79
+ }
80
+ try {
81
+ const response = await fetchData("compliance/check-checkbox", {
82
+ userId,
83
+ checkboxId,
84
+ investmentId,
85
+ privateInvestorId
86
+ });
87
+ return response;
88
+ } catch (error) {
89
+ console.error(`Failed to check checkbox: ${checkboxId}`, error);
90
+ throw error;
91
+ }
92
+ }, []);
93
+ const clearCheckboxes = useCallback((key) => {
94
+ if (key) {
95
+ setCheckboxes((prev) => {
96
+ const newState = { ...prev };
97
+ delete newState[key];
98
+ return newState;
99
+ });
100
+ setLoadingStates((prev) => {
101
+ const newState = { ...prev };
102
+ delete newState[key];
103
+ return newState;
104
+ });
105
+ setErrorStates((prev) => {
106
+ const newState = { ...prev };
107
+ delete newState[key];
108
+ return newState;
109
+ });
110
+ } else {
111
+ setCheckboxes({});
112
+ setLoadingStates({});
113
+ setErrorStates({});
114
+ }
115
+ }, []);
116
+ const value = useMemo(
117
+ () => ({
118
+ getCheckboxes,
119
+ checkCheckbox,
120
+ clearCheckboxes
121
+ }),
122
+ [getCheckboxes, checkCheckbox, clearCheckboxes]
123
+ );
124
+ return /* @__PURE__ */ jsx(CheckboxContext.Provider, { value, children });
125
+ };
126
+ const useCheckboxes = (key, options = {}) => {
127
+ const context = useContext(CheckboxContext);
128
+ if (!context) {
129
+ throw new Error("useCheckboxes must be used within CheckboxProvider");
130
+ }
131
+ if (!key) {
132
+ throw new Error("useCheckboxes requires a key parameter");
133
+ }
134
+ return context.getCheckboxes(key, options);
135
+ };
136
+ const useCheckboxActions = () => {
137
+ const context = useContext(CheckboxContext);
138
+ if (!context) {
139
+ throw new Error("useCheckboxActions must be used within CheckboxProvider");
140
+ }
141
+ return {
142
+ checkCheckbox: context.checkCheckbox,
143
+ clearCheckboxes: context.clearCheckboxes
144
+ };
145
+ };
146
+ export {
147
+ CheckboxContext,
148
+ CheckboxProvider,
149
+ useCheckboxActions,
150
+ useCheckboxes
151
+ };
@@ -0,0 +1,73 @@
1
+ import { getApps, getApp, initializeApp } from "firebase/app";
2
+ import { initializeAuth, inMemoryPersistence, getAuth } from "firebase/auth";
3
+ const __vite_import_meta_env__ = {};
4
+ let app = null;
5
+ let auth = null;
6
+ function getEnvFirebaseConfig() {
7
+ try {
8
+ return {
9
+ apiKey: "AIzaSyBBp_3Romnfv--YpUuV0mJgDymvSp3oq0c",
10
+ authDomain: "stokr-development-env.firebaseapp.com",
11
+ projectId: "stokr-development-env",
12
+ storageBucket: "stokr-development-env.appspot.com",
13
+ messagingSenderId: "568229412804",
14
+ appId: "1:568229412804:web:2391857e3e2a0b02346e91",
15
+ measurementId: "G-CP53SZVSMN"
16
+ };
17
+ } catch {
18
+ return {};
19
+ }
20
+ }
21
+ function isValidConfig(config) {
22
+ return config?.apiKey != null && String(config.apiKey).trim() !== "";
23
+ }
24
+ function getFirebaseAuth() {
25
+ return auth;
26
+ }
27
+ function initFirebase(configOverride) {
28
+ const firebaseConfig = configOverride || getEnvFirebaseConfig();
29
+ if (!isValidConfig(firebaseConfig)) {
30
+ if (configOverride && typeof console !== "undefined" && console.warn) {
31
+ console.warn(
32
+ "[firebase-config] initFirebase() received a config with no valid apiKey. Ensure all VITE_FIREBASE_* variables are defined in your .env file and the dev server was restarted."
33
+ );
34
+ }
35
+ return;
36
+ }
37
+ try {
38
+ const existingApps = getApps();
39
+ if (existingApps.length > 0) {
40
+ app = getApp();
41
+ } else {
42
+ app = initializeApp(firebaseConfig);
43
+ }
44
+ try {
45
+ auth = initializeAuth(app, { persistence: inMemoryPersistence });
46
+ } catch (initErr) {
47
+ auth = getAuth(app);
48
+ if (typeof console !== "undefined" && console.warn) {
49
+ console.warn(
50
+ "[firebase-config] initializeAuth() failed (auth already initialized by another module). Falling back to getAuth() — if sign-in hangs for 30s, ensure this module loads BEFORE @stokr/components-library. Error:",
51
+ initErr?.message || initErr
52
+ );
53
+ }
54
+ }
55
+ } catch (err) {
56
+ app = null;
57
+ auth = null;
58
+ if (typeof console !== "undefined" && console.warn) {
59
+ console.warn(
60
+ "[firebase-config] Firebase init failed (e.g. invalid API key or duplicate app):",
61
+ err?.code || err?.message || err
62
+ );
63
+ }
64
+ }
65
+ }
66
+ if (typeof __vite_import_meta_env__ !== "undefined" && isValidConfig(getEnvFirebaseConfig())) {
67
+ initFirebase();
68
+ }
69
+ export {
70
+ auth,
71
+ getFirebaseAuth,
72
+ initFirebase
73
+ };
@@ -0,0 +1,262 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { useState, useContext, useEffect, useCallback } from "react";
3
+ import { AuthContext } from "../context/AuthContext.js";
4
+ import fetchDataPublic from "../api/fetchDataPublic.js";
5
+ import parse from "html-react-parser";
6
+ import { useCheckboxes } from "../context/Checkbox/CheckboxContext.js";
7
+ const initialState = {
8
+ email: "",
9
+ name: "",
10
+ mailingList: false,
11
+ privateInvestorList: false,
12
+ mailingListText: /* @__PURE__ */ jsx(Fragment, { children: "You just want to be updated on the project. Subscribe here for further information going forward." }),
13
+ privateInvestorListText: /* @__PURE__ */ jsxs(Fragment, { children: [
14
+ "You are a professional investor or an investor willing to invest in private offerings. Subscribe here to be contacted by a dedicated team to help you confirm your eligibility for this investment.",
15
+ /* @__PURE__ */ jsx("br", {}),
16
+ " ",
17
+ /* @__PURE__ */ jsx("br", {}),
18
+ "You are seeking to invest on your own initiative and any potential investments arose as a result of your direct inquiry and outreach."
19
+ ] }),
20
+ mailingListDisabled: false,
21
+ privateInvestorListDisabled: false,
22
+ optionalCheckBox: false,
23
+ optionalCheckBoxText: "",
24
+ optionalCheckBoxChecked: false,
25
+ checkedCheckboxes: [],
26
+ isSubmitting: false,
27
+ successMessage: null,
28
+ errorMessage: null
29
+ };
30
+ const getProjectSubscription = (user, project) => {
31
+ if (!user || !project?._id) {
32
+ return {
33
+ isPrivateInvestor: false,
34
+ isSubscribed: false,
35
+ privateInvestorStatus: null
36
+ };
37
+ }
38
+ if (user.privateInvestorProjects && user.subscribedProjects) {
39
+ const privateInvestorProject = user.privateInvestorProjects.find((p) => p.projectId === project._id);
40
+ const subscribedProject = user.subscribedProjects[project.name];
41
+ return {
42
+ isPrivateInvestor: !!privateInvestorProject?.isAllowed,
43
+ isSubscribed: !!subscribedProject,
44
+ privateInvestorStatus: privateInvestorProject?.status
45
+ };
46
+ }
47
+ return {
48
+ isPrivateInvestor: user.isPrivateInvestor,
49
+ isSubscribed: user.isSubscribed,
50
+ privateInvestorStatus: user.privateInvestorStatus
51
+ };
52
+ };
53
+ const updateUserSubscription = (user, project, updates) => {
54
+ if (!user) return user;
55
+ if (user.privateInvestorProjects && user.subscribedProjects) {
56
+ const updatedUser = { ...user };
57
+ if (updates.isPrivateInvestor !== void 0) {
58
+ const existingIndex = updatedUser.privateInvestorProjects.findIndex((p) => p.projectId === project._id);
59
+ if (existingIndex >= 0) {
60
+ updatedUser.privateInvestorProjects[existingIndex] = {
61
+ ...updatedUser.privateInvestorProjects[existingIndex],
62
+ ...updates
63
+ };
64
+ } else {
65
+ updatedUser.privateInvestorProjects = [
66
+ ...updatedUser.privateInvestorProjects,
67
+ { projectId: project._id, status: "New", ...updates }
68
+ ];
69
+ }
70
+ }
71
+ if (updates.isSubscribed !== void 0) {
72
+ updatedUser.subscribedProjects[project.name] = updates.isSubscribed;
73
+ }
74
+ return updatedUser;
75
+ }
76
+ return { ...user, ...updates };
77
+ };
78
+ const useNewVentureForm = ({ project, user, salesChannel, customSuccessMessage }) => {
79
+ const [formValues, setFormValues] = useState(initialState);
80
+ const { setUser, checkPrivateInvestorAll, checkIfUserSubscribedAll } = useContext(AuthContext);
81
+ const { checkboxes, isLoading: isLoadingCheckboxes } = useCheckboxes("newVentureModal", {
82
+ group: "newVentureModal"
83
+ });
84
+ useEffect(() => {
85
+ let formValuesCopy = { ...formValues };
86
+ if (checkboxes) {
87
+ Object.values(checkboxes).forEach((checkbox) => {
88
+ if (checkbox.label === "createPrivateInvestor" && !formValuesCopy.privateInvestorListDisabled) {
89
+ formValuesCopy.privateInvestorListText = parse(checkbox.agreementText);
90
+ } else if (checkbox.label === "subscribeToProject" && !formValuesCopy.mailingListDisabled) {
91
+ formValuesCopy.mailingListText = parse(checkbox.agreementText);
92
+ }
93
+ });
94
+ }
95
+ if (user?._id) {
96
+ formValuesCopy.email = user.email;
97
+ formValuesCopy.name = user.username;
98
+ const projectSubscription = getProjectSubscription(user, project);
99
+ if (projectSubscription.isPrivateInvestor) {
100
+ formValuesCopy.privateInvestorListText = "You are already registered on the whitelist.";
101
+ formValuesCopy.privateInvestorList = true;
102
+ formValuesCopy.privateInvestorListDisabled = true;
103
+ } else if (projectSubscription.privateInvestorStatus && projectSubscription.privateInvestorStatus !== "Admitted") {
104
+ formValuesCopy.privateInvestorListText = "Your profile is under review. An account manager will reach out to you to confirm your eligibility.";
105
+ formValuesCopy.privateInvestorList = true;
106
+ formValuesCopy.privateInvestorListDisabled = true;
107
+ }
108
+ if (projectSubscription.isSubscribed) {
109
+ formValuesCopy.mailingList = true;
110
+ formValuesCopy.mailingListText = "You already subscribed to the email notification list.";
111
+ formValuesCopy.mailingListDisabled = true;
112
+ }
113
+ }
114
+ setFormValues(formValuesCopy);
115
+ }, [user, checkboxes, project, formValues]);
116
+ const handleSubmit = useCallback(
117
+ async (values) => {
118
+ setFormValues((prev) => ({ ...prev, isSubmitting: true }));
119
+ try {
120
+ const dataToSend = {
121
+ email: values.email,
122
+ projectId: project._id,
123
+ name: values.name,
124
+ checkedCheckboxes: formValues.checkedCheckboxes,
125
+ salesChannel: salesChannel ? salesChannel : window.location.pathname.includes("featured-assets") ? "featuredAssets" : "investor"
126
+ };
127
+ if (values.privateInvestorList && !formValues.privateInvestorListDisabled) {
128
+ dataToSend.createPrivateInvestor = true;
129
+ }
130
+ if (values.mailingList && !formValues.mailingListDisabled) {
131
+ dataToSend.subscribeToProject = true;
132
+ }
133
+ const response = await fetchDataPublic("private-investor/public/create", dataToSend);
134
+ let updates = {};
135
+ if (response?.privateInvestor) {
136
+ updates.privateInvestorStatus = response.privateInvestor.status;
137
+ updates.isPrivateInvestor = response.privateInvestor.isAllowed || false;
138
+ }
139
+ if (response?.subscribedToProject) {
140
+ updates.isSubscribed = true;
141
+ }
142
+ const updatedUser = updateUserSubscription(user, project, updates);
143
+ setUser(updatedUser);
144
+ setFormValues((prev) => ({
145
+ ...prev,
146
+ successMessage: customSuccessMessage ? customSuccessMessage : /* @__PURE__ */ jsxs(Fragment, { children: [
147
+ "Please continue onboarding, an account manager will reach out to you.",
148
+ /* @__PURE__ */ jsx("br", {}),
149
+ "If you are an existing account holder, kindly log in and make sure your account is fully verified."
150
+ ] }),
151
+ errorMessage: null,
152
+ isSubmitting: false
153
+ }));
154
+ return response;
155
+ } catch (error) {
156
+ let errorMessage;
157
+ if (error?.response?.status === 406) {
158
+ errorMessage = error.response.data?.substring(7) || "You are already added to this project.";
159
+ } else {
160
+ errorMessage = /* @__PURE__ */ jsxs(Fragment, { children: [
161
+ "Something went wrong. Please try again a bit later or contact us at",
162
+ " ",
163
+ /* @__PURE__ */ jsx("a", { href: "mailto:support@stokr.io", style: { color: "inherit" }, children: "support@stokr.io" }),
164
+ " "
165
+ ] });
166
+ }
167
+ setFormValues((prev) => ({
168
+ ...prev,
169
+ errorMessage,
170
+ successMessage: null,
171
+ isSubmitting: false
172
+ }));
173
+ throw error;
174
+ }
175
+ },
176
+ // eslint-disable-next-line react-hooks/exhaustive-deps
177
+ [
178
+ project,
179
+ formValues.checkedCheckboxes,
180
+ formValues.privateInvestorListDisabled,
181
+ formValues.mailingListDisabled,
182
+ user,
183
+ setUser
184
+ ]
185
+ );
186
+ const checkUserProjectStatus = async () => {
187
+ const promises = [];
188
+ const projectSubscription = getProjectSubscription(user, project);
189
+ const needsPrivateInvestorData = projectSubscription.isPrivateInvestor === void 0;
190
+ const needsSubscriptionData = projectSubscription.isSubscribed === void 0;
191
+ if (needsPrivateInvestorData) {
192
+ promises.push(checkPrivateInvestorAll(user, true));
193
+ }
194
+ if (needsSubscriptionData) {
195
+ promises.push(checkIfUserSubscribedAll(user, true));
196
+ }
197
+ if (promises.length === 0) return;
198
+ try {
199
+ const results = await Promise.all(promises);
200
+ const updatedUser = { ...user };
201
+ results.forEach((result) => {
202
+ if (result) {
203
+ Object.assign(updatedUser, result);
204
+ }
205
+ });
206
+ setUser(updatedUser);
207
+ } catch (error) {
208
+ console.error("Failed to check user status for project:", error);
209
+ }
210
+ };
211
+ useEffect(() => {
212
+ if (!user || !user._id || !(project && project._id)) return;
213
+ checkUserProjectStatus();
214
+ }, [user, project]);
215
+ useEffect(() => {
216
+ let formValuesCopy = { ...formValues };
217
+ if (checkboxes) {
218
+ Object.values(checkboxes).forEach((checkbox) => {
219
+ if (checkbox.label === "createPrivateInvestor" && !formValuesCopy.privateInvestorListDisabled) {
220
+ formValuesCopy.privateInvestorListText = parse(checkbox.agreementText);
221
+ } else if (checkbox.label === "subscribeToProject" && !formValuesCopy.mailingListDisabled) {
222
+ formValuesCopy.mailingListText = parse(checkbox.agreementText);
223
+ }
224
+ });
225
+ }
226
+ if (user?._id) {
227
+ formValuesCopy.email = user.email;
228
+ formValuesCopy.name = user.username;
229
+ const projectSubscription = getProjectSubscription(user, project);
230
+ if (projectSubscription.isPrivateInvestor) {
231
+ formValuesCopy.privateInvestorListText = "You are already registered on the whitelist.";
232
+ formValuesCopy.privateInvestorList = true;
233
+ formValuesCopy.privateInvestorListDisabled = true;
234
+ } else if (projectSubscription.privateInvestorStatus && projectSubscription.privateInvestorStatus !== "Admitted") {
235
+ formValuesCopy.privateInvestorListText = "Your profile is under review. An account manager will reach out to you to confirm your eligibility.";
236
+ formValuesCopy.privateInvestorList = true;
237
+ formValuesCopy.privateInvestorListDisabled = true;
238
+ }
239
+ if (projectSubscription.isSubscribed) {
240
+ formValuesCopy.mailingList = true;
241
+ formValuesCopy.mailingListText = "You already subscribed to the email notification list.";
242
+ formValuesCopy.mailingListDisabled = true;
243
+ }
244
+ }
245
+ setFormValues(formValuesCopy);
246
+ }, [user, checkboxes, project]);
247
+ const updateCheckedCheckboxes = useCallback((_checkboxes) => {
248
+ setFormValues((prev) => ({ ...prev, checkedCheckboxes: _checkboxes }));
249
+ }, []);
250
+ return {
251
+ // Form state
252
+ ...formValues,
253
+ // Loading state
254
+ isLoading: isLoadingCheckboxes,
255
+ // Actions
256
+ handleSubmit,
257
+ updateCheckedCheckboxes
258
+ };
259
+ };
260
+ export {
261
+ useNewVentureForm
262
+ };
@@ -0,0 +1,89 @@
1
+ import { useState, useRef, useCallback, useEffect } from "react";
2
+ import stdin_default from "../services/TimerService.js";
3
+ const useTimer = (timerId, initialDuration = 0) => {
4
+ const [secondsRemaining, setSecondsRemaining] = useState(initialDuration);
5
+ const [hasTimerFinished, setHasTimerFinished] = useState(false);
6
+ const [isTimerActive, setIsTimerActive] = useState(false);
7
+ const [wasTimerStarted, setWasTimerStarted] = useState(false);
8
+ const timerIdRef = useRef(timerId);
9
+ const startTimer = useCallback((duration) => {
10
+ setIsTimerActive(true);
11
+ setHasTimerFinished(false);
12
+ setSecondsRemaining(duration);
13
+ setWasTimerStarted(true);
14
+ stdin_default.startTimer(
15
+ timerIdRef.current,
16
+ duration,
17
+ (remaining, isExpired) => {
18
+ setSecondsRemaining(remaining);
19
+ if (isExpired) {
20
+ setHasTimerFinished(true);
21
+ setIsTimerActive(false);
22
+ }
23
+ },
24
+ () => {
25
+ setHasTimerFinished(true);
26
+ setIsTimerActive(false);
27
+ }
28
+ );
29
+ }, []);
30
+ const stopTimer = useCallback(() => {
31
+ stdin_default.stopTimer(timerIdRef.current);
32
+ setIsTimerActive(false);
33
+ setSecondsRemaining(0);
34
+ setHasTimerFinished(true);
35
+ }, []);
36
+ const pauseTimer = useCallback(() => {
37
+ stdin_default.stopTimer(timerIdRef.current);
38
+ setIsTimerActive(false);
39
+ }, []);
40
+ const resumeTimer = useCallback(() => {
41
+ if (!isTimerActive && secondsRemaining > 0 && !hasTimerFinished) {
42
+ startTimer(secondsRemaining);
43
+ }
44
+ }, [isTimerActive, secondsRemaining, hasTimerFinished, startTimer]);
45
+ useEffect(() => {
46
+ let initialId;
47
+ const existingTimer = stdin_default.getTimerInfo(timerIdRef.current);
48
+ if (existingTimer) {
49
+ initialId = setTimeout(() => {
50
+ setSecondsRemaining(existingTimer.remaining);
51
+ setHasTimerFinished(existingTimer.isExpired);
52
+ setIsTimerActive(existingTimer.isActive);
53
+ setWasTimerStarted(true);
54
+ }, 0);
55
+ }
56
+ const syncInterval = setInterval(() => {
57
+ const timerInfo = stdin_default.getTimerInfo(timerIdRef.current);
58
+ if (timerInfo) {
59
+ setSecondsRemaining(timerInfo.remaining);
60
+ setHasTimerFinished(timerInfo.isExpired);
61
+ setIsTimerActive(timerInfo.isActive);
62
+ } else if (wasTimerStarted) {
63
+ setHasTimerFinished(true);
64
+ setIsTimerActive(false);
65
+ setSecondsRemaining(0);
66
+ }
67
+ }, 1e3);
68
+ return () => {
69
+ clearTimeout(initialId);
70
+ clearInterval(syncInterval);
71
+ };
72
+ }, [wasTimerStarted]);
73
+ useEffect(() => {
74
+ return () => {
75
+ };
76
+ }, []);
77
+ return {
78
+ secondsRemaining,
79
+ hasTimerFinished,
80
+ isTimerActive,
81
+ startTimer,
82
+ stopTimer,
83
+ pauseTimer,
84
+ resumeTimer
85
+ };
86
+ };
87
+ export {
88
+ useTimer
89
+ };