@stokr/components-library 2.3.58-beta.6 → 2.3.58-beta.7

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 (466) hide show
  1. package/dist/api/StokrWeb3.js +3 -3
  2. package/dist/api/auth.js +16 -53
  3. package/dist/api/fetchData.js +26 -66
  4. package/dist/api/fetchDataPublic.js +20 -57
  5. package/dist/components/2FA/Connect2FA.js +10 -11
  6. package/dist/components/2FA/EnterCode.js +32 -30
  7. package/dist/components/2FA/EnterCode.stories.js +4 -8
  8. package/dist/components/2FA/InstallAuthApp.js +8 -9
  9. package/dist/components/2FA/ResetCode.js +11 -12
  10. package/dist/components/2FA/Sucess2FA.js +12 -16
  11. package/dist/components/2FA/disable-2fa-flow.js +53 -104
  12. package/dist/components/2FA/disable-2fa-flow.stories.js +4 -8
  13. package/dist/components/2FA/enable-2fa-flow.js +73 -144
  14. package/dist/components/2FA/enable-2fa-flow.stories.js +4 -8
  15. package/dist/components/2FA/index.js +9 -9
  16. package/dist/components/2FA/login-with-otp-flow.js +126 -206
  17. package/dist/components/2FA/login-with-otp-flow.stories.js +4 -8
  18. package/dist/components/2FA/main-flow.js +70 -144
  19. package/dist/components/2FA/main-flow.stories.js +4 -8
  20. package/dist/components/AccountBalance/AccountBalance.js +14 -13
  21. package/dist/components/AccountBalance/AccountBalance.stories.js +6 -12
  22. package/dist/components/AccountBalance/AccountBalance.styles.js +9 -17
  23. package/dist/components/AdminDashboard/Table/ReactTable.js +77 -84
  24. package/dist/components/AdminDashboard/Table/ReactTable.stories.js +87 -63
  25. package/dist/components/AdminDashboard/Table/ReactTableWrapper.js +24 -30
  26. package/dist/components/AdminDashboard/Table/Table.js +88 -123
  27. package/dist/components/AdminDashboard/Table/Table.styles.js +28 -90
  28. package/dist/components/AgreementItem/AgreementItem.js +10 -11
  29. package/dist/components/AgreementItem/AgreementItem.stories.js +5 -10
  30. package/dist/components/AgreementItem/AgreementItem.styles.js +8 -12
  31. package/dist/components/AnalyticGraphs/Analytic.js +504 -743
  32. package/dist/components/AnalyticGraphs/Analytic.styles.js +14 -26
  33. package/dist/components/BackButton/BackButton.js +9 -10
  34. package/dist/components/BackButton/BackButton.stories.js +4 -8
  35. package/dist/components/BackButton/BackButton.styles.js +13 -51
  36. package/dist/components/Background/Background.js +12 -11
  37. package/dist/components/Background/Background.stories.js +8 -14
  38. package/dist/components/Background/Background.styles.js +17 -33
  39. package/dist/components/BarChart/BarChart.js +138 -181
  40. package/dist/components/BarChart/BarChart.stories.js +5 -10
  41. package/dist/components/BarChart/BarChart.styles.js +8 -15
  42. package/dist/components/BarChartLegend/BarChartLegend.js +40 -67
  43. package/dist/components/BarChartLegend/BarChartLegend.styles.js +5 -10
  44. package/dist/components/BasicTable/BasicTable.js +12 -13
  45. package/dist/components/BasicTable/BasicTable.stories.js +5 -10
  46. package/dist/components/BasicTable/BasicTable.styles.js +11 -27
  47. package/dist/components/BlogPost/BlogPost.js +34 -53
  48. package/dist/components/BlogPost/BlogPost.stories.js +33 -46
  49. package/dist/components/BlogPost/BlogPost.styles.js +67 -59
  50. package/dist/components/Button/Button-stoDetails.js +150 -129
  51. package/dist/components/Button/Button.stories.js +27 -44
  52. package/dist/components/Button/Button.styles.js +24 -62
  53. package/dist/components/Button/GlareButton.js +61 -89
  54. package/dist/components/Button/GlareButton.stories.js +19 -29
  55. package/dist/components/ButtonContainer/ButtonContainer.styles.js +5 -10
  56. package/dist/components/CapitalRaisedSummary/CapitalRaisedSummery.stories.js +4 -8
  57. package/dist/components/CapitalRaisedSummary/CaptialRaisedSummary.js +9 -10
  58. package/dist/components/CapitalRaisedSummary/CaptialRaisedSummary.styles.js +8 -17
  59. package/dist/components/Card/Card.styles.js +14 -41
  60. package/dist/components/ChartBox/ChartBox.js +5 -8
  61. package/dist/components/ChartBox/ChartBox.stories.js +3 -6
  62. package/dist/components/ChartBox/ChartBox.styles.js +8 -14
  63. package/dist/components/ChartBox/ChartBoxDistribution.js +5 -8
  64. package/dist/components/ChartBox/ChartBoxDistribution.stories.js +3 -6
  65. package/dist/components/ChartLegend/ChartLegend.js +30 -46
  66. package/dist/components/ChartLegend/ChartLegend.stories.js +22 -28
  67. package/dist/components/ChartLegend/ChartLegend.styles.js +16 -41
  68. package/dist/components/Checkbox/Checkbox.js +32 -32
  69. package/dist/components/Checkbox/Checkbox.stories.js +5 -10
  70. package/dist/components/Checkbox/Checkbox.styles.js +10 -23
  71. package/dist/components/Checklist/ChecklistCard.js +33 -35
  72. package/dist/components/Checklist/ChecklistCard.stories.js +77 -100
  73. package/dist/components/Checklist/ChecklistCard.styles.js +12 -15
  74. package/dist/components/Chips/Chip.js +14 -13
  75. package/dist/components/Chips/Chip.stories.js +10 -19
  76. package/dist/components/Chips/Chip.styles.js +14 -14
  77. package/dist/components/Chips/ChipWrapper.js +23 -41
  78. package/dist/components/Chips/ChipsWrapper.stories.js +9 -17
  79. package/dist/components/ComponentScroll/ComponentScroll.js +25 -34
  80. package/dist/components/ComponentScroll/ComponentScroll.stories.js +16 -23
  81. package/dist/components/ComponentScroll/ComponentScroll.styles.js +22 -47
  82. package/dist/components/ComponentWrapper/ComponentWrapper.styles.js +7 -61
  83. package/dist/components/CryptoAddress/ComponentWrap.js +10 -11
  84. package/dist/components/CryptoAddress/CryptoAddress.js +51 -68
  85. package/dist/components/CryptoAddress/CryptoAddress.stories.js +7 -13
  86. package/dist/components/CryptoAddress/CryptoAddress.styles.js +55 -124
  87. package/dist/components/CryptoAddress/RadioWrap.js +9 -10
  88. package/dist/components/CryptoAddressDetails/CryptoAddressDetails.js +24 -25
  89. package/dist/components/CryptoAddressDetails/CryptoAddressDetails.stories.js +5 -10
  90. package/dist/components/CryptoAddressDetails/CryptoAddressDetails.styles.js +12 -42
  91. package/dist/components/CryptoAddressWrapper/CryptoAddressWrapper.js +10 -9
  92. package/dist/components/CryptoAddressWrapper/CryptoAddressWrapper.styles.js +16 -27
  93. package/dist/components/DonutChart/DonutChart.js +101 -130
  94. package/dist/components/DonutChart/DonutChart.stories.js +4 -8
  95. package/dist/components/DonutChart/DonutChart.styles.js +15 -27
  96. package/dist/components/DoubleButton/DoubleButton.styles.js +8 -8
  97. package/dist/components/ErrorMessage/ErrorMessage.styles.js +3 -5
  98. package/dist/components/FAQ/FAQ.js +29 -45
  99. package/dist/components/FAQ/FAQ.stories.js +4 -9
  100. package/dist/components/FAQ/FAQ.styles.js +23 -39
  101. package/dist/components/Footer/Footer.js +9 -10
  102. package/dist/components/Footer/Footer.stories.js +6 -12
  103. package/dist/components/Footer/Footer.styles.js +22 -46
  104. package/dist/components/Footer/FooterLayout.js +16 -20
  105. package/dist/components/Footer/FooterLayout.stories.js +4 -8
  106. package/dist/components/Footer/FooterMenu.js +61 -83
  107. package/dist/components/Footer/FooterMenu.stories.js +4 -8
  108. package/dist/components/Footer/FooterMenu.styles.js +16 -39
  109. package/dist/components/Footer/index.js +4 -4
  110. package/dist/components/ForgotPasswordModal/ForgotPasswordModal.js +92 -114
  111. package/dist/components/ForgotPasswordModal/ForgotPasswordModal.stories.js +4 -8
  112. package/dist/components/Form/Form.js +15 -14
  113. package/dist/components/Form/Form.stories.js +4 -8
  114. package/dist/components/Form/Form.styles.js +16 -36
  115. package/dist/components/FullscreenCard/FullscreenCard.styles.js +7 -12
  116. package/dist/components/Grid/Grid.styles.js +17 -68
  117. package/dist/components/Header/Header.js +98 -163
  118. package/dist/components/Header/Header.stories.js +17 -28
  119. package/dist/components/Header/Header.styles.js +61 -124
  120. package/dist/components/HeroBlock/HeroVideoBlock.js +20 -25
  121. package/dist/components/Icon/Icon.style.js +10 -22
  122. package/dist/components/Icon/Icon2.js +11 -13
  123. package/dist/components/InfoIcon/InfoIcon.js +18 -17
  124. package/dist/components/InfoIcon/InfoIcon.stories.js +5 -10
  125. package/dist/components/InfoIcon/InfoIcon.styles.js +5 -21
  126. package/dist/components/InfoPanel/InfoPanel.js +26 -48
  127. package/dist/components/Input/DatePickerInput.js +21 -33
  128. package/dist/components/Input/DatePickerInput.stories.js +5 -10
  129. package/dist/components/Input/DatePickerInput.styles.js +5 -19
  130. package/dist/components/Input/Input.js +43 -51
  131. package/dist/components/Input/Input.stories.js +9 -16
  132. package/dist/components/Input/Input.styles.js +8 -43
  133. package/dist/components/Input/InputPassword.js +30 -50
  134. package/dist/components/Input/InputPassword.stories.js +6 -12
  135. package/dist/components/Input/InputPassword.styles.js +30 -57
  136. package/dist/components/Input/InputUsername.js +83 -102
  137. package/dist/components/Input/InputWithButton.js +20 -19
  138. package/dist/components/Input/InputWithButton.stories.js +5 -9
  139. package/dist/components/Input/InputWithButton.styles.js +7 -19
  140. package/dist/components/Input/OtpInput.js +27 -42
  141. package/dist/components/Input/OtpInput.stories.js +5 -11
  142. package/dist/components/Input/RangeInput.js +29 -25
  143. package/dist/components/Input/RangeInput.stories.js +4 -8
  144. package/dist/components/Input/RangeInput.styles.js +15 -42
  145. package/dist/components/Input/Select.js +68 -89
  146. package/dist/components/Input/Select.stories.js +6 -12
  147. package/dist/components/Input/Select.styles.js +12 -32
  148. package/dist/components/InvestCalculator/InvestCalculator.js +245 -243
  149. package/dist/components/InvestCalculator/InvestCalculator.stories.js +18 -21
  150. package/dist/components/InvestCalculator/InvestCalculator.styles.js +14 -33
  151. package/dist/components/InvestmentStat/InvestmentStat.js +11 -10
  152. package/dist/components/InvestmentStat/InvestmentStat.stories.js +5 -10
  153. package/dist/components/InvestmentStat/InvestmentStat.styles.js +12 -24
  154. package/dist/components/KYCFlow/BasicInfo.js +419 -460
  155. package/dist/components/KYCFlow/Confirmation.js +12 -17
  156. package/dist/components/KYCFlow/DocumentFileUpload.js +214 -227
  157. package/dist/components/KYCFlow/DocumentScan.js +16 -15
  158. package/dist/components/KYCFlow/DocumentScanUpload.js +203 -210
  159. package/dist/components/KYCFlow/DocumentSelect.js +87 -117
  160. package/dist/components/KYCFlow/DocumentSuccess.js +14 -15
  161. package/dist/components/KYCFlow/DocumentUpload.js +10 -11
  162. package/dist/components/KYCFlow/DocumentVerificationType.js +98 -128
  163. package/dist/components/KYCFlow/FaceScan.js +10 -11
  164. package/dist/components/KYCFlow/FaceScanRecognition.js +14 -13
  165. package/dist/components/KYCFlow/FaceScanSuccess.js +10 -13
  166. package/dist/components/KYCFlow/Terms.js +90 -113
  167. package/dist/components/KYCFlow/_styles.js +37 -86
  168. package/dist/components/KYCFlow/index.js +14 -14
  169. package/dist/components/KYCSelectBox/KYCSelectBox.styles.js +7 -19
  170. package/dist/components/LatestUpdate/LatestUpdate.js +12 -11
  171. package/dist/components/LatestUpdate/LatestUpdate.stories.js +5 -10
  172. package/dist/components/LatestUpdate/LatestUpdate.styles.js +15 -28
  173. package/dist/components/Layout/Layout-func-no-work.js +24 -24
  174. package/dist/components/Layout/Layout.js +47 -68
  175. package/dist/components/Layout/Layout.stories.js +5 -12
  176. package/dist/components/LearnMoreCarousel/LearnMoreCarousel.js +13 -12
  177. package/dist/components/LearnMoreCarousel/LearnMoreCarousel.stories.js +5 -10
  178. package/dist/components/LearnMoreCarousel/LearnMoreCarousel.styles.js +10 -22
  179. package/dist/components/LearnMorePage/LearnMore.js +134 -174
  180. package/dist/components/LearnMorePage/LearnMore.shared.styles.js +7 -22
  181. package/dist/components/LearnMorePage/LearnMore.stories.js +4 -8
  182. package/dist/components/LearnMorePage/LearnMore.styles.js +24 -74
  183. package/dist/components/LearnMorePage/LearnMoreExampleObject.js +3 -5
  184. package/dist/components/LearnMorePage/LearnMoreItem.js +11 -16
  185. package/dist/components/LearnMorePage/LearnMoreItem.stories.js +4 -8
  186. package/dist/components/LearnMorePage/LearnMoreItem.styles.js +18 -54
  187. package/dist/components/LearnMoreSection/LearnMore.js +119 -158
  188. package/dist/components/LearnMoreSection/LearnMore.stories.js +4 -8
  189. package/dist/components/LearnMoreSection/LearnMore.styles.js +15 -41
  190. package/dist/components/LearnMoreSection/LearnMoreItem.js +14 -15
  191. package/dist/components/LearnMoreSection/LearnMoreItem.stories.js +4 -8
  192. package/dist/components/LearnMoreSection/LearnMoreItem.styles.js +9 -23
  193. package/dist/components/LoginModal/LoginModal.js +35 -41
  194. package/dist/components/LoginModal/LoginModal.stories.js +8 -12
  195. package/dist/components/MainMenu/DynamicMainMenu.js +11 -14
  196. package/dist/components/MainMenu/MainMenu.js +157 -190
  197. package/dist/components/MainMenu/MainMenu.styles.js +48 -89
  198. package/dist/components/MatomoConnect/Matomo.js +201 -463
  199. package/dist/components/MenuNav/MenuNav.styles.js +5 -9
  200. package/dist/components/Modal/Modal.js +46 -48
  201. package/dist/components/Modal/Modal.stories.js +8 -16
  202. package/dist/components/Modal/Modal.styles.js +34 -96
  203. package/dist/components/Modal/NewVentureModal/NewVentureModal.js +69 -95
  204. package/dist/components/Modal/NewVentureModal/NewVentureModal.stories.js +22 -43
  205. package/dist/components/Modal/PaymentModal.js +43 -54
  206. package/dist/components/Modal/PaymentModal.stories.js +4 -8
  207. package/dist/components/MultiProgressBar/MultiProgressBar.js +19 -23
  208. package/dist/components/MultiProgressBar/MultiProgressBar.stories.js +6 -12
  209. package/dist/components/MultiProgressBar/MultiProgressBar.styles.js +9 -22
  210. package/dist/components/Newsletter/Newsletter.js +65 -100
  211. package/dist/components/Newsletter/Newsletter.stories.js +4 -8
  212. package/dist/components/Newsletter/Newsletter.styles.js +47 -44
  213. package/dist/components/NotificationContext/NotificationContext.js +93 -125
  214. package/dist/components/NotificationCounter/NotificationCounter.styles.js +4 -16
  215. package/dist/components/Number/Number.js +13 -10
  216. package/dist/components/Number/Number.stories.js +23 -41
  217. package/dist/components/Number/Number.styles.js +4 -10
  218. package/dist/components/PageTransition/PageTransition.js +16 -19
  219. package/dist/components/Pagination/Pagination.js +22 -25
  220. package/dist/components/Pagination/Pagination.stories.js +29 -36
  221. package/dist/components/Pagination/Pagination.styles.js +8 -15
  222. package/dist/components/Pagination/PaginationControls.js +32 -36
  223. package/dist/components/Pagination/PaginationControls.stories.js +33 -62
  224. package/dist/components/Pagination/usePagination.js +29 -37
  225. package/dist/components/Process/Process.stories.js +6 -12
  226. package/dist/components/Process/Process.styles.js +6 -16
  227. package/dist/components/ProfileBadge/ProfileBadge.js +12 -11
  228. package/dist/components/ProfileBadge/ProfileBadge.stories.js +5 -9
  229. package/dist/components/ProfileBadge/ProfileBadge.styles.js +13 -19
  230. package/dist/components/ProfileBox/ProfileBox.js +15 -17
  231. package/dist/components/ProfileBox/ProfileBox.stories.js +5 -9
  232. package/dist/components/ProfileBox/ProfileBox.styles.js +9 -21
  233. package/dist/components/ProfileHeader/ProfileHeader.js +163 -199
  234. package/dist/components/ProfileHeader/ProfileHeader.styles.js +24 -46
  235. package/dist/components/ProfileStat/ProfileStat.js +12 -11
  236. package/dist/components/ProfileStat/ProfileStat.stories.js +6 -12
  237. package/dist/components/ProfileStat/ProfileStat.styles.js +9 -23
  238. package/dist/components/ProofOfAddress/ProofOfAddress.styles.js +20 -36
  239. package/dist/components/QRCode/QRCode.js +30 -30
  240. package/dist/components/QRCode/QRCode.stories.js +14 -26
  241. package/dist/components/ROI/ROI.js +225 -261
  242. package/dist/components/ROI/ROI.styles.js +13 -25
  243. package/dist/components/ROI/ROIChart.js +196 -303
  244. package/dist/components/ROI/ROIChart.styles.js +7 -11
  245. package/dist/components/ROI/ROIModal.js +13 -20
  246. package/dist/components/ROI/ROIParkingo.js +208 -244
  247. package/dist/components/ROI/ROIPixelmatic.js +209 -245
  248. package/dist/components/ROI/ROIScenarioBox.js +9 -8
  249. package/dist/components/ROI/ROIScenarioBox.styles.js +10 -33
  250. package/dist/components/Radio/Radio.js +19 -18
  251. package/dist/components/Radio/Radio.stories.js +4 -8
  252. package/dist/components/Radio/Radio.styles.js +5 -14
  253. package/dist/components/RefreshButton/RefreshButton.js +6 -5
  254. package/dist/components/RefreshButton/RefreshButton.stories.js +5 -10
  255. package/dist/components/RefreshButton/RefreshButton.styles.js +9 -24
  256. package/dist/components/RegisterConfirmModal/RegisterConfirmModal.js +17 -18
  257. package/dist/components/RegisterConfirmModal/RegisterConfirmModal.stories.js +5 -9
  258. package/dist/components/RegisterConfirmModal/RegisterConfirmModal.styles.js +3 -4
  259. package/dist/components/RegisterLiquidSteps/RegisterLiquidSteps.js +46 -70
  260. package/dist/components/RegisterLiquidSteps/RegisterLiquidSteps.styles.js +10 -22
  261. package/dist/components/RegisterLiquidSteps/complete.js +4 -5
  262. package/dist/components/RegisterLiquidSteps/flow.js +53 -99
  263. package/dist/components/RegisterLiquidSteps/index.js +7 -22
  264. package/dist/components/RegisterLiquidSteps/register-liquid.js +62 -102
  265. package/dist/components/RegisterModal/RegisterModal.js +82 -118
  266. package/dist/components/RegisterModal/RegisterModal.stories.js +5 -9
  267. package/dist/components/RequestDataBox/RequestDataBox.js +9 -8
  268. package/dist/components/RequestDataBox/RequestDataBox.stories.js +4 -8
  269. package/dist/components/RequestDataBox/RequestDataBox.styles.js +7 -12
  270. package/dist/components/ResetConfirmModal/ResetConfirmModal.js +10 -11
  271. package/dist/components/ResetConfirmModal/ResetConfirmModal.styles.js +3 -4
  272. package/dist/components/ResetPasswordModal/ResetPasswordModal.js +29 -28
  273. package/dist/components/SEO/SEO.js +11 -10
  274. package/dist/components/SEO/SEO.stories.js +4 -8
  275. package/dist/components/SectionTitle/SectionTitle.styles.js +3 -5
  276. package/dist/components/ShareButton/ShareButton.js +132 -145
  277. package/dist/components/SideLine/SideLine.js +3 -6
  278. package/dist/components/SideLine/SideLine.stories.js +3 -6
  279. package/dist/components/SideLine/SideLine.styles.js +6 -12
  280. package/dist/components/SigningSubflow/SignSubIntro.js +9 -8
  281. package/dist/components/SigningSubflow/_styles.js +9 -20
  282. package/dist/components/SigningSubflow/index.js +5 -5
  283. package/dist/components/Slider/Slider.js +16 -16
  284. package/dist/components/Slider/Slider.stories.js +5 -10
  285. package/dist/components/Slider/Slider.styles.js +5 -8
  286. package/dist/components/SpanButton/SpanButton.styles.js +3 -6
  287. package/dist/components/StatusBadge/StatusBadge.styles.js +4 -10
  288. package/dist/components/StepController/StepController.js +49 -74
  289. package/dist/components/StepController/StepController.stories.js +4 -8
  290. package/dist/components/StepController/StepController.styles.js +6 -12
  291. package/dist/components/StepController/StepControllerContext.js +46 -68
  292. package/dist/components/StepController/StepControllerProgress.js +16 -19
  293. package/dist/components/StepController/StepControllerProgress.stories.js +4 -8
  294. package/dist/components/StepsProgress/StepsProgress.js +44 -58
  295. package/dist/components/StepsProgress/StepsProgress.stories.js +33 -35
  296. package/dist/components/StepsProgress/StepsProgress.styles.js +7 -15
  297. package/dist/components/StokrLoader/StokrLoader.js +20 -23
  298. package/dist/components/StokrLoader/media.js +5 -7
  299. package/dist/components/SvgIcons/AdminBadgeSvg.js +16 -19
  300. package/dist/components/SvgIcons/CameraSvg.js +26 -29
  301. package/dist/components/SvgIcons/CapsLockSvg.js +21 -24
  302. package/dist/components/SvgIcons/DocumentBackSvg.js +25 -28
  303. package/dist/components/SvgIcons/DocumentSmallSvg.js +51 -54
  304. package/dist/components/SvgIcons/DocumentSvg.js +28 -31
  305. package/dist/components/SvgIcons/Early.js +14 -17
  306. package/dist/components/SvgIcons/EthSvg.js +30 -33
  307. package/dist/components/SvgIcons/EurSvg.js +16 -19
  308. package/dist/components/SvgIcons/FaceScanIconSvg.js +21 -24
  309. package/dist/components/SvgIcons/FourSvg.js +11 -14
  310. package/dist/components/SvgIcons/Glassess.js +19 -22
  311. package/dist/components/SvgIcons/LogoSvg.js +14 -17
  312. package/dist/components/SvgIcons/OneSvg.js +13 -16
  313. package/dist/components/SvgIcons/PassportSvg.js +46 -49
  314. package/dist/components/SvgIcons/RefreshSvg.js +17 -20
  315. package/dist/components/SvgIcons/SocialFacebook.js +20 -23
  316. package/dist/components/SvgIcons/SocialInstagram.js +11 -14
  317. package/dist/components/SvgIcons/SocialLinkedIn.js +25 -28
  318. package/dist/components/SvgIcons/SocialMedium.js +15 -18
  319. package/dist/components/SvgIcons/SocialReddit.js +15 -18
  320. package/dist/components/SvgIcons/SocialTelegram.js +49 -52
  321. package/dist/components/SvgIcons/SocialTwitter.js +44 -47
  322. package/dist/components/SvgIcons/SocialYoutube.js +15 -18
  323. package/dist/components/SvgIcons/ThreeSvg.js +10 -13
  324. package/dist/components/SvgIcons/TwoSidedDocumentSvg.js +72 -75
  325. package/dist/components/SvgIcons/TwoSvg.js +13 -16
  326. package/dist/components/SvgIcons/UpdateDefaultSvg.js +19 -22
  327. package/dist/components/SvgIcons/UpdateHardSvg.js +15 -18
  328. package/dist/components/SvgIcons/UpdateSoftSvg.js +17 -20
  329. package/dist/components/SvgIcons/UploadSvg.js +24 -27
  330. package/dist/components/SvgIcons/VerifiedBadge.js +13 -16
  331. package/dist/components/SvgIcons/index.js +32 -32
  332. package/dist/components/Switch/Switch.js +23 -37
  333. package/dist/components/Switch/Switch.stories.js +8 -14
  334. package/dist/components/Switch/Switch.styles.js +8 -33
  335. package/dist/components/Tabs/Tabs.js +19 -21
  336. package/dist/components/Tabs/Tabs.stories.js +4 -8
  337. package/dist/components/Tabs/Tabs.styles.js +4 -6
  338. package/dist/components/TabsNav/TabNav.js +14 -13
  339. package/dist/components/TabsNav/TabNav.stories.js +5 -10
  340. package/dist/components/TabsNav/TabsNav.js +14 -14
  341. package/dist/components/TabsNav/TabsNav.stories.js +4 -8
  342. package/dist/components/TabsNav/TabsNav.styles.js +10 -25
  343. package/dist/components/TeamOverview/TeamOverview.js +38 -84
  344. package/dist/components/TeamOverview/TeamOverview.stories.js +5 -10
  345. package/dist/components/TeamOverview/TeamOverview.styles.js +18 -35
  346. package/dist/components/TermsModal/TermsModal.js +49 -79
  347. package/dist/components/TermsModal/TermsModal.stories.js +4 -8
  348. package/dist/components/TermsModal/_styles.js +35 -100
  349. package/dist/components/Text/Headline.js +15 -14
  350. package/dist/components/Text/Headline.stories.js +4 -8
  351. package/dist/components/Text/StyledText.js +5 -8
  352. package/dist/components/Text/Text.stories.js +5 -10
  353. package/dist/components/Text/Text.styles.js +15 -37
  354. package/dist/components/TextLink/TextLink.styles.js +6 -17
  355. package/dist/components/ToDoList/ToDoList.js +76 -85
  356. package/dist/components/ToDoList/ToDoList.stories.js +7 -14
  357. package/dist/components/ToDoList/ToDoList.styles.js +34 -43
  358. package/dist/components/ToDoList/ToDoListTask.js +22 -35
  359. package/dist/components/ToDoList/ToDoListTask.stories.js +5 -10
  360. package/dist/components/ToDoList/ToDoListTask.styles.js +13 -40
  361. package/dist/components/TransactionDetails/TransactionDetails.js +9 -19
  362. package/dist/components/TransactionDetails/TransactionDetails.stories.js +5 -10
  363. package/dist/components/TransactionDetails/TransactionDetails.styles.js +6 -15
  364. package/dist/components/TransactionInfo/TransactionInfo.js +18 -17
  365. package/dist/components/TransactionInfo/TransactionInfo.stories.js +4 -8
  366. package/dist/components/TransactionInfo/TransactionInfo.styles.js +10 -31
  367. package/dist/components/TwoFactorModal/TwoFactorModal.js +72 -94
  368. package/dist/components/VerifyEmailModal/VerifyEmailModal.js +49 -48
  369. package/dist/components/VerifyEmailModal/VerifyEmailModal.stories.js +6 -11
  370. package/dist/components/breakdown/Breakdown.js +38 -36
  371. package/dist/components/breakdown/index.js +3 -5
  372. package/dist/components/headerHo/HeaderHo.js +585 -769
  373. package/dist/components/headerHo/HeaderHo.stories.js +9 -13
  374. package/dist/components/headerHo/index.js +3 -5
  375. package/dist/components/icons/Arrow.js +43 -46
  376. package/dist/components/icons/Arrow.stories.js +7 -14
  377. package/dist/components/icons/ArrowSimple.js +32 -35
  378. package/dist/components/icons/ArrowSimple.stories.js +7 -14
  379. package/dist/components/icons/Check.js +28 -31
  380. package/dist/components/icons/Check.stories.js +3 -6
  381. package/dist/components/icons/Facebook.js +11 -14
  382. package/dist/components/icons/Facebook.stories.js +3 -6
  383. package/dist/components/icons/Info.js +40 -43
  384. package/dist/components/icons/Info.stories.js +3 -6
  385. package/dist/components/icons/Instagram.js +11 -14
  386. package/dist/components/icons/Instagram.stories.js +3 -6
  387. package/dist/components/icons/LinkIcon.js +19 -22
  388. package/dist/components/icons/LinkIcon.stories.js +3 -6
  389. package/dist/components/icons/LinkedIn.js +28 -31
  390. package/dist/components/icons/LinkedIn.stories.js +3 -6
  391. package/dist/components/icons/Medium.js +27 -30
  392. package/dist/components/icons/Medium.stories.js +3 -6
  393. package/dist/components/icons/Reddit.js +17 -20
  394. package/dist/components/icons/Reddit.stories.js +3 -6
  395. package/dist/components/icons/Share.js +47 -50
  396. package/dist/components/icons/Share.stories.js +3 -6
  397. package/dist/components/icons/Telegram.js +27 -30
  398. package/dist/components/icons/Telegram.stories.js +3 -6
  399. package/dist/components/icons/Twitter.js +11 -14
  400. package/dist/components/icons/Twitter.stories.js +3 -6
  401. package/dist/components/icons/X.js +11 -14
  402. package/dist/components/icons/X.stories.js +3 -6
  403. package/dist/components/icons/Youtube.js +11 -14
  404. package/dist/components/icons/Youtube.stories.js +3 -6
  405. package/dist/components/icons/index.js +15 -15
  406. package/dist/components/landing-page/List.js +3 -5
  407. package/dist/components/landing-page/PageContent.js +5 -7
  408. package/dist/components/landing-page/PageText.js +12 -16
  409. package/dist/components/landing-page/PageTitle.js +16 -47
  410. package/dist/components/logo/Logo.js +49 -71
  411. package/dist/components/logo/index.js +3 -5
  412. package/dist/components/renderToBody/index.js +3 -5
  413. package/dist/components/renderToBody/renderToBody.js +39 -60
  414. package/dist/components/taxId/TaxId.stories.js +11 -16
  415. package/dist/components/taxId/complete.js +9 -11
  416. package/dist/components/taxId/flow.js +22 -34
  417. package/dist/components/taxId/index.js +4 -4
  418. package/dist/components/taxId/register-taxid.js +54 -92
  419. package/dist/components/video/Video.js +69 -84
  420. package/dist/components/video/Video.stories.js +5 -9
  421. package/dist/components/video/index.js +3 -5
  422. package/dist/constants/globalVariables.js +10 -20
  423. package/dist/constants/style.js +23 -46
  424. package/dist/context/Auth.js +247 -340
  425. package/dist/context/AuthContext.js +545 -1023
  426. package/dist/context/Checkbox/CheckboxContext.js +65 -117
  427. package/dist/firebase-config.js +4 -6
  428. package/dist/hooks/useNewVentureForm.js +128 -193
  429. package/dist/hooks/useTimer.js +29 -51
  430. package/dist/index.js +134 -134
  431. package/dist/model/axios.js +4 -5
  432. package/dist/model/axiosPublic.js +4 -5
  433. package/dist/services/TimerService.js +70 -89
  434. package/dist/static/images/copy_icon.svg +4 -0
  435. package/dist/styles/colors.js +2 -4
  436. package/dist/styles/fonts.js +3 -4
  437. package/dist/styles/global.js +3 -4
  438. package/dist/styles/grid.js +4 -5
  439. package/dist/styles/reactTippy.js +3 -4
  440. package/dist/styles/rwd.js +12 -26
  441. package/dist/styles/semanticUi.js +3 -4
  442. package/dist/styles/spacing.js +2 -3
  443. package/dist/styles/theme.js +6 -9
  444. package/dist/utils/allowed-countries-list.js +2 -3
  445. package/dist/utils/analytics.js +32 -48
  446. package/dist/utils/check-sale-time-left.js +37 -39
  447. package/dist/utils/check-todo-status.js +3 -4
  448. package/dist/utils/checklistGenerator.js +46 -46
  449. package/dist/utils/copyToClipboard.js +65 -131
  450. package/dist/utils/countries-list.js +2 -3
  451. package/dist/utils/customHooks.js +40 -67
  452. package/dist/utils/delete-redirect-cookie-and-navigate.js +3 -3
  453. package/dist/utils/fix-decimals.js +4 -5
  454. package/dist/utils/formatCurrencyValue.js +41 -52
  455. package/dist/utils/get-cookie-domain.js +3 -4
  456. package/dist/utils/get-short-address.js +1 -3
  457. package/dist/utils/isUSInvestor.js +2 -4
  458. package/dist/utils/km_ify.js +3 -3
  459. package/dist/utils/lock-body.js +3 -5
  460. package/dist/utils/moment.js +10 -12
  461. package/dist/utils/redirect-url.js +2 -3
  462. package/dist/utils/saveAs.js +5 -5
  463. package/dist/utils/scrollUtils.js +33 -36
  464. package/dist/utils/set-redirect-cookie.js +6 -7
  465. package/dist/utils/withRouter.js +6 -6
  466. package/package.json +134 -141
