@alphapoint/apex-web 5.5.5 → 5.7.0

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 (402) hide show
  1. package/lib/App.js +30 -18
  2. package/lib/components/2FA/TwoFactorAuthContainer.js +58 -24
  3. package/lib/components/2FA/TwoFactorAuthContainer.test.js +215 -0
  4. package/lib/components/AccountsDropdown/AccountsDropdownComponent.css +6 -0
  5. package/lib/components/AccountsDropdown/AccountsDropdownComponent.js +6 -2
  6. package/lib/components/AccountsDropdown/AccountsDropdownComponent.test.js +43 -0
  7. package/lib/components/AccountsDropdown/AccountsDropdownContainer.js +3 -1
  8. package/lib/components/BalancesList/BalancesListContainer.js +4 -1
  9. package/lib/components/DepositSidePaneComponents/DepositFormComponent.js +2 -7
  10. package/lib/components/DigitalAssets/DigitalAssetsOfferingProfilePage.css +6 -3
  11. package/lib/components/DigitalAssets/DigitalAssetsOfferingProfilePage.js +2 -2
  12. package/lib/components/DigitalAssets/DigitalAssetsPage.js +1 -1
  13. package/lib/components/DigitalAssets/digitalAssetsPriceLabel.test.js +238 -0
  14. package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.js +7 -0
  15. package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.test.js +105 -0
  16. package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthContainerFactory.js +12 -1
  17. package/lib/components/FusionAuth/ConfirmPendingWithdrawModal.js +60 -0
  18. package/lib/components/FusionAuth/FusionAuthCallbackComponent.js +66 -0
  19. package/lib/components/FusionAuth/FusionAuthCallbackContainer.js +24 -0
  20. package/lib/components/FusionAuth/FusionStepUpModal.js +63 -0
  21. package/lib/components/FusionAuth/LinkOAuthIdentityModal.css +6 -0
  22. package/lib/components/FusionAuth/LinkOAuthIdentityModal.js +65 -0
  23. package/lib/components/FuturesOrderBook/FuturesOrderBookContainer.js +6 -0
  24. package/lib/components/InstrumentPositions/InstrumentPositionsContainer.js +4 -1
  25. package/lib/components/KYC/kycLevelsVerificationPropsHelper.test.js +7 -8
  26. package/lib/components/Login/LoginFormComponent.js +15 -4
  27. package/lib/components/Login/LoginFormContainer.js +21 -26
  28. package/lib/components/MarginBalances/MarginDepositWithdraw/MarginDepositModal/MarginDepositFormContainer.js +2 -1
  29. package/lib/components/NoAccountBanner/NoAccountBanner.css +9 -0
  30. package/lib/components/NoAccountBanner/NoAccountBanner.js +58 -0
  31. package/lib/components/NoAccountBanner/index.js +16 -0
  32. package/lib/components/NoAccountPlaceholder/NoAccountPlaceholder.css +31 -0
  33. package/lib/components/NoAccountPlaceholder/NoAccountPlaceholder.js +33 -0
  34. package/lib/components/NoAccountPlaceholder/index.js +9 -0
  35. package/lib/components/OrderBookComponents/Level2DataTableComponent.js +4 -0
  36. package/lib/components/OrderBookComponents/OrderBookComponent.css +1 -0
  37. package/lib/components/OrderBookComponents/OrderBookComponent.js +7 -2
  38. package/lib/components/OrderBookComponents/OrderBookContainer.js +3 -1
  39. package/lib/components/OrderEntryComponents/defaultForm/BuySellTabs.js +11 -5
  40. package/lib/components/OrderEntryComponents/defaultForm/OrderEntryAnchoring.js +19 -3
  41. package/lib/components/OrderHistoryComponents/OpenOrders/OpenOrdersComponent.js +1 -1
  42. package/lib/components/OrderHistoryComponents/OpenOrders/OpenOrdersComponent.test.js +97 -73
  43. package/lib/components/PriceChart/TVChartComponent.js +47 -2
  44. package/lib/components/PriceChart/TVChartContainer.js +2 -1
  45. package/lib/components/Retail/RetailSidePanes/FiatDeposit/FiatDepositFormComponent.js +2 -6
  46. package/lib/components/Retail/RetailSidePanes/FiatWithdraw/FiatWithdrawFormComponent.js +2 -6
  47. package/lib/components/SendReceiveSidePane/ReceiveAddress/ReceiveAddressComponent.js +2 -6
  48. package/lib/components/SendReceiveSidePane/SendAddress/SendAddressComponent.js +2 -7
  49. package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/ProfileFormComponent.js +3 -1
  50. package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/SsoLinkRowComponent.css +10 -0
  51. package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/SsoLinkRowComponent.js +77 -0
  52. package/lib/components/Settings/ProfileAndSecurity/TwoFactorAuthSettingsCard/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.js +12 -4
  53. package/lib/components/Settings/ProfileAndSecurity/TwoFactorAuthSettingsCard/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.test.js +246 -0
  54. package/lib/components/Signup/SignupFormComponent.js +10 -1
  55. package/lib/components/Theme/ThemeToggler/ThemeToggler.js +4 -1
  56. package/lib/components/WithdrawSidePaneComponents/WithdrawForm/WithdrawFormComponent.js +3 -8
  57. package/lib/components/common/APRecaptcha/APRecaptcha.css +33 -0
  58. package/lib/components/common/APRecaptcha/APRecaptcha.js +252 -0
  59. package/lib/components/common/APRecaptcha/index.js +22 -0
  60. package/lib/components/common/ErrorBoundary/ErrorBoundary.css +35 -0
  61. package/lib/components/common/ErrorBoundary/ErrorBoundary.js +87 -0
  62. package/lib/config/configDefault.json +9 -2
  63. package/lib/helpers/accountProviderHelper.js +28 -0
  64. package/lib/helpers/accountProviderHelper.test.js +67 -0
  65. package/lib/helpers/dateHelper.test.js +11 -5
  66. package/lib/helpers/destinationTagHelper.test.js +14 -5
  67. package/lib/helpers/errorTextFormatter.js +13 -4
  68. package/lib/helpers/errorTextFormatter.test.js +26 -0
  69. package/lib/helpers/formValidations.test.js +19 -3
  70. package/lib/helpers/fusionStepUp.js +79 -0
  71. package/lib/helpers/fusionStepUp.test.js +136 -0
  72. package/lib/helpers/homePageLayoutHelper.test.js +16 -2
  73. package/lib/helpers/numberFormatter/numberFormatter.js +3 -1
  74. package/lib/helpers/numberFormatter/numberFormatter.test.js +9 -2
  75. package/lib/helpers/orderHelper.test.js +59 -38
  76. package/lib/helpers/placeOrderHelper.js +9 -2
  77. package/lib/helpers/placeOrderHelper.test.js +43 -16
  78. package/lib/helpers/recalculateOrderHelper.test.js +49 -12
  79. package/lib/helpers/safeSessionStorage.js +36 -0
  80. package/lib/helpers/twoFactorAuthCancellation.js +38 -0
  81. package/lib/helpers/wsHelper.test.js +16 -7
  82. package/lib/hocs/forAccount.js +33 -0
  83. package/lib/hocs/forAccount.test.js +50 -0
  84. package/lib/hocs/forVerified.js +16 -2
  85. package/lib/hocs/withAuthentication.js +3 -1
  86. package/lib/index.js +3 -2
  87. package/lib/layouts/HeaderLayout/HeaderLayout.js +2 -1
  88. package/lib/layouts/WalletsLayout/WalletsLayoutContainer.js +3 -1
  89. package/lib/layouts/WalletsLayout/WalletsLayoutContainer.test.js +84 -0
  90. package/lib/redux/actions/affiliateActions.test.js +22 -27
  91. package/lib/redux/actions/apiActions.js +25 -8
  92. package/lib/redux/actions/apiActions.test.js +98 -0
  93. package/lib/redux/actions/apiKeyActions.test.js +29 -34
  94. package/lib/redux/actions/authActions.js +581 -48
  95. package/lib/redux/actions/authActions.test.js +140 -164
  96. package/lib/redux/actions/confirmWithdrawActions.js +7 -2
  97. package/lib/redux/actions/confirmWithdrawActions.test.js +83 -29
  98. package/lib/redux/actions/depositActions.test.js +267 -249
  99. package/lib/redux/actions/eotcActions.test.js +3 -0
  100. package/lib/redux/actions/eotcSettlementActions.test.js +3 -0
  101. package/lib/redux/actions/eotcWithdrawActions.test.js +3 -0
  102. package/lib/redux/actions/fusionAuthActions.test.js +717 -0
  103. package/lib/redux/actions/instrumentActions.test.js +560 -160
  104. package/lib/redux/actions/interestAccountActions.js +12 -3
  105. package/lib/{components/MarginBalances/MarginDepositWithdraw/MarginDepositWithdrawContainer.notest.js → redux/actions/interestAccountActions.test.js} +41 -51
  106. package/lib/redux/actions/kycIdentityMindActions.js +4 -4
  107. package/lib/redux/actions/kycIdentityMindActions.test.js +31 -13
  108. package/lib/redux/actions/kycJumioActions.test.js +16 -6
  109. package/lib/redux/actions/kycManualActions.test.js +16 -9
  110. package/lib/redux/actions/level1Actions.test.js +2 -2
  111. package/lib/redux/actions/level2Actions.test.js +51 -120
  112. package/lib/redux/actions/loyaltyFeeActions.test.js +19 -16
  113. package/lib/redux/actions/marketStateUpdateActions.test.js +2 -2
  114. package/lib/redux/actions/modalActions.js +3 -0
  115. package/lib/redux/actions/orderEntryActions.js +32 -5
  116. package/lib/redux/actions/orderEntryActions.test.js +104 -37
  117. package/lib/redux/actions/orderHistoryActions.js +11 -4
  118. package/lib/redux/actions/orderHistoryActions.test.js +94 -79
  119. package/lib/redux/actions/positionActions.test.js +19 -4
  120. package/lib/redux/actions/productActions.test.js +38 -21
  121. package/lib/redux/actions/recentTradesActions.test.js +2 -2
  122. package/lib/redux/actions/regionFormActions.test.js +25 -33
  123. package/lib/redux/actions/reportActions.test.js +16 -35
  124. package/lib/redux/actions/signupActions.js +18 -4
  125. package/lib/redux/actions/signupActions.test.js +146 -142
  126. package/lib/redux/actions/snackbarActions.test.js +4 -4
  127. package/lib/redux/actions/tickersActions.test.js +10 -4
  128. package/lib/redux/actions/transferActions.test.js +111 -93
  129. package/lib/redux/actions/transferRequestActions.test.js +42 -42
  130. package/lib/redux/actions/userActions.js +97 -34
  131. package/lib/redux/actions/userActions.test.js +663 -314
  132. package/lib/redux/actions/verifyEmailActions.test.js +13 -2
  133. package/lib/redux/actions/withdrawActions.js +143 -76
  134. package/lib/redux/actions/withdrawActions.test.js +369 -187
  135. package/lib/redux/actions/withdrawActions.travelRule.test.js +17 -3
  136. package/lib/redux/actions/wsConnectionActions.js +96 -1
  137. package/lib/redux/actions/wsConnectionActions.test.js +9 -8
  138. package/lib/redux/actions/wsConnectionLifecycle.test.js +207 -0
  139. package/lib/redux/futures/actions/futuresOrderFormActions.js +26 -2
  140. package/lib/redux/margin/actions/marginActions.test.js +163 -75
  141. package/lib/redux/margin/actions/marginHistoryActions.test.js +190 -151
  142. package/lib/redux/margin/reducers/marginHistoryReducer.test.js +146 -135
  143. package/lib/redux/margin/selectors/marginHistorySelectors.test.js +101 -102
  144. package/lib/redux/margin/selectors/marginOrderSelectors.test.js +2 -2
  145. package/lib/redux/middlewares/authMiddleware.test.js +142 -23
  146. package/lib/redux/middlewares/placeOrderMiddleware.test.js +18 -1
  147. package/lib/redux/middlewares/startupMiddleware.test.js +10 -34
  148. package/lib/redux/middlewares/wsConnectionMiddleware.test.js +6 -1
  149. package/lib/redux/reducers/apiProcessingReducer.test.js +4 -2
  150. package/lib/redux/reducers/authReducer.test.js +3 -3
  151. package/lib/redux/reducers/depositReducer.test.js +2 -1
  152. package/lib/redux/reducers/level2Reducer.test.js +2 -2
  153. package/lib/redux/reducers/orderHistoryReducer.js +1 -1
  154. package/lib/redux/reducers/orderHistoryReducer.test.js +63 -75
  155. package/lib/redux/reducers/positionReducer.test.js +1 -2
  156. package/lib/redux/reducers/resetPasswordReducer.test.js +1 -0
  157. package/lib/redux/reducers/snackbarReducer.test.js +12 -39
  158. package/lib/redux/reducers/tickersReducer.test.js +2 -2
  159. package/lib/redux/reducers/userReducer.js +10 -0
  160. package/lib/redux/reducers/userReducer.test.js +36 -1
  161. package/lib/redux/reducers/withdrawReducer.test.js +11 -5
  162. package/lib/redux/selectors/buySellSelectors.test.js +10 -6
  163. package/lib/redux/selectors/depositWithdrawalSelectors.js +6 -12
  164. package/lib/redux/selectors/instrumentPositionSelectors.test.js +58 -18
  165. package/lib/redux/selectors/level2Selectors.test.js +60 -33
  166. package/lib/redux/selectors/loyaltyTokenSelectors.test.js +15 -13
  167. package/lib/redux/selectors/marginHistorySelectors.test.js +11 -5
  168. package/lib/redux/selectors/openOrdersActivitySelector.test.js +4 -4
  169. package/lib/redux/selectors/orderHistorySelectors.test.js +141 -22
  170. package/lib/redux/selectors/orderTotalSelector.test.js +76 -30
  171. package/lib/redux/selectors/productPositionSelectors.test.js +2 -1
  172. package/lib/redux/selectors/recentActivitySelector.js +8 -2
  173. package/lib/redux/selectors/recentActivitySelector.v2.test.js +33 -0
  174. package/lib/redux/selectors/recentTradesSelectors.test.js +17 -0
  175. package/lib/redux/selectors/transfersTableSelectors.test.js +7 -1
  176. package/lib/redux/selectors/userSelectors.js +6 -1
  177. package/lib/redux/selectors/userSelectors.test.js +28 -0
  178. package/lib/services/subscriptions/accountPositionSubscriptionService.test.js +0 -14
  179. package/lib/services/subscriptions/orderStateSubscriptionService.test.js +0 -14
  180. package/lib/services/subscriptions/orderTradesSuscriptionService.test.js +0 -14
  181. package/lib/services/tradingView/ChartAPI.js +17 -2
  182. package/lib/setupTests.js +1 -10
  183. package/package.json +21 -5
  184. package/lib/components/APSnackbar/APSnackbarContainer.notest.js +0 -58
  185. package/lib/components/ActivityReportingComponents/ActivityReportingButtons/ActivityReportingButtonsComponent.notest.js +0 -27
  186. package/lib/components/ActivityReportingComponents/ActivityReportingButtons/ActivityReportingButtonsContainer.notest.js +0 -42
  187. package/lib/components/AffiliateComponents/AffiliateActiveTagComponent.notest.js +0 -36
  188. package/lib/components/AffiliateComponents/AffiliateActiveTagContainer.notest.js +0 -81
  189. package/lib/components/AffiliateComponents/AffiliateCountContainer.notest.js +0 -37
  190. package/lib/components/AffiliateComponents/AffiliateModal.notest.js +0 -41
  191. package/lib/components/AffiliateComponents/AffiliateModalContainer.notest.js +0 -79
  192. package/lib/components/ApiKeysSidePaneComponents/ApiKeyList/ApiKeyListContainer.notest.js +0 -40
  193. package/lib/components/ApiKeysSidePaneComponents/ApiKeysComponent/ApiKeysComponent.notest.js +0 -32
  194. package/lib/components/ApiKeysSidePaneComponents/ApiKeysForm/ApiKeysFormComponent.notest.js +0 -32
  195. package/lib/components/ApiKeysSidePaneComponents/ApiKeysForm/ApiKeysFormContainer.notest.js +0 -29
  196. package/lib/components/ApiKeysSidePaneComponents/ApiKeysSidePane/ApiKeySidePaneComponent.notest.js +0 -46
  197. package/lib/components/ApiKeysSidePaneComponents/CreateApiKey/CreateApiKeyComponent.notest.js +0 -50
  198. package/lib/components/ApiKeysSidePaneComponents/CreateApiKey/CreateApiKeyContainer.notest.js +0 -70
  199. package/lib/components/ApiKeysSidePaneComponents/NewApiKey/NewApiKeyModalContainer.notest.js +0 -102
  200. package/lib/components/ApiKeysSidePaneComponents/RemoveApiKeyModal/RemoveApiKeyModalContainer.notest.js +0 -53
  201. package/lib/components/BalancesList/BalancesListContainer.notest.js +0 -91
  202. package/lib/components/BalancesMenu/BalanceMenuContainer.notest.js +0 -49
  203. package/lib/components/BalancesMenu/BalancesMenuComponent.notest.js +0 -68
  204. package/lib/components/BalancesMenu/BalancesMenuItemComponent.notest.js +0 -28
  205. package/lib/components/ConfirmBlockTradeModal/ConfirmBlockTradeModalContainer.notest.js +0 -171
  206. package/lib/components/ConfirmLimitOrderModal/ConfirmLimitOrderModalContainer.notest.js +0 -179
  207. package/lib/components/ConfirmWithdraw/ConfirmWithdrawContainer.notest.js +0 -58
  208. package/lib/components/DepositConfirmation/DepositConfirmationModalContainer.notest.js +0 -59
  209. package/lib/components/DepositSidePaneComponents/DepositFormComponent.notest.js +0 -123
  210. package/lib/components/DepositSidePaneComponents/DepositFormContainer.notest.js +0 -174
  211. package/lib/components/DepositSidePaneComponents/DepositTemplateFormComponent.notest.js +0 -79
  212. package/lib/components/DepositSidePaneComponents/DepositTemplateFormContainer.notest.js +0 -66
  213. package/lib/components/DepositSidePaneComponents/DepositWorkflows/CryptoWalletDepositWorkflow/CryptoWalletDepositWorkflowComponent.notest.js +0 -42
  214. package/lib/components/DepositSidePaneComponents/DepositWorkflows/CryptoWalletDepositWorkflow/CryptoWalletDepositWorkflowContainer.notest.js +0 -52
  215. package/lib/components/DepositSidePaneComponents/DepositWorkflows/DepositWorkflowsComponent.notest.js +0 -52
  216. package/lib/components/DepositSidePaneComponents/DepositWorkflows/DepositWorkflowsContainer.notest.js +0 -49
  217. package/lib/components/DepositSidePaneComponents/DepositWorkflows/GenericPaymentWorkflow/GenericPaymentWorkflowComponent.notest.js +0 -96
  218. package/lib/components/DepositSidePaneComponents/DepositWorkflows/GenericPaymentWorkflow/GenericPaymentWorkflowContainer.notest.js +0 -49
  219. package/lib/components/DepositSidePaneComponents/DepositWorkflows/ManualDepositWorkflow/ManualDepositWorkflowComponent.notest.js +0 -68
  220. package/lib/components/DepositSidePaneComponents/DepositWorkflows/ManualDepositWorkflow/ManualDepositWorkflowContainer.notest.js +0 -60
  221. package/lib/components/DepositSidePaneComponents/DepositWorkflows/PaymentProcessors/Hyphen/HyphenDepositWorkflowContainer.notest.js +0 -66
  222. package/lib/components/DepthChart/DepthChartContainer.notest.js +0 -82
  223. package/lib/components/EnableTwoFactorAuth/Disable2FAModalContainer.notest.js +0 -73
  224. package/lib/components/EnableTwoFactorAuth/Enable2FAModalContainer.notest.js +0 -82
  225. package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthContainerFactory.notest.js +0 -50
  226. package/lib/components/EotcBalancesList/EotcBalancesListContainer.notest.js +0 -53
  227. package/lib/components/EotcProductCard/EotcProductCardContainer.notest.js +0 -87
  228. package/lib/components/EotcProductCard/EotcProductCardListContainer.notest.js +0 -55
  229. package/lib/components/EotcProductCardSimple/EotcProductCardSimpleContainer.notest.js +0 -136
  230. package/lib/components/EotcProductCardSimple/EotcProductCardSimpleListContainer.notest.js +0 -66
  231. package/lib/components/EotcWalletCard/EotcWalletCardContainer.notest.js +0 -148
  232. package/lib/components/EotcWalletCard/EotcWalletCardGridContainer.notest.js +0 -57
  233. package/lib/components/InstrumentPositions/InstrumentPositionsContainer.notest.js +0 -54
  234. package/lib/components/InstrumentPositionsWrapper/InstrumentPositionsWrapperContainer.notest.js +0 -46
  235. package/lib/components/InstrumentSelector/InstrumentSelectorContainer.notest.js +0 -112
  236. package/lib/components/InstrumentTable/InstrumentTableContainer.notest.js +0 -51
  237. package/lib/components/KYC/KYCBaseContainer.notest.js +0 -103
  238. package/lib/components/KYC/KYCLevel/KYCLevelComponent.notest.js +0 -94
  239. package/lib/components/KYCSettings/KYCSettingsContainer.notest.js +0 -49
  240. package/lib/components/KYCStatus/KYCStatusContainer.notest.js +0 -66
  241. package/lib/components/KYC_IM/KYC_IMForm/KYC_IMFormContainer.notest.js +0 -89
  242. package/lib/components/KYC_IM/KYC_IMForm/KYC_IMFormStepContainer.notest.js +0 -37
  243. package/lib/components/KYC_IM/KYC_IMLevelsContainer.notest.js +0 -47
  244. package/lib/components/KYC_IMLegacy/KYC_IMLegacyForm/KYC_IMLegacyFormContainer.notest.js +0 -152
  245. package/lib/components/KYC_IMLegacy/KYC_IMLegacyLevelsContainer.notest.js +0 -47
  246. package/lib/components/KYC_Jumio/KYC_JumioIframe/KYC_JumioIframeComponent.notest.js +0 -63
  247. package/lib/components/KYC_Jumio/KYC_JumioIframe/KYC_JumioIframeContainer.notest.js +0 -70
  248. package/lib/components/KYC_Jumio/KYC_JumioLevelsContainer.notest.js +0 -47
  249. package/lib/components/KYC_Manual/KYC_ManualForm/KYC_ManualFormContainer.notest.js +0 -102
  250. package/lib/components/KYC_Manual/KYC_ManualIframe/KYC_ManualIframeContainer.notest.js +0 -150
  251. package/lib/components/KYC_Manual/KYC_ManualLevelsContainer.notest.js +0 -47
  252. package/lib/components/Login/LoginFormComponent.notest.js +0 -84
  253. package/lib/components/Login/LoginFormContainer.notest.js +0 -111
  254. package/lib/components/LoyaltyToken/LoyaltyTokenContainer.notest.js +0 -57
  255. package/lib/components/MarginBalances/MarginDepositWithdraw/MarginDepositModal/MarginDepositFormContainer.notest.js +0 -87
  256. package/lib/components/MarginBalances/MarginOverview/MarginOverviewContainer.notest.js +0 -45
  257. package/lib/components/MarginTransferAssetModal/MarginTransferAssetsFormContainer.notest.js +0 -194
  258. package/lib/components/MarketDataCardsComponent/MarketDataCardsContainer.notest.js +0 -63
  259. package/lib/components/MenuItem/MenuItemComponent.notest.js +0 -39
  260. package/lib/components/OrderBookComponents/BulkCancelButtonsComponent/BulkCancelButtonsComponent.notest.js +0 -54
  261. package/lib/components/OrderBookComponents/Level2DataTableComponent.notest.js +0 -38
  262. package/lib/components/OrderBookComponents/OrderBookComponent.notest.js +0 -38
  263. package/lib/components/OrderBookComponents/OrderBookContainer.notest.js +0 -121
  264. package/lib/components/OrderHistoryComponents/DepositsStatus/DepositsStatusComponent.notest.js +0 -68
  265. package/lib/components/OrderHistoryComponents/FilledOrders/FilledOrdersComponent.notest.js +0 -156
  266. package/lib/components/OrderHistoryComponents/HeaderWithFilter/HeaderWithFilterContainer.notest.js +0 -58
  267. package/lib/components/OrderHistoryComponents/InactiveOrders/InactiveOrdersComponent.notest.js +0 -97
  268. package/lib/components/OrderHistoryComponents/MarginOpenPositions/MarginOpenPositionsComponent.notest.js +0 -93
  269. package/lib/components/OrderHistoryComponents/MarginOrderHistory/MarginOrderHistoryComponent.notest.js +0 -107
  270. package/lib/components/OrderHistoryComponents/MarginOrderHistoryExtended/MarginOrderHistoryExtendedComponent.notest.js +0 -118
  271. package/lib/components/OrderHistoryComponents/OpenOrders/OpenOrdersComponent.notest.js +0 -123
  272. package/lib/components/OrderHistoryComponents/OrderHistoryComponent.notest.js +0 -107
  273. package/lib/components/OrderHistoryComponents/PositionPayments/PositionPaymentsComponent.notest.js +0 -82
  274. package/lib/components/OrderHistoryComponents/TradeReports/TradeReportsComponent.notest.js +0 -124
  275. package/lib/components/OrderHistoryComponents/WithdrawStatus/WithdrawStatusComponent.notest.js +0 -69
  276. package/lib/components/PriceChart/ApexChartComponent.notest.js +0 -48
  277. package/lib/components/PriceChart/ApexChartContainer.notest.js +0 -75
  278. package/lib/components/PriceChart/PriceChartContainer.notest.js +0 -37
  279. package/lib/components/PriceChart/TVChartContainer.notest.js +0 -106
  280. package/lib/components/ProblemLoggingIn/ProblemLoggingInFormContainer.notest.js +0 -81
  281. package/lib/components/ProductPositionDetails/ProductPositionDetailsComponent.notest.js +0 -37
  282. package/lib/components/ProductPositionDetails/ProductPositionDetailsContainer.notest.js +0 -47
  283. package/lib/components/ProfileForm/ProfileFormComponent.notest.js +0 -51
  284. package/lib/components/ProfileForm/ProfileFormContainer.notest.js +0 -68
  285. package/lib/components/RecentActivity/RecentActivityContainer.notest.js +0 -41
  286. package/lib/components/RecentActivity/RecentActivityTable/RecentActivityTableContainer.notest.js +0 -43
  287. package/lib/components/RecentActivityWithFilter/RecentActivityHeaderWithFilter/RecentActivityHeaderForm/RecentActivityHeaderFormContainer.notest.js +0 -128
  288. package/lib/components/RecentActivityWithFilter/RecentActivityTableWithFilter/RecentActivityTableWithFilterContainer.notest.js +0 -64
  289. package/lib/components/RecentActivityWithFilter/RecentActivityWithFilterContainer.notest.js +0 -41
  290. package/lib/components/RecentTrades/RecentTradesComponent.notest.js +0 -78
  291. package/lib/components/RecentTrades/RecentTradesContainer.notest.js +0 -59
  292. package/lib/components/ReportBlockTradeSidePaneComponents/ReportBlockTradeContainer.notest.js +0 -169
  293. package/lib/components/ReportBlockTradeSidePaneComponents/ReportBlockTradeSidePaneContainer.notest.js +0 -107
  294. package/lib/components/ReportSidePaneComponents/ConfirmCyclicalReport/ConfirmCyclicalReportModalContainer.notest.js +0 -39
  295. package/lib/components/ReportSidePaneComponents/ConfirmSingleReport/ConfirmSingleReportModalContainer.notest.js +0 -39
  296. package/lib/components/ReportSidePaneComponents/CreateReportForm/CreateReportFormComponent.notest.js +0 -42
  297. package/lib/components/ReportSidePaneComponents/CreateReportForm/CreateReportFormContainer.notest.js +0 -85
  298. package/lib/components/ReportSidePaneComponents/DownloadReportForm/DownloadReportContainer.notest.js +0 -37
  299. package/lib/components/ReportSidePaneComponents/ReportSidePaneComponent.notest.js +0 -72
  300. package/lib/components/ReportSidePaneComponents/ScheduleReportForm/ScheduleReportFormComponent.notest.js +0 -43
  301. package/lib/components/ReportSidePaneComponents/ScheduleReportForm/ScheduleReportFormContainer.notest.js +0 -80
  302. package/lib/components/ReportSidePaneComponents/ScheduledReportsTable/ScheduledReportsTableComponent.notest.js +0 -34
  303. package/lib/components/ReportSidePaneComponents/ScheduledReportsTable/ScheduledReportsTableContainer.notest.js +0 -48
  304. package/lib/components/ResetPasswordForm/ResetPasswordFormContainer.notest.js +0 -105
  305. package/lib/components/ResetPasswordRequestForm/ResetPasswordRequestFormComponent.notest.js +0 -39
  306. package/lib/components/ResetPasswordRequestForm/ResetPasswordRequestFormContainerFactory.notest.js +0 -47
  307. package/lib/components/Retail/RetailBuySell/BuySell/BuySellContainer.notest.js +0 -105
  308. package/lib/components/Retail/RetailBuySell/BuySell/BuySellCustomRow/BuySellCustomRowContainer.notest.js +0 -145
  309. package/lib/components/Retail/RetailBuySell/BuySell/BuySellInstrumentSelector/BuySellInstrumentSelectorContainer.notest.js +0 -113
  310. package/lib/components/Retail/RetailBuySell/BuySell/BuySellOrderButton/BuySellOrderButtonContainer.notest.js +0 -66
  311. package/lib/components/Retail/RetailBuySell/BuySell/BuySellPresetValuesRows/BuySellPresetValuesRowsContainer.notest.js +0 -125
  312. package/lib/components/Retail/RetailBuySell/BuySell/BuySellTabs/BuySellTabsContainer.notest.js +0 -115
  313. package/lib/components/Retail/RetailBuySell/BuySellBalances/BuySellBalancesContainer.notest.js +0 -126
  314. package/lib/components/Retail/RetailBuySell/BuySellChartIntervalSelector/BuySellChartIntervalSelectorContainer.notest.js +0 -36
  315. package/lib/components/Retail/RetailBuySell/BuySellChartOverview/BuySellChartOverviewContainer.notest.js +0 -43
  316. package/lib/components/Retail/RetailBuySell/BuySellInstrumentSelect/BuySellInstrumentSelectContainer.notest.js +0 -153
  317. package/lib/components/Retail/RetailBuySell/BuySellOrderConfirmationModal/BuySellConfirmationModalContainer.notest.js +0 -262
  318. package/lib/components/Retail/RetailBuySell/BuySellOrderOverview/BuySellOrderOverviewContainer.notest.js +0 -124
  319. package/lib/components/Retail/RetailBuySell/EotcBuySell/EotcBuySellContainer.notest.js +0 -125
  320. package/lib/components/Retail/RetailBuySell/EotcBuySell/EotcBuySellCustomRow/EotcBuySellCustomRowContainer.notest.js +0 -143
  321. package/lib/components/Retail/RetailBuySell/EotcBuySell/EotcBuySellPresetValuesRows/EotcBuySellPresetValuesRowsContainer.notest.js +0 -125
  322. package/lib/components/Retail/RetailBuySell/EotcBuySellChartOverviewContainer/BuySellChartOverviewContainer.notest.js +0 -43
  323. package/lib/components/Retail/RetailBuySell/EotcBuySellOrderConfirmationModal/EotcBuySellConfirmationModalContainer.notest.js +0 -262
  324. package/lib/components/Retail/RetailSidePanes/FiatDeposit/DepositReferenceIdModalContainer.notest.js +0 -45
  325. package/lib/components/Retail/RetailSidePanes/FiatDeposit/FiatDepositFormContainer.notest.js +0 -137
  326. package/lib/components/Retail/RetailSidePanes/FiatDeposit/FiatDepositModalContainer.notest.js +0 -82
  327. package/lib/components/Retail/RetailSidePanes/FiatFormTabsComponent.notest.js +0 -49
  328. package/lib/components/Retail/RetailSidePanes/FiatSidePaneContainer.notest.js +0 -62
  329. package/lib/components/Retail/RetailSidePanes/FiatWithdraw/BankSelect/BankSelectContainer.notest.js +0 -80
  330. package/lib/components/Retail/RetailSidePanes/FiatWithdraw/FiatWithdrawFormContainer.notest.js +0 -124
  331. package/lib/components/Retail/RetailSidePanes/FiatWithdraw/FiatWithdrawModalContainer.notest.js +0 -46
  332. package/lib/components/SendReceiveSidePane/Receive/ReceiveContainer.notest.js +0 -69
  333. package/lib/components/SendReceiveSidePane/ReceiveAddress/ReceiveAddressContainer.notest.js +0 -73
  334. package/lib/components/SendReceiveSidePane/ReceiveForm/ReceiveFormContainer.notest.js +0 -54
  335. package/lib/components/SendReceiveSidePane/SendAddress/SendAddressContainer.notest.js +0 -71
  336. package/lib/components/SendReceiveSidePane/SendForm/SendFormContainer.notest.js +0 -72
  337. package/lib/components/SendReceiveSidePane/SendReceiveSidePaneContainer.notest.js +0 -139
  338. package/lib/components/SendReceiveSidePane/SendReceiveTwoFactorAuth/SendReceiveTwoFactorAuthContainer.notest.js +0 -102
  339. package/lib/components/Settings/ApiKeys/ApiKeysSidePaneButton/ApiKeysSidePaneButtonContainer.notest.js +0 -31
  340. package/lib/components/Settings/DemoSettings/DemoSettingsContainer.notest.js +0 -46
  341. package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/ProfileFormContainer.notest.js +0 -69
  342. package/lib/components/Settings/ProfileAndSecurity/RegionSettingsCard/RegionSettings/RegionSettingsContainer.notest.js +0 -86
  343. package/lib/components/Settings/ProfileAndSecurity/ThemeSettingsCard/ThemeForm/ThemeSettingsContainer.notest.js +0 -45
  344. package/lib/components/Settings/TradeSettings/MarginTrading/EnableMarginModal/EnableMarginConfirmationModalComponent.notest.js +0 -47
  345. package/lib/components/Settings/TradeSettings/MarginTrading/EnableMarginModal/EnableMarginConfirmationModalContainer.notest.js +0 -112
  346. package/lib/components/Settings/TradeSettings/MarginTrading/MarginTradingComponent.notest.js +0 -33
  347. package/lib/components/Settings/TradeSettings/MarginTrading/MarginTradingContainer.notest.js +0 -54
  348. package/lib/components/Settings/TransferHistory/TransferHistoryContainer.notest.js +0 -42
  349. package/lib/components/Signup/SignupFormComponent.notest.js +0 -92
  350. package/lib/components/Signup/SignupFormContainer.notest.js +0 -124
  351. package/lib/components/StandaloneKYC/StandaloneKYCContainer.notest.js +0 -75
  352. package/lib/components/StandaloneModal/StandaloneModalComponent.notest.js +0 -69
  353. package/lib/components/Ticker/TickerContainer.notest.js +0 -57
  354. package/lib/components/Transfers/TransfersContainer.notest.js +0 -99
  355. package/lib/components/Transfers/TransfersFilters/TransfersFiltersContainer.notest.js +0 -81
  356. package/lib/components/TwoFactorAuthForm/TwoFactorAuthFormContainer.notest.js +0 -60
  357. package/lib/components/UserBalance/UserBalanceContainer.notest.js +0 -47
  358. package/lib/components/UserSettings/UserSettingsComponent.notest.js +0 -55
  359. package/lib/components/UserSummary/UserSummaryContainer.notest.js +0 -65
  360. package/lib/components/VerificationRequired/VerificationRequiredContainer.notest.js +0 -47
  361. package/lib/components/VerifyEmail/VerifyEmailContainer.notest.js +0 -46
  362. package/lib/components/WalletCards/WalletCardContainer.notest.js +0 -77
  363. package/lib/components/WalletCards/WalletCardGridContainer.notest.js +0 -42
  364. package/lib/components/WalletDetails/WalletDetailsContainer.notest.js +0 -61
  365. package/lib/components/WalletNavItems/CryptoNavItemsContainer.notest.js +0 -46
  366. package/lib/components/WalletNavItems/EotcCryptoNavItemsContainer.notest.js +0 -64
  367. package/lib/components/WalletNavItems/FiatNavItemsComponent.notest.js +0 -59
  368. package/lib/components/WalletNavItems/FiatNavItemsContainer.notest.js +0 -66
  369. package/lib/components/WalletRows/WalletRowContainer.notest.js +0 -76
  370. package/lib/components/WalletRows/WalletRowListContainer.notest.js +0 -43
  371. package/lib/components/WithdrawSidePaneComponents/PaymentProcessors/HyphenWithdrawWorkflowContainer.notest.js +0 -51
  372. package/lib/components/WithdrawSidePaneComponents/PaymentProcessors/TrustpayWithdrawWorkflowContainer.notest.js +0 -36
  373. package/lib/components/WithdrawSidePaneComponents/WithdrawForm/WithdrawFormComponent.notest.js +0 -131
  374. package/lib/components/WithdrawSidePaneComponents/WithdrawForm/WithdrawFormContainer.notest.js +0 -140
  375. package/lib/components/WithdrawSidePaneComponents/WithdrawTemplateForm/WithdrawTemplateFormComponent.notest.js +0 -38
  376. package/lib/components/WithdrawSidePaneComponents/WithdrawTemplateForm/WithdrawTemplateFormContainer.notest.js +0 -95
  377. package/lib/components/WithdrawSidePaneComponents/WithdrawWorkflows/WithdrawWorkflowsContainer.notest.js +0 -42
  378. package/lib/components/common/APDatePicker/APDatePicker.notest.js +0 -194
  379. package/lib/components/common/APLabelWithText/APLabelWithText.notest.js +0 -25
  380. package/lib/components/common/APNumberInput.notest.js +0 -173
  381. package/lib/components/common/APRadioTab/APRadioTab.notest.js +0 -69
  382. package/lib/components/common/APSegmentedButton/APSegmentedButton.notest.js +0 -55
  383. package/lib/components/common/APSnackbar/APSnackbar.notest.js +0 -107
  384. package/lib/components/common/APVerticalScroller/APVerticalScroller.notest.js +0 -172
  385. package/lib/components/common/Modal/Modal.notest.js +0 -55
  386. package/lib/components/common/Pagination/PaginationComponent.notest.js +0 -137
  387. package/lib/components/common/Pagination/PaginationContainer.notest.js +0 -47
  388. package/lib/components/common/Popover/Popover.notest.js +0 -137
  389. package/lib/components/common/ProductIcon/ProductIcon.notest.js +0 -76
  390. package/lib/components/common/ProductIcon/ProductIconContainer.notest.js +0 -38
  391. package/lib/components/common/SidePane/SidePaneComponent.notest.js +0 -48
  392. package/lib/components/common/SidePane/SidePaneContainer.notest.js +0 -54
  393. package/lib/components/common/Snackbar/Snackbar.notest.js +0 -51
  394. package/lib/components/common/Tab/Tab.notest.js +0 -68
  395. package/lib/helpers/formGeneratorHelper.notest.js +0 -203
  396. package/lib/helpers/formTemplateHelper.notest.js +0 -170
  397. package/lib/hocs/modalDecorator.notest.js +0 -74
  398. package/lib/hocs/redirectIfAuthorized.notest.js +0 -80
  399. package/lib/hocs/resize.notest.js +0 -37
  400. package/lib/layouts/HomePageLayout.notest.js +0 -65
  401. package/lib/redux/actions/languageActions.test.js +0 -105
  402. package/lib/redux/selectors/recentActivitySelector.test.js +0 -725
