PageSourceSearch

https://aipesolutions.ai/assets/Team-DNMQ3A5a.js

js aipesolutions.ai collected 2026-10-05 13:57:13 UTC 13,852 bytes, 6 lines download raw bytes

1import{g as ge,r as n,j as e,l as m,x as fe,h as ee,a$ as ve,C as N,b as w,J as ye,e as x,ar as Ne,O as we,_ as Ce,a2 as U,T as Te,V as ke,W as Se,X as Me,as as Ee,a1 as _,a9 as Ie,aa as De,ab as Re,ac as Fe,af as V,Y as Le,aI as Ae,aJ as He,aK as Be,bF as Pe,at as ze,au as Oe,av as Ue,bG as v,bH as $,aw as Y,bI as _e,s as b,b0 as Ve,b1 as $e,c as G,d as J}from"./index-LTiB72C6.js";import{D as Ye}from"./DashboardHeader-COGRauxS.js";import{M as Q}from"./ModernLeftSidebar-rOgySZhv.js";import{B as W}from"./Breadcrumbs-DNixbkDn.js";import{R as Ge,L as K}from"./RoleBadge-BNBqK1DT.js";import{C as y}from"./clock-Bf8411BE.js";import{C as X}from"./copy-DLTHTmc4.js";import{E as Je}from"./ellipsis-4XdgIPbd.js";import{T as q}from"./TrialBanner-Cnh263WY.js";import"./extends-CF3RwP-h.js";import"./search-CrRSZxM6.js";import"./star-DqVG4fe3.js";import"./award-BqGWghwM.js";import"./thumbs-up-KAw0Kse-.js";import"./trending-up-B74WegxC.js";/**
2 * @license lucide-react v0.488.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 Qe=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]],We=ge("trash",Qe),C=n.forwardRef(({className:i,...r},t)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:t,className:m("w-full caption-bottom text-sm",i),...r})}));C.displayName="Table";const T=n.forwardRef(({className:i,...r},t)=>e.jsx("thead",{ref:t,className:m("[&_tr]:border-b",i),...r}));T.displayName="TableHeader";const k=n.forwardRef(({className:i,...r},t)=>e.jsx("tbody",{ref:t,className:m("[&_tr:last-child]:border-0",i),...r}));k.displayName="TableBody";const Ke=n.forwardRef(({className:i,...r},t)=>e.jsx("tfoot",{ref:t,className:m("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",i),...r}));Ke.displayName="TableFooter";const h=n.forwardRef(({className:i,...r},t)=>e.jsx("tr",{ref:t,className:m("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",i),...r}));h.displayName="TableRow";const c=n.forwardRef(({className:i,...r},t)=>e.jsx("th",{ref:t,className:m("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",i),...r}));c.displayName="TableHead";const o=n.forwardRef(({className:i,...r},t)=>e.jsx("td",{ref:t,className:m("p-4 align-middle [&:has([role=checkbox])]:pr-0",i),...r}));o.displayName="TableCell";const Xe=n.forwardRef(({className:i,...r},t)=>e.jsx("caption",{ref:t,className:m("mt-4 text-sm text-muted-foreground",i),...r}));Xe.displayName="TableCaption";function Z({showInvites:i=!1,onRefresh:r,pendingInvites:t=[],isLoadingInvites:se=!1}){const[S,ae]=n.useState(""),[p,M]=n.useState([]),[re,E]=n.useState(!1),[te,ie]=n.useState("member"),[g,I]=n.useState(""),[f,u]=n.useState(!1),{toast:l}=fe();ee();const{teamMembers:D,isLoading:R}=ve(),[F,L]=n.useState(!1),[A,H]=n.useState(null);n.useEffect(()=>{M(D)},[D]);const ne=n.useMemo(()=>p?p.filter(s=>{var a;return(a=s.name)==null?void 0:a.toLowerCase().includes(S.toLowerCase())}):[],[p]),le=s=>{ae(s.target.value)},B=()=>{E(!1),I("")},oe=s=>{ie(s)},ce=s=>{I(s.target.value)},de=async()=>{if(!g){l({title:"Error",description:"Please enter an email address.",variant:"destructive"});return}u(!0);try{const{data:s,error:a}=await b.functions.invoke("invite-user",{body:{email:g,role:te}});a?(console.error("Function error:",a),l({title:"Error",description:a.message||"Failed to send invitation. Please try again.",variant:"destructive"})):(l({title:"Success",description:"Invitation sent successfully!"}),B(),typeof r=="function"&&r())}catch(s){console.error("Unexpected error:",s),l({title:"Error",description:"An unexpected error occurred. Please try again.",variant:"destructive"})}finally{u(!1)}},me=async s=>{u(!0);try{const{data:a,error:d}=await b.functions.invoke("resend-invitation",{body:{invitationId:s}});d?(console.error("Resend invite error:",d),l({title:"Error",description:"Failed to resend invitation.",variant:"destructive"})):l({title:"Success",description:"Invitation resent successfully!"})}catch(a){console.error("Unexpected error:",a),l({title:"Error",description:"An unexpected error occurred. Please try again.",variant:"destructive"})}finally{u(!1)}},xe=async s=>{u(!0);try{const{data:a,error:d}=await b.functions.invoke("invitations-api",{body:{action:"cancel",invitationId:s}});d?(console.error("Cancel invite error:",d),l({title:"Error",description:"Failed to cancel invitation.",variant:"destructive"})):(l({title:"Success",description:"Invitation cancelled successfully!"}),typeof r=="function"&&r())}catch(a){console.error("Unexpected error:",a),l({title:"Error",description:"An unexpected error occurred. Please try again.",variant:"destructive"})}finally{u(!1)}},he=async s=>{L(!0),H(s.id);try{if(!s.token)throw new Error("Invitation token is missing.");const a=`${window.location.origin}/auth?token=${s.token}`;await navigator.clipboard.writeText(a),l({title:"Success",description:"Invitation link copied to clipboard!"})}catch(a){console.error("Error copying invite link:",a),l({title:"Error",description:"Failed to copy invitation link.",variant:"destructive"})}finally{L(!1),setTimeout(()=>{H(null)},3e3)}},pe=async s=>{try{if(!s.token)throw new Error("Invitation token is missing.");const a=`${s.token}`;await navigator.clipboard.writeText(a),l({title:"Success",description:"token copied to clipboard!"})}catch(a){console.error("Error copying token link:",a),l({title:"Error",description:"Failed to copy token link.",variant:"destructive"})}}
6,P=async(s,a,d)=>{try{if(!p.find(j=>j.id===s))throw new Error("Member not found");const{error:O}=await b.functions.invoke("company-members-api",{body:{action:"update-role",memberId:s,field:a,value:d}});if(O)throw O;l({title:"Success",description:`Member ${a} updated successfully`});const be=p.map(j=>j.id===s?{...j,[a]:d}:j);M(be),r&&r()}catch(z){console.error("Error updating member:",z),l({title:"Error",description:"Failed to update member",variant:"destructive"})}},ue=["Marketing","Sales","Engineering","Customer Support","Product","Design","HR","Finance","General"],je=["admin","member"];return!R&&p.length===0&&!i?e.jsx(N,{children:e.jsxs(w,{className:"text-center py-8",children:[e.jsx(ye,{className:"h-12 w-12 text-orange-500 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-2",children:"No Team Members Found"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:"We couldn't load team members for your company. This might happen if:"}),e.jsxs("ul",{className:"text-sm text-gray-500 dark:text-gray-400 mb-4 text-left max-w-md mx-auto",children:[e.jsx("li",{children:"• You don't have a company selected"}),e.jsx("li",{children:"• There are no members in your company yet"}),e.jsx("li",{children:"• There's a connectivity issue"})]})]})}):e.jsx("div",{children:i?e.jsx("div",{children:e.jsxs(C,{children:[e.jsx(T,{children:e.jsxs(h,{children:[e.jsx(c,{children:"Role"}),e.jsx(c,{children:"Status"}),e.jsx(c,{children:"Token"}),e.jsx(c,{children:"Expires"}),e.jsx(c,{className:"text-right",children:"Actions"})]})}),e.jsx(k,{children:se?e.jsx(h,{children:e.jsx(o,{colSpan:5,className:"text-center p-4",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(y,{className:"mr-2 h-4 w-4 animate-spin"}),"Loading invitations..."]})})}):t.length>0?t.map(s=>e.jsxs(h,{children:[e.jsx(o,{children:s.role}),e.jsx(o,{children:s.status}),e.jsx(o,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{children:s.token}),e.jsx(x,{variant:"outline",size:"icon",onClick:()=>pe(s),children:e.jsx(X,{className:"h-4 w-4"})})]})}),e.jsx(o,{children:Ne(new Date(s.expires_at),{addSuffix:!0})}),e.jsx(o,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(x,{variant:"outline",size:"icon",onClick:()=>he(s),disabled:F&&A===s.id,children:F&&A===s.id?e.jsx(we,{className:"h-4 w-4"}):e.jsx(X,{className:"h-4 w-4"})}),e.jsx(x,{variant:"outline",size:"icon",onClick:()=>me(s.id),disabled:f,children:e.jsx(Ce,{className:"h-4 w-4"})}),e.jsx(x,{variant:"destructive",size:"icon",onClick:()=>xe(s.id),disabled:f,children:e.jsx(We,{className:"h-4 w-4"})})]})})]},s.id)):e.jsx(h,{children:e.jsx(o,{colSpan:5,className:"text-center",children:"No pending invitations"})})})]})}):e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center justify-between pb-4",children:e.jsx(U,{type:"text",placeholder:"Search team members...",value:S,onChange:le,className:"max-w-sm"})}),e.jsx(Te,{open:re,onOpenChange:E,children:e.jsxs(ke,{className:"sm:max-w-[425px]",children:[e.jsxs(Se,{children:[e.jsx(Me,{children:"Invite a Team Member"}),e.jsx(Ee,{children:"Send an invitation to a new team member."})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx(_,{htmlFor:"email",className:"text-right",children:"Email"}),e.jsx(U,{type:"email",id:"email",value:g,onChange:ce,className:"col-span-3"})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx(_,{htmlFor:"role",className:"text-right",children:"Role"}),e.jsxs(Ie,{onValueChange:oe,children:[e.jsx(De,{className:"col-span-3",children:e.jsx(Re,{placeholder:"Select a role"})}),e.jsxs(Fe,{children:[e.jsx(V,{value:"member",children:"Member"}),e.jsx(V,{value:"admin",children:"Admin"})]})]})]})]}),e.jsxs(Le,{children:[e.jsx(x,{type:"button",variant:"secondary",onClick:B,children:"Cancel"}),e.jsx(x,{type:"submit",onClick:de,children:f?e.jsxs(e.Fragment,{children:[e.jsx(y,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):"Send Invite"})]})]})}),R?e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(y,{className:"mr-2 h-4 w-4 animate-spin"}),"Loading team members..."]}):e.jsxs(C,{children:[e.jsx(T,{children:e.jsxs(h,{children:[e.jsx(c,{children:"Name"}),e.jsx(c,{children:"Email"}),e.jsx(c,{children:"Role"}),e.jsx(c,{children:"Department"}),e.jsx(c,{children:"Status"}),e.jsx(c,{className:"text-right",children:"Actions"})]})}),e.jsx(k,{children:ne.map(s=>e.jsxs(h,{children:[e.jsx(o,{children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(Ae,{children:[e.jsx(He,{src:s.avatar,alt:s.name}),e.jsx(Be,{children:s.name[0]})]}),e.jsx("span",{children:s.name}),s.isOnline&&e.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"})]})}),e.jsx(o,{children:s.email}),e.jsx(o,{children:e.jsx(Ge,{role:s.role})}),e.jsx(o,{children:e.jsx(Pe,{department:s.department})}),e.jsx(o,{children:"-"}),e.jsx(o,{className:"text-right",children:e.jsxs(ze,{children:[e.jsx(Oe,{asChild:!0,children:e.jsxs(x,{variant:"ghost",className:"h-8 w-8 p-0",children:[e.jsx("span",{className:"sr-only",children:"Open menu"}),e.jsx(Je,{className:"h-4 w-4"})]})}),e.jsxs(Ue,{align:"end",children:[e.jsx(v,{children:"Actions"}),e.jsx($,{}),e.jsx(v,{children:"Department"}),ue.map(a=>e.jsxs(Y,{onSelect:()=>P(s.id,"department",a),className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:_e[a].bg}}),a]},a)),e.jsx($,{}),e.jsx(v,{children:"Role"}),je.map(a=>e.jsx(Y,{onSelect:()=>P(s.id,"role",a),children:e.jsx("span",{className:"capitalize",children:a})},a))]})]})})]},s.id))})]})]})})}const hs=()=>{const{user:i,loading:r,demoMode:t}=ee();return n.useEffect(()=>{},[]),r?e.jsx(Ve,{message:"Loading Team",submessage:"Preparing your team dashboard..."}):!i&&!t?e.jsx($e,{to:"/auth"}):e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-lumo-gray via-white to-accent/10 text-foreground font-lumo",children:[e.jsx(Ye,{}),e.jsxs("div",{className:"relative w-full",children:[e.jsxs("div",{className:"hidden lg:block",children:[e.jsx("div",{className:"fixed left-0 top-0 h-full w-[min(22vw,350px)] pt-20 overflow-y-auto z-10 bg-card/80 backdrop-blur-sm border-r border-primary/20",children:e.jsx("div",{className:"p-4",children:e.jsx(Q,{})})}),e.jsx("div",{className:"ml-[min(22vw,350px)] px-6 pb-8",children:e.jsxs("div",{className:"flex flex-col mt-12 max-w-7xl mx-auto",children:[e.jsx(q,{}),e.jsx(W,{}),t&&e.jsxs("div",{className:"mb-8 p-6 bg-gradient-to-r from-primary/10 to-accent/10 rounded-xl border border-primary/20",children:[e.jsx("h3",{className:"font-semibold text-primary mb-2",children:"Demo Mode Active"}),e.jsx("p",{className:"text-sm text-primary/80 mb-4",children:"You're currently using the dashboard in demo mode. Some features may be limited."})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(N,{className:"border border-border shadow-lg",children:[e.jsx(G,{className:"bg-gradient-to-r from-primary/5 to-accent/5 border-b border-primary/20",children:e.jsx(J,{className:"text-lg text-foreground",children:"Team Management"})}),e.jsx(w,{className:"p-6 bg-card",children:e.jsx(Z,{showInvites:!1})})]}),e.jsx(K,{})]})]})})]}),e.jsxs("div",{className:"lg:hidden px-4 pb-8 space-y-6",children:[e.jsx("div",{className:"grid grid-cols-1 gap-6 pt-6",children:e.jsx(Q,{})}),e.jsx(q,{}),e.jsx(W,{}),t&&e.jsxs("div",{className:"p-6 bg-gradient-to-r from-primary/10 to-accent/10 rounded-xl border border-primary/20",children:[e.jsx("h3",{className:"font-semibold text-primary mb-2",children:"Demo Mode Active"}),e.jsx("p",{className:"text-sm text-primary/80 mb-4",children:"You're currently using the dashboard in demo mode."})]}),e.jsxs(N,{className:"border border-border shadow-lg",children:[e.jsx(G,{className:"bg-gradient-to-r from-primary/5 to-accent/5 border-b border-primary/20",children:e.jsx(J,{className:"text-lg text-foreground",children:"Team Management"})}),e.jsx(w,{className:"p-6 bg-card",children:e.jsx(Z,{showInvites:!1})})]}),e.jsx(K,{})]})]})]})};export{hs 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.