Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
fix(client): propagate metrics context data to /account/reset (#226) …
Browse files Browse the repository at this point in the history
…r=vladikoff
  • Loading branch information
philbooth authored and vladikoff committed Dec 1, 2016
1 parent 0d9fa4c commit e630a03
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions client/FxAccountClient.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -530,6 +530,9 @@ define([
* is required if `options.keys` is true. * is required if `options.keys` is true.
* @param {Boolean} [options.sessionToken] * @param {Boolean} [options.sessionToken]
* If `true`, a new `sessionToken` is provisioned. * 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 * @return {Promise} A promise that will be fulfilled with JSON `xhr.responseText` of the request
*/ */
FxAccountClient.prototype.accountReset = function(email, newPassword, accountResetToken, options) { FxAccountClient.prototype.accountReset = function(email, newPassword, accountResetToken, options) {
Expand All @@ -543,6 +546,10 @@ define([
data.sessionToken = options.sessionToken; data.sessionToken = options.sessionToken;
} }


if (options.metricsContext) {
data.metricsContext = metricsContext.marshall(options.metricsContext);
}

required(email, 'email'); required(email, 'email');
required(newPassword, 'new password'); required(newPassword, 'new password');
required(accountResetToken, 'accountResetToken'); required(accountResetToken, 'accountResetToken');
Expand Down
9 changes: 8 additions & 1 deletion tests/lib/account.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -154,7 +154,14 @@ define([
var newPassword = 'newturles'; var newPassword = 'newturles';
assert.ok(accountResetToken, 'accountResetToken is returned'); 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( .then(
function (result) { function (result) {
Expand Down

0 comments on commit e630a03

Please sign in to comment.