web-manager 3.1.26 → 3.1.27

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 +27 -16
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1432,23 +1432,34 @@ function Manager() {
1432
1432
  if (options.libraries.chatsy.enabled === true) {
1433
1433
  var chatsyPath = 'libraries.chatsy.config';
1434
1434
 
1435
+ // function log() {
1436
+ // console.log('---chatsy', chatsy.open, chatsy.status);
1437
+ // }
1438
+ // setInterval(function () {
1439
+ // log()
1440
+ // }, 1000);
1441
+
1435
1442
  dom.loadScript({
1436
- // src: 'https://embed.tawk.to/' + utilities.get(options, tawkPath + '.chatId', '') + '/' + (utilities.get(options, tawkPath + '.widgetId') || 'default'),
1437
- src: 'https://app.chatsy.ai/resources/script.js',
1438
- // src: 'http://192.168.86.248:4001/resources/script.js',
1443
+ // src: 'https://app.chatsy.ai/resources/script.js',
1444
+ src: 'http://localhost:4001/resources/script.js',
1439
1445
  attributes: [
1440
1446
  {name: 'data-account-id', value: utilities.get(options, chatsyPath + '.accountId', '')},
1441
1447
  {name: 'data-chat-id', value: utilities.get(options, chatsyPath + '.chatId', '')},
1442
1448
  {name: 'data-settings', value: JSON.stringify(utilities.get(options, chatsyPath + '.settings', ''))},
1443
1449
  ],
1444
- crossorigin: true,
1445
- }, function(e) {
1446
- if (e) {
1447
- return reject(e);
1448
- }
1449
-
1450
- chatsy.open();
1451
- select('#prechat-btn').hide();
1450
+ crossorigin: true,
1451
+ })
1452
+ .then(function () {
1453
+ // Listen for Chatsy status
1454
+ chatsy.on('status', function(event, status) {
1455
+ if (status === 'loaded') {
1456
+ setTimeout(function () {
1457
+ select('#prechat-btn').hide();
1458
+ }, 1000);
1459
+
1460
+ chatsy.open();
1461
+ }
1462
+ })
1452
1463
 
1453
1464
  resolve();
1454
1465
  })
@@ -1527,11 +1538,11 @@ function Manager() {
1527
1538
  if (featuresDefault && featuresCustom) {
1528
1539
  cb();
1529
1540
  } 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
- });
1541
+ 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'})
1542
+ .then(function() {
1543
+ // This.log('Loaded polyfill.io')
1544
+ cb();
1545
+ })
1535
1546
  }
1536
1547
 
1537
1548
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-manager",
3
- "version": "3.1.26",
3
+ "version": "3.1.27",
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": {