web-manager 3.0.6 → 3.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/helpers/auth-pages.js +37 -18
- package/index.js +7 -8
- package/lib/account.js +1 -1
- package/package.json +3 -3
    
        package/README.md
    CHANGED
    
    | @@ -265,6 +265,7 @@ The Firebase login system works like charm out of the box without you having to | |
| 265 265 | 
             
            * `.auth-signout-all-btn`: Add to a button to handle the signout process
         | 
| 266 266 | 
             
            * `.auth-email-element`: Add to any element to display the user's email
         | 
| 267 267 | 
             
            * `.auth-terms-input`: Add to a checkbox to require a TOS agreement before signup occurs
         | 
| 268 | 
            +
            * `.auth-newsletter-input`: Add to a checkbox to opt-in the user to newsletters upon signup
         | 
| 268 269 | 
             
            * `.auth-uid-element`: Add to any element to display the user's uid
         | 
| 269 270 | 
             
            * `.auth-signedin-true-element`: Add to any element and it will be hidden if the user *is* signed in
         | 
| 270 271 | 
             
            * `.auth-signedin-false-element`: Add to any element and it will be hidden if the user *is not* signed in
         | 
    
        package/helpers/auth-pages.js
    CHANGED
    
    | @@ -5,26 +5,45 @@ var dom; | |
| 5 5 | 
             
            function AuthPages() {
         | 
| 6 6 | 
             
              var self = this;
         | 
| 7 7 | 
             
              dom = window.Manager.dom();
         | 
| 8 | 
            -
              var authRegex = /\/(signin|signup|forgot)/;
         | 
| 9 8 | 
             
              var pageQueryString = window.Manager.properties.page.queryString;
         | 
| 10 | 
            -
              var pageAuthRedirect = pageQueryString.get('auth_redirect')
         | 
| 11 9 |  | 
| 12 | 
            -
               | 
| 13 | 
            -
                 | 
| 14 | 
            -
             | 
| 15 | 
            -
                   | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
                    }
         | 
| 25 | 
            -
                  }
         | 
| 26 | 
            -
                })
         | 
| 27 | 
            -
              }
         | 
| 10 | 
            +
              dom.select('a[href*=signin], a[href*=signup], a[href*=forgot]').each(function (el) {
         | 
| 11 | 
            +
                var href = el.getAttribute('href');
         | 
| 12 | 
            +
                try {
         | 
| 13 | 
            +
                  var newURL = new URL(href);
         | 
| 14 | 
            +
                  pageQueryString.forEach(function(value, key) {
         | 
| 15 | 
            +
                    newURL.searchParams.set(key, value)
         | 
| 16 | 
            +
                  })
         | 
| 17 | 
            +
                  el.setAttribute('href', newURL.toString())
         | 
| 18 | 
            +
                } catch (e) {
         | 
| 19 | 
            +
                  console.warn('Failed to set auth URL', e);
         | 
| 20 | 
            +
                }
         | 
| 21 | 
            +
              })
         | 
| 28 22 | 
             
            }
         | 
| 29 23 |  | 
| 24 | 
            +
            // function AuthPages() {
         | 
| 25 | 
            +
            //   var self = this;
         | 
| 26 | 
            +
            //   dom = window.Manager.dom();
         | 
| 27 | 
            +
            //   var authRegex = /\/(signin|signup|forgot)/;
         | 
| 28 | 
            +
            //   var pageQueryString = window.Manager.properties.page.queryString;
         | 
| 29 | 
            +
            //   var pageAuthRedirect = pageQueryString.get('auth_redirect')
         | 
| 30 | 
            +
            //
         | 
| 31 | 
            +
            //   if (pageAuthRedirect) {
         | 
| 32 | 
            +
            //     dom.select('a').each(function (el) {
         | 
| 33 | 
            +
            //       var href = el.getAttribute('href');
         | 
| 34 | 
            +
            //       if (href && href.match(authRegex)) {
         | 
| 35 | 
            +
            //         try {
         | 
| 36 | 
            +
            //           var newURL = new URL(href);
         | 
