1import{d as O,u as y,b as m,j as e}from"./vendor-query-DPZO-Gta.js";import{j as Q,i as I,r as f}from"./vendor-react-BomFe3BT.js";import{l as c}from"./index-BLzMsaFd.js";import"./vendor-charts-DodUWJ0z.js";function X(){var _,P,S,z,B,A,W,q,H,V,F,R,G,T;const{business:n}=Q(),h=O(),[g,C]=I(),[d,$]=f.useState("overview"),[u,L]=f.useState({}),[M,p]=f.useState(!1);f.useEffect(()=>{g.get("select_location")==="true"&&(p(!0),g.delete("select_location"),C(g,{replace:!0}))},[g,C]);const{data:t,isLoading:D}=y({queryKey:["google-business-profile",n.id],queryFn:async()=>(await c.getProfile(n.id)).data}),{data:o}=y({queryKey:["google-business-reviews",n.id],queryFn:async()=>(await c.getReviews(n.id)).data,enabled:!!(t!=null&&t.is_connected)&&d==="reviews"}),{data:l}=y({queryKey:["google-business-insights",n.id],queryFn:async()=>(await c.getInsights(n.id)).data,enabled:!!(t!=null&&t.is_connected)&&d==="insights"}),{data:N,isLoading:E}=y({queryKey:["google-business-locations",n.id],queryFn:async()=>(await c.getLocations(n.id)).data,enabled:M}),b=m({mutationFn:s=>c.selectLocation(n.id,s.location_id,s.location_name),onSuccess:()=>{p(!1),h.invalidateQueries({queryKey:["google-business-profile",n.id]})}}),x=m({mutationFn:()=>c.getOAuthUrl(n.id),onSuccess:s=>{var r;(r=s.data)!=null&&r.oauth_url&&(window.location.href=s.data.oauth_url)},onError:s=>{var r,i;console.error("Failed to get OAuth URL:",s),alert(((i=(r=s.response)==null?void 0:r.data)==null?void 0:i.detail)||"Failed to connect to Google. Please try again.")}}),v=m({mutationFn:()=>c.disconnect(n.id),onSuccess:()=>{h.invalidateQueries({queryKey:["google-business-profile",n.id]})}}),w=m({mutationFn:()=>c.sync(n.id),onSuccess:()=>{h.invalidateQueries({queryKey:["google-business-profile",n.id]})}}),k=m({mutationFn:({reviewId:s,reply:r})=>c.replyToReview(n.id,s,r),onSuccess:()=>{h.invalidateQueries({queryKey:["google-business-reviews",n.id]}),L({})}}),K=[{id:"overview",name:"Overview"},{id:"reviews",name:"Reviews"},{id:"posts",name:"Posts"},{id:"insights",name:"Insights"},{id:"settings",name:"Settings"}],j=s=>e.jsx("div",{className:"flex items-center gap-0.5",children:[1,2,3,4,5].map(r=>e.jsx("svg",{className:`w-4 h-4 ${r<=s?"text-yellow-400":"text-gray-300"}`,fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"})},r))});if(D)return e.jsx("div",{className:"text-center py-12 text-gray-500",children:"Loading..."});if(M)return e.jsx("div",{className:"max-w-2xl mx-auto",children:e.jsxs("div",{className:"card p-8",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx("svg",{className:"w-8 h-8 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("h2",{className:"text-xl font-bold text-gray-900 mb-2",children:"Google Account Connected"}),e.jsx("p",{className:"text-gray-600",children:"Select which business location you want to connect:"})]}),E?e.jsx("div",{className:"text-center py-8 text-gray-500",children:"Loading locations..."}):N&&N.length>0?e.jsx("div",{className:"space-y-6",children:Object.entries(N.reduce((s,r)=>{const i=r.account_name;return s[i]||(s[i]=[]),s[i].push(r),s},{})).map(([s,r])=>e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-gray-700 mb-3 flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"})}),s,e.jsxs("span",{className:"text-xs font-normal text-gray-400",children:["(",r.length," location",r.length>
11?"s":"",")"]})]}),e.jsx("div",{className:"space-y-2",children:r.map(i=>e.jsxs("button",{onClick:()=>b.mutate(i),disabled:b.isPending,className:"w-full p-4 border border-gray-200 rounded-lg hover:border-primary-500 hover:bg-primary-50 transition text-left flex items-start gap-4 disabled:opacity-50",children:[e.jsx("div",{className:"w-10 h-10 bg-blue-100 rounded-lg flex items-center justify-center flex-shrink-0",children:e.jsxs("svg",{className:"w-5 h-5 text-blue-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-gray-900",children:i.location_name}),i.address&&e.jsx("p",{className:"text-sm text-gray-500 truncate",children:i.address})]}),e.jsx("svg",{className:"w-5 h-5 text-gray-400 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]},i.location_id))})]},s))}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-gray-500 mb-4",children:"No business locations found in your Google account."}),e.jsx("button",{onClick:()=>p(!1),className:"btn-secondary",children:"Go Back"})]}),b.isPending&&e.jsx("div",{className:"text-center py-4 text-primary-600",children:"Connecting location..."}),e.jsx("div",{className:"mt-6 pt-6 border-t text-center",children:e.jsx("button",{onClick:()=>p(!1),className:"text-sm text-gray-500 hover:text-gray-700",children:"Cancel and go back"})})]})});const a=t==null?void 0:t.is_connected;return e.jsxs("div",{children:[!a&&e.jsx("div",{className:"mb-6 bg-gradient-to-r from-blue-50 to-indigo-50 border border-blue-200 rounded-xl p-6",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-14 h-14 bg-white rounded-xl shadow-sm flex items-center justify-center flex-shrink-0",children:e.jsxs("svg",{className:"w-8 h-8",viewBox:"0 0 24 24",fill:"currentColor",children:[e.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),e.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),e.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),e.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-1",children:"Connect Google Business Profile"}),e.jsx("p",{className:"text-sm text-gray-600 mb-4",children:"Manage your reviews, create posts, and track performance metrics directly from your dashboard."}),e.jsx("button",{onClick:()=>x.mutate(),disabled:x.isPending,className:"btn-primary inline-flex items-center gap-2",children:x.isPending?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Connecting..."]}):e.jsxs(e.Fragment,{children:[e.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[e.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),e.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),e.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),e.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),"Connect with Google"]})})]})]})}),e.jsx("div",{className:"flex gap-1 mb-6 bg-gray-100 p-1 rounded-lg w-fit",children:K.map(s=>e.jsx("button",{onClick:()=>$(s.id),className:`px-4 py-2 text-sm font-medium rounded-md transition ${d===s.id?"bg-white text-primary-600 shadow-sm":"text-gray-600 hover:text-gray-900"}`,children:s.name},s.id))}),d==="overview"&&e.jsxs("div",{className:`space-y-6 ${a?"":"opacity-60"}`,children:[e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-start justify-between mb-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-16 h-16 bg-blue-100 rounded-lg flex items-center justify-center",children:e.jsxs("svg",{className:"w-8 h-8 text-blue-600",viewBox:"0 0 24 24",fill:"
1currentColor",children:[e.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),e.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),e.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),e.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-gray-900",children:a?((_=t==null?void 0:t.profile_data)==null?void 0:_.name)||(t==null?void 0:t.location_name):n.name}),e.jsx("p",{className:"text-gray-500",children:a?(P=t==null?void 0:t.profile_data)==null?void 0:P.address:"Connect to see your business address"}),e.jsx("div",{className:"flex items-center gap-2 mt-1",children:a?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800",children:"Connected"}),(t==null?void 0:t.last_synced_at)&&e.jsxs("span",{className:"text-xs text-gray-400",children:["Last synced: ",new Date(t.last_synced_at).toLocaleString()]})]}):e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-600",children:"Not Connected"})})]})]}),a&&e.jsx("button",{onClick:()=>w.mutate(),disabled:w.isPending,className:"btn-secondary text-sm",children:w.isPending?"Syncing...":"Sync Now"})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-gray-50 rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-gray-500",children:"Rating"}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx("span",{className:"text-2xl font-bold text-gray-900",children:a?((S=t==null?void 0:t.profile_data)==null?void 0:S.rating)||"-":"4.8"}),j(a?((z=t==null?void 0:t.profile_data)==null?void 0:z.rating)||0:4.8)]})]}),e.jsxs("div",{className:"bg-gray-50 rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-gray-500",children:"Reviews"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900 mt-1",children:a?((B=t==null?void 0:t.profile_data)==null?void 0:B.review_count)||0:"127"})]}),e.jsxs("div",{className:"bg-gray-50 rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-gray-500",children:"Phone"}),e.jsx("p",{className:"text-sm font-medium text-gray-900 mt-1",children:a?((A=t==null?void 0:t.profile_data)==null?void 0:A.phone)||"-":"(555) 123-4567"})]}),e.jsxs("div",{className:"bg-gray-50 rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-gray-500",children:"Website"}),e.jsx("p",{className:"text-sm font-medium text-primary-600 mt-1 truncate",children:a?((W=t==null?void 0:t.profile_data)==null?void 0:W.website)||"-":"www.example.com"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"card p-6",children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-4",children:"Business Hours"}),a&&((q=t==null?void 0:t.profile_data)!=null&&q.hours)?e.jsx("div",{className:"space-y-2",children:Object.entries(t.profile_data.hours).map(([s,r])=>e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600 capitalize",children:s}),e.jsx("span",{className:"text-gray-900",children:r})]},s))}):e.jsx("div",{className:"space-y-2",children:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"].map(s=>e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:s}),e.jsx("span",{className:"text-gray-900",children:s==="Sunday"?"Closed":"9:00 AM - 5:00 PM"})]},s))})]}),e.jsxs("div",{className:"card p-6",children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-4",children:"Categories"}),a&&((V=(H=t==null?void 0:t.profile_data)==null?void 0:H.categories)!=null&&V.length)?e.jsx("div",{className:"flex flex-wrap gap-2",children:t.profile_data.categories.map((s,r)=>e.jsx("span",{className:"px-3 py-1 bg-gray-100 text-gray-700 text-sm rounded-full",children:s},r))}):e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("span",{className:"px-3 py-1 bg-gray-100 text-gray-700 text-sm rounded-full",children:"Local Service"}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 text-gray-700 text-sm rounded-full",children:"Professional Services"})]})]})]}),e.jsxs("div",{className:"card p-6",children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-2",children:"Description"}),e.jsx("p",{className:"text-gray-600",children:a&&((F=t==null?void 0:t.profile_data)!=null&&F.description)?t.profile_data.description:"Your business description from Google will appear here once connected. This helps customers understand what services you offer."})]})]}),d==="reviews"&&e.jsxs("div",{className:`space-y-4 ${a?"":"opacity-60"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"font-semibold text-gray-900",children:"Recent Reviews"}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[j(a?((R=t==null?void 0:t.profile_data)==null?void 0:R.rating)||0:4.8),e.jsx("span",{className:"ml-1",children:a?((G=t==null?void 0:t.profile_data)==null?void 0:G.rating)||"-":"4.8"})]}),e.jsxs("span",{children:["(",a?((T=t==null?void 0:t.profile_data)==null?void 0:T.review_count)||0:"127"," reviews)"]})]})]}),a&&(o==null?void 0:o.length)===0?e.jsx("div",{className:"card p-8 text-center text-gray-500",children:"No reviews yet"}):a?o==null?void 0:o.map(s=>e.jsxs("div",{className:"card p-6",children:[e.jsx("div",{className:"flex items-start justify-between mb-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-200 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-gray-600 font-medium",children:s.author_name[0]})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900",children:s.author_name}),e.jsxs("div",{className:"flex items-center gap-2",children:[j(s.rating),e.jsx("span",{className:"text-xs text-gray-400",children:new Date(s.created_at).toLocaleDateString()})]})]})]})}),e.jsx("p",{className:"text-gray-700 mb-4",children:s.comment}),s.reply?e.jsxs("div",{className:"bg-gray-50 rounded-lg p-4 ml-6 border-l-2 border-primary-500",children:[e.jsxs("p",{className:"text-xs text-gray-500 mb-1",children:["Your reply ",s.replied_at&&`- ${new Date(s.replied_at).toLocaleDateString()}`]}),e.jsx("p",{className:"text-gray-700 text-sm",children:s.reply})]}):e.jsxs("div",{className:"ml-6",children:[e.jsx("textarea",{placeholder:"Write a reply...",value:u[s.id]||"",onChange:r=>L({...u,[s.id]:r.target.value}),className:"w-full border border-gray-300 rounded-lg p-3 text-sm resize-none",rows:2}),e.jsx("button",{onClick:()=>k.mutate({reviewId:s.id,reply:u[s.id]}),disabled:!u[s.id]||k.isPending,className:"btn-primary text-sm mt-2",children:k.isPending?"Sending...":"Reply"})]})]},s.id)):e.jsx(e.Fragment,{children:[{id:"1",author:"Sarah M.",rating:5,comment:"Excellent service! The team was very professional and responsive. Highly recommend to anyone looking for quality work.",date:"2 days ago"},{id:"2",author:"Michael R.",rating:4,comment:"Great experience overall. Quick turnaround and good communication throughout the project.",date:"1 week ago"}
1,{id:"3",author:"Jennifer L.",rating:5,comment:"Absolutely wonderful! They went above and beyond to make sure everything was perfect. Will definitely be using their services again.",date:"2 weeks ago"}].map(s=>e.jsxs("div",{className:"card p-6",children:[e.jsx("div",{className:"flex items-start justify-between mb-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-200 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-gray-600 font-medium",children:s.author[0]})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900",children:s.author}),e.jsxs("div",{className:"flex items-center gap-2",children:[j(s.rating),e.jsx("span",{className:"text-xs text-gray-400",children:s.date})]})]})]})}),e.jsx("p",{className:"text-gray-700 mb-4",children:s.comment}),e.jsxs("div",{className:"ml-6",children:[e.jsx("textarea",{placeholder:"Write a reply...",disabled:!0,className:"w-full border border-gray-300 rounded-lg p-3 text-sm resize-none bg-gray-50",rows:2}),e.jsx("button",{disabled:!0,className:"btn-primary text-sm mt-2 opacity-50 cursor-not-allowed",children:"Reply"})]})]},s.id))})]}),d==="posts"&&e.jsxs("div",{className:a?"":"opacity-60",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h3",{className:"font-semibold text-gray-900",children:"Your Posts"}),e.jsx("button",{className:`btn-primary ${a?"":"opacity-50 cursor-not-allowed"}`,disabled:!a,children:"Create Post"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[e.jsx("div",{className:"card p-4 border-2 border-dashed border-gray-200 hover:border-primary-300 cursor-pointer transition",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-blue-100 rounded-lg flex items-center justify-center",children:e.jsx("svg",{className:"w-5 h-5 text-blue-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5.882V19.24a1.76 1.76 0 01-3.417.592l-2.147-6.15M18 13a3 3 0 100-6M5.436 13.683A4.001 4.001 0 017 6h1.832c4.1 0 7.625-1.234 9.168-3v14c-1.543-1.766-5.067-3-9.168-3H7a3.988 3.988 0 01-1.564-.317z"})})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900",children:"What's New"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Share updates with customers"})]})]})}),e.jsx("div",{className:"card p-4 border-2 border-dashed border-gray-200 hover:border-primary-300 cursor-pointer transition",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-green-100 rounded-lg flex items-center justify-center",children:e.jsx("svg",{className:"w-5 h-5 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v13m0-13V6a2 2 0 112 2h-2zm0 0V5.5A2.5 2.5 0 109.5 8H12zm-7 4h14M5 12a2 2 0 110-4h14a2 2 0 110 4M5 12v7a2 2 0 002 2h10a2 2 0 002-2v-7"})})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900",children:"Offer"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Promote a sale or special"})]})]})}),e.jsx("div",{className:"card p-4 border-2 border-dashed border-gray-200 hover:border-primary-300 cursor-pointer transition",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-purple-100 rounded-lg flex items-center justify-center",children:e.jsx("svg",{className:"w-5 h-5 text-purple-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900",children:"Event"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Announce an upcoming event"})]})]})})]}),e.jsxs("div",{className:"card p-6",children:[e.jsx("h4",{className:"font-medium text-gray-900 mb-4",children:"Recent Posts"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-4 p-4 bg-gray-50 rounded-lg",children:[e.jsx("div",{className:"w-20 h-20 bg-gray-200 rounded-lg flex items-center justify-center flex-shrink-0",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium text-gray-900",children:"Spring Sale - 20% Off All Services"}),e.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Celebrate the season with special savings on all our services. Limited time offer!"}),e.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-gray-400",children:[e.jsx("span",{children:"Posted 3 days ago"}),e.jsx("span",{children:"245 views"}),e.jsx("span",{children:"12 clicks"})]})]})]}),e.jsxs("div",{className:"flex items-start gap-4 p-4 bg-gray-50 rounded-lg",children:[e.jsx("div",{className:"w-20 h-20 bg-gray-200 rounded-lg flex items-center justify-center flex-shrink-0",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium text-gray-900",children:"New Extended Hours"}),e.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"We're now open until 8 PM on weekdays to better serve you!"}),e.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-gray-400",children:[e.jsx("span",{children:"Posted 1 week ago"}),e.jsx("span",{children:"189 views"}),e.jsx("span",{children:"8 clicks"})]})]})]})]})]})]}),d==="insights"&&e.jsxs("div",{className:`space-y-6 ${a?"":"opacity-60"}`,children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"card p-6",children:[e.jsx("p",{className:"text-sm text-gray-500",children:"Profile Views"}),e.jsx("p",{className:"text-3xl font-bold text-gray-900 mt-1",children:a?(l==null?void 0:l.views)||0:"2,847"}),e.jsx("p",{className:"text-xs text-green-600 mt-1",children:"+12% from last month"})]}),e.jsxs("div",{className:"card p-6",children:[e.jsx("p",{className:"text-sm text-gray-500",children:"Search Appearances"}),e.jsx("p",{className:"text-3xl font-bold text-gray-900 mt-1",children:a?(l==null?void 0:l.searches)||0:"8,234"}),e.jsx("p",{className:"text-xs text-green-600 mt-1",children:"+8% from last month"})]}),e.jsxs("div",{className:"card p-6",children:[e.jsx("p",{className:"text-sm text-gray-500",children:"Direction Requests"}),e.jsx("p",{className:"text-3xl font-bold text-gray-900 mt-1",children:a?(l==null?void 0:l.direction_requests)||0:"156"}),e.jsx("p",{className:"text-xs text-green-600 mt-1",children:"+23% from last month"})]}),e.jsxs("div",{className:"card p-6",children:[e.jsx("p",{className:"text-sm text-gray-500",children:"Phone Calls"}),e.jsx("p",{className:"text-3xl font-bold text-gray-900 mt-1",children:a?(l==null?void 0:l.calls)||0:"89"}),e.jsx("p",{className:"text-xs text-green-600 mt-1",children:"+5% from last month"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"card p-6",children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-4",children:"Website Clicks"}),e.jsx("p",{className:"text-4xl font-bold text-primary-600",children:a?(l==null?void 0:l.website_clicks)||0:"432"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Total clicks to your website in the last 30 days"}),e.jsx("div",{className:"mt-4 h-24 bg-gradient-to-r from-primary-100 to-primary-50 rounded-lg flex items-end justify-around px-2",children:[40,55,35,70,60,85,75].map((s,r)=>e.jsx("div",{className:"w-6 bg-primary-500 rounded-t",style:{height:`${s}%`}},r))}),e.jsxs("div",{className:"flex justify-between mt-2 text-xs text-gray-400",children:[e.jsx("span",{children:"Mon"}),e.jsx("span",{children:"Tue"}),e.jsx("span",{children:"Wed"}),e.jsx("span",{children:"Thu"}),e.jsx("span",{children:"Fri"}),e.jsx("span",{children:"Sat"}),e.jsx("span",{children:"Sun"})]})]}),e.jsxs("div",{className:"card p-6",children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-4",children:"Search Queries"}),e.jsx("p",{className:"text-sm text-gray-500 mb-4",children:"Top searches that led customers to your profile"}),e.jsx("div",{className:"space-y-3",children:[{query:`${n.name.toLowerCase()}`,count:234},{query:"local services near me",count:189},{query:"best service provider",count:145},{query:"professional services",count:98}].map((s,r)=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-gray-700",children:s.query}),e.jsx("span",{className:"text-sm font-medium text-gray-900",children:s.count})]},r))})]})]}),e.jsxs("div",{className:"card p-6",children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-4",children:"Customer Actions"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"text-center p-4 bg-gray-50 rounded-lg",children:[e.jsx("svg",{className:"w-8 h-8 mx-auto text-blue-500 mb-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042
111.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z"})}),e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:"89"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Calls"})]}),e.jsxs("div",{className:"text-center p-4 bg-gray-50 rounded-lg",children:[e.jsx("svg",{className:"w-8 h-8 mx-auto text-green-500 mb-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 20l-5.447-2.724A1 1 0 013 16.382V5.618a1 1 0 011.447-.894L9 7m0 13l6-3m-6 3V7m6 10l4.553 2.276A1 1 0 0021 18.382V7.618a1 1 0 00-.553-.894L15 4m0 13V4m0 0L9 7"})}),e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:"156"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Directions"})]}),e.jsxs("div",{className:"text-center p-4 bg-gray-50 rounded-lg",children:[e.jsx("svg",{className:"w-8 h-8 mx-auto text-purple-500 mb-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"})}),e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:"432"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Website"})]}),e.jsxs("div",{className:"text-center p-4 bg-gray-50 rounded-lg",children:[e.jsx("svg",{className:"w-8 h-8 mx-auto text-orange-500 mb-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:"67"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Messages"})]})]})]})]}),d==="settings"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"card p-6",children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-4",children:"Connection Settings"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between py-3 border-b",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900",children:"Connected Account"}),e.jsx("p",{className:"text-sm text-gray-500",children:a?(t==null?void 0:t.google_account_id)||"Google Account":"Not connected"})]}),e.jsx("span",{className:`px-2 py-1 text-xs font-medium rounded ${a?"bg-green-100 text-green-800":"bg-gray-100 text-gray-600"}`,children:a?"Active":"Inactive"})]}),e.jsx("div",{className:"flex items-center justify-between py-3 border-b",children:e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900",children:"Location"}),e.jsx("p",{className:"text-sm text-gray-500",children:a?(t==null?void 0:t.location_name)||"Primary Location":"Connect to select a location"})]})}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900",children:"Auto-sync"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Automatically sync profile data every hour"})]}),e.jsxs("label",{className:`relative inline-flex items-center ${a?"cursor-pointer":"cursor-not-allowed opacity-50"}`,children:[e.jsx("input",{type:"checkbox",defaultChecked:!0,disabled:!a,className:"sr-only peer"}),e.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-primary-300 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-primary-600"})]})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900",children:"AI Review Responses"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Let AI suggest responses to customer reviews"})]}),e.jsxs("label",{className:`relative inline-flex items-center ${a?"cursor-pointer":"cursor-not-allowed opacity-50"}`,children:[e.jsx("input",{type:"checkbox",disabled:!a,className:"sr-only peer"}),e.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-primary-300 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-primary-600"})]})]}),e.jsxs("div",{className:"flex items-center justify-between py-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900",children:"Review Notifications"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Get notified when you receive new reviews"})]}),e.jsxs("label",{className:`relative inline-flex items-center ${a?"cursor-pointer":"cursor-not-allowed opacity-50"}`,children:[e.jsx("input",{type:"checkbox",defaultChecked:!0,disabled:!a,className:"sr-only peer"}),e.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-primary-300 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-primary-600"})]})]})]})]}),a?e.jsxs("div",{className:"card p-6 border-red-200",children:[e.jsx("h3",{className:"font-semibold text-red-600 mb-2",children:"Danger Zone"}),e.jsx("p",{className:"text-sm text-gray-500 mb-4",children:"Disconnecting will remove the integration. You can reconnect at any time."}),e.jsx("button",{onClick:()=>{confirm("Are you sure you want to disconnect Google Business Profile?")&&v.mutate()},disabled:v.isPending,className:"btn-secondary text-red-600 border-red-300 hover:bg-red-50",children:v.isPending?"Disconnecting...":"Disconnect Google Business Profile"})]}):e.jsxs("div",{className:"card p-6 bg-blue-50 border-blue-200",children:[e.jsx("h3",{className:"font-semibold text-blue-900 mb-2",children:"Connect to Enable Settings"}),e.jsx("p",{className:"text-sm text-blue-700 mb-4",children:"Connect your Google Business Profile to customize these settings and manage your online presence."}),e.jsx("button",{onClick:()=>x.mutate(),disabled:x.isPending,className:"btn-primary",children:x.isPending?"Connecting...":"Connect with Google"})]})]})]})}export{X as default};
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.