11import React , { useEffect , useState } from 'react' ;
2- import { connect , useDispatch , useSelector } from 'react-redux' ;
2+ import { useDispatch , useSelector } from 'react-redux' ;
33
44import { getConfig } from '@edx/frontend-platform' ;
55import { sendPageEvent , sendTrackEvent } from '@edx/frontend-platform/analytics' ;
@@ -16,9 +16,6 @@ import { Navigate, useNavigate } from 'react-router-dom';
1616
1717import BaseContainer from '../base-container' ;
1818import { clearThirdPartyAuthContextErrorMessage } from '../common-components/data/actions' ;
19- import {
20- tpaProvidersSelector ,
21- } from '../common-components/data/selectors' ;
2219import messages from '../common-components/messages' ;
2320import { LOGIN_PAGE , REGISTER_PAGE } from '../data/constants' ;
2421import {
@@ -31,11 +28,8 @@ import { backupRegistrationForm, setSimplifyRegExperimentData } from '../registe
3128import { FIRST_STEP , SECOND_STEP } from '../register/data/optimizelyExperiment/helper' ;
3229
3330const Logistration = ( props ) => {
34- const { selectedPage, tpaProviders } = props ;
31+ const { selectedPage } = props ;
3532 const tpaHint = getTpaHint ( ) ;
36- const {
37- providers, secondaryProviders,
38- } = tpaProviders ;
3933 const { formatMessage } = useIntl ( ) ;
4034 const [ institutionLogin , setInstitutionLogin ] = useState ( false ) ;
4135 const [ key , setKey ] = useState ( '' ) ;
@@ -44,7 +38,10 @@ const Logistration = (props) => {
4438 const hideRegistrationLink = getConfig ( ) . SHOW_REGISTRATION_LINKS === false ;
4539
4640 const dispatch = useDispatch ( ) ;
47- const { simplifyRegExpVariation, simplifiedRegisterPageStep } = useSelector ( state => state . register ) ;
41+ const providers = useSelector ( state => state . commonComponents . thirdPartyAuthContext . providers ) ;
42+ const secondaryProviders = useSelector ( state => state . commonComponents . thirdPartyAuthContext . secondaryProviders ) ;
43+ const simplifyRegExpVariation = useSelector ( state => state . register . simplifyRegExpVariation ) ;
44+ const simplifiedRegisterPageStep = useSelector ( state => state . register . simplifiedRegisterPageStep ) ;
4845
4946 useEffect ( ( ) => {
5047 const authService = getAuthService ( ) ;
@@ -72,11 +69,11 @@ const Logistration = (props) => {
7269
7370 const handleOnSelect = ( tabKey ) => {
7471 sendTrackEvent ( `edx.bi.${ tabKey . replace ( '/' , '' ) } _form.toggled` , { category : 'user-engagement' } ) ;
75- props . clearThirdPartyAuthContextErrorMessage ( ) ;
72+ dispatch ( clearThirdPartyAuthContextErrorMessage ( ) ) ;
7673 if ( tabKey === LOGIN_PAGE ) {
77- props . backupRegistrationForm ( ) ;
74+ dispatch ( backupRegistrationForm ( ) ) ;
7875 } else if ( tabKey === REGISTER_PAGE ) {
79- props . backupLoginForm ( ) ;
76+ dispatch ( backupLoginForm ( ) ) ;
8077 }
8178 setKey ( tabKey ) ;
8279 } ;
@@ -184,35 +181,10 @@ const Logistration = (props) => {
184181
185182Logistration . propTypes = {
186183 selectedPage : PropTypes . string ,
187- backupLoginForm : PropTypes . func . isRequired ,
188- backupRegistrationForm : PropTypes . func . isRequired ,
189- clearThirdPartyAuthContextErrorMessage : PropTypes . func . isRequired ,
190- tpaProviders : PropTypes . shape ( {
191- providers : PropTypes . arrayOf ( PropTypes . shape ( { } ) ) ,
192- secondaryProviders : PropTypes . arrayOf ( PropTypes . shape ( { } ) ) ,
193- } ) ,
194- } ;
195-
196- Logistration . defaultProps = {
197- tpaProviders : {
198- providers : [ ] ,
199- secondaryProviders : [ ] ,
200- } ,
201184} ;
202185
203186Logistration . defaultProps = {
204187 selectedPage : REGISTER_PAGE ,
205188} ;
206189
207- const mapStateToProps = state => ( {
208- tpaProviders : tpaProvidersSelector ( state ) ,
209- } ) ;
210-
211- export default connect (
212- mapStateToProps ,
213- {
214- backupLoginForm,
215- backupRegistrationForm,
216- clearThirdPartyAuthContextErrorMessage,
217- } ,
218- ) ( Logistration ) ;
190+ export default Logistration ;
0 commit comments