web-manager 3.1.25 → 3.1.27

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 +27 -16
  2. package/lib/account.js +1 -5
  3. 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/lib/account.js CHANGED
@@ -398,13 +398,9 @@ Account.prototype._resolveAccount = function (firebaseUser, account, options) {
398
398
  billingUpdateBtn.setAttribute('hidden', true);
399
399
 
400
400
  if (planIsActive) {
401
- updateURL.searchParams.set('appName', utilities.get(self.Manager, 'properties.global.brand.name', 'Unknown'));
402
- updateURL.searchParams.set('supportUrl', currentURL.origin + '/support');
403
- updateURL.searchParams.set('supportEmail', utilities.get(self.Manager, 'properties.contact.emailSupport', 'unknown@email.com'));
404
- updateURL.searchParams.set('userEmail', firebaseUser.email);
405
- updateURL.searchParams.set('userId', firebaseUser.uid);
406
401
  updateURL.searchParams.set('orderId', account.plan.payment.orderId);
407
402
  updateURL.searchParams.set('resourceId', account.plan.payment.resourceId);
403
+
408
404
  billingUpdateBtn.removeAttribute('hidden').setAttribute('href', updateURL.toString());
409
405
  } else {
410
406
  billingSubscribeBtn.removeAttribute('hidden');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-manager",
3
- "version": "3.1.25",
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": {