{"version":3,"file":"app-services.min.js","sources":["app-services.min.js"],"sourcesContent":["/// \r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var AccountService = /** @class */ (function () {\r\n function AccountService($http, $q, appConfiguration, authenticationService) {\r\n this.$http = $http;\r\n this.$q = $q;\r\n this.appConfiguration = appConfiguration;\r\n this.authenticationService = authenticationService;\r\n this.baseUrl = \"\".concat(this.appConfiguration.webServiceUrl, \"/account\");\r\n }\r\n AccountService.prototype.addInvestorLeadNotification = function (email, optedIn) {\r\n var deferred = this.$q.defer();\r\n var request = {\r\n email: email,\r\n optedIn: optedIn\r\n };\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.post(\"\".concat(this.baseUrl, \"/investor-notification-email\"), request).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n AccountService.prototype.changeForgottenPassword = function (request) {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.post(\"\".concat(this.baseUrl, \"/replace-password\"), request).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n ;\r\n AccountService.prototype.changePassword = function (request) {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.post(\"\".concat(this.baseUrl, \"/password\"), request).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n ;\r\n AccountService.prototype.deleteInvestorNotificationEmail = function (emailId) {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.delete(\"\".concat(this.baseUrl, \"/investor-notification-email/\").concat(emailId)).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n AccountService.prototype.getAccountProfile = function () {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.get(\"\".concat(this.baseUrl, \"/get-profile\")).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n AccountService.prototype.getInvestorLoginCode = function () {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.get(\"\".concat(this.baseUrl, \"/login-code\")).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n AccountService.prototype.getInvestorNotificationEmails = function () {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.get(\"\".concat(this.baseUrl, \"/investor-notification-emails\")).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n AccountService.prototype.getMemberTypes = function () {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.get(\"\".concat(this.baseUrl, \"/member-types\")).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n AccountService.prototype.getSubscription = function () {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.get(\"\".concat(this.baseUrl, \"/subscription\")).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n AccountService.prototype.getTransactions = function (request) {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.post(\"\".concat(this.baseUrl, \"/transactions\"), request).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n AccountService.prototype.matchAccountEmail = function (email) {\r\n var _this = this;\r\n return this.$http.get(\"\".concat(this.baseUrl, \"/match-email?email=\").concat(encodeURIComponent(email))).then(function (response) {\r\n if (response.status == 200) {\r\n return _this.$q.resolve(response.data.accountExists);\r\n }\r\n else {\r\n return _this.$q.reject(response);\r\n }\r\n }).catch(function (reason) {\r\n return _this.$q.reject(reason);\r\n });\r\n };\r\n AccountService.prototype.sendForgotPasswordEmail = function (request) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.post(\"\".concat(this.baseUrl, \"/request-password-reset\"), request).then(function (result) {\r\n return _this.$q.resolve(result.status == 200 && result.data == true);\r\n }).catch(function (reason) {\r\n return _this.$q.reject(false);\r\n });\r\n };\r\n AccountService.prototype.updateAccountInfo = function (request) {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.post(\"\".concat(this.baseUrl, \"/profile\"), request).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n ;\r\n AccountService.prototype.updateInvestorNotificationEmail = function (request) {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.put(\"\".concat(this.baseUrl, \"/investor-notification-email\"), request).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n ;\r\n AccountService.prototype.updateNotificationSettings = function (request) {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.post(\"\".concat(this.baseUrl, \"/notification-settings\"), request).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.statusText);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n ;\r\n AccountService.prototype.getPublicProfile = function () {\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.get(\"\".concat(this.baseUrl, \"/public-profile\"))\r\n .then(AccountService.handleLegacyResponse);\r\n };\r\n AccountService.prototype.updatePublicProfile = function (request) {\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.post(\"\".concat(this.baseUrl, \"/public-profile\"), request)\r\n .then(AccountService.handleLegacyResponse);\r\n };\r\n AccountService.handleLegacyResponse = function (result, requireSuccess) {\r\n if (requireSuccess === void 0) { requireSuccess = false; }\r\n if ((result === null || result === void 0 ? void 0 : result.status) == 200 && result.data) {\r\n if (result.data.success) {\r\n return result.data;\r\n }\r\n if (!requireSuccess) {\r\n console.debug(result.data);\r\n return result.data;\r\n }\r\n }\r\n console.debug(result);\r\n if (result === null || result === void 0 ? void 0 : result.data) {\r\n if (result.data.errorMessageToDisplay) {\r\n throw result.data.errorMessageToDisplay;\r\n }\r\n if (result.data.hasOwnProperty('message')) {\r\n var standardErrorResponse = result.data;\r\n throw standardErrorResponse.message;\r\n }\r\n }\r\n throw 'An unknown error has occurred';\r\n };\r\n AccountService.$inject = [\r\n names.angular.Http,\r\n names.angular.Q,\r\n names.zbuyer.AppConfiguration,\r\n names.zbuyer.services.AuthenticationService\r\n ];\r\n return AccountService;\r\n }());\r\n angular.module(names.zbuyer.Application)\r\n .service(names.zbuyer.services.AccountService, AccountService);\r\n })(implementation = services.implementation || (services.implementation = {}));\r\n })(services = zbuyer.services || (zbuyer.services = {}));\r\n})(zbuyer || (zbuyer = {}));\r\n\n/// \r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var AccountMessageService = /** @class */ (function () {\r\n function AccountMessageService($http, appConfiguration, authenticationService) {\r\n this.$http = $http;\r\n this.appConfiguration = appConfiguration;\r\n this.authenticationService = authenticationService;\r\n this.baseUrl = \"\".concat(this.appConfiguration.webServiceUrl, \"/account-message\");\r\n }\r\n AccountMessageService.prototype.get = function (pageUrlOrName) {\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.get(\"\".concat(this.baseUrl, \"?pageUrlOrName=\").concat(pageUrlOrName))\r\n .then(AccountMessageService.handleLegacyResponse);\r\n };\r\n AccountMessageService.prototype.recordAction = function (accountMessageId, actionButtonClickedText, inputFormProperties) {\r\n this.authenticationService.updateDefaultAuthHeader();\r\n var request = {\r\n accountMessageId: accountMessageId,\r\n actionButtonClickedText: actionButtonClickedText,\r\n inputFormProperties: inputFormProperties\r\n };\r\n return this.$http.post(\"\".concat(this.baseUrl, \"/action\"), request)\r\n .then(AccountMessageService.handleLegacyResponse);\r\n };\r\n AccountMessageService.handleLegacyResponse = function (result, requireSuccess) {\r\n if (requireSuccess === void 0) { requireSuccess = false; }\r\n if (result.status == 200 && result.data) {\r\n if (result.data.success) {\r\n return result.data;\r\n }\r\n if (!requireSuccess) {\r\n console.debug(result.data);\r\n return result.data;\r\n }\r\n }\r\n console.debug(result);\r\n if (result.data) {\r\n if (result.data.errorMessageToDisplay) {\r\n throw result.data.errorMessageToDisplay;\r\n }\r\n if (result.data.hasOwnProperty('message')) {\r\n var standardErrorResponse = result.data;\r\n throw standardErrorResponse.message;\r\n }\r\n }\r\n throw 'An unknown error has occurred';\r\n };\r\n AccountMessageService.$inject = [\r\n names.angular.Http,\r\n names.zbuyer.AppConfiguration,\r\n names.zbuyer.services.AuthenticationService\r\n ];\r\n return AccountMessageService;\r\n }());\r\n angular.module(names.zbuyer.Application)\r\n .service(names.zbuyer.services.AccountMessageService, AccountMessageService);\r\n })(implementation = services.implementation || (services.implementation = {}));\r\n })(services = zbuyer.services || (zbuyer.services = {}));\r\n})(zbuyer || (zbuyer = {}));\r\n\n/// \r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var ClientId = 'zBuyer.Mobile.Web.UI';\r\n var AuthenticationService = /** @class */ (function () {\r\n function AuthenticationService($http, $httpParamSerializer, $interval, $q, $cookies, $window, storage, appConfiguration, deviceIdService) {\r\n this.$http = $http;\r\n this.$httpParamSerializer = $httpParamSerializer;\r\n this.$interval = $interval;\r\n this.$q = $q;\r\n this.$cookies = $cookies;\r\n this.$window = $window;\r\n this.storage = storage;\r\n this.appConfiguration = appConfiguration;\r\n this.deviceIdService = deviceIdService;\r\n this.initialAuthPromise = this.validateAuth();\r\n }\r\n AuthenticationService.prototype.getAuthenticationHeader = function () {\r\n var token = this.getAuthenticationToken();\r\n if (token != null) {\r\n return \"bearer \".concat(token);\r\n }\r\n return '';\r\n };\r\n AuthenticationService.prototype.getAuthenticationToken = function () {\r\n var tokenInfo = this.storage.get(names.zbuyer.cookies.AuthToken);\r\n if (tokenInfo) {\r\n return tokenInfo.access_token;\r\n }\r\n return null;\r\n };\r\n AuthenticationService.prototype.getInitialAuthPromise = function () {\r\n return this.initialAuthPromise;\r\n };\r\n AuthenticationService.prototype.keepAlive = function (continuous) {\r\n var _this = this;\r\n if (continuous === true) {\r\n if (this.keepAlivePromise) {\r\n this.$interval.cancel(this.keepAlivePromise);\r\n }\r\n this.keepAlivePromise = this.$interval(function () { return _this.keepAlive(); }, this.appConfiguration.keepAliveInterval);\r\n }\r\n else if (continuous === false) {\r\n this.$interval.cancel(this.keepAlivePromise);\r\n this.keepAlivePromise = null;\r\n }\r\n else {\r\n // Default single keep-alive\r\n this.refreshWebApiConnection();\r\n this.refreshWebUiConnection();\r\n }\r\n };\r\n AuthenticationService.prototype.login = function (request) {\r\n var _this = this;\r\n var deferred = this.$q.defer();\r\n var config = this.getRequestConfig(true);\r\n var requestData = this.$httpParamSerializer(request);\r\n this.$http.post(this.appConfiguration.authTokenUrl, requestData, config).then(function (result) {\r\n if (result.status == 200) {\r\n _this.storeAuthenticationToken(result.data);\r\n deferred.resolve(result.data.access_token);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n AuthenticationService.prototype.loginAs = function (memberId, password) {\r\n var _this = this;\r\n if (password === void 0) { password = 'bypass'; }\r\n var deferred = this.$q.defer();\r\n var config = this.getRequestConfig(true);\r\n var requestData = this.$httpParamSerializer({\r\n grant_type: 'password',\r\n username: memberId.toString(),\r\n password: password,\r\n client_id: ClientId\r\n });\r\n this.$http.post(this.appConfiguration.authTokenUrl, requestData, config).then(function (result) {\r\n if (result.status == 200) {\r\n _this.storeAuthenticationToken(result.data);\r\n deferred.resolve(result.data.access_token);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n AuthenticationService.prototype.loginWithUserNameAndPassword = function (userName, password) {\r\n var requestData = {\r\n grant_type: 'password',\r\n username: userName,\r\n password: password,\r\n client_id: ClientId,\r\n deviceToken: this.deviceIdService.getStoredDeviceId(),\r\n devicePlatform: 'WEB'\r\n };\r\n return this.login(requestData);\r\n };\r\n AuthenticationService.prototype.loginWithKey = function (loginKey) {\r\n var requestData = {\r\n grant_type: 'password',\r\n username: '',\r\n password: '',\r\n client_id: ClientId,\r\n deviceToken: this.deviceIdService.getStoredDeviceId(),\r\n devicePlatform: 'WEB',\r\n loginKey: loginKey\r\n };\r\n return this.login(requestData);\r\n };\r\n AuthenticationService.prototype.logout = function () {\r\n this.revokeAuthentication();\r\n this.$window.location.href = new URL('/account/login', this.appConfiguration.baseUrl).href;\r\n };\r\n AuthenticationService.prototype.updateDefaultAuthHeader = function () {\r\n var authToken = this.getAuthenticationToken();\r\n if (authToken != null) {\r\n this.$http.defaults.headers.common['Authorization'] = 'bearer ' + authToken;\r\n }\r\n };\r\n AuthenticationService.prototype.useRefreshToken = function () {\r\n var _this = this;\r\n var deferred = this.$q.defer();\r\n var config = this.getAuthenticationRequestConfig();\r\n var refreshToken = this.getRefreshToken();\r\n if (refreshToken !== null) {\r\n var requestData = this.$httpParamSerializer({\r\n 'refresh_token': refreshToken,\r\n 'grant_type': 'refresh_token'\r\n });\r\n this.$http.post(this.appConfiguration.authTokenUrl, requestData, config).then(function (result) {\r\n if (result.status == 200) {\r\n _this.storeAuthenticationToken(result.data);\r\n deferred.resolve(result);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n }\r\n else {\r\n deferred.reject();\r\n }\r\n return deferred.promise;\r\n };\r\n AuthenticationService.prototype.validateAuth = function () {\r\n var _this = this;\r\n var tokenInfo = this.storage.get(names.zbuyer.cookies.AuthToken);\r\n if (!tokenInfo) {\r\n return this.$q.resolve(false);\r\n }\r\n return this.validateAuthCore().then(function (status) {\r\n switch (status) {\r\n case 200:\r\n return _this.$q.resolve(true);\r\n case 400:\r\n return _this.$q.resolve(false);\r\n case 401:\r\n return _this.useRefreshToken()\r\n .then(function () { return _this.validateAuthCore().then(function (status) { return _this.$q.resolve(status == 200); }); })\r\n .catch(function () { return _this.$q.resolve(false); });\r\n default:\r\n return _this.$q.resolve(false);\r\n }\r\n }).then(function (authSuccess) {\r\n if (!authSuccess) {\r\n _this.clearAuthentication();\r\n }\r\n return authSuccess;\r\n });\r\n };\r\n AuthenticationService.prototype.clearAuthentication = function () {\r\n this.storage.deleteKey(names.zbuyer.cookies.AuthToken);\r\n };\r\n AuthenticationService.prototype.getAuthenticationRequestConfig = function (withCredentials) {\r\n if (withCredentials === void 0) { withCredentials = false; }\r\n var authHeader = this.getAuthenticationHeader();\r\n var config = {\r\n headers: {\r\n 'Authorization': authHeader,\r\n 'Content-Type': 'application/x-www-form-urlencoded',\r\n 'zBuyer-Device': this.$window.location.href\r\n },\r\n withCredentials: withCredentials\r\n };\r\n return config;\r\n };\r\n AuthenticationService.prototype.getRequestConfig = function (withCredentials) {\r\n if (withCredentials === void 0) { withCredentials = false; }\r\n var config = {\r\n headers: {\r\n 'Content-Type': 'application/x-www-form-urlencoded',\r\n 'zBuyer-Device': this.$window.location.href\r\n },\r\n withCredentials: withCredentials\r\n };\r\n return config;\r\n };\r\n AuthenticationService.prototype.getRefreshToken = function () {\r\n var tokenInfo = this.storage.get(names.zbuyer.cookies.AuthToken);\r\n if (tokenInfo) {\r\n return tokenInfo.refresh_token;\r\n }\r\n return null;\r\n };\r\n AuthenticationService.prototype.refreshWebApiConnection = function () {\r\n var _this = this;\r\n this.validateAuthCore().then(function (status) {\r\n if (status == 401) {\r\n // For 401 unauthorized, attempt to refresh auth token and try to validate auth again\r\n return _this.useRefreshToken()\r\n .then(function () { return _this.validateAuthCore().then(function (status2) { return status2; }); })\r\n .catch(function () { return status; }); // original 401\r\n }\r\n return status;\r\n }).then(function (status) {\r\n if (status == 400) {\r\n _this.keepAlive(false);\r\n alert(zbuyer.messages.ReloadOnUserChanged);\r\n _this.$window.location.href = _this.appConfiguration.baseUrl;\r\n }\r\n else if (status == 401) {\r\n _this.clearAuthentication();\r\n _this.$window.location.href = \"account/login?result=\".concat(names.zbuyer.loginreasons.Unauthorized);\r\n }\r\n });\r\n };\r\n AuthenticationService.prototype.refreshWebUiConnection = function () {\r\n var _this = this;\r\n this.$http.get(this.appConfiguration.baseUrl + 'keep-alive').then(function (result) {\r\n if (result.status !== 200) {\r\n _this.logout();\r\n }\r\n });\r\n };\r\n AuthenticationService.prototype.revokeAuthentication = function () {\r\n var config = this.getAuthenticationRequestConfig();\r\n this.$http.get(this.appConfiguration.webServiceUrl + '/auth/revoke', config);\r\n this.clearAuthentication();\r\n };\r\n AuthenticationService.prototype.storeAuthenticationToken = function (tokenInfo) {\r\n this.storage.set(names.zbuyer.cookies.AuthToken, tokenInfo);\r\n if (tokenInfo) {\r\n this.$http.defaults.headers.common['Authorization'] = 'bearer ' + tokenInfo.access_token;\r\n }\r\n };\r\n AuthenticationService.prototype.validateAuthCore = function () {\r\n var _this = this;\r\n var authUrl = \"\".concat(this.appConfiguration.webServiceUrl, \"/auth/authorize\");\r\n if (this.accountId) {\r\n // Send up known account ID (API to return 400 on mismatch)\r\n authUrl = \"\".concat(authUrl, \"/\").concat(this.accountId);\r\n }\r\n var config = this.getAuthenticationRequestConfig();\r\n return this.$http.get(authUrl, config).then(function (result) {\r\n if (result.status == 200 && _this.accountId == null) {\r\n // AccountId (if sent) matches auth claim (otherwise, retain AccountId to validate in future calls)\r\n _this.accountId = result.data;\r\n }\r\n return _this.$q.resolve(result.status);\r\n });\r\n };\r\n AuthenticationService.$inject = [\r\n names.angular.Http,\r\n names.angular.HttpParamSerializer,\r\n names.angular.Interval,\r\n names.angular.Q,\r\n names.angular.Cookies,\r\n names.angular.Window,\r\n names.jquery.JStorage,\r\n names.zbuyer.AppConfiguration,\r\n names.zbuyer.services.DeviceIdService\r\n ];\r\n return AuthenticationService;\r\n }());\r\n angular.module(names.zbuyer.Application)\r\n .service(names.zbuyer.services.AuthenticationService, AuthenticationService);\r\n })(implementation = services.implementation || (services.implementation = {}));\r\n })(services = zbuyer.services || (zbuyer.services = {}));\r\n})(zbuyer || (zbuyer = {}));\r\n\n/// \r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var CheckoutHelperService = /** @class */ (function () {\r\n function CheckoutHelperService($http, appConfiguration, authenticationService) {\r\n this.$http = $http;\r\n this.appConfiguration = appConfiguration;\r\n this.authenticationService = authenticationService;\r\n this.baseUrl = \"\".concat(this.appConfiguration.webServiceUrl, \"/precheckout\");\r\n }\r\n CheckoutHelperService.prototype.getQuestionStatuses = function () {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.get(\"\".concat(this.baseUrl, \"/question-statuses\"))\r\n .then(function (result) { return _this.handleResponse(result, true); });\r\n };\r\n CheckoutHelperService.prototype.setLeadTypePreference = function (homeSellers, homeBuyers) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.post(\"\".concat(this.baseUrl, \"/lead-types?buyers=\").concat(homeBuyers, \"&sellers=\").concat(homeSellers), null)\r\n .then(function (result) {\r\n _this.handleResponse(result, true);\r\n });\r\n };\r\n CheckoutHelperService.prototype.getCurrentWorkingArea = function () {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.get(\"\".concat(this.baseUrl, \"/working-area\"))\r\n .then(function (result) { return _this.handleResponse(result, true); });\r\n };\r\n CheckoutHelperService.prototype.getCountiesForState = function (stateCode) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.get(\"\".concat(this.baseUrl, \"/counties/\").concat(stateCode))\r\n .then(function (result) { return _this.handleResponse(result, true).counties; });\r\n };\r\n CheckoutHelperService.prototype.getMetroAreasForState = function (stateCode) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.get(\"\".concat(this.baseUrl, \"/metros/\").concat(stateCode))\r\n .then(function (result) { return _this.handleResponse(result, true).metroAreas; });\r\n };\r\n CheckoutHelperService.prototype.addCountyToWorkingArea = function (county) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n var request = {\r\n countyName: county.name,\r\n stateCode: county.stateAbbreviation\r\n };\r\n return this.$http.post(\"\".concat(this.baseUrl, \"/working-area/county\"), request)\r\n .then(function (result) {\r\n _this.handleResponse(result, true);\r\n });\r\n };\r\n CheckoutHelperService.prototype.addMetroAreaToWorkingArea = function (metroArea) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n var request = {\r\n metroAreaName: metroArea.name,\r\n stateCode: metroArea.stateCode\r\n };\r\n return this.$http.post(\"\".concat(this.baseUrl, \"/working-area/metro\"), request)\r\n .then(function (result) {\r\n _this.handleResponse(result, true);\r\n });\r\n };\r\n CheckoutHelperService.prototype.removeCountyFromWorkingArea = function (county) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n var request = {\r\n countyName: county.name,\r\n stateCode: county.stateAbbreviation\r\n };\r\n return this.$http.delete(\"\".concat(this.baseUrl, \"/working-area/county\"), {\r\n data: request,\r\n headers: { 'Content-Type': 'application/json;charset=utf-8' }\r\n })\r\n .then(function (result) {\r\n _this.handleResponse(result, true);\r\n });\r\n };\r\n CheckoutHelperService.prototype.validateWorkingAreaDisplay = function (counties) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.post(\"\".concat(this.baseUrl, \"/working-area/validate\"), { counties: counties })\r\n .then(function (result) { return _this.handleResponse(result, true).success; });\r\n };\r\n CheckoutHelperService.prototype.getTeamSize = function () {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.get(\"\".concat(this.baseUrl, \"/team-size\"))\r\n .then(function (result) { return _this.handleResponse(result, true); });\r\n };\r\n CheckoutHelperService.prototype.setTeamSize = function (teamSize) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.post(\"\".concat(this.baseUrl, \"/team-size\"), { teamSize: teamSize })\r\n .then(function (result) {\r\n _this.handleResponse(result, true);\r\n });\r\n };\r\n CheckoutHelperService.prototype.getRecommendedPackage = function () {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.get(\"\".concat(this.baseUrl, \"/recommended\"))\r\n .then(function (result) { return _this.handleResponse(result, true); });\r\n };\r\n CheckoutHelperService.prototype.setRecomendedPackageBuyers = function (buyersLeadCount) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.post(\"\".concat(this.baseUrl, \"/recommended/buyers/\").concat(buyersLeadCount), null)\r\n .then(function (result) { return _this.handleResponse(result, true); });\r\n };\r\n CheckoutHelperService.prototype.setRecomendedPackageSellers = function (sellersLeadCount) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.post(\"\".concat(this.baseUrl, \"/recommended/sellers/\").concat(sellersLeadCount), null)\r\n .then(function (result) { return _this.handleResponse(result, true); });\r\n };\r\n CheckoutHelperService.prototype.validateRecommendedPackageDisplay = function (request) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.post(\"\".concat(this.baseUrl, \"/recommended/validate\"), request)\r\n .then(function (result) { return _this.handleResponse(result, false); });\r\n };\r\n CheckoutHelperService.prototype.getAdvancedPackage = function () {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.get(\"\".concat(this.baseUrl, \"/advanced\"))\r\n .then(function (result) { return _this.handleResponse(result, true); });\r\n };\r\n CheckoutHelperService.prototype.setAdvancedCountyLeadCounts = function (update) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.post(\"\".concat(this.baseUrl, \"/advanced/lead-counts\"), update)\r\n .then(function (result) { return _this.handleResponse(result, true); });\r\n };\r\n CheckoutHelperService.prototype.validateAdvancedPackageDisplay = function (displayedPackage) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.post(\"\".concat(this.baseUrl, \"/advanced/validate\"), displayedPackage)\r\n .then(function (result) { var _a, _b; return (_b = (_a = _this.handleResponse(result, true)) === null || _a === void 0 ? void 0 : _a.success) !== null && _b !== void 0 ? _b : false; });\r\n };\r\n CheckoutHelperService.prototype.resetToRecommendedPackage = function () {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.get(\"\".concat(this.baseUrl, \"/recommended/reset\"))\r\n .then(function (result) {\r\n _this.handleResponse(result, true);\r\n });\r\n };\r\n CheckoutHelperService.prototype.handleResponse = function (result, requireSuccess) {\r\n var _a;\r\n if (requireSuccess === void 0) { requireSuccess = false; }\r\n if ((result === null || result === void 0 ? void 0 : result.status) == 200 && ((_a = result.data) === null || _a === void 0 ? void 0 : _a.success)) {\r\n return result.data;\r\n }\r\n if (!requireSuccess) {\r\n console.debug(result.data);\r\n return result.data;\r\n }\r\n if (result === null || result === void 0 ? void 0 : result.data) {\r\n if (result.data.errorMessageToDisplay) {\r\n console.debug(result.data.internalDebugInfo);\r\n throw result.data.errorMessageToDisplay;\r\n }\r\n else if (result.data.hasOwnProperty('message')) {\r\n var standardErrorResponse = result.data;\r\n console.debug(result.data);\r\n throw standardErrorResponse.message;\r\n }\r\n }\r\n throw 'An unknown error has occurred';\r\n };\r\n CheckoutHelperService.$inject = [\r\n names.angular.Http,\r\n names.zbuyer.AppConfiguration,\r\n names.zbuyer.services.AuthenticationService\r\n ];\r\n return CheckoutHelperService;\r\n }());\r\n angular.module(names.zbuyer.Application)\r\n .service(names.zbuyer.services.CheckoutHelperService, CheckoutHelperService);\r\n })(implementation = services.implementation || (services.implementation = {}));\r\n })(services = zbuyer.services || (zbuyer.services = {}));\r\n})(zbuyer || (zbuyer = {}));\r\n\n/// \r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var CalledFrom;\r\n (function (CalledFrom) {\r\n CalledFrom[CalledFrom[\"Unknown\"] = 0] = \"Unknown\";\r\n CalledFrom[CalledFrom[\"CartBuilderPage\"] = 1] = \"CartBuilderPage\";\r\n CalledFrom[CalledFrom[\"CheckoutPage\"] = 2] = \"CheckoutPage\";\r\n })(CalledFrom || (CalledFrom = {}));\r\n var CheckoutService = /** @class */ (function () {\r\n function CheckoutService($http, appConfiguration, authenticationService) {\r\n this.$http = $http;\r\n this.appConfiguration = appConfiguration;\r\n this.authenticationService = authenticationService;\r\n this.baseUrl = \"\".concat(this.appConfiguration.webServiceUrl, \"/checkout\");\r\n }\r\n CheckoutService.prototype.checkCartIsValid = function () {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.get(\"\".concat(this.baseUrl, \"/validate\"))\r\n .then(function (result) { return _this.handleResponse(result); });\r\n };\r\n CheckoutService.prototype.getSubscriptionStatusAndLocationsHtml = function () {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.get(\"\".concat(this.baseUrl, \"/subscription-html\"))\r\n .then(function (result) { return _this.handleResponse(result, true); });\r\n };\r\n CheckoutService.prototype.getCartItemOptions = function (county, state) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n var request = {\r\n county: county,\r\n state: state\r\n };\r\n return this.$http.post(\"\".concat(this.baseUrl, \"/get-cart-item-options\"), request)\r\n .then(function (result) { return _this.handleResponse(result, true); });\r\n };\r\n CheckoutService.prototype.getCurrentCart = function (isFinalCheckout) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n var request = {\r\n locationCalledFrom: isFinalCheckout ? CalledFrom.CheckoutPage : CalledFrom.CartBuilderPage\r\n };\r\n return this.$http.post(\"\".concat(this.baseUrl, \"/get-current-cart\"), request)\r\n .then(function (result) { return _this.handleResponse(result, false); });\r\n };\r\n CheckoutService.prototype.loadCheckoutData = function () {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.get(this.baseUrl)\r\n .then(function (result) { return _this.handleResponse(result); });\r\n };\r\n CheckoutService.prototype.performCheckout = function (request) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.post(this.baseUrl, request)\r\n .then(function (result) { return _this.handleResponse(result); });\r\n };\r\n CheckoutService.prototype.updateCart = function (request) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.post(\"\".concat(this.baseUrl, \"/update-cart\"), request)\r\n .then(function (result) { return _this.handleResponse(result, true); });\r\n };\r\n CheckoutService.prototype.updateCreditCard = function (request) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.post(\"\".concat(this.baseUrl, \"/credit-card\"), request)\r\n .then(function (result) { return _this.handleResponse(result); });\r\n };\r\n CheckoutService.prototype.handleResponse = function (result, requireSuccess) {\r\n var _a;\r\n if (requireSuccess === void 0) { requireSuccess = false; }\r\n if ((result === null || result === void 0 ? void 0 : result.status) == 200 && ((_a = result.data) === null || _a === void 0 ? void 0 : _a.success)) {\r\n return result.data;\r\n }\r\n if (!requireSuccess) {\r\n console.debug(result.data);\r\n return result.data;\r\n }\r\n if (result === null || result === void 0 ? void 0 : result.data) {\r\n if (result.data.errorMessageToDisplay) {\r\n console.debug(result.data.internalDebugInfo);\r\n throw result.data.errorMessageToDisplay;\r\n }\r\n else if (result.data.hasOwnProperty('message')) {\r\n var standardErrorResponse = result.data;\r\n console.debug(result.data);\r\n throw standardErrorResponse.message;\r\n }\r\n }\r\n throw 'An unknown error has occurred';\r\n };\r\n CheckoutService.$inject = [\r\n names.angular.Http,\r\n names.zbuyer.AppConfiguration,\r\n names.zbuyer.services.AuthenticationService\r\n ];\r\n return CheckoutService;\r\n }());\r\n angular.module(names.zbuyer.Application)\r\n .service(names.zbuyer.services.CheckoutService, CheckoutService);\r\n })(implementation = services.implementation || (services.implementation = {}));\r\n })(services = zbuyer.services || (zbuyer.services = {}));\r\n})(zbuyer || (zbuyer = {}));\r\n\n/// \r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var CountiesService = /** @class */ (function () {\r\n function CountiesService($http, $httpParamSerializer, $q, appConfiguration, authenticationService) {\r\n this.$http = $http;\r\n this.$httpParamSerializer = $httpParamSerializer;\r\n this.$q = $q;\r\n this.appConfiguration = appConfiguration;\r\n this.authenticationService = authenticationService;\r\n this.baseUrl = \"\".concat(this.appConfiguration.webServiceUrl, \"/counties\");\r\n }\r\n CountiesService.prototype.getCountiesForState = function (stateAbbreviation) {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.get(\"\".concat(this.baseUrl, \"/state/\").concat(stateAbbreviation)).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data.counties);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n CountiesService.prototype.getCountyForZip = function (zip) {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.get(\"\".concat(this.baseUrl, \"/\").concat(zip)).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data.county);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n CountiesService.prototype.getRelatedCounties = function (state, county) {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n var request = { state: state, county: county };\r\n this.$http.post(\"\".concat(this.baseUrl, \"/related\"), request)\r\n .then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data);\r\n }\r\n else {\r\n deferred.reject(result);\r\n }\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n CountiesService.$inject = [\r\n names.angular.Http,\r\n names.angular.HttpParamSerializer,\r\n names.angular.Q,\r\n names.zbuyer.AppConfiguration,\r\n names.zbuyer.services.AuthenticationService\r\n ];\r\n return CountiesService;\r\n }());\r\n angular.module(names.zbuyer.Application)\r\n .service(names.zbuyer.services.CountiesService, CountiesService);\r\n })(implementation = services.implementation || (services.implementation = {}));\r\n })(services = zbuyer.services || (zbuyer.services = {}));\r\n})(zbuyer || (zbuyer = {}));\r\n\n/// \r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var ComplianceService = /** @class */ (function () {\r\n function ComplianceService($http, appConfiguration, authenticationService, notificationService) {\r\n this.$http = $http;\r\n this.appConfiguration = appConfiguration;\r\n this.authenticationService = authenticationService;\r\n this.notificationService = notificationService;\r\n this.baseUrl = \"\".concat(this.appConfiguration.webServiceUrl, \"/compliance\");\r\n }\r\n ComplianceService.prototype.getProspectingCompliance = function () {\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.get(\"\".concat(this.baseUrl, \"/prospecting\"))\r\n .then(ComplianceService.handleLegacyResponse)\r\n .then(function (response) { return !response.phoneNumbersLocked; });\r\n };\r\n ComplianceService.prototype.setProspectingCompliance = function (agreedTerms) {\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.post(\"\".concat(this.baseUrl, \"/prospecting\"), { agreedTerms: agreedTerms })\r\n .then(ComplianceService.handleLegacyResponse);\r\n };\r\n ComplianceService.prototype.checkHighProspectingPhoneRequestRate = function () {\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.get(\"\".concat(this.baseUrl, \"/prospecting/excess\"))\r\n .then(function (result) {\r\n var _a;\r\n if (result.status == 200 && result.data) {\r\n return result.data;\r\n }\r\n console.debug(result);\r\n if ((_a = result.data) === null || _a === void 0 ? void 0 : _a.hasOwnProperty('message')) {\r\n var standardErrorResponse = result.data;\r\n throw standardErrorResponse.message;\r\n }\r\n throw 'An unknown error has occurred';\r\n });\r\n };\r\n ComplianceService.prototype.recordTrustedFormCertUrl = function (pageUrlOrName, certUrl, accountMessageId) {\r\n this.authenticationService.updateDefaultAuthHeader();\r\n var request = {\r\n accountMessageId: accountMessageId,\r\n pageUrlOrName: pageUrlOrName,\r\n trustedFormCertUrl: certUrl\r\n };\r\n return this.$http.post(\"\".concat(this.baseUrl, \"/trusted-form\"), request)\r\n .then(function (response) { return ComplianceService.handleLegacyResponse(response, false); });\r\n };\r\n ComplianceService.prototype.applyTrustedFormCertification = function (pageUrlOrName, accountMessageId) {\r\n var _this = this;\r\n return ComplianceService.loadTrustedFormCertification().then(function (certUrl) {\r\n return _this.recordTrustedFormCertUrl(pageUrlOrName, certUrl, accountMessageId)\r\n .then(function (response) {\r\n if (!response.success) {\r\n console.debug(response.internalDebugInfo);\r\n _this.notificationService.warning(response.errorMessageToDisplay);\r\n }\r\n return response.success;\r\n });\r\n })\r\n .catch(function (err) {\r\n console.debug(err);\r\n _this.notificationService.warning('Unable to set up third-party consent form certification.');\r\n return false;\r\n });\r\n };\r\n ComplianceService.loadTrustedFormCertification = function () {\r\n var $injector = angular.element('html').injector();\r\n var $q = $injector.get(names.angular.Q);\r\n if (ComplianceService.LoadedTrustedForm && ComplianceService.TrustedFormCertUrl) {\r\n return $q.resolve(ComplianceService.TrustedFormCertUrl);\r\n }\r\n var deferred = $q.defer();\r\n ComplianceService.LoadedTrustedForm = true;\r\n // Core TrustedForm script-load (based on original Javascript supplied in documentation)\r\n var fieldName = 'xxTrustedFormCertUrl';\r\n var provideReferrer = false;\r\n var invertFieldSensitivity = false;\r\n var scriptTag = document.createElement('script');\r\n scriptTag.type = 'text/javascript';\r\n scriptTag.async = true;\r\n scriptTag.src = \"\".concat(document.location.protocol, \"//api.trustedform.com/trustedform.js?provide_referrer=\").concat(encodeURIComponent(provideReferrer))\r\n + \"&field=\".concat(encodeURIComponent(fieldName), \"&l=\").concat(new Date().getTime() + Math.random(), \"&invert_field_sensitivity=\").concat(invertFieldSensitivity, \"&use_tagged_consent=true\");\r\n var firstScriptTag = document.getElementsByTagName('script')[0];\r\n firstScriptTag.parentNode.insertBefore(scriptTag, firstScriptTag);\r\n var hiddenFieldSelector = \"form input[name=\\\"\".concat(fieldName, \"\\\"]\");\r\n var maxRetries = 50;\r\n var numRetries = 0;\r\n var certCheck = function () {\r\n var certUrl = $(hiddenFieldSelector).first().val();\r\n if (certUrl && certUrl.trim() !== '') {\r\n console.debug('TrustedForm Cert URL acquired:', certUrl);\r\n ComplianceService.TrustedFormCertUrl = certUrl;\r\n deferred.resolve(certUrl);\r\n }\r\n else {\r\n numRetries++;\r\n if (numRetries > maxRetries) {\r\n deferred.reject('Exceeded max number of retries watching for TrustedForm Cert URL');\r\n }\r\n else {\r\n setTimeout(certCheck, 50);\r\n }\r\n }\r\n };\r\n setTimeout(certCheck, 75);\r\n return deferred.promise;\r\n };\r\n ComplianceService.handleLegacyResponse = function (result, requireSuccess) {\r\n if (requireSuccess === void 0) { requireSuccess = true; }\r\n if (result.status == 200 && result.data) {\r\n if (result.data.success) {\r\n return result.data;\r\n }\r\n if (!requireSuccess) {\r\n console.debug(result.data);\r\n return result.data;\r\n }\r\n }\r\n console.debug(result);\r\n if (result.data) {\r\n if (result.data.errorMessageToDisplay) {\r\n throw result.data.errorMessageToDisplay;\r\n }\r\n if (result.data.hasOwnProperty('message')) {\r\n var standardErrorResponse = result.data;\r\n throw standardErrorResponse.message;\r\n }\r\n }\r\n throw 'An unknown error has occurred';\r\n };\r\n ComplianceService.LoadedTrustedForm = false;\r\n ComplianceService.TrustedFormCertUrl = null;\r\n ComplianceService.$inject = [\r\n names.angular.Http,\r\n names.zbuyer.AppConfiguration,\r\n names.zbuyer.services.AuthenticationService,\r\n names.zbuyer.services.NotificationService,\r\n ];\r\n return ComplianceService;\r\n }());\r\n implementation.ComplianceService = ComplianceService;\r\n angular.module(names.zbuyer.Application)\r\n .service(names.zbuyer.services.ComplianceService, ComplianceService);\r\n })(implementation = services.implementation || (services.implementation = {}));\r\n })(services = zbuyer.services || (zbuyer.services = {}));\r\n})(zbuyer || (zbuyer = {}));\r\n\n/// \r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var CountyPackagesService = /** @class */ (function () {\r\n function CountyPackagesService($http, $httpParamSerializer, $q, appConfiguration, authenticationService) {\r\n this.$http = $http;\r\n this.$httpParamSerializer = $httpParamSerializer;\r\n this.$q = $q;\r\n this.appConfiguration = appConfiguration;\r\n this.authenticationService = authenticationService;\r\n this.baseUrl = \"\".concat(this.appConfiguration.webServiceUrl, \"/county-packages\");\r\n }\r\n CountyPackagesService.prototype.getCountyPackageDataForState = function (state) {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.get(\"\".concat(this.baseUrl, \"/\").concat(state, \"/state\")).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data.countyPackageDataCounties);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n CountyPackagesService.prototype.getCountyPackageDataPendingForAccount = function () {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.get(\"\".concat(this.baseUrl, \"/account/pending\")).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data.countyPackageDataCounties);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n CountyPackagesService.$inject = [\r\n names.angular.Http,\r\n names.angular.HttpParamSerializer,\r\n names.angular.Q,\r\n names.zbuyer.AppConfiguration,\r\n names.zbuyer.services.AuthenticationService\r\n ];\r\n return CountyPackagesService;\r\n }());\r\n angular.module(names.zbuyer.Application)\r\n .service(names.zbuyer.services.CountyPackagesService, CountyPackagesService);\r\n })(implementation = services.implementation || (services.implementation = {}));\r\n })(services = zbuyer.services || (zbuyer.services = {}));\r\n})(zbuyer || (zbuyer = {}));\r\n\n/// \r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var CountyStatisticsService = /** @class */ (function () {\r\n function CountyStatisticsService($http, $httpParamSerializer, $q, appConfiguration, authenticationService) {\r\n this.$http = $http;\r\n this.$httpParamSerializer = $httpParamSerializer;\r\n this.$q = $q;\r\n this.appConfiguration = appConfiguration;\r\n this.authenticationService = authenticationService;\r\n this.baseUrl = \"\".concat(this.appConfiguration.webServiceUrl, \"/county-statistics\");\r\n }\r\n CountyStatisticsService.prototype.getCityLeadCountsForStateAndCounty = function (state, county) {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.get(\"\".concat(this.baseUrl, \"/city-leads?state=\").concat(encodeURIComponent(state), \"&county=\").concat(encodeURIComponent(county))).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data.cityLeads);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise.then(function (response) { return { cityLeads: response, countyRequested: county, stateRequested: state }; });\r\n };\r\n CountyStatisticsService.prototype.getCountyStatisticsForStateAndCounty = function (state, county) {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.get(\"\".concat(this.baseUrl, \"/statistics?state=\").concat(encodeURIComponent(state), \"&county=\").concat(encodeURIComponent(county))).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data.countyStatistics);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise.then(function (response) { return { countyStatistics: response, countyRequested: county, stateRequested: state }; });\r\n };\r\n CountyStatisticsService.prototype.getCountyLeadsCoordinatesForStateAndCounty = function (state, county) {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.get(\"\".concat(this.baseUrl, \"/leads-coordinates?state=\").concat(encodeURIComponent(state), \"&county=\").concat(encodeURIComponent(county))).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise.then(function (response) { return { countyLeadsCoordinates: response, countyRequested: county, stateRequested: state }; });\r\n };\r\n CountyStatisticsService.$inject = [\r\n names.angular.Http,\r\n names.angular.HttpParamSerializer,\r\n names.angular.Q,\r\n names.zbuyer.AppConfiguration,\r\n names.zbuyer.services.AuthenticationService\r\n ];\r\n return CountyStatisticsService;\r\n }());\r\n angular.module(names.zbuyer.Application)\r\n .service(names.zbuyer.services.CountyStatisticsService, CountyStatisticsService);\r\n })(implementation = services.implementation || (services.implementation = {}));\r\n })(services = zbuyer.services || (zbuyer.services = {}));\r\n})(zbuyer || (zbuyer = {}));\r\n\n/// \r\nvar __extends = (this && this.__extends) || (function () {\r\n var extendStatics = function (d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n };\r\n return function (d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var CrmService = /** @class */ (function (_super) {\r\n __extends(CrmService, _super);\r\n function CrmService($http, appConfiguration, authenticationService) {\r\n return _super.call(this, $http, appConfiguration, authenticationService, true) || this;\r\n }\r\n CrmService.prototype.initializeBaseUrl = function (webServiceUrl) {\r\n return \"\".concat(webServiceUrl, \"/crm\");\r\n };\r\n CrmService.prototype.add = function (connectionTypeId, inputProperties) {\r\n var request = {\r\n crmConnectionTypeId: connectionTypeId,\r\n crmConnectionProperties: inputProperties,\r\n };\r\n return _super.prototype.postLegacy.call(this, this.baseUrl, request).then(function (response) { return response.crmConnection; });\r\n };\r\n CrmService.prototype.delete = function (id) {\r\n return _super.prototype.deleteLegacy.call(this, \"\".concat(this.baseUrl, \"/\").concat(id))\r\n .then(function () { return void 0; });\r\n };\r\n CrmService.prototype.getAll = function () {\r\n return _super.prototype.getLegacy.call(this, this.baseUrl)\r\n .then(function (response) { return response.crmConnections; });\r\n };\r\n CrmService.prototype.getTypes = function () {\r\n return _super.prototype.getLegacy.call(this, \"\".concat(this.baseUrl, \"/types\"))\r\n .then(function (response) { return response.crmConnectionTypes; });\r\n };\r\n CrmService.prototype.getDefaultType = function () {\r\n return _super.prototype.getLegacy.call(this, \"\".concat(this.baseUrl, \"/default-type\"));\r\n };\r\n CrmService.prototype.setEnabled = function (id, enabled) {\r\n return _super.prototype.postLegacy.call(this, \"\".concat(this.baseUrl, \"/enable/\").concat(id, \"/\").concat(enabled))\r\n .then(function () { return void 0; });\r\n };\r\n CrmService.$inject = [\r\n names.angular.Http,\r\n names.zbuyer.AppConfiguration,\r\n names.zbuyer.services.AuthenticationService\r\n ];\r\n return CrmService;\r\n }(services.LegacyApiService));\r\n implementation.CrmService = CrmService;\r\n angular.module(names.zbuyer.Application)\r\n .service(names.zbuyer.services.CrmService, CrmService);\r\n })(implementation = services.implementation || (services.implementation = {}));\r\n })(services = zbuyer.services || (zbuyer.services = {}));\r\n})(zbuyer || (zbuyer = {}));\r\n\n/// \r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var DeviceIdKey = \"DeviceId\";\r\n var DeviceIdService = /** @class */ (function () {\r\n function DeviceIdService(storage) {\r\n this.storage = storage;\r\n }\r\n DeviceIdService.prototype.getStoredDeviceId = function () {\r\n return this.storage.get(DeviceIdKey, null) || this.generateDeviceId();\r\n };\r\n DeviceIdService.prototype.generateDeviceId = function () {\r\n // This is not a true UUID, and Math.random may have a 1-in-1m chance of collision.\r\n // MP Note - I added a constant value at the beginning to prevent collisions with\r\n // real non-sequential UUIDs, which will never begin with \"00001111\". That will\r\n // increase the probability of Math.random collisions and decrease the probability\r\n // of real UUID collisions.\r\n var id = '00001111-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\r\n var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);\r\n return v.toString(16);\r\n });\r\n this.storage.set(DeviceIdKey, id);\r\n return id;\r\n };\r\n DeviceIdService.$inject = [\r\n names.jquery.JStorage,\r\n ];\r\n return DeviceIdService;\r\n }());\r\n angular.module(names.zbuyer.Application)\r\n .service(names.zbuyer.services.DeviceIdService, DeviceIdService);\r\n })(implementation = services.implementation || (services.implementation = {}));\r\n })(services = zbuyer.services || (zbuyer.services = {}));\r\n})(zbuyer || (zbuyer = {}));\r\n\n/// \r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var FolderService = /** @class */ (function () {\r\n function FolderService($http, $q, appConfiguration, authenticationService) {\r\n this.$http = $http;\r\n this.$q = $q;\r\n this.appConfiguration = appConfiguration;\r\n this.authenticationService = authenticationService;\r\n this.apiBaseUrl = this.appConfiguration.webServiceUrl + '/folders';\r\n }\r\n FolderService.prototype.addLeadToFolder = function (folder, leadId) {\r\n var deferred = this.$q.defer();\r\n var request = {\r\n folder: folder,\r\n leadId: leadId\r\n };\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.put(this.apiBaseUrl + \"/\".concat(folder.name, \"/add-lead/\").concat(leadId), request).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data.folder);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n FolderService.prototype.getFolderList = function () {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.get(this.apiBaseUrl + '/list').then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data.folderList);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n FolderService.prototype.getFolders = function () {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.get(this.apiBaseUrl).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data.folders);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n FolderService.prototype.renameFolder = function (currentFolderName, newFolderName) {\r\n var deferred = this.$q.defer();\r\n var request = {\r\n currentFolderName: currentFolderName,\r\n newName: newFolderName\r\n };\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.put(this.apiBaseUrl + '/rename', request).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve();\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n FolderService.$inject = [\r\n names.angular.Http,\r\n names.angular.Q,\r\n names.zbuyer.AppConfiguration,\r\n names.zbuyer.services.AuthenticationService\r\n ];\r\n return FolderService;\r\n }());\r\n angular.module(names.zbuyer.Application)\r\n .service(names.zbuyer.services.FoldersService, FolderService);\r\n })(implementation = services.implementation || (services.implementation = {}));\r\n })(services = zbuyer.services || (zbuyer.services = {}));\r\n})(zbuyer || (zbuyer = {}));\r\n\n/// \r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var GeneralApiService = /** @class */ (function () {\r\n function GeneralApiService($http, $q, appConfiguration, authenticationService) {\r\n this.$http = $http;\r\n this.$q = $q;\r\n this.appConfiguration = appConfiguration;\r\n this.authenticationService = authenticationService;\r\n }\r\n GeneralApiService.prototype.getVersionInfo = function () {\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.get(\"\".concat(this.appConfiguration.webServiceUrl, \"/versioninfo\")).then(function (response) { return response.data; });\r\n };\r\n GeneralApiService.prototype.validateRecaptcha = function (recaptchaKey) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n var recaptchaVerificationRequest = {\r\n key: recaptchaKey\r\n };\r\n return this.$http.post(\"\".concat(this.appConfiguration.webServiceUrl, \"/recaptcha\"), recaptchaVerificationRequest).then(function (r) {\r\n if (r.status == 200) {\r\n return _this.$q.resolve(r.data);\r\n }\r\n else {\r\n return _this.$q.reject(zbuyer.messages.ApiCommunicationError);\r\n }\r\n });\r\n };\r\n GeneralApiService.$inject = [\r\n names.angular.Http,\r\n names.angular.Q,\r\n names.zbuyer.AppConfiguration,\r\n names.zbuyer.services.AuthenticationService\r\n ];\r\n return GeneralApiService;\r\n }());\r\n angular.module(names.zbuyer.Application)\r\n .service(names.zbuyer.services.GeneralApiService, GeneralApiService);\r\n })(implementation = services.implementation || (services.implementation = {}));\r\n })(services = zbuyer.services || (zbuyer.services = {}));\r\n})(zbuyer || (zbuyer = {}));\r\n\n/// \r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var LeadPhoneNumberService = /** @class */ (function () {\r\n function LeadPhoneNumberService($http, $q, appConfiguration, authenticationService) {\r\n this.$http = $http;\r\n this.$q = $q;\r\n this.appConfiguration = appConfiguration;\r\n this.authenticationService = authenticationService;\r\n }\r\n LeadPhoneNumberService.prototype.getLeadPhoneNumber = function (id) {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.get(this.appConfiguration.webServiceUrl + '/leads/phone/' + id).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n LeadPhoneNumberService.prototype.getLeadPhoneNumbers = function (id, complianceReminderConfirmed) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n var requestUrl = \"\".concat(this.appConfiguration.webServiceUrl, \"/leads/phones/\").concat(id, \"?complianceReminderConfirmed=\").concat(complianceReminderConfirmed !== null && complianceReminderConfirmed !== void 0 ? complianceReminderConfirmed : false);\r\n return this.$http.get(requestUrl)\r\n .then(function (result) { return (result.status == 200) ? result.data : _this.$q.reject(result); });\r\n };\r\n LeadPhoneNumberService.$inject = [\r\n names.angular.Http,\r\n names.angular.Q,\r\n names.zbuyer.AppConfiguration,\r\n names.zbuyer.services.AuthenticationService\r\n ];\r\n return LeadPhoneNumberService;\r\n }());\r\n angular.module(names.zbuyer.Application)\r\n .service(names.zbuyer.services.LeadPhoneNumberService, LeadPhoneNumberService);\r\n })(implementation = services.implementation || (services.implementation = {}));\r\n })(services = zbuyer.services || (zbuyer.services = {}));\r\n})(zbuyer || (zbuyer = {}));\r\n\n/// \r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var LeadsService = /** @class */ (function () {\r\n function LeadsService($http, $httpParamSerializer, $q, appConfiguration, authenticationService) {\r\n this.$http = $http;\r\n this.$httpParamSerializer = $httpParamSerializer;\r\n this.$q = $q;\r\n this.appConfiguration = appConfiguration;\r\n this.authenticationService = authenticationService;\r\n this.baseUrl = \"\".concat(this.appConfiguration.webServiceUrl, \"/leads\");\r\n }\r\n LeadsService.prototype.addNoteToLead = function (noteText, leadId) {\r\n var deferred = this.$q.defer();\r\n var addNoteToLeadRequest = {\r\n leadId: leadId,\r\n noteText: noteText\r\n };\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.put(\"\".concat(this.baseUrl, \"/add-note\"), addNoteToLeadRequest).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.statusText);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n LeadsService.prototype.addRatingToLead = function (rating, leadId) {\r\n var deferred = this.$q.defer();\r\n var addRatingToLeadRequest = {\r\n leadId: leadId,\r\n rating: rating\r\n };\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.put(\"\".concat(this.baseUrl, \"/add-rating\"), addRatingToLeadRequest).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data.rating);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n LeadsService.prototype.getInvestorLead = function (leadId) {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.get(\"\".concat(this.baseUrl, \"/investor/\").concat(leadId)).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data.investorLead);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n LeadsService.prototype.getLead = function (leadId) {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.get(\"\".concat(this.baseUrl, \"/\").concat(leadId), { params: { includeGeoLocation: true } }).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data.lead);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n LeadsService.prototype.getLeadLocation = function (leadId) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.post(\"\".concat(this.baseUrl, \"/location\"), { \"Id\": leadId }).then(function (result) {\r\n if (result.status != 200) {\r\n return _this.$q.reject(result);\r\n }\r\n return _this.$q.resolve(result.data);\r\n });\r\n };\r\n LeadsService.prototype.getLeads = function (page, leadsPerPage, prospecting) {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.get(\"\".concat(this.baseUrl, \"/\").concat(leadsPerPage, \"/\").concat(page, \"/\").concat(prospecting)).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n LeadsService.prototype.getLeadsCount = function (filters, filtersEnabled, prospecting) {\r\n var deferred = this.$q.defer();\r\n var getLeadsCountRequest = {\r\n leadFilters: filters,\r\n filtersEnabled: filtersEnabled,\r\n prospecting: prospecting\r\n };\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.post(\"\".concat(this.baseUrl, \"/count\"), getLeadsCountRequest).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data.count);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n LeadsService.prototype.getPrintableLead = function (lead, complianceConfirmed) {\r\n var deferred = this.$q.defer();\r\n var request = {\r\n leadId: lead.id,\r\n complianceReminderConfirmed: complianceConfirmed !== null && complianceConfirmed !== void 0 ? complianceConfirmed : false\r\n };\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.post(\"\".concat(this.baseUrl, \"/printable\"), request, { responseType: 'blob' }).then(function (result) {\r\n if (result.status == 200) {\r\n var printLeadResult = {\r\n blob: new Blob([result.data], { type: 'application/pdf' }),\r\n };\r\n deferred.resolve(printLeadResult);\r\n return;\r\n }\r\n // Special handling for prospecting rate limit warning\r\n if (result.status == 429) {\r\n var printLeadResult = {\r\n rateLimitReached: true\r\n };\r\n deferred.resolve(printLeadResult);\r\n return;\r\n }\r\n console.debug(result);\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n LeadsService.prototype.getLeadVCard = function (lead, complianceConfirmed) {\r\n var deferred = this.$q.defer();\r\n var request = {\r\n leadId: lead.id,\r\n complianceReminderConfirmed: complianceConfirmed\r\n };\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.post(\"\".concat(this.baseUrl, \"/share\"), request).then(function (result) {\r\n if (result.status == 200) {\r\n var shareLeadResult = {\r\n blob: new Blob([result.data], { type: 'text/x-vcard' }),\r\n };\r\n deferred.resolve(shareLeadResult);\r\n }\r\n // Special handling for prospecting rate limit warning\r\n if (result.status == 429) {\r\n var shareLeadResult = {\r\n rateLimitReached: true\r\n };\r\n deferred.resolve(shareLeadResult);\r\n return;\r\n }\r\n console.debug(result);\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n LeadsService.prototype.searchForLeads = function (filters, page, leadsPerPage, prospecting) {\r\n var deferred = this.$q.defer();\r\n var searchForLeadsRequest = {\r\n leadFilters: filters,\r\n leadsPerPage: leadsPerPage,\r\n page: page,\r\n prospecting: prospecting\r\n };\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.post(\"\".concat(this.baseUrl, \"/filter-by\"), searchForLeadsRequest).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n LeadsService.$inject = [\r\n names.angular.Http,\r\n names.angular.HttpParamSerializer,\r\n names.angular.Q,\r\n names.zbuyer.AppConfiguration,\r\n names.zbuyer.services.AuthenticationService\r\n ];\r\n return LeadsService;\r\n }());\r\n angular.module(names.zbuyer.Application)\r\n .service(names.zbuyer.services.LeadsService, LeadsService);\r\n })(implementation = services.implementation || (services.implementation = {}));\r\n })(services = zbuyer.services || (zbuyer.services = {}));\r\n})(zbuyer || (zbuyer = {}));\r\n\n/// \r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var LeadPreviewService = /** @class */ (function () {\r\n function LeadPreviewService($http, appConfiguration, authenticationService) {\r\n this.$http = $http;\r\n this.appConfiguration = appConfiguration;\r\n this.authenticationService = authenticationService;\r\n this.baseUrl = \"\".concat(this.appConfiguration.webServiceUrl, \"/lead-previews\");\r\n }\r\n LeadPreviewService.prototype.claimLead = function (leadId) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.get(\"\".concat(this.baseUrl, \"/claim/\").concat(leadId))\r\n .then(function (result) { return _this.handleResponse(result, false); });\r\n };\r\n LeadPreviewService.prototype.getLeadPreview = function (leadId) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.get(\"\".concat(this.baseUrl, \"/\").concat(leadId))\r\n .then(function (result) { return _this.handleResponse(result, true).leadPreview; });\r\n };\r\n LeadPreviewService.prototype.getLeadPreviewList = function (request) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.post(this.baseUrl, request)\r\n .then(function (result) { return _this.handleResponse(result, true); });\r\n };\r\n LeadPreviewService.prototype.getSubscribedLocations = function (detailLevel) {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.get(\"\".concat(this.baseUrl, \"/locations/\").concat(detailLevel))\r\n .then(function (result) { return _this.handleResponse(result, true).locations; });\r\n };\r\n LeadPreviewService.prototype.getTokenBalance = function () {\r\n var _this = this;\r\n this.authenticationService.updateDefaultAuthHeader();\r\n return this.$http.get(\"\".concat(this.baseUrl, \"/token-balance\"))\r\n .then(function (result) { return _this.handleResponse(result, true); });\r\n };\r\n LeadPreviewService.prototype.handleResponse = function (result, requireSuccess) {\r\n var _a;\r\n if ((result === null || result === void 0 ? void 0 : result.status) == 200 && ((_a = result.data) === null || _a === void 0 ? void 0 : _a.success)) {\r\n return result.data;\r\n }\r\n if (!requireSuccess) {\r\n console.log(result.data);\r\n return result.data;\r\n }\r\n if (result === null || result === void 0 ? void 0 : result.data) {\r\n if (result.data.errorMessageToDisplay) {\r\n console.log(result.data.internalDebugInfo);\r\n throw result.data.errorMessageToDisplay;\r\n }\r\n else if (result.data.hasOwnProperty('message')) {\r\n var standardErrorResponse = result.data;\r\n console.log(result.data);\r\n throw standardErrorResponse.message;\r\n }\r\n }\r\n throw 'An unknown error has occurred';\r\n };\r\n LeadPreviewService.$inject = [\r\n names.angular.Http,\r\n names.zbuyer.AppConfiguration,\r\n names.zbuyer.services.AuthenticationService\r\n ];\r\n return LeadPreviewService;\r\n }());\r\n angular.module(names.zbuyer.Application)\r\n .service(names.zbuyer.services.LeadPreviewService, LeadPreviewService);\r\n })(implementation = services.implementation || (services.implementation = {}));\r\n })(services = zbuyer.services || (zbuyer.services = {}));\r\n})(zbuyer || (zbuyer = {}));\r\n\n/// \r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var LeadTagsService = /** @class */ (function () {\r\n function LeadTagsService($http, $q, appConfiguration, authenticationService) {\r\n this.$http = $http;\r\n this.$q = $q;\r\n this.appConfiguration = appConfiguration;\r\n this.authenticationService = authenticationService;\r\n }\r\n LeadTagsService.prototype.getLeadTags = function () {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.get(this.appConfiguration.webServiceUrl + '/lead-tags').then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data.leadTags);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n LeadTagsService.$inject = [\r\n names.angular.Http,\r\n names.angular.Q,\r\n names.zbuyer.AppConfiguration,\r\n names.zbuyer.services.AuthenticationService\r\n ];\r\n return LeadTagsService;\r\n }());\r\n angular.module(names.zbuyer.Application)\r\n .service(names.zbuyer.services.LeadTagsService, LeadTagsService);\r\n })(implementation = services.implementation || (services.implementation = {}));\r\n })(services = zbuyer.services || (zbuyer.services = {}));\r\n})(zbuyer || (zbuyer = {}));\r\n\n/// \r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var ModalService = /** @class */ (function () {\r\n function ModalService() {\r\n }\r\n ModalService.prototype.handleCloseActions = function (scope, $uibModalInstance) {\r\n // To prevent backdrop dismiss console errors, we consume the event here, and close it manually\r\n scope.$on('modal.closing', function (event, reason, closed) {\r\n if (reason == 'backdrop click' || reason == 'escape key press') {\r\n event.preventDefault();\r\n $uibModalInstance.close();\r\n }\r\n });\r\n };\r\n return ModalService;\r\n }());\r\n angular.module(names.zbuyer.Application)\r\n .service(names.zbuyer.services.ModalService, ModalService);\r\n })(implementation = services.implementation || (services.implementation = {}));\r\n })(services = zbuyer.services || (zbuyer.services = {}));\r\n})(zbuyer || (zbuyer = {}));\r\n\n/// \r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var Toastr = 'Toastr';\r\n var NotificationService = /** @class */ (function () {\r\n function NotificationService(toastr) {\r\n this.$toastr = toastr;\r\n }\r\n NotificationService.prototype.error = function (message, title) {\r\n title = this.validateTitle(title);\r\n this.$toastr.error(message, title, this.getCommonOptions());\r\n };\r\n NotificationService.prototype.info = function (message, title) {\r\n title = this.validateTitle(title);\r\n this.$toastr.info(message, title, this.getCommonOptions());\r\n };\r\n NotificationService.prototype.success = function (message, title) {\r\n title = this.validateTitle(title);\r\n this.$toastr.success(message, title, this.getCommonOptions());\r\n };\r\n NotificationService.prototype.warning = function (message, title) {\r\n title = this.validateTitle(title);\r\n this.$toastr.warning(message, title, this.getCommonOptions());\r\n };\r\n NotificationService.prototype.getCommonOptions = function (toastClass) {\r\n return {\r\n closeButton: true,\r\n toastClass: toastClass\r\n };\r\n };\r\n NotificationService.prototype.validateTitle = function (title) {\r\n if (typeof (title) == 'undefined' || title == null || title.length <= 0) {\r\n return zbuyer.messages.ApplicationTitle;\r\n }\r\n return title;\r\n };\r\n NotificationService.$inject = [Toastr];\r\n return NotificationService;\r\n }());\r\n angular.module(names.zbuyer.Application)\r\n .factory(Toastr, function () { return toastr; })\r\n .service(names.zbuyer.services.NotificationService, NotificationService);\r\n })(implementation = services.implementation || (services.implementation = {}));\r\n })(services = zbuyer.services || (zbuyer.services = {}));\r\n})(zbuyer || (zbuyer = {}));\r\n\n/// \r\nvar __extends = (this && this.__extends) || (function () {\r\n var extendStatics = function (d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n };\r\n return function (d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var NotificationTestService = /** @class */ (function (_super) {\r\n __extends(NotificationTestService, _super);\r\n function NotificationTestService($http, appConfiguration, authenticationService) {\r\n return _super.call(this, $http, appConfiguration, authenticationService, true) || this;\r\n }\r\n NotificationTestService.prototype.initializeBaseUrl = function (webServiceUrl) {\r\n return \"\".concat(webServiceUrl, \"/notification-test\");\r\n };\r\n NotificationTestService.prototype.sendTestNotification = function (properties) {\r\n var request = {\r\n testLeadNotificationProperties: properties\r\n };\r\n return _super.prototype.putLegacy.call(this, this.baseUrl, request)\r\n .then(function () { return void 0; });\r\n };\r\n NotificationTestService.prototype.getTestNotificationOptions = function () {\r\n return this.getLegacy(\"\".concat(this.baseUrl, \"/options\"))\r\n .then(function (response) { return response.inputFormItems; });\r\n };\r\n NotificationTestService.$inject = [\r\n names.angular.Http,\r\n names.zbuyer.AppConfiguration,\r\n names.zbuyer.services.AuthenticationService\r\n ];\r\n return NotificationTestService;\r\n }(services.LegacyApiService));\r\n implementation.NotificationTestService = NotificationTestService;\r\n angular.module(names.zbuyer.Application)\r\n .service(names.zbuyer.services.NotificationTestService, NotificationTestService);\r\n })(implementation = services.implementation || (services.implementation = {}));\r\n })(services = zbuyer.services || (zbuyer.services = {}));\r\n})(zbuyer || (zbuyer = {}));\r\n\n/// \r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var ReasonsSellingService = /** @class */ (function () {\r\n function ReasonsSellingService($http, $q, appConfiguration, authenticationService) {\r\n this.$http = $http;\r\n this.$q = $q;\r\n this.appConfiguration = appConfiguration;\r\n this.authenticationService = authenticationService;\r\n }\r\n ReasonsSellingService.prototype.getReasonsSelling = function () {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.get(this.appConfiguration.webServiceUrl + '/reasons-selling').then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data.reasonsSelling);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n ReasonsSellingService.$inject = [\r\n names.angular.Http,\r\n names.angular.Q,\r\n names.zbuyer.AppConfiguration,\r\n names.zbuyer.services.AuthenticationService\r\n ];\r\n return ReasonsSellingService;\r\n }());\r\n angular.module(names.zbuyer.Application)\r\n .service(names.zbuyer.services.ReasonsSellingService, ReasonsSellingService);\r\n })(implementation = services.implementation || (services.implementation = {}));\r\n })(services = zbuyer.services || (zbuyer.services = {}));\r\n})(zbuyer || (zbuyer = {}));\r\n\n/// \r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var SignupService = /** @class */ (function () {\r\n function SignupService($http, $q, appConfiguration, authenticationService) {\r\n this.$http = $http;\r\n this.$q = $q;\r\n this.appConfiguration = appConfiguration;\r\n this.authenticationService = authenticationService;\r\n this.baseUrl = \"\".concat(this.appConfiguration.webServiceUrl, \"/signup\");\r\n }\r\n SignupService.prototype.newSignup = function (request) {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.post(\"\".concat(this.baseUrl, \"/new\"), request).then(function (result) {\r\n if (result.status == 200) {\r\n deferred.resolve(result.data);\r\n return;\r\n }\r\n deferred.reject(result);\r\n }).catch(function (reason) {\r\n deferred.reject(reason);\r\n });\r\n return deferred.promise;\r\n };\r\n SignupService.prototype.sendLanding = function (request) {\r\n var deferred = this.$q.defer();\r\n this.authenticationService.updateDefaultAuthHeader();\r\n this.$http.post(\"\".concat(this.baseUrl), request).then(function (result) {\r\n if ((result === null || result === void 0 ? void 0 : result.data) && typeof result.data.viewId !== 'undefined') {\r\n deferred.resolve(result.data);\r\n }\r\n else {\r\n deferred.reject();\r\n }\r\n });\r\n return deferred.promise;\r\n };\r\n SignupService.$inject = [\r\n names.angular.Http,\r\n names.angular.Q,\r\n names.zbuyer.AppConfiguration,\r\n names.zbuyer.services.AuthenticationService\r\n ];\r\n return SignupService;\r\n }());\r\n angular.module(names.zbuyer.Application)\r\n .service(names.zbuyer.services.SignupService, SignupService);\r\n })(implementation = services.implementation || (services.implementation = {}));\r\n })(services = zbuyer.services || (zbuyer.services = {}));\r\n})(zbuyer || (zbuyer = {}));\r\n\n/// \r\nvar zbuyer;\r\n(function (zbuyer) {\r\n var services;\r\n (function (services) {\r\n var implementation;\r\n (function (implementation) {\r\n var BlockUI = 'BlockUI';\r\n var SpinWaitService = /** @class */ (function () {\r\n function SpinWaitService(appConfiguration, $timeout, $q) {\r\n this.appConfiguration = appConfiguration;\r\n this.$timeout = $timeout;\r\n this.$q = $q;\r\n this.blockList = [];\r\n this.cycleMessageDuration = 1500;\r\n this.spinnerMessageClass = 'zb-spinner-message';\r\n this.spinnerWheelClass = 'zb-spinner';\r\n this.spinnerMessages = [];\r\n this.initializeSpinnerMessages();\r\n }\r\n SpinWaitService.prototype.initializeSpinnerMessages = function () {\r\n var controller = this;\r\n var deferred = this.$q.defer();\r\n $.getJSON(\"\".concat(this.appConfiguration.baseUrl, \"Content/app-spinner-messages.json\"), function (json) {\r\n controller.spinnerMessages = json;\r\n deferred.resolve();\r\n }).fail(deferred.reject);\r\n return deferred.promise;\r\n };\r\n /**\r\n * Establishes a UI-blocking overlay until unblock is called using same key.\r\n * Optionally, if key corresponds to defined messages, those messages will display in the overlay.\r\n * If prior blocks are ongoing, UI overlay will not change.\r\n *\r\n * @param key - key for lock/unlock of UI (and key to custom message list to display in blocking overlay)\r\n * @param visualElementClass - class tag(s) for visual element above message text\r\n * @param message - single message to display (overrides default messages for key)\r\n */\r\n SpinWaitService.prototype.block = function (key, visualElementClass, message) {\r\n if (visualElementClass === void 0) { visualElementClass = this.spinnerWheelClass; }\r\n var hasKey = (typeof (key) !== 'undefined' && key !== null && key.length > 0);\r\n if (hasKey && this.blockList.indexOf(key) >= 0) {\r\n return; // Already blocking for this key.\r\n }\r\n // Only change the UI if this is the ONLY active block.\r\n if (this.blockList.length == 0) {\r\n angular.element.blockUI({\r\n baseZ: 10000,\r\n message: \"