web-manager 3.1.39 → 3.1.41
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +68 -20
- package/lib/account.js +6 -4
- package/lib/dom.js +1 -1
- package/package.json +11 -3
package/index.js
CHANGED
@@ -194,7 +194,7 @@ function Manager() {
|
|
194
194
|
|
195
195
|
if (!utilities.get(this, 'properties.page.status.eventHandlersSet', false)) {
|
196
196
|
this.properties.page.status.eventHandlersSet = true;
|
197
|
-
|
197
|
+
|
198
198
|
document.addEventListener('click', function (event) {
|
199
199
|
// auth events
|
200
200
|
if (event.target.matches('.auth-signin-email-btn')) {
|
@@ -214,15 +214,15 @@ function Manager() {
|
|
214
214
|
} else if (event.target.matches('.auth-subscribe-notifications-btn')) {
|
215
215
|
This.notifications().subscribe()
|
216
216
|
}
|
217
|
-
|
217
|
+
|
218
218
|
// Autorequest
|
219
219
|
if (!This._notificationRequested && This.properties.options.pushNotifications.autoRequest) {
|
220
220
|
This._notificationRequested = true;
|
221
|
-
|
221
|
+
|
222
222
|
setTimeout(function () {
|
223
223
|
This.notifications().subscribe()
|
224
224
|
}, This.properties.options.pushNotifications.autoRequest * 1000);
|
225
|
-
}
|
225
|
+
}
|
226
226
|
|
227
227
|
}, false);
|
228
228
|
}
|
@@ -271,7 +271,7 @@ function Manager() {
|
|
271
271
|
done = true;
|
272
272
|
store.set(didSignUp, true)
|
273
273
|
_authHandle_in_normal(This, user);
|
274
|
-
}
|
274
|
+
}
|
275
275
|
}
|
276
276
|
|
277
277
|
if (!store.get(didSignUp) && hoursSinceCreation < 0.5) {
|
@@ -285,7 +285,8 @@ function Manager() {
|
|
285
285
|
command: 'user:sign-up',
|
286
286
|
payload: {
|
287
287
|
newsletterSignUp: select('.auth-newsletter-input').getValue(),
|
288
|
-
affiliateCode: store.get('auth.affiliateCode', ''),
|
288
|
+
// affiliateCode: store.get('auth.affiliateCode', ''),
|
289
|
+
affiliateCode: store.get('affiliateCode', ''),
|
289
290
|
},
|
290
291
|
}),
|
291
292
|
})
|
@@ -491,8 +492,8 @@ function Manager() {
|
|
491
492
|
This.properties.page.status.initializing = true;
|
492
493
|
|
493
494
|
// set other properties
|
494
|
-
This.properties.meta.environment = window.location.host.match(/:40|ngrok/)
|
495
|
-
? 'development'
|
495
|
+
This.properties.meta.environment = window.location.host.match(/:40|ngrok/)
|
496
|
+
? 'development'
|
496
497
|
: 'production';
|
497
498
|
|
498
499
|
// Load polyfills
|
@@ -546,8 +547,13 @@ function Manager() {
|
|
546
547
|
storageBucket: '',
|
547
548
|
messagingSenderId: '',
|
548
549
|
appId: '',
|
550
|
+
measurementId: '',
|
549
551
|
},
|
550
552
|
},
|
553
|
+
firebase_auth: {
|
554
|
+
enabled: true,
|
555
|
+
load: false,
|
556
|
+
},
|
551
557
|
firebase_firestore: {
|
552
558
|
enabled: true,
|
553
559
|
load: false,
|
@@ -556,9 +562,12 @@ function Manager() {
|
|
556
562
|
enabled: true,
|
557
563
|
load: false,
|
558
564
|
},
|
559
|
-
|
565
|
+
firebase_appCheck: {
|
560
566
|
enabled: true,
|
561
567
|
load: false,
|
568
|
+
config: {
|
569
|
+
siteKey: '',
|
570
|
+
},
|
562
571
|
},
|
563
572
|
lazysizes: {
|
564
573
|
enabled: true,
|
@@ -578,7 +587,7 @@ function Manager() {
|
|
578
587
|
settings: {
|
579
588
|
openChatButton: {
|
580
589
|
background: '#237afc',
|
581
|
-
text: '#ffffff',
|
590
|
+
text: '#ffffff',
|
582
591
|
},
|
583
592
|
},
|
584
593
|
},
|
@@ -641,7 +650,7 @@ function Manager() {
|
|
641
650
|
This.properties.global.version = configuration.global.version;
|
642
651
|
This.properties.global.url = configuration.global.url;
|
643
652
|
This.properties.global.cacheBreaker = configuration.global.cacheBreaker;
|
644
|
-
|
653
|
+
|
645
654
|
This.properties.global.brand = configuration.global.brand;
|
646
655
|
This.properties.global.contact = configuration.global.contact;
|
647
656
|
This.properties.global.download = configuration.global.download;
|
@@ -650,11 +659,13 @@ function Manager() {
|
|
650
659
|
This.properties.global.validRedirectHosts = configuration.global.validRedirectHosts;
|
651
660
|
This.properties.meta.environment = utilities.get(configuration, 'global.settings.debug.environment', This.properties.meta.environment);
|
652
661
|
This.properties.page.queryString = new URLSearchParams(window.location.search);
|
662
|
+
|
653
663
|
var pageQueryString = This.properties.page.queryString
|
654
664
|
var pagePathname = window.location.pathname;
|
655
665
|
var qsAff = pageQueryString.get('aff');
|
656
666
|
if (qsAff) {
|
657
|
-
store.set('auth.affiliateCode', qsAff);
|
667
|
+
// store.set('auth.affiliateCode', qsAff);
|
668
|
+
store.set('affiliateCode', qsAff);
|
658
669
|
}
|
659
670
|
var qsRedirect = pageQueryString.get('redirect');
|
660
671
|
if (qsRedirect && This.isValidRedirectUrl(qsRedirect)) {
|
@@ -669,7 +680,6 @@ function Manager() {
|
|
669
680
|
})
|
670
681
|
}
|
671
682
|
|
672
|
-
|
673
683
|
// load critical libraries
|
674
684
|
function postCrucial() {
|
675
685
|
// console.log('HERE 5');
|
@@ -707,7 +717,7 @@ function Manager() {
|
|
707
717
|
var chatsyOps = options_user.libraries.chatsy;
|
708
718
|
if (chatsyOps.enabled) {
|
709
719
|
var preChatBtn = select('#prechat-btn');
|
710
|
-
|
720
|
+
|
711
721
|
preChatBtn.css({
|
712
722
|
background: chatsyOps.config.settings.openChatButton.background,
|
713
723
|
})
|
@@ -1303,6 +1313,7 @@ function Manager() {
|
|
1303
1313
|
load_firebase_auth(This, options),
|
1304
1314
|
load_firebase_firestore(This, options),
|
1305
1315
|
load_firebase_messaging(This, options),
|
1316
|
+
load_firebase_appCheck(This, options),
|
1306
1317
|
])
|
1307
1318
|
.then(resolve)
|
1308
1319
|
.catch(reject);
|
@@ -1312,7 +1323,8 @@ function Manager() {
|
|
1312
1323
|
.then(_post)
|
1313
1324
|
.catch(reject);
|
1314
1325
|
} else {
|
1315
|
-
import('firebase/app')
|
1326
|
+
// import('firebase/app')
|
1327
|
+
import('firebase/compat/app')
|
1316
1328
|
.then(function(mod) {
|
1317
1329
|
window.firebase = mod.default;
|
1318
1330
|
_post()
|
@@ -1338,7 +1350,8 @@ function Manager() {
|
|
1338
1350
|
.then(resolve)
|
1339
1351
|
.catch(reject);
|
1340
1352
|
} else {
|
1341
|
-
import('firebase/auth')
|
1353
|
+
// import('firebase/auth')
|
1354
|
+
import('firebase/compat/auth')
|
1342
1355
|
.then(resolve)
|
1343
1356
|
.catch(reject);
|
1344
1357
|
}
|
@@ -1362,7 +1375,8 @@ function Manager() {
|
|
1362
1375
|
.then(resolve)
|
1363
1376
|
.catch(reject);
|
1364
1377
|
} else {
|
1365
|
-
import('firebase/firestore')
|
1378
|
+
// import('firebase/firestore')
|
1379
|
+
import('firebase/compat/firestore')
|
1366
1380
|
.then(resolve)
|
1367
1381
|
.catch(reject);
|
1368
1382
|
}
|
@@ -1384,7 +1398,8 @@ function Manager() {
|
|
1384
1398
|
.then(resolve)
|
1385
1399
|
.catch(reject);
|
1386
1400
|
} else {
|
1387
|
-
import('firebase/messaging')
|
1401
|
+
// import('firebase/messaging')
|
1402
|
+
import('firebase/compat/messaging')
|
1388
1403
|
.then(resolve)
|
1389
1404
|
.catch(reject);
|
1390
1405
|
}
|
@@ -1394,6 +1409,39 @@ function Manager() {
|
|
1394
1409
|
});
|
1395
1410
|
}
|
1396
1411
|
|
1412
|
+
var load_firebase_appCheck = function(This, options) {
|
1413
|
+
return new Promise(function(resolve, reject) {
|
1414
|
+
var setting = options.libraries.firebase_appCheck;
|
1415
|
+
if (setting.enabled === true) {
|
1416
|
+
if (setting.load) {
|
1417
|
+
setting.load(This)
|
1418
|
+
.then(resolve)
|
1419
|
+
.catch(reject);
|
1420
|
+
} else {
|
1421
|
+
// import('firebase/app-check')
|
1422
|
+
import('firebase/compat/app-check')
|
1423
|
+
.then(function (mod) {
|
1424
|
+
var appCheck = firebase.appCheck;
|
1425
|
+
var siteKey = setting.config.siteKey;
|
1426
|
+
|
1427
|
+
if (!siteKey) {
|
1428
|
+
return resolve();
|
1429
|
+
}
|
1430
|
+
|
1431
|
+
appCheck().activate(
|
1432
|
+
new appCheck.ReCaptchaEnterpriseProvider(siteKey),
|
1433
|
+
true,
|
1434
|
+
);
|
1435
|
+
|
1436
|
+
resolve();
|
1437
|
+
})
|
1438
|
+
.catch(reject);
|
1439
|
+
}
|
1440
|
+
} else {
|
1441
|
+
resolve();
|
1442
|
+
}
|
1443
|
+
});
|
1444
|
+
}
|
1397
1445
|
|
1398
1446
|
var load_lazysizes = function(This, options) {
|
1399
1447
|
return new Promise(function(resolve, reject) {
|
@@ -1451,8 +1499,8 @@ function Manager() {
|
|
1451
1499
|
var chatsyPath = 'libraries.chatsy.config';
|
1452
1500
|
|
1453
1501
|
loadScript({
|
1454
|
-
src: 'https://app.chatsy.ai/resources/script.js',
|
1455
|
-
// src: 'http://localhost:4001/resources/script.js',
|
1502
|
+
src: 'https://app.chatsy.ai/resources/script.js',
|
1503
|
+
// src: 'http://localhost:4001/resources/script.js',
|
1456
1504
|
attributes: [
|
1457
1505
|
{name: 'data-account-id', value: utilities.get(options, chatsyPath + '.accountId', '')},
|
1458
1506
|
{name: 'data-chat-id', value: utilities.get(options, chatsyPath + '.chatId', '')},
|
package/lib/account.js
CHANGED
@@ -91,7 +91,7 @@ Account.prototype.initializeAccountPage = function (options) {
|
|
91
91
|
|
92
92
|
Account.prototype.delete = function (options) {
|
93
93
|
var self = this;
|
94
|
-
|
94
|
+
|
95
95
|
var user = firebase.auth().currentUser;
|
96
96
|
var errorElement = self.dom.select('.auth-delete-account-error-message-element');
|
97
97
|
var confirmValue = self.dom.select('.auth-delete-account-confirmation-input').getValue()
|
@@ -168,7 +168,7 @@ Account.prototype.resolve = function (account, options) {
|
|
168
168
|
.get()
|
169
169
|
.then(function (doc) {
|
170
170
|
return resolve(self._resolveAccount(currentUser, doc.data(), options));
|
171
|
-
})
|
171
|
+
})
|
172
172
|
});
|
173
173
|
}
|
174
174
|
|
@@ -229,11 +229,13 @@ 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
233
|
account.plan.expires = account.plan.expires || {};
|
234
234
|
account.plan.expires.timestamp = new Date(account.plan.expires.timestamp || 0).toISOString();
|
235
235
|
account.plan.expires.timestampUNIX = Math.round(new Date(account.plan.expires.timestamp || 0).getTime() / 1000);
|
236
|
-
|
236
|
+
|
237
|
+
account.plan.status = account.plan.status || 'cancelled';
|
238
|
+
|
237
239
|
account.plan.trial = account.plan.trial || {};
|
238
240
|
account.plan.trial.activated = account.plan.trial.activated || false;
|
239
241
|
account.plan.trial.expires = account.plan.trial.expires || {};
|
package/lib/dom.js
CHANGED
@@ -256,7 +256,7 @@ Dom.loadScript = function(options, callback) {
|
|
256
256
|
options.crossorigin = typeof options.crossorigin === 'undefined' ? false : options.crossorigin;
|
257
257
|
options.cacheBreaker = typeof options.cacheBreaker === 'undefined' ? true : options.cacheBreaker;
|
258
258
|
options.attributes = typeof options.attributes === 'undefined' ? [] : options.attributes;
|
259
|
-
|
259
|
+
|
260
260
|
var s = document.createElement('script');
|
261
261
|
|
262
262
|
// Set the script cache breaker
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "web-manager",
|
3
|
-
"version": "3.1.
|
3
|
+
"version": "3.1.41",
|
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": {
|
@@ -22,10 +22,18 @@
|
|
22
22
|
"url": "https://github.com/itw-creative-works/web-manager/issues"
|
23
23
|
},
|
24
24
|
"homepage": "https://itwcreativeworks.com",
|
25
|
+
"backup": {
|
26
|
+
"dependencies": {
|
27
|
+
"@sentry/browser": "^6.19.7",
|
28
|
+
"cookieconsent": "^3.1.1",
|
29
|
+
"firebase": "^8.10.1",
|
30
|
+
"lazysizes": "^5.3.2"
|
31
|
+
}
|
32
|
+
},
|
25
33
|
"dependencies": {
|
26
34
|
"@sentry/browser": "^6.19.7",
|
27
35
|
"cookieconsent": "^3.1.1",
|
28
|
-
"firebase": "^
|
36
|
+
"firebase": "^9.23.0",
|
29
37
|
"lazysizes": "^5.3.2"
|
30
38
|
}
|
31
|
-
}
|
39
|
+
}
|