@@ -24,46 +24,28 @@ var _withRouter = require("../../utils/withRouter");
24
24
  var _customHooks = require("../../utils/customHooks");
25
25
  var _auth2 = require("firebase/auth");
26
26
  var _firebaseConfig = require("../../firebase-config");
27
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
28
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
29
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
30
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
31
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
32
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
33
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
27
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
28
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
34
29
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
35
30
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
36
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
37
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
38
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
39
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
40
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
41
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
42
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
43
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
44
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
45
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
46
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
47
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
48
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
49
- var Outer = _styledComponents.default.div.withConfig({
31
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
32
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
33
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
34
+ const Outer = _styledComponents.default.div.withConfig({
50
35
  displayName: "HeaderHo__Outer",
51
36
  componentId: "sc-ll6oef-0"
52
- })(["position:relative;", ""], function (_ref) {
53
- var fixed = _ref.fixed;
37
+ })(["position:relative;", ""], _ref => {
38
+ let {
39
+ fixed
40
+ } = _ref;
54
41
  return fixed && (0, _styledComponents.css)(["position:fixed;z-index:99;top:0;left:50%;width:100%;background:white;max-width:", "px;transform:translateX(-50%);border-left:1px solid ", ";border-right:1px solid ", ";"], sc.MAX_WIDTH, sc.GRAY_BASE_HEX, sc.GRAY_BASE_HEX);
55
42
  });
56
- var HeaderHoClass = /*#__PURE__*/function (_Component) {
57
- _inherits(HeaderHoClass, _Component);
58
- var _super = _createSuper(HeaderHoClass);
59
- function HeaderHoClass() {
43
+ class HeaderHoClass extends _react.Component {
44
+ constructor() {
60
45
  var _this;
61
- _classCallCheck(this, HeaderHoClass);
62
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
63
- args[_key] = arguments[_key];
64
- }
65
- _this = _super.call.apply(_super, [this].concat(args));
66
- _defineProperty(_assertThisInitialized(_this), "state", {
46
+ super(...arguments);
47
+ _this = this;
48
+ _defineProperty(this, "state", {
67
49
  mobileMenuOpen: false,
68
50
  isModalOpen: {
69
51
  login: false,
@@ -96,69 +78,69 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
96
78
  termsData: undefined,
97
79
  isResettingExpiredToken: false
98
80
  });
99
- _defineProperty(_assertThisInitialized(_this), "checkForModals", function () {
100
- var _this$props = _this.props,
101
- isLogin = _this$props.isLogin,
102
- isSignUp = _this$props.isSignUp,
103
- isResetPassword = _this$props.isResetPassword,
104
- isVerifyEmail = _this$props.isVerifyEmail;
105
- var user = _this.context.user;
106
- var isModalOpen = _this.state.isModalOpen;
107
- var login = isModalOpen.login,
108
- signUp = isModalOpen.signUp,
109
- resetPassword = isModalOpen.resetPassword,
110
- verifyEmail = isModalOpen.verifyEmail;
81
+ _defineProperty(this, "checkForModals", () => {
82
+ const {
83
+ isLogin,
84
+ isSignUp,
85
+ isResetPassword,
86
+ isVerifyEmail
87
+ } = this.props;
88
+ const {
89
+ user
90
+ } = this.context;
91
+ const {
92
+ isModalOpen
93
+ } = this.state;
94
+ const {
95
+ login,
96
+ signUp,
97
+ resetPassword,
98
+ verifyEmail
99
+ } = isModalOpen;
111
100
 
112
101
  //checks if any modal is open
113
102
  //if true we won't open any modal from below
114
- var isAnyModalOpen = Object.values(isModalOpen).some(function (value) {
115
- return value === true;
116
- });
103
+ const isAnyModalOpen = Object.values(isModalOpen).some(value => value === true);
117
104
  if (isAnyModalOpen) return;
118
105
 
119
106
  //dont open if modal is already open or user is logged in
120
107
  if (isLogin && !user && !login) {
121
- _this.setState(function (prevState) {
122
- return _objectSpread(_objectSpread({}, prevState), {}, {
123
- isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
124
- login: true
125
- })
126
- });
127
- });
108
+ this.setState(prevState => _objectSpread(_objectSpread({}, prevState), {}, {
109
+ isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
110
+ login: true
111
+ })
112
+ }));
128
113
  }
129
114
  if (isSignUp && !user && !signUp) {
130
- _this.setState(function (prevState) {
131
- return _objectSpread(_objectSpread({}, prevState), {}, {
132
- isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
133
- signUp: true
134
- })
135
- });
136
- });
115
+ this.setState(prevState => _objectSpread(_objectSpread({}, prevState), {}, {
116
+ isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
117
+ signUp: true
118
+ })
119
+ }));
137
120
  }
138
121
  if (isResetPassword && !user && !resetPassword) {
139
- _this.setState(function (prevState) {
140
- return _objectSpread(_objectSpread({}, prevState), {}, {
141
- isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
142
- resetPassword: true
143
- })
144
- });
145
- });
122
+ this.setState(prevState => _objectSpread(_objectSpread({}, prevState), {}, {
123
+ isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
124
+ resetPassword: true
125
+ })
126
+ }));
146
127
  }
