{"version":3,"file":"login.js","names":["noviNs","vm","Vue","el","data","email","modelEmail","password","errorMessage","modelErrorMessage","showEmailForm","length","showPasswordForm","showEmailNotFound","showMemberFoundWithNoAccount","showPasswordNotSet","ssoProviders","showPassword","showNoviAdminLogin","showNonMatchingUserAccount","isLoading","isSubmitting","isAccountCreationDisabled","computed","passwordInputType","this","toggleShowPasswordTitle","methods","continueClick","checkEmail","switchToPasswordForm","backToEmailClick","toggleShowPassword","submitForm","e","preventDefault","emailRegex","test","$","ajax","url","duplicateEmailUrl","encodeURIComponent","type","success","hasOwnProperty","hasDuplicate","customerActive","userId","hasSetPassword","hasNonMatchingUserAccount","mcIframe","document","getElementById","window","addEventListener","event","origin","missionControlUrl","contentWindow","postMessage","on","value","replace","returnUrl","createAccountHref","attr"],"sources":["login.js"],"mappings":"CAAA,SAAWA,GACP,IAAIC,EAAK,IAAIC,IAAI,CACbC,GAAI,cACJC,KAAM,CACFC,MAAOL,EAAOM,WACdC,SAAU,GACVC,aAAcR,EAAOS,kBACrBC,eAAgBV,EAAOM,YAA0C,GAA5BN,EAAOM,WAAWK,OACvDC,iBAAkBZ,EAAOM,WAAWK,OAAS,EAC7CE,mBAAmB,EACnBC,8BAA8B,EAC9BC,oBAAoB,EACpBC,aAAc,GACdC,cAAc,EACdC,oBAAoB,EACpBC,4BAA4B,EAC5BC,WAAW,EACXC,cAAc,EACdC,0BAA2BtB,EAAOsB,2BAEtCC,SAAU,CACNC,kBAAmB,WACf,OAAOC,KAAKR,aAAe,OAAS,UACxC,EACAS,wBAAyB,WACrB,OAAID,KAAKR,aACE,gBACJ,eACX,GAEJU,QAAS,CACLC,cAAe,WACXH,KAAKI,YACT,EACAC,qBAAsB,WAClBL,KAAKf,eAAgB,EACrBe,KAAKb,kBAAmB,CAC5B,EACAmB,iBAAkB,WACdN,KAAKjB,aAAe,GACpBiB,KAAKf,eAAgB,EACrBe,KAAKb,kBAAmB,CAC5B,EACAoB,mBAAoB,WAChBP,KAAKR,cAAgBQ,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AQrC,KAAKqC,MAAMC,QAAQ,MAAO,GAC3C,IAEI/D,EAAOgE,UAAW,CAClB,IAAIC,EAAoB3B,EAAE,oCAAoC4B,KAAK,QAAU,cAAgBlE,EAAOgE,UACpG1B,EAAE,oCAAoC4B,KAAK,OAAQD,EACvD,CAEH,CAjID,CAiIGjE","sourcesContent":["(function (noviNs) {\r\n    var vm = new Vue({\r\n        el: \"#login-form\",\r\n        data: {\r\n            email: noviNs.modelEmail,\r\n            password: '',\r\n            errorMessage: noviNs.modelErrorMessage,\r\n            showEmailForm: !noviNs.modelEmail || noviNs.modelEmail.length == 0,\r\n            showPasswordForm: noviNs.modelEmail.length > 0,\r\n            showEmailNotFound: false,\r\n            showMemberFoundWithNoAccount: false,\r\n            showPasswordNotSet: false,\r\n            ssoProviders: [],\r\n            showPassword: false,\r\n            showNoviAdminLogin: false,\r\n            showNonMatchingUserAccount: false,\r\n            isLoading: false,\r\n            isSubmitting: false,\r\n            isAccountCreationDisabled: noviNs.isAccountCreationDisabled\r\n        },\r\n        computed: {\r\n            passwordInputType: function () {\r\n                return this.showPassword ? \"text\" : \"password\";\r\n            },\r\n            toggleShowPasswordTitle: function () {\r\n                if (this.showPassword)\r\n                    return 'Hide Password';\r\n                return 'Show Password';\r\n            }\r\n        },\r\n        methods: {\r\n            continueClick: function () {\r\n                this.checkEmail();\r\n            },\r\n            switchToPasswordForm: function () {\r\n                this.showEmailForm = false;\r\n                this.showPasswordForm = true;\r\n            },\r\n            backToEmailClick: function () {\r\n                this.errorMessage = \"\";\r\n                this.showEmailForm = true;\r\n                this.showPasswordForm = false;\r\n            },\r\n            toggleShowPassword: function () {\r\n                this.showPassword = !this.showPassword;\r\n            },\r\n            submitForm: function (e) {\r\n                if (!this.password.length) {\r\n                    this.errorMessage = \"Password is required.\";\r\n                    e.preventDefault();\r\n                }\r\n                else {\r\n                    this.errorMessage = \"\";\r\n                    this.isSubmitting = true;\r\n                }\r\n            },\r\n            checkEmail: function () {\r\n                if (!this.email || this.email.length == 0) {\r\n                    this.errorMessage = \"Please enter your email address.\"\r\n                    return;\r\n                }\r\n\r\n                if (!noviNs.emailRegex.test(this.email)) {\r\n                    this.errorMessage = \"Please enter a valid email address.\"\r\n                    return;\r\n                }\r\n\r\n                this.errorMessage = \"\";\r\n                this.isLoading = true;\r\n\r\n                $.ajax({\r\n                    url: noviNs.duplicateEmailUrl + \"?email=\" + encodeURIComponent(this.email),\r\n                    type: 'GET',\r\n                    success: function (data) {\r\n                        vm.isLoading = false;\r\n\r\n                        vm.showEmailNotFound = false;\r\n                        vm.showPasswordNotSet = false;\r\n                        vm.showNonMatchingUserAccount = false;\r\n                        vm.showMemberFoundWithNoAccount = !data.hasOwnProperty('userId') && data.hasDuplicate;\r\n\r\n                        if (!data.customerActive) {\r\n                            vm.showEmailNotFound = true;\r\n                        }\r\n                        else if (data.hasDuplicate && data.userId && data.hasSetPassword && !data.hasNonMatchingUserAccount) {\r\n                            vm.switchToPasswordForm();\r\n                        }\r\n                        else if (data.userId && !data.hasSetPassword) {\r\n                            vm.showPasswordNotSet = true;\r\n                            vm.ssoProviders = data.ssoProviders || [];\r\n                        }\r\n                        else if (data.hasNonMatchingUserAccount) {\r\n                            vm.showNonMatchingUserAccount = true;\r\n                        }\r\n                        else {\r\n                            vm.showEmailNotFound = true;\r\n                        }\r\n                    }\r\n                });\r\n            }\r\n        }\r\n    });\r\n\r\n    var mcIframe = document.getElementById(\"mc-iframe\");\r\n\r\n    function gotMessage(event) {\r\n        if (event.origin !== noviNs.missionControlUrl || event.data != \"mc-been-there\") {\r\n            return;\r\n        }\r\n\r\n        vm.showNoviAdminLogin = true;\r\n    }\r\n\r\n    window.addEventListener(\"message\", gotMessage, false);\r\n\r\n    //If developer tools are open, somehow the iFrame loads first so we have to tell it we are ready\r\n    document.addEventListener(\"DOMContentLoaded\", function (event) {\r\n        mcIframe.contentWindow.postMessage(\"ready\", noviNs.missionControlUrl);\r\n    });\r\n\r\n    $(\"#Email\").on('keyup blur change paste input', function () {\r\n        this.value = this.value.replace(/\\s/g, '');\r\n    });\r\n\r\n    if (noviNs.returnUrl) {\r\n        var createAccountHref = $(\"#join-modal .create-account-link\").attr(\"href\") + \"&returnUrl=\" + noviNs.returnUrl;\r\n        $(\"#join-modal .create-account-link\").attr(\"href\", createAccountHref);\r\n    }\r\n\r\n})(noviNs);"]}