web-manager 3.2.21 → 3.2.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/lib/account.js +19 -1
  2. package/package.json +1 -1
package/lib/account.js CHANGED
@@ -180,6 +180,12 @@ function handlePlanVisibility(planId) {
180
180
  });
181
181
  }
182
182
 
183
+ function splitDashesAndUppercase(str) {
184
+ return str.split('-').map(function (word) {
185
+ return uppercase(word);
186
+ }).join(' ');
187
+ }
188
+
183
189
  function uppercase(str) {
184
190
  return str.charAt(0).toUpperCase() + str.slice(1);
185
191
  }
@@ -363,6 +369,18 @@ Account.prototype._resolveAccount = function (firebaseUser, account, options) {
363
369
  account.api.clientId = account.api.clientId || 'unknown';
364
370
  account.api.privateKey = account.api.privateKey || 'unknown';
365
371
 
372
+ // Usage
373
+ account.usage = account.usage || {};
374
+
375
+ account.usage.requests = account.usage.requests || {};
376
+ account.usage.requests.total = account.usage.requests.total || 0;
377
+ account.usage.requests.period = account.usage.requests.period || 0;
378
+
379
+ account.usage.requests.last = account.usage.requests.last || {};
380
+ account.usage.requests.last.id = account.usage.requests.last.id || '';
381
+ account.usage.requests.last.timestamp = account.usage.requests.last.timestamp || '1970-01-01T00:00:00.000Z';
382
+ account.usage.requests.last.timestampUNIX = account.usage.requests.last.timestampUNIX || 0;
383
+
366
384
  // Personal
367
385
  account.personal = account.personal || {};
368
386
 
@@ -464,7 +482,7 @@ Account.prototype._resolveAccount = function (firebaseUser, account, options) {
464
482
  }
465
483
 
466
484
  // Update billing UI
467
- billingPlanId.setInnerHTML(uppercase(account.plan.id));
485
+ billingPlanId.setInnerHTML(splitDashesAndUppercase(account.plan.id));
468
486
  billingFrequencyEl.setInnerHTML(account.plan.id !== defaultPlanId ? ' (billed ' + uppercase(account.plan.payment.frequency) + ')' : '');
469
487
  billingStartDateEl.setInnerHTML(account.plan.id !== defaultPlanId ? ' - Purchased ' + getMonth(startDate) + ' ' + startDate.getDate() + ', ' + startDate.getFullYear() : '');
470
488
  billingExpirationDateEl.setInnerHTML(account.plan.id !== defaultPlanId && daysTillExpire < 366
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-manager",
3
- "version": "3.2.21",
3
+ "version": "3.2.23",
4
4
  "description": "Easily access important variables such as the query string, current domain, and current page in a single object.",
5
5
  "main": "index.js",
6
6
  "scripts": {