147
128
  if (isVerifyEmail && !verifyEmail) {
148
- _this.setState(function (prevState) {
149
- return _objectSpread(_objectSpread({}, prevState), {}, {
150
- isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
151
- verifyEmail: true
152
- })
153
- });
154
- });
129
+ this.setState(prevState => _objectSpread(_objectSpread({}, prevState), {}, {
130
+ isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
131
+ verifyEmail: true
132
+ })
133
+ }));
155
134
  }
156
135
  });
157
- _defineProperty(_assertThisInitialized(_this), "setOpenModalStatus", function (modalId, status) {
158
- var isModalOpen = _this.state.isModalOpen;
159
- var _this$props2 = _this.props,
160
- onSignupModalClose = _this$props2.onSignupModalClose,
161
- navigate = _this$props2.navigate;
136
+ _defineProperty(this, "setOpenModalStatus", (modalId, status) => {
137
+ const {
138
+ isModalOpen
139
+ } = this.state;
140
+ const {
141
+ onSignupModalClose,
142
+ navigate
143
+ } = this.props;
162
144
 
163
145
  //if we pass custom onSignupModalClose, we don't want any modification in the url
164
146
  if (!onSignupModalClose) {
@@ -170,726 +152,560 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
170
152
  navigate('/');
171
153
  }
172
154
  }
173
- _this.setState(function (prevState) {
174
- return _objectSpread(_objectSpread({}, prevState), {}, {
175
- isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, _defineProperty({}, modalId, status))
176
- }, modalId === 'forgot' && !status && {
177
- isResettingExpiredToken: false
178
- });
179
- });
155
+ this.setState(prevState => _objectSpread(_objectSpread({}, prevState), {}, {
156
+ isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
157
+ [modalId]: status
158
+ })
159
+ }, modalId === 'forgot' && !status && {
160
+ isResettingExpiredToken: false
161
+ }));
180
162
  });
