@@ -20,11 +20,17 @@ export default class EmbeddedLoginPrompt {
2020 this . config = config ;
2121 }
2222
23- private getHref = ( ) => (
24- `${ this . config . authenticationDomain } /im-embedded-login-prompt`
23+ private getHref = ( anonymousId ?: string ) => {
24+ let href = `${ this . config . authenticationDomain } /im-embedded-login-prompt`
2525 + `?client_id=${ this . config . oidcConfiguration . clientId } `
26- + `&rid=${ getDetail ( Detail . RUNTIME_ID ) } `
27- ) ;
26+ + `&rid=${ getDetail ( Detail . RUNTIME_ID ) } ` ;
27+
28+ if ( anonymousId ) {
29+ href += `&third_party_a_id=${ anonymousId } ` ;
30+ }
31+
32+ return href ;
33+ } ;
2834
2935 private static appendIFrameStylesIfNeeded = ( ) => {
3036 if ( document . getElementById ( LOGIN_PROMPT_KEYFRAME_STYLES_ID ) ) {
@@ -71,10 +77,10 @@ export default class EmbeddedLoginPrompt {
7177 document . head . appendChild ( style ) ;
7278 } ;
7379
74- private getEmbeddedLoginIFrame = ( ) => {
80+ private getEmbeddedLoginIFrame = ( anonymousId ?: string ) => {
7581 const embeddedLoginPrompt = document . createElement ( 'iframe' ) ;
7682 embeddedLoginPrompt . id = LOGIN_PROMPT_IFRAME_ID ;
77- embeddedLoginPrompt . src = this . getHref ( ) ;
83+ embeddedLoginPrompt . src = this . getHref ( anonymousId ) ;
7884 embeddedLoginPrompt . style . height = '100vh' ;
7985 embeddedLoginPrompt . style . width = '100vw' ;
8086 embeddedLoginPrompt . style . maxHeight = `${ LOGIN_PROMPT_WINDOW_HEIGHT } px` ;
@@ -90,9 +96,9 @@ export default class EmbeddedLoginPrompt {
9096 return embeddedLoginPrompt ;
9197 } ;
9298
93- public displayEmbeddedLoginPrompt ( ) : Promise < EmbeddedLoginPromptResult > {
99+ public displayEmbeddedLoginPrompt ( anonymousId ?: string ) : Promise < EmbeddedLoginPromptResult > {
94100 return new Promise ( ( resolve , reject ) => {
95- const embeddedLoginPrompt = this . getEmbeddedLoginIFrame ( ) ;
101+ const embeddedLoginPrompt = this . getEmbeddedLoginIFrame ( anonymousId ) ;
96102 const messageHandler = ( { data, origin } : MessageEvent ) => {
97103 if (
98104 origin !== this . config . authenticationDomain
0 commit comments