web-manager 3.1.4 → 3.1.7

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.
Files changed (2) hide show
  1. package/lib/account.js +39 -11
  2. 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._resolveAccount = function (currentUser, account, options) {
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
- currentUser = currentUser || {};
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 || currentUser.email || null;
211
- account.auth.uid = account.auth.uid || currentUser.uid || null;
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
@@ -276,15 +302,17 @@ Account.prototype._resolveAccount = function (currentUser, account, options) {
276
302
 
277
303
  // Resolve oAuth2
278
304
  account.oauth2 = account.oauth2 || {};
279
- account.oauth2.discord = account.oauth2.discord || {};
280
- account.oauth2.discord.user = account.oauth2.discord.user || {};
305
+ // account.oauth2.discord = account.oauth2.discord || {};
306
+ // account.oauth2.discord.user = account.oauth2.discord.user || {};
281
307
 
282
308
  // Resolve roles
283
309
  account.roles = account.roles || {};
284
- account.roles.betaTester = account.plan.id === defaultPlanId ? false : account.roles.betaTester === true || account.roles.betaTester === 'true';
310
+ // account.roles.betaTester = account.plan.id === defaultPlanId ? false : account.roles.betaTester === true || account.roles.betaTester === 'true';
311
+ account.roles.betaTester = account.roles.betaTester === true || account.roles.betaTester === 'true';
285
312
  account.roles.developer = account.roles.developer === true || account.roles.developer === 'true';
286
313
  account.roles.admin = account.roles.admin === true || account.roles.admin === 'true';
287
314
  account.roles.vip = account.roles.vip === true || account.roles.vip === 'true';
315
+ account.roles.og = account.roles.og === true || account.roles.og === 'true';
288
316
  account.roles.promoExempt = account.roles.promoExempt === true || account.roles.promoExempt === 'true';
289
317
 
290
318
  // Resolve affiliate
@@ -359,13 +387,13 @@ Account.prototype._resolveAccount = function (currentUser, account, options) {
359
387
 
360
388
  authCreatedEl.setInnerHTML(
361
389
  new Date(
362
- parseInt(utilities.get(currentUser, 'metadata.a', '0'))
390
+ parseInt(utilities.get(firebaseUser, 'metadata.a', '0'))
363
391
  )
364
392
  .toLocaleString(undefined, {
365
393
  weekday: 'long', year: 'numeric', month: 'long', day: 'numeric',
366
394
  })
367
395
  )
368
- authPhoneInput.setInnerHTML(currentUser.phoneNumber).setValue(currentUser.phoneNumber)
396
+ authPhoneInput.setInnerHTML(firebaseUser.phoneNumber).setValue(firebaseUser.phoneNumber)
369
397
 
370
398
  billingSubscribeBtn.setAttribute('hidden', true);
371
399
  billingUpdateBtn.setAttribute('hidden', true);
@@ -374,8 +402,8 @@ Account.prototype._resolveAccount = function (currentUser, account, options) {
374
402
  updateURL.searchParams.set('appName', utilities.get(self.Manager, 'properties.global.brand.name', 'Unknown'));
375
403
  updateURL.searchParams.set('supportUrl', currentURL.origin + '/support');
376
404
  updateURL.searchParams.set('supportEmail', utilities.get(self.Manager, 'properties.contact.emailSupport', 'unknown@email.com'));
377
- updateURL.searchParams.set('userEmail', currentUser.email);
378
- updateURL.searchParams.set('userId', currentUser.uid);
405
+ updateURL.searchParams.set('userEmail', firebaseUser.email);
406
+ updateURL.searchParams.set('userId', firebaseUser.uid);
379
407
  updateURL.searchParams.set('orderId', account.plan.payment.orderId);
380
408
  updateURL.searchParams.set('resourceId', account.plan.payment.resourceId);
381
409
  billingUpdateBtn.removeAttribute('hidden').setAttribute('href', updateURL.toString());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-manager",
3
- "version": "3.1.4",
3
+ "version": "3.1.7",
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": {