@@ -101,14 +101,28 @@ export const Connecting = (props) => {
101101
102102 const statusChanged =
103103 pollingState . previousResponse ?. connection_status !==
104- pollingState . currentResponse ?. connection_status
104+ pollingState . currentResponse ?. connection_status ||
105+ pollingState . previousResponse ?. raw_status !== pollingState . currentResponse ?. raw_status
105106
106107 // if status changes during connecting or timeout send out a post message
107108 if ( pollingState . previousResponse != null && statusChanged ) {
108- postMessageFunctions . onPostMessage ( 'connect/memberStatusUpdate' , {
109+ const eventMetadata = {
109110 member_guid : pollingState . currentResponse . guid ,
110- connection_status : pollingState . currentResponse . connection_status ,
111- } )
111+ user_guid : pollingState . currentResponse . user_guid ,
112+ }
113+ if ( pollingState . currentResponse . aggregator ) {
114+ eventMetadata . aggregator = pollingState . currentResponse . aggregator
115+ }
116+ if ( pollingState . currentResponse . raw_status ) {
117+ eventMetadata . raw_status = pollingState . currentResponse . raw_status
118+ }
119+ if ( pollingState . currentResponse . selected_account_id ) {
120+ eventMetadata . selected_account_id = pollingState . currentResponse . selected_account_id
121+ }
122+ if ( ucpInstitutionId ) {
123+ eventMetadata . ucpInstitutionId = ucpInstitutionId
124+ }
125+ postMessageFunctions . onPostMessage ( 'connect/memberStatusUpdate' , eventMetadata )
112126 }
113127
114128 setMessage ( pollingState . userMessage )
@@ -121,31 +135,36 @@ export const Connecting = (props) => {
121135 // state
122136
123137 // send member connected post message before analytic event, this allows clients to show their own "connected" window before the connect complete step.
124- if ( uiMessageVersion === 4 ) {
125- const event = {
126- user_guid : currentMember . user_guid ,
127- member_guid : currentMember . guid ,
128- }
138+ const eventMetadata = {
139+ member_guid : currentMember . guid ,
140+ user_guid : currentMember . user_guid ,
141+ }
129142
130- if ( currentMember . aggregator ) {
131- event . aggregator = currentMember . aggregator
132- }
143+ if ( currentMember . aggregator ) {
144+ eventMetadata . aggregator = currentMember . aggregator
145+ }
133146
134- if ( ucpInstitutionId ) {
135- event . ucpInstitutionId = ucpInstitutionId
136- }
147+ if ( currentMember . selected_account_id ) {
148+ eventMetadata . selected_account_id = currentMember . selected_account_id
149+ }
150+
151+ if ( currentMember . raw_status ) {
152+ eventMetadata . raw_status = currentMember . raw_status
153+ }
137154
138- postMessageFunctions . onPostMessage ( POST_MESSAGES . MEMBER_CONNECTED , event )
155+ if ( ucpInstitutionId ) {
156+ eventMetadata . ucpInstitutionId = ucpInstitutionId
157+ }
158+
159+ if ( uiMessageVersion === 4 ) {
160+ postMessageFunctions . onPostMessage ( POST_MESSAGES . MEMBER_CONNECTED , eventMetadata )
139161 analyticFunctions . onAnalyticEvent ( `connect_${ POST_MESSAGES . MEMBER_CONNECTED } ` , {
140162 type : connectConfig . is_mobile_webview ? 'url' : 'message' ,
141163 } )
142164 } else if ( hasAtriumAPI && isMobileWebview === true ) {
143165 PostMessage . setWebviewUrl ( `atrium://memberAdded/${ currentMember . guid } ` )
144166 } else {
145- PostMessage . send ( 'mxConnect:memberAdded' , {
146- member_guid : currentMember . guid ,
147- user_guid : currentMember . user_guid ,
148- } )
167+ PostMessage . send ( 'mxConnect:memberAdded' , eventMetadata )
149168 }
150169
151170 fadeOut ( connectingRef . current , 'down' ) . then ( ( ) => {
0 commit comments