PageSourceSearch

https://app.cookieyes.com/assets/auth.lazy-BtzKBNlI.js

js cookieyes.com collected 2026-10-01 07:37:50 UTC 3,864 bytes, 1 lines download raw bytes

1import{ft as _,fu as x,hQ as y,B as j,d2 as I,fv as S,hP as L,d as T,r as w,j as h,aL as R}from"./index-6AHMKm1b.js";import{u as $}from"./hubspotService-Dq8Z_-Mm.js";function E(){return"https://app.cookieyes.com/v1".replace(/\/$/,"")}function F(u,m,t){var p,l,d,b;const s=((p=document.cookie.split("; ").find(g=>g.startsWith("token=")))==null?void 0:p.split("=")[1])||localStorage.getItem("cky_token"),e=x(),o=s?"/connect-hubspot":"/signup",n=new URL(`${globalThis.location.origin}${_(e)}${o}`);n.searchParams.set("source","hubspot"),n.searchParams.set("install_flow","1"),n.searchParams.set("returnUrl",u),m&&n.searchParams.set("app_id",m);const i=((l=t==null?void 0:t.get("hub_id"))==null?void 0:l.trim())||((d=t==null?void 0:t.get("portalId"))==null?void 0:d.trim());i&&n.searchParams.set("hub_id",i);const c=(b=t==null?void 0:t.get("website"))==null?void 0:b.trim();return c&&n.searchParams.set("website",c),t&&(y(n,t),j(t)),sessionStorage.setItem("hubspot_install_pending","1"),n.toString()}function k(u){const{data:m,hub_id:t,app_id:s,websiteId:e,searchParams:o}=u,{exists:n,user_id:i,is_connected_to_website:c}=m,l=E()||globalThis.location.origin,d=!!(n&&i),b=o.get("returnUrl")||I().returnUrl||"";if(!d){const a=x(),r=new URL(`${globalThis.location.origin}${_(a)}/signup`);return r.searchParams.set("source","hubspot"),r.searchParams.set("hub_id",t),s&&r.searchParams.set("app_id",s),e&&r.searchParams.set("website",e),r.toString()}if(e&&!b){if(c){const r=new URL(`${l}/setup`);return r.searchParams.set("websiteId",e),r.searchParams.set("source","hubspot"),r.searchParams.set("hub_id",t),s&&r.searchParams.set("app_id",s),r.toString()}const a=new URL(`${l}/hs-plan-selector`);return a.searchParams.set("source","hubspot"),a.searchParams.set("hub_id",t),a.searchParams.set("mode","connect"),a.searchParams.set("website",e),s&&a.searchParams.set("app_id",s),a.toString()}const g=o.get("go_to_domains")==="1",U=x();if(g){const a=new URL(`${globalThis.location.origin}${_(U)}/hubspot/domains`);a.searchParams.set("hub_id",t),s&&a.searchParams.set("app_id",s);const r=S(o);for(const[P,v]of Object.entries(r))a.searchParams.set(P,String(v));return a.toString()}const f=new URL(`${globalThis.location.origin}${_(U)}/connect-hubspot`);if(f.searchParams.set("hub_id",t),f.searchParams.set("source","hubspot"),f.searchParams.set("access","direct"),s&&f.searchParams.set("app_id",s),e&&f.searchParams.set("website",e),!o.get("returnUrl")){const a=L();if(a.returnUrl)for(const[r,P]of Object.entries(a))P!==void 0&&P!==""&&f.searchParams.set(r,String(P))}return f.toString()}const z=T("/hubspot/auth")({component:B});function B(){const[u,m]=w.useState(null),t=globalThis.location.search,s=new URLSearchParams(t),e=s.get("hub_id"),o=s.get("app_id"),n=s.get("website"),i=s.get("step"),c=s.get("returnUrl"),{data:p,isError:l,isLoading:d}=$(e,n,!!e&&i!=="authorize");return w.useEffect(()=>{i==="authorize"&&c&&(globalThis.location.href=F(c,o,new URLSearchParams(t)))},[i,c,o,t]),w.useEffect(()=>{if(i==="authorize")return;if(!e){m("Missing HubSpot account ID");return}if(sessionStorage.setItem("hub_id",e),o&&sessionStorage.setItem("app_id",o),l){m("Failed to verify connection");return}if(!p)return;const b=new URLSearchParams(globalThis.location.search),g=k({data:p,hub_id:e,app_id:o,websiteId:n,searchParams:b});g&&(globalThis.location.href=g)},[p,l,e,o,n,i]),u?h.jsx("div",{className:"min-h-screen flex items-center justify-center",children:h.jsxs("div",{className:"max-w-md w-full text-center",children:[h.jsx("h2",{className:"text-2xl font-bold text-red-600 mb-4",children:"Error"}),h.jsx("p",{className:"text-gray-700",children:u})]})}):d?h.jsx("div",{className:"min-h-screen flex items-center justify-center",children:h.jsx(R,{})}):h.jsx("div",{className:"min-h-screen flex items-center justify-center",children:h.jsx(R,{})})}export{B as HubSpotAuth,z as Route};

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.