1
1
import React , { useEffect , useState } from 'react' ;
2
- import { connect , useDispatch , useSelector } from 'react-redux' ;
2
+ import { useDispatch , useSelector } from 'react-redux' ;
3
3
4
4
import { getConfig } from '@edx/frontend-platform' ;
5
5
import { sendPageEvent , sendTrackEvent } from '@edx/frontend-platform/analytics' ;
@@ -16,9 +16,6 @@ import { Navigate, useNavigate } from 'react-router-dom';
16
16
17
17
import BaseContainer from '../base-container' ;
18
18
import { clearThirdPartyAuthContextErrorMessage } from '../common-components/data/actions' ;
19
- import {
20
- tpaProvidersSelector ,
21
- } from '../common-components/data/selectors' ;
22
19
import messages from '../common-components/messages' ;
23
20
import { LOGIN_PAGE , REGISTER_PAGE } from '../data/constants' ;
24
21
import {
@@ -31,11 +28,8 @@ import { backupRegistrationForm, setSimplifyRegExperimentData } from '../registe
31
28
import { FIRST_STEP , SECOND_STEP } from '../register/data/optimizelyExperiment/helper' ;
32
29
33
30
const Logistration = ( props ) => {
34
- const { selectedPage, tpaProviders } = props ;
31
+ const { selectedPage } = props ;
35
32
const tpaHint = getTpaHint ( ) ;
36
- const {
37
- providers, secondaryProviders,
38
- } = tpaProviders ;
39
33
const { formatMessage } = useIntl ( ) ;
40
34
const [ institutionLogin , setInstitutionLogin ] = useState ( false ) ;
41
35
const [ key , setKey ] = useState ( '' ) ;
@@ -44,7 +38,10 @@ const Logistration = (props) => {
44
38
const hideRegistrationLink = getConfig ( ) . SHOW_REGISTRATION_LINKS === false ;
45
39
46
40
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 ) ;
48
45
49
46
useEffect ( ( ) => {
50
47
const authService = getAuthService ( ) ;
@@ -72,11 +69,11 @@ const Logistration = (props) => {
72
69
73
70
const handleOnSelect = ( tabKey ) => {
74
71
sendTrackEvent ( `edx.bi.${ tabKey . replace ( '/' , '' ) } _form.toggled` , { category : 'user-engagement' } ) ;
75
- props . clearThirdPartyAuthContextErrorMessage ( ) ;
72
+ dispatch ( clearThirdPartyAuthContextErrorMessage ( ) ) ;
76
73
if ( tabKey === LOGIN_PAGE ) {
77
- props . backupRegistrationForm ( ) ;
74
+ dispatch ( backupRegistrationForm ( ) ) ;
78
75
} else if ( tabKey === REGISTER_PAGE ) {
79
- props . backupLoginForm ( ) ;
76
+ dispatch ( backupLoginForm ( ) ) ;
80
77
}
81
78
setKey ( tabKey ) ;
82
79
} ;
@@ -184,35 +181,10 @@ const Logistration = (props) => {
184
181
185
182
Logistration . propTypes = {
186
183
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
- } ,
201
184
} ;
202
185
203
186
Logistration . defaultProps = {
204
187
selectedPage : REGISTER_PAGE ,
205
188
} ;
206
189
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