web-manager 3.1.22 → 3.1.24

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 +47 -36
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -28,6 +28,9 @@ var debug;
28
28
  // var utilities;
29
29
  // var storage;
30
30
 
31
+ // Shortcuts
32
+ var select;
33
+
31
34
 
32
35
  /**
33
36
  * MODULE
@@ -150,6 +153,8 @@ function Manager() {
150
153
 
151
154
  }
152
155
 
156
+ select = this.dom().select;
157
+
153
158
  }
154
159
 
155
160
  /**
@@ -235,8 +240,6 @@ function Manager() {
235
240
  function _authHandle_in(This, user) {
236
241
  // This.log('_authHandle_in', user);
237
242
  if (This.properties.page.status.didSignUp) {
238
- var domLib = This.dom();
239
-
240
243
  user.getIdToken(false)
241
244
  .then(function(token) {
242
245
  var done;
@@ -246,7 +249,7 @@ function Manager() {
246
249
  authenticationToken: token,
247
250
  command: 'user:sign-up',
248
251
  payload: {
249
- newsletterSignUp: domLib.select('.auth-newsletter-input').getValue(),
252
+ newsletterSignUp: select('.auth-newsletter-input').getValue(),
250
253
  affiliateCode: This.storage().get('auth.affiliateCode', ''),
251
254
  }
252
255
  }),
@@ -290,7 +293,6 @@ function Manager() {
290
293
 
291
294
 
292
295
  function _authHandle_in_normal(This, user) {
293
- var domLib = This.dom();
294
296
  var returnUrl = This.properties.page.queryString.get('auth_redirect');
295
297
  if (returnUrl && This.isValidRedirectUrl(returnUrl)) {
296
298
  window.location.href = decodeURIComponent(returnUrl);
@@ -300,20 +302,20 @@ function Manager() {
300
302
  window.location.href = This.properties.options.auth.sends.prohibited;
301
303
  return;
302
304
  }
303
- domLib.select('.auth-signedin-true-element').show();
304
- domLib.select('.auth-signedin-false-element').hide();
305
- domLib.select('.auth-email-element').each(function(e, i) {
305
+ select('.auth-signedin-true-element').show();
306
+ select('.auth-signedin-false-element').hide();
307
+ select('.auth-email-element').each(function(e, i) {
306
308
  if (e.tagName === 'INPUT') {
307
- domLib.select(e).setValue(user.email)
309
+ select(e).setValue(user.email)
308
310
  } else {
309
- domLib.select(e).setInnerHTML(user.email)
311
+ select(e).setInnerHTML(user.email)
310
312
  }
311
313
  });
312
- domLib.select('.auth-uid-element').each(function(e, i) {
314
+ select('.auth-uid-element').each(function(e, i) {
313
315
  if (e.tagName === 'INPUT') {
314
- domLib.select(e).setValue(user.uid)
316
+ select(e).setValue(user.uid)
315
317
  } else {
316
- domLib.select(e).setInnerHTML(user.uid)
318
+ select(e).setInnerHTML(user.uid)
317
319
  }
318
320
  });
319
321
  }
@@ -472,9 +474,11 @@ function Manager() {
472
474
  This.properties.page.status.initializing = true;
473
475
 
474
476
  // set other properties
475
- This.properties.meta.environment = /((:\/\/)(local|127\.|192\.|.+ngrok\.))/.test(window.location.href) ? 'development' : 'production';
476
-
477
+ This.properties.meta.environment = window.location.host.match(/:40|ngrok/)
478
+ ? 'development'
479
+ : 'production';
477
480
 
481
+ // Load polyfills
478
482
  init_loadPolyfills(This, configuration, function() {
479
483
  This.properties.page.status.initializing = false;
480
484
  // This.properties.genericPromise = new Promise(resolve => { resolve() });
@@ -686,10 +690,17 @@ function Manager() {
686
690
 
687
691
  var chatsyOps = options_user.libraries.chatsy;
688
692
  if (chatsyOps.enabled) {
689
- This.dom().select('#prechat-btn').css({
693
+ var preChatBtn = select('#prechat-btn');
694
+
695
+ preChatBtn.css({
690
696
  background: chatsyOps.config.settings.openChatButton.background,
691
697
  })
692
698
  .show();
699
+
700
+ window.chatsy = {};
701
+ window.chatsy.open = function() {
702
+ preChatBtn.get(0).click();
703
+ }
693
704
  }
694
705
 
695
706
  // load non-critical libraries
@@ -822,40 +833,39 @@ function Manager() {
822
833
  var This = this;
823
834
  var firebaseActive = typeof firebase !== 'undefined';
824
835
  var erel = '.auth-error-message-element';
825
- var domLib = This.dom();
826
836
 
827
837
  function _displayError(msg) {
828
838
  console.error(msg);
829
- domLib.select(erel).show().setInnerHTML(msg);
839
+ select(erel).show().setInnerHTML(msg);
830
840
  }
831
841
  function _preDisplayError() {
832
- domLib.select(erel).hide().setInnerHTML('');
842
+ select(erel).hide().setInnerHTML('');
833
843
  }
834
844
 
835
845
  // function signinButtonDisabled(status) {
836
846
  // if (status) {
837
- // domLib.select('.auth-signin-email-btn').setAttribute('disabled', true);
847
+ // select('.auth-signin-email-btn').setAttribute('disabled', true);
838
848
  // } else {
839
- // domLib.select('.auth-signin-email-btn').removeAttribute('disabled');
849
+ // select('.auth-signin-email-btn').removeAttribute('disabled');
840
850
  // }
841
851
  // }
842
852
  // function signupButtonDisabled(status) {
843
853
  // if (status) {
844
- // domLib.select('.auth-signup-email-btn').setAttribute('disabled', true);
854
+ // select('.auth-signup-email-btn').setAttribute('disabled', true);
845
855
  // } else {
846
- // domLib.select('.auth-signup-email-btn').removeAttribute('disabled');
856
+ // select('.auth-signup-email-btn').removeAttribute('disabled');
847
857
  // }
848
858
  // }
849
859
  // function forgotButtonDisabled(status) {
850
860
  // if (status) {
851
- // domLib.select('.auth-forgot-email-btn').setAttribute('disabled', true);
861
+ // select('.auth-forgot-email-btn').setAttribute('disabled', true);
852
862
  // } else {
853
- // domLib.select('.auth-forgot-email-btn').removeAttribute('disabled');
863
+ // select('.auth-forgot-email-btn').removeAttribute('disabled');
854
864
  // }
855
865
  // }
856
866
 
857
867
  function setAuthButtonDisabled(button, status) {
858
- var el = domLib.select('.auth-' + button + '-email-btn');
868
+ var el = select('.auth-' + button + '-email-btn');
859
869
  var disabled = 'disabled';
860
870
  if (status) {
861
871
  el.setAttribute(disabled, true);
@@ -868,7 +878,7 @@ function Manager() {
868
878
  var authSelector = '.auth-';
869
879
  var inputSelector = authSelector + input + '-input';
870
880
  var formSelector = authSelector + mode + '-form ';
871
- var result = existing || domLib.select(formSelector + inputSelector).getValue() || domLib.select(inputSelector).getValue();
881
+ var result = existing || select(formSelector + inputSelector).getValue() || select(inputSelector).getValue();
872
882
 
873
883
  return input === 'email' ? result.trim().toLowerCase() : result;
874
884
  }
@@ -914,9 +924,9 @@ function Manager() {
914
924
  _preDisplayError();
915
925
  // This.log('Signin attempt: ', method, email, password);
916
926
  if (method === 'email') {
917
- // email = (email || domLib.select('.auth-email-input').getValue()).trim().toLowerCase();
927
+ // email = (email || select('.auth-email-input').getValue()).trim().toLowerCase();
918
928
  email = resolveAuthInput(email, mode, 'email');
919
- // password = password || domLib.select('.auth-password-input').getValue();
929
+ // password = password || select('.auth-password-input').getValue();
920
930
  password = resolveAuthInput(password, mode, 'password');
921
931
  // console.log('Signin attempt: ', method, email, password);
922
932
 
@@ -954,25 +964,25 @@ function Manager() {
954
964
  _preDisplayError();
955
965
  // This.log('Signup attempt: ', method, email, password, passwordConfirm);
956
966
  // var acceptedTerms
957
- // var termEl = domLib.select('.auth-terms-input');
967
+ // var termEl = select('.auth-terms-input');
958
968
  // if (termEl.exists() && !termEl.getValue() === true) {
959
969
  // _displayError('Please review and accept our terms.');
960
970
  // return;
961
971
  // }
962
972
  var termsSelector = '.auth-terms-input';
963
- var termSpecificEl = domLib.select('.auth-signup-form ' + termsSelector)
964
- var termGenericEl = domLib.select(termsSelector)
973
+ var termSpecificEl = select('.auth-signup-form ' + termsSelector)
974
+ var termGenericEl = select(termsSelector)
965
975
  if ((termSpecificEl.exists() && !termSpecificEl.getValue() === true) || (termGenericEl.exists() && !termGenericEl.getValue() === true)) {
966
976
  _displayError('Please review and accept our terms.');
967
977
  return;
968
978
  }
969
979
 
970
980
  if (method === 'email') {
971
- // email = (email || domLib.select('.auth-email-input').getValue()).trim().toLowerCase();
981
+ // email = (email || select('.auth-email-input').getValue()).trim().toLowerCase();
972
982
  email = resolveAuthInput(email, mode, 'email');
973
- // password = password || domLib.select('.auth-password-input').getValue();
983
+ // password = password || select('.auth-password-input').getValue();
974
984
  password = resolveAuthInput(password, mode, 'password');
975
- // passwordConfirm = passwordConfirm || domLib.select('.auth-password-confirm-input').getValue();
985
+ // passwordConfirm = passwordConfirm || select('.auth-password-confirm-input').getValue();
976
986
  passwordConfirm = resolveAuthInput(passwordConfirm, mode, 'password-confirm');
977
987
  // console.log('Signup attempt: ', method, email, password, passwordConfirm);
978
988
 
@@ -1019,7 +1029,7 @@ function Manager() {
1019
1029
  forgot: function(email) {
1020
1030
  // This.log('forgot()');
1021
1031
  var mode = 'forgot';
1022
- // email = email || domLib.select('.auth-email-input').getValue();
1032
+ // email = email || select('.auth-email-input').getValue();
1023
1033
  email = resolveAuthInput(email, mode, 'email')
1024
1034
 
1025
1035
  // forgotButtonDisabled(true);
@@ -1417,6 +1427,7 @@ function Manager() {
1417
1427
 
1418
1428
  var load_chatsy = function(This, options) {
1419
1429
  var dom = This.dom();
1430
+
1420
1431
  return new Promise(function(resolve, reject) {
1421
1432
  if (options.libraries.chatsy.enabled === true) {
1422
1433
  var chatsyPath = 'libraries.chatsy.config';
@@ -1437,7 +1448,7 @@ function Manager() {
1437
1448
  }
1438
1449
 
1439
1450
  chatsy.open();
1440
- dom.select('#prechat-btn').hide();
1451
+ select('#prechat-btn').hide();
1441
1452
 
1442
1453
  resolve();
1443
1454
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-manager",
3
- "version": "3.1.22",
3
+ "version": "3.1.24",
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": {