From f5bf41a18156d96977cc400e84eb7d7cb3910a90 Mon Sep 17 00:00:00 2001 From: Evan Morikawa Date: Tue, 30 Aug 2016 10:41:31 -0700 Subject: [PATCH] fix(onboarding): fix injected js error and pass N1 version --- internal_packages/onboarding/lib/page-authenticate.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal_packages/onboarding/lib/page-authenticate.jsx b/internal_packages/onboarding/lib/page-authenticate.jsx index c230d7e22..3e3f7ce9e 100644 --- a/internal_packages/onboarding/lib/page-authenticate.jsx +++ b/internal_packages/onboarding/lib/page-authenticate.jsx @@ -81,7 +81,8 @@ export default class AuthenticatePage extends React.Component { componentDidMount() { const webview = ReactDOM.findDOMNode(this.refs.webview); - webview.src = `${IdentityStore.URLRoot}/onboarding?utm_medium=N1&utm_source=OnboardingPage`; + const n1Version = NylasEnv.getVersion(); + webview.src = `${IdentityStore.URLRoot}/onboarding?utm_medium=N1&utm_source=OnboardingPage&N1_version=${n1Version}`; webview.addEventListener('did-start-loading', this.webviewDidStartLoading); webview.addEventListener('did-get-response-details', this.webviewDidGetResponseDetails); webview.addEventListener('did-fail-load', this.webviewDidFailLoad); @@ -130,7 +131,8 @@ export default class AuthenticatePage extends React.Component { const js = ` var a = document.querySelector('#pro-account'); result = a ? a.innerText : null; - document.querySelector('.open-external').addEventListener('click', function(event) {console.log(this.href); event.preventDefault(); return false;}) + var el = document.querySelector('.open-external'); + if (el) {el.addEventListener('click', function(event) {console.log(this.href); event.preventDefault(); return false;})} `; const webview = ReactDOM.findDOMNode(this.refs.webview);