web-manager 3.2.41 → 3.2.43
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +15 -5
- package/lib/account.js +6 -5
- package/package.json +1 -1
package/index.js
CHANGED
@@ -87,6 +87,7 @@ function Manager() {
|
|
87
87
|
global: {
|
88
88
|
version: '',
|
89
89
|
url: '',
|
90
|
+
buildTime: 0,
|
90
91
|
cacheBreaker: '',
|
91
92
|
brand: {
|
92
93
|
name: 'default'
|
@@ -555,6 +556,7 @@ function Manager() {
|
|
555
556
|
self.properties.global.app = configuration.global.app;
|
556
557
|
self.properties.global.version = configuration.global.version;
|
557
558
|
self.properties.global.url = configuration.global.url;
|
559
|
+
self.properties.global.buildTime = new Date(+configuration.global.buildTime * 1000);
|
558
560
|
self.properties.global.cacheBreaker = configuration.global.cacheBreaker;
|
559
561
|
|
560
562
|
self.properties.global.brand = configuration.global.brand;
|
@@ -1192,7 +1194,8 @@ function Manager() {
|
|
1192
1194
|
function refreshNewVersion(self) {
|
1193
1195
|
console.log('refreshNewVersion()');
|
1194
1196
|
|
1195
|
-
|
1197
|
+
// Make request to get the build time (live)
|
1198
|
+
fetch('/@output/build/build.json?cb=' + new Date().getTime())
|
1196
1199
|
.then(function (res) {
|
1197
1200
|
if (res.ok) {
|
1198
1201
|
return res.json();
|
@@ -1201,15 +1204,22 @@ function Manager() {
|
|
1201
1204
|
}
|
1202
1205
|
})
|
1203
1206
|
.then(function (data) {
|
1204
|
-
var
|
1205
|
-
var
|
1207
|
+
var buildTimeCurrent = self.properties.global.buildTime;
|
1208
|
+
var buildTimeLive = new Date(data['npm-build'].timestamp);
|
1206
1209
|
|
1207
|
-
|
1208
|
-
|
1210
|
+
// Log
|
1211
|
+
console.log('refreshNewVersion()', data, buildTimeCurrent, buildTimeLive);
|
1209
1212
|
|
1213
|
+
// If the live time is newer, refresh
|
1214
|
+
if (buildTimeCurrent < buildTimeLive) {
|
1215
|
+
console.log('refreshNewVersion(): Refreshing...');
|
1216
|
+
|
1217
|
+
// Force page reload
|
1210
1218
|
window.onbeforeunload = function () {
|
1211
1219
|
return undefined;
|
1212
1220
|
}
|
1221
|
+
|
1222
|
+
// Refresh
|
1213
1223
|
window.location.reload(true);
|
1214
1224
|
}
|
1215
1225
|
})
|
package/lib/account.js
CHANGED
@@ -450,6 +450,7 @@ Account.prototype._resolveAccount = function (firebaseUser, account, options) {
|
|
450
450
|
|
451
451
|
var updateURL = new URL(cancelURL);
|
452
452
|
var referralURL = new URL(window.location.origin || window.location.host);
|
453
|
+
var accountCreationDate = new Date(+self.utilities.get(firebaseUser, 'metadata.createdAt', '0'));
|
453
454
|
|
454
455
|
function _setAuthItem(selector, value) {
|
455
456
|
self.dom.select(selector).each(function(e, i) {
|
@@ -465,9 +466,9 @@ Account.prototype._resolveAccount = function (firebaseUser, account, options) {
|
|
465
466
|
referralURL.searchParams.set('aff', account.affiliate.code)
|
466
467
|
|
467
468
|
authCreatedEl.setInnerHTML(
|
468
|
-
new Date(
|
469
|
+
new Date(accountCreationDate)
|
469
470
|
.toLocaleString(undefined, {
|
470
|
-
|
471
|
+
year: 'numeric', month: 'long', day: 'numeric',
|
471
472
|
})
|
472
473
|
)
|
473
474
|
authPhoneInput.setInnerHTML(firebaseUser.phoneNumber).setValue(firebaseUser.phoneNumber)
|
@@ -509,9 +510,9 @@ Account.prototype._resolveAccount = function (firebaseUser, account, options) {
|
|
509
510
|
var visibleStatus = uppercase(account.plan.status === 'suspended' ? 'failed payment' : account.plan.status);
|
510
511
|
// If user is on trial, start date is trial exp date
|
511
512
|
var visibleStartDate = account.plan.trial.activated ? account.plan.trial.expires.timestamp : account.plan.payment.startDate.timestamp;
|
513
|
+
// If basic, just show account creation date
|
512
514
|
if (isBasicPlan) {
|
513
|
-
|
514
|
-
visibleStartDate = new Date(now.getFullYear(), now.getMonth(), 1).toISOString();
|
515
|
+
visibleStartDate = accountCreationDate;
|
515
516
|
}
|
516
517
|
var visibleFrequency = account.plan.payment.frequency === 'unknown' ? 'monthly' : account.plan.payment.frequency;
|
517
518
|
|
@@ -528,7 +529,7 @@ Account.prototype._resolveAccount = function (firebaseUser, account, options) {
|
|
528
529
|
billingStatusColorEl.addClass('bg-soft-danger').addClass('text-danger');
|
529
530
|
}
|
530
531
|
billingStartDateEl.setInnerHTML(new Date(visibleStartDate).toLocaleString(undefined, {
|
531
|
-
|
532
|
+
year: 'numeric', month: 'long', day: 'numeric',
|
532
533
|
}));
|
533
534
|
billingExpirationDateEl.setInnerHTML(isBasicPlan && daysTillExpire < 366
|
534
535
|
? '<i class="fas fa-exclamation-triangle mr-1"></i> Expires in ' + daysTillExpire + ' days '
|
package/package.json
CHANGED