@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.
- package/lib/App.js +30 -18
- package/lib/components/2FA/TwoFactorAuthContainer.js +58 -24
- package/lib/components/2FA/TwoFactorAuthContainer.test.js +215 -0
- package/lib/components/AccountsDropdown/AccountsDropdownComponent.css +6 -0
- package/lib/components/AccountsDropdown/AccountsDropdownComponent.js +6 -2
- package/lib/components/AccountsDropdown/AccountsDropdownComponent.test.js +43 -0
- package/lib/components/AccountsDropdown/AccountsDropdownContainer.js +3 -1
- package/lib/components/BalancesList/BalancesListContainer.js +4 -1
- package/lib/components/DepositSidePaneComponents/DepositFormComponent.js +2 -7
- package/lib/components/DigitalAssets/DigitalAssetsOfferingProfilePage.css +6 -3
- package/lib/components/DigitalAssets/DigitalAssetsOfferingProfilePage.js +2 -2
- package/lib/components/DigitalAssets/DigitalAssetsPage.js +1 -1
- package/lib/components/DigitalAssets/digitalAssetsPriceLabel.test.js +238 -0
- package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.js +7 -0
- package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.test.js +105 -0
- package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthContainerFactory.js +12 -1
- package/lib/components/FusionAuth/ConfirmPendingWithdrawModal.js +60 -0
- package/lib/components/FusionAuth/FusionAuthCallbackComponent.js +66 -0
- package/lib/components/FusionAuth/FusionAuthCallbackContainer.js +24 -0
- package/lib/components/FusionAuth/FusionStepUpModal.js +63 -0
- package/lib/components/FusionAuth/LinkOAuthIdentityModal.css +6 -0
- package/lib/components/FusionAuth/LinkOAuthIdentityModal.js +65 -0
- package/lib/components/FuturesOrderBook/FuturesOrderBookContainer.js +6 -0
- package/lib/components/InstrumentPositions/InstrumentPositionsContainer.js +4 -1
- package/lib/components/KYC/kycLevelsVerificationPropsHelper.test.js +7 -8
- package/lib/components/Login/LoginFormComponent.js +15 -4
- package/lib/components/Login/LoginFormContainer.js +21 -26
- package/lib/components/MarginBalances/MarginDepositWithdraw/MarginDepositModal/MarginDepositFormContainer.js +2 -1
- package/lib/components/NoAccountBanner/NoAccountBanner.css +9 -0
- package/lib/components/NoAccountBanner/NoAccountBanner.js +58 -0
- package/lib/components/NoAccountBanner/index.js +16 -0
- package/lib/components/NoAccountPlaceholder/NoAccountPlaceholder.css +31 -0
- package/lib/components/NoAccountPlaceholder/NoAccountPlaceholder.js +33 -0
- package/lib/components/NoAccountPlaceholder/index.js +9 -0
- package/lib/components/OrderBookComponents/Level2DataTableComponent.js +4 -0
- package/lib/components/OrderBookComponents/OrderBookComponent.css +1 -0
- package/lib/components/OrderBookComponents/OrderBookComponent.js +7 -2
- package/lib/components/OrderBookComponents/OrderBookContainer.js +3 -1
- package/lib/components/OrderEntryComponents/defaultForm/BuySellTabs.js +11 -5
- package/lib/components/OrderEntryComponents/defaultForm/OrderEntryAnchoring.js +19 -3
- package/lib/components/OrderHistoryComponents/OpenOrders/OpenOrdersComponent.js +1 -1
- package/lib/components/OrderHistoryComponents/OpenOrders/OpenOrdersComponent.test.js +97 -73
- package/lib/components/PriceChart/TVChartComponent.js +47 -2
- package/lib/components/PriceChart/TVChartContainer.js +2 -1
- package/lib/components/Retail/RetailSidePanes/FiatDeposit/FiatDepositFormComponent.js +2 -6
- package/lib/components/Retail/RetailSidePanes/FiatWithdraw/FiatWithdrawFormComponent.js +2 -6
- package/lib/components/SendReceiveSidePane/ReceiveAddress/ReceiveAddressComponent.js +2 -6
- package/lib/components/SendReceiveSidePane/SendAddress/SendAddressComponent.js +2 -7
- package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/ProfileFormComponent.js +3 -1
- package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/SsoLinkRowComponent.css +10 -0
- package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/SsoLinkRowComponent.js +77 -0
- package/lib/components/Settings/ProfileAndSecurity/TwoFactorAuthSettingsCard/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.js +12 -4
- package/lib/components/Settings/ProfileAndSecurity/TwoFactorAuthSettingsCard/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.test.js +246 -0
- package/lib/components/Signup/SignupFormComponent.js +10 -1
- package/lib/components/Theme/ThemeToggler/ThemeToggler.js +4 -1
- package/lib/components/WithdrawSidePaneComponents/WithdrawForm/WithdrawFormComponent.js +3 -8
- package/lib/components/common/APRecaptcha/APRecaptcha.css +33 -0
- package/lib/components/common/APRecaptcha/APRecaptcha.js +252 -0
- package/lib/components/common/APRecaptcha/index.js +22 -0
- package/lib/components/common/ErrorBoundary/ErrorBoundary.css +35 -0
- package/lib/components/common/ErrorBoundary/ErrorBoundary.js +87 -0
- package/lib/config/configDefault.json +9 -2
- package/lib/helpers/accountProviderHelper.js +28 -0
- package/lib/helpers/accountProviderHelper.test.js +67 -0
- package/lib/helpers/dateHelper.test.js +11 -5
- package/lib/helpers/destinationTagHelper.test.js +14 -5
- package/lib/helpers/errorTextFormatter.js +13 -4
- package/lib/helpers/errorTextFormatter.test.js +26 -0
- package/lib/helpers/formValidations.test.js +19 -3
- package/lib/helpers/fusionStepUp.js +79 -0
- package/lib/helpers/fusionStepUp.test.js +136 -0
- package/lib/helpers/homePageLayoutHelper.test.js +16 -2
- package/lib/helpers/numberFormatter/numberFormatter.js +3 -1
- package/lib/helpers/numberFormatter/numberFormatter.test.js +9 -2
- package/lib/helpers/orderHelper.test.js +59 -38
- package/lib/helpers/placeOrderHelper.js +9 -2
- package/lib/helpers/placeOrderHelper.test.js +43 -16
- package/lib/helpers/recalculateOrderHelper.test.js +49 -12
- package/lib/helpers/safeSessionStorage.js +36 -0
- package/lib/helpers/twoFactorAuthCancellation.js +38 -0
- package/lib/helpers/wsHelper.test.js +16 -7
- package/lib/hocs/forAccount.js +33 -0
- package/lib/hocs/forAccount.test.js +50 -0
- package/lib/hocs/forVerified.js +16 -2
- package/lib/hocs/withAuthentication.js +3 -1
- package/lib/index.js +3 -2
- package/lib/layouts/HeaderLayout/HeaderLayout.js +2 -1
- package/lib/layouts/WalletsLayout/WalletsLayoutContainer.js +3 -1
- package/lib/layouts/WalletsLayout/WalletsLayoutContainer.test.js +84 -0
- package/lib/redux/actions/affiliateActions.test.js +22 -27
- package/lib/redux/actions/apiActions.js +25 -8
- package/lib/redux/actions/apiActions.test.js +98 -0
- package/lib/redux/actions/apiKeyActions.test.js +29 -34
- package/lib/redux/actions/authActions.js +581 -48
- package/lib/redux/actions/authActions.test.js +140 -164
- package/lib/redux/actions/confirmWithdrawActions.js +7 -2
- package/lib/redux/actions/confirmWithdrawActions.test.js +83 -29
- package/lib/redux/actions/depositActions.test.js +267 -249
- package/lib/redux/actions/eotcActions.test.js +3 -0
- package/lib/redux/actions/eotcSettlementActions.test.js +3 -0
- package/lib/redux/actions/eotcWithdrawActions.test.js +3 -0
- package/lib/redux/actions/fusionAuthActions.test.js +717 -0
- package/lib/redux/actions/instrumentActions.test.js +560 -160
- package/lib/redux/actions/interestAccountActions.js +12 -3
- package/lib/{components/MarginBalances/MarginDepositWithdraw/MarginDepositWithdrawContainer.notest.js → redux/actions/interestAccountActions.test.js} +41 -51
- package/lib/redux/actions/kycIdentityMindActions.js +4 -4
- package/lib/redux/actions/kycIdentityMindActions.test.js +31 -13
- package/lib/redux/actions/kycJumioActions.test.js +16 -6
- package/lib/redux/actions/kycManualActions.test.js +16 -9
- package/lib/redux/actions/level1Actions.test.js +2 -2
- package/lib/redux/actions/level2Actions.test.js +51 -120
- package/lib/redux/actions/loyaltyFeeActions.test.js +19 -16
- package/lib/redux/actions/marketStateUpdateActions.test.js +2 -2
- package/lib/redux/actions/modalActions.js +3 -0
- package/lib/redux/actions/orderEntryActions.js +32 -5
- package/lib/redux/actions/orderEntryActions.test.js +104 -37
- package/lib/redux/actions/orderHistoryActions.js +11 -4
- package/lib/redux/actions/orderHistoryActions.test.js +94 -79
- package/lib/redux/actions/positionActions.test.js +19 -4
- package/lib/redux/actions/productActions.test.js +38 -21
- package/lib/redux/actions/recentTradesActions.test.js +2 -2
- package/lib/redux/actions/regionFormActions.test.js +25 -33
- package/lib/redux/actions/reportActions.test.js +16 -35
- package/lib/redux/actions/signupActions.js +18 -4
- package/lib/redux/actions/signupActions.test.js +146 -142
- package/lib/redux/actions/snackbarActions.test.js +4 -4
- package/lib/redux/actions/tickersActions.test.js +10 -4
- package/lib/redux/actions/transferActions.test.js +111 -93
- package/lib/redux/actions/transferRequestActions.test.js +42 -42
- package/lib/redux/actions/userActions.js +97 -34
- package/lib/redux/actions/userActions.test.js +663 -314
- package/lib/redux/actions/verifyEmailActions.test.js +13 -2
- package/lib/redux/actions/withdrawActions.js +143 -76
- package/lib/redux/actions/withdrawActions.test.js +369 -187
- package/lib/redux/actions/withdrawActions.travelRule.test.js +17 -3
- package/lib/redux/actions/wsConnectionActions.js +96 -1
- package/lib/redux/actions/wsConnectionActions.test.js +9 -8
- package/lib/redux/actions/wsConnectionLifecycle.test.js +207 -0
- package/lib/redux/futures/actions/futuresOrderFormActions.js +26 -2
- package/lib/redux/margin/actions/marginActions.test.js +163 -75
- package/lib/redux/margin/actions/marginHistoryActions.test.js +190 -151
- package/lib/redux/margin/reducers/marginHistoryReducer.test.js +146 -135
- package/lib/redux/margin/selectors/marginHistorySelectors.test.js +101 -102
- package/lib/redux/margin/selectors/marginOrderSelectors.test.js +2 -2
- package/lib/redux/middlewares/authMiddleware.test.js +142 -23
- package/lib/redux/middlewares/placeOrderMiddleware.test.js +18 -1
- package/lib/redux/middlewares/startupMiddleware.test.js +10 -34
- package/lib/redux/middlewares/wsConnectionMiddleware.test.js +6 -1
- package/lib/redux/reducers/apiProcessingReducer.test.js +4 -2
- package/lib/redux/reducers/authReducer.test.js +3 -3
- package/lib/redux/reducers/depositReducer.test.js +2 -1
- package/lib/redux/reducers/level2Reducer.test.js +2 -2
- package/lib/redux/reducers/orderHistoryReducer.js +1 -1
- package/lib/redux/reducers/orderHistoryReducer.test.js +63 -75
- package/lib/redux/reducers/positionReducer.test.js +1 -2
- package/lib/redux/reducers/resetPasswordReducer.test.js +1 -0
- package/lib/redux/reducers/snackbarReducer.test.js +12 -39
- package/lib/redux/reducers/tickersReducer.test.js +2 -2
- package/lib/redux/reducers/userReducer.js +10 -0
- package/lib/redux/reducers/userReducer.test.js +36 -1
- package/lib/redux/reducers/withdrawReducer.test.js +11 -5
- package/lib/redux/selectors/buySellSelectors.test.js +10 -6
- package/lib/redux/selectors/depositWithdrawalSelectors.js +6 -12
- package/lib/redux/selectors/instrumentPositionSelectors.test.js +58 -18
- package/lib/redux/selectors/level2Selectors.test.js +60 -33
- package/lib/redux/selectors/loyaltyTokenSelectors.test.js +15 -13
- package/lib/redux/selectors/marginHistorySelectors.test.js +11 -5
- package/lib/redux/selectors/openOrdersActivitySelector.test.js +4 -4
- package/lib/redux/selectors/orderHistorySelectors.test.js +141 -22
- package/lib/redux/selectors/orderTotalSelector.test.js +76 -30
- package/lib/redux/selectors/productPositionSelectors.test.js +2 -1
- package/lib/redux/selectors/recentActivitySelector.js +8 -2
- package/lib/redux/selectors/recentActivitySelector.v2.test.js +33 -0
- package/lib/redux/selectors/recentTradesSelectors.test.js +17 -0
- package/lib/redux/selectors/transfersTableSelectors.test.js +7 -1
- package/lib/redux/selectors/userSelectors.js +6 -1
- package/lib/redux/selectors/userSelectors.test.js +28 -0
- package/lib/services/subscriptions/accountPositionSubscriptionService.test.js +0 -14
- package/lib/services/subscriptions/orderStateSubscriptionService.test.js +0 -14
- package/lib/services/subscriptions/orderTradesSuscriptionService.test.js +0 -14
- package/lib/services/tradingView/ChartAPI.js +17 -2
- package/lib/setupTests.js +1 -10
- package/package.json +21 -5
- package/lib/components/APSnackbar/APSnackbarContainer.notest.js +0 -58
- package/lib/components/ActivityReportingComponents/ActivityReportingButtons/ActivityReportingButtonsComponent.notest.js +0 -27
- package/lib/components/ActivityReportingComponents/ActivityReportingButtons/ActivityReportingButtonsContainer.notest.js +0 -42
- package/lib/components/AffiliateComponents/AffiliateActiveTagComponent.notest.js +0 -36
- package/lib/components/AffiliateComponents/AffiliateActiveTagContainer.notest.js +0 -81
- package/lib/components/AffiliateComponents/AffiliateCountContainer.notest.js +0 -37
- package/lib/components/AffiliateComponents/AffiliateModal.notest.js +0 -41
- package/lib/components/AffiliateComponents/AffiliateModalContainer.notest.js +0 -79
- package/lib/components/ApiKeysSidePaneComponents/ApiKeyList/ApiKeyListContainer.notest.js +0 -40
- package/lib/components/ApiKeysSidePaneComponents/ApiKeysComponent/ApiKeysComponent.notest.js +0 -32
- package/lib/components/ApiKeysSidePaneComponents/ApiKeysForm/ApiKeysFormComponent.notest.js +0 -32
- package/lib/components/ApiKeysSidePaneComponents/ApiKeysForm/ApiKeysFormContainer.notest.js +0 -29
- package/lib/components/ApiKeysSidePaneComponents/ApiKeysSidePane/ApiKeySidePaneComponent.notest.js +0 -46
- package/lib/components/ApiKeysSidePaneComponents/CreateApiKey/CreateApiKeyComponent.notest.js +0 -50
- package/lib/components/ApiKeysSidePaneComponents/CreateApiKey/CreateApiKeyContainer.notest.js +0 -70
- package/lib/components/ApiKeysSidePaneComponents/NewApiKey/NewApiKeyModalContainer.notest.js +0 -102
- package/lib/components/ApiKeysSidePaneComponents/RemoveApiKeyModal/RemoveApiKeyModalContainer.notest.js +0 -53
- package/lib/components/BalancesList/BalancesListContainer.notest.js +0 -91
- package/lib/components/BalancesMenu/BalanceMenuContainer.notest.js +0 -49
- package/lib/components/BalancesMenu/BalancesMenuComponent.notest.js +0 -68
- package/lib/components/BalancesMenu/BalancesMenuItemComponent.notest.js +0 -28
- package/lib/components/ConfirmBlockTradeModal/ConfirmBlockTradeModalContainer.notest.js +0 -171
- package/lib/components/ConfirmLimitOrderModal/ConfirmLimitOrderModalContainer.notest.js +0 -179
- package/lib/components/ConfirmWithdraw/ConfirmWithdrawContainer.notest.js +0 -58
- package/lib/components/DepositConfirmation/DepositConfirmationModalContainer.notest.js +0 -59
- package/lib/components/DepositSidePaneComponents/DepositFormComponent.notest.js +0 -123
- package/lib/components/DepositSidePaneComponents/DepositFormContainer.notest.js +0 -174
- package/lib/components/DepositSidePaneComponents/DepositTemplateFormComponent.notest.js +0 -79
- package/lib/components/DepositSidePaneComponents/DepositTemplateFormContainer.notest.js +0 -66
- package/lib/components/DepositSidePaneComponents/DepositWorkflows/CryptoWalletDepositWorkflow/CryptoWalletDepositWorkflowComponent.notest.js +0 -42
- package/lib/components/DepositSidePaneComponents/DepositWorkflows/CryptoWalletDepositWorkflow/CryptoWalletDepositWorkflowContainer.notest.js +0 -52
- package/lib/components/DepositSidePaneComponents/DepositWorkflows/DepositWorkflowsComponent.notest.js +0 -52
- package/lib/components/DepositSidePaneComponents/DepositWorkflows/DepositWorkflowsContainer.notest.js +0 -49
- package/lib/components/DepositSidePaneComponents/DepositWorkflows/GenericPaymentWorkflow/GenericPaymentWorkflowComponent.notest.js +0 -96
- package/lib/components/DepositSidePaneComponents/DepositWorkflows/GenericPaymentWorkflow/GenericPaymentWorkflowContainer.notest.js +0 -49
- package/lib/components/DepositSidePaneComponents/DepositWorkflows/ManualDepositWorkflow/ManualDepositWorkflowComponent.notest.js +0 -68
- package/lib/components/DepositSidePaneComponents/DepositWorkflows/ManualDepositWorkflow/ManualDepositWorkflowContainer.notest.js +0 -60
- package/lib/components/DepositSidePaneComponents/DepositWorkflows/PaymentProcessors/Hyphen/HyphenDepositWorkflowContainer.notest.js +0 -66
- package/lib/components/DepthChart/DepthChartContainer.notest.js +0 -82
- package/lib/components/EnableTwoFactorAuth/Disable2FAModalContainer.notest.js +0 -73
- package/lib/components/EnableTwoFactorAuth/Enable2FAModalContainer.notest.js +0 -82
- package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthContainerFactory.notest.js +0 -50
- package/lib/components/EotcBalancesList/EotcBalancesListContainer.notest.js +0 -53
- package/lib/components/EotcProductCard/EotcProductCardContainer.notest.js +0 -87
- package/lib/components/EotcProductCard/EotcProductCardListContainer.notest.js +0 -55
- package/lib/components/EotcProductCardSimple/EotcProductCardSimpleContainer.notest.js +0 -136
- package/lib/components/EotcProductCardSimple/EotcProductCardSimpleListContainer.notest.js +0 -66
- package/lib/components/EotcWalletCard/EotcWalletCardContainer.notest.js +0 -148
- package/lib/components/EotcWalletCard/EotcWalletCardGridContainer.notest.js +0 -57
- package/lib/components/InstrumentPositions/InstrumentPositionsContainer.notest.js +0 -54
- package/lib/components/InstrumentPositionsWrapper/InstrumentPositionsWrapperContainer.notest.js +0 -46
- package/lib/components/InstrumentSelector/InstrumentSelectorContainer.notest.js +0 -112
- package/lib/components/InstrumentTable/InstrumentTableContainer.notest.js +0 -51
- package/lib/components/KYC/KYCBaseContainer.notest.js +0 -103
- package/lib/components/KYC/KYCLevel/KYCLevelComponent.notest.js +0 -94
- package/lib/components/KYCSettings/KYCSettingsContainer.notest.js +0 -49
- package/lib/components/KYCStatus/KYCStatusContainer.notest.js +0 -66
- package/lib/components/KYC_IM/KYC_IMForm/KYC_IMFormContainer.notest.js +0 -89
- package/lib/components/KYC_IM/KYC_IMForm/KYC_IMFormStepContainer.notest.js +0 -37
- package/lib/components/KYC_IM/KYC_IMLevelsContainer.notest.js +0 -47
- package/lib/components/KYC_IMLegacy/KYC_IMLegacyForm/KYC_IMLegacyFormContainer.notest.js +0 -152
- package/lib/components/KYC_IMLegacy/KYC_IMLegacyLevelsContainer.notest.js +0 -47
- package/lib/components/KYC_Jumio/KYC_JumioIframe/KYC_JumioIframeComponent.notest.js +0 -63
- package/lib/components/KYC_Jumio/KYC_JumioIframe/KYC_JumioIframeContainer.notest.js +0 -70
- package/lib/components/KYC_Jumio/KYC_JumioLevelsContainer.notest.js +0 -47
- package/lib/components/KYC_Manual/KYC_ManualForm/KYC_ManualFormContainer.notest.js +0 -102
- package/lib/components/KYC_Manual/KYC_ManualIframe/KYC_ManualIframeContainer.notest.js +0 -150
- package/lib/components/KYC_Manual/KYC_ManualLevelsContainer.notest.js +0 -47
- package/lib/components/Login/LoginFormComponent.notest.js +0 -84
- package/lib/components/Login/LoginFormContainer.notest.js +0 -111
- package/lib/components/LoyaltyToken/LoyaltyTokenContainer.notest.js +0 -57
- package/lib/components/MarginBalances/MarginDepositWithdraw/MarginDepositModal/MarginDepositFormContainer.notest.js +0 -87
- package/lib/components/MarginBalances/MarginOverview/MarginOverviewContainer.notest.js +0 -45
- package/lib/components/MarginTransferAssetModal/MarginTransferAssetsFormContainer.notest.js +0 -194
- package/lib/components/MarketDataCardsComponent/MarketDataCardsContainer.notest.js +0 -63
- package/lib/components/MenuItem/MenuItemComponent.notest.js +0 -39
- package/lib/components/OrderBookComponents/BulkCancelButtonsComponent/BulkCancelButtonsComponent.notest.js +0 -54
- package/lib/components/OrderBookComponents/Level2DataTableComponent.notest.js +0 -38
- package/lib/components/OrderBookComponents/OrderBookComponent.notest.js +0 -38
- package/lib/components/OrderBookComponents/OrderBookContainer.notest.js +0 -121
- package/lib/components/OrderHistoryComponents/DepositsStatus/DepositsStatusComponent.notest.js +0 -68
- package/lib/components/OrderHistoryComponents/FilledOrders/FilledOrdersComponent.notest.js +0 -156
- package/lib/components/OrderHistoryComponents/HeaderWithFilter/HeaderWithFilterContainer.notest.js +0 -58
- package/lib/components/OrderHistoryComponents/InactiveOrders/InactiveOrdersComponent.notest.js +0 -97
- package/lib/components/OrderHistoryComponents/MarginOpenPositions/MarginOpenPositionsComponent.notest.js +0 -93
- package/lib/components/OrderHistoryComponents/MarginOrderHistory/MarginOrderHistoryComponent.notest.js +0 -107
- package/lib/components/OrderHistoryComponents/MarginOrderHistoryExtended/MarginOrderHistoryExtendedComponent.notest.js +0 -118
- package/lib/components/OrderHistoryComponents/OpenOrders/OpenOrdersComponent.notest.js +0 -123
- package/lib/components/OrderHistoryComponents/OrderHistoryComponent.notest.js +0 -107
- package/lib/components/OrderHistoryComponents/PositionPayments/PositionPaymentsComponent.notest.js +0 -82
- package/lib/components/OrderHistoryComponents/TradeReports/TradeReportsComponent.notest.js +0 -124
- package/lib/components/OrderHistoryComponents/WithdrawStatus/WithdrawStatusComponent.notest.js +0 -69
- package/lib/components/PriceChart/ApexChartComponent.notest.js +0 -48
- package/lib/components/PriceChart/ApexChartContainer.notest.js +0 -75
- package/lib/components/PriceChart/PriceChartContainer.notest.js +0 -37
- package/lib/components/PriceChart/TVChartContainer.notest.js +0 -106
- package/lib/components/ProblemLoggingIn/ProblemLoggingInFormContainer.notest.js +0 -81
- package/lib/components/ProductPositionDetails/ProductPositionDetailsComponent.notest.js +0 -37
- package/lib/components/ProductPositionDetails/ProductPositionDetailsContainer.notest.js +0 -47
- package/lib/components/ProfileForm/ProfileFormComponent.notest.js +0 -51
- package/lib/components/ProfileForm/ProfileFormContainer.notest.js +0 -68
- package/lib/components/RecentActivity/RecentActivityContainer.notest.js +0 -41
- package/lib/components/RecentActivity/RecentActivityTable/RecentActivityTableContainer.notest.js +0 -43
- package/lib/components/RecentActivityWithFilter/RecentActivityHeaderWithFilter/RecentActivityHeaderForm/RecentActivityHeaderFormContainer.notest.js +0 -128
- package/lib/components/RecentActivityWithFilter/RecentActivityTableWithFilter/RecentActivityTableWithFilterContainer.notest.js +0 -64
- package/lib/components/RecentActivityWithFilter/RecentActivityWithFilterContainer.notest.js +0 -41
- package/lib/components/RecentTrades/RecentTradesComponent.notest.js +0 -78
- package/lib/components/RecentTrades/RecentTradesContainer.notest.js +0 -59
- package/lib/components/ReportBlockTradeSidePaneComponents/ReportBlockTradeContainer.notest.js +0 -169
- package/lib/components/ReportBlockTradeSidePaneComponents/ReportBlockTradeSidePaneContainer.notest.js +0 -107
- package/lib/components/ReportSidePaneComponents/ConfirmCyclicalReport/ConfirmCyclicalReportModalContainer.notest.js +0 -39
- package/lib/components/ReportSidePaneComponents/ConfirmSingleReport/ConfirmSingleReportModalContainer.notest.js +0 -39
- package/lib/components/ReportSidePaneComponents/CreateReportForm/CreateReportFormComponent.notest.js +0 -42
- package/lib/components/ReportSidePaneComponents/CreateReportForm/CreateReportFormContainer.notest.js +0 -85
- package/lib/components/ReportSidePaneComponents/DownloadReportForm/DownloadReportContainer.notest.js +0 -37
- package/lib/components/ReportSidePaneComponents/ReportSidePaneComponent.notest.js +0 -72
- package/lib/components/ReportSidePaneComponents/ScheduleReportForm/ScheduleReportFormComponent.notest.js +0 -43
- package/lib/components/ReportSidePaneComponents/ScheduleReportForm/ScheduleReportFormContainer.notest.js +0 -80
- package/lib/components/ReportSidePaneComponents/ScheduledReportsTable/ScheduledReportsTableComponent.notest.js +0 -34
- package/lib/components/ReportSidePaneComponents/ScheduledReportsTable/ScheduledReportsTableContainer.notest.js +0 -48
- package/lib/components/ResetPasswordForm/ResetPasswordFormContainer.notest.js +0 -105
- package/lib/components/ResetPasswordRequestForm/ResetPasswordRequestFormComponent.notest.js +0 -39
- package/lib/components/ResetPasswordRequestForm/ResetPasswordRequestFormContainerFactory.notest.js +0 -47
- package/lib/components/Retail/RetailBuySell/BuySell/BuySellContainer.notest.js +0 -105
- package/lib/components/Retail/RetailBuySell/BuySell/BuySellCustomRow/BuySellCustomRowContainer.notest.js +0 -145
- package/lib/components/Retail/RetailBuySell/BuySell/BuySellInstrumentSelector/BuySellInstrumentSelectorContainer.notest.js +0 -113
- package/lib/components/Retail/RetailBuySell/BuySell/BuySellOrderButton/BuySellOrderButtonContainer.notest.js +0 -66
- package/lib/components/Retail/RetailBuySell/BuySell/BuySellPresetValuesRows/BuySellPresetValuesRowsContainer.notest.js +0 -125
- package/lib/components/Retail/RetailBuySell/BuySell/BuySellTabs/BuySellTabsContainer.notest.js +0 -115
- package/lib/components/Retail/RetailBuySell/BuySellBalances/BuySellBalancesContainer.notest.js +0 -126
- package/lib/components/Retail/RetailBuySell/BuySellChartIntervalSelector/BuySellChartIntervalSelectorContainer.notest.js +0 -36
- package/lib/components/Retail/RetailBuySell/BuySellChartOverview/BuySellChartOverviewContainer.notest.js +0 -43
- package/lib/components/Retail/RetailBuySell/BuySellInstrumentSelect/BuySellInstrumentSelectContainer.notest.js +0 -153
- package/lib/components/Retail/RetailBuySell/BuySellOrderConfirmationModal/BuySellConfirmationModalContainer.notest.js +0 -262
- package/lib/components/Retail/RetailBuySell/BuySellOrderOverview/BuySellOrderOverviewContainer.notest.js +0 -124
- package/lib/components/Retail/RetailBuySell/EotcBuySell/EotcBuySellContainer.notest.js +0 -125
- package/lib/components/Retail/RetailBuySell/EotcBuySell/EotcBuySellCustomRow/EotcBuySellCustomRowContainer.notest.js +0 -143
- package/lib/components/Retail/RetailBuySell/EotcBuySell/EotcBuySellPresetValuesRows/EotcBuySellPresetValuesRowsContainer.notest.js +0 -125
- package/lib/components/Retail/RetailBuySell/EotcBuySellChartOverviewContainer/BuySellChartOverviewContainer.notest.js +0 -43
- package/lib/components/Retail/RetailBuySell/EotcBuySellOrderConfirmationModal/EotcBuySellConfirmationModalContainer.notest.js +0 -262
- package/lib/components/Retail/RetailSidePanes/FiatDeposit/DepositReferenceIdModalContainer.notest.js +0 -45
- package/lib/components/Retail/RetailSidePanes/FiatDeposit/FiatDepositFormContainer.notest.js +0 -137
- package/lib/components/Retail/RetailSidePanes/FiatDeposit/FiatDepositModalContainer.notest.js +0 -82
- package/lib/components/Retail/RetailSidePanes/FiatFormTabsComponent.notest.js +0 -49
- package/lib/components/Retail/RetailSidePanes/FiatSidePaneContainer.notest.js +0 -62
- package/lib/components/Retail/RetailSidePanes/FiatWithdraw/BankSelect/BankSelectContainer.notest.js +0 -80
- package/lib/components/Retail/RetailSidePanes/FiatWithdraw/FiatWithdrawFormContainer.notest.js +0 -124
- package/lib/components/Retail/RetailSidePanes/FiatWithdraw/FiatWithdrawModalContainer.notest.js +0 -46
- package/lib/components/SendReceiveSidePane/Receive/ReceiveContainer.notest.js +0 -69
- package/lib/components/SendReceiveSidePane/ReceiveAddress/ReceiveAddressContainer.notest.js +0 -73
- package/lib/components/SendReceiveSidePane/ReceiveForm/ReceiveFormContainer.notest.js +0 -54
- package/lib/components/SendReceiveSidePane/SendAddress/SendAddressContainer.notest.js +0 -71
- package/lib/components/SendReceiveSidePane/SendForm/SendFormContainer.notest.js +0 -72
- package/lib/components/SendReceiveSidePane/SendReceiveSidePaneContainer.notest.js +0 -139
- package/lib/components/SendReceiveSidePane/SendReceiveTwoFactorAuth/SendReceiveTwoFactorAuthContainer.notest.js +0 -102
- package/lib/components/Settings/ApiKeys/ApiKeysSidePaneButton/ApiKeysSidePaneButtonContainer.notest.js +0 -31
- package/lib/components/Settings/DemoSettings/DemoSettingsContainer.notest.js +0 -46
- package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/ProfileFormContainer.notest.js +0 -69
- package/lib/components/Settings/ProfileAndSecurity/RegionSettingsCard/RegionSettings/RegionSettingsContainer.notest.js +0 -86
- package/lib/components/Settings/ProfileAndSecurity/ThemeSettingsCard/ThemeForm/ThemeSettingsContainer.notest.js +0 -45
- package/lib/components/Settings/TradeSettings/MarginTrading/EnableMarginModal/EnableMarginConfirmationModalComponent.notest.js +0 -47
- package/lib/components/Settings/TradeSettings/MarginTrading/EnableMarginModal/EnableMarginConfirmationModalContainer.notest.js +0 -112
- package/lib/components/Settings/TradeSettings/MarginTrading/MarginTradingComponent.notest.js +0 -33
- package/lib/components/Settings/TradeSettings/MarginTrading/MarginTradingContainer.notest.js +0 -54
- package/lib/components/Settings/TransferHistory/TransferHistoryContainer.notest.js +0 -42
- package/lib/components/Signup/SignupFormComponent.notest.js +0 -92
- package/lib/components/Signup/SignupFormContainer.notest.js +0 -124
- package/lib/components/StandaloneKYC/StandaloneKYCContainer.notest.js +0 -75
- package/lib/components/StandaloneModal/StandaloneModalComponent.notest.js +0 -69
- package/lib/components/Ticker/TickerContainer.notest.js +0 -57
- package/lib/components/Transfers/TransfersContainer.notest.js +0 -99
- package/lib/components/Transfers/TransfersFilters/TransfersFiltersContainer.notest.js +0 -81
- package/lib/components/TwoFactorAuthForm/TwoFactorAuthFormContainer.notest.js +0 -60
- package/lib/components/UserBalance/UserBalanceContainer.notest.js +0 -47
- package/lib/components/UserSettings/UserSettingsComponent.notest.js +0 -55
- package/lib/components/UserSummary/UserSummaryContainer.notest.js +0 -65
- package/lib/components/VerificationRequired/VerificationRequiredContainer.notest.js +0 -47
- package/lib/components/VerifyEmail/VerifyEmailContainer.notest.js +0 -46
- package/lib/components/WalletCards/WalletCardContainer.notest.js +0 -77
- package/lib/components/WalletCards/WalletCardGridContainer.notest.js +0 -42
- package/lib/components/WalletDetails/WalletDetailsContainer.notest.js +0 -61
- package/lib/components/WalletNavItems/CryptoNavItemsContainer.notest.js +0 -46
- package/lib/components/WalletNavItems/EotcCryptoNavItemsContainer.notest.js +0 -64
- package/lib/components/WalletNavItems/FiatNavItemsComponent.notest.js +0 -59
- package/lib/components/WalletNavItems/FiatNavItemsContainer.notest.js +0 -66
- package/lib/components/WalletRows/WalletRowContainer.notest.js +0 -76
- package/lib/components/WalletRows/WalletRowListContainer.notest.js +0 -43
- package/lib/components/WithdrawSidePaneComponents/PaymentProcessors/HyphenWithdrawWorkflowContainer.notest.js +0 -51
- package/lib/components/WithdrawSidePaneComponents/PaymentProcessors/TrustpayWithdrawWorkflowContainer.notest.js +0 -36
- package/lib/components/WithdrawSidePaneComponents/WithdrawForm/WithdrawFormComponent.notest.js +0 -131
- package/lib/components/WithdrawSidePaneComponents/WithdrawForm/WithdrawFormContainer.notest.js +0 -140
- package/lib/components/WithdrawSidePaneComponents/WithdrawTemplateForm/WithdrawTemplateFormComponent.notest.js +0 -38
- package/lib/components/WithdrawSidePaneComponents/WithdrawTemplateForm/WithdrawTemplateFormContainer.notest.js +0 -95
- package/lib/components/WithdrawSidePaneComponents/WithdrawWorkflows/WithdrawWorkflowsContainer.notest.js +0 -42
- package/lib/components/common/APDatePicker/APDatePicker.notest.js +0 -194
- package/lib/components/common/APLabelWithText/APLabelWithText.notest.js +0 -25
- package/lib/components/common/APNumberInput.notest.js +0 -173
- package/lib/components/common/APRadioTab/APRadioTab.notest.js +0 -69
- package/lib/components/common/APSegmentedButton/APSegmentedButton.notest.js +0 -55
- package/lib/components/common/APSnackbar/APSnackbar.notest.js +0 -107
- package/lib/components/common/APVerticalScroller/APVerticalScroller.notest.js +0 -172
- package/lib/components/common/Modal/Modal.notest.js +0 -55
- package/lib/components/common/Pagination/PaginationComponent.notest.js +0 -137
- package/lib/components/common/Pagination/PaginationContainer.notest.js +0 -47
- package/lib/components/common/Popover/Popover.notest.js +0 -137
- package/lib/components/common/ProductIcon/ProductIcon.notest.js +0 -76
- package/lib/components/common/ProductIcon/ProductIconContainer.notest.js +0 -38
- package/lib/components/common/SidePane/SidePaneComponent.notest.js +0 -48
- package/lib/components/common/SidePane/SidePaneContainer.notest.js +0 -54
- package/lib/components/common/Snackbar/Snackbar.notest.js +0 -51
- package/lib/components/common/Tab/Tab.notest.js +0 -68
- package/lib/helpers/formGeneratorHelper.notest.js +0 -203
- package/lib/helpers/formTemplateHelper.notest.js +0 -170
- package/lib/hocs/modalDecorator.notest.js +0 -74
- package/lib/hocs/redirectIfAuthorized.notest.js +0 -80
- package/lib/hocs/resize.notest.js +0 -37
- package/lib/layouts/HomePageLayout.notest.js +0 -65
- package/lib/redux/actions/languageActions.test.js +0 -105
- 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
|
|
751
|
+
var _ref10 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(dispatch) {
|
|
219
752
|
var authTimeout, timeoutID, auth;
|
|
220
|
-
return _regenerator().w(function (
|
|
221
|
-
while (1) switch (
|
|
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
|
-
|
|
761
|
+
_context9.n = 1;
|
|
229
762
|
return _apex["default"].connection.WebAuthenticateUser({
|
|
230
763
|
SessionToken: token
|
|
231
764
|
});
|
|
232
765
|
case 1:
|
|
233
|
-
auth =
|
|
766
|
+
auth = _context9.v;
|
|
234
767
|
clearTimeout(timeoutID);
|
|
235
768
|
if (!auth.Authenticated) {
|
|
236
|
-
|
|
769
|
+
_context9.n = 3;
|
|
237
770
|
break;
|
|
238
771
|
}
|
|
239
|
-
|
|
772
|
+
_context9.n = 2;
|
|
240
773
|
return dispatch(authSuccess(auth));
|
|
241
774
|
case 2:
|
|
242
|
-
return
|
|
775
|
+
return _context9.a(2, auth);
|
|
243
776
|
case 3:
|
|
244
|
-
|
|
777
|
+
_context9.n = 4;
|
|
245
778
|
return dispatch(logout());
|
|
246
779
|
case 4:
|
|
247
|
-
return
|
|
780
|
+
return _context9.a(2);
|
|
248
781
|
}
|
|
249
|
-
},
|
|
782
|
+
}, _callee9);
|
|
250
783
|
}));
|
|
251
|
-
return function (
|
|
252
|
-
return
|
|
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
|
|
259
|
-
var auth, reauth, _auth$errormsg, _reauth,
|
|
260
|
-
return _regenerator().w(function (
|
|
261
|
-
while (1) switch (
|
|
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
|
-
|
|
796
|
+
_context0.p = 0;
|
|
264
797
|
if (!(pending2FACredentials && had2FAReconnection)) {
|
|
265
|
-
|
|
798
|
+
_context0.n = 4;
|
|
266
799
|
break;
|
|
267
800
|
}
|
|
268
|
-
|
|
801
|
+
_context0.n = 1;
|
|
269
802
|
return _apex["default"].connection.WebAuthenticateUser(pending2FACredentials);
|
|
270
803
|
case 1:
|
|
271
|
-
reauth =
|
|
804
|
+
reauth = _context0.v;
|
|
272
805
|
if (!(!reauth.Authenticated || !reauth.Requires2FA)) {
|
|
273
|
-
|
|
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
|
|
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
|
-
|
|
816
|
+
_context0.n = 3;
|
|
284
817
|
return _apex["default"].connection.Authenticate2FA({
|
|
285
818
|
Code: Code
|
|
286
819
|
});
|
|
287
820
|
case 3:
|
|
288
|
-
auth =
|
|
289
|
-
|
|
821
|
+
auth = _context0.v;
|
|
822
|
+
_context0.n = 9;
|
|
290
823
|
break;
|
|
291
824
|
case 4:
|
|
292
|
-
|
|
825
|
+
_context0.n = 5;
|
|
293
826
|
return _apex["default"].connection.Authenticate2FA({
|
|
294
827
|
Code: Code
|
|
295
828
|
});
|
|
296
829
|
case 5:
|
|
297
|
-
auth =
|
|
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
|
-
|
|
832
|
+
_context0.n = 9;
|
|
300
833
|
break;
|
|
301
834
|
}
|
|
302
|
-
|
|
835
|
+
_context0.n = 6;
|
|
303
836
|
return _apex["default"].connection.WebAuthenticateUser(pending2FACredentials);
|
|
304
837
|
case 6:
|
|
305
|
-
_reauth =
|
|
838
|
+
_reauth = _context0.v;
|
|
306
839
|
if (!(!_reauth.Authenticated || !_reauth.Requires2FA)) {
|
|
307
|
-
|
|
840
|
+
_context0.n = 7;
|
|
308
841
|
break;
|
|
309
842
|
}
|
|
310
843
|
console.error('[2FA] Re-authentication failed');
|
|
311
844
|
pending2FACredentials = null;
|
|
312
|
-
return
|
|
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
|
-
|
|
850
|
+
_context0.n = 8;
|
|
318
851
|
return _apex["default"].connection.Authenticate2FA({
|
|
319
852
|
Code: Code
|
|
320
853
|
});
|
|
321
854
|
case 8:
|
|
322
|
-
auth =
|
|
855
|
+
auth = _context0.v;
|
|
323
856
|
case 9:
|
|
324
857
|
if (!auth.Authenticated) {
|
|
325
|
-
|
|
858
|
+
_context0.n = 10;
|
|
326
859
|
break;
|
|
327
860
|
}
|
|
328
|
-
return
|
|
861
|
+
return _context0.a(2, dispatch(authSuccess(auth)));
|
|
329
862
|
case 10:
|
|
330
|
-
return
|
|
863
|
+
return _context0.a(2, dispatch(authError(auth)));
|
|
331
864
|
case 11:
|
|
332
|
-
|
|
865
|
+
_context0.n = 13;
|
|
333
866
|
break;
|
|
334
867
|
case 12:
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
console.error('[2FA] Error during 2FA authentication:',
|
|
338
|
-
return
|
|
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
|
|
876
|
+
return _context0.a(2);
|
|
344
877
|
}
|
|
345
|
-
},
|
|
878
|
+
}, _callee0, null, [[0, 12]]);
|
|
346
879
|
}));
|
|
347
|
-
return function (
|
|
348
|
-
return
|
|
880
|
+
return function (_x0, _x1) {
|
|
881
|
+
return _ref11.apply(this, arguments);
|
|
349
882
|
};
|
|
350
883
|
}();
|
|
351
884
|
};
|