| 37 | 
            +
            //           if (newURL.pathname.match(authRegex)) {
         | 
| 38 | 
            +
            //             newURL.searchParams.set('auth_redirect', pageAuthRedirect)
         | 
| 39 | 
            +
            //             el.setAttribute('href', newURL.toString())
         | 
| 40 | 
            +
            //           }
         | 
| 41 | 
            +
            //         } catch (e) {
         | 
| 42 | 
            +
            //           // console.warn('Failed to set auth URL', e);
         | 
| 43 | 
            +
            //         }
         | 
| 44 | 
            +
            //       }
         | 
| 45 | 
            +
            //     })
         | 
| 46 | 
            +
            //   }
         | 
| 47 | 
            +
            // }
         | 
| 48 | 
            +
             | 
| 30 49 | 
             
            module.exports = AuthPages;
         | 
    
        package/index.js
    CHANGED
    
    | @@ -816,6 +816,7 @@ function Manager() { | |
| 816 816 | 
             
                var domLib = This.dom();
         | 
| 817 817 |  | 
| 818 818 | 
             
                function _displayError(msg) {
         | 
| 819 | 
            +
                  console.error(msg);
         | 
| 819 820 | 
             
                  domLib.select(erel).show().setInnerHTML(msg);
         | 
| 820 821 | 
             
                }
         | 
| 821 822 | 
             
                function _preDisplayError() {
         | 
| @@ -858,9 +859,9 @@ function Manager() { | |
| 858 859 | 
             
                  var authSelector = '.auth-';
         | 
| 859 860 | 
             
                  var inputSelector = authSelector + input + '-input';
         | 
| 860 861 | 
             
                  var formSelector = authSelector + mode + '-form ';
         | 
| 861 | 
            -
                   | 
| 862 | 
            +
                  var result = existing || domLib.select(formSelector + inputSelector).getValue() || domLib.select(inputSelector).getValue();
         | 
| 862 863 |  | 
| 863 | 
            -
                  return  | 
| 864 | 
            +
                  return input === 'email' ? result.trim().toLowerCase() : result;
         | 
| 864 865 | 
             
                }
         | 
| 865 866 |  | 
| 866 867 | 
             
                return {
         | 
| @@ -888,7 +889,6 @@ function Manager() { | |
| 888 889 | 
             
                        firebase.auth()
         | 
| 889 890 | 
             
                          .getRedirectResult()
         | 
| 890 891 | 
             
                          .catch(function (error) {
         | 
| 891 | 
            -
                            console.error(error);
         | 
| 892 892 | 
             
                            _displayError(error.message);
         | 
| 893 893 | 
             
                          });
         | 
| 894 894 | 
             
                      }
         | 
| @@ -906,7 +906,7 @@ function Manager() { | |
| 906 906 | 
             
                    // This.log('Signin attempt: ', method, email, password);
         | 
| 907 907 | 
             
                    if (method === 'email') {
         | 
| 908 908 | 
             
                      // email = (email || domLib.select('.auth-email-input').getValue()).trim().toLowerCase();
         | 
| 909 | 
            -
                      email = resolveAuthInput(email, mode, 'email') | 
| 909 | 
            +
                      email = resolveAuthInput(email, mode, 'email');
         | 
| 910 910 | 
             
                      // password = password || domLib.select('.auth-password-input').getValue();
         | 
| 911 911 | 
             
                      password = resolveAuthInput(password, mode, 'password');
         | 
| 912 912 | 
             
                      // console.log('Signin attempt: ', method, email, password);
         | 
| @@ -934,7 +934,6 @@ function Manager() { | |
| 934 934 | 
             
                    } else {
         | 
| 935 935 | 
             
                      firebase.auth().signInWithRedirect(new firebase.auth.OAuthProvider(method))
         | 
| 936 936 | 
             
                      .catch(function (e) {
         | 
| 937 | 
            -
                        console.error(e);
         | 
| 938 937 | 
             
                        _displayError(e);
         | 
| 939 938 | 
             
                      })
         | 
| 940 939 | 
             
                    }
         | 
| @@ -961,7 +960,7 @@ function Manager() { | |
| 961 960 |  | 
| 962 961 | 
             
                    if (method === 'email') {
         | 
| 963 962 | 
             
                      // email = (email || domLib.select('.auth-email-input').getValue()).trim().toLowerCase();
         | 
| 964 | 
            -
                      email = resolveAuthInput(email, mode, 'email') | 
| 963 | 
            +
                      email = resolveAuthInput(email, mode, 'email');
         | 
| 965 964 | 
             
                      // password = password || domLib.select('.auth-password-input').getValue();
         | 
| 966 965 | 
             
                      password = resolveAuthInput(password, mode, 'password');
         | 
| 967 966 | 
             
                      // passwordConfirm = passwordConfirm || domLib.select('.auth-password-confirm-input').getValue();
         | 
| @@ -1012,7 +1011,7 @@ function Manager() { | |
| 1012 1011 | 
             
                    // This.log('forgot()');
         | 
| 1013 1012 | 
             
                    var mode = 'forgot';
         | 
| 1014 1013 | 
             
                    // email = email || domLib.select('.auth-email-input').getValue();
         | 
| 1015 | 
            -
                    email = resolveAuthInput(email, mode, 'email') | 
| 1014 | 
            +
                    email = resolveAuthInput(email, mode, 'email')
         | 
| 1016 1015 |  | 
| 1017 1016 | 
             
                    // forgotButtonDisabled(true);
         | 
| 1018 1017 | 
             
                    setAuthButtonDisabled(mode, true);
         | 
| @@ -1633,7 +1632,7 @@ function Manager() { | |
| 1633 1632 | 
             
                var returnUrlObject = new URL(decodeURIComponent(url));
         | 
| 1634 1633 | 
             
                var currentUrlObject = new URL(window.location.href);
         | 
| 1635 1634 | 
             
                return returnUrlObject.host === currentUrlObject.host
         | 
| 1636 | 
            -
                  || returnUrlObject.protocol ===  | 
| 1635 | 
            +
                  || returnUrlObject.protocol === this.properties.global.app + ':'
         | 
| 1637 1636 | 
             
              }
         | 
| 1638 1637 |  | 
| 1639 1638 | 
             
              // Manager.prototype.performance = function() {
         | 
    
        package/lib/account.js
    CHANGED
    
    | @@ -323,7 +323,7 @@ Account.prototype._resolveAccount = function (currentUser, account, options) { | |
| 323 323 |  | 
| 324 324 | 
             
                _setAuthItem('.auth-apikey-element', utilities.get(account, 'api.privateKey', 'n/a'))
         | 
| 325 325 | 
             
              } catch (e) {
         | 
| 326 | 
            -
                console.error('Unable to set DOM elements', e);
         | 
| 326 | 
            +
                // console.error('Unable to set DOM elements', e);
         | 
| 327 327 | 
             
              }
         | 
| 328 328 | 
             
              self.properties = account;
         | 
| 329 329 |  | 
    
        package/package.json
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            {
         | 
| 2 2 | 
             
              "name": "web-manager",
         | 
| 3 | 
            -
              "version": "3.0. | 
| 3 | 
            +
              "version": "3.0.9",
         | 
| 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": {
         | 
| @@ -23,9 +23,9 @@ | |
| 23 23 | 
             
              },
         | 
| 24 24 | 
             
              "homepage": "https://itwcreativeworks.com",
         | 
| 25 25 | 
             
              "dependencies": {
         | 
| 26 | 
            -
                "@sentry/browser": "^6. | 
| 26 | 
            +
                "@sentry/browser": "^6.19.7",
         | 
| 27 27 | 
             
                "cookieconsent": "^3.1.1",
         | 
| 28 28 | 
             
                "firebase": "^8.10.1",
         | 
| 29 29 | 
             
                "lazysizes": "^5.3.2"
         | 
| 30 30 | 
             
              }
         | 
| 31 | 
            -
            }
         | 
| 31 | 
            +
            }
         |