181
- _defineProperty(_assertThisInitialized(_this), "switchOpenModal", function (prevModalId, nextModalId) {
182
- var isModalOpen = _this.state.isModalOpen;
163
+ _defineProperty(this, "switchOpenModal", (prevModalId, nextModalId) => {
164
+ const {
165
+ isModalOpen
166
+ } = this.state;
183
167
 
184
168
  //if you previously were on /signup or any other route and you want to swtich to login modal
185
169
  //we need to change the url accordingly so if you refresh the page, the modal will open
186
170
  if (nextModalId === 'login' || nextModalId === 'signUp') {
187
171
  window.history.pushState('', '', nextModalId === 'login' ? '/login' : nextModalId === 'signUp' ? '/signup' : '/');
188
172
  }
189
- _this.setState(function (prevState) {
190
- var _objectSpread3;
191
- return _objectSpread(_objectSpread({}, prevState), {}, {
192
- isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, (_objectSpread3 = {}, _defineProperty(_objectSpread3, prevModalId, false), _defineProperty(_objectSpread3, nextModalId, true), _objectSpread3))
193
- });
194
- });
173
+ this.setState(prevState => _objectSpread(_objectSpread({}, prevState), {}, {
174
+ isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
175
+ [prevModalId]: false,
176
+ [nextModalId]: true
177
+ })
178
+ }));
195
179
  });
