web-manager 3.1.29 → 3.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -1
- package/lib/account.js +29 -12
- package/package.json +2 -2
package/index.js
CHANGED
@@ -244,6 +244,7 @@ function Manager() {
|
|
244
244
|
user.getIdToken(false)
|
245
245
|
.then(function(token) {
|
246
246
|
var done;
|
247
|
+
|
247
248
|
fetch('https://us-central1-' + This.properties.options.libraries.firebase_app.config.projectId + '.cloudfunctions.net/bm_api', {
|
248
249
|
method: 'POST',
|
249
250
|
body: JSON.stringify({
|
@@ -252,7 +253,7 @@ function Manager() {
|
|
252
253
|
payload: {
|
253
254
|
newsletterSignUp: select('.auth-newsletter-input').getValue(),
|
254
255
|
affiliateCode: This.storage().get('auth.affiliateCode', ''),
|
255
|
-
}
|
256
|
+
},
|
256
257
|
}),
|
257
258
|
})
|
258
259
|
.catch(function () {})
|
package/lib/account.js
CHANGED
@@ -210,7 +210,7 @@ Account.prototype._resolveAccount2 = function (firebaseUser, account, options) {
|
|
210
210
|
*/
|
211
211
|
Account.prototype._resolveAccount = function (firebaseUser, account, options) {
|
212
212
|
var self = this;
|
213
|
-
|
213
|
+
|
214
214
|
firebaseUser = firebaseUser || {};
|
215
215
|
account = account || {};
|
216
216
|
options = options || {};
|
@@ -229,9 +229,17 @@ Account.prototype._resolveAccount = function (firebaseUser, account, options) {
|
|
229
229
|
// Resolve plan
|
230
230
|
account.plan = account.plan || {};
|
231
231
|
account.plan.id = account.plan.id || defaultPlanId;
|
232
|
+
|
232
233
|
account.plan.expires = account.plan.expires || {};
|
233
234
|
account.plan.expires.timestamp = new Date(account.plan.expires.timestamp || 0).toISOString();
|
234
235
|
account.plan.expires.timestampUNIX = Math.round(new Date(account.plan.expires.timestamp || 0).getTime() / 1000);
|
236
|
+
|
237
|
+
account.plan.trial = account.plan.trial || {};
|
238
|
+
account.plan.trial.activated = account.plan.trial.activated || false;
|
239
|
+
account.plan.trial.expires = account.plan.trial.expires || {};
|
240
|
+
account.plan.trial.expires.timestamp = new Date(account.plan.trial.expires.timestamp || 0).toISOString()
|
241
|
+
account.plan.trial.expires.timestampUNIX = Math.round(new Date(account.plan.trial.expires.timestamp || 0).getTime() / 1000);
|
242
|
+
|
235
243
|
account.plan.limits = account.plan.limits || {};
|
236
244
|
// account.plan.devices = account.plan.devices || 1;
|
237
245
|
|
@@ -279,7 +287,7 @@ Account.prototype._resolveAccount = function (firebaseUser, account, options) {
|
|
279
287
|
var planExpireDate = new Date(account.plan.expires.timestamp);
|
280
288
|
var now = new Date();
|
281
289
|
var daysTillExpire = Math.floor((planExpireDate - now) / 86400000);
|
282
|
-
var difference = (planExpireDate.getTime() - now.getTime())/(24*3600*1000);
|
290
|
+
var difference = (planExpireDate.getTime() - now.getTime()) / (24 * 3600 * 1000);
|
283
291
|
var startDate = new Date(account.plan.payment.startDate.timestamp);
|
284
292
|
var planIsActive = difference > -1 && account.plan.id !== defaultPlanId;
|
285
293
|
|
@@ -320,6 +328,17 @@ Account.prototype._resolveAccount = function (firebaseUser, account, options) {
|
|
320
328
|
account.activity.created.timestamp = account.activity.created.timestamp || '1970-01-01T00:00:00.000Z';
|
321
329
|
account.activity.created.timestampUNIX = account.activity.created.timestampUNIX || 0;
|
322
330
|
|
331
|
+
account.activity.geolocation = account.activity.geolocation || {};
|
332
|
+
account.activity.geolocation.ip = account.activity.geolocation.ip || 'unknown';
|
333
|
+
account.activity.geolocation.continent = account.activity.geolocation.continent || 'unknown';
|
334
|
+
account.activity.geolocation.country = account.activity.geolocation.country || 'unknown';
|
335
|
+
account.activity.geolocation.city = account.activity.geolocation.city || 'unknown';
|
336
|
+
account.activity.geolocation.latitude = account.activity.geolocation.latitude || 'unknown';
|
337
|
+
account.activity.geolocation.longitude = account.activity.geolocation.longitude || 'unknown';
|
338
|
+
account.activity.geolocation.userAgent = account.activity.geolocation.userAgent || 'unknown';
|
339
|
+
account.activity.geolocation.language = account.activity.geolocation.language || 'unknown';
|
340
|
+
account.activity.geolocation.platform = account.activity.geolocation.platform || 'unknown';
|
341
|
+
|
323
342
|
// Api
|
324
343
|
account.api = account.api || {};
|
325
344
|
account.api.clientId = account.api.clientId || 'unknown';
|
@@ -328,14 +347,6 @@ Account.prototype._resolveAccount = function (firebaseUser, account, options) {
|
|
328
347
|
// Personal
|
329
348
|
account.personal = account.personal || {};
|
330
349
|
|
331
|
-
account.personal.name = account.personal.name || {};
|
332
|
-
account.personal.name.first = account.personal.name.first || '';
|
333
|
-
account.personal.name.last = account.personal.name.last || '';
|
334
|
-
|
335
|
-
account.personal.telephone = account.personal.telephone || {};
|
336
|
-
account.personal.telephone.countryCode = account.personal.telephone.countryCode || 0;
|
337
|
-
account.personal.telephone.national = account.personal.telephone.national || 0;
|
338
|
-
|
339
350
|
account.personal.birthday = account.personal.birthday || {};
|
340
351
|
account.personal.birthday.timestamp = account.personal.birthday.timestamp || '1970-01-01T00:00:00.000Z';
|
341
352
|
account.personal.birthday.timestampUNIX = account.personal.birthday.timestampUNIX || 0;
|
@@ -343,14 +354,20 @@ Account.prototype._resolveAccount = function (firebaseUser, account, options) {
|
|
343
354
|
account.personal.gender = account.personal.gender || '';
|
344
355
|
|
345
356
|
account.personal.location = account.personal.location || {};
|
357
|
+
account.personal.location.city = account.personal.location.city || '';
|
346
358
|
account.personal.location.country = account.personal.location.country || '';
|
347
359
|
|
360
|
+
account.personal.name = account.personal.name || {};
|
361
|
+
account.personal.name.first = account.personal.name.first || '';
|
362
|
+
account.personal.name.last = account.personal.name.last || '';
|
363
|
+
|
364
|
+
account.personal.telephone = account.personal.telephone || {};
|
365
|
+
account.personal.telephone.countryCode = account.personal.telephone.countryCode || 0;
|
366
|
+
account.personal.telephone.national = account.personal.telephone.national || 0;
|
348
367
|
|
349
368
|
// Set UI elements
|
350
369
|
// In a try/catch because this lib is used in node sometimes
|
351
370
|
try {
|
352
|
-
// var apiLinkURL = isDevelopment ? 'http://localhost:5000/discord-link' : 'https://api.{{ site.brand.name }}.com/discord-link';
|
353
|
-
// var apiUnlinkURL = isDevelopment ? 'http://localhost:5000/discord-unlink' : 'https://api.{{ site.brand.name }}.com/discord-unlink';
|
354
371
|
var cancelURL = isDevelopment ? 'http://localhost:4001/cancel/' : 'https://itwcreativeworks.com/portal/account/manage/';
|
355
372
|
|
356
373
|
var billingSubscribeBtn = self.dom.select('.auth-billing-subscribe-btn');
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "web-manager",
|
3
|
-
"version": "3.1.
|
3
|
+
"version": "3.1.31",
|
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": {
|
@@ -28,4 +28,4 @@
|
|
28
28
|
"firebase": "^8.10.1",
|
29
29
|
"lazysizes": "^5.3.2"
|
30
30
|
}
|
31
|
-
}
|
31
|
+
}
|