@@ -4,13 +4,25 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.validateSessionToken = exports.subscribeToLogoutEvent = exports.setUserNotAuthenticated = exports.sendTwoFactorAuthCode = exports.require2FA = exports.redirectFromLogin = exports.mark2FAReconnection = exports.logout = exports.login = exports.enforceEnable2FA = exports.authSuccess = exports.authError = exports.FORCED_LOGOUT = exports.ENABLE_2FA_REQUIRED = exports.AUTH_SUCCESS = exports.AUTH_REDIRECT = exports.AUTH_NONE = exports.AUTH_ERROR = exports.AUTH_2FA_REQUIRED = void 0;
7
+ exports.validateSessionToken = exports.takeFusionAuthFlow = exports.subscribeToLogoutEvent = exports.startFusionAuthPopupStepUp = exports.startFusionAuthPopupLink = exports.startFusionAuthLogin = exports.setUserNotAuthenticated = exports.sendTwoFactorAuthCode = exports.require2FA = exports.redirectFromLogin = exports.mark2FAReconnection = exports.logout = exports.login = exports.fusionAuthRedirectUri = exports.enforceEnable2FA = exports.completeOAuthIdentityLink = exports.completeFusionAuthLogin = exports.completeFusionAuthCallback = exports.clearFusionAuthSessionKeys = exports.authSuccess = exports.authError = exports.FUSIONAUTH_POPUP_NAME = exports.FUSIONAUTH_POPUP_MESSAGE = exports.FORCED_LOGOUT = exports.ENABLE_2FA_REQUIRED = exports.AUTH_SUCCESS = exports.AUTH_REDIRECT = exports.AUTH_NONE = exports.AUTH_ERROR = exports.AUTH_2FA_REQUIRED = void 0;
8
8
  var _apex = _interopRequireDefault(require("../../apex"));
