web-manager 3.1.38 → 3.1.40

Sign up to get free protection for your applications and to get access to all the features.
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) {
@@ -491,8 +491,8 @@ function Manager() {
491
491
  This.properties.page.status.initializing = true;
492
492
 
493
493
  // set other properties
494
- This.properties.meta.environment = window.location.host.match(/:40|ngrok/)
495
- ? 'development'
494
+ This.properties.meta.environment = window.location.host.match(/:40|ngrok/)
495
+ ? 'development'
496
496
  : 'production';
497
497
 
498
498
  // Load polyfills
@@ -578,7 +578,7 @@ function Manager() {
578
578
  settings: {
579
579
  openChatButton: {
580
580
  background: '#237afc',
581
- text: '#ffffff',
581
+ text: '#ffffff',
582
582
  },
583
583
  },
584
584
  },
@@ -641,7 +641,7 @@ function Manager() {
641
641
  This.properties.global.version = configuration.global.version;
642
642
  This.properties.global.url = configuration.global.url;
643
643
  This.properties.global.cacheBreaker = configuration.global.cacheBreaker;
644
-
644
+
645
645
  This.properties.global.brand = configuration.global.brand;
646
646
  This.properties.global.contact = configuration.global.contact;
647
647
  This.properties.global.download = configuration.global.download;
@@ -707,7 +707,7 @@ function Manager() {
707
707
  var chatsyOps = options_user.libraries.chatsy;
708
708
  if (chatsyOps.enabled) {
709
709
  var preChatBtn = select('#prechat-btn');
710
-
710
+
711
711
  preChatBtn.css({
712
712
  background: chatsyOps.config.settings.openChatButton.background,
713
713
  })
@@ -1443,12 +1443,16 @@ function Manager() {
1443
1443
 
1444
1444
  var load_chatsy = function(This, options) {
1445
1445
  return new Promise(function(resolve, reject) {
1446
- if (options.libraries.chatsy.enabled === true) {
1446
+
1447
+ if (
1448
+ options.libraries.chatsy.enabled === true
1449
+ && !This.properties.page._chatsyRequested
1450
+ ) {
1447
1451
  var chatsyPath = 'libraries.chatsy.config';
1448
1452
 
1449
1453
  loadScript({
1450
- src: 'https://app.chatsy.ai/resources/script.js',
1451
- // src: 'http://localhost:4001/resources/script.js',
1454
+ src: 'https://app.chatsy.ai/resources/script.js',
1455
+ // src: 'http://localhost:4001/resources/script.js',
1452
1456
  attributes: [
1453
1457
  {name: 'data-account-id', value: utilities.get(options, chatsyPath + '.accountId', '')},
1454
1458
  {name: 'data-chat-id', value: utilities.get(options, chatsyPath + '.chatId', '')},
@@ -1471,6 +1475,7 @@ function Manager() {
1471
1475
  resolve();
1472
1476
  })
1473
1477
 
1478
+ This.properties.page._chatsyRequested = true;
1474
1479
  } else {
1475
1480
  resolve();
1476
1481
  }
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.38",
3
+ "version": "3.1.40",
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
+ }