PageSourceSearch

https://boombam.app/assets/platform-integration-DtGhh7T6.js

js boombam.app collected 2026-10-04 13:34:06 UTC 62,267 bytes, 11 lines download raw bytes

1import{K as de,r as w,j as e,ak as $,al as V,am as H,an as K,D as k,ao as U,z as ke,y as L,l as ne,B as x,C as c,ba as Ce,bb as Se,b as d,d as m,o as y,s as F,aK as Re,w as Ae,bc as Te,e as p,f as me,k as b,c_ as xe,b5 as M,m as N,S as Ge,c$ as Pe,bh as Z,b6 as z,n as W,X as E,U as Ie,R as he,T as Me,E as We,Q as Y,J as Fe,V as re,_,a5 as Q,a as B,a6 as ee,bJ as ue,aF as pe,$ as C,a0 as S,a1 as R,a2 as A,a3 as l,aq as se,h as De,bU as ze,ap as Le,aD as ge,d0 as qe,t as ce,a7 as te,x as Oe,aY as Be}from"./index-CuSEeJFb.js";import{T as je,a as fe,b as P,c as I}from"./tabs-CcPOXtvT.js";import{P as Ee}from"./progress-B2eMqtVV.js";import{C as ve}from"./circle-check-DSSdNCFx.js";import{R as Ye}from"./rocket-DokzAs0d.js";import{I as le}from"./inbox-BU0SGvLM.js";import{S as we}from"./shield-check-CdluR3-3.js";import{S as ye}from"./share-2-BVJnd9fZ.js";import{S as $e}from"./square-pen-Wwme7SiP.js";import{C as Ve}from"./copy-Ctw93tQ7.js";import{F as He}from"./facebook-BJe1dDtq.js";import{A as Ke}from"./arrow-right-left-B_tMOH_y.js";import{f as be}from"./format-hhvI2L0z.js";import"./en-US-BOoww7nS.js";/**
2 * @license lucide-react v0.453.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Ue=de("Chrome",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["line",{x1:"21.17",x2:"12",y1:"8",y2:"8",key:"a0cw5f"}],["line",{x1:"3.95",x2:"8.54",y1:"6.06",y2:"14",key:"1kftof"}],["line",{x1:"10.88",x2:"15.46",y1:"21.94",y2:"14",key:"1ymyh8"}]]);/**
7 * @license lucide-react v0.453.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Ne=de("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]),X=[{id:"overview",title:"Reviews Growth Engine Overview",icon:k,description:"Transform customer reviews into powerful marketing assets that drive growth",steps:[{title:"What is the Reviews Growth Engine?",description:"A complete system that connects your review sources, manages feedback, creates widgets, and generates marketing content automatically using AI.",tips:["Consolidates reviews from Google Business, Yelp, Facebook, and more","Automatically converts positive reviews into social media posts","Creates embeddable widgets to showcase reviews on your website","Tracks performance metrics to measure review impact"]},{title:"The Complete Workflow",description:"Follow this 5-step process to maximize your review marketing:",tips:["1. Connect Sources → Link your review platforms (Google, Yelp, Facebook)","2. Manage Inbox → Organize, respond to, and tag reviews","3. Create Widgets → Build embeddable review displays for your website","4. Generate Content → Use AI to create social posts and marketing materials","5. Track Analytics → Monitor performance and optimize your strategy"]},{title:"Key Benefits",description:"Why the Reviews Growth Engine is essential for your marketing:",tips:["Save 10+ hours per week on review management","Increase website conversion rates with social proof","Generate unlimited marketing content from existing reviews","Build trust and credibility with potential customers","Track ROI from your review marketing efforts"]}]},{id:"sources",title:"Connecting Review Sources",icon:Z,description:"Connect Google Business, Yelp, Facebook, and other review platforms",steps:[{title:"Connect Google Business Profile",description:"Link your Google Business Profile to automatically sync reviews and ratings.",tips:["Click 'Connect Google Business' in the Sources tab","Sign in with your Google account that owns the business","Select your business location if you have multiple","Reviews will sync automatically within 15 minutes"],warning:"Make sure you're signed in as a business owner or manager, not just a user account."},{title:"Connect Yelp Business",description:"Integrate your Yelp business page to import reviews and respond to feedback.",tips:["Click 'Connect Yelp Business' and sign in to your Yelp business account","Authorize access to your business reviews","Historical reviews will be imported (up to 100 most recent)","New reviews will sync daily"],success:"Yelp integration includes review response capabilities directly from your inbox."},{title:"Connect Facebook Reviews",description:"Link your Facebook Business Page to manage reviews and recommendations.",tips:["Click 'Connect Facebook' and log in to your Facebook account","Select your business page from the list","Grant permissions for reading reviews and posting responses","Both reviews and recommendations will be imported"]},{title:"Monitor Connection Status",description:"Keep your integrations healthy and active.",tips:["Check connection status indicators (green = healthy, red = needs attention)","Refresh connections if data stops syncing","Update permissions if platforms change their requirements","Set up email alerts for connection failures"],warning:"If connections fail, click 'Reconnect' and re-authorize access."}]},{id:"inbox",title:"Managing Your Review Inbox",icon:le,description:"Organize, moderate, respond to, and tag reviews from all sources",steps:[{title:"Review Inbox Overview",description:"Your central hub for managing all incoming reviews across platforms.",tips:["View reviews from all sources in one unified inbox","Filter by rating, platform, date, or response status","Sort by newest, oldest, highest rated, or lowest rated","Use bulk actions to tag or categorize multiple reviews"]},{title:"Responding to Reviews",description:"Craft professional responses that build relationships and trust.",tips:["Click 'Reply' on any review to open the response editor","Use AI suggestions for professional response templates","Customize responses based on review rating and content","Responses post directly to the original platform"],success:"Positive responses can turn neutral reviews into loyal customers!"},{title:"Review Moderation & Tagging",description:"Organize reviews for easy filtering and content generation.",tips:["Tag reviews by theme: 'great service', 'product quality', 'fast delivery'","Mark reviews as 'featured' to prioritize them in widgets","Hide inappropriate or fake reviews from public display","Create custom tags that match your business categories"]},{title:"Review Analytics in Inbox",description:"Track response rates and engagement metrics.",tips:["Monitor response time to reviews (aim for under 24 hours)","Track sentiment trends over time","Identify common themes in positive and negative feedback","Use insights to improve business operations"]}]},{id:"widgets",title:"Creating Review Widgets",icon:z,description:"Build embeddable review displays for your website and marketing",steps:[{title:"Widget Types Available",description:"Choose the right widget format for your website layout.",tips:["Carousel Widget: Rotating display of 3-5 featured reviews","Grid Widget: Static grid layout showing 6-9 reviews","Single Widget: Highlight one standout review","Testimonial Wall: Full-page display of customer stories"]},{title:"Creating Your First Widget",description:"Step-by-step widget creation process.",tips:["Click 'Create Widget' in the Widgets tab","Choose widget type (Carousel recommended for first-time users)","Select review sources to include","Set minimum rating filter (4+ stars recommended)","Customize colors and fonts to match your brand"],success:"Most users see a 15-20% increase in conversion rates after adding review widgets."},{title:"Widget Customization",description:"Make widgets match your website's design perfectly.",tips:["Adjust colors: background, text, accent colors","Choose fonts: inherit from website or select custom","Set size: responsive width or fixed dimensions","Configure display: show ratings, dates, platform logos","Preview on mobile and desktop before publishing"]},{title:"Embedding Widgets",description:"Add widgets to your website with simple c
11opy-paste code.",tips:["Copy the provided HTML embed code","Paste into your website's HTML where you want the widget","No technical skills required - works on any website platform","Widgets update automatically when new reviews come in"],warning:"Test widgets on a staging site before deploying to production."}]},{id:"automations",title:"AI Content Generation & Automations",icon:W,description:"Transform reviews into marketing content using AI automation",steps:[{title:"Social Media Post Generation",description:"Turn positive reviews into engaging social media content.",tips:["Select 1-3 of your best reviews (4+ stars recommended)","Choose target platforms: Instagram, Facebook, Twitter, LinkedIn","Select tone: professional, casual, enthusiastic","AI generates platform-optimized posts with hashtags"],success:"AI-generated posts typically get 25% more engagement than manual posts."},{title:"Customer Story Creation",description:"Generate detailed case studies from customer reviews.",tips:["Choose reviews with detailed feedback and specific outcomes","Select story type: case study, testimonial, success story","Set target audience: general, industry-specific, or persona-based","AI creates 500-800 word stories with compelling narratives"]},{title:"SEO Content Generation",description:"Create search-optimized content featuring customer reviews.",tips:["Select multiple reviews covering different services/products","Add target keywords for your industry and location","Choose content type: landing page, blog post, or service page","Generated content includes review quotes and SEO optimization"]},{title:"Automation Rules Setup",description:"Set up automatic content generation for new reviews.",tips:["Create rules: 'When 5-star review → Generate social post'","Set frequency limits to avoid over-posting","Configure approval workflows for generated content","Schedule content publication across social platforms"],warning:"Always review AI-generated content before publishing to maintain brand quality."}]},{id:"analytics",title:"Review Analytics & Performance",icon:E,description:"Track how reviews impact your marketing and business growth",steps:[{title:"Review Performance Metrics",description:"Monitor key metrics that indicate review program success.",tips:["Average rating trend over time","Review volume: monthly and weekly incoming reviews","Response rate and average response time","Platform breakdown: which sources generate most reviews"]},{title:"Widget Performance Tracking",description:"Measure how review widgets impact website conversions.",tips:["Click-through rates on review widgets","Time spent on pages with review widgets vs without","Conversion rate impact: visitors who viewed reviews vs didn't","A/B testing different widget positions and styles"]},{title:"Content Marketing ROI",description:"Track the performance of AI-generated marketing content.",tips:["Social media engagement rates for review-based posts","Website traffic from review-based SEO content","Lead generation from customer story campaigns","Cost savings from automated content creation"]},{title:"Business Impact Analysis",description:"Connect review marketing to bottom-line business results.",tips:["Correlation between review score improvements and revenue","Customer acquisition cost reduction from social proof","Customer lifetime value of review-driven customers","Brand sentiment tracking across all platforms"]}]}],_e=[{problem:"Authentication Required Error",solution:"Click 'Reconnect' on the failed integration and re-authorize access. Make sure you're using an account with business management permissions.",icon:we},{problem:"CompanyAccessError",solution:"Switch to the correct company profile in your account settings, or contact your admin to grant access to review management tools.",icon:Ie},{problem:"Reviews Not Syncing",solution:"Check your connection status and refresh the integration. Some platforms have rate limits that delay syncing by 15-30 minutes.",icon:he},{problem:"AI Content Generation Fails",solution:"Ensure you've selected high-quality reviews with sufficient detail. Try reducing the number of selected reviews or check your AI credits.",icon:W},{problem:"Widget Not Displaying",solution:"Verify the embed code is correctly placed in your HTML. Check that your website doesn't block external scripts or iframes.",icon:Ne},{problem:"Empty Analytics Data",solution:"Analytics require 24-48 hours to populate after setup. Make sure tracking pixels are properly installed on your website.",icon:E}],Qe=[{title:"Review Selection Strategy",tip:"Focus on 4-5 star reviews that tell a story with specific details about outcomes and experiences.",icon:Me},{title:"Widget Placement",tip:"Place review widgets on high-traffic pages: homepage, service pages, and checkout flow for maximum impact.",icon:We},{title:"Response Templates",tip:"Create response templates for different scenarios but always personalize with specific details from the review.",icon:Y},{title:"Content Generation Timing",tip:"Generate social content in batches weekly rather than 
11individually to maintain consistent posting schedule.",icon:Fe},{title:"Multi-Platform Strategy",tip:"Cross-post review-based content across platforms but adapt the format and tone for each platform's audience.",icon:ye},{title:"Performance Optimization",tip:"A/B test different widget styles and positions monthly to optimize conversion rates and user engagement.",icon:re}];function Je({isOpen:r,onClose:u}){const[g,j]=w.useState(["overview"]),[h,a]=w.useState("guide"),o=i=>{j(t=>t.includes(i)?t.filter(s=>s!==i):[...t,i])},v=()=>{j(X.map(i=>i.id))},f=()=>{j([])};return e.jsx($,{open:r,onOpenChange:u,children:e.jsxs(V,{className:"max-w-6xl max-h-[90vh] overflow-hidden","data-testid":"review-integration-guide",children:[e.jsxs(H,{className:"pb-4 border-b",children:[e.jsxs(K,{className:"text-2xl flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-gradient-to-r from-yellow-500 to-orange-500 rounded-lg",children:e.jsx(k,{className:"h-6 w-6 text-white"})}),"Review Integration & Management Guide"]}),e.jsx(U,{className:"text-base",children:"Master the Reviews Growth Engine to transform customer feedback into powerful marketing assets"})]}),e.jsxs(je,{value:h,onValueChange:a,className:"flex flex-col h-full",children:[e.jsxs(fe,{className:"grid w-full grid-cols-3","data-testid":"guide-tabs",children:[e.jsxs(P,{value:"guide","data-testid":"tab-guide",children:[e.jsx(ke,{className:"h-4 w-4 mr-2"}),"Step-by-Step Guide"]}),e.jsxs(P,{value:"troubleshooting","data-testid":"tab-troubleshooting",children:[e.jsx(L,{className:"h-4 w-4 mr-2"}),"Troubleshooting"]}),e.jsxs(P,{value:"tips","data-testid":"tab-tips",children:[e.jsx(ne,{className:"h-4 w-4 mr-2"}),"Pro Tips"]})]}),e.jsx(I,{value:"guide",className:"flex-1 overflow-y-auto",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center py-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ee,{value:g.length/X.length*100,className:"w-32 h-2"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[g.length," of ",X.length," sections open"]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(x,{variant:"outline",size:"sm",onClick:v,"data-testid":"button-expand-all",children:"Expand All"}),e.jsx(x,{variant:"outline",size:"sm",onClick:f,"data-testid":"button-collapse-all",children:"Collapse All"})]})]}),e.jsx("div",{className:"space-y-4",children:X.map(i=>e.jsx(c,{className:"overflow-hidden","data-testid":`section-${i.id}`,children:e.jsxs(Ce,{open:g.includes(i.id),onOpenChange:()=>o(i.id),children:[e.jsx(Se,{asChild:!0,children:e.jsx(d,{className:"cursor-pointer hover:bg-muted/50 transition-colors",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-gradient-to-r from-blue-500 to-purple-500 rounded-lg",children:e.jsx(i.icon,{className:"h-5 w-5 text-white"})}),e.jsxs("div",{children:[e.jsx(m,{className:"text-lg",children:i.title}),e.jsx(y,{className:"text-base mt-1",children:i.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(F,{variant:"secondary",children:[i.steps.length," steps"]}),g.includes(i.id)?e.jsx(Re,{className:"h-5 w-5"}):e.jsx(Ae,{className:"h-5 w-5"})]})]})})}),e.jsx(Te,{children:e.jsx(p,{className:"pt-0",children:e.jsx("div",{className:"space-y-6",children:i.steps.map((t,s)=>e.jsxs("div",{className:"border-l-4 border-blue-200 pl-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-500 text-white rounded-full flex items-center justify-center text-sm font-bold",children:s+1}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-semibold text-lg",children:t.title}),e.jsx("p",{className:"text-muted-foreground mt-1",children:t.description})]})]}),t.tips&&e.jsx("div",{className:"ml-8 space-y-2",children:t.tips.map((T,n)=>e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(me,{className:"h-4 w-4 text-green-500 mt-0.5 flex-shrink-0"}),e.jsx("span",{className:"text-sm",children:T})]},n))}),t.warning&&e.jsxs(b,{className:"ml-8",children:[e.jsx(xe,{className:"h-4 w-4"}),e.jsx(M,{children:"Important Note"}),e.jsx(N,{children:t.warning})]}),t.success&&e.jsxs(b,{className:"ml-8 bg-green-50 border-green-200 dark:bg-green-950/20",children:[e.jsx(ve,{className:"h-4 w-4 text-green-600"}),e.jsx(M,{className:"text-green-800 dark:text-green-200",children:"Pro Tip"}),e.jsx(N,{className:"text-green-700 dark:text-green-300",children:t.success})]})]},s))})})})]})},i.id))})]})}),e.jsx(I,{value:"troubleshooting",className:"flex-1 overflow-y-auto",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-center py-4",children:[e.jsx("h3",{className:"text-xl font-semibold mb-2",children:"Common Issues & Solutions"}
11),e.jsx("p",{className:"text-muted-foreground",children:"Quick fixes for the most common problems you might encounter"})]}),e.jsx("div",{className:"grid gap-4",children:_e.map((i,t)=>e.jsx(c,{"data-testid":`troubleshooting-${t}`,children:e.jsx(d,{children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"p-2 bg-red-100 dark:bg-red-950/20 rounded-lg",children:e.jsx(i.icon,{className:"h-5 w-5 text-red-600 dark:text-red-400"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx(m,{className:"text-lg text-red-700 dark:text-red-300",children:i.problem}),e.jsx(y,{className:"mt-2 text-base",children:i.solution})]})]})})},t))}),e.jsxs(b,{className:"mt-6",children:[e.jsx(L,{className:"h-4 w-4"}),e.jsx(M,{children:"Still Need Help?"}),e.jsx(N,{children:"If you're still experiencing issues, contact our support team with specific error messages and screenshots for faster resolution."})]})]})}),e.jsx(I,{value:"tips",className:"flex-1 overflow-y-auto",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-center py-4",children:[e.jsx("h3",{className:"text-xl font-semibold mb-2",children:"Pro Tips & Best Practices"}),e.jsx("p",{className:"text-muted-foreground",children:"Advanced strategies to maximize your review marketing success"})]}),e.jsx("div",{className:"grid gap-4",children:Qe.map((i,t)=>e.jsx(c,{"data-testid":`tip-${t}`,children:e.jsx(d,{children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"p-2 bg-gradient-to-r from-green-500 to-blue-500 rounded-lg",children:e.jsx(i.icon,{className:"h-5 w-5 text-white"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx(m,{className:"text-lg",children:i.title}),e.jsx(y,{className:"mt-2 text-base",children:i.tip})]})]})})},t))}),e.jsxs(b,{className:"mt-6 bg-gradient-to-r from-blue-50 to-purple-50 dark:from-blue-950/20 dark:to-purple-950/20 border-blue-200 dark:border-blue-800",children:[e.jsx(Ye,{className:"h-4 w-4 text-blue-600"}),e.jsx(M,{className:"text-blue-900 dark:text-blue-100",children:"Ready to Level Up?"}),e.jsx(N,{className:"text-blue-800 dark:text-blue-200",children:"Implement these strategies consistently for 30 days and you'll see a significant improvement in review volume, website conversions, and social media engagement."})]})]})})]}),e.jsxs("div",{className:"flex justify-between items-center pt-4 border-t",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Ge,{className:"h-4 w-4"}),e.jsx("span",{children:"Updated for Reviews Growth Engine v2.0"})]}),e.jsx(Pe,{asChild:!0,children:e.jsx(x,{"data-testid":"button-close-guide",children:"Close Guide"})})]})]})})}function js(){const[r,u]=w.useState("sources"),[g,j]=w.useState(!1);_();const h=Q(),{data:a=[],isLoading:o}=B({queryKey:["/api/customer-reviews"],retry:!1}),{data:v=[],isLoading:f}=B({queryKey:["/api/review-import-integrations"],retry:!1}),{data:i=[],isLoading:t}=B({queryKey:["/api/review-widgets"],retry:!1}),{data:s=[],isLoading:T}=B({queryKey:["/api/marketing-content"],retry:!1}),{data:n,isLoading:D}=B({queryKey:["/api/review-analytics"],retry:!1}),J=a.length>0?(a.reduce((G,ie)=>G+(ie.rating||0),0)/a.length).toFixed(1):"0.0",q=a.filter(G=>{if(!G.createdAt)return!1;const ie=new Date(G.createdAt),ae=new Date;return ae.setDate(ae.getDate()-30),ie>=ae}).length,O=i.filter(G=>G.status==="published").length,oe=s.filter(G=>G.aiGenerated).length;return e.jsxs("div",{className:"container mx-auto p-4 sm:p-6 max-w-7xl space-y-4 sm:space-y-6","data-testid":"reviews-growth-engine-page",children:[e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold text-gray-900 dark:text-white",children:"Reviews Growth Engine ⭐"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm sm:text-base text-muted-foreground",children:"Transform customer reviews into powerful marketing assets that drive growth"}),e.jsx("div",{className:"text-sm text-muted-foreground bg-blue-50 dark:bg-blue-950/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ne,{className:"h-4 w-4 text-blue-600 dar
11k:text-blue-400 mt-0.5"}),e.jsxs("div",{children:[e.jsx("strong",{className:"text-blue-900 dark:text-blue-100",children:"What you can do here:"}),e.jsxs("ul",{className:"mt-1 space-y-1 text-blue-800 dark:text-blue-200",children:[e.jsx("li",{children:"• Connect Google, Yelp, and Facebook review sources"}),e.jsx("li",{children:"• Manage and respond to reviews from one inbox"}),e.jsx("li",{children:"• Create beautiful review widgets for your website"}),e.jsx("li",{children:"• Generate AI-powered social media content from reviews"}),e.jsx("li",{children:"• Track how reviews impact your marketing performance"})]})]})]})})]})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsxs(x,{onClick:()=>j(!0),variant:"default",className:"flex items-center gap-2 flex-1 sm:flex-none","data-testid":"button-view-guide",children:[e.jsx(L,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"View Guide"}),e.jsx("span",{className:"sm:hidden",children:"Guide"})]}),e.jsxs(x,{onClick:()=>h.invalidateQueries(),variant:"outline",className:"flex items-center gap-2 flex-1 sm:flex-none","data-testid":"button-refresh-data",children:[e.jsx(he,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Refresh Data"}),e.jsx("span",{className:"sm:hidden",children:"Refresh"})]})]})]})}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs(c,{"data-testid":"kpi-average-rating",children:[e.jsxs(d,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(m,{className:"text-sm font-medium",children:"Average Rating"}),e.jsx(k,{className:"h-4 w-4 text-yellow-500"})]}),e.jsxs(p,{children:[e.jsxs("div",{className:"text-2xl font-bold flex items-center gap-1",children:[J,e.jsx(k,{className:"h-5 w-5 text-yellow-500 fill-current"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a.length===0?"No reviews yet":`From ${a.length} reviews`})]})]}),e.jsxs(c,{"data-testid":"kpi-new-reviews",children:[e.jsxs(d,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(m,{className:"text-sm font-medium",children:"New Reviews (30d)"}),e.jsx(re,{className:"h-4 w-4 text-green-500"})]}),e.jsxs(p,{children:[e.jsx("div",{className:"text-2xl font-bold",children:q}),e.jsx("p",{className:"text-xs text-muted-foreground",children:q===0?"No new reviews":"Recent customer feedback"})]})]}),e.jsxs(c,{"data-testid":"kpi-published-widgets",children:[e.jsxs(d,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(m,{className:"text-sm font-medium",children:"Published Widgets"}),e.jsx(z,{className:"h-4 w-4 text-blue-500"})]}),e.jsxs(p,{children:[e.jsx("div",{className:"text-2xl font-bold",children:O}),e.jsx("p",{className:"text-xs text-muted-foreground",children:O===0?"No widgets created":"Live on your website"})]})]}),e.jsxs(c,{"data-testid":"kpi-ai-posts",children:[e.jsxs(d,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(m,{className:"text-sm font-medium",children:"AI Posts Generated"}),e.jsx(W,{className:"h-4 w-4 text-purple-500"})]}),e.jsxs(p,{children:[e.jsx("div",{className:"text-2xl font-bold",children:oe}),e.jsx("p",{className:"text-xs text-muted-foreground",children:oe===0?"No AI content yet":"Marketing content created"})]})]})]}),e.jsxs(je,{value:r,onValueChange:u,className:"space-y-4 sm:space-y-6",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(fe,{className:"flex sm:grid w-full sm:grid-cols-5 h-auto p-1",children:[e.jsxs(P,{value:"sources","data-testid":"tab-sources",className:"flex-shrink-0 text-xs sm:text-sm px-2 sm:px-4 py-2",children:[e.jsx(Z,{className:"w-3 h-3 sm:w-4 sm:h-4 mr-1 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Sources"}),e.jsx("span",{className:"sm:hidden",children:"Sources"})]}),e.jsxs(P,{value:"inbox","data-testid":"tab-inbox",className:"flex-shrink-0 text-xs sm:text-sm px-2 sm:px-4 py-2",children:[e.jsx(le,{className:"w-3 h-3 sm:w-4 sm:h-4 mr-1 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Inbox"}),e.jsx("span",{className:"sm:hidden",children:"Inbox"})]}),e.jsxs(P,{value:"widgets","data-testid":"tab-widgets",className:"flex-shrink-0 text-xs sm:text-sm px-2 sm:px-4 py-2",children:[e.jsx(z,{className:"w-3 h-3 sm:w-4 sm:h-4 mr-1 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Widgets"}),e.jsx("span",{className:"sm:hidden",children:"Widgets"})]}),e.jsxs(P,{value:"automations","data-testid":"tab-automations",className:"flex-shrink-0 text-xs sm:text-sm px-2 sm:px-4 py-2",children:[e.jsx(W,{className:"w-3 h-3 sm:w-4 sm:h-4 mr-1 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Automations"}),e.jsx("span",{className:"sm:hidden",children:"Auto"})]}),e.jsxs(P,{value:"analytics","data-testid":"tab-analytics",className:"flex-shrink-0 text-xs sm:text-sm px-2 sm:px-4 py-2",children:[e.jsx(E,{className:"w-3 h-3 sm:w-4 sm:h-4 mr-1 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Analytics"}),e.jsx("span",{className:"sm:hidden",children:"Analytics"})]})]})}
11),e.jsx(I,{value:"sources",className:"space-y-4 sm:space-y-6",children:e.jsx(Xe,{sources:v,isLoading:f})}),e.jsx(I,{value:"inbox",className:"space-y-4 sm:space-y-6",children:e.jsx(Ze,{reviews:a,isLoading:o})}),e.jsx(I,{value:"widgets",className:"space-y-4 sm:space-y-6",children:e.jsx(es,{widgets:i,reviews:a,isLoading:t})}),e.jsx(I,{value:"automations",className:"space-y-4 sm:space-y-6",children:e.jsx(ss,{marketingContent:s,reviews:a,isLoading:T})}),e.jsx(I,{value:"analytics",className:"space-y-4 sm:space-y-6",children:e.jsx(ts,{analytics:n,reviews:a,widgets:i,marketingContent:s,isLoading:D})})]})]})}function Xe({sources:r,isLoading:u}){const[g,j]=w.useState(!1),[h,a]=w.useState(""),{toast:o}=_(),v=Q(),f=ee({mutationFn:async t=>await te("/api/review-import-integrations",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{o({title:"Source Connected",description:"Your review source has been connected successfully."}),v.invalidateQueries({queryKey:["/api/review-import-integrations"]}),j(!1)},onError:t=>{o({title:"Connection Failed",description:t.message||"Failed to connect review source. Check your credentials and try again.",variant:"destructive"})}});if(u)return e.jsx("div",{className:"flex justify-center p-8",children:"Loading review sources..."});const i=[{id:"google",name:"Google My Business",icon:e.jsx(Ue,{className:"h-5 w-5"}),color:"text-blue-600"},{id:"yelp",name:"Yelp",icon:e.jsx(k,{className:"h-5 w-5"}),color:"text-red-600"},{id:"facebook",name:"Facebook",icon:e.jsx(He,{className:"h-5 w-5"}),color:"text-blue-600"},{id:"trustpilot",name:"Trustpilot",icon:e.jsx(we,{className:"h-5 w-5"}),color:"text-green-600"}];return e.jsxs("div",{className:"space-y-6",children:[r.length===0&&e.jsxs(b,{children:[e.jsx(ne,{className:"h-4 w-4"}),e.jsx(M,{children:"Getting Started with Review Sources"}),e.jsx(N,{children:e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsx("p",{children:"Connect your review platforms to start collecting and managing reviews in one place."}),e.jsxs("div",{className:"text-sm",children:[e.jsx("strong",{children:"Step-by-step process:"}),e.jsxs("ol",{className:"list-decimal list-inside mt-1 space-y-1 ml-2",children:[e.jsx("li",{children:"Choose a platform (Google, Yelp, Facebook)"}),e.jsx("li",{children:"Authenticate with your business account"}),e.jsx("li",{children:"Configure import settings and filters"}),e.jsx("li",{children:"Start collecting reviews automatically"})]})]})]})})]}),e.jsxs(c,{"data-testid":"card-available-platforms",children:[e.jsxs(d,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(Z,{className:"h-5 w-5"}),"Available Review Platforms"]}),e.jsx(y,{children:"Connect your business profiles to import and manage reviews"})]}),e.jsx(p,{children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:i.map(t=>{const s=r.some(T=>T.platform===t.id);return e.jsx("div",{className:`p-4 border rounded-lg transition-colors ${s?"border-green-200 bg-green-50 dark:border-green-800 dark:bg-green-950/20":"border-gray-200 hover:border-gray-300 dark:border-gray-700 dark:hover:border-gray-600"}`,"data-testid":`platform-${t.id}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:t.color,children:t.icon}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium",children:t.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s?"Connected":"Not connected"})]})]}),s?e.jsxs(F,{variant:"secondary",className:"text-green-700 bg-green-100 dark:text-green-300 dark:bg-green-900/30",children:[e.jsx(ve,{className:"h-3 w-3 mr-1"}),"Active"]}):e.jsx(x,{size:"sm",onClick:()=>{a(t.id),j(!0)},"data-testid":`button-connect-${t.id}`,children:"Connect"})]})},t.id)})})})]}),r.length>0&&e.jsxs(c,{"data-testid":"card-connected-sources",children:[e.jsxs(d,{children:[e.jsx(m,{children:"Connected Sources"}),e.jsx(y,{children:"Manage your connected review platforms and import settings"})]}),e.jsx(p,{children:e.jsx("div",{className:"space-y-4",children:r.map(t=>e.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg","data-testid":`connected-source-${t.id}`,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(Z,{className:"h-5 w-5 text-blue-600"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium",children:t.platform}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.totalReviews||0," reviews imported"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{variant:t.status==="active"?"default":"secondary",children:t.status}),e.jsx(x,{size:"sm",variant:"outline","data-testid":`button-edit-source-${t.id}`,children:e.jsx(ue,{className:"h-4 w-4"})})]})]},t.id))})})]}),e.jsx($,{open:g,onOpenChange:j,children:e.jsxs(V,{children:[e.jsxs(H,{
11children:[e.jsx(K,{children:"Connect Review Platform"}),e.jsxs(U,{children:["Connect your ",h," business account to import reviews"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(b,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsx(M,{children:"Authentication Required"}),e.jsxs(N,{children:["You'll be redirected to ",h," to authenticate your business account. Make sure you have admin access to your business profile."]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Business Name (Optional)"}),e.jsx(pe,{placeholder:"Enter your business name","data-testid":"input-business-name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Import Frequency"}),e.jsxs(C,{defaultValue:"hourly",children:[e.jsx(S,{"data-testid":"select-import-frequency",children:e.jsx(R,{})}),e.jsxs(A,{children:[e.jsx(l,{value:"hourly",children:"Every Hour"}),e.jsx(l,{value:"daily",children:"Daily"}),e.jsx(l,{value:"weekly",children:"Weekly"})]})]})]})]}),e.jsxs(se,{children:[e.jsx(x,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),e.jsx(x,{onClick:()=>{f.mutate({platform:h,status:"active",importFrequency:"hourly"})},disabled:f.isPending,"data-testid":"button-confirm-connect",children:f.isPending?"Connecting...":"Connect Platform"})]})]})})]})}function Ze({reviews:r,isLoading:u}){w.useState([]);const[g,j]=w.useState("all"),[h,a]=w.useState(!1),[o,v]=w.useState(null),{toast:f}=_(),i=Q(),t=ee({mutationFn:async n=>await te("/api/review-responses",{method:"POST",body:JSON.stringify(n)}),onSuccess:()=>{f({title:"Response Sent",description:"Your response has been published successfully."}),i.invalidateQueries({queryKey:["/api/customer-reviews"]}),a(!1)},onError:n=>{f({title:"Response Failed",description:n.message||"Failed to send response. Please try again.",variant:"destructive"})}});if(u)return e.jsx("div",{className:"flex justify-center p-8",children:"Loading review inbox..."});const s=r.filter(n=>g==="all"?!0:g==="positive"?(n.rating||0)>=4:g==="negative"?(n.rating||0)<=2:!0),T=r.filter(n=>{var D;return!((D=n.responses)!=null&&D.length)});return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs(c,{"data-testid":"card-total-reviews",children:[e.jsxs(d,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(m,{className:"text-sm font-medium",children:"Total Reviews"}),e.jsx(Y,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(p,{children:[e.jsx("div",{className:"text-2xl font-bold",children:r.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"All time"})]})]}),e.jsxs(c,{"data-testid":"card-needs-response",children:[e.jsxs(d,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(m,{className:"text-sm font-medium",children:"Needs Response"}),e.jsx(De,{className:"h-4 w-4 text-orange-500"})]}),e.jsxs(p,{children:[e.jsx("div",{className:"text-2xl font-bold text-orange-600",children:T.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Awaiting reply"})]})]}),e.jsxs(c,{"data-testid":"card-response-rate",children:[e.jsxs(d,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(m,{className:"text-sm font-medium",children:"Response Rate"}),e.jsx(me,{className:"h-4 w-4 text-green-500"})]}),e.jsxs(p,{children:[e.jsxs("div",{className:"text-2xl font-bold text-green-600",children:[r.length>0?Math.round((r.length-T.length)/r.length*100):0,"%"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Of all reviews"})]})]})]}),e.jsxs(c,{children:[e.jsx(d,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(m,{children:"Review Inbox"}),e.jsx(y,{children:"Manage and respond to customer reviews"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(C,{value:g,onValueChange:j,children:[e.jsx(S,{className:"w-40","data-testid":"select-rating-filter",children:e.jsx(R,{})}),e.jsxs(A,{children:[e.jsx(l,{value:"all",children:"All Reviews"}
11),e.jsx(l,{value:"positive",children:"Positive (4-5★)"}),e.jsx(l,{value:"negative",children:"Negative (1-2★)"})]})]})})]})}),e.jsx(p,{children:s.length>0?e.jsx("div",{className:"space-y-4",children:s.map(n=>{var D,J,q;return e.jsxs("div",{className:"border rounded-lg p-4 space-y-3","data-testid":`review-${n.id}`,children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"flex items-center",children:[1,2,3,4,5].map(O=>e.jsx(k,{className:`h-4 w-4 ${O<=(n.rating||0)?"text-yellow-400 fill-current":"text-gray-300"}`},O))}),e.jsx(F,{variant:"outline",children:n.platform||"Unknown"}),!((D=n.responses)!=null&&D.length)&&e.jsx(F,{variant:"destructive",className:"text-xs",children:"Needs Response"})]}),e.jsx("h4",{className:"font-medium",children:n.reviewerName||"Anonymous"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:n.reviewText||"No review text available"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:n.reviewDate?be(new Date(n.reviewDate),"MMM d, yyyy"):"Unknown date"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!((J=n.responses)!=null&&J.length)&&e.jsxs(x,{size:"sm",onClick:()=>{v(n),a(!0)},"data-testid":`button-respond-${n.id}`,children:[e.jsx(Y,{className:"h-4 w-4 mr-1"}),"Respond"]}),e.jsx(x,{size:"sm",variant:"outline","data-testid":`button-view-${n.id}`,children:e.jsx(ze,{className:"h-4 w-4"})})]})]}),((q=n.responses)==null?void 0:q.length)>0&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-3 rounded-md",children:[e.jsx("p",{className:"text-sm font-medium mb-1",children:"Your Response:"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:n.responses[0].responseText})]})]},n.id)})}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx(le,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-muted-foreground mb-2",children:r.length===0?"No Reviews Yet":"No Reviews Match Filter"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:r.length===0?"Connect review sources to start collecting customer feedback":"Try adjusting your filters to see more reviews"}),r.length===0&&e.jsx(x,{onClick:()=>{},children:"Connect Review Sources"})]})})]}),e.jsx($,{open:h,onOpenChange:a,children:e.jsxs(V,{children:[e.jsxs(H,{
11children:[e.jsx(K,{children:"Respond to Review"}),e.jsx(U,{children:"Craft a thoughtful response to this customer review"})]}),o&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-900 rounded-lg",children:[e.jsx("div",{className:"flex items-center gap-2 mb-2",children:[1,2,3,4,5].map(n=>e.jsx(k,{className:`h-4 w-4 ${n<=(o.rating||0)?"text-yellow-400 fill-current":"text-gray-300"}`},n))}),e.jsx("p",{className:"text-sm",children:o.reviewText}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["- ",o.reviewerName]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Your Response"}),e.jsx(Le,{placeholder:"Thank you for your feedback...",className:"min-h-[100px]","data-testid":"textarea-response"})]}),e.jsxs(b,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsxs(N,{children:[e.jsx("strong",{children:"Response Tips:"}),e.jsxs("ul",{className:"mt-1 text-sm space-y-1",children:[e.jsx("li",{children:"• Thank the customer for their feedback"}),e.jsx("li",{children:"• Address any specific concerns mentioned"}),e.jsx("li",{children:"• Keep it professional and friendly"}),e.jsx("li",{children:"• Invite them to contact you directly if needed"})]})]})]})]}),e.jsxs(se,{children:[e.jsx(x,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsx(x,{onClick:()=>{o&&t.mutate({reviewId:o.id,responseText:"Thank you for your feedback!",status:"published"})},disabled:t.isPending,"data-testid":"button-send-response",children:t.isPending?"Sending...":"Send Response"})]})]})})]})}function es({widgets:r,reviews:u,isLoading:g}){const[j,h]=w.useState(!1);w.useState(null);const[a,o]=w.useState("carousel"),{toast:v}=_(),f=Q(),i=ee({mutationFn:async s=>await te("/api/review-widgets",{method:"POST",body:JSON.stringify(s)}),onSuccess:()=>{v({title:"Widget Created",description:"Your review widget has been created successfully."}),f.invalidateQueries({queryKey:["/api/review-widgets"]}),h(!1)},onError:s=>{v({title:"Creation Failed",description:s.message||"Failed to create widget. Please try again.",variant:"destructive"})}});if(g)return e.jsx("div",{className:"flex justify-center p-8",children:"Loading review widgets..."});const t=[{id:"carousel",name:"Review Carousel",description:"Scrollable reviews with navigation",icon:e.jsx(Ke,{className:"h-5 w-5"}),preview:"Multiple reviews that customers can scroll through"},{id:"grid",name:"Review Grid",description:"Reviews displayed in a grid layout",icon:e.jsx(z,{className:"h-5 w-5"}),preview:"Grid of review cards showing multiple reviews at once"},{id:"single",name:"Single Review",description:"Display one featured review",icon:e.jsx(k,{className:"h-5 w-5"}),preview:"Highlight your best review prominently"},{id:"testimonial",name:"Testimonial Bar",description:"Horizontal testimonial strip",icon:e.jsx(Y,{className:"h-5 w-5"}),preview:"Slim horizontal bar perfect for headers or footers"}];return e.jsxs("div",{className:"space-y-6",children:[r.length===0&&e.jsxs(b,{children:[e.jsx(z,{className:"h-4 w-4"}),e.jsx(M,{children:"Create Your First Review Widget"}),e.jsx(N,{children:e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsx("p",{children:"Transform your reviews into beautiful widgets that build trust and drive conversions."}),e.jsxs("div",{className:"text-sm",children:[e.jsx("strong",{children:"Simple 3-step process:"}),e.jsxs("ol",{className:"list-decimal list-inside mt-1 space-y-1 ml-2",children:[e.jsx("li",{children:"Choose a widget style (carousel, grid, single, testimonial)"}),e.jsx("li",{children:"Customize colors, fonts, and layout to match your brand"}),e.jsx("li",{children:"Copy the code and embed on your website"})]})]})]})})]}),e.jsxs(c,{"data-testid":"card-widget-types",children:[e.jsx(d,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(z,{className:"h-5 w-5"}),"Review Widget Gallery"]}),e.jsx(y,{children:"Choose from professional widget designs that convert visitors into customers"})]}),e.jsxs(x,{onClick:()=>h(!0),"data-testid":"button-create-widget",children:[e.jsx(ge,{className:"h-4 w-4 mr-2"}),"Create Widget"]})]})}),e.jsx(p,{children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:t.map(s=>e.jsx("div",{className:"border rounded-lg p-6 hover:border-primary curs
11or-pointer transition-colors",onClick:()=>{o(s.id),h(!0)},"data-testid":`widget-type-${s.id}`,children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-primary/10 rounded-lg flex items-center justify-center text-primary",children:s.icon}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-medium mb-1",children:s.name}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:s.description}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900 p-3 rounded-md",children:e.jsx("p",{className:"text-xs text-muted-foreground",children:s.preview})})]})]})},s.id))})})]}),r.length>0&&e.jsxs(c,{"data-testid":"card-existing-widgets",children:[e.jsxs(d,{children:[e.jsx(m,{children:"Your Widgets"}),e.jsx(y,{children:"Manage your review widgets and get embed codes"})]}),e.jsx(p,{children:e.jsx("div",{className:"space-y-4",children:r.map(s=>e.jsxs("div",{className:"border rounded-lg p-4 space-y-3","data-testid":`widget-${s.id}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium",children:s.name}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.widgetType," • Created ",s.createdAt?be(new Date(s.createdAt),"MMM d, yyyy"):"Recently"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{variant:s.status==="published"?"default":"secondary",children:s.status}),e.jsx(x,{size:"sm",variant:"outline","data-testid":`button-edit-widget-${s.id}`,children:e.jsx($e,{className:"h-4 w-4"})}),e.jsx(x,{size:"sm",variant:"outline","data-testid":`button-copy-code-${s.id}`,children:e.jsx(Ne,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900 p-3 rounded-md",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-xs font-mono text-muted-foreground",children:`<script src="https://your-domain.com/widget/${s.id}"><\/script>`}),e.jsx(x,{size:"sm",variant:"ghost",onClick:()=>{navigator.clipboard.writeText(`<script src="https://your-domain.com/widget/${s.id}"><\/script>`),v({title:"Copied!",description:"Widget code copied to clipboard."})},children:e.jsx(Ve,{className:"h-4 w-4"})})]})})]},s.id))})})]}),e.jsx($,{open:j,onOpenChange:h,children:e.jsxs(V,{className:"max-w-2xl",children:[e.jsxs(H,{
11children:[e.jsx(K,{children:"Create Review Widget"}),e.jsx(U,{children:"Design a beautiful review widget for your website"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Widget Name"}),e.jsx(pe,{placeholder:"e.g., Homepage Reviews","data-testid":"input-widget-name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Widget Type"}),e.jsxs(C,{value:a,onValueChange:o,children:[e.jsx(S,{"data-testid":"select-widget-type",children:e.jsx(R,{})}),e.jsx(A,{children:t.map(s=>e.jsx(l,{value:s.id,children:s.name},s.id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Review Selection"}),e.jsxs(C,{defaultValue:"top_rated",children:[e.jsx(S,{"data-testid":"select-review-filter",children:e.jsx(R,{})}),e.jsxs(A,{children:[e.jsx(l,{value:"top_rated",children:"Top Rated (4-5 stars)"}),e.jsx(l,{value:"recent",children:"Most Recent"}),e.jsx(l,{value:"featured",children:"Featured Reviews"}),e.jsx(l,{value:"all",children:"All Reviews"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Max Reviews to Show"}),e.jsxs(C,{defaultValue:"5",children:[e.jsx(S,{"data-testid":"select-max-reviews",children:e.jsx(R,{})}),e.jsxs(A,{children:[e.jsx(l,{value:"3",children:"3 Reviews"}),e.jsx(l,{value:"5",children:"5 Reviews"}),e.jsx(l,{value:"10",children:"10 Reviews"}),e.jsx(l,{value:"20",children:"20 Reviews"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Theme"}),e.jsxs(C,{defaultValue:"light",children:[e.jsx(S,{"data-testid":"select-theme",children:e.jsx(R,{})}),e.jsxs(A,{children:[e.jsx(l,{value:"light",children:"Light Theme"}),e.jsx(l,{value:"dark",children:"Dark Theme"}),e.jsx(l,{value:"auto",children:"Auto (Match Website)"})]})]})]})]}),e.jsxs(b,{children:[e.jsx(qe,{className:"h-4 w-4"}),e.jsxs(N,{children:[e.jsx("strong",{children:"Live Preview:"})," Your widget will appear here with your selected settings. The actual widget will use your real reviews and match your website's styling."]})]})]}),e.jsxs(se,{children:[e.jsx(x,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),e.jsx(x,{onClick:()=>{i.mutate({name:`Review Widget - ${a}`,widgetType:a,displaySettings:{maxReviews:5,showRating:!0,showDate:!0,showPlatform:!0},styleSettings:{theme:"light",accentColor:"#3b82f6"},filterSettings:{minRating:4,platforms:[]},status:"published"})},disabled:i.isPending,"data-testid":"button-create-widget-confirm",children:i.isPending?"Creating...":"Create Widget"})]})]})})]})}function ss({marketingContent:r,reviews:u,isLoading:g}){const[j,h]=w.useState(!1),[a,o]=w.useState(""),{toast:v}=_(),f=Q(),i=ee({mutationFn:async s=>await te("/api/marketing-content",{method:"POST",body:JSON.stringify(s)}),onSuccess:()=>{v({title:"Automation Created",description:"Your review automation has been set up successfully."}),f.invalidateQueries({queryKey:["/api/marketing-content"]}),h(!1)},onError:s=>{v({title:"Setup Failed",description:s.message||"Failed to create automation. Please try again.",variant:"destructive"})}});if(g)return e.jsx("div",{className:"flex justify-center p-8",children:"Loading automations..."});const t=[{id:"social_posts",name:"Social Media Posts",description:"Auto-generate social posts from new positive reviews",icon:e.jsx(ye,{className:"h-5 w-5"}),benefit:"Save 5+ hours/week on social content creation"},{id:"email_campaigns",name:"Email Testimonials",description:"Include review snippets in your email campaigns",icon:e.jsx(Oe,{className:"h-5 w-5"}),benefit:"Increase email CTR by 15-25%"},{id:"website_content",name:"Website Content",description:"Generate landing page copy from customer reviews",icon:e.jsx(Be,{className:"h-5 w-5"}),benefit:"Boost conversion rates with social proof"},{id:"response_templates",name:"Smart Responses",description:"AI-powered response suggestions for reviews",icon:e.jsx(W,{className:"h-5 w-5"}),benefit:"Respond 3x faster with personalized messages"}];return e.jsxs("div",{className:"space-y-6",children:[r.length===0&&e.jsxs(b,{children:[e.jsx(W,{className:"h-4 w-4"}),e.jsx(M,{children:"AI-Powered Review Automations"}),e.jsx(N,{children:e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsx("p",{children:"Turn every positive review into marketing content automatically."}),e.jsxs("div",{className:"text-sm",children:[e.jsx("strong",{children:"What gets automated:"}),e.jsxs("ul",{className:"list-disc list-inside mt-1 space-y-1 ml-2",children:[e.jsx("li",{children:"Social media posts featuring customer testimonials"}),e.jsx("li",{children:"Email newsletter content with review highlights"}),e.jsx("li",{children:"Website copy powered by real customer feedback"}),e.jsx("li",{children:"Smart response suggestions for new reviews"})]})]})]})})]}),e.jsxs(c,{"data-testid":"card-automation-types",children:[e.jsx(d,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(W,{className:"h-5 w-5"}),"Review Automation Gallery"]}),e.jsx(y,{children:"Set up AI-powered automations to maximize the value of every review"})]}),e.jsxs(x,{onClick:()=>h(!0),"data-testid":"button-create-automation",children:[e.jsx(ge,{className:"h-4 w-4 mr-2"}),"Create Automation"]})]})}),e.jsx(p,{children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:t.map(s=>e.jsx("div",{className:"border rounded-lg p-6 hover:border-primary curs
11or-pointer transition-colors",onClick:()=>{o(s.id),h(!0)},"data-testid":`automation-type-${s.id}`,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-primary/10 rounded-lg flex items-center justify-center text-primary",children:s.icon}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-medium mb-1",children:s.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.description})]})]}),e.jsx("div",{className:"bg-green-50 dark:bg-green-950/20 p-3 rounded-md border border-green-200 dark:border-green-800",children:e.jsxs("p",{className:"text-sm text-green-800 dark:text-green-200 font-medium",children:["⚡ ",s.benefit]})})]})},s.id))})})]}),r.length>0&&e.jsxs(c,{"data-testid":"card-active-automations",children:[e.jsxs(d,{children:[e.jsx(m,{children:"Active Automations"}),e.jsx(y,{children:"Manage your review-powered marketing automations"})]}),e.jsx(p,{children:e.jsx("div",{className:"space-y-4",children:r.map(s=>e.jsxs("div",{className:"border rounded-lg p-4 space-y-3","data-testid":`automation-${s.id}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium",children:s.title||"Untitled Automation"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.contentType," • ",s.status]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{variant:s.aiGenerated?"default":"secondary",children:s.aiGenerated?"AI Generated":"Manual"}),e.jsx(x,{size:"sm",variant:"outline","data-testid":`button-edit-automation-${s.id}`,children:e.jsx(ue,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:e.jsx("p",{children:s.content||s.description||"No content available"})})]},s.id))})})]}),e.jsx($,{open:j,onOpenChange:h,children:e.jsxs(V,{children:[e.jsxs(H,{
11children:[e.jsx(K,{children:"Create Review Automation"}),e.jsx(U,{children:"Set up AI-powered content generation from your reviews"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Automation Type"}),e.jsxs(C,{value:a,onValueChange:o,children:[e.jsx(S,{"data-testid":"select-automation-type",children:e.jsx(R,{placeholder:"Choose automation type"})}),e.jsx(A,{children:t.map(s=>e.jsx(l,{value:s.id,children:s.name},s.id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Review Criteria"}),e.jsxs(C,{defaultValue:"4_plus",children:[e.jsx(S,{"data-testid":"select-review-criteria",children:e.jsx(R,{})}),e.jsxs(A,{children:[e.jsx(l,{value:"5_star",children:"5-Star Reviews Only"}),e.jsx(l,{value:"4_plus",children:"4+ Star Reviews"}),e.jsx(l,{value:"positive",children:"Positive Sentiment"}),e.jsx(l,{value:"all",children:"All Reviews"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Generation Frequency"}),e.jsxs(C,{defaultValue:"daily",children:[e.jsx(S,{"data-testid":"select-frequency",children:e.jsx(R,{})}),e.jsxs(A,{children:[e.jsx(l,{value:"immediate",children:"Immediately (New Reviews)"}),e.jsx(l,{value:"daily",children:"Daily Batch"}),e.jsx(l,{value:"weekly",children:"Weekly Summary"}),e.jsx(l,{value:"monthly",children:"Monthly Compilation"})]})]})]}),u.length===0&&e.jsxs(b,{children:[e.jsx(xe,{className:"h-4 w-4"}),e.jsx(N,{children:"You need to have reviews connected before setting up automations. Connect your review sources first in the Sources tab."})]})]}),e.jsxs(se,{children:[e.jsx(x,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),e.jsx(x,{onClick:()=>{i.mutate({title:`${a} Automation`,contentType:a,aiGenerated:!0,status:"active",content:`Automated ${a} content from reviews`})},disabled:i.isPending||u.length===0,"data-testid":"button-create-automation-confirm",children:i.isPending?"Creating...":"Create Automation"})]})]})})]})}function ts({analytics:r,reviews:u,widgets:g,marketingContent:j,isLoading:h}){if(h)return e.jsx("div",{className:"flex justify-center p-8",children:"Loading analytics..."});const a=(u==null?void 0:u.length)||0,o=a>0?(u.reduce((i,t)=>i+(t.rating||0),0)/a).toFixed(1):"0.0",v=[5,4,3,2,1].map(i=>({rating:i,count:(u==null?void 0:u.filter(t=>t.rating===i).length)||0})),f=(u==null?void 0:u.reduce((i,t)=>{const s=t.platform||"Unknown";return i[s]=(i[s]||0)+1,i},{}))||{};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsxs(c,{"data-testid":"analytics-total-reviews",children:[e.jsxs(d,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(m,{className:"text-sm font-medium",children:"Total Reviews"}),e.jsx(Y,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(p,{children:[e.jsx("div",{className:"text-2xl font-bold",children:a}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"All platforms"})]})]}),e.jsxs(c,{"data-testid":"analytics-avg-rating",children:[e.jsxs(d,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(m,{className:"text-sm font-medium",children:"Average Rating"}),e.jsx(k,{className:"h-4 w-4 text-yellow-500"})]}),e.jsxs(p,{children:[e.jsxs("div",{className:"text-2xl font-bold flex items-center gap-1",children:[o,e.jsx(k,{className:"h-5 w-5 text-yellow-500 fill-current"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Overall score"})]})]}),e.jsxs(c,{"data-testid":"analytics-widgets",children:[e.jsxs(d,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(m,{className:"text-sm font-medium",children:"Active Widgets"}),e.jsx(z,{className:"h-4 w-4 text-blue-500"})]}),e.jsxs(p,{children:[e.jsx("div",{className:"text-2xl font-bold",children:(g==null?void 0:g.length)||0}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Deployed widgets"})]})]}),e.jsxs(c,{"data-testid":"analytics-ai-content",children:[e.jsxs(d,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(m,{className:"text-sm font-medium",children:"AI Content"}),e.jsx(W,{className:"h-4 w-4 text-purple-500"})]}),e.jsxs(p,{children:[e.jsx("div",{className:"text-2xl font-bold",children:(j==null?void 0:j.length)||0}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Generated pieces"})]})]})]}),e.jsxs(c,{"data-testid":"card-rating-distribution",children:[e.jsxs(d,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(E,{className:"h-5 w-5"}),"Rating Distribution"]}),e.jsx(y,{children:"Breakdown of ratings across all reviews"})]}),e.jsx(p,{children:a>
110?e.jsx("div",{className:"space-y-3",children:v.map(i=>e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-1 w-16",children:[e.jsx("span",{className:"text-sm font-medium",children:i.rating}),e.jsx(k,{className:"h-4 w-4 text-yellow-400 fill-current"})]}),e.jsx("div",{className:"flex-1",children:e.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2",children:e.jsx("div",{className:"bg-yellow-400 h-2 rounded-full",style:{width:`${a>0?i.count/a*100:0}%`}})})}),e.jsx("span",{className:"text-sm text-muted-foreground w-12 text-right",children:i.count})]},i.rating))}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx(E,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"No rating data available"})]})})]}),e.jsxs(c,{"data-testid":"card-platform-breakdown",children:[e.jsxs(d,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"h-5 w-5"}),"Platform Breakdown"]}),e.jsx(y,{children:"Reviews by platform source"})]}),e.jsx(p,{children:Object.keys(f).length>0?e.jsx("div",{className:"space-y-3",children:Object.entries(f).map(([i,t])=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-3 h-3 bg-blue-500 rounded-full"}),e.jsx("span",{className:"font-medium capitalize",children:i})]}),e.jsx(F,{variant:"secondary",children:t})]},i))}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx(ce,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"No platform data available"})]})})]}),e.jsxs(c,{"data-testid":"card-performance-insights",children:[e.jsxs(d,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(re,{className:"h-5 w-5"}),"Performance Insights"]}),e.jsx(y,{children:"Key metrics and recommendations for growth"})]}),e.jsx(p,{children:e.jsx("div",{className:"space-y-4",children:a===0?e.jsxs(b,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsxs(N,{children:[e.jsx("strong",{children:"Get Started:"})," Connect your review sources to start seeing insights and analytics here. The more reviews you collect, the better insights you'll get."]})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"p-3 bg-blue-50 dark:bg-blue-950/20 rounded-lg border border-blue-200 dark:border-blue-800",children:e.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:[e.jsx("strong",{children:"Review Velocity:"})," You've collected ",a," reviews.",a<10&&" Try to get 10+ reviews for better credibility.",a>=10&&a<50&&" Great start! Aim for 50+ reviews to maximize trust.",a>=50&&" Excellent review volume - you're building strong social proof!"]})}),parseFloat(o)>=4&&e.jsx("div",{className:"p-3 bg-green-50 dark:bg-green-950/20 rounded-lg border border-green-200 dark:border-green-800",children:e.jsxs("p",{className:"text-sm text-green-800 dark:text-green-200",children:[e.jsx("strong",{children:"High Rating Alert:"})," Your ",o,"★ average is excellent! Consider featuring these reviews prominently on your website and social media."]})}),parseFloat(o)<3.5&&a>5&&e.jsx("div",{className:"p-3 bg-yellow-50 dark:bg-yellow-950/20 rounded-lg border border-yellow-200 dark:border-yellow-800",children:e.jsxs("p",{className:"text-sm text-yellow-800 dark:text-yellow-200",children:[e.jsx("strong",{children:"Improvement Opportunity:"})," Your ",o,"★ average suggests room for improvement. Focus on addressing customer concerns and improving service quality."]})})]})})})]}),e.jsx(Je,{isOpen:showGuide,onClose:()=>setShowGuide(!1)})]})}export{js 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.