web-manager 3.2.32 → 3.2.34
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +19 -14
- package/lib/account.js +14 -1
- package/package.json +3 -3
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
|
-
|
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 (
|
147
|
+
if (target.matches('.auth-signin-email-btn')) {
|
146
148
|
self.auth().signIn('email');
|
147
|
-
} else if (
|
149
|
+
} else if (target.matches('.auth-signup-email-btn')) {
|
148
150
|
self.auth().signUp('email');
|
149
|
-
} else if (
|
150
|
-
self.auth().signIn(
|
151
|
-
} else if (
|
152
|
-
self.auth().signUp(
|
153
|
-
} else if (
|
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 (
|
157
|
+
} else if (target.matches('.auth-forgot-email-btn')) {
|
156
158
|
self.auth().forgot();
|
157
|
-
} else if (
|
159
|
+
} else if (target.matches('#prechat-btn')) {
|
158
160
|
load_chatsy(self, self.properties.options);
|
159
|
-
} else if (
|
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.
|
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;
|
@@ -407,7 +410,7 @@ Account.prototype._resolveAccount = function (firebaseUser, account, options) {
|
|
407
410
|
// Set UI elements
|
408
411
|
// In a try/catch because this lib is used in node sometimes
|
409
412
|
try {
|
410
|
-
var cancelURL = isDevelopment ? 'http://localhost:4001/cancel' : 'https://itwcreativeworks.com/portal/account/manage';
|
413
|
+
var cancelURL = isDevelopment ? 'http://localhost:4001/cancel' : 'https://itwcreativeworks.com/portal/account/payment/manage';
|
411
414
|
|
412
415
|
var billingSubscribeBtn = self.dom.select('.auth-billing-subscribe-btn');
|
413
416
|
var billingUpdateBtn = self.dom.select('.auth-billing-update-btn');
|
@@ -491,8 +494,17 @@ 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
|
+
account.plan.status = 'suspended'
|
500
|
+
if (account.plan.status === 'suspended') {
|
501
|
+
self.dom.select('.master-alert-suspended').removeAttribute('hidden');
|
502
|
+
}
|
503
|
+
|
504
|
+
// Update API UI
|
494
505
|
_setAuthItem('.auth-apikey-element', self.utilities.get(account, 'api.privateKey', 'n/a'));
|
495
506
|
|
507
|
+
// Update referral UI
|
496
508
|
$referralCount.setInnerHTML(account.affiliate.referrals.length);
|
497
509
|
$referralCode.setInnerHTML(account.affiliate.code).setValue(account.affiliate.code);
|
498
510
|
$referralCode.setInnerHTML(referralURL.toString()).setValue(referralURL.toString());
|
@@ -500,6 +512,7 @@ Account.prototype._resolveAccount = function (firebaseUser, account, options) {
|
|
500
512
|
var affiliateLinkURI = encodeURIComponent(referralURL.toString());
|
501
513
|
var affiliateLinkTextURI = encodeURIComponent('Sign up for ' + self.utilities.get(self.Manager, 'properties.global.brand.name', 'this') + ', a useful service:');
|
502
514
|
|
515
|
+
// Update social links
|
503
516
|
$referralSocialLink
|
504
517
|
.each(function ($el) {
|
505
518
|
var provider = $el.dataset.provider;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "web-manager",
|
3
|
-
"version": "3.2.
|
3
|
+
"version": "3.2.34",
|
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,9 +31,9 @@
|
|
31
31
|
}
|
32
32
|
},
|
33
33
|
"dependencies": {
|
34
|
-
"@sentry/browser": "^7.
|
34
|
+
"@sentry/browser": "^7.98.0",
|
35
35
|
"cookieconsent": "^3.1.1",
|
36
36
|
"firebase": "^9.23.0",
|
37
37
|
"lazysizes": "^5.3.2"
|
38
38
|
}
|
39
|
-
}
|
39
|
+
}
|