@heroku/ember-backboard
Advanced tools
Comparing version 1.7.1 to 1.8.0
import { getOwner } from '@ember/application'; | ||
import { computed } from '@ember/object'; | ||
import { isEmpty } from '@ember/utils'; | ||
import Service from '@ember/service'; | ||
export default Service.extend({ | ||
accountId: null, | ||
export default class Analytics extends Service { | ||
accountId = null; | ||
backboardUrl: computed(function() { | ||
get backboardUrl() { | ||
const config = getOwner(this).resolveRegistration('config:environment'); | ||
return config && config.backboardUrl; | ||
}), | ||
} | ||
source: computed(function() { | ||
get source() { | ||
const config = getOwner(this).resolveRegistration('config:environment'); | ||
return config && config.backboardSourceName; | ||
}), | ||
} | ||
@@ -27,4 +26,4 @@ /** | ||
trackUser(account) { | ||
this.set('accountId', account.get('id')); | ||
}, | ||
this.accountId = account.id; | ||
} | ||
@@ -39,3 +38,3 @@ /** | ||
logEvent(noun, action, properties = {}) { | ||
const userId = this.get('accountId'); | ||
const userId = this.accountId; | ||
if (isEmpty(userId)) { | ||
@@ -48,3 +47,3 @@ // this scenario, at a minimum, happens during the OAuth redirect login | ||
const source = this.get('source'); | ||
const source = this.source; | ||
@@ -55,3 +54,5 @@ const event = `${noun} ${action}`; | ||
const routerService = getOwner(this).lookup('service:router'); | ||
properties.route = routerService ? routerService.currentPath : window.location.pathname; | ||
properties.route = routerService | ||
? routerService.currentPath | ||
: window.location.pathname; | ||
@@ -64,3 +65,6 @@ const url = this._sanitize(window.location.href); // this includes proto and domain | ||
const page = { url, path, search, title, referrer }; | ||
const connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection; | ||
const connection = | ||
navigator.connection || | ||
navigator.mozConnection || | ||
navigator.webkitConnection; | ||
if (connection) { | ||
@@ -71,6 +75,6 @@ properties.effectiveNetworkType = connection.effectiveType; | ||
this._transmit({ source, event, userId, properties, page }); | ||
}, | ||
} | ||
_transmit(payload) { | ||
const backboardUrl = this.get('backboardUrl'); | ||
const backboardUrl = this.backboardUrl; | ||
@@ -88,3 +92,3 @@ // abort this request when backboard is unset | ||
xhr.send(); | ||
}, | ||
} | ||
@@ -94,3 +98,3 @@ _sanitize(str) { | ||
} | ||
}); | ||
} | ||
@@ -109,6 +113,10 @@ // https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#The_Unicode_Problem | ||
// can be fed into btoa. | ||
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, | ||
return btoa( | ||
encodeURIComponent(str).replace( | ||
/%([0-9A-F]{2})/g, | ||
function toSolidBytes(match, p1) { | ||
return String.fromCharCode('0x' + p1); | ||
})); | ||
return String.fromCharCode('0x' + p1); | ||
} | ||
) | ||
); | ||
} |
'use strict'; | ||
module.exports = function(/* environment, appConfig */) { | ||
return { }; | ||
module.exports = function (/* environment, appConfig */) { | ||
return {}; | ||
}; |
'use strict'; | ||
module.exports = { | ||
name: require('./package').name | ||
name: require('./package').name, | ||
}; |
{ | ||
"name": "@heroku/ember-backboard", | ||
"version": "1.7.1", | ||
"version": "1.8.0", | ||
"description": "Ember backboard", | ||
@@ -16,4 +16,8 @@ "keywords": [ | ||
"build": "ember build", | ||
"lint": "eslint .", | ||
"lint:fix": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*:fix", | ||
"lint:hbs": "ember-template-lint .", | ||
"lint:js": "eslint .", | ||
"lint:hbs:fix": "ember-template-lint . --fix", | ||
"lint:js": "eslint . --cache", | ||
"lint:js:fix": "eslint . --fix", | ||
"start": "ember serve", | ||
@@ -24,33 +28,44 @@ "test": "ember test", | ||
"dependencies": { | ||
"ember-cli-babel": "^7.4.3" | ||
"ember-cli-babel": "^7.26.6" | ||
}, | ||
"devDependencies": { | ||
"@ember/optional-features": "^0.6.3", | ||
"@babel/eslint-parser": "^7.19.1", | ||
"@ember/optional-features": "^2.0.0", | ||
"@ember/test-helpers": "^2.4.2", | ||
"@embroider/test-setup": "^0.43.5", | ||
"broccoli-asset-rev": "^2.7.0", | ||
"chai-dom": "^1.0.0", | ||
"ember-cli": "~3.4.1", | ||
"ember-cli": "~3.28.6", | ||
"ember-cli-chai": "^0.5.0", | ||
"ember-cli-dependency-checker": "^3.0.0", | ||
"ember-cli-eslint": "^4.2.3", | ||
"ember-cli-htmlbars": "^3.0.0", | ||
"ember-cli-htmlbars-inline-precompile": "^1.0.3", | ||
"ember-cli-inject-live-reload": "^1.8.2", | ||
"ember-cli-template-lint": "^1.0.0-beta.1", | ||
"ember-cli-uglify": "^2.1.0", | ||
"ember-cli-htmlbars": "^5.7.1", | ||
"ember-cli-inject-live-reload": "^2.1.0", | ||
"ember-cli-terser": "^4.0.2", | ||
"ember-disable-prototype-extensions": "^1.1.3", | ||
"ember-export-application-global": "^2.0.0", | ||
"ember-load-initializers": "^1.1.0", | ||
"ember-load-initializers": "^2.1.2", | ||
"ember-maybe-import-regenerator": "^0.1.6", | ||
"ember-mocha": "^0.16.1", | ||
"ember-resolver": "^5.0.1", | ||
"ember-source": "~3.4.0", | ||
"ember-source-channel-url": "^1.1.0", | ||
"ember-page-title": "^6.2.2", | ||
"ember-resolver": "^8.0.2", | ||
"ember-source": "~3.28.11", | ||
"ember-source-channel-url": "^3.0.0", | ||
"ember-template-lint": "^5.3.3", | ||
"ember-try": "^1.0.0", | ||
"eslint-plugin-ember": "^5.2.0", | ||
"eslint-plugin-node": "^7.0.1", | ||
"loader.js": "^4.7.0" | ||
"eslint": "^8.33.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-ember": "^10.5.4", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^3.4.1", | ||
"eslint-plugin-qunit": "^6.2.0", | ||
"loader.js": "^4.7.0", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.3.2" | ||
}, | ||
"engines": { | ||
"node": "10.24.1" | ||
"node": "14.x || 16.x" | ||
}, | ||
"ember": { | ||
"edition": "octane" | ||
}, | ||
"ember-addon": { | ||
@@ -57,0 +72,0 @@ "configPath": "tests/dummy/config" |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
133
7808
32
8
Updatedember-cli-babel@^7.26.6