196
- _defineProperty(_assertThisInitialized(_this), "setUserInfo", function (userInfo) {
197
- _this.setState(function (prevState) {
198
- return _objectSpread(_objectSpread({}, prevState), {}, {
199
- userInfo: userInfo
200
- });
201
- });
180
+ _defineProperty(this, "setUserInfo", userInfo => {
181
+ this.setState(prevState => _objectSpread(_objectSpread({}, prevState), {}, {
182
+ userInfo
183
+ }));
202
184
  });
203
- _defineProperty(_assertThisInitialized(_this), "setPopupError", function (popup, message) {
204
- var field = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
205
- _this.setState(function (prevState) {
206
- return _objectSpread(_objectSpread({}, prevState), {}, {
207
- popupError: {
208
- popup: popup,
209
- message: message,
210
- field: field
211
- }
212
- });
213
- });
185
+ _defineProperty(this, "setPopupError", function (popup, message) {
186
+ let field = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
187
+ _this.setState(prevState => _objectSpread(_objectSpread({}, prevState), {}, {
188
+ popupError: {
189
+ popup,
190
+ message,
191
+ field
192
+ }
193
+ }));
214
194
  });
215
- _defineProperty(_assertThisInitialized(_this), "clearPopupError", function () {
216
- _this.setState(function (prevState) {
217
- return _objectSpread(_objectSpread({}, prevState), {}, {
218
- popupError: {
219
- popup: undefined,
220
- message: undefined,
221
- field: undefined
222
- }
223
- });
224
- });
195
+ _defineProperty(this, "clearPopupError", () => {
196
+ this.setState(prevState => _objectSpread(_objectSpread({}, prevState), {}, {
197
+ popupError: {
198
+ popup: undefined,
199
+ message: undefined,
200
+ field: undefined
201
+ }
202
+ }));
225
203
  });
226
- _defineProperty(_assertThisInitialized(_this), "setPopupSuccess", function (popup, message) {
227
- _this.setState(function (prevState) {
228
- return _objectSpread(_objectSpread({}, prevState), {}, {
229
- popupSuccess: {
230
- popup: popup,
231
- message: message
232
- }
233
- });
234
- });
204
+ _defineProperty(this, "setPopupSuccess", (popup, message) => {
205
+ this.setState(prevState => _objectSpread(_objectSpread({}, prevState), {}, {
206
+ popupSuccess: {
207
+ popup,
208
+ message
209
+ }
210
+ }));
235
211
  });
236
- _defineProperty(_assertThisInitialized(_this), "clearPopupSuccess", function () {
237
- _this.setState(function (prevState) {
238
- return _objectSpread(_objectSpread({}, prevState), {}, {
239
- popupSuccess: {
240
- popup: undefined,
241
- message: undefined
242
- }
243
- });
244
- });
212
+ _defineProperty(this, "clearPopupSuccess", () => {
213
+ this.setState(prevState => _objectSpread(_objectSpread({}, prevState), {}, {
214
+ popupSuccess: {
215
+ popup: undefined,
216
+ message: undefined
217
+ }
218
+ }));
245
219
  });
246
- _defineProperty(_assertThisInitialized(_this), "setIsActionLoading", function (popup) {
247
- _this.setState({
220
+ _defineProperty(this, "setIsActionLoading", popup => {
221
+ this.setState({
248
222
  isActionLoading: popup
249
223
  });
250
224
  });
251
- return _this;
252
225
  }
253
- _createClass(HeaderHoClass, [{
254
- key: "componentWillUnmount",
255
- value: function componentWillUnmount() {
256
- // Force unlock body scrolling when component unmounts
257
- document.body.style.overflow = 'unset';
226
+ componentWillUnmount() {
227
+ // Force unlock body scrolling when component unmounts
228
+ document.body.style.overflow = 'unset';
229
+ }
230
+ componentDidUpdate(prevProps, prevState) {
231
+ // If any popup is open, prevent body from scrolling
232
+ const isOpenCurrent = Object.values(this.state.isModalOpen).some(popup => popup);
233
+ const isOpenPrev = Object.values(prevState.isModalOpen).some(popup => popup);
234
+ const {
235
+ mobileMenuOpen
236
+ } = this.state;
237
+ const {
238
+ isFetchingUser,
239
+ verifyEmailError
240
+ } = this.context;
241
+ if (!mobileMenuOpen) {
242
+ if (isOpenCurrent) {
243
+ console.log('🚀 ~ componentDidUpdate ~ isOpenCurrent:', isOpenCurrent);
244
+ document.body.style.overflow = 'hidden';
245
+ } else if (isOpenPrev) {
246
+ document.body.style.overflow = 'unset';
247
+ }
258
248
  }
259
- }, {
260
- key: "componentDidUpdate",
261
- value: function componentDidUpdate(prevProps, prevState) {
262
- // If any popup is open, prevent body from scrolling
263
- var isOpenCurrent = Object.values(this.state.isModalOpen).some(function (popup) {
264
- return popup;
265
- });
266
- var isOpenPrev = Object.values(prevState.isModalOpen).some(function (popup) {
267
- return popup;
268
- });
269
- var mobileMenuOpen = this.state.mobileMenuOpen;
270
- var _this$context = this.context,
271
- isFetchingUser = _this$context.isFetchingUser,
272
- verifyEmailError = _this$context.verifyEmailError;
273
- if (!mobileMenuOpen) {
274
- if (isOpenCurrent) {
275
- console.log('🚀 ~ componentDidUpdate ~ isOpenCurrent:', isOpenCurrent);
276
- document.body.style.overflow = 'hidden';
277
- } else if (isOpenPrev) {
278
- document.body.style.overflow = 'unset';
249
+ if ((verifyEmailError === null || verifyEmailError === void 0 ? void 0 : verifyEmailError.code) === 'auth/invalid-action-code' && !window.location.href.includes('login')) {
250
+ this.props.navigate('/login');
251
+ this.props.navigate(0);
252
+ }
253
+ if (!isFetchingUser) {
254
+ this.checkForModals();
255
+ }
256
+ }
257
+ render() {
258
+ const {
259
+ isModalOpen,
260
+ userInfo,
261
+ isActionLoading,
262
+ termsData,
263
+ isResettingExpiredToken
264
+ } = this.state;
265
+ const {
266
+ fixed,
267
+ activateMenu,
268
+ activeMenu,
269
+ withoutLoginSignupButton,
270
+ useRelativePathForMenu,
271
+ isLoginModalOpen,
272
+ setIsLoginModalOpen,
273
+ cooldown
274
+ } = this.props;
275
+ const {
276
+ getUser,
277
+ user = {},
278
+ avatar,
279
+ logoutUser,
280
+ loginUser,
281
+ waitingFor2fa,
282
+ firebaseError,
283
+ loginUserWithTotp,
284
+ createUser,
285
+ handleResetPassword,
286
+ resendActivationEmail,
287
+ verifyEmailError,
288
+ isVerifyingEmail
289
+ } = this.context;
290
+ return /*#__PURE__*/_react.default.createElement(Outer, {
291
+ fixed: fixed
292
+ }, /*#__PURE__*/_react.default.createElement(_Header.default, {
293
+ user: user,
294
+ activeMenu: activeMenu,
295
+ activateMenu: activateMenu,
296
+ useRelativePathForMenu: useRelativePathForMenu,
297
+ userPhoto: avatar,
298
+ logoutUser: logoutUser,
299
+ noFixedPosition: true,
300
+ withoutLoginSignupButton: withoutLoginSignupButton,
301
+ onLoginClick: () => {
302
+ this.setOpenModalStatus('login', true);
303
+ },
304
+ onSignUpClick: () => {
305
+ this.setOpenModalStatus('signUp', true);
306
+ }
307
+ }), /*#__PURE__*/_react.default.createElement(_LoginModal.default, {
308
+ isActionLoading: isActionLoading,
309
+ popupError: this.state.popupError,
310
+ isModalOpen: isModalOpen.login || isLoginModalOpen,
311
+ onModalClose: () => {
312
+ this.setOpenModalStatus('login', false);
313
+ setIsLoginModalOpen && setIsLoginModalOpen(false);
314
+ this.clearPopupError();
315
+ this.setIsActionLoading(undefined);
316
+ },
317
+ onModalSwitch: () => {
318
+ this.switchOpenModal('login', 'signUp');
319
+ setIsLoginModalOpen && setIsLoginModalOpen(false);
320
+ this.clearPopupError();
321
+ this.setIsActionLoading(undefined);
322
+ },
323
+ onForgotPassword: () => {
324
+ this.switchOpenModal('login', 'forgot');
325
+ setIsLoginModalOpen && setIsLoginModalOpen(false);
326
+ this.clearPopupError();
327
+ this.setIsActionLoading(undefined);
328
+ },
329
+ onFormSend: async _ref2 => {
330
+ let {
331
+ email,
332
+ password
333
+ } = _ref2;
334
+ this.clearPopupError();
335
+ this.setIsActionLoading('login');
336
+ try {
337
+ if (password.length > 128) {
338
+ this.setPopupError('login', 'Your password cannot exceed 128 characters');
339
+ this.setIsActionLoading(undefined);
340
+ return;
341
+ }
342
+ await loginUser(email, password);
343
+ await getUser();
344
+ this.setOpenModalStatus('login', false);
345
+ setIsLoginModalOpen && setIsLoginModalOpen(false);
346
+ this.clearPopupError();
347
+ this.setIsActionLoading(undefined);
348
+ } catch (error) {
349
+ const errorMessage = error === null || error === void 0 ? void 0 : error.message;
350
+
351
+ //handle switch modal correctly
352
+ if ((error === null || error === void 0 ? void 0 : error.code) === 'auth/multi-factor-auth-required') {
353
+ this.switchOpenModal('login', 'enter2fa');
354
+ this.clearPopupError();
355
+ this.setIsActionLoading(undefined);
356
+ return;
357
+ }
358
+ if (errorMessage) {
359
+ this.setPopupError('login', errorMessage);
360
+ } else {
361
+ this.setPopupError('login', "Oops. Something's not right there. Try again?");
362
+ }
363
+ this.setIsActionLoading(undefined);
279
364
  }
280
365
  }
281
- if ((verifyEmailError === null || verifyEmailError === void 0 ? void 0 : verifyEmailError.code) === 'auth/invalid-action-code' && !window.location.href.includes('login')) {
282
- this.props.navigate('/login');
283
- this.props.navigate(0);
366
+ }), waitingFor2fa && /*#__PURE__*/_react.default.createElement(_FA.EnterCode, {
367
+ isModal: true,
368
+ popupError: this.state.popupError,
369
+ isActionLoading: isActionLoading,
370
+ isModalOpen: isModalOpen.enter2fa,
371
+ onModalClose: () => {
372
+ this.setOpenModalStatus('enter2fa', false);
373
+ this.clearPopupError();
374
+ this.setIsActionLoading(undefined);
375
+ },
376
+ onModalSwitch: () => {
377
+ this.switchOpenModal('enter2fa', 'resetCode');
378
+ this.clearPopupError();
379
+ this.setIsActionLoading(undefined);
380
+ },
381
+ onFormSend: async _ref3 => {
382
+ let {
383
+ otpInput
384
+ } = _ref3;
385
+ this.setIsActionLoading('enter2fa');
386
+ try {
387
+ await loginUserWithTotp(otpInput, firebaseError);
388
+ await getUser();
389
+ this.setOpenModalStatus('enter2fa', false);
390
+ this.clearPopupError();
391
+ this.setIsActionLoading(undefined);
392
+ } catch (error) {
393
+ console.log('🚀 ~ file: HeaderHo.jsx:364 ~ error:', error);
394
+ if ((error === null || error === void 0 ? void 0 : error.code) === 'auth/invalid-verification-code') {
395
+ this.setPopupError('enter2fa', 'That’s not the right 2FA code. Try again');
396
+ } else if ((error === null || error === void 0 ? void 0 : error.code) === 'auth/code-expired') {
397
+ this.setPopupError('enter2fa', 'Time out. Please restart the flow and log in again');
398
+ } else {
399
+ this.setPopupError('enter2fa', error === null || error === void 0 ? void 0 : error.message);
400
+ }
401
+ }
402
+ this.setIsActionLoading(undefined);
284
403
  }
285
- if (!isFetchingUser) {
286
- this.checkForModals();
404
+ }), /*#__PURE__*/_react.default.createElement(_FA.ResetCode, {
405
+ isModalOpen: isModalOpen.resetCode,
406
+ onModalClose: () => {
407
+ this.setOpenModalStatus('resetCode', false);
408
+ this.clearPopupError();
409
+ this.setIsActionLoading(undefined);
410
+ },
411
+ onModalSwitch: () => {
412
+ this.clearPopupError();
413
+ this.setIsActionLoading(undefined);
414
+ this.switchOpenModal('resetCode', 'enter2fa');
287
415
  }
288
- }
289
- }, {
290
- key: "render",
291
- value: function render() {
292
- var _this2 = this;
293
- var _this$state = this.state,
294
- isModalOpen = _this$state.isModalOpen,
295
- userInfo = _this$state.userInfo,
296
- isActionLoading = _this$state.isActionLoading,
297
- termsData = _this$state.termsData,
298
- isResettingExpiredToken = _this$state.isResettingExpiredToken;
299
- var _this$props3 = this.props,
300
- fixed = _this$props3.fixed,
301
- activateMenu = _this$props3.activateMenu,
302
- activeMenu = _this$props3.activeMenu,
303
- withoutLoginSignupButton = _this$props3.withoutLoginSignupButton,
304
- useRelativePathForMenu = _this$props3.useRelativePathForMenu,
305
- isLoginModalOpen = _this$props3.isLoginModalOpen,
306
- setIsLoginModalOpen = _this$props3.setIsLoginModalOpen,
307
- cooldown = _this$props3.cooldown;
308
- var _this$context2 = this.context,
309
- getUser = _this$context2.getUser,
310
- _this$context2$user = _this$context2.user,
311
- user = _this$context2$user === void 0 ? {} : _this$context2$user,
312
- avatar = _this$context2.avatar,
313
- logoutUser = _this$context2.logoutUser,
314
- loginUser = _this$context2.loginUser,
315
- waitingFor2fa = _this$context2.waitingFor2fa,
316
- firebaseError = _this$context2.firebaseError,
317
- loginUserWithTotp = _this$context2.loginUserWithTotp,
318
- createUser = _this$context2.createUser,
319
- handleResetPassword = _this$context2.handleResetPassword,
320
- resendActivationEmail = _this$context2.resendActivationEmail,
321
- verifyEmailError = _this$context2.verifyEmailError,
322
- isVerifyingEmail = _this$context2.isVerifyingEmail;
323
- return /*#__PURE__*/_react.default.createElement(Outer, {
324
- fixed: fixed
325
- }, /*#__PURE__*/_react.default.createElement(_Header.default, {
326
- user: user,
327
- activeMenu: activeMenu,
328
- activateMenu: activateMenu,
329
- useRelativePathForMenu: useRelativePathForMenu,
330
- userPhoto: avatar,
331
- logoutUser: logoutUser,
332
- noFixedPosition: true,
333
- withoutLoginSignupButton: withoutLoginSignupButton,
334
- onLoginClick: function onLoginClick() {
335
- _this2.setOpenModalStatus('login', true);
336
- },
337
- onSignUpClick: function onSignUpClick() {
338
- _this2.setOpenModalStatus('signUp', true);
339
- }
340
- }), /*#__PURE__*/_react.default.createElement(_LoginModal.default, {
341
- isActionLoading: isActionLoading,
342
- popupError: this.state.popupError,
343
- isModalOpen: isModalOpen.login || isLoginModalOpen,
344
- onModalClose: function onModalClose() {
345
- _this2.setOpenModalStatus('login', false);
346
- setIsLoginModalOpen && setIsLoginModalOpen(false);
347
- _this2.clearPopupError();
348
- _this2.setIsActionLoading(undefined);
349
- },
350
- onModalSwitch: function onModalSwitch() {
351
- _this2.switchOpenModal('login', 'signUp');
352
- setIsLoginModalOpen && setIsLoginModalOpen(false);
353
- _this2.clearPopupError();
354
- _this2.setIsActionLoading(undefined);
355
- },
356
- onForgotPassword: function onForgotPassword() {
357
- _this2.switchOpenModal('login', 'forgot');
358
- setIsLoginModalOpen && setIsLoginModalOpen(false);
359
- _this2.clearPopupError();
360
- _this2.setIsActionLoading(undefined);
361
- },
362
- onFormSend: /*#__PURE__*/function () {
363
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
364
- var email, password, errorMessage;
365
- return _regeneratorRuntime().wrap(function _callee$(_context) {
366
- while (1) switch (_context.prev = _context.next) {
367
- case 0:
368
- email = _ref2.email, password = _ref2.password;
369
- _this2.clearPopupError();
370
- _this2.setIsActionLoading('login');
371
- _context.prev = 3;
372
- if (!(password.length > 128)) {
373
- _context.next = 8;
374
- break;
375
- }
376
- _this2.setPopupError('login', 'Your password cannot exceed 128 characters');
377
- _this2.setIsActionLoading(undefined);
378
- return _context.abrupt("return");
379
- case 8:
380
- _context.next = 10;
381
- return loginUser(email, password);
382
- case 10:
383
- _context.next = 12;
384
- return getUser();
385
- case 12:
386
- _this2.setOpenModalStatus('login', false);
387
- setIsLoginModalOpen && setIsLoginModalOpen(false);
388
- _this2.clearPopupError();
389
- _this2.setIsActionLoading(undefined);
390
- _context.next = 28;
391
- break;
392
- case 18:
393
- _context.prev = 18;
394
- _context.t0 = _context["catch"](3);
395
- errorMessage = _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message; //handle switch modal correctly
396
- if (!((_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.code) === 'auth/multi-factor-auth-required')) {
397
- _context.next = 26;
398
- break;
399
- }
400
- _this2.switchOpenModal('login', 'enter2fa');
401
- _this2.clearPopupError();
402
- _this2.setIsActionLoading(undefined);
403
- return _context.abrupt("return");
404
- case 26:
405
- if (errorMessage) {
406
- _this2.setPopupError('login', errorMessage);
407
- } else {
408
- _this2.setPopupError('login', "Oops. Something's not right there. Try again?");
409
- }
410
- _this2.setIsActionLoading(undefined);
411
- case 28:
412
- case "end":
413
- return _context.stop();
414
- }
415
- }, _callee, null, [[3, 18]]);
416
- }));
417
- return function (_x) {
418
- return _ref3.apply(this, arguments);
419
- };
420
- }()
421
- }), waitingFor2fa && /*#__PURE__*/_react.default.createElement(_FA.EnterCode, {
422
- isModal: true,
423
- popupError: this.state.popupError,
424
- isActionLoading: isActionLoading,
425
- isModalOpen: isModalOpen.enter2fa,
426
- onModalClose: function onModalClose() {
427
- _this2.setOpenModalStatus('enter2fa', false);
428
- _this2.clearPopupError();
429
- _this2.setIsActionLoading(undefined);
430
- },
431
- onModalSwitch: function onModalSwitch() {
432
- _this2.switchOpenModal('enter2fa', 'resetCode');
433
- _this2.clearPopupError();
434
- _this2.setIsActionLoading(undefined);
435
- },
436
- onFormSend: /*#__PURE__*/function () {
437
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref4) {
438
- var otpInput;
439
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
440
- while (1) switch (_context2.prev = _context2.next) {
441
- case 0:
442
- otpInput = _ref4.otpInput;
443
- _this2.setIsActionLoading('enter2fa');
444
- _context2.prev = 2;
445
- _context2.next = 5;
446
- return loginUserWithTotp(otpInput, firebaseError);
447
- case 5:
448
- _context2.next = 7;
449
- return getUser();
450
- case 7:
451
- _this2.setOpenModalStatus('enter2fa', false);
452
- _this2.clearPopupError();
453
- _this2.setIsActionLoading(undefined);
454
- _context2.next = 16;
455
- break;
456
- case 12:
457
- _context2.prev = 12;
458
- _context2.t0 = _context2["catch"](2);
459
- console.log('🚀 ~ file: HeaderHo.jsx:364 ~ error:', _context2.t0);
460
- if ((_context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.code) === 'auth/invalid-verification-code') {
461
- _this2.setPopupError('enter2fa', 'That’s not the right 2FA code. Try again');
462
- } else if ((_context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.code) === 'auth/code-expired') {
463
- _this2.setPopupError('enter2fa', 'Time out. Please restart the flow and log in again');
464
- } else {
465
- _this2.setPopupError('enter2fa', _context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.message);
466
- }
467
- case 16:
468
- _this2.setIsActionLoading(undefined);
469
- case 17:
470
- case "end":
471
- return _context2.stop();
472
- }
473
- }, _callee2, null, [[2, 12]]);
474
- }));
475
- return function (_x2) {
476
- return _ref5.apply(this, arguments);
477
- };
478
- }()
479
- }), /*#__PURE__*/_react.default.createElement(_FA.ResetCode, {
480
- isModalOpen: isModalOpen.resetCode,
481
- onModalClose: function onModalClose() {
482
- _this2.setOpenModalStatus('resetCode', false);
483
- _this2.clearPopupError();
484
- _this2.setIsActionLoading(undefined);
485
- },
486
- onModalSwitch: function onModalSwitch() {
487
- _this2.clearPopupError();
488
- _this2.setIsActionLoading(undefined);
489
- _this2.switchOpenModal('resetCode', 'enter2fa');
416
+ }), /*#__PURE__*/_react.default.createElement(_RegisterModal.default, {
417
+ isActionLoading: isActionLoading,
418
+ popupError: this.state.popupError,
419
+ clearPopupError: this.clearPopupError,
420
+ setPopupError: this.setPopupError,
421
+ isModalOpen: isModalOpen.signUp,
422
+ onModalClose: () => {
423
+ var _location$state;
424
+ const {
425
+ location,
426
+ navigate,
427
+ onSignupModalClose
428
+ } = this.props;
429
+ var body = document.getElementsByTagName('body')[0];
430
+ body.style.overflow = 'unset';
431
+ this.setOpenModalStatus('signUp', false);
432
+ this.clearPopupError();
433
+ this.setIsActionLoading(undefined);
434
+ onSignupModalClose && onSignupModalClose();
435
+ if (location !== null && location !== void 0 && (_location$state = location.state) !== null && _location$state !== void 0 && _location$state.isHowStokrWorksRedirect) {
436
+ navigate('/how-stokr-works/for-investors');
490
437
  }
491
- }), /*#__PURE__*/_react.default.createElement(_RegisterModal.default, {
492
- isActionLoading: isActionLoading,
493
- popupError: this.state.popupError,
494
- clearPopupError: this.clearPopupError,
495
- setPopupError: this.setPopupError,
496
- isModalOpen: isModalOpen.signUp,
497
- onModalClose: function onModalClose() {
498
- var _location$state;
499
- var _this2$props = _this2.props,
500
- location = _this2$props.location,
501
- navigate = _this2$props.navigate,
502
- onSignupModalClose = _this2$props.onSignupModalClose;
503
- var body = document.getElementsByTagName('body')[0];
504
- body.style.overflow = 'unset';
505
- _this2.setOpenModalStatus('signUp', false);
506
- _this2.clearPopupError();
507
- _this2.setIsActionLoading(undefined);
508
- onSignupModalClose && onSignupModalClose();
509
- if (location !== null && location !== void 0 && (_location$state = location.state) !== null && _location$state !== void 0 && _location$state.isHowStokrWorksRedirect) {
510
- navigate('/how-stokr-works/for-investors');
438
+ },
439
+ onTermsClicked: termsData => {
440
+ this.setState(prevState => _objectSpread(_objectSpread({}, prevState), {}, {
441
+ termsData
442
+ }));
443
+ this.switchOpenModal('signUp', 'terms');
444
+ this.clearPopupError();
445
+ this.setIsActionLoading(undefined);
446
+ },
447
+ onModalSwitch: () => {
448
+ this.switchOpenModal('signUp', 'login');
449
+ this.clearPopupError();
450
+ this.setIsActionLoading(undefined);
451
+ const {
452
+ onSignupModalClose
453
+ } = this.props;
454
+ onSignupModalClose && onSignupModalClose();
455
+ },
456
+ onFormSend: async userInfo => {
457
+ this.clearPopupError();
458
+ this.setIsActionLoading('signUp');
459
+
460
+ //check password
461
+ try {
462
+ if (userInfo.password.length > 128) {
463
+ this.setPopupError('register', 'Your password cannot exceed 128 characters', 'password');
464
+ this.setIsActionLoading(undefined);
465
+ return;
511
466
  }
512
- },
513
- onTermsClicked: function onTermsClicked(termsData) {
514
- _this2.setState(function (prevState) {
515
- return _objectSpread(_objectSpread({}, prevState), {}, {
516
- termsData: termsData
517
- });
518
- });
519
- _this2.switchOpenModal('signUp', 'terms');
520
- _this2.clearPopupError();
521
- _this2.setIsActionLoading(undefined);
522
- },
523
- onModalSwitch: function onModalSwitch() {
524
- _this2.switchOpenModal('signUp', 'login');
525
- _this2.clearPopupError();
526
- _this2.setIsActionLoading(undefined);
527
- var onSignupModalClose = _this2.props.onSignupModalClose;
528
- onSignupModalClose && onSignupModalClose();
529
- },
530
- onFormSend: /*#__PURE__*/function () {
531
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(userInfo) {
532
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
533
- while (1) switch (_context3.prev = _context3.next) {
534
- case 0:
535
- _this2.clearPopupError();
536
- _this2.setIsActionLoading('signUp');
467
+ await createUser(userInfo.email, userInfo.password);
537
468
 
538
- //check password
539
- _context3.prev = 2;
540
- if (!(userInfo.password.length > 128)) {
541
- _context3.next = 7;
542
- break;
543
- }
544
- _this2.setPopupError('register', 'Your password cannot exceed 128 characters', 'password');
545
- _this2.setIsActionLoading(undefined);
546
- return _context3.abrupt("return");
547
- case 7:
548
- _context3.next = 9;
549
- return createUser(userInfo.email, userInfo.password);
550
- case 9:
551
- //start the timer to count when user can resend email
552
- cooldown === null || cooldown === void 0 || cooldown.startCooldown();
469
+ //start the timer to count when user can resend email
470
+ cooldown === null || cooldown === void 0 || cooldown.startCooldown();
553
471
 
554
- //if user checked newsletter checkbox
555
- if (!userInfo.newsletter) {
556
- _context3.next = 13;
557
- break;
558
- }
559
- _context3.next = 13;
560
- return (0, _fetchDataPublic.default)('emails/subscribe', {
561
- email: userInfo.email,
562
- listName: 'newsletter'
563
- });
564
- case 13:
565
- _this2.setUserInfo(userInfo);
566
- _this2.switchOpenModal('signUp', 'confirm');
567
- _this2.setIsActionLoading(undefined);
568
- _context3.next = 23;
569
- break;
570
- case 18:
571
- _context3.prev = 18;
572
- _context3.t0 = _context3["catch"](2);
573
- console.log(_context3.t0);
574
- _this2.setIsActionLoading(undefined);
575
- if ((_context3.t0 === null || _context3.t0 === void 0 ? void 0 : _context3.t0.code) === 'auth/email-already-in-use') {
576
- _this2.setPopupError('register', 'This email address is already taken', 'email');
577
- } else if ((_context3.t0 === null || _context3.t0 === void 0 ? void 0 : _context3.t0.code) === 'auth/weak-password') {
578
- _this2.setPopupError('register', 'The password is too weak. Please try again.', 'password');
579
- } else {
580
- _this2.setPopupError('register', 'Oops, something went wrong');
581
- }
582
- case 23:
583
- case "end":
584
- return _context3.stop();
585
- }
586
- }, _callee3, null, [[2, 18]]);
587
- }));
588
- return function (_x3) {
589
- return _ref6.apply(this, arguments);
590
- };
591
- }()
592
- }), /*#__PURE__*/_react.default.createElement(_TermsModal.default, {
593
- isModalOpen: isModalOpen.terms,
594
- termsData: termsData,
595
- onModalClose: function onModalClose() {
596
- _this2.setOpenModalStatus('terms', false);
597
- },
598
- onModalSwitch: function onModalSwitch() {
599
- _this2.switchOpenModal('terms', 'signUp');
472
+ //if user checked newsletter checkbox
473
+ if (userInfo.newsletter) {
474
+ await (0, _fetchDataPublic.default)('emails/subscribe', {
475
+ email: userInfo.email,
476
+ listName: 'newsletter'
477
+ });
478
+ }
479
+ this.setUserInfo(userInfo);
480
+ this.switchOpenModal('signUp', 'confirm');
481
+ this.setIsActionLoading(undefined);
482
+ } catch (error) {
483
+ console.log(error);
484
+ this.setIsActionLoading(undefined);
485
+ if ((error === null || error === void 0 ? void 0 : error.code) === 'auth/email-already-in-use') {
486
+ this.setPopupError('register', 'This email address is already taken', 'email');
487
+ } else if ((error === null || error === void 0 ? void 0 : error.code) === 'auth/weak-password') {
488
+ this.setPopupError('register', 'The password is too weak. Please try again.', 'password');
489
+ } else {
490
+ this.setPopupError('register', 'Oops, something went wrong');
491
+ }
600
492
  }
601
- }), /*#__PURE__*/_react.default.createElement(_RegisterConfirmModal.default, {
602
- id: "form-submitted-popup",
603
- isActionLoading: isActionLoading,
604
- userInfo: userInfo,
605
- cooldown: cooldown,
606
- popupError: this.state.popupError,
607
- popupSuccess: this.state.popupSuccess,
608
- isModalOpen: isModalOpen.confirm,
609
- onModalClose: function onModalClose() {
610
- _this2.setOpenModalStatus('confirm', false);
611
- _this2.clearPopupSuccess();
612
- _this2.clearPopupError();
613
- _this2.setIsActionLoading(undefined);
614
- },
615
- onResend: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
616
- var email;
617
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
618
- while (1) switch (_context4.prev = _context4.next) {
619
- case 0:
620
- _this2.clearPopupSuccess();
621
- _this2.clearPopupError();
622
- _this2.setIsActionLoading('resend');
623
- _context4.prev = 3;
624
- email = _this2.state.userInfo.email;
625
- _context4.next = 7;
626
- return resendActivationEmail(email);
627
- case 7:
628
- cooldown === null || cooldown === void 0 || cooldown.startCooldown();
629
- _this2.setPopupSuccess('resend', 'Email sent.');
630
- _this2.setIsActionLoading(undefined);
631
- _context4.next = 17;
632
- break;
633
- case 12:
634
- _context4.prev = 12;
635
- _context4.t0 = _context4["catch"](3);
636
- console.log(_context4.t0);
637
- _this2.setPopupError('resend', 'Something went wrong.');
638
- _this2.setIsActionLoading(undefined);
639
- case 17:
640
- case "end":
641
- return _context4.stop();
642
- }
643
- }, _callee4, null, [[3, 12]]);
644
- }))
645
- }), /*#__PURE__*/_react.default.createElement(_ForgotPasswordModal.default, {
646
- isActionLoading: isActionLoading,
647
- popupError: this.state.popupError,
648
- popupSuccess: this.state.popupSuccess,
649
- isModalOpen: isModalOpen.forgot,
650
- isResettingExpiredToken: isResettingExpiredToken,
651
- onModalClose: function onModalClose() {
652
- _this2.setOpenModalStatus('forgot', false);
653
- _this2.clearPopupError();
654
- _this2.clearPopupSuccess();
655
- _this2.setIsActionLoading(undefined);
493
+ }
494
+ }), /*#__PURE__*/_react.default.createElement(_TermsModal.default, {
495
+ isModalOpen: isModalOpen.terms,
496
+ termsData: termsData,
497
+ onModalClose: () => {
498
+ this.setOpenModalStatus('terms', false);
499
+ },
500
+ onModalSwitch: () => {
501
+ this.switchOpenModal('terms', 'signUp');
502
+ }
503
+ }), /*#__PURE__*/_react.default.createElement(_RegisterConfirmModal.default, {
504
+ id: "form-submitted-popup",
505
+ isActionLoading: isActionLoading,
506
+ userInfo: userInfo,
507
+ cooldown: cooldown,
508
+ popupError: this.state.popupError,
509
+ popupSuccess: this.state.popupSuccess,
510
+ isModalOpen: isModalOpen.confirm,
511
+ onModalClose: () => {
512
+ this.setOpenModalStatus('confirm', false);
513
+ this.clearPopupSuccess();
514
+ this.clearPopupError();
515
+ this.setIsActionLoading(undefined);
516
+ },
517
+ onResend: async () => {
518
+ this.clearPopupSuccess();
519
+ this.clearPopupError();
520
+ this.setIsActionLoading('resend');
521
+ try {
522
+ const email = this.state.userInfo.email;
523
+ await resendActivationEmail(email);
524
+ cooldown === null || cooldown === void 0 || cooldown.startCooldown();
525
+ this.setPopupSuccess('resend', 'Email sent.');
526
+ this.setIsActionLoading(undefined);
527
+ } catch (error) {
528
+ console.log(error);
529
+ this.setPopupError('resend', 'Something went wrong.');
530
+ this.setIsActionLoading(undefined);
531
+ }
532
+ }
533
+ }), /*#__PURE__*/_react.default.createElement(_ForgotPasswordModal.default, {
534
+ isActionLoading: isActionLoading,
535
+ popupError: this.state.popupError,
536
+ popupSuccess: this.state.popupSuccess,
537
+ isModalOpen: isModalOpen.forgot,
538
+ isResettingExpiredToken: isResettingExpiredToken,
539
+ onModalClose: () => {
540
+ this.setOpenModalStatus('forgot', false);
541
+ this.clearPopupError();
542
+ this.clearPopupSuccess();
543
+ this.setIsActionLoading(undefined);
656
544
 
657
- // if we are in the expired token reset flow, we
658
- // also need to close the reset password modal
659
- if (isResettingExpiredToken) {
660
- _this2.setOpenModalStatus('resetPassword', false);
661
- }
662
- },
663
- onModalSwitch: function onModalSwitch() {
664
- _this2.switchOpenModal('forgot', 'login');
665
- _this2.clearPopupError();
666
- _this2.clearPopupSuccess();
667
- _this2.setIsActionLoading(undefined);
668
- },
669
- onFormSend: /*#__PURE__*/function () {
670
- var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref8) {
671
- var email, payload;
672
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
673
- while (1) switch (_context5.prev = _context5.next) {
674
- case 0:
675
- email = _ref8.email;
676
- _this2.clearPopupError();
677
- _this2.setIsActionLoading('forgot');
678
- payload = {
679
- email: email
680
- };
681
- if (isResettingExpiredToken) {
682
- console.log('isResettingExpiredToken: ', isResettingExpiredToken);
683
- payload.ventureInvite = true;
684
- }
685
- console.log('payload obj: ', payload);
686
- _context5.prev = 6;
687
- _context5.next = 9;
688
- return (0, _auth.default)('forgotPass', payload);
689
- case 9:
690
- _this2.setPopupSuccess('forgot', "We sent a message to ".concat(email, " (you might need to check your junk or spam folder) \u2014 tap the link inside to create a new password."));
691
- _this2.setIsActionLoading(undefined);
692
- _context5.next = 18;
693
- break;
694
- case 13:
695
- _context5.prev = 13;
696
- _context5.t0 = _context5["catch"](6);
697
- console.log(_context5.t0);
698
- _this2.setPopupError('forgot', 'This email is not registered.');
699
- _this2.setIsActionLoading(undefined);
700
- case 18:
701
- case "end":
702
- return _context5.stop();
703
- }
704
- }, _callee5, null, [[6, 13]]);
705
- }));
706
- return function (_x4) {
707
- return _ref9.apply(this, arguments);
708
- };
709
- }()
710
- }), /*#__PURE__*/_react.default.createElement(_ResetPasswordModal.default, {
711
- isActionLoading: isActionLoading,
712
- popupError: this.state.popupError,
713
- isModalOpen: isModalOpen.resetPassword,
714
- onModalClose: function onModalClose() {
715
- // clean up URL params
716
- var url = new URL(window.location);
717
- url.searchParams.delete('oobCode');
718
- url.searchParams.delete('mode');
719
- window.history.replaceState({}, '', url.toString());
720
- _this2.setOpenModalStatus('resetPassword', false);
721
- _this2.clearPopupError();
722
- _this2.setIsActionLoading(undefined);
723
- },
724
- onModalSwitch: function onModalSwitch() {
725
- window.history.pushState({}, null, '/login');
726
- _this2.switchOpenModal('resetPassword', 'login');
727
- _this2.clearPopupError();
728
- _this2.setIsActionLoading(undefined);
729
- },
730
- onFormSend: /*#__PURE__*/function () {
731
- var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref10) {
732
- var password;
733
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
734
- while (1) switch (_context6.prev = _context6.next) {
735
- case 0:
736
- password = _ref10.password;
737
- _this2.clearPopupError();
738
- _this2.setIsActionLoading('resetPassword');
739
- _context6.prev = 3;
740
- _context6.next = 6;
741
- return handleResetPassword(password);
742
- case 6:
743
- _this2.switchOpenModal('resetPassword', 'confirmReset');
744
- _this2.setIsActionLoading(undefined);
745
- _context6.next = 15;
746
- break;
747
- case 10:
748
- _context6.prev = 10;
749
- _context6.t0 = _context6["catch"](3);
750
- console.log(_context6.t0);
751
- _this2.setPopupError('resetPassword', (_context6.t0 === null || _context6.t0 === void 0 ? void 0 : _context6.t0.message) || 'Something went wrong.');
752
- _this2.setIsActionLoading(undefined);
753
- case 15:
754
- case "end":
755
- return _context6.stop();
756
- }
757
- }, _callee6, null, [[3, 10]]);
758
- }));
759
- return function (_x5) {
760
- return _ref11.apply(this, arguments);
761
- };
762
- }(),
763
- onLoad: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
764
- var location, query, oobCode, url;
765
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
766
- while (1) switch (_context7.prev = _context7.next) {
767
- case 0:
768
- location = _this2.props.location;
769
- query = new URLSearchParams(location === null || location === void 0 ? void 0 : location.search);
770
- oobCode = query.get('oobCode');
771
- if (!(oobCode && oobCode !== '')) {
772
- _context7.next = 16;
773
- break;
774
- }
775
- _this2.setIsActionLoading('resetPassword');
776
- _context7.prev = 5;
777
- _context7.next = 8;
778
- return (0, _auth2.checkActionCode)(_firebaseConfig.auth, oobCode);
779
- case 8:
780
- _this2.setIsActionLoading(undefined);
781
- _context7.next = 15;
782
- break;
783
- case 11:
784
- _context7.prev = 11;
785
- _context7.t0 = _context7["catch"](5);
786
- console.log('Password reset code error:', _context7.t0);
787
- if ((_context7.t0 === null || _context7.t0 === void 0 ? void 0 : _context7.t0.code) === 'auth/expired-action-code') {
788
- _this2.setState(function (prevState) {
789
- return _objectSpread(_objectSpread({}, prevState), {}, {
790
- isResettingExpiredToken: true
791
- });
792
- });
545
+ // if we are in the expired token reset flow, we
546
+ // also need to close the reset password modal
547
+ if (isResettingExpiredToken) {
548
+ this.setOpenModalStatus('resetPassword', false);
549
+ }
550
+ },
551
+ onModalSwitch: () => {
552
+ this.switchOpenModal('forgot', 'login');
553
+ this.clearPopupError();
554
+ this.clearPopupSuccess();
555
+ this.setIsActionLoading(undefined);
556
+ },
557
+ onFormSend: async _ref4 => {
558
+ let {
559
+ email
560
+ } = _ref4;
561
+ this.clearPopupError();
562
+ this.setIsActionLoading('forgot');
563
+ const payload = {
564
+ email: email
565
+ };
566
+ if (isResettingExpiredToken) {
567
+ console.log('isResettingExpiredToken: ', isResettingExpiredToken);
568
+ payload.ventureInvite = true;
569
+ }
570
+ console.log('payload obj: ', payload);
571
+ try {
572
+ await (0, _auth.default)('forgotPass', payload);
573
+ this.setPopupSuccess('forgot', "We sent a message to ".concat(email, " (you might need to check your junk or spam folder) \u2014 tap the link inside to create a new password."));
574
+ this.setIsActionLoading(undefined);
575
+ } catch (error) {
576
+ console.log(error);
577
+ this.setPopupError('forgot', 'This email is not registered.');
578
+ this.setIsActionLoading(undefined);
579
+ }
580
+ }
581
+ }), /*#__PURE__*/_react.default.createElement(_ResetPasswordModal.default, {
582
+ isActionLoading: isActionLoading,
583
+ popupError: this.state.popupError,
584
+ isModalOpen: isModalOpen.resetPassword,
585
+ onModalClose: () => {
586
+ // clean up URL params
587
+ const url = new URL(window.location);
588
+ url.searchParams.delete('oobCode');
589
+ url.searchParams.delete('mode');
590
+ window.history.replaceState({}, '', url.toString());
591
+ this.setOpenModalStatus('resetPassword', false);
592
+ this.clearPopupError();
593
+ this.setIsActionLoading(undefined);
594
+ },
595
+ onModalSwitch: () => {
596
+ window.history.pushState({}, null, '/login');
597
+ this.switchOpenModal('resetPassword', 'login');
598
+ this.clearPopupError();
599
+ this.setIsActionLoading(undefined);
600
+ },
601
+ onFormSend: async _ref5 => {
602
+ let {
603
+ password
604
+ } = _ref5;
605
+ this.clearPopupError();
606
+ this.setIsActionLoading('resetPassword');
607
+ try {
608
+ await handleResetPassword(password);
609
+ this.switchOpenModal('resetPassword', 'confirmReset');
610
+ this.setIsActionLoading(undefined);
611
+ } catch (error) {
612
+ console.log(error);
613
+ this.setPopupError('resetPassword', (error === null || error === void 0 ? void 0 : error.message) || 'Something went wrong.');
614
+ this.setIsActionLoading(undefined);
615
+ }
616
+ },
617
+ onLoad: async () => {
618
+ const {
619
+ location
620
+ } = this.props;
621
+ const query = new URLSearchParams(location === null || location === void 0 ? void 0 : location.search);
622
+ const oobCode = query.get('oobCode');
623
+ if (oobCode && oobCode !== '') {
624
+ this.setIsActionLoading('resetPassword');
625
+ try {
626
+ await (0, _auth2.checkActionCode)(_firebaseConfig.auth, oobCode);
627
+ this.setIsActionLoading(undefined);
628
+ } catch (error) {
629
+ console.log('Password reset code error:', error);
630
+ if ((error === null || error === void 0 ? void 0 : error.code) === 'auth/expired-action-code') {
631
+ this.setState(prevState => _objectSpread(_objectSpread({}, prevState), {}, {
632
+ isResettingExpiredToken: true
633
+ }));
793
634
 
794
- // before switching to Forgot Password modal, we need to clean up
795
- // the URL parameters that keep the reset password modal open.
796
- url = new URL(window.location);
797
- url.searchParams.delete('oobCode');
798
- url.searchParams.delete('mode');
799
- window.history.replaceState({}, '', url.toString());
635
+ // before switching to Forgot Password modal, we need to clean up
636
+ // the URL parameters that keep the reset password modal open.
637
+ const url = new URL(window.location);
638
+ url.searchParams.delete('oobCode');
639
+ url.searchParams.delete('mode');
640
+ window.history.replaceState({}, '', url.toString());
800
641
 
801
- // we use a special version of Forgot Password modal
802
- // adjusted to handle and resend expired tokens.
803
- // isResettingExpiredToken makes it adjust.
804
- _this2.switchOpenModal('resetPassword', 'forgot');
805
- } else {
806
- _this2.setPopupError('resetPassword', 'Something went wrong with the password reset link. Please try again.');
807
- }
808
- case 15:
809
- _this2.setIsActionLoading(undefined);
810
- case 16:
811
- case "end":
812
- return _context7.stop();
642
+ // we use a special version of Forgot Password modal
643
+ // adjusted to handle and resend expired tokens.
644
+ // isResettingExpiredToken makes it adjust.
645
+ this.switchOpenModal('resetPassword', 'forgot');
646
+ } else {
647
+ this.setPopupError('resetPassword', 'Something went wrong with the password reset link. Please try again.');
813
648
  }
814
- }, _callee7, null, [[5, 11]]);
815
- }))
816
- }), /*#__PURE__*/_react.default.createElement(_ResetConfirmModal.default, {
817
- isModalOpen: isModalOpen.confirmReset,
818
- onModalClose: function onModalClose() {
819
- _this2.setOpenModalStatus('confirmReset', false);
820
- },
821
- onModalSwitch: function onModalSwitch() {
822
- var location = _this2.props.location;
823
- var query = new URLSearchParams(location === null || location === void 0 ? void 0 : location.search);
824
- var userType = query.get('user_type');
825
- if (userType && userType === 'sa') {
826
- window.open("https://backoffice.".concat(process.env.REACT_APP_WEBSITE_DOMAIN));
827
- } else {
828
- _this2.switchOpenModal('confirmReset', 'login');
829
649
  }
650
+ this.setIsActionLoading(undefined);
830
651
  }
831
- }), !isVerifyingEmail && /*#__PURE__*/_react.default.createElement(_VerifyEmailModal.default, {
832
- id: "verify-email-popup",
833
- isActionLoading: isActionLoading,
834
- popupError: this.state.popupError,
835
- popupSuccess: this.state.popupSuccess,
836
- isModalOpen: isModalOpen.verifyEmail,
837
- continueUrl: "https://signup.".concat(process.env.REACT_APP_WEBSITE_DOMAIN, "/welcome"),
838
- error: verifyEmailError,
839
- isSuccess: !!!verifyEmailError,
840
- onModalSwitch: function onModalSwitch() {
841
- _this2.switchOpenModal('verifyEmail', 'login');
842
- _this2.clearPopupError();
843
- _this2.setIsActionLoading(undefined);
844
- },
845
- onModalClose: function onModalClose() {
846
- _this2.setOpenModalStatus('verifyEmail', false);
847
- _this2.clearPopupSuccess();
848
- _this2.clearPopupError();
849
- _this2.setIsActionLoading(undefined);
850
- },
851
- onResend: /*#__PURE__*/function () {
852
- var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(values) {
853
- var email;
854
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
855
- while (1) switch (_context8.prev = _context8.next) {
856
- case 0:
857
- _this2.clearPopupSuccess();
858
- _this2.clearPopupError();
859
- _this2.setIsActionLoading('resend');
860
- _context8.prev = 3;
861
- email = values === null || values === void 0 ? void 0 : values.email;
862
- _context8.next = 7;
863
- return resendActivationEmail(email);
864
- case 7:
865
- _this2.setPopupSuccess('resend', 'Email sent.');
866
- _this2.setIsActionLoading(undefined);
867
- _context8.next = 16;
868
- break;
869
- case 11:
870
- _context8.prev = 11;
871
- _context8.t0 = _context8["catch"](3);
872
- console.log(_context8.t0);
873
- _this2.setPopupError('resend', (_context8.t0 === null || _context8.t0 === void 0 ? void 0 : _context8.t0.message) || 'Something went wrong.');
874
- _this2.setIsActionLoading(undefined);
875
- case 16:
876
- case "end":
877
- return _context8.stop();
878
- }
879
- }, _callee8, null, [[3, 11]]);
880
- }));
881
- return function (_x6) {
882
- return _ref13.apply(this, arguments);
883
- };
884
- }()
885
- }));
886
- }
887
- }]);
888
- return HeaderHoClass;
889
- }(_react.Component);
652
+ }
653
+ }), /*#__PURE__*/_react.default.createElement(_ResetConfirmModal.default, {
654
+ isModalOpen: isModalOpen.confirmReset,
655
+ onModalClose: () => {
656
+ this.setOpenModalStatus('confirmReset', false);
657
+ },
658
+ onModalSwitch: () => {
659
+ const {
660
+ location
661
+ } = this.props;
662
+ const query = new URLSearchParams(location === null || location === void 0 ? void 0 : location.search);
663
+ let userType = query.get('user_type');
664
+ if (userType && userType === 'sa') {
665
+ window.open("https://backoffice.".concat(process.env.REACT_APP_WEBSITE_DOMAIN));
666
+ } else {
667
+ this.switchOpenModal('confirmReset', 'login');
668
+ }
669
+ }
670
+ }), !isVerifyingEmail && /*#__PURE__*/_react.default.createElement(_VerifyEmailModal.default, {
671
+ id: "verify-email-popup",
672
+ isActionLoading: isActionLoading,
673
+ popupError: this.state.popupError,
674
+ popupSuccess: this.state.popupSuccess,
675
+ isModalOpen: isModalOpen.verifyEmail,
676
+ continueUrl: "https://signup.".concat(process.env.REACT_APP_WEBSITE_DOMAIN, "/welcome"),
677
+ error: verifyEmailError,
678
+ isSuccess: !!!verifyEmailError,
679
+ onModalSwitch: () => {
680
+ this.switchOpenModal('verifyEmail', 'login');
681
+ this.clearPopupError();
682
+ this.setIsActionLoading(undefined);
683
+ },
684
+ onModalClose: () => {
685
+ this.setOpenModalStatus('verifyEmail', false);
686
+ this.clearPopupSuccess();
687
+ this.clearPopupError();
688
+ this.setIsActionLoading(undefined);
689
+ },
690
+ onResend: async values => {
691
+ this.clearPopupSuccess();
692
+ this.clearPopupError();
693
+ this.setIsActionLoading('resend');
694
+ try {
695
+ const email = values === null || values === void 0 ? void 0 : values.email;
696
+ await resendActivationEmail(email);
697
+ this.setPopupSuccess('resend', 'Email sent.');
698
+ this.setIsActionLoading(undefined);
699
+ } catch (error) {
700
+ console.log(error);
701
+ this.setPopupError('resend', (error === null || error === void 0 ? void 0 : error.message) || 'Something went wrong.');
702
+ this.setIsActionLoading(undefined);
703
+ }
704
+ }
705
+ }));
706
+ }
707
+ }
890
708
  _defineProperty(HeaderHoClass, "propTypes", {});
891
709
  _defineProperty(HeaderHoClass, "contextType", _AuthContext.AuthContext);
892
- var HeaderHo = (0, _withRouter.withRouter)((0, _customHooks.cooldownHOC)(HeaderHoClass, 90));
893
- exports.HeaderHo = HeaderHo;
894
- var _default = HeaderHo;
895
- exports.default = _default;
710
+ const HeaderHo = exports.HeaderHo = (0, _withRouter.withRouter)((0, _customHooks.cooldownHOC)(HeaderHoClass, 90));
711
+ var _default = exports.default = HeaderHo;