1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c1262d82-2e6b-4b7b-9b89-d9e67a5baa22",e._sentryDebugIdIdentifier="sentry-dbid-c1262d82-2e6b-4b7b-9b89-d9e67a5baa22")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1739],{866:(e,t,s)=>{s.d(t,{JM:()=>d,Wn:()=>h,XI:()=>u,bU:()=>l,nc:()=>c});var a=s(91609),r=s(37910),n=s(15226);function o(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];t?document.cookie="accessToken=".concat(e,"; path=/; max-age=").concat(604800,"; SameSite=Lax"):document.cookie="accessToken=".concat(e,"; path=/; SameSite=Lax")}function i(){document.cookie="accessToken=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT"}let c=(0,a.v)()((0,r.Zr)((e,t)=>({user:null,accessToken:null,refreshToken:null,rememberMe:!0,isLoading:!1,isAuthenticated:!1,_hasHydrated:!1,setHasHydrated:t=>e({_hasHydrated:t}),login:async function(t,s,a){let r=!(arguments.length>3)||void 0===arguments[3]||arguments[3];e({isLoading:!0});try{let i=await n.FH.post("/auth/login",{email:t,password:s,twoFactorCode:a,rememberMe:r});if(i.data){if("requiresTwoFactor"in i.data&&i.data.requiresTwoFactor)return e({isLoading:!1}),i.data;let{user:t,accessToken:s,refreshToken:a}=i.data;n.FH.setToken(s),o(s,r),e({user:t,accessToken:s,refreshToken:a,rememberMe:r,isAuthenticated:!0,isLoading:!1})}}catch(t){throw e({isLoading:!1}),t}},register:async t=>{e({isLoading:!0});try{let s=await n.FH.post("/auth/register",t);if(s.data){let{user:t,accessToken:a,refreshToken:r}=s.data;n.FH.setToken(a),o(a),e({user:t,accessToken:a,refreshToken:r,isAuthenticated:!0,isLoading:!1})}}catch(t){throw e({isLoading:!1}),t}},logout:async()=>{try{await n.FH.post("/auth/logout")}catch(e){}finally{n.FH.setToken(null),i(),e({user:null,accessToken:null,refreshToken:null,isAuthenticated:!1});try{["getting-started-dismissed","ai-readiness-dismissed","featureDiscovery","voice-sent-sync-ts","whatsapp-onboarding-progress","sandbox-context","onboarding-step","247sales-user","247sales-ui"].forEach(e=>localStorage.removeItem(e)),Object.keys(localStorage).filter(e=>e.startsWith("page-explainer-dismissed-")).forEach(e=>localStorage.removeItem(e))}catch(e){}}},refreshSession:async()=>{let{refreshToken:s}=t();if(s)try{let t=await n.FH.post("/auth/refresh",{refreshToken:s});t.data&&(n.FH.setToken(t.data.accessToken),o(t.data.accessToken),e({accessToken:t.data.accessToken,refreshToken:t.data.refreshToken}))}catch(s){let e=s instanceof Error&&"status"in s?s.status:0;(401===e||403===e)&&t().logout()}},setUser:t=>e({user:t})}),{name:"247sales-auth",partialize:e=>({user:e.user,accessToken:e.accessToken,refreshToken:e.refreshToken,isAuthenticated:e.isAuthenticated}),onRehydrateStorage:()=>e=>{if(null==e?void 0:e.accessToken){let t=!1;try{let s=e.accessToken.split(".");if(3!==s.length)t=!0;else{let e=s[1].replace(/-/g,"+").replace(/_/g,"/"),a=(4-e.length%4)%4;e+="=".repeat(a);let r=JSON.parse(atob(e));(!r.exp||1e3*r.exp<Date.now())&&(t=!0)}}catch(e){t=!0}if(t){n.FH.setToken(null),i(),c.setState({user:null,accessToken:null,refreshToken:null,isAuthenticated:!1}),e.setHasHydrated(!0);return}n.FH.setToken(e.accessToken)}null==e||e.setHasHydrated(!0)}}));window.addEventListener("storage",e=>{if("247sales-auth"===e.key){if(!e.newValue)return void c.getState().logout();try{var t;let s=JSON.parse(e.newValue);(null==s||null==(t=s.state)?void 0:t.accessToken)||c.getState().logout()}catch(e){}}});let l=()=>c(e=>{var t;return null==(t=e.user)?void 0:t.tier}),u=()=>c(e=>e.isAuthenticated),d=()=>c(e=>e._hasHydrated),h=()=>c(e=>e.logout)},9754:(e,t,s)=>{s.d(t,{f:()=>n,t:()=>r});let a=null;function r(e){a=e}function n(e){null==a||a(e)}},15226:(e,t,s)=>{s.d(t,{Ay:()=>c,FH:()=>i,hD:()=>o});var a=s(9754);let r="https://two47-sales-api.onrender.com/api/v1";(r.includes("localhost")||r.includes("127.0.0.1"))&&console.error("CRITICAL: Production build cannot use localhost URL for API. Set NEXT_PUBLIC_API_URL to production API endpoint.");class n{setToken(e){this.accessToken=e}hasToken(){return null!==this.accessToken}async requestWithRetry(e){var t,s;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;try{let s,n={"Content-Type":"application/json",...r.headers};this.accessToken&&(n.Authorization="Bearer ".concat(this.accessToken));let i=await fetch("".concat(this.baseUrl).concat(e),{...r,headers:n});try{s=await i.json()}catch(e){throw new o(i.ok?"Invalid response format":"Server error: ".concat(i.status),i.status)}if(!i.ok){let e,r="string"==typeof s.error?s.error:(null==(t=s.error)?void 0:t.message)||s.message||"Request failed";if(429===i.status){let t=i.headers.get("Retry-After");if(t){let s=parseInt(t,10);isNaN(s)||(e=1e3*s)}}let n=new o(r,i.status,s.errors,e);throw n.code=s.code,n.details=s.details,"UPGRADE_REQUIRED"===s.co
1de&&s.details&&(0,a.f)(s.details),n}return s}catch(t){if(t instanceof o&&n<this.MAX_RETRIES){if(429===t.status){let a=(null!=(s=t.retryAfterMs)?s:this.RETRY_BASE_DELAY*Math.pow(2,n))+500*Math.random();return await new Promise(e=>setTimeout(e,a)),this.requestWithRetry(e,r,n+1)}if(t.status>=500&&t.status<600&&502!==t.status){let t=this.RETRY_BASE_DELAY*Math.pow(2,n)+500*Math.random();return await new Promise(e=>setTimeout(e,t)),this.requestWithRetry(e,r,n+1)}}throw t}}async request(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.requestWithRetry(e,t,0)}async get(e,t){let s=e;if(null==t?void 0:t.params){let e=new URLSearchParams;Object.entries(t.params).forEach(t=>{let[s,a]=t;null!=a&&e.append(s,String(a))});let a=e.toString();a&&(s+=(s.includes("?")?"&":"?")+a)}return this.request(s,{method:"GET"})}async post(e,t){return this.request(e,{method:"POST",body:t?JSON.stringify(t):void 0})}async patch(e,t){return this.request(e,{method:"PATCH",body:t?JSON.stringify(t):void 0})}async put(e,t){return this.request(e,{method:"PUT",body:t?JSON.stringify(t):void 0})}async delete(e,t){return this.request(e,{method:"DELETE",body:t?JSON.stringify(t):void 0})}async postFormData(e,t){let s,r={};this.accessToken&&(r.Authorization="Bearer ".concat(this.accessToken));let n=await fetch("".concat(this.baseUrl).concat(e),{method:"POST",headers:r,body:t});try{s=await n.json()}catch(e){throw new o(n.ok?"Invalid response format":"Server error: ".concat(n.status),n.status)}if(!n.ok){var i;let e=new o("string"==typeof s.error?s.error:(null==(i=s.error)?void 0:i.message)||s.message||"Upload failed",n.status,s.errors);throw e.code=s.code,e.details=s.details,"UPGRADE_REQUIRED"===s.code&&s.details&&(0,a.f)(s.details),e}return s}constructor(e){this.accessToken=null,this.MAX_RETRIES=3,this.RETRY_BASE_DELAY=1e3,this.baseUrl=e}}class o extends Error{constructor(e,t,s,a){super(e),this.status=t,this.errors=s,this.retryAfterMs=a}}let i=new n(r),c=i},81739:(e,t,s)=>{s.d(t,{Mf:()=>i,Zs:()=>c,kH:()=>o});var a=s(91609),r=s(37910),n=s(866);let o=(0,a.v)()((0,r.Zr)((e,t)=>({user:null,accounts:[],activeAccountId:null,isAuthenticated:!1,isLoading:!0,setUser:t=>e({user:t,isAuthenticated:!!t,isLoading:!1}),setAccounts:s=>{var a,r;let n=t().activeAccountId,o=s.some(e=>e.id===n);e({accounts:s,activeAccountId:o?n:null!=(r=null==(a=s[0])?void 0:a.id)?r:null})},setActiveAccount:t=>e({activeAccountId:t}),logout:()=>e({user:null,accounts:[],activeAccountId:null,isAuthenticated:!1}),getActiveAccount:()=>{let{accounts:e,activeAccountId:s}=t();return e.find(e=>e.id===s)||null},getTier:()=>{let{user:e}=t();if(null==e?void 0:e.subscriptionTier)return e.subscriptionTier;let s=n.nc.getState().user;return(null==s?void 0:s.tier)||"free"}}),{name:"247sales-user",partialize:e=>({activeAccountId:e.activeAccountId})})),i=()=>o(e=>e.activeAccountId),c=()=>{let e=o(e=>{var t;return null==(t=e.user)?void 0:t.subscriptionTier}),t=(0,n.nc)(e=>{var t;return null==(t=e.user)?void 0:t.effectiveTier}),s=(0,n.nc)(e=>{var t;return null==(t=e.user)?void 0:t.tier});return t||e||s||"free"}}}]);
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.