diff --git a/release-notes/RELEASE_NOTES_NEXT.md b/release-notes/RELEASE_NOTES_NEXT.md index 8f693dbb..56194397 100644 --- a/release-notes/RELEASE_NOTES_NEXT.md +++ b/release-notes/RELEASE_NOTES_NEXT.md @@ -1,6 +1,6 @@ # KBase kbase-ui NEXT Release Notes -none +The main change here is to update the call to Google Analytics to anonymize the user id sent. ## CHANGES @@ -18,7 +18,7 @@ none ### IMPROVEMENTS -none +- UIP-35: sends an anonymous id to Google Analytics instead of a user name ### FIXES diff --git a/src/client/js/gtagSupport.js b/src/client/js/gtagSupport.js index e55c3992..19fd97c2 100644 --- a/src/client/js/gtagSupport.js +++ b/src/client/js/gtagSupport.js @@ -319,7 +319,7 @@ function main() { const auth = await getAuth(); if (auth) { - pageView.user_id = auth.user; + pageView.user_id = auth.anonid; } pushGTag('event', 'page_view', pageView); diff --git a/src/client/modules/app/services/europa.ts b/src/client/modules/app/services/europa.ts new file mode 100644 index 00000000..c9ce7dee --- /dev/null +++ b/src/client/modules/app/services/europa.ts @@ -0,0 +1,45 @@ +import { Runtime } from '../../lib/types'; + +// TODO: DO NOT MERGE WITHOUT SAFER TARGET ORIGIN +const europaTargetOrigin = '*'; // 'https://ci-europa.kbase.us' + +export const initEuropa = (runtime: Runtime) => { + runtime.receive('app', 'route-component', (payload) => { + if (window.parent) { + window.parent.postMessage( + { source: 'kbase-ui.app.route-component', payload }, + europaTargetOrigin + ); + } + }); + runtime.receive('ui', 'setTitle', (payload) => { + if (window.parent) { + window.parent.postMessage( + { source: 'kbase-ui.ui.setTitle', payload }, + europaTargetOrigin + ); + } + }); + runtime.receive('session', 'loggedin', () => { + if (window.parent) { + window.parent.postMessage( + { + source: 'kbase-ui.session.loggedin', + payload: { + token: runtime.service('session').getAuthToken(), + }, + }, + europaTargetOrigin + ); + } + }); + window.addEventListener('message', (message) => { + if (message.source !== window.parent) return; + if ( + message?.data?.source && + message?.data?.source == 'europa.navigate' + ) { + runtime.send('app', 'navigate', message.data.payload); + } + }); +}; diff --git a/src/client/modules/app/services/route.ts b/src/client/modules/app/services/route.ts index 4b5f7ae9..ab6bc83c 100644 --- a/src/client/modules/app/services/route.ts +++ b/src/client/modules/app/services/route.ts @@ -11,6 +11,7 @@ import { RoutingLocation, } from "./router"; import { Receiver, Runtime, Service, SimpleMap } from "../../lib/types"; +import { initEuropa } from "./europa"; type RouteHandler = RoutedRequest; @@ -71,6 +72,7 @@ export class RouteService extends Service { this.currentRouteHandler = null; this.receivers = []; this.eventListeners = []; + initEuropa(this.runtime); } doRoute() { diff --git a/src/client/modules/lib/kb_lib/Auth2Session.ts b/src/client/modules/lib/kb_lib/Auth2Session.ts index c0e1a2f2..f9d613a5 100644 --- a/src/client/modules/lib/kb_lib/Auth2Session.ts +++ b/src/client/modules/lib/kb_lib/Auth2Session.ts @@ -674,19 +674,6 @@ export class Auth2Session { new Cookie(this.cookieName, '').setPath('/') ); - // Also remove the domain level cookie in case it was in advertently - // created. This can be a cause for a corrupt token, since the old auth - // system tokens are invalid, and it could create domain level cookies. - // New auth code does not (other than the backup cookie.) - const domainParts = window.location.hostname.split('.'); - let domain; - for (let len = 2; len <= domainParts.length; len += 1) { - domain = domainParts.slice(-len).join('.'); - this.cookieManager.removeItem( - new Cookie(this.cookieName, '').setPath('/').setDomain(domain) - ); - } - if (this.extraCookies) { this.extraCookies.forEach((cookieConfig) => { this.cookieManager.removeItem( diff --git a/src/client/modules/lib/messenger.ts b/src/client/modules/lib/messenger.ts index b6b4c1c4..adfe5903 100644 --- a/src/client/modules/lib/messenger.ts +++ b/src/client/modules/lib/messenger.ts @@ -131,6 +131,9 @@ export class Messenger { const channelName = publishDef.channel; const message = publishDef.message; + const console_workaround = console; + console_workaround.log("Messenger.send",publishDef) + const channel = this.channels.get(channelName); if (!channel) { return; diff --git a/src/client/modules/pluginSupport/AutoPostForm.js b/src/client/modules/pluginSupport/AutoPostForm.js index 694c3dad..316522f4 100644 --- a/src/client/modules/pluginSupport/AutoPostForm.js +++ b/src/client/modules/pluginSupport/AutoPostForm.js @@ -41,6 +41,7 @@ define([ return html`
.-content { flex: 1 1 0px; display: flex; @@ -136,7 +140,7 @@ /* Navbar */ -/* +/* * Main Navigation Bar */ @@ -245,8 +249,8 @@ /* Body */ -/* Tweak navbar, sidebar and main content areas to fit together -The navbar and sidebar are fixed -- so out of flow and need absolute positioning +/* Tweak navbar, sidebar and main content areas to fit together +The navbar and sidebar are fixed -- so out of flow and need absolute positioning Although the sidebar is partially positioned with part of the navbar. The content area is normal flow and just needs to have a matching top margin. */