1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="252b1a70-5176-4be0-b1ba-f9ddbcfd7fa2",e._sentryDebugIdIdentifier="sentry-dbid-252b1a70-5176-4be0-b1ba-f9ddbcfd7fa2")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2792],{89645:function(e,n,t){t.d(n,{P:function(){return isTransientNetworkError}});var o=t(87066);let isTransientNetworkError=e=>{var n,t,l,i;if(!e||"object"!=typeof e||o.default.isCancel(e))return!1;let a=null!==(i=null===(n=e.response)||void 0===n?void 0:n.status)&&void 0!==i?i:e.status;if("number"==typeof a&&a>0)return!1;let u=(null===(t=e.message)||void 0===t?void 0:t.toLowerCase())||"";return!e.response&&("ERR_NETWORK"===e.code||"ECONNABORTED"===e.code||(null===(l=e.request)||void 0===l?void 0:l.status)===0||"network error"===u||u.includes("timeout"))}},54053:function(e,n,t){t.d(n,{Z:function(){return useAuth}});var o=t(4438),l=t(16318),i=t(67294),a=t(85518),u=t(41248),s=t(40377),d=t(16238),r=t(23671),c=t(63893),v=t(43817),f=t(89645),b=t(76367),g=t(76128);let shouldLogoutAfterSilentAuthError=e=>{var n,t;let o=(null==e?void 0:null===(n=e.response)||void 0===n?void 0:n.status)||(null==e?void 0:e.status)||(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.status);return 401===o||404===o||/status code (401|404)/i.test((null==e?void 0:e.message)||"")},shouldRetryBootstrapAuthError=e=>{var n,t;let o=(null==e?void 0:null===(n=e.response)||void 0===n?void 0:n.status)||(null==e?void 0:e.status)||(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.status),l=(null==e?void 0:e.message)||"";return(0,f.P)(e)||400===o||/status code 400/i.test(l)};function useAuth(){var e,n,t,f,p,_,h,m,w,y,k,C,A,E,R,D,I,N;let{sessionId:U,loading:x,isLoggedIn:B,user:O,business:P,businessLocation:S,settingsLocation:T,updateSettingsLoading:Z}=(0,g.v9)(e=>e.auth),L=(0,u.I0)(),W=(0,i.useCallback)(async function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];try{await (0,b.Dm)()}catch(e){}L((0,r.kS)({redirect:e}))},[L]),J=(0,i.useCallback)(async function(e,n){let t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];try{await (0,b.Dm)();let l=await L((0,r.x4)({email:e,password:n,bypassToken:t})).unwrap();if(!a.tq){let e=l.navigation_menu_toggle;L((0,o.gJ)(e));let n=l.contact_card_toggle;L((0,o.IW)(n)),e&&L((0,o.Nr)(!0)),n&&L((0,o.N)(!1))}return l}catch(e){if(!t&&(null==e?void 0:e.message))try{let n=JSON.parse(null==e?void 0:e.message);(null==n?void 0:n.status)===404||(null==n?void 0:n.status)===400||(null==n?void 0:n.status)===422?l.ZP.error({message:"Wrong email or password. Please try again."}):l.ZP.error({message:n.message})}catch(e){l.ZP.error({message:"Something went wrong. Please try again in a moment."})}else if(!(0,s.sc)()&&shouldLogoutAfterSilentAuthError(e)){if((0,d.QI)())return null;W()}if(t&&i&&shouldRetryBootstrapAuthError(e))throw e;return null}},[L,W]);return{isLoggedIn:B,user:O,business:P,businessLocation:S,login:J,loading:x,logout:W,isOnAllLocations:!S,businessCountry:S?(null==S?void 0:S.country)||"AU":(null==P?void 0:null===(e=P.locations[0])||void 0===e?void 0:e.country)||"AU",updateSettingsLocation:function(e){let n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];L((0,c.kJ)(n)),L((0,c.v_)(e)),setTimeout(()=>L((0,c.kJ)(!1)),600)},isSuperAdmin:!!(null==O?void 0:O.super_admin),isBusinessOwner:(null==P?void 0:P.owner_user_id)===(null==O?void 0:O.id),canUseAIFeatures:(null==O?void 0:O.super_admin)||(null==O?void 0:O.id)==="e5b83a44-6190-42b1-8695-bf6262b11e88",canUseMoveBusinessFeature:!v.BB||["c2039f44-3e67-49bb-b300-5579d36a3f04","7d9d2b47-1452-4337-9805-a9391508d8cf","ceb1f663-a042-41cc-b77e-7e0f72887dc6","740f6a96-a703-4f8f-b442-7b9c39546aac","384b3314-c9f8-4ab4-895f-425695db19c1","d3aff10b-cee4-4e1a-b595-200938b39e5b"].includes((null==P?void 0:P.id)||""),isOutboundEnabled:(null==P?void 0:P.id)==="e0b4c1a3-7983-4ffa-8bc0-34e5820efdcc"||!!(null==P?void 0:P.locations.some(e=>e.enable_inbound_calls)),voipEnabled:!!(null==P?void 0:P.locations.some(e=>e.enable_inbound_calls)),settingsLocation:T,updateSettingsLoading:Z,sessionId:U,assginedOpenCount:null!==(C=null!==(k=null==S?void 0:S.assigned_count_open)&&void 0!==k?k:null==P?void 0:null===(t=P.locations)||void 0===t?void 0:null===(n=t[0])||void 0===n?void 0:n.assigned_count_open)&&void 0!==C?C:0,assginedClosedCount:null!==(E=null!==(A=null==S?void 0:S.assigned_count_closed)&&void 0!==A?A:null==P?void 0:null===(p=P.locations)||void 0===p?void 0:null===(f=p[0])||void 0===f?void 0:f.assigned_count_closed)&&void 0!==E?E:0,unassignedCountOpen:null!==(D=null!==(R=null==S?void 0:S.unassigned_count_open)&&void 0!==R?R:null==P?void 0:null===(h=P.locations)||void 0===h?void 0:null===(_=h[0])||void 0===_?void 0:_.unassigned_count_open)&&void 0!==D?D:0,unassignedCountClosed:null!==(N=null!==(I=null==S?void 0:S.unassigned_count_closed)&&void 0!==I?I:null==P?void 0:null===(w=P.locations)||void 0===w?void 0:null===(m=w[0])||void 0===m?void 0:m.unassigned_count_closed)&&void 0!==N?N:0,aiOnboardingCompleted:null==O?void 0:null===(y=O.ai_info)||void 0===y?void 0:y.onboarding_completed,coaxBanners:(null==O?void 0:O.co
1ax_banners)||[],msgSendingBehaviour:(null==O?void 0:O.msg_sending_behaviour)||"enter"}}},62792:function(e,n,t){t.d(n,{Z:function(){return usePersistAuth}});var o=t(37895),l=t(22756),i=t(40377),a=t(26702),u=t(32583),s=t(86269),d=t(16238),r=t(42950),c=t(54053),v=t(4438),f=t(67294),b=t(41248);let g=["access","referalPopup","key","iv"],p=[3e3,5e3,7e3],_=null;function usePersistAuth(){let{login:e}=(0,c.Z)(),n=(0,b.I0)(),t=(0,f.useCallback)(async function(){let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0],c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",f=arguments.length>2&&void 0!==arguments[2]&&arguments[2];try{t&&n((0,v.K4)(!0));let{access:b,accessCookieCount:h,hasExpiredDuplicate:m}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=e?[e]:s.pR.getAll("access"),t=(0,a.CU)(n,{skewMs:3e4}),o=t.accessToken||n[0]||null;return{access:o,accessCookieCount:e?0:t.accessCookieCount,hasExpiredDuplicate:t.hasExpiredDuplicate}}(c);if(!b)return"unauthenticated";let w=(0,a.WU)(b);if((0,a.vf)(b,{skewMs:3e4})){let e=function(e){if(null===e)return"unknown";let n=Date.now()-e;return n<6e4?"under_1m":n<36e5?"under_1h":n<864e5?"under_1d":"over_1d"}(w);return o.n({category:"auth",level:"info",message:"Expired access token skipped during auth bootstrap",data:{reason:"bootstrap_expired_token",accessCookieCount:h,tokenAgeBucket:e,pathname:window.location.pathname}}),await (0,u.S6)({event:"auth_client_logout_redirect",outcome:"failed_logout_redirected",reason:"bootstrap_expired_token",retryAttempted:!1,retryRecovered:!1,hadAccessCookie:!!b,accessCookieCount:h,hasExpiredDuplicate:m,tokenAgeBucket:e},b),(0,l.Rn)(),(0,d.QI)()||((0,l.Rn)(),g.forEach(e=>s.pR.remove(e)),function(){if((0,d.QI)())return;let e=window.location.pathname,n=e.startsWith("/dashboard")||e.includes("welcome")||e.includes("upgrade")||e.includes("extension");n&&(window.location.href="/")}()),"unauthenticated"}let y=null;if(!c&&(h>1||m)&&(o.n({category:"auth",level:"info",message:"Normalizing duplicate access cookies during bootstrap",data:{reason:"duplicate_access_cookie",accessCookieCount:h,hasExpiredDuplicate:m,pathname:window.location.pathname}}),s.pR.set({access:b,expiry:w?new Date(w).toUTCString():void 0}),y="duplicate_access_cookie_normalized"),!c&&_)return await _;let bootstrapUser=async()=>{(0,l.uB)(b);let n=await e("","",!0,f);return n?((0,i.K6)(),y&&(0,u.Fr)({event:"auth_session_restored",outcome:"succeeded_restored",reason:y,retryAttempted:!1,retryRecovered:!0,hadAccessCookie:!0,accessCookieCount:h,hasExpiredDuplicate:m},b),"authenticated"):"unauthenticated"};if(c)return await bootstrapUser();if(!f)return _=bootstrapUser().finally(()=>{_=null}),await _;return _=(async()=>{for(let e=0;e<4;e++)try{return await bootstrapUser()}catch(t){let n=p[e];if(void 0===n)return"unavailable";await (0,r.Dc)(n)}return"unavailable"})().finally(()=>{_=null}),await _}catch(e){return"unavailable"}finally{n((0,v.K4)(!1))}},[n,e]);return{invalidateUser:t}}}}]);
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.