web-manager 3.1.26 → 3.1.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/index.js +25 -24
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -30,6 +30,7 @@ var debug;
30
30
 
31
31
  // Shortcuts
32
32
  var select;
33
+ var loadScript;
33
34
 
34
35
 
35
36
  /**
@@ -154,7 +155,7 @@ function Manager() {
154
155
  }
155
156
 
156
157
  select = this.dom().select;
157
-
158
+ loadScript = this.dom().loadScript;
158
159
  }
159
160
 
160
161
  /**
@@ -330,8 +331,9 @@ function Manager() {
330
331
  window.location.href = sendSplit[0] + '?' + newQuery.toString();
331
332
  return;
332
333
  }
333
- This.dom().select('.auth-signedin-true-element').hide();
334
- This.dom().select('.auth-signedin-false-element').show();
334
+
335
+ select('.auth-signedin-true-element').hide();
336
+ select('.auth-signedin-false-element').show();
335
337
  }
336
338
 
337
339
  Manager.prototype.ready = function(fn, options) {
@@ -1426,29 +1428,31 @@ function Manager() {
1426
1428
  }
1427
1429
 
1428
1430
  var load_chatsy = function(This, options) {
1429
- var dom = This.dom();
1430
-
1431
1431
  return new Promise(function(resolve, reject) {
1432
1432
  if (options.libraries.chatsy.enabled === true) {
1433
1433
  var chatsyPath = 'libraries.chatsy.config';
1434
1434
 
1435
- dom.loadScript({
1436
- // src: 'https://embed.tawk.to/' + utilities.get(options, tawkPath + '.chatId', '') + '/' + (utilities.get(options, tawkPath + '.widgetId') || 'default'),
1435
+ loadScript({
1437
1436
  src: 'https://app.chatsy.ai/resources/script.js',
1438
- // src: 'http://192.168.86.248:4001/resources/script.js',
1437
+ // src: 'http://localhost:4001/resources/script.js',
1439
1438
  attributes: [
1440
1439
  {name: 'data-account-id', value: utilities.get(options, chatsyPath + '.accountId', '')},
1441
1440
  {name: 'data-chat-id', value: utilities.get(options, chatsyPath + '.chatId', '')},
1442
1441
  {name: 'data-settings', value: JSON.stringify(utilities.get(options, chatsyPath + '.settings', ''))},
1443
1442
  ],
1444
- crossorigin: true,
1445
- }, function(e) {
1446
- if (e) {
1447
- return reject(e);
1448
- }
1449
-
1450
- chatsy.open();
1451
- select('#prechat-btn').hide();
1443
+ crossorigin: true,
1444
+ })
1445
+ .then(function () {
1446
+ // Listen for Chatsy status
1447
+ chatsy.on('status', function(event, status) {
1448
+ if (status === 'loaded') {
1449
+ setTimeout(function () {
1450
+ select('#prechat-btn').hide();
1451
+ }, 1000);
1452
+
1453
+ chatsy.open();
1454
+ }
1455
+ })
1452
1456
 
1453
1457
  resolve();
1454
1458
  })
@@ -1461,9 +1465,6 @@ function Manager() {
1461
1465
 
1462
1466
  var load_sentry = function(This, options) {
1463
1467
  return new Promise(function(resolve, reject) {
1464
- // if (typeof window.Sentry !== 'undefined') {
1465
- // return resolve();
1466
- // }
1467
1468
  if (options.libraries.sentry.enabled === true) {
1468
1469
  import('@sentry/browser')
1469
1470
  .then(function(mod) {
@@ -1527,11 +1528,11 @@ function Manager() {
1527
1528
  if (featuresDefault && featuresCustom) {
1528
1529
  cb();
1529
1530
  } else {
1530
- // This.dom().loadScript({src: 'https://polyfill.io/v3/polyfill.min.js?flags=always%2Cgated&features=default'}, function() {
1531
- This.dom().loadScript({src: 'https://polyfill.io/v3/polyfill.min.js?flags=always%2Cgated&features=default%2Ces5%2Ces6%2Ces7%2CPromise.prototype.finally%2C%7Ehtml5-elements%2ClocalStorage%2Cfetch%2CURLSearchParams'}, function() {
1532
- // This.log('Loaded polyfill.io')
1533
- cb();
1534
- });
1531
+ loadScript({src: 'https://polyfill.io/v3/polyfill.min.js?flags=always%2Cgated&features=default%2Ces5%2Ces6%2Ces7%2CPromise.prototype.finally%2C%7Ehtml5-elements%2ClocalStorage%2Cfetch%2CURLSearchParams'})
1532
+ .then(function() {
1533
+ // This.log('Loaded polyfill.io')
1534
+ cb();
1535
+ })
1535
1536
  }
1536
1537
 
1537
1538
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-manager",
3
- "version": "3.1.26",
3
+ "version": "3.1.28",
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": {
@@ -28,4 +28,4 @@
28
28
  "firebase": "^8.10.1",
29
29
  "lazysizes": "^5.3.2"
30
30
  }
31
- }
31
+ }