src/main/js/oidc-connector.js
/**
     * Handle potential XDM communication from a callback page.
     *
     * @param element
     * @param loginWindow
     * @param callback
     * @param once
     * @param inlineElement
     * @private
     */
Handle potential XDM communication from a callback page.
Handle potential XDM communication from a callback page .
function doHandlePostMessage( { element, loginWindow, callback, once, inlineElement = null } ) {
        function actionCallback( event ) {
            let data = {};
            try {
                data = JSON.parse( event.data ) || {};
            }
            catch ( e ) {
            }
            switch ( data.type ) {
                case XDM_CONSTANTS.BID_ERROR_RECEIVED_XDM_EVENT:
                case XDM_CONSTANTS.BID_RESPONSE_DATA_RECEIVED_XDM_EVENT: {
                    if ( loginWindow ) {
                        loginWindow.close();
                    }
                    if ( inlineElement ) {
                        inlineElement.innerHTML = '';
                    }
                    if ( callback ) {
                        if ( data.error ) {
                            callback( { error: data.error } );
                        }
                        else {
                            callback( null, data.data );
                        }
                    }
                    if ( once ) {
                        element.removeEventListener( 'message', actionCallback );
                    }
                    break;
                }
            }
        }
        element.addEventListener( 'message', actionCallback );
    }
function doHandlePostMessage ( { element , loginWindow , callback , once , inlineElement = null } ) { function actionCallback ( event ) { let data = { } ; try { data = JSON . parse ( event . data ) || { } ; } catch ( e ) { } switch ( data . type ) { case XDM_CONSTANTS . BID_ERROR_RECEIVED_XDM_EVENT : case XDM_CONSTANTS . BID_RESPONSE_DATA_RECEIVED_XDM_EVENT : { if ( loginWindow ) { loginWindow . close ( ) ; } if ( inlineElement ) { inlineElement . innerHTML = '' ; } if ( callback ) { if ( data . error ) { callback ( { error : data . error } ) ; } else { callback ( null , data . data ) ; } } if ( once ) { element . removeEventListener ( 'message' , actionCallback ) ; } break ; } } } element . addEventListener ( 'message' , actionCallback ) ; }
Handle potential XDM communication from a callback page.
Handle potential XDM communication from a callback page .
// ignore // Reset inline element