diff --git a/package.json b/package.json index 2f26a3b..74bf6d5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@al/core", - "version": "1.2.23", + "version": "1.2.24", "description": "Node Enterprise Packages for Alert Logic (NEPAL) Core Library", "main": "./dist/index.cjs.js", "types": "./dist/index.d.ts", diff --git a/src/session/al-session.ts b/src/session/al-session.ts index 735f24c..da5fdfe 100644 --- a/src/session/al-session.ts +++ b/src/session/al-session.ts @@ -158,6 +158,9 @@ export class AlSessionInstance } this.setTokenInfo( token, expirationTTL ); console.log("Updated AIMS Token to expire in %s seconds from now", offset ); + }, + logging: ( enable:boolean ) => { + AlErrorHandler.verbose = enable; } } ); } diff --git a/src/session/utilities/al-conduit-client.ts b/src/session/utilities/al-conduit-client.ts index 808162a..d794737 100644 --- a/src/session/utilities/al-conduit-client.ts +++ b/src/session/utilities/al-conduit-client.ts @@ -3,12 +3,12 @@ import { AlLocation, AlLocatorService, } from "../../common/navigation"; -import { AlErrorHandler } from '../../error-handler'; import { AlBehaviorPromise } from "../../common/promises"; import { AlStopwatch, AlTriggerStream, } from "../../common/utility"; +import { AlErrorHandler } from '../../error-handler'; import { AlDatacenterSessionErrorEvent, AlDatacenterSessionEstablishedEvent, @@ -71,7 +71,7 @@ export class AlConduitClient } let locationId = AlRuntimeConfiguration.getOption( ConfigOption.NavigationConduitLocation, AlLocation.AccountsUI ); AlConduitClient.conduitUri = AlLocatorService.resolveURL( locationId, '/conduit.html', { residency, environment } ); - console.log(`Notice: conduit client is using '${AlConduitClient.conduitUri}' as target` ); + AlErrorHandler.log( `Notice: conduit client is using '${AlConduitClient.conduitUri}' as target` ); const fragment = AlConduitClient.document.createDocumentFragment(); const container = AlConduitClient.document.createElement( "div" ); container.setAttribute("id", "conduitClient" ); @@ -178,9 +178,9 @@ export class AlConduitClient /** * Deletes existing session information. */ - public deleteSession(): Promise { + public deleteSession() { return this.request('conduit.deleteSession') - .then( () => true ); + .then( () => true ); } /** @@ -264,12 +264,14 @@ export class AlConduitClient } public onConduitReady(event: any ): void { - AlConduitClient.conduitWindow = event.source; - AlConduitClient.conduitOrigin = event.origin; - AlConduitClient.ready.resolve( true ); - if ( typeof( event.data.cookiesDisabled ) === 'boolean' && event.data.cookiesDisabled ) { - console.warn("WARNING: conduit has indicated that 3rd party cookies are disabled, triggering session error event." ); - AlConduitClient.events.trigger( new AlDatacenterSessionErrorEvent( "inapplicable", "cookie-configuration", event.data ) ); + if ( AlConduitClient.conduitUri.startsWith( event.origin ) ) { + AlConduitClient.conduitWindow = event.source; + AlConduitClient.conduitOrigin = event.origin; + AlConduitClient.ready.resolve( true ); + if ( typeof( event.data.cookiesDisabled ) === 'boolean' && event.data.cookiesDisabled ) { + console.warn("WARNING: conduit has indicated that 3rd party cookies are disabled, triggering session error event." ); + AlConduitClient.events.trigger( new AlDatacenterSessionErrorEvent( "inapplicable", "cookie-configuration", event.data ) ); + } } } @@ -298,7 +300,7 @@ export class AlConduitClient if ( typeof( event.data.locationId ) !== 'string' ) { return; } - console.log(`Notice: received external session confirmation for location [${event.data.locationId}]` ); + AlErrorHandler.log( `Notice: received external session confirmation for location [${event.data.locationId}]` ); const session = AlConduitClient.externalSessions.hasOwnProperty( event.data.locationId ) ? AlConduitClient.externalSessions[event.data.locationId] : null; if ( session ) {