vendor: 5,741 bytes, lines 1-2
1/*! For license information please see 983.8e99ceb6c5593edb0df4.chunk.js.LICENSE.txt */ 2"use strict";(self.webpackChunk_car_lead_app_host_app=self.webpackChunk_car_lead_app_host_app||[]).push([[983],{4983:(e,t,r)=>{r.d(t,{$Z:()=>E,AI:()=>j,Fu:()=>w,Gp:()=>O,L1:()=>l,Lf:()=>b,Lx:()=>A,XM:()=>v,ah:()=>I,kN:()=>x,tm:()=>G,w2:()=>g});var n=r(2037),o=r(5474);function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){c(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t,r){return(t=function(e){var t=function(e){if("object"!=a(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(){u=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function p(e,t,r,n){return Object.defineProperty(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{p({},"")}catch(e){p=function(e,t,r){return e[t]=r}}function f(t,r,n,o){var a=r&&r.prototype instanceof d?r:d,s=Object.create(a.prototype);return p(s,"_invoke",function(t,r,n){var o=1;return function(a,s){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===a)throw s;return{value:e,done:!0}}for(n.method=a,n.arg=s;;){var i=n.delegate;if(i){var c=E(i,n);if(c){if(c===l)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var u=h(t,r,n);if("normal"===u.type){if(o=n.done?4:2,u.arg===l)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=4,n.method="throw",n.arg=u.arg)}}}(t,n,new S(o||[])),!0),s}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=f;var l={};function d(){}function v(){}function y(){}var w={};p(w,s,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(O([])));m&&m!==r&&n.call(m,s)&&(w=m);var b=y.prototype=d.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){p(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function r(o,s,i,c){var u=h(e[o],e,s);if("throw"!==u.type){var p=u.arg,f=p.value;return f&&"object"==a(f)&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,i,c)}),(function(e){r("throw",e,i,c)})):t.resolve(f).then((function(e){p.value=e,i(p)}),(function(e){return r("throw",e,i,c)}))}c(u.arg)}var o;p(this,"_invoke",(function(e,n){function a(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(a,a):a()}),!0)}function E(t,r){var n=r.method,o=t.i[n];if(o===e)return r.delegate=null,"throw"===n&&t.i.return&&(r.method="return",r.arg=e,E(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),l;var a=h(o,t.i,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,l;var s=a.arg;return s?s.done?(r[t.r]=s.value,r.next=t.n,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,l):s:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,l)}function T(e){this.tryEntries.push(e)}function j(t){var r=t[4]||{};r.type="normal",r.arg=e,t[4]=r}function S(e){this.tryEntries=[[-1]],e.forEach(T,this),this.reset(!0)}function O(t){if(null!=t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(a(t)+" is not iterable")}return v.prototype=y,p(b,"constructor",y),p(y,"constructor",v),v.displayName=p(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,p(e,c,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},x(k.prototype),p(k.prototype,i,(function(){return this})),t.AsyncIterator=k,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var s=new k(f(e,r,n,o),a);return t.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},x(b),p(b,c,"Generator"),p(b,s,(function(){return this})),p(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.unshift(n);return function e(){for(;r.length;)if((n=r.pop())in t)return e.value=n,e.done=!1,e;return e.done=!0,e}},t.values=O,S.prototype={constructor:S,reset:function(t){if(this.prev=this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEac
2h(j),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0][4];if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(e){s.type="throw",s.arg=t,r.next=e}for(var o=r.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a[4],i=this.prev,c=a[1],u=a[2];if(-1===a[0])return n("end"),!1;if(!c&&!u)throw Error("try statement without catch or finally");if(null!=a[0]&&a[0]<=i){if(i<c)return this.method="next",this.arg=e,n(c),!0;if(i<u)return n(u),!1}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===e||"continue"===e)&&o[0]<=t&&t<=o[2]&&(o=null);var a=o?o[4]:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o[2],l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r[2]===e)return this.complete(r[4],r[3]),j(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r[0]===e){var n=r[4];if("throw"===n.type){var o=n.arg;j(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={i:O(t),r,n},"next"===this.method&&(this.arg=e),l}},t}function p(e,t,r,n,o,a,s){try{var i=e[a](s),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function f(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function s(e){p(a,n,o,s,i,"next",e)}function i(e){p(a,n,o,s,i,"throw",e)}s(void 0)}))}}var h=(0,n.c)("pk_test_51REia8CTdK10dM9bFdJ7nhhx7TdrUdzcq00RJC9e1UGTVk6rvDGJIr3tA1DYRPWAGTZlp7VXpaMevldYEpfa4Y0C00cHVfqc49");function l(){return d.apply(this,arguments)}function d(){return(d=f(u().mark((function e(){var t;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(localStorage.getItem("authToken")){e.next=3;break}throw new Error("Not authenticated");case 3:return e.next=5,G("".concat(o.JR,"/api/lead_buyers/me/"),{method:"GET"});case 5:if((t=e.sent).ok){e.next=8;break}throw new Error("Failed to fetch LeadBuyer profile");case 8:return e.abrupt("return",t.json());case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function v(){return y.apply(this,arguments)}function y(){return(y=f(u().mark((function e(){var t;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,localStorage.getItem("authToken")){e.next=4;break}return e.abrupt("return",!1);case 4:return e.next=6,l();case 6:return t=e.sent,e.abrupt("return",!0===t.is_affiliate_user);case 10:return e.prev=10,e.t0=e.catch(0),console.error("Error checking affiliate user status:",e.t0),e.abrupt("return",!1);case 14:case"end":return e.stop()}}),e,null,[[0,10]])})))).apply(this,arguments)}function w(e){return e?new Promise((function(t,r){if(window.grecaptcha)return t();var n=document.querySelector('script[src*="recaptcha/api.js"]');if(n)return n.addEventListener("load",t),void n.addEventListener("error",(function(){return r(new Error("reCAPTCHA script could not be loaded. Please refresh the pagei"))}));var o=document.createElement("script");o.src="https://www.google.com/recaptcha/api.js?render=".concat(e),o.async=!0,o.onload=t,o.onerror=function(){return r(new Error("reCAPTCHA script could not be loaded. Please refresh the page"))},document.body.appendChild(o)})):Promise.reject(new Error("reCAPTCHA site key is missing!"))}function g(e){return m.apply(this,arguments)}function m(){return(m=f(u().mark((function e(t){var r,n,a;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch("".concat(o.JR,"/account/password-reset/"),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({email:t})});case 2:if((r=e.sent).ok){e.next=10;break}return e.next=6,r.json();case 6:throw n=e.sent,(a=new Error(n.error||"Failed to request password reset")).response={data:n},a;case 10:return e.abrupt("return",r.json());case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var b=function(){var e=f(u().mark((function e(t,r,n){var a,s,i,c,p,f,l;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,h;case 3:return a=e.sent,e.next=6,fetch("".concat(o.JR,"/api/checkout/"),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({leadId:t,status:r,leadBuyerId:n})});case 6:if((s=e.sent).ok){e.next=20;break}return i="Checkout unsuccessful, please try again.",e.prev=9,e.next=12,s.json();case 12:null!=(c=e.sent)&&c.error?i=c.error:"string"==typeof c&&(i=c),e.next=18;break;case 16:e.prev=16,e.t0=e.catch(9);case 18:return alert(i),e.abrupt("return");case 20:return e.next=22,s.json();case 22:return p=e.sent,e.next=25,a.redirectToCheckout({sessionId:p.id});case 25:(f=e.sent).error&&alert(f.error.message),e.next=37;break;case 29:if(e.prev=29,e.t1=e.catch(0),console.error("Error submitting lead data:",e.t1),!e.t1.response){e.next=34;break}throw e.t1;case 34:throw(l=new Error(e.t1.message||"Network error")).response={status:0,data:{error:e.t1.message||"Network error occurred"}},l;case 37:case"end":return e.stop()}}),e,null,[[0,29],[9,16]])})));return function(t,r,n){return e.apply(this,arguments)}}();function x(e,t){return k.apply(this,arguments)}function k(){return(k=f(u().mark((function e(t,r){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("updateLeadStatus not implemented");case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function E(e){return T.apply(this,arguments)}function T(){return(T=f(u().mark((function e(t){var r,n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,G("".concat(o.JR,"/api/leadbuyerleads/").concat(t,"/"),{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"}});case 2:if((r=e.sent).ok){e.next=8;break}return e.next=6,r.json();case 6:throw n=e.sent,new Error(n.detail||"Failed to fetch lead");case 8:return e.next=10,r.json();case 10:return e.abrupt("return",e.sent);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function j(e){return S.apply(this,arguments)}function S(){return(S=f(u().mark((function e(t){var r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,G("".concat(o.JR,"/api/leadbuyerleads/").concat(t,"/notes/"),{method:"GET",headers:{"X-Session-ID":sessionStorage.getItem("session_id")||""}});case 2:if((r=e.sent).ok){e.next=5;break}throw new Error("Failed to fetch notes");case 5:return e.next=7,r.json();case 7:return e.abrupt("return",e.sent);case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(e,t){return _.apply(this,arguments)}function _(){return(_=f(u().mark((function e(t,r){var n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,G("".concat(o.JR,"/api/leadbuyerleads/").concat(t,"/notes/"),{method:"POST",headers:{"X-Session-ID":sessionStorage.getItem("session_id")||""},body:JSON.stringify({content:r})});case 2:if((n=e.sent).ok){e.next=5;break}throw new Error("Failed to add note");case 5:return e.next=7,n.json();case 7:return e.abrupt("return",e.sent);case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function P(e,t){if(401===e.status||403===e.status){var r=new Error(t.error||"Authentication error");throw r.isAuth=!0,r}}var I=function(){var e=f(u().mark((function e(){var t,r,n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,G("".concat(o.JR,"/api/leadbuyerleads/"),{method:"GET",headers:{"X-Session-ID":sessionStorage.getItem("session_id")||""}});case 3:if((t=e.sent).ok){e.next=10;break}return e.next=7,t.json().catch((function(){return{}}));case 7:throw r=e.sent,P(t,r),new Error(r.error||"Error ".concat(t.status,": ").concat(t.statusText));case 10:return e.next=12,t.json();case 12:return n=e.sent,e.abrupt("return",n);case 16:throw e.prev=16,e.t0=e.catch(0),console.error("Error fetching leads:",e.t0),e.t0;case 20:case"end":return e.stop()}}),e,null,[[0,16]])})));return function(){return e.apply(this,arguments)}}(),A=function(){var e=f(u().mark((function e(t){var r,n,a;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,fetch("".concat(o.JR,"/api/lead_buyers/login/"),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t)});case 3:return r=e.sent,n=null,e.prev=5,e.next=8,r.json();case 8:n=e.sent,e.next=14;break;case 11:e.prev=11,e.t0=e.catch(5),n={};case 14:if(r.ok){e.next=18;break}throw(a=new Error(n&&n.error||"Error ".concat(r.status,": ").concat(r.statusText))).response={status:r.status,data:n},a;case 18:return n&&n.access&&localStorage.setItem("authToken",n.access),n&&n.refresh&&localStorage.setItem("refreshToken",n.refresh),e.abrupt("return",n||{});case 23:throw e.prev=23,e.t1=e.catch(0),e.t1.response||console.error("Login error:",e.t1),e.t1;case 27:case"end":return e.stop()}}),e,null,[[0,23],[5,11]])})));return function(t){return e.apply(this,arguments)}}(),C=!1,J=null,N=function(){var e=f(u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!C||!J){e.next=2;break}return e.abrupt("return",J);case 2:return C=!0,J=f(u().mark((function e(){var t,r,n,a;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,t=localStorage.getItem("refreshToken")){e.next=5;break}throw console.error("No refresh token found in localStorage"),new Error("No refresh token found");case 5:return e.next=7,fetch("".concat(o.JR,"/api/token/refresh/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh:t})});case 7:if((r=e.sent).ok){e.next=14;break}return e.next=11,r.text();case 11:throw n=e.sent,console.error("Token refresh failed:",{status:r.status,statusText:r.statusText,errorBody:n}),new Error("Refresh token error: ".concat(r.status," ").concat(r.statusText));case 14:return e.next=16,r.json();case 16:if((a=e.sent).access){e.next=20;break}throw console.error("Token refresh response missing access token:",a),new Error("Invalid token refresh response");case 20:return localStorage.setItem("authToken",a.access),e.abrupt("return",a.access);case 24:throw e.prev=24,e.t0=e.catch(0),console.error("Token refresh exception:",e.t0),e.t0;case 28:return e.prev=28,C=!1,J=null,e.finish(28);case 32:case"end":return e.stop()}}),e,null,[[0,24,28,32]])})))(),e.abrupt("return",J);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),G=function(){var e=f(u().mark((function e(t){var r,n,o,a,s,c,p=arguments;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=p.length>1&&void 0!==p[1]?p[1]:{},n=localStorage.getItem("authToken"),o=r.body instanceof FormData,r.headers=i(i(i(i({},r.headers||{}),n?{Authorization:"Bearer ".concat(n)}:{}),!o&&{"Content-Type":"application/json"}),{},{Accept:"application/json","X-Session-ID":sessionStorage.getItem("session_id")||""}),e.next=6,fetch(t,r);case 6:if(401!==(a=e.sent).status){e.next=36;break}if(localStorage.getItem("refreshToken")){e.next=12;break}return console.error("No refresh token available, cannot refresh session"),e.abrupt("return",a);case 12:return e.prev=12,e.next=15,N();case 15:return s=e.sent,localStorage.setItem("authToken",s),r.headers.Authorization="Bearer ".concat(s),e.next=20,fetch(t,r);case 20:return(a=e.sent).ok?console.log("Request succeeded after token refresh"):console.error("Request still failed after token refresh:",{status:a.status,statusText:a.statusText}),e.abrupt("return",a);case 25:throw e.prev=25,e.t0=e.catch(12),console.error("Token refresh failed completely:",e.t0),localStorage.removeItem("authToken"),localStorage.removeItem("refreshToken"),localStorage.removeItem("authUser"),window.location.pathname.includes("/login")?console.error("Already on login page, not redirecting to avoid loop"):(alert("Your session has expired. You will be redirected to the login page."),setTimeout((function(){window.location.href="/login"}),1e3)),(c=new Error("Session expired. Please login again.")).isAuth=!0,c;case 36:return e.abrupt("return",a);case 37:case"end":return e.stop()}}),e,null,[[12,25]])})));return function(t){return e.apply(this,arguments)}}()},5474:(e,t,r)=>{r.d(t,{EZ:()=>o,JR:()=>n,JT:()=>s,md:()=>a});var n="https://leadgen-api-prod-325aab8116da.herokuapp.com",o="6Lc1QTQrAAAAAIMN7B6EIoro8dxFqnigOAOrEWxK",a="false",s="false"}}]); 3//# sourceMappingURL=983.8e99ceb6c5593edb0df4.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.