Permalink
Browse files

fix(client): propagate metrics context data to /account/reset (#226) …

…r=vladikoff
  • Loading branch information...
1 parent 0d9fa4c commit e630a03ab9c58d149605fe4adae5b3953b619e65 @philbooth philbooth committed with vladikoff Dec 1, 2016
Showing with 15 additions and 1 deletion.
  1. +7 −0 client/FxAccountClient.js
  2. +8 −1 tests/lib/account.js
@@ -530,6 +530,9 @@ define([
* is required if `options.keys` is true.
* @param {Boolean} [options.sessionToken]
* If `true`, a new `sessionToken` is provisioned.
+ * @param {Object} [options.metricsContext={}] Metrics context metadata
+ * @param {String} options.metricsContext.flowId identifier for the current event flow
+ * @param {Number} options.metricsContext.flowBeginTime flow.begin event time
* @return {Promise} A promise that will be fulfilled with JSON `xhr.responseText` of the request
*/
FxAccountClient.prototype.accountReset = function(email, newPassword, accountResetToken, options) {
@@ -543,6 +546,10 @@ define([
data.sessionToken = options.sessionToken;
}
+ if (options.metricsContext) {
+ data.metricsContext = metricsContext.marshall(options.metricsContext);
+ }
+
required(email, 'email');
required(newPassword, 'new password');
required(accountResetToken, 'accountResetToken');
@@ -154,7 +154,14 @@ define([
var newPassword = 'newturles';
assert.ok(accountResetToken, 'accountResetToken is returned');
- return respond(client.accountReset(email, newPassword, accountResetToken, { keys: true, sessionToken: true }), RequestMocks.accountReset);
+ return respond(client.accountReset(email, newPassword, accountResetToken, {
+ keys: true,
+ metricsContext: {
+ flowBeginTime: 1480615985437,
+ flowId: '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'
+ },
+ sessionToken: true
+ }), RequestMocks.accountReset);
})
.then(
function (result) {

0 comments on commit e630a03

Please sign in to comment.