"use strict";$(function(){$('a[href^="#"]').bind("click.smoothscroll",function(e){e.preventDefault();var a=this.hash,t=$(a);$("html, body").stop().animate({scrollTop:t.offset().top},900,"swing",function(){window.location.hash=a})})}),axios.interceptors.request.use(function(e){$(".loading").fadeIn().css("display","inline-block"),setTimeout(function(){$(".result_loading").fadeIn()},400);var a=window.localStorage.token;return a&&(e.headers.Authorization="token ".concat(a)),e},function(e){return $(".loading").fadeOut(),Promise.reject(e)}),axios.interceptors.response.use(function(e){return $(".result_loading").fadeOut(),$(".loading").fadeOut(),e},function(e){return $(".loading").fadeOut(),Promise.reject(e)}),$(function(){$("[name=propertyValue]").maskMoney({prefix:"£",precision:0,allowNegative:!1}),$("input").change(function(){$(this).parent().removeClass("error"),$(this).parent().children(".message").remove(),$(this).parent().children("br").remove()}),$(".not-sure button").click(function(){$(this).fadeOut(),$(".details").slideDown()}),$(".retrieve-estimated-value").click(function(){$(".calculate .loading").css("height","0"),$(".calculate .loading").css("width","0"),$(".property_info .loading").css("transform","scale(1)"),axios.post("/retrieve-property-value",{postcode:$("[name=postcode]").val(),bedroomCount:$("[name=bedroomCount]").val(),propertyType:$("[name=propertyType]").val()}).then(function(e){$("[name=propertyValue]").maskMoney("mask",e.data.data.average)})}),$(".calculate button").click(function(){$(this).children("span").hide(),$(this).attr("disabled","true");var e=[];e.propertyValue=$("[name=propertyValue]").val().replace(/\D/g,""),e.postcode=$("[name=postcode]").val(),e.firstName=$("[name=firstName]").val(),e.lastName=$("[name=lastName]").val(),e.age=$("[name=age]").val(),e.contactNumber=$("[name=contactNumber]").val(),e.emailAddress=$("[name=emailAddress]").val(),$(".calculate .loading").css("height","28px"),$(".calculate .loading").css("width","28px"),$(".property_info .loading").css("transform","scale(0)"),axios.post("/retrieve-calculation",{propertyValue:e.propertyValue,postcode:e.postcode,firstName:e.firstName,lastName:e.lastName,age:e.age,contactNumber:e.contactNumber,emailAddress:e.emailAddress}).then(function(a){axios.post("/process-lead",{propertyValue:e.propertyValue,postcode:e.postcode,firstName:e.firstName,lastName:e.lastName,age:e.age,contactNumber:e.contactNumber,emailAddress:e.emailAddress}).then(function(a){var t={event:"conversion"};"undefined"!=typeof gDataLayer&&gDataLayer.push(t),gtag("event","conversion",{allow_custom_scripts:!0,u1:"My Equity Release Expert",u2:"",u3:a.data.leadData.propertyValue,u4:"",u5:a.data.leadData.age,u6:"",u7:"",u8:a.data.humanID,u9:"",send_to:"DC-9050084/mybra0/mybra0+standard"});var o={age:e.age,property_value:e.propertyValue,first_name:e.firstName,last_name:e.lastName,contact_number:e.contactNumber,email_address:e.emailAddress,postcode:e.postcode,event:"leadSubmit"};window.dataLayer.push(o)}),$(".calculator_form").fadeOut(),setTimeout(function(){$(".results .value").html(a.data.maximumLoanAmount).simpleMoneyFormat(),$(".results .value").prepend("£"),$(".results").fadeIn().css("display","flex")},400)}).catch(function(e){$(".calculate button").removeAttr("disabled"),setTimeout(function(){$(".calculate button").children("span").show()},400),$("span .message").remove(),_.forEach(e.response.data.errors,function(e,a){$("[name="+a+"]").parent().append(''+e+"")})})})}); //# sourceMappingURL=themeB.min.js.map