web-manager 3.1.2 → 3.1.6
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/account.js +49 -12
- package/package.json +1 -1
package/lib/account.js
CHANGED
@@ -194,9 +194,35 @@ function getMonth(date) {
|
|
194
194
|
return monthNames[date.getMonth()];
|
195
195
|
}
|
196
196
|
|
197
|
-
Account.prototype.
|
197
|
+
Account.prototype._resolveAccount2 = function (firebaseUser, account, options) {
|
198
|
+
// TODO: USE resolve-account library Instead
|
199
|
+
|
200
|
+
/*
|
201
|
+
const resolver = new (require('resolve-account'))({
|
202
|
+
Manager: self.Manager,
|
203
|
+
utilities: utilities,
|
204
|
+
dom: dom,
|
205
|
+
});
|
206
|
+
|
207
|
+
|
208
|
+
self.properties = resolver.resolve(firebaseUser, account, options)
|
209
|
+
|
210
|
+
return self.properties;
|
211
|
+
|
212
|
+
*/
|
213
|
+
|
214
|
+
}
|
215
|
+
|
216
|
+
/*
|
217
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
218
|
+
THIS HAS BEEN MOVED TO the resolve-account lib
|
219
|
+
still here until figure out how to import resolve-account here
|
220
|
+
any changes to resolve-account must go here too
|
221
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
222
|
+
*/
|
223
|
+
Account.prototype._resolveAccount = function (firebaseUser, account, options) {
|
198
224
|
var self = this;
|
199
|
-
|
225
|
+
firebaseUser = firebaseUser || {};
|
200
226
|
account = account || {};
|
201
227
|
options = options || {};
|
202
228
|
|
@@ -207,8 +233,8 @@ Account.prototype._resolveAccount = function (currentUser, account, options) {
|
|
207
233
|
|
208
234
|
// Resolve auth
|
209
235
|
account.auth = account.auth || {};
|
210
|
-
account.auth.email = account.auth.email ||
|
211
|
-
account.auth.uid = account.auth.uid ||
|
236
|
+
account.auth.email = account.auth.email || firebaseUser.email || null;
|
237
|
+
account.auth.uid = account.auth.uid || firebaseUser.uid || null;
|
212
238
|
account.auth.temporary = account.auth.temporary || false;
|
213
239
|
|
214
240
|
// Resolve plan
|
@@ -256,7 +282,9 @@ Account.prototype._resolveAccount = function (currentUser, account, options) {
|
|
256
282
|
});
|
257
283
|
}
|
258
284
|
} catch (e) {
|
259
|
-
|
285
|
+
if (typeof window !== 'undefined') {
|
286
|
+
console.error('Unable to check query strings', e);
|
287
|
+
}
|
260
288
|
}
|
261
289
|
|
262
290
|
var planExpireDate = new Date(account.plan.expires.timestamp);
|
@@ -274,8 +302,8 @@ Account.prototype._resolveAccount = function (currentUser, account, options) {
|
|
274
302
|
|
275
303
|
// Resolve oAuth2
|
276
304
|
account.oauth2 = account.oauth2 || {};
|
277
|
-
account.oauth2.discord = account.oauth2.discord || {};
|
278
|
-
account.oauth2.discord.user = account.oauth2.discord.user || {};
|
305
|
+
// account.oauth2.discord = account.oauth2.discord || {};
|
306
|
+
// account.oauth2.discord.user = account.oauth2.discord.user || {};
|
279
307
|
|
280
308
|
// Resolve roles
|
281
309
|
account.roles = account.roles || {};
|
@@ -355,8 +383,15 @@ Account.prototype._resolveAccount = function (currentUser, account, options) {
|
|
355
383
|
referralURL.pathname = '/';
|
356
384
|
referralURL.searchParams.set('aff', account.affiliate.code)
|
357
385
|
|
358
|
-
authCreatedEl.setInnerHTML(
|
359
|
-
|
386
|
+
authCreatedEl.setInnerHTML(
|
387
|
+
new Date(
|
388
|
+
parseInt(utilities.get(firebaseUser, 'metadata.a', '0'))
|
389
|
+
)
|
390
|
+
.toLocaleString(undefined, {
|
391
|
+
weekday: 'long', year: 'numeric', month: 'long', day: 'numeric',
|
392
|
+
})
|
393
|
+
)
|
394
|
+
authPhoneInput.setInnerHTML(firebaseUser.phoneNumber).setValue(firebaseUser.phoneNumber)
|
360
395
|
|
361
396
|
billingSubscribeBtn.setAttribute('hidden', true);
|
362
397
|
billingUpdateBtn.setAttribute('hidden', true);
|
@@ -365,8 +400,8 @@ Account.prototype._resolveAccount = function (currentUser, account, options) {
|
|
365
400
|
updateURL.searchParams.set('appName', utilities.get(self.Manager, 'properties.global.brand.name', 'Unknown'));
|
366
401
|
updateURL.searchParams.set('supportUrl', currentURL.origin + '/support');
|
367
402
|
updateURL.searchParams.set('supportEmail', utilities.get(self.Manager, 'properties.contact.emailSupport', 'unknown@email.com'));
|
368
|
-
updateURL.searchParams.set('userEmail',
|
369
|
-
updateURL.searchParams.set('userId',
|
403
|
+
updateURL.searchParams.set('userEmail', firebaseUser.email);
|
404
|
+
updateURL.searchParams.set('userId', firebaseUser.uid);
|
370
405
|
updateURL.searchParams.set('orderId', account.plan.payment.orderId);
|
371
406
|
updateURL.searchParams.set('resourceId', account.plan.payment.resourceId);
|
372
407
|
billingUpdateBtn.removeAttribute('hidden').setAttribute('href', updateURL.toString());
|
@@ -416,7 +451,9 @@ Account.prototype._resolveAccount = function (currentUser, account, options) {
|
|
416
451
|
})
|
417
452
|
|
418
453
|
} catch (e) {
|
419
|
-
|
454
|
+
if (typeof window !== 'undefined') {
|
455
|
+
console.error('Unable to set DOM elements', e);
|
456
|
+
}
|
420
457
|
}
|
421
458
|
|
422
459
|
self.properties = account;
|
package/package.json
CHANGED