9
9
  var _config = _interopRequireDefault(require("../../config"));
10
+ var _path = _interopRequireDefault(require("../../helpers/path"));
10
11
  var _reduxForm = require("redux-form");
11
12
  var _LogoutEventSubscriptionService = _interopRequireDefault(require("../../services/subscriptions/LogoutEventSubscriptionService"));
12
13
  var _userActions = require("./userActions");
14
+ var _snackbarActions = require("./snackbarActions");
15
+ var _modalActions = require("./modalActions");
16
+ var _wsConnectionActions = require("./wsConnectionActions");
17
+ var _fusionStepUp = require("../../helpers/fusionStepUp");
18
+ var _safeSessionStorage = require("../../helpers/safeSessionStorage");
13
19
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
20
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
21
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
22
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
23
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
24
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
25
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
14
26
  function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
15
27
  function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
16
28
  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; }
@@ -213,139 +225,660 @@ var redirectFromLogin = exports.redirectFromLogin = function redirectFromLogin(l
213
225
  }
214
226
  };
215
227
  };
228
+
229
+ // --- FusionAuth SSO (OAuth2 authorization-code + PKCE) ---
230
+ // State and PKCE verifier live in sessionStorage across the hosted-login round trip; the code is
231
+ // exchanged server-side by the generic OAuthAuthenticateUser endpoint (OAuthType=Fusion).
232
+ // The hosted pages cannot be embedded (X-Frame-Options: DENY), so flows are either a full-page
233
+ // redirect or a popup whose OPENER performs the exchange - the gateway mints the session on the
234
+ // connection that calls the endpoint.
235
+
236
+ var FUSIONAUTH_STATE_KEY = 'fusionAuthState';
237
+ var FUSIONAUTH_VERIFIER_KEY = 'fusionAuthCodeVerifier';
238
+
239
+ // Which flow left for the hosted pages. Registration does NOT continue into a session: the
240
+ // user returns to the login page and the code expires unexchanged.
241
+ var FUSIONAUTH_FLOW_KEY = 'fusionAuthFlow';
242
+
243
+ // The accessors below are the only things that touch those three keys, so no caller manipulates
244
+ // them directly and none of them can throw at a caller: a browser storage policy that denies
245
+ // access throws on the accessor itself, and the callback route reads the flow marker from its
246
+ // mount path, where an uncaught SecurityError would leave a blank page.
247
+
248
+ /** Records which flow left for the hosted pages; a falsy `flow` clears the marker. */
249
+ var setFusionAuthFlow = function setFusionAuthFlow(flow) {
250
+ if (flow) {
251
+ (0, _safeSessionStorage.writeSessionItem)(FUSIONAUTH_FLOW_KEY, flow);
252
+ } else {
253
+ (0, _safeSessionStorage.removeSessionItem)(FUSIONAUTH_FLOW_KEY);
254
+ }
255
+ };
256
+
257
+ /** Reads AND clears the flow marker. */
258
+ var takeFusionAuthFlow = exports.takeFusionAuthFlow = function takeFusionAuthFlow() {
259
+ var flow = (0, _safeSessionStorage.readSessionItem)(FUSIONAUTH_FLOW_KEY);
260
+ (0, _safeSessionStorage.removeSessionItem)(FUSIONAUTH_FLOW_KEY);
261
+ return flow;
262
+ };
263
+ var clearFusionAuthSessionKeys = exports.clearFusionAuthSessionKeys = function clearFusionAuthSessionKeys() {
264
+ (0, _safeSessionStorage.removeSessionItem)(FUSIONAUTH_STATE_KEY);
265
+ (0, _safeSessionStorage.removeSessionItem)(FUSIONAUTH_VERIFIER_KEY);
266
+ };
267
+
268
+ /** Reads AND clears the state/verifier pair, so neither can be replayed after a failed check. */
269
+ var takeFusionAuthPkce = function takeFusionAuthPkce() {
270
+ var pkce = {
271
+ expectedState: (0, _safeSessionStorage.readSessionItem)(FUSIONAUTH_STATE_KEY),
272
+ codeVerifier: (0, _safeSessionStorage.readSessionItem)(FUSIONAUTH_VERIFIER_KEY)
273
+ };
274
+ clearFusionAuthSessionKeys();
275
+ return pkce;
276
+ };
277
+
278
+ // window.name survives navigation, so the callback page can tell "I am the SSO popup"
279
+ // apart from a login page someone opened in a new tab (which also has window.opener)
280
+ var FUSIONAUTH_POPUP_NAME = exports.FUSIONAUTH_POPUP_NAME = 'apexFusionAuthLogin';
281
+ var FUSIONAUTH_POPUP_MESSAGE = exports.FUSIONAUTH_POPUP_MESSAGE = 'fusionauth:callback';
282
+ var base64UrlEncode = function base64UrlEncode(buffer) {
283
+ return btoa(String.fromCharCode.apply(String, _toConsumableArray(new Uint8Array(buffer)))).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
284
+ };
285
+ var randomUrlSafeString = function randomUrlSafeString() {
286
+ var bytes = new Uint8Array(32);
287
+ window.crypto.getRandomValues(bytes);
288
+ return base64UrlEncode(bytes);
289
+ };
290
+ var computeCodeChallenge = /*#__PURE__*/function () {
291
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(verifier) {
292
+ var digest;
293
+ return _regenerator().w(function (_context3) {
294
+ while (1) switch (_context3.n) {
295
+ case 0:
296
+ _context3.n = 1;
297
+ return window.crypto.subtle.digest('SHA-256', new TextEncoder().encode(verifier));
298
+ case 1:
299
+ digest = _context3.v;
300
+ return _context3.a(2, base64UrlEncode(digest));
301
+ }
302
+ }, _callee3);
303
+ }));
304
+ return function computeCodeChallenge(_x3) {
305
+ return _ref3.apply(this, arguments);
306
+ };
307
+ }();
308
+ var fusionAuthRedirectUri = exports.fusionAuthRedirectUri = function fusionAuthRedirectUri() {
309
+ return "".concat(window.location.origin).concat((0, _path["default"])(_config["default"].FusionAuth.redirectPath));
310
+ };
311
+
312
+ /// Fresh state + PKCE, stored for completion; returns the hosted-page URL (/oauth2/authorize or
313
+ /// /oauth2/register), or null when WebCrypto is unavailable (needs HTTPS or localhost) or the
314
+ /// browser refuses to store them.
315
+ var prepareFusionAuthAuthorizeUrl = /*#__PURE__*/function () {
316
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(dispatch) {
317
+ var oauthPath,
318
+ forceReauth,
319
+ state,
320
+ verifier,
321
+ challenge,
322
+ params,
323
+ _args4 = arguments;
324
+ return _regenerator().w(function (_context4) {
325
+ while (1) switch (_context4.n) {
326
+ case 0:
327
+ oauthPath = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : '/oauth2/authorize';
328
+ forceReauth = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : false;
329
+ if (!(!window.crypto || !window.crypto.subtle)) {
330
+ _context4.n = 1;
331
+ break;
332
+ }
333
+ dispatch(authError({
334
+ Authenticated: false,
335
+ errormsg: 'Sign-in requires a secure (HTTPS) connection.'
336
+ }));
337
+ return _context4.a(2, null);
338
+ case 1:
339
+ state = randomUrlSafeString();
340
+ verifier = randomUrlSafeString();
341
+ _context4.n = 2;
342
+ return computeCodeChallenge(verifier);
343
+ case 2:
344
+ challenge = _context4.v;
345
+ if (!(!(0, _safeSessionStorage.writeSessionItem)(FUSIONAUTH_STATE_KEY, state) || !(0, _safeSessionStorage.writeSessionItem)(FUSIONAUTH_VERIFIER_KEY, verifier))) {
346
+ _context4.n = 3;
347
+ break;
348
+ }
349
+ clearFusionAuthSessionKeys();
350
+ dispatch(authError({
351
+ Authenticated: false,
352
+ errormsg: 'Sign-in requires browser storage. Please allow cookies and site data, then try again.'
353
+ }));
354
+ return _context4.a(2, null);
355
+ case 3:
356
+ params = new URLSearchParams({
357
+ client_id: _config["default"].FusionAuth.clientId,
358
+ response_type: 'code',
359
+ redirect_uri: fusionAuthRedirectUri(),
360
+ scope: 'openid email profile offline_access',
361
+ state: state,
362
+ code_challenge: challenge,
363
+ code_challenge_method: 'S256'
364
+ });
365
+ if (forceReauth) {
366
+ // force full re-authentication even with a live FusionAuth SSO cookie
367
+ params.set('prompt', 'login');
368
+ params.set('max_age', '0');
369
+ }
370
+ return _context4.a(2, "".concat(_config["default"].FusionAuth.baseUrl).concat(oauthPath, "?").concat(params.toString()));
371
+ }
372
+ }, _callee4);
373
+ }));
374
+ return function prepareFusionAuthAuthorizeUrl(_x4) {
375
+ return _ref4.apply(this, arguments);
376
+ };
377
+ }();
378
+
379
+ /// Full-page redirect to a hosted page. `flow` marks which leg left so the callback can tell a
380
+ /// registration return (which must not mint a session) from a login return; null also clears a
381
+ /// marker an abandoned signup left behind, which would otherwise bounce this login's callback
382
+ /// back to the login page without a session.
383
+ var startFusionAuthRedirectFlow = function startFusionAuthRedirectFlow(oauthPath, flow) {
384
+ return /*#__PURE__*/function () {
385
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(dispatch) {
386
+ var url;
387
+ return _regenerator().w(function (_context5) {
388
+ while (1) switch (_context5.n) {
389
+ case 0:
390
+ _context5.n = 1;
391
+ return prepareFusionAuthAuthorizeUrl(dispatch, oauthPath);
392
+ case 1:
393
+ url = _context5.v;
394
+ if (url) {
395
+ setFusionAuthFlow(flow);
396
+ window.location.assign(url);
397
+ }
398
+ case 2:
399
+ return _context5.a(2);
400
+ }
401
+ }, _callee5);
402
+ }));
403
+ return function (_x5) {
404
+ return _ref5.apply(this, arguments);
405
+ };
406
+ }();
407
+ };
408
+ var startFusionAuthLogin = exports.startFusionAuthLogin = function startFusionAuthLogin() {
409
+ return startFusionAuthRedirectFlow('/oauth2/authorize', null);
410
+ };
411
+
412
+ /// Hosted page in a popup; onCallbackParams gets { code, state, error, errorDescription } and the
413
+ /// caller completes on this window. Closing the popup is a cancel.
414
+ ///
415
+ /// redirectFallback says what to do when the popup is blocked anyway: 'redirect' navigates this
416
+ /// window to the hosted page (the callback route then completes a LOGIN), 'none' reports it and
417
+ /// leaves the page alone. Flows that are not logins must pass 'none' — see startFusionAuthPopupLink.
418
+ var startFusionAuthPopupFlow = function startFusionAuthPopupFlow(oauthPath, onCallbackParams) {
419
+ var _ref6 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
420
+ _ref6$forceReauth = _ref6.forceReauth,
421
+ forceReauth = _ref6$forceReauth === void 0 ? false : _ref6$forceReauth,
422
+ _ref6$redirectFallbac = _ref6.redirectFallback,
423
+ redirectFallback = _ref6$redirectFallbac === void 0 ? 'redirect' : _ref6$redirectFallbac;
424
+ return /*#__PURE__*/function () {
425
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(dispatch) {
426
+ var width, height, left, top, popup, url;
427
+ return _regenerator().w(function (_context6) {
428
+ while (1) switch (_context6.n) {
429
+ case 0:
430
+ // no popup flow is a registration, so clear any marker an abandoned signup left behind
431
+ setFusionAuthFlow(null);
432
+ width = 480;
433
+ height = 720;
434
+ left = Math.max(0, window.screenX + (window.outerWidth - width) / 2);
435
+ top = Math.max(0, window.screenY + (window.outerHeight - height) / 2); // Opened blank BEFORE the PKCE challenge is awaited, then navigated below: Safari only
436
+ // honours window.open while the click's user activation is still live, and an await ends it.
437
+ popup = window.open('', FUSIONAUTH_POPUP_NAME, "popup=yes,width=".concat(width, ",height=").concat(height, ",left=").concat(left, ",top=").concat(top));
438
+ _context6.n = 1;
439
+ return prepareFusionAuthAuthorizeUrl(dispatch, oauthPath, forceReauth);
440
+ case 1:
441
+ url = _context6.v;
442
+ if (url) {
443
+ _context6.n = 2;
444
+ break;
445
+ }
446
+ if (popup) {
447
+ popup.close();
448
+ }
449
+ return _context6.a(2);
450
+ case 2:
451
+ if (popup) {
452
+ _context6.n = 4;
453
+ break;
454
+ }
455
+ if (!(redirectFallback === 'none')) {
456
+ _context6.n = 3;
457
+ break;
458
+ }
459
+ clearFusionAuthSessionKeys();
460
+ dispatch((0, _snackbarActions.showSnack)({
461
+ id: 'fusionAuthPopupBlockedSnack',
462
+ // t("Please allow pop-ups for this site and try again.")
463
+ text: 'Please allow pop-ups for this site and try again.',
464
+ type: 'warning'
465
+ }));
466
+ return _context6.a(2);
467
+ case 3:
468
+ // popup blocked — the state/verifier just stored still apply to the redirect flow
469
+ window.location.assign(url);
470
+ return _context6.a(2);
471
+ case 4:
472
+ popup.location.replace(url);
473
+ _context6.n = 5;
474
+ return new Promise(function (resolve) {
475
+ var closeWatcher;
476
+ var finish = function finish(handler) {
477
+ window.removeEventListener('message', onMessage);
478
+ clearInterval(closeWatcher);
479
+ handler();
480
+ resolve();
481
+ };
482
+ var onMessage = function onMessage(event) {
483
+ if (event.origin !== window.location.origin) {
484
+ return;
485
+ }
486
+ if (!event.data || event.data.type !== FUSIONAUTH_POPUP_MESSAGE) {
487
+ return;
488
+ }
489
+ var _event$data = event.data,
490
+ code = _event$data.code,
491
+ state = _event$data.state,
492
+ error = _event$data.error,
493
+ errorDescription = _event$data.errorDescription;
494
+ finish(function () {
495
+ try {
496
+ popup.close();
497
+ } catch (e) {
498
+ // the popup may already be closing itself; nothing to do
499
+ }
500
+ onCallbackParams({
501
+ code: code,
502
+ state: state,
503
+ error: error,
504
+ errorDescription: errorDescription
505
+ });
506
+ });
507
+ };
508
+ window.addEventListener('message', onMessage);
509
+
510
+ // no close event crosses window boundaries, so poll; user closing the hosted login
511
+ // is a deliberate cancel, not an error worth flashing on the page behind it
512
+ closeWatcher = setInterval(function () {
513
+ if (popup.closed) {
514
+ finish(clearFusionAuthSessionKeys);
515
+ }
516
+ }, 500);
517
+ });
518
+ case 5:
519
+ return _context6.a(2);
520
+ }
521
+ }, _callee6);
522
+ }));
523
+ return function (_x6) {
524
+ return _ref7.apply(this, arguments);
525
+ };
526
+ }();
527
+ };
528
+
529
+ /// Step-up in a popup (prompt=login, max_age=0) so page state survives; the code lands on this
530
+ /// window's connection, the session being re-validated. Full-page fallback when blocked is safe
531
+ /// here: the callback route completes a login, and the stashed action resumes on return.
532
+ var startFusionAuthPopupStepUp = exports.startFusionAuthPopupStepUp = function startFusionAuthPopupStepUp(onCallbackParams) {
533
+ return startFusionAuthPopupFlow('/oauth2/authorize', onCallbackParams, {
534
+ forceReauth: true
535
+ });
536
+ };
537
+
538
+ /// Opt-in SSO link for a signed-in user: forced re-authentication popup whose code the opener
539
+ /// hands to LinkOAuthIdentity; that endpoint ends every session, so completion signs out too.
540
+ ///
541
+ /// No redirect fallback: the callback route only ever completes a LOGIN, so falling back would
542
+ /// spend the code on OAuthAuthenticateUser and silently sign the user in instead of linking.
543
+ var startFusionAuthPopupLink = exports.startFusionAuthPopupLink = function startFusionAuthPopupLink(onCallbackParams) {
544
+ return startFusionAuthPopupFlow('/oauth2/authorize', onCallbackParams, {
545
+ forceReauth: true,
546
+ redirectFallback: 'none'
547
+ });
548
+ };
549
+
550
+ // A provider error_description is unauthenticated text off the callback URL - anyone can hand a
551
+ // user a callback link carrying arbitrary copy, and it renders as this site's own message - so it
552
+ // is logged for diagnosis and never shown.
553
+ var logOAuthError = function logOAuthError(context, error, errorDescription) {
554
+ return console.warn("[FusionAuth] ".concat(context, " returned an OAuth error:"), error, errorDescription);
555
+ };
556
+ var completeFusionAuthLogin = exports.completeFusionAuthLogin = function completeFusionAuthLogin(code, returnedState) {
557
+ return /*#__PURE__*/function () {
558
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(dispatch) {
559
+ var _takeFusionAuthPkce, expectedState, codeVerifier, res, auth, _t;
560
+ return _regenerator().w(function (_context7) {
561
+ while (1) switch (_context7.p = _context7.n) {
562
+ case 0:
563
+ _takeFusionAuthPkce = takeFusionAuthPkce(), expectedState = _takeFusionAuthPkce.expectedState, codeVerifier = _takeFusionAuthPkce.codeVerifier;
564
+ if (!(!code || !codeVerifier || !expectedState || returnedState !== expectedState)) {
565
+ _context7.n = 1;
566
+ break;
567
+ }
568
+ return _context7.a(2, dispatch(authError({
569
+ Authenticated: false,
570
+ errormsg: 'Sign-in could not be completed. Please try again.'
571
+ })));
572
+ case 1:
573
+ _context7.p = 1;
574
+ _context7.n = 2;
575
+ return _apex["default"].connection.RPCPromise('OAuthAuthenticateUser', {
576
+ AccessCode: code,
577
+ CodeVerifier: codeVerifier,
578
+ RedirectUrl: fusionAuthRedirectUri()
579
+ });
580
+ case 2:
581
+ res = _context7.v;
582
+ auth = JSON.parse(res.o);
583
+ if (!auth.Authenticated) {
584
+ _context7.n = 3;
585
+ break;
586
+ }
587
+ return _context7.a(2, dispatch(authSuccess(auth)));
588
+ case 3:
589
+ return _context7.a(2, dispatch(authError(_objectSpread(_objectSpread({}, auth), {}, {
590
+ Authenticated: false,
591
+ errormsg: auth.errormsg || auth.Errormsg || 'Sign-in could not be completed. Please try again.'
592
+ }))));
593
+ case 4:
594
+ _context7.p = 4;
595
+ _t = _context7.v;
596
+ // RPC rejection (expired/reused code, disconnect mid-call) — surface it so the
597
+ // callback page shows the error + back-to-login link instead of spinning forever
598
+ console.error('[FusionAuth] OAuthAuthenticateUser failed:', _t);
599
+ return _context7.a(2, dispatch(authError({
600
+ Authenticated: false,
601
+ errormsg: 'Sign-in could not be completed. Please try again.'
602
+ })));
603
+ }
604
+ }, _callee7, null, [[1, 4]]);
605
+ }));
606
+ return function (_x7) {
607
+ return _ref8.apply(this, arguments);
608
+ };
609
+ }();
610
+ };
611
+
612
+ // Step-up resume: re-present the stashed action for confirmation, only after a successful login.
613
+ var resumePendingStepUpAction = function resumePendingStepUpAction(dispatch, action) {
614
+ // authSuccess actions carry payload.isAuthenticated; authError actions do not
615
+ if (!action || !action.payload || !action.payload.isAuthenticated) {
616
+ return action;
617
+ }
618
+ var pending = (0, _fusionStepUp.takePendingAction)();
619
+ if (pending && pending.type === _fusionStepUp.PENDING_ACTION_WITHDRAW) {
620
+ if (pending.complete) {
621
+ dispatch((0, _modalActions.openModal)(_modalActions.MODAL_TYPES.CONFIRM_PENDING_WITHDRAW, {
622
+ withdrawPayload: pending.payload
623
+ }));
624
+ } else {
625
+ // Full-page redirect fallback: the destination details were deliberately never persisted
626
+ // (helpers/fusionStepUp), so there is nothing to resubmit — ask for the withdrawal again.
627
+ dispatch((0, _snackbarActions.showSnack)({
628
+ id: 'fusionAuthStepUpSnack',
629
+ // t("Verification complete. Please submit your withdrawal again.")
630
+ text: 'Verification complete. Please submit your withdrawal again.',
631
+ type: 'success'
632
+ }));
633
+ }
634
+ }
635
+ return action;
636
+ };
637
+
638
+ /// The return leg of a login-shaped callback, shared by the full-page route
639
+ /// (FusionAuthCallbackContainer) and the step-up popup (FusionStepUpModal): connect if this
640
+ /// window has no socket yet, exchange the code, then re-present a stashed step-up action.
641
+ var completeFusionAuthCallback = exports.completeFusionAuthCallback = function completeFusionAuthCallback(_ref9) {
642
+ var code = _ref9.code,
643
+ state = _ref9.state,
644
+ error = _ref9.error,
645
+ errorDescription = _ref9.errorDescription;
646
+ return function (dispatch) {
647
+ if (error) {
648
+ // FusionAuth came back with an OAuth error (user cancelled, missing PKCE, etc.)
649
+ logOAuthError('sign-in', error, errorDescription);
650
+ clearFusionAuthSessionKeys();
651
+ return Promise.resolve(dispatch(authError({
652
+ Authenticated: false,
653
+ errormsg: 'Sign-in was cancelled. Please try again.'
654
+ })));
655
+ }
656
+ return dispatch((0, _wsConnectionActions.connectAndAuthenticate)(function () {
657
+ return dispatch(completeFusionAuthLogin(code, state)).then(function (action) {
658
+ return resumePendingStepUpAction(dispatch, action);
659
+ });
660
+ }))
661
+ // The socket never opened, so the code was never exchanged. Without this the callback
662
+ // page holds its spinner on 'Signing you in...' indefinitely; authError gives it the
663
+ // error and the back-to-login link instead.
664
+ ["catch"](function () {
665
+ return dispatch(authError({
666
+ Authenticated: false,
667
+ errormsg: 'Could not reach the trading server. Please try again.'
668
+ }));
669
+ });
670
+ };
671
+ };
672
+
673
+ /// Completes the link on THIS connection; on success the gateway has ended every session, so
674
+ /// logout() takes the window to /login with a snack. Failures stay on the settings page.
675
+ var completeOAuthIdentityLink = exports.completeOAuthIdentityLink = function completeOAuthIdentityLink(_ref0) {
676
+ var code = _ref0.code,
677
+ returnedState = _ref0.state,
678
+ error = _ref0.error,
679
+ errorDescription = _ref0.errorDescription;
680
+ return /*#__PURE__*/function () {
681
+ var _ref1 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(dispatch) {
682
+ var _takeFusionAuthPkce2, expectedState, codeVerifier, fail, res, result, _t2;
683
+ return _regenerator().w(function (_context8) {
684
+ while (1) switch (_context8.p = _context8.n) {
685
+ case 0:
686
+ _takeFusionAuthPkce2 = takeFusionAuthPkce(), expectedState = _takeFusionAuthPkce2.expectedState, codeVerifier = _takeFusionAuthPkce2.codeVerifier;
687
+ fail = function fail(text) {
688
+ dispatch((0, _snackbarActions.showSnack)({
689
+ id: 'fusionAuthLinkSnack',
690
+ text: text,
691
+ type: 'warning'
692
+ }));
693
+ return {
694
+ Linked: false,
695
+ errormsg: text
696
+ };
697
+ };
698
+ if (!error) {
699
+ _context8.n = 1;
700
+ break;
701
+ }
702
+ logOAuthError('linking', error, errorDescription);
703
+ // t("SSO linking was cancelled.")
704
+ return _context8.a(2, fail('SSO linking was cancelled.'));
705
+ case 1:
706
+ if (!(!code || !codeVerifier || !expectedState || returnedState !== expectedState)) {
707
+ _context8.n = 2;
708
+ break;
709
+ }
710
+ return _context8.a(2, fail('SSO linking could not be completed. Please try again.'));
711
+ case 2:
712
+ _context8.p = 2;
713
+ _context8.n = 3;
714
+ return _apex["default"].connection.RPCPromise('LinkOAuthIdentity', {
715
+ AccessCode: code,
716
+ CodeVerifier: codeVerifier,
717
+ RedirectUrl: fusionAuthRedirectUri()
718
+ });
719
+ case 3:
720
+ res = _context8.v;
721
+ result = JSON.parse(res.o);
722
+ if (result.Linked) {
723
+ _context8.n = 4;
724
+ break;
725
+ }
726
+ return _context8.a(2, fail(result.errormsg || result.Errormsg || 'SSO linking could not be completed. Please try again.'));
727
+ case 4:
728
+ dispatch(logout());
729
+ dispatch((0, _snackbarActions.showSnack)({
730
+ id: 'fusionAuthLinkSnack',
731
+ // t("Your account is now linked to SSO. Please sign in again.")
732
+ text: 'Your account is now linked to SSO. Please sign in again.',
733
+ type: 'success'
734
+ }));
735
+ return _context8.a(2, result);
736
+ case 5:
737
+ _context8.p = 5;
738
+ _t2 = _context8.v;
739
+ console.error('[FusionAuth] LinkOAuthIdentity failed:', _t2);
740
+ return _context8.a(2, fail('SSO linking could not be completed. Please try again.'));
741
+ }
742
+ }, _callee8, null, [[2, 5]]);
743
+ }));
744
+ return function (_x8) {
745
+ return _ref1.apply(this, arguments);
746
+ };
747
+ }();
748
+ };
216
749
  var validateSessionToken = exports.validateSessionToken = function validateSessionToken(token) {
217
750
  return /*#__PURE__*/function () {
218
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(dispatch) {
751
+ var _ref10 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(dispatch) {
219
752
  var authTimeout, timeoutID, auth;
220
- return _regenerator().w(function (_context3) {
221
- while (1) switch (_context3.n) {
753
+ return _regenerator().w(function (_context9) {
754
+ while (1) switch (_context9.n) {
222
755
  case 0:
223
756
  authTimeout = _config["default"].global.authTimeout;
224
757
  timeoutID = authTimeout ? setTimeout(function () {
225
758
  localStorage.removeItem('token');
226
759
  window.location.reload();
227
760
  }, authTimeout) : 0;
228
- _context3.n = 1;
761
+ _context9.n = 1;
229
762
  return _apex["default"].connection.WebAuthenticateUser({
230
763
  SessionToken: token
231
764
  });
232
765
  case 1:
233
- auth = _context3.v;
766
+ auth = _context9.v;
234
767
  clearTimeout(timeoutID);
235
768
  if (!auth.Authenticated) {
236
- _context3.n = 3;
769
+ _context9.n = 3;
237
770
  break;
238
771
  }
239
- _context3.n = 2;
772
+ _context9.n = 2;
240
773
  return dispatch(authSuccess(auth));
241
774
  case 2:
242
- return _context3.a(2, auth);
775
+ return _context9.a(2, auth);
243
776
  case 3:
244
- _context3.n = 4;
777
+ _context9.n = 4;
245
778
  return dispatch(logout());
246
779
  case 4:
247
- return _context3.a(2);
780
+ return _context9.a(2);
248
781
  }
249
- }, _callee3);
782
+ }, _callee9);
250
783
  }));
251
- return function (_x3) {
252
- return _ref3.apply(this, arguments);
784
+ return function (_x9) {
785
+ return _ref10.apply(this, arguments);
253
786
  };
254
787
  }();
255
788
  };
256
789
  var sendTwoFactorAuthCode = exports.sendTwoFactorAuthCode = function sendTwoFactorAuthCode(Code) {
257
790
  return /*#__PURE__*/function () {
258
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(dispatch, _getState) {
259
- var auth, reauth, _auth$errormsg, _reauth, _t;
260
- return _regenerator().w(function (_context4) {
261
- while (1) switch (_context4.p = _context4.n) {
791
+ var _ref11 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(dispatch, _getState) {
792
+ var auth, reauth, _auth$errormsg, _reauth, _t3;
793
+ return _regenerator().w(function (_context0) {
794
+ while (1) switch (_context0.p = _context0.n) {
262
795
  case 0:
263
- _context4.p = 0;
796
+ _context0.p = 0;
264
797
  if (!(pending2FACredentials && had2FAReconnection)) {
265
- _context4.n = 4;
798
+ _context0.n = 4;
266
799
  break;
267
800
  }
268
- _context4.n = 1;
801
+ _context0.n = 1;
269
802
  return _apex["default"].connection.WebAuthenticateUser(pending2FACredentials);
270
803
  case 1:
271
- reauth = _context4.v;
804
+ reauth = _context0.v;
272
805
  if (!(!reauth.Authenticated || !reauth.Requires2FA)) {
273
- _context4.n = 2;
806
+ _context0.n = 2;
274
807
  break;
275
808
  }
276
809
  console.error('[2FA] Re-authentication failed or does not require 2FA');
277
810
  pending2FACredentials = null;
278
- return _context4.a(2, dispatch(authError({
811
+ return _context0.a(2, dispatch(authError({
279
812
  Authenticated: false,
280
813
  errormsg: 'Session expired. Please try logging in again.'
281
814
  })));
282
815
  case 2:
283
- _context4.n = 3;
816
+ _context0.n = 3;
284
817
  return _apex["default"].connection.Authenticate2FA({
285
818
  Code: Code
286
819
  });
287
820
  case 3:
288
- auth = _context4.v;
289
- _context4.n = 9;
821
+ auth = _context0.v;
822
+ _context0.n = 9;
290
823
  break;
291
824
  case 4:
292
- _context4.n = 5;
825
+ _context0.n = 5;
293
826
  return _apex["default"].connection.Authenticate2FA({
294
827
  Code: Code
295
828
  });
296
829
  case 5:
297
- auth = _context4.v;
830
+ auth = _context0.v;
298
831
  if (!((auth.o === 'Endpoint Not Found' || (_auth$errormsg = auth.errormsg) !== null && _auth$errormsg !== void 0 && _auth$errormsg.includes('Endpoint Not Found')) && pending2FACredentials)) {
299
- _context4.n = 9;
832
+ _context0.n = 9;
300
833
  break;
301
834
  }
302
- _context4.n = 6;
835
+ _context0.n = 6;
303
836
  return _apex["default"].connection.WebAuthenticateUser(pending2FACredentials);
304
837
  case 6:
305
- _reauth = _context4.v;
838
+ _reauth = _context0.v;
306
839
  if (!(!_reauth.Authenticated || !_reauth.Requires2FA)) {
307
- _context4.n = 7;
840
+ _context0.n = 7;
308
841
  break;
309
842
  }
310
843
  console.error('[2FA] Re-authentication failed');
311
844
  pending2FACredentials = null;
312
- return _context4.a(2, dispatch(authError({
845
+ return _context0.a(2, dispatch(authError({
313
846
  Authenticated: false,
314
847
  errormsg: 'Session expired. Please try logging in again.'
315
848
  })));
316
849
  case 7:
317
- _context4.n = 8;
850
+ _context0.n = 8;
318
851
  return _apex["default"].connection.Authenticate2FA({
319
852
  Code: Code
320
853
  });
321
854
  case 8:
322
- auth = _context4.v;
855
+ auth = _context0.v;
323
856
  case 9:
324
857
  if (!auth.Authenticated) {
325
- _context4.n = 10;
858
+ _context0.n = 10;
326
859
  break;
327
860
  }
328
- return _context4.a(2, dispatch(authSuccess(auth)));
861
+ return _context0.a(2, dispatch(authSuccess(auth)));
329
862
  case 10:
330
- return _context4.a(2, dispatch(authError(auth)));
863
+ return _context0.a(2, dispatch(authError(auth)));
331
864
  case 11:
332
- _context4.n = 13;
865
+ _context0.n = 13;
333
866
  break;
334
867
  case 12:
335
- _context4.p = 12;
336
- _t = _context4.v;
337
- console.error('[2FA] Error during 2FA authentication:', _t);
338
- return _context4.a(2, dispatch(authError({
868
+ _context0.p = 12;
869
+ _t3 = _context0.v;
870
+ console.error('[2FA] Error during 2FA authentication:', _t3);
871
+ return _context0.a(2, dispatch(authError({
339
872
  Authenticated: false,
340
873
  errormsg: 'Authentication failed. Please try again.'
341
874
  })));
342
875
  case 13:
343
- return _context4.a(2);
876
+ return _context0.a(2);
344
877
  }
345
- }, _callee4, null, [[0, 12]]);
878
+ }, _callee0, null, [[0, 12]]);
346
879
  }));
347
- return function (_x4, _x5) {
348
- return _ref4.apply(this, arguments);
880
+ return function (_x0, _x1) {
881
+ return _ref11.apply(this, arguments);
349
882
  };
350
883
  }();
351
884
  };