PageSourceSearch

https://boombam.app/assets/CampaignLibrary-BTmIzBSZ.js

js boombam.app collected 2026-10-04 13:33:06 UTC 41,446 bytes, 2 lines download raw bytes

1import{r as c,_ as fe,j as e,bd as ee,af as Te,ag as De,B as h,bJ as _e,ah as Fe,bK as Xe,aj as ae,bL as Ye,ai as B,aC as Le,ar as Ze,C as z,e as R,aD as qe,E as Ae,au as he,s as $,bF as $e,U as ue,T as le,J as pe,bM as es,bN as ss,bO as Me,bP as Be,bQ as ts,bR as Oe,ak as Ne,al as we,am as ve,an as be,ao as ye,ab as I,aF as Ge,bS as Se,bT as as,D as rs,b9 as ls,bC as is,aK as Ke,bU as ns,F as os,ba as cs,bb as ds,bV as xs,bc as ms,aH as hs,bo as us,a5 as ps,N as gs,a as Pe,a6 as re,V as js,aE as fs,$ as ce,a0 as de,a1 as xe,a2 as me,a3 as v,b as Ns,d as ws,bq as Ie}from"./index-CuSEeJFb.js";import{u as vs,a as ze,s as bs,K as ys,P as Ss,D as Cs,c as ks,S as Es,h as Ts,d as Ds,C as Fs,f as Ls}from"./sortable.esm-CaaY9462.js";import{G as Je}from"./grip-vertical-DtmmqDbO.js";import{R as ie}from"./rocket-DokzAs0d.js";import{F as As}from"./filter-DIYm3mPi.js";import{P as Re}from"./pen-line-Ys7SVokk.js";import{f as Ue}from"./formatDistanceToNow-JmSQUCLK.js";import{E as $s}from"./ellipsis-vertical-04pZ3iRl.js";import{C as Qe}from"./copy-Ctw93tQ7.js";import{S as Ms}from"./share-2-BVJnd9fZ.js";import{a as Os,F as Ps}from"./folder-XQRCjIoi.js";import{C as ge}from"./circle-pause-Bz7TBe1x.js";import{C as je}from"./circle-play-DmeaGwsH.js";import{F as Is}from"./folder-open-nDEnLPQX.js";import{C as zs}from"./chevrons-up-down-BZ7u-cRr.js";import{R as We,a as te}from"./radio-group-Cg3Pu9OU.js";import{R as Rs}from"./rotate-ccw-Tvprt-zs.js";import{F as Us}from"./feature-gate-CFYwT4eA.js";import{L as Ws}from"./list-CcOCoqUW.js";import{L as Ve}from"./layout-grid-23B-LoFc.js";import"./constructNow-CAQUuh76.js";import"./en-US-BOoww7nS.js";import"./differenceInCalendarMonths-CdYt3YUn.js";import"./endOfDay-CTvcx9iE.js";import"./endOfMonth-DMtDxPW7.js";const Z=[{id:"status",label:"Status",visible:!0,width:120,minWidth:100},{id:"name",label:"Campaign Name",visible:!0,width:200,minWidth:150},{id:"type",label:"Type",visible:!0,width:120,minWidth:100},{id:"workflow",label:"Workflow",visible:!0,width:150,minWidth:120},{id:"avatar",label:"Target Avatar",visible:!0,width:150,minWidth:120},{id:"offer",label:"Offer",visible:!0,width:150,minWidth:120},{id:"budget",label:"Budget",visible:!1,width:120,minWidth:100},{id:"performance",label:"Performance",visible:!0,width:140,minWidth:120},{id:"tags",label:"Tags",visible:!1,width:120,minWidth:100},{id:"folder",label:"Folder",visible:!0,width:120,minWidth:100},{id:"created",label:"Date Created",visible:!0,width:150,minWidth:120},{id:"actions",label:"Actions",visible:!0,width:120,minWidth:100}];function Vs({column:b,isSelected:k,sortColumn:u,sortDirection:y,onSort:r,onResize:U}){const{attributes:M,listeners:K,setNodeRef:E,transform:G,transition:F,isDragging:J}=Ds({id:b.id}),[P,W]=c.useState(!1),N={transform:Fs.Transform.toString(G),transition:P?"none":F,opacity:J?.5:1,width:`${b.width}px`,minWidth:`${b.minWidth||80}px`,position:"relative"},O=u===b.id,p=b.id!=="actions"&&r,T=()=>p?O?y==="asc"?e.jsx(is,{className:"h-3 w-3 text-orange-500"}):e.jsx(Ke,{className:"h-3 w-3 text-orange-500"}):e.jsx(zs,{className:"h-3 w-3 text-gray-400"}):null,S=()=>{p&&!P&&r(b.id)},n=V=>{V.preventDefault(),V.stopPropagation(),W(!0);const i=V.clientX,o=b.width||150,w=x=>{const C=x.clientX-i,L=Math.max(b.minWidth||80,o+C);U&&U(b.id,L)},g=()=>{W(!1),document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",g)};document.addEventListener("mousemove",w),document.addEventListener("mouseup",g)};return e.jsx(Be,{ref:E,style:N,className:`${J?"bg-gray-100":""} ${k?"ring-2 ring-orange-200":""} px-2`,...M,children:e.jsxs("div",{className:"flex items-center justify-between h-full",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[e.jsx("div",{className:"cursor-grab active:cursor-grabbing flex items-center gap-2 hover:text-orange-600",...K,children:e.jsx(Je,{className:"h-4 w-4 text-gray-400"})}),e.jsxs("div",{className:`flex items-center gap-1 flex-1 ${p?"cursor-pointer hover:text-orange-600":""} ${O?"text-orange-600 font-medium":""}`,onClick:S,children:[e.jsx("span",{className:"truncate",children:b.label}),T()]})]}),e.jsx("div",{onMouseDown:n,className:"absolute right-0 top-0 h-full w-1 cursor-col-resize hover:bg-orange-400 bg-transparent group",children:e.jsx("div",{className:"absolute right-0 top-0 h-full w-3 -translate-x-1/2"})})]})})}function _s({campaigns:b,loading:k,onViewCampaign:u,onEditCampaign:y,onDeleteCampaign:r,onDuplicateCampaign:U,onExportCampaign:M,onShareCampaign:K,onCreateCampaign:E,sortColumn:G="created",sortDirection:F="desc",onSort:J,onUpdateTags:P,onUpdateStatus:W}){const[N,O]=c.useState(new Set),[p,T]=c.useState(Z),[S,n]=c.useState(Z.map(s=>s.id)),[V,i]=c.useState(!1),[o,w]=c.useState(null),[g,x]=c.useState(""),{toast:C}=fe();c.useEffect(()=>{const s=localStorage.getItem("campaignTableColumns"),a=localStorage.getItem("campaignTableColumnOrder");if(s)try{T(JSON.parse(s))}catch{T(Z)}if(a)try{n(JSON.parse(a))}catch{n(Z.map(l=>l.id))}},[]);const L=(s,a)=>{localStorage.setItem("campaignTableColumns",JSON.stringify(s)),a&&localStorage.setItem("campaignTableColumnOrder",JSON.stringify(a))},m=s=>{const a=p.map(l=>l.id===s?{...l,visible:!l.visible}:l);T(a),L(a)},D=()=>{T(Z),n(Z.map(s=>s.id)),localStorage.removeItem("campaignTableColumns"),localStorage.removeItem("campaignTableColumnOrder")},H=(s,a)=>{const l=p.map(d=>d.id===s?{...d,width:a}:d);T(l),L(l)},_=vs(ze(Ss),ze(ys,{coordinateGetter:bs})),ne=s=>{const{active:a,over:l}=s;if(l&&a.id!==l.id){const d=S.indexOf(a.id),j=S.indexOf(l.id),Q=Ls(S,d,j);n(Q),L(p,Q)}},se=S.map(s=>p.find(a=>a.id===s)).filter(s=>!!s&&s.visible),oe=(s,a)=>{var l,d;switch(a){case"status":return ke(s.deploymentStatus);case"name":return e.jsxs("div",{className:"font-medium text-gray-900",children:[s.name,s.description&&e.jsx("p",{className:"text-xs text-gray-500 mt-1 line-clamp-1",children:s.description})]});case"type":return e.jsx($,{variant:"outline",className:"capitalize",children:((l=s.type)==null?void 0:l.replace("_"," "))||"awareness"});case"workflow":return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($e,{className:"h-4 w-4 text-gray-400"}),e.jsx("span",{className:"text-sm",children:s.workflowName||"No workflow"})]});case"avatar":return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ue,{className:"h-4 w-4 text-blue-500"}),e.jsx("span",{className:"text-sm",children:s.avatarName||"No avatar"})]});case"offer":return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{className:"text-sm",children:s.offerName||"No offer"})]});case"budget":return e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ls,{className:"h-4 w-4 text-gray-400"}),e.jsx("span",{className:"text-sm font-medium",children:s.budget?`$${s.budget.toLocaleStr
1ing()}`:"-"})]});case"performance":return e.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[s.totalSteps&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-16 h-2 bg-gray-200 rounded-full",children:e.jsx("div",{className:"h-2 bg-green-500 rounded-full",style:{width:`${(s.completedSteps||0)/s.totalSteps*100}%`}})}),e.jsxs("span",{className:"text-gray-600",children:[s.completedSteps||0,"/",s.totalSteps]})]}),((d=s.metrics)==null?void 0:d.roi)&&e.jsxs($,{variant:"outline",className:"text-xs",children:["ROI: ",s.metrics.roi,"%"]})]});case"tags":return e.jsxs("div",{className:"flex flex-wrap gap-1",children:[(s.tags||[]).length>0?s.tags.slice(0,2).map((j,Q)=>e.jsx($,{variant:"outline",className:"text-xs",children:j},Q)):e.jsx("span",{className:"text-xs text-gray-400",children:"No tags"}),(s.tags||[]).length>2&&e.jsxs($,{variant:"outline",className:"text-xs bg-gray-100",children:["+",s.tags.length-2]})]});case"folder":return Ee(s);case"created":return e.jsx("div",{className:"text-sm text-gray-600",children:Ue(new Date(s.createdAt),{addSuffix:!0})});case"actions":return e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(h,{size:"sm",variant:"ghost",onClick:()=>u(s),className:"h-8 w-8 p-0",title:"View campaign",children:e.jsx(Ae,{className:"h-4 w-4"})}),e.jsxs(Te,{children:[e.jsx(De,{asChild:!0,children:e.jsx(h,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0",title:"More actions",children:e.jsx($s,{className:"h-4 w-4"})})}),e.jsxs(Fe,{align:"end",className:"w-48",children:[e.jsxs(B,{onClick:()=>y(s),children:[e.jsx(Re,{className:"h-4 w-4 mr-2"}),"Edit Campaign"]}),U&&e.jsxs(B,{onClick:()=>U(s),children:[e.jsx(Qe,{className:"h-4 w-4 mr-2"}),"Duplicate"]}),M&&e.jsxs(B,{onClick:()=>M(s),children:[e.jsx(Se,{className:"h-4 w-4 mr-2"}),"Export"]}),K&&e.jsxs(B,{onClick:()=>K(s),children:[e.jsx(Ms,{className:"h-4 w-4 mr-2"}),"Share"]}),e.jsxs(B,{onClick:()=>f(s),children:[e.jsx(as,{className:"h-4 w-4 mr-2"}),"Add Tags"]}),e.jsxs(B,{children:[e.jsx(Os,{className:"h-4 w-4 mr-2"}),"Move to Folder"]}),e.jsxs(B,{children:[e.jsx(rs,{className:"h-4 w-4 mr-2"}),"Add to Favorites"]}),W&&s.systemStatus!=="completed"&&e.jsxs(e.Fragment,{children:[e.jsx(ae,{}),e.jsx(B,{onClick:()=>W(s.id,s.systemStatus==="active"?"paused":"active"),children:s.systemStatus==="active"?e.jsxs(e.Fragment,{children:[e.jsx(ge,{className:"h-4 w-4 mr-2"}),"Pause Campaign"]}):e.jsxs(e.Fragment,{children:[e.jsx(je,{className:"h-4 w-4 mr-2"}),"Resume Campaign"]})})]}),e.jsx(ae,{}),e.jsxs(B,{onClick:()=>r(s),className:"text-red-600 focus:text-red-600",children:[e.jsx(he,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]});default:return null}},A=(s=>G?[...s].sort((a,l)=>{let d,j;switch(G){case"name":d=a.name||"",j=l.name||"";break;case"type":d=a.type||"",j=l.type||"";break;case"workflow":d=a.workflowName||"",j=l.workflowName||"";break;case"avatar":d=a.avatarName||"",j=l.avatarName||"";break;case"offer":d=a.offerName||"",j=l.offerName||"";break;case"budget":d=a.budget||0,j=l.budget||0;break;case"performance":d=a.completedSteps&&a.totalSteps?a.completedSteps/a.totalSteps:0,j=l.completedSteps&&l.totalSteps?l.completedSteps/l.totalSteps:0;break;case"tags":d=(a.tags||[]).length,j=(l.tags||[]).length;break;case"folder":d=a.folderName||"",j=l.folderName||"";break;case"created":d=new Date(a.createdAt).getTime(),j=new Date(l.createdAt).getTime();break;case"status":d=a.systemStatus||"active",j=l.systemStatus||"active";break;default:return 0}if(typeof d=="string"&&typeof j=="string"){const Q=d.localeCompare(j);return F==="asc"?Q:-Q}return typeof d=="number"&&typeof j=="number"?F==="asc"?d-j:j-d:0}):s)(b),X=(s,a)=>{const l=new Set(N);a?l.add(s):l.delete(s),O(l)},q=s=>{if(s){const a=new Set(A.map(l=>l.id));O(a)}else O(new Set)},t=()=>{O(new Set)},f=s=>{w(s),x((s.tags||[]).join(", ")),i(!0)},Y=()=>{if(!o||!P)return;const s=g.split(",").map(a=>a.trim()).filter(a=>a.length>0);P(o.id,s),i(!1),w(null),x(""),C({title:"Tags Updated",description:`Updated tags for "${o.name}"`})},He=s=>{switch(s){case"active":return e.jsxs($,{className:"bg-green-500 hover:bg-green-600 text-white text-xs",children:[e.jsx(je,{className:"h-3 w-3 mr-1"}),"Active"]});case"paused":return e.jsxs($,{className:"bg-yellow-500 hover:bg-yellow-600 text-white text-xs",children:[e.jsx(ge,{className:"h-3 w-3 mr-1"}),"Paused"]});case"scheduled":return e.jsxs($,{className:"bg-blue-500 hover:bg-blue-600 text-white text-xs",children:[e.jsx(pe,{className:"h-3 w-3 mr-1"}),"Scheduled"]});case"completed":return e.jsxs($,{className:"bg-gray-500 hover:bg-gray-600 text-white text-xs",children:[e.jsx(Le,{className:"h-3 w-3 mr-1"}),"Completed"]});default:return e.jsx($,{variant:"secondary",children:"Unknown"})}},ke=s=>{switch(s){case"published":return e.jsxs($,{variant:"outline",className:"text-xs text-green-600 border-green-600",children:[e.jsx(ie,{className:"h-3 w-3 mr-1"}),"Published"]});case"in_review":return e.jsx($,{variant:"outline",className:"text-xs text-orange-600 border-orange-600",children:"In Review"});case"draft":default:return e.jsx($,{variant:"outline",className:"text-xs",children:"Draft"})}},Ee=s=>!s.folderId||!s.folderName?e.jsxs("div",{className:"flex items-center gap-1 text-gray-400",children:[e.jsx(Ps,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs",children:"No folder"})]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Is,{className:"h-4 w-4",style:{color:s.folderColor||"#6366f1"}}),e.jsx("span",{className:"text-sm font-medium",children:s.folderName})]});return k?e.jsx("div",{className:"flex items-center justify-center p-12",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-orange-500 mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Loading c
1ampaigns..."})]})}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[A.length>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ee,{id:"select-all",checked:N.size===A.length&&A.length>0,onCheckedChange:q,className:"h-4 w-4 shrink-0"}),e.jsx("label",{htmlFor:"select-all",className:"text-sm cursor-pointer",children:"Select All"})]}),A.length>0&&e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:e.jsxs("span",{className:"font-medium",children:[A.length," campaigns"]})}),e.jsx("div",{className:"text-xs text-gray-500 hidden md:block",children:"Drag column headers to reorder"})]}),e.jsxs(Te,{children:[e.jsx(De,{asChild:!0,children:e.jsxs(h,{variant:"outline",size:"sm",className:"flex items-center gap-2",children:[e.jsx(_e,{className:"h-4 w-4"}),"Columns"]})}),e.jsxs(Fe,{align:"end",className:"w-64",children:[e.jsx(Xe,{children:"Table Columns"}),e.jsx(ae,{}),e.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:p.map(s=>e.jsx(Ye,{checked:s.visible,onCheckedChange:()=>m(s.id),disabled:s.id==="name",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Je,{className:"h-3 w-3 text-gray-400"}),s.label]})},s.id))}),e.jsx(ae,{}),e.jsx(B,{onClick:D,children:"Reset to Default"})]})]})]}),N.size>0&&e.jsx("div",{className:"bg-orange-50 border border-orange-200 rounded-lg p-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Le,{className:"h-5 w-5 text-orange-600"}),e.jsxs("span",{className:"text-sm font-medium text-orange-900",children:[N.size," campaign",N.size>1?"s":""," selected"]})]}),e.jsx("div",{className:"flex gap-2",children:e.jsxs(h,{variant:"ghost",size:"sm",onClick:t,className:"flex items-center gap-2 text-gray-600 hover:text-gray-800",children:[e.jsx(Ze,{className:"h-4 w-4"}),"Clear"]})})]})}),e.jsx(z,{children:e.jsx(R,{className:"p-0",children:A.length===0?e.jsx("div",{className:"text-center py-12 sm:py-16",children:b.length===0?e.jsxs("div",{children:[e.jsx(ie,{className:"h-12 w-12 sm:h-16 sm:w-16 text-gray-300 mx-auto mb-4"}),e.jsx("h3",{className:"text-base sm:text-lg font-medium text-gray-700 mb-2",children:"No campaigns yet"}),e.jsx("p",{className:"text-sm sm:text-base text-gray-500 mb-4 sm:mb-6",children:"Create your first campaign to get started"}),e.jsxs(h,{className:"bg-orange-500 hover:bg-orange-600 w-full sm:w-auto",onClick:E,children:[e.jsx(qe,{className:"h-4 w-4 mr-2"}),"Create First Campaign"]})]}):e.jsxs("div",{children:[e.jsx(As,{className:"h-10 w-10 sm:h-12 sm:w-12 text-gray-300 mx-auto mb-4"}),e.jsx("h3",{className:"text-base sm:text-lg font-medium text-gray-700 mb-2",children:"No matching campaigns"}),e.jsx("p",{className:"text-sm sm:text-base text-gray-500",children:"Try adjusting your search or filters"})]})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"block lg:hidden space-y-3 p-3",children:A.map(s=>{var a;return e.jsx(z,{className:`hover:shadow-md transition-shadow ${N.has(s.id)?"ring-2 ring-orange-200 bg-orange-50":""}`,children:e.jsx(R,{className:"p-4",children:e.jsxs("div",{className:"flex flex-col space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(ee,{checked:N.has(s.id),onCheckedChange:l=>X(s.id,l),className:"h-4 w-4 shrink-0"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(h,{size:"sm",variant:"ghost",onClick:()=>u(s),className:"h-8 w-8 p-0",children:e.jsx(Ae,{className:"h-3 w-3"})}),e.jsx(h,{size:"sm",variant:"ghost",onClick:()=>y(s),className:"h-8 w-8 p-0",children:e.jsx(Re,{className:"h-3 w-3"})}),e.jsx(h,{size:"sm",variant:"ghost",onClick:()=>r(s),className:"h-8 w-8 p-0 text-red-500 hover:text-red-700",children:e.jsx(he,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"font-medium text-gray-900 text-sm leading-tight break-words",children:s.name||"Untitled Campaign"}),e.jsx("div",{className:"text-xs text-gray-500 line-clamp-2",children:s.description||"No description available"})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[He(s.systemStatus),ke(s.deploymentStatus),e.jsx($,{variant:"outline",className:"text-xs capitalize",children:((a=s.type)==null?void 0:a.replace("_"," "))||"awareness"})]}),e.jsxs("div",{className:"flex flex-col gap-2 text-xs",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-3",children:[s.workflowName&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx($e,{className:"h-3 w-3 text-gray-400"}),e.jsx("span",{children:s.workflowName})]}),s.avatarName&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ue,{className:"h-3 w-3 text-blue-500"}),e.jsx("span",{children:s.avatarName})]}),s.offerName&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(le,{className:"h-3 w-3 text-green-500"}),e.jsx("span",{children:s.offerName})]})]})}),s.totalSteps&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 h-2 bg-gray-200 rounded-full",children:e.jsx("div",{className:"h-2 bg-green-500 rounded-full",style:{width:`${(s.completedSteps||0)/s.totalSteps*100}%`}})}),e.jsxs("span",{className:"text-gray-600",children:[s.completedSteps||0,"/",s.totalSteps]})]}),e.jsxs("div",{className:"flex items-center justify-between text-gray-500",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(pe,{className:"h-3 w-3"}),e.jsxs("span",{children:[Ue(new Date(s.createdAt))," ago"]})]}),Ee(s)]})]})]})})},s.id)})}),e.jsx("div",{className:"hidden lg:block overflow-x-auto",children:e.jsx(Cs,{sensors:_,collisionDetection:ks,onDragEnd:ne,children:e.jsxs(es,{children:[e.jsx(ss,{children:e.jsxs(Me,{children:[e.jsx(Be,{className:"w-12",children:e.jsx(ee,{checked:N.size===A.length&&A.length>0,onCheckedChange:q,className:"h-4 w-4"})}),e.jsx(Es,{items:se.map(s=>s.id),strategy:Ts,children:se.map(s=>e.jsx(Vs,{column:s,isSelected:!1,sortColumn:G,sortDirection:F,onSort:J,onResize:H},s.id))})]})}),e.jsx(ts,{children:A.map(s=>e.jsxs(Me,{className:`hover:bg-gray-50 ${N.has(s.id)?"bg-orange-50":""}`,children:[e.jsx(Oe,{className:"w-12",children:e.jsx(ee,{checked:N.has(s.id),onCheckedChange:a=>X(s.id,a),className:"h-4 w-4"})}),se.map(a=>e.jsx(Oe,{style:{width:`${a.width}px`,minWidth:`${a.minWidth||80}px`},className:"px-2",children:oe(s,a.id)},a.id))]},s.id))})]})})})]})})}),e.jsx(Ne,{open:V,onOpenChange:i,children:e.jsxs(we,{children:[e.jsxs(ve,{children:[e.jsx(be,{children:"Edit Campaign Tags"}),e.jsxs(ye,{children:['Add or edit tags for "',o==null?void 0:o.name,'". Separate multiple tags with commas.']})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(I,{htmlFor:"tags",children:"Tags"}),e.jsx(Ge,{id:"tags",value:g,onChange:s=>x(s.target.value),placeholder:"e.g., seasonal, email, high-priority"})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(h,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(h,{onClick:Y,children:"Save Tags"})]})]})]})})]})}function qs({open:b,onOpenChange:k,campaignId:u,campaignName:y}){const[r,U]=c.useState("docx"),[M,K]=c.useState("full"),[E,G]=c.useState(!0),[F,J]=c.useState(!0),[P,W]=c.useState(!1),[N,O]=c.useState(!1),[p,T]=c.useState([]),{toast:S}=fe(),n=(i,o)=>{const g=`[${new Date().toLocaleTimeString()}] ${i}`;console.log(g,o||""),T(x=>[...x,o?`${g}: ${JSON.stringify(o,null,2)}`:g])},V=async()=>{W(!0),T([]);try{if(r==="google-docs"){n("🚀 Google Docs export started",{campaignId:u,exp
1ortFormat:r});const g=await fetch(`/api/campaigns/${u}/export/google-docs`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"});if(!g.ok){const C=await g.json();throw new Error(C.details||C.error||"Failed to create Google Doc")}const x=await g.json();n("✅ Google Doc created",x),window.open(x.url,"_blank"),S({title:"Google Doc Created!",description:`"${x.title}" is now available in Google Docs`}),k(!1);return}n("🚀 Export started",{campaignId:u,exportFormat:r,scope:M,includeImages:E,includeVariants:F,userAgent:navigator.userAgent,isMobile:/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),clipboardSupported:!!navigator.clipboard,cookiesEnabled:navigator.cookieEnabled});const i={format:r==="docx"?"doc":r,scope:M,includeImages:E,includeVariants:F};n("📤 Sending request to server",{url:`/api/campaigns/${u}/export`,method:"POST",body:i});const o=await fetch(`/api/campaigns/${u}/export`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(i)});if(n("📥 Server response received",{status:o.status,statusText:o.statusText,headers:Object.fromEntries(o.headers.entries()),ok:o.ok}),!o.ok){const g=await o.text();let x;try{x=JSON.parse(g)}catch{x={error:g}}throw n("❌ Server error response",{status:o.status,error:x}),new Error(x.error||`Server error: ${o.status} ${o.statusText}`)}const w=await o.json();if(n("✅ Export data received",w),w.downloadUrl){const g={doc:"docx"},x=r==="docx"?"doc":r,C=`${y.replace(/[^a-z0-9]/gi,"_")}_export.${g[x]||"docx"}`,L=/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);if(n("📱 Device detection",{isMobile:L,userAgent:navigator.userAgent}),L){n("📱 Mobile download: Opening in new window",{url:w.downloadUrl});try{if(!window.open(w.downloadUrl,"_blank")){n("⚠️ Popup blocked - trying alternative method");const D=document.createElement("a");D.href=w.downloadUrl,D.target="_blank",D.rel="noopener noreferrer",document.body.appendChild(D),D.click(),document.body.removeChild(D)}}catch(m){throw n("❌ Mobile download error",m),m}}else{n("💻 Desktop download: Attempting programmatic download");try{n("📥 Fetching file from download URL",{url:w.downloadUrl});const m=await fetch(w.downloadUrl);if(n("📥 Download response",{status:m.status,statusText:m.statusText,headers:Object.fromEntries(m.headers.entries())}),!m.ok)throw new Error(`Download failed: ${m.status} ${m.statusText}`);n("🔄 Converting to blob");const D=await m.blob();n("✅ Blob created",{size:D.size,type:D.type});const H=window.URL.createObjectURL(D),_=document.createElement("a");_.href=H,_.download=C,_.style.display="none",n("🔗 Creating download link",{filename:C,url:H.substring(0,100)+"..."}),document.body.appendChild(_),_.click(),n("✅ Download link clicked"),window.URL.revokeObjectURL(H),document.body.removeChild(_)}catch(m){n("❌ Programmatic download failed, trying fallback",m),window.open(w.downloadUrl,"_blank"),n("🔄 Opened in new window as fallback")}}n("🎉 Export completed successfully"),S({title:"Export Successful",description:`Campaign exported as ${r==="docx"?"Word Document":"Document"}`}),k(!1)}else throw n("❌ No download URL in response",w),new Error("No download URL received")}catch(i){n("💥 Export failed with error",{error:i instanceof Error?i.message:String(i),stack:i instanceof Error?i.stack:void 0,name:i instanceof Error?i.name:void 0}),console.error("Export error:",i),S({title:"Export Failed",description:i instanceof Error?i.message:"Failed to export campaign. Please try again.",variant:"destructive"})}finally{n("🏁 Export process completed"),W(!1)}};return e.jsx(Ne,{open:b,onOpenChange:k,children:e.jsxs(we,{className:"sm:max-w-[500px]",children:[e.jsxs(ve,{children:[e.jsx(be,{children:"Export Campaign"}),e.jsxs(ye,{children:['Export "',y,'" in your preferred format']})]}),e.jsxs("div",{className:"space-y-6 pt-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(I,{children:"Export Format"}),e.jsxs(We,{value:r,onValueChange:i=>U(i),children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(te,{value:"google-docs",id:"google-docs"}),e.jsxs(I,{htmlFor:"google-docs",className:"flex items-center gap-2 cursor-pointer",children:[e.jsx(ns,{className:"h-4 w-4 text-blue-600"}),"Google Docs"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(te,{value:"docx",id:"docx"}),e.jsxs(I,{htmlFor:"docx",className:"flex items-center gap-2 cursor-pointer",children:[e.jsx(os,{className:"h-4 w-4 text-blue-500"}),"Word Document"]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(I,{children:"Export Scope"}),e.jsxs(We,{value:M,onValueChange:i=>K(i),children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(te,{value:"full",id:"full"}),e.jsx(I,{htmlFor:"full",className:"cursor-pointer",children:"Full Campaign (All Details)"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(te,{value:"steps",id:"steps"}),e.jsx(I,{htmlFor:"steps",className:"cursor-pointer",children:"Campaign Steps Only"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(te,{value:"summary",id:"summary"}),e.jsx(I,{htmlFor:"summary",className:"cursor-pointer",children:"Executive Summary"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(I,{children:"Options"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ee,{id:"includeImages",checked:E,onCheckedChange:i=>G(i)}),e.jsx(I,{htmlFor:"includeImages",className:"cursor-pointer",children:"Include Images"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ee,{id:"includeVariants",checked:F,onCheckedChange:i=>J(i)}),e.jsx(I,{htmlFor:"includeVariants",className:"cursor-pointer",children:"Include A/B Variants"})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(h,{variant:"outline",onClick:()=>k(!1),children:"Cancel"}),e.jsx(h,{onClick:V,disabled:P,className:"bg-orange-500 hover:bg-orange-600",children:P?e.jsx(e.Fragment,{children:"Exporting..."}):e.jsxs(e.Fragment,{children:[e.jsx(Se,{className:"h-4 w-4 mr-2"}),"Export"]})})]}),e.jsx("div",{className:"border-t border-orange-200 pt-4 mt-4",children:e.jsxs(cs,{open:N,onOpenChange:O,children:[e.jsx(ds,{asChild:!0,children:e.jsxs(h,{variant:"outline",size:"sm",className:"w-full justify-between border-orange-300 hover:bg-orange-50 text-orange-700",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xs,{className:"h-4 w-4 text-orange-600"}),"🔧 Debug Export Issues ",p.length>0&&`(${p.length} logs)`]}),e.jsx(Ke,{className:"h-4 w-4"})]})}
1),e.jsxs(ms,{className:"space-y-2",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"Watch real-time export process logs to troubleshoot issues"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(h,{variant:"outline",size:"sm",onClick:()=>T([]),className:"text-xs",children:[e.jsx(Rs,{className:"h-3 w-3 mr-1"}),"Clear Logs"]}),e.jsxs(h,{variant:"outline",size:"sm",onClick:()=>{const i=p.join(`
2`);navigator.clipboard.writeText(i).catch(()=>{console.log("Copy failed")}),S({title:"Logs Copied",description:"Debug logs copied to clipboard"})},className:"text-xs",children:[e.jsx(Qe,{className:"h-3 w-3 mr-1"}),"Copy Logs"]})]}),p.length>0&&e.jsx(hs,{className:"h-32 w-full border rounded p-2 bg-slate-50 dark:bg-slate-900",children:e.jsx("div",{className:"space-y-1",children:p.map((i,o)=>e.jsx("div",{className:"text-xs font-mono whitespace-pre-wrap text-slate-700 dark:text-slate-300",children:i},o))})}),p.length===0&&N&&e.jsx("div",{className:"text-xs text-muted-foreground text-center py-4 border rounded bg-slate-50 dark:bg-slate-900",children:"No debug logs yet. Click Export to see detailed logs."})]})]})})]})]})})}function gt(){const[b,k]=us(),{toast:u}=fe(),y=ps(),{activeCompanyId:r,isHydrated:U}=gs(),[M,K]=c.useState(""),[E,G]=c.useState("all"),[F,J]=c.useState("all"),[P,W]=c.useState("created"),[N,O]=c.useState("desc"),[p,T]=c.useState("table"),[S,n]=c.useState(null),[V,i]=c.useState(!1),[o,w]=c.useState(null),[g,x]=c.useState(!1),[C,L]=c.useState(null);c.useEffect(()=>{r&&(console.log("🔄 CAMPAIGN LIBRARY: Company changed to",r,"- clearing cache and refetching"),y.invalidateQueries({queryKey:["/api/campaigns"]}),y.invalidateQueries({queryKey:["/api/folders"]}))},[r,y]);const{data:m=[],isLoading:D,refetch:H}=Pe({queryKey:["/api/campaigns",{companyId:r,status:E,folderId:o}],enabled:U&&!!r,queryFn:async()=>{const t=new URLSearchParams;r&&t.append("companyId",r.toString()),E!=="all"&&t.append("status",E),o&&t.append("folderId",o.toString());const f=await fetch(`/api/campaigns?${t}`);if(!f.ok)throw new Error("Failed to fetch campaigns");return f.json()}}),{data:_=[]}=Pe({queryKey:["/api/folders",{type:"campaign",companyId:r}],enabled:U&&!!r,queryFn:async()=>{const t=await fetch("/api/folders?type=campaign",{headers:{"X-Company-Id":(r==null?void 0:r.toString())||""}});return t.ok?t.json():[]}}),ne=re({mutationFn:async t=>{if(!(await fetch(`/api/campaigns/${t}`,{method:"DELETE",headers:{"X-Company-Id":(r==null?void 0:r.toString())||""}})).ok)throw new Error("Failed to delete campaign")},onSuccess:()=>{Ie("delete_campaign","content_management","campaign_library"),y.invalidateQueries({queryKey:["/api/campaigns"]}),u({title:"Success",description:"Campaign deleted successfully"})},onError:()=>{u({title:"Error",description:"Failed to delete campaign",variant:"destructive"})}}),se=re({mutationFn:async t=>{const f=await fetch(`/api/campaigns/${t}/duplicate`,{method:"POST",headers:{"X-Company-Id":(r==null?void 0:r.toString())||""}});if(!f.ok)throw new Error("Failed to duplicate campaign");return f.json()},onSuccess:()=>{Ie("duplicate_campaign","content_management","campaign_library"),y.invalidateQueries({queryKey:["/api/campaigns"]}),u({title:"Success",description:"Campaign duplicated successfully"})},onError:()=>{u({title:"Error",description:"Failed to duplicate campaign",variant:"destructive"})}}),oe=re({mutationFn:async({campaignId:t,status:f})=>{if(!(await fetch(`/api/campaigns/${t}/status`,{method:"PATCH",headers:{"Content-Type":"application/json","X-Company-Id":(r==null?void 0:r.toString())||""},body:JSON.stringify({status:f})})).ok)throw new Error("Failed to update campaign status")},onSuccess:()=>{u({title:"Success",description:"Campaign status updated"}),y.invalidateQueries({queryKey:["/api/campaigns",{companyId:r}]})},onError:()=>{u({title:"Error",description:"Failed to update campaign status",variant:"destructive"})}}),Ce=re({mutationFn:async({campaignId:t,tags:f})=>{if(!(await fetch(`/api/campaigns/${t}/tags`,{method:"PATCH",headers:{"Content-Type":"application/json","X-Company-Id":(r==null?void 0:r.toString())||""},body:JSON.stringify({tags:f})})).ok)throw new Error("Failed to update tags")},onSuccess:()=>{u({title:"Success",description:"Tags updated successfully"}),y.invalidateQueries({queryKey:["/api/campaigns",{companyId:r}]})},onError:()=>{u({title:"Error",description:"Failed to update tags",variant:"destructive"})}}),A=t=>{P===t?O(N==="asc"?"desc":"asc"):(W(t),O("asc"))},X=m.filter(t=>{var f;if(M){const Y=M.toLowerCase();if(!t.name.toLowerCase().includes(Y)&&!((f=t.description)!=null&&f.toLowerCase().includes(Y)))return!1}return!(E!=="all"&&t.systemStatus!==E||F!=="all"&&t.type!==F)}),q={total:m.length,active:m.filter(t=>t.systemStatus==="active").length,paused:m.filter(t=>t.systemStatus==="paused").length,scheduled:m.filter(t=>t.systemStatus==="scheduled").length,completed:m.filter(t=>t.systemStatus==="completed").length,draft:m.filter(t=>t.deploymentStatus==="draft").length,published:m.filter(t=>t.deploymentStatus==="published").length};return e.jsx(Us,{feature:"campaigns",requiredPlan:"solopreneur",children:e.jsx("div",{children:e.jsxs("div",{className:"container mx-auto p-4 max-w-7xl space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold text-gray-900 flex items-center gap-2",children:[e.jsx(ie,{className:"h-8 w-8 text-orange-500"}),"Campaign Library"]}),e.jsx("p",{className:"text-gray-600 mt-1",children:"Manage and organize all your marketing campaigns"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(h,{variant:"outline",onClick:()=>i(!0),disabled:X.length===0,children:[e.jsx(Se,{className:"h-4 w-4 mr-2"}),"Export"]}),e.jsxs(h,{className:"bg-orange-500 hover:bg-orange-600",onClick:()=>k("/campaign-builder"),children:[e.jsx(qe,{className:"h-4 w-4 mr-2"}),"New Campaign"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-7 gap-3",children:[e.jsx(z,{className:"hover:shadow-md transition-shadow cursor-pointer",children:e.jsx(R,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-600",children:"Total"}),e.jsx("p",{className:"text-xl font-bold",children:q.total})]}),e.jsx(ie,{className:"h-8 w-8 text-gray-400"})]})})}),e.jsx(z,{className:"hover:shadow-md transition-shadow cursor-pointer",children:e.jsx(R,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-600",children:"Active"}),e.jsx("p",{className:"text-xl font-bold text-green-600",children:q.active})]}),e.jsx(je,{className:"h-8 w-8 text-green-500"})]})})}),e.jsx(z,{className:"hover:shadow-md transition-shadow cursor-pointer",children:e.jsx(R,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-600",children:"Paused"}),e.jsx("p",{className:"text-xl font-bold text-yellow-600",children:q.paused})]}),e.jsx(ge,{className:"h-8 w-8 text-yellow-500"})]})})}),e.jsx(z,{className:"hover:shadow-md transition-shadow cursor-pointer",children:e.jsx(R,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-600",children:"Scheduled"}),e.jsx("p",{className:"text-xl font-bold text-blue-600",children:q.scheduled})]}),e.jsx(pe,{className:"h-8 w-8 text-blue-500"})]})})}),e.jsx(z,{className:"hover:shadow-md transition-shadow cursor-pointer",children:e.jsx(R,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-600",children:"Completed"}),e.jsx("p",{className:"text-xl font-bold text-gray-600",children:q.completed})]}),e.jsx(le,{className:"h-8 w-8 text-gray-500"})]})})}),e.jsx(z,{className:"hover:shadow-md transition-shadow cursor-pointer",children:e.jsx(R,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-600",children:"Draft"}),e.jsx("p",{className:"text-xl font-bold text-gray-600",children:q.draft})]}),e.jsx(_e,{className:"h-8 w-8 text-gray-400"})]})})}),e.jsx(z,{className:"hover:shadow-md transition-shadow cursor-pointer",children:e.jsx(R,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-600",children:"Published"}),e.jsx("p",{className:"text-xl font-bold text-green-600",children:q.published})]}),e.jsx(js,{className:"h-8 w-8 text-green-500"})]})})})]}),e.jsx(z,{children:e.jsx(R,{className:"p-4",children:e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4",children:[e.jsx("div",{className:"flex-1",children:e.jsxs("div",{className:"relative",children:[e.jsx(fs,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(Ge,{placeholder:"Search campaigns...",value:M,onChange:t=>K(t.target.value),className:"pl-10"})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(ce,{value:E,onValueChange:G,children:[e.jsx(de,{className:"w-40",children:e.jsx(xe,{placeholder:"All Status"})}),e.jsxs(me,{children:[e.jsx(v,{value:"all",children:"All Status"}),e.jsx(v,{value:"active",children:"Active"}),e.jsx(v,{value:"paused",children:"Paused"}),e.jsx(v,{value:"scheduled",children:"Scheduled"}),e.jsx(v,{value:"completed",children:"Completed"})]})]}),e.jsxs(ce,{value:F,onValueChange:J,children:[e.jsx(de,{className:"w-40",children:e.jsx(xe,{placeholder:"All Types"})}),e.jsxs(me,{children:[e.jsx(v,{value:"all",children:"All Types"}),e.jsx(v,{value:"awareness",children:"Awareness"}),e.jsx(v,{value:"consideration",children:"Consideration"}),e.jsx(v,{value:"conversion",children:"Conversion"}),e.jsx(v,{value:"retention",children:"Retention"}),e.jsx(v,{value:"advocacy",children:"Advocacy"}),e.jsx(v,{value:"full_funnel",children:"Full Funnel"}),e.jsx(v,{value:"service_unaware",children:"Service Unaware"}),e.jsx(v,{value:"provider_unaware",children:"Provider Unaware"}),e.jsx(v,{value:"existing_customer",children:"Existing Customer"})]})]}),e.jsxs(ce,{value:(o==null?void 0:o.toString())||"all",onValueChange:t=>w(t==="all"?null:parseInt(t)),children:[e.jsx(de,{className:"w-40",children:e.jsx(xe,{placeholder:"All Folders"})}),e.jsxs(me,{children:[e.jsx(v,{value:"all",children:"All Folders"}),_.map(t=>e.jsx(v,{value:t.id.toString(),children:t.name},t.id))]})]}),e.jsxs("div",{className:"flex items-center border rounded-md",children:[e.jsx(h,{variant:p==="table"?"default":"ghost",size:"sm",onClick:()=>T("table"),className:"rounded-r-none",children:e.jsx(Ws,{className:"h-4 w-4"})}),e.jsx(h,{variant:p==="grid"?"default":"ghost",size:"sm",onClick:()=>T("grid"),className:"rounded-l-none",children:e.jsx(Ve,{className:"h-4 w-4"})})]})]})]})})}),p==="table"?e.jsx(_s,{campaigns:X,loading:D,onViewCampaign:t=>k(`/campaign-builder?id=${t.id}`),onEditCampaign:t=>k(`/campaign-builder?id=${t.id}`),onDeleteCampaign:t=>{L(t),x(!0)},onDuplicateCampaign:t=>se.mutate(t.id),onExportCampaign:t=>{n(t),i(!0)},onShareCampaign:t=>{u({title:"Share Campaign",description:"Sharing functionality coming soon!"})},onCreateCampaign:()=>k("/campaign-builder"),sortColumn:P,sortDirection:N,onSort:A,onUpdateTags:(t,f)=>Ce.mutate({campaignId:t,tags:f}),onUpdateStatus:(t,f)=>oe.mutate({campaignId:t,status:f})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:X.map(t=>e.jsxs(z,{className:"hover:shadow-lg transition-shadow cursor-pointer",children:[e.jsx(Ns,{className:"pb-3",children:e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsx(ws,{className:"text-lg line-clamp-1",children:t.name}),e.jsxs("div",{className:"flex flex-col gap-1",children:[t.systemStatus==="active"&&e.jsx("span",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"}),t.systemStatus==="paused"&&e.jsx("span",{className:"w-2 h-2 bg-yellow-500 rounded-full"})]})]})}),e.jsxs(R,{children:[e.jsx("p",{className:"text-sm text-gray-600 line-clamp-2 mb-3",children:t.description||"No description"}),e.jsxs("div",{className:"space-y-2",children:[t.workflowName&&e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(Ve,{className:"h-3 w-3 text-gray-400"}),e.jsx("span",{children:t.workflowName})]}),t.avatarName&&e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(ue,{className:"h-3 w-3 text-blue-500"}),e.jsx("span",{children:t.avatarName})]}),t.offerName&&e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(le,{className:"h-3 w-3 text-green-500"}
2),e.jsx("span",{children:t.offerName})]}),t.totalSteps&&e.jsx("div",{className:"w-full h-2 bg-gray-200 rounded-full mt-2",children:e.jsx("div",{className:"h-2 bg-green-500 rounded-full",style:{width:`${(t.completedSteps||0)/t.totalSteps*100}%`}})})]}),e.jsxs("div",{className:"flex justify-between items-center mt-4",children:[e.jsxs("div",{className:"flex gap-1",children:[e.jsx(h,{size:"sm",variant:"ghost",onClick:()=>k(`/campaign-builder?id=${t.id}`),children:"View"}),e.jsx(h,{size:"sm",variant:"ghost",onClick:()=>{L(t),x(!0)},children:e.jsx(he,{className:"h-4 w-4"})})]}),e.jsx("span",{className:"text-xs text-gray-500",children:new Date(t.createdAt).toLocaleDateString()})]})]})]},t.id))}),V&&S&&e.jsx(qs,{open:V,onOpenChange:i,campaignId:S.id,campaignName:S.name}),e.jsx(Ne,{open:g,onOpenChange:x,children:e.jsxs(we,{children:[e.jsxs(ve,{children:[e.jsx(be,{children:"Delete Campaign"}),e.jsxs(ye,{children:['Are you sure you want to delete "',C==null?void 0:C.name,'"? This action cannot be undone.']})]}),e.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[e.jsx(h,{variant:"outline",onClick:()=>{x(!1),L(null)},children:"Cancel"}),e.jsx(h,{variant:"destructive",onClick:()=>{C&&(ne.mutate(C.id),x(!1),L(null))},children:"Delete Campaign"})]})]})})]})})})}export{gt 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.