web-manager 3.2.33 → 3.2.35

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. package/index.js +19 -14
  2. package/lib/account.js +12 -0
  3. package/package.json +2 -2
package/index.js CHANGED
@@ -133,7 +133,7 @@ function Manager() {
133
133
  Manager.prototype.set = function(path, value) {
134
134
  var self = this;
135
135
 
136
- return utilities.set(self, 'properties.' + path, value);
136
+ return utilities.set(self, 'properties.' + path, value);
137
137
  }
138
138
 
139
139
  Manager.prototype.setEventListeners = function() {
@@ -141,23 +141,27 @@ function Manager() {
141
141
 
142
142
  // Setup click handler
143
143
  document.addEventListener('click', function (event) {
144
+ var target = event.target;
145
+
144
146
  // auth events
145
- if (event.target.matches('.auth-signin-email-btn')) {
147
+ if (target.matches('.auth-signin-email-btn')) {
146
148
  self.auth().signIn('email');
147
- } else if (event.target.matches('.auth-signup-email-btn')) {
149
+ } else if (target.matches('.auth-signup-email-btn')) {
148
150
  self.auth().signUp('email');
149
- } else if (event.target.matches('.auth-signin-provider-btn')) {
150
- self.auth().signIn(event.target.getAttribute('data-provider'));
151
- } else if (event.target.matches('.auth-signup-provider-btn')) {
152
- self.auth().signUp(event.target.getAttribute('data-provider'));
153
- } else if (event.target.matches('.auth-signout-all-btn')) {
151
+ } else if (target.matches('.auth-signin-provider-btn')) {
152
+ self.auth().signIn(target.getAttribute('data-provider'));
153
+ } else if (target.matches('.auth-signup-provider-btn')) {
154
+ self.auth().signUp(target.getAttribute('data-provider'));
155
+ } else if (target.matches('.auth-signout-all-btn')) {
154
156
  self.auth().signOut();
155
- } else if (event.target.matches('.auth-forgot-email-btn')) {
157
+ } else if (target.matches('.auth-forgot-email-btn')) {
156
158
  self.auth().forgot();
157
- } else if (event.target.matches('#prechat-btn')) {
159
+ } else if (target.matches('#prechat-btn')) {
158
160
  load_chatsy(self, self.properties.options);
159
- } else if (event.target.matches('.auth-subscribe-notifications-btn')) {
161
+ } else if (target.matches('.auth-subscribe-notifications-btn')) {
160
162
  self.notifications().subscribe()
163
+ } else if (target.matches('.master-alert-close')) {
164
+ target.parentElement.setAttribute('hidden', true);
161
165
  }
162
166
 
163
167
  // Autorequest
@@ -604,10 +608,11 @@ function Manager() {
604
608
  try {
605
609
  if (!self.properties.page.isSupportedBrowser) {
606
610
  var box = document.getElementsByClassName('master-alert-outdated')[0];
607
- box.style.display = 'block';
608
- document.body.insertBefore(box, document.body.firstChild);
611
+ box.removeAttribute('hidden');
609
612
  }
610
- } catch (e) {}
613
+ } catch (e) {
614
+ console.error(e);
615
+ }
611
616
 
612
617
  // run the init callback
613
618
  self.properties.page.status.ready = true;
package/lib/account.js CHANGED
@@ -236,6 +236,9 @@ Account.prototype._resolveAccount = function (firebaseUser, account, options) {
236
236
  var timestampOld = '1970-01-01T00:00:00.000Z';
237
237
  var timestampUNIXOld = 0;
238
238
 
239
+ console.log('++++++account', JSON.stringify(account, null, 2));
240
+ console.log('++++++options', JSON.stringify(options, null, 2));
241
+
239
242
  // Resolve auth
240
243
  account.auth = account.auth || {};
241
244
  account.auth.uid = account.auth.uid || firebaseUser.uid || null;
@@ -491,8 +494,16 @@ Account.prototype._resolveAccount = function (firebaseUser, account, options) {
491
494
  ? '<i class="fas fa-exclamation-triangle mr-1"></i> Expires in ' + daysTillExpire + ' days '
492
495
  : '');
493
496
 
497
+
498
+ // Update payment method UI
499
+ if (account.plan.status === 'suspended') {
500
+ self.dom.select('.master-alert-suspended').removeAttribute('hidden');
501
+ }
502
+
503
+ // Update API UI
494
504
  _setAuthItem('.auth-apikey-element', self.utilities.get(account, 'api.privateKey', 'n/a'));
495
505
 
506
+ // Update referral UI
496
507
  $referralCount.setInnerHTML(account.affiliate.referrals.length);
497
508
  $referralCode.setInnerHTML(account.affiliate.code).setValue(account.affiliate.code);
498
509
  $referralCode.setInnerHTML(referralURL.toString()).setValue(referralURL.toString());
@@ -500,6 +511,7 @@ Account.prototype._resolveAccount = function (firebaseUser, account, options) {
500
511
  var affiliateLinkURI = encodeURIComponent(referralURL.toString());
501
512
  var affiliateLinkTextURI = encodeURIComponent('Sign up for ' + self.utilities.get(self.Manager, 'properties.global.brand.name', 'this') + ', a useful service:');
502
513
 
514
+ // Update social links
503
515
  $referralSocialLink
504
516
  .each(function ($el) {
505
517
  var provider = $el.dataset.provider;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-manager",
3
- "version": "3.2.33",
3
+ "version": "3.2.35",
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": {
@@ -31,7 +31,7 @@
31
31
  }
32
32
  },
33
33
  "dependencies": {
34
- "@sentry/browser": "^7.88.0",
34
+ "@sentry/browser": "^7.98.0",
35
35
  "cookieconsent": "^3.1.1",
36
36
  "firebase": "^9.23.0",
37
37
  "lazysizes": "^5.3.2"