PageSourceSearch

https://socialselling.ai/_next/static/chunks/13013.ef61d201f9a891b6.js

js socialselling.ai collected 2026-10-05 14:50:58 UTC 39,816 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[13013],{86859:function(e,s,a){a.r(s),a.d(s,{default:function(){return Z}});var t=a(57437),r=a(2265),n=a(99376),l=a(79820),i=a(12381),c=a(40279),o=a(75060),d=a(69174),u=a(94589),m=a(17168),h=a(32660),x=a(98420),f=a(65621),p=a(15863),g=a(82431),v=a(37806),j=a(65302),b=a(54001),y=a(11239),w=a(96362),N=a(20847),k=a(61345),C=a(84881),S=a(9310),_=a(79587),E=a(73608);let T=["/dashboard/trial-expired","/dashboard/plan-expired","/dashboard/billing","/dashboard/workspace","/logout"];var F=a(7434),A=a(4705),D=a(14438),z=a(71837);function Z(){var e,s;let a=(0,n.useRouter)(),{user:Z}=(0,C.a)(),{endNavigation:P}=(0,S.H)(),{users:U,invitations:R,loading:I,inviteUser:O,removeUser:L,refresh:Y}=(0,_.U)(),{platforms:M,accounts:V,oauthStatus:W,connectedCount:B,loading:G,connectPlatform:K,disconnectPlatform:H,refreshAll:$}=(0,E.J)(),{status:J,loading:X,isPaidPlan:q,daysRemaining:Q,creditsBalance:ee,refreshStatus:es}=function(){var e,s,a,t,l;let i=(0,n.useRouter)(),c=(0,n.usePathname)(),[o,d]=(0,r.useState)(null),[u,m]=(0,r.useState)(!0),[h,x]=(0,r.useState)(null),f=(0,r.useCallback)(async()=>{try{let e=localStorage.getItem("access_token");if(!e){m(!1);return}let s=await fetch("".concat("","/api/billing/trial-status"),{headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}});if(!s.ok)throw Error("Failed to fetch trial status");let a=await s.json();d(a),a.has_trial&&a.is_expired&&!a.is_paid_plan&&!T.some(e=>null==c?void 0:c.startsWith(e))&&(null==c?void 0:c.startsWith("/dashboard"))&&i.push("/dashboard/trial-expired"),a.is_paid_plan&&a.is_expired&&a.needs_renewal&&!T.some(e=>null==c?void 0:c.startsWith(e))&&(null==c?void 0:c.startsWith("/dashboard"))&&i.push("/dashboard/plan-expired")}catch(e){console.error("Error checking trial status:",e),x(e.message)}finally{m(!1)}},[c,i]);return(0,r.useEffect)(()=>{f()},[f]),(0,r.useEffect)(()=>{let e=setInterval(f,3e5);return()=>clearInterval(e)},[f]),{status:o,loading:u,error:h,isTrialActive:null===(e=null==o?void 0:o.trial_is_active)||void 0===e||e,isExpired:null!==(s=null==o?void 0:o.is_expired)&&void 0!==s&&s,isPaidPlan:null!==(a=null==o?void 0:o.is_paid_plan)&&void 0!==a&&a,daysRemaining:null!==(t=null==o?void 0:o.days_remaining)&&void 0!==t?t:0,creditsBalance:null!==(l=null==o?void 0:o.credits_balance)&&void 0!==l?l:0,refreshStatus:f}}(),{regions:ea,loading:et}=(0,F.e)(),{branches:er,loading:en}=(0,A.n)();(0,r.useEffect)(()=>{I||G||X||et||en||P()},[I,G,X,et,en,P]);let[el,ei]=(0,r.useState)(""),[ec,eo]=(0,r.useState)(""),[ed,eu]=(0,r.useState)("UTC"),[em,eh]=(0,r.useState)(!1),[ex,ef]=(0,r.useState)(!1),[ep,eg]=(0,r.useState)("60"),[ev,ej]=(0,r.useState)(!1),[eb,ey]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(Z){var e,s,a,t,r;ei((null===(e=Z.settings)||void 0===e?void 0:e.company)||Z.full_name||"My Workspace"),eo((null===(s=Z.settings)||void 0===s?void 0:s.website)||""),eu((null===(a=Z.settings)||void 0===a?void 0:a.timezone)||"UTC"),ef((null===(t=Z.settings)||void 0===t?void 0:t.two_factor_enabled)||!1),eg((null===(r=Z.settings)||void 0===r?void 0:r.session_timeout)||"60")}},[Z]);let ew=U.filter(e=>"active"===e.status).length,eN=R.length,ek=ea.length,eC=er.length,eS={facebook:"\uD83D\uDC65",instagram:"\uD83D\uDCF7",twitter:"\uD83D\uDC26",linkedin:"\uD83D\uDCBC",whatsapp:"\uD83D\uDCAC",email:"\uD83D\uDCE7",gmail:"\uD83D\uDCE7",google:"\uD83D\uDD0D"},e_=async()=>{eh(!0);try{await z.api.put("/auth/me",{settings:{company:el,website:ec,timezone:ed}}),D.A.success("Settings saved successfully")}catch(e){D.A.error("Failed to save settings")}finally{eh(!1)}},eE=async e=>{let s=await L(e);s.success?D.A.success("User removed successfully"):D.A.error(s.error||"Failed to remove user")},eT=async()=>{ej(!0);try{await z.api.put("/auth/me",{settings:{two_factor_enabled:ex,session_timeout:ep}}),D.A.success("Security settings saved successfully")}catch(e){D.A.error("Failed to save security settings")}finally{ej(!1)}},eF=async()=>{if(confirm("Are you sure you want to sign out from all devices? You will need to log in again.")){ey(!0);try{await z.api.post("/auth/logout-all"),D.A.success("Signed out from all devices"),window.location.href="/login"}catch(e){D.A.error("Failed to sign out from all devices"),ey(!1)}}},eA=e=>e?new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"N/A";return(0,t.jsxs)("div",{className:"p-3 sm:p-4 md:p-6 space-y-4 sm:sp
1ace-y-6",children:[(0,t.jsx)("div",{className:"flex justify-between items-center",children:(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsxs)(i.z,{variant:"ghost",onClick:()=>a.push("/dashboard/settings"),className:"text-muted-foreground hover:text-foreground",children:[(0,t.jsx)(h.Z,{className:"h-4 w-4 mr-2"}),"Settings"]}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("h1",{className:"text-xl sm:text-2xl md:text-3xl font-bold",children:"Workspace Settings"}),(0,t.jsx)("p",{className:"text-xs sm:text-sm text-muted-foreground truncate",children:"Manage your workspace and team"})]})]})}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,t.jsxs)(l.Zb,{children:[(0,t.jsx)(l.Ol,{className:"pb-2",children:(0,t.jsx)(l.ll,{className:"text-sm font-medium",children:"Team Members"})}),(0,t.jsxs)(l.aY,{children:[(0,t.jsx)("div",{className:"text-2xl font-bold",children:U.length}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[ew," active",eN>0&&", ".concat(eN," pending")]})]})]}),(0,t.jsxs)(l.Zb,{children:[(0,t.jsx)(l.Ol,{className:"pb-2",children:(0,t.jsx)(l.ll,{className:"text-sm font-medium",children:"Organization"})}),(0,t.jsxs)(l.aY,{children:[(0,t.jsx)("div",{className:"text-2xl font-bold",children:ek+eC}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[ek," regions, ",eC," branches"]})]})]}),(0,t.jsxs)(l.Zb,{children:[(0,t.jsx)(l.Ol,{className:"pb-2",children:(0,t.jsx)(l.ll,{className:"text-sm font-medium",children:"Connected Platforms"})}),(0,t.jsxs)(l.aY,{children:[(0,t.jsx)("div",{className:"text-2xl font-bold",children:B}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[V.length," accounts"]})]})]}),(0,t.jsxs)(l.Zb,{children:[(0,t.jsx)(l.Ol,{className:"pb-2",children:(0,t.jsx)(l.ll,{className:"text-sm font-medium",children:"Plan"})}),(0,t.jsxs)(l.aY,{children:[(0,t.jsx)("div",{className:"text-2xl font-bold",children:(null==J?void 0:null===(e=J.current_plan_sku)||void 0===e?void 0:e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()))||"Trial"}),!q&&Q>0&&(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[Q," days remaining"]}),q&&(0,t.jsx)(d.C,{className:"bg-green-500 mt-1",children:"Active"})]})]})]}),(0,t.jsxs)(m.Tabs,{defaultValue:"general",className:"space-y-4",children:[(0,t.jsxs)(m.TabsList,{className:"flex flex-wrap",children:[(0,t.jsx)(m.TabsTrigger,{value:"general",children:"General"}),(0,t.jsxs)(m.TabsTrigger,{value:"organization",className:"flex items-center gap-1",children:[(0,t.jsx)(x.Z,{className:"h-4 w-4"}),"Organization"]}),(0,t.jsx)(m.TabsTrigger,{value:"team",children:"Team"}),(0,t.jsx)(m.TabsTrigger,{value:"integrations",children:"Integrations"}),(0,t.jsx)(m.TabsTrigger,{value:"billing",children:"Billing"}),(0,t.jsx)(m.TabsTrigger,{value:"security",children:"Security"}),(0,t.jsxs)(m.TabsTrigger,{value:"audit-logs",className:"flex items-center gap-1",children:[(0,t.jsx)(f.Z,{className:"h-4 w-4"}),"Audit Logs"]})]}),(0,t.jsx)(m.TabsContent,{value:"general",className:"space-y-4",children:(0,t.jsxs)(l.Zb,{children:[(0,t.jsxs)(l.Ol,{children:[(0,t.jsx)(l.ll,{children:"General Settings"}),(0,t.jsx)(l.SZ,{children:"Manage your workspace information"})]}),(0,t.jsxs)(l.aY,{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(o._,{htmlFor:"workspace-name",children:"Workspace Name"}),(0,t.jsx)(c.I,{id:"workspace-name",value:el,onChange:e=>ei(e.target.value),placeholder:"Enter workspace name"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(o._,{htmlFor:"company-url",children:"Company URL"}),(0,t.jsx)(c.I,{id:"company-url",value:ec,onChange:e=>eo(e.target.value),placeholder:"https://example.com"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(o._,{htmlFor:"timezone",children:"Timezone"}),(0,t.jsxs)("select",{id:"timezone",className:"w-full p-2 border rounded-md",value:ed,onChange:e=>eu(e.target.value),children:[(0,t.jsx)("option",{value:"UTC",children:"UTC"}),(0,t.jsx)("option",{value:"America/Los_Angeles",children:"UTC-08:00 Pacific Time"}
1),(0,t.jsx)("option",{value:"America/New_York",children:"UTC-05:00 Eastern Time"}),(0,t.jsx)("option",{value:"Europe/London",children:"UTC+00:00 GMT"}),(0,t.jsx)("option",{value:"Europe/Paris",children:"UTC+01:00 Central European Time"}),(0,t.jsx)("option",{value:"Asia/Kolkata",children:"UTC+05:30 India Standard Time"}),(0,t.jsx)("option",{value:"Asia/Singapore",children:"UTC+08:00 Singapore Time"})]})]}),(0,t.jsxs)(i.z,{onClick:e_,disabled:em,children:[em&&(0,t.jsx)(p.Z,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Changes"]})]})]})}),(0,t.jsx)(m.TabsContent,{value:"organization",className:"space-y-4",children:(0,t.jsx)(N._,{})}),(0,t.jsx)(m.TabsContent,{value:"team",className:"space-y-4",children:(0,t.jsxs)(l.Zb,{children:[(0,t.jsx)(l.Ol,{children:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(l.ll,{children:"Team Members"}),(0,t.jsx)(l.SZ,{children:"Manage who has access to this workspace"})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsxs)(i.z,{variant:"outline",size:"sm",onClick:Y,children:[(0,t.jsx)(g.Z,{className:"h-4 w-4 mr-2"}),"Refresh"]}),(0,t.jsxs)(i.z,{onClick:()=>window.location.href="/dashboard/users",children:[(0,t.jsx)(v.Z,{className:"h-4 w-4 mr-2"}),"Manage Users"]})]})]})}),(0,t.jsx)(l.aY,{children:I?(0,t.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,t.jsx)(p.Z,{className:"h-6 w-6 animate-spin"})}):(0,t.jsxs)("div",{className:"space-y-4",children:[R.length>0&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)("h4",{className:"text-sm font-medium mb-2 text-muted-foreground",children:"Pending Invitations"}),R.map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between p-4 border rounded-lg bg-yellow-50 dark:bg-yellow-900/20 mb-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)("div",{className:"h-10 w-10 bg-gradient-to-br from-yellow-400 to-orange-500 rounded-full flex items-center justify-center text-white font-semibold",children:e.email.charAt(0).toUpperCase()}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:e.email}),(0,t.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Invited ",eA(e.created_at)]})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)(d.C,{variant:"secondary",children:"Pending"}),(0,t.jsx)(d.C,{variant:"outline",children:e.role||"Member"})]})]},e.id))]}),U.map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)("div",{className:"h-10 w-10 bg-gradient-to-br from-blue-500 to-purple-500 rounded-full flex items-center justify-center text-white font-semibold",children:(e.full_name||e.email).charAt(0).toUpperCase()}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:e.full_name||e.email}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e.email})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)(d.C,{variant:"active"===e.status?"default":"secondary",children:e.status}),(0,t.jsx)(d.C,{variant:"outline",children:e.enterprise_role||e.workspace_role||"Member"}),e.id!==(null==Z?void 0:Z.id)&&(0,t.jsx)(i.z,{size:"sm",variant:"ghost",onClick:()=>eE(e.id),children:"Remove"})]})]},e.id)),0===U.length&&0===R.length&&(0,t.jsx)("div",{className:"text-center py-8 text-muted-foreground",children:"No team members yet. Invite your first team member to get started."})]})})]})}),(0,t.jsxs)(m.TabsContent,{value:"integrations",className:"space-y-4",children:[(0,t.jsxs)(l.Zb,{children:[(0,t.jsx)(l.Ol,{children:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(l.ll,{children:"Connected Integrations"}),(0,t.jsx)(l.SZ,{children:"Manage your connected platforms and services"})]}),(0,t.jsxs)(i.z,{variant:"outline",size:"sm",onClick:$,children:[(0,t.jsx)(g.Z,{className:"h-4 w-4 mr-2"}),"Refresh"]})]})}),(0,t.jsx)(l.aY,{children:G?(0,t.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,t.jsx)(p.Z,{className:"h-6 w-6 animate-spin"})}):(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[M.map(e=>{let s=W[e.id],a=(null==s?void 0:s.isConnected)||!1,r=V.filter(s=>s.platform===e.id),n=["x","twitter","pinterest","linkedin","youtube"].includes(e.id.toLowerCase());return(0,t.jsxs)("div",{className:"flex items-center justify-between p-4 border rounded-lg ".concat(n?"opacity-60":""),children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("span",{className:"text-2xl",children:eS[e.id.toLowerCase()]||"\uD83D\uDD17"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:e.name}),n?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Coming soon"}):a?(0,t.jsxs)("p",{className:"text-sm text-green-600",children:[r.length," account",1!==r.length?"s":""," connected"]}):(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Not connected"})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[a&&!n&&(0,t.jsx)(j.Z,{className:"h-4 w-4 text-green-500"}),(0,t.jsx)(i.z,{size:"sm",variant:a?"outline":"default",disabled:n,onClick:()=>{n||(a?window.location.href="/dashboard/settings":K(e.id))},children:n?"Coming Soon":a?"Manage":"Connect"})]})]},e.id)}),0===M.length&&(0,t.jsx)("div",{className:"col-span-2 text-center py-8 text-muted-foreground",children:"No platforms available. Configure platforms in admin settings."})]})})]}),(0,t.jsxs)(l.Zb,{children:[(0,t.jsxs)(l.Ol,{children:[(0,t.jsx)(l.ll,{children:"API A
1ccess"}),(0,t.jsx)(l.SZ,{children:"Manage API keys and webhooks"})]}),(0,t.jsx)(l.aY,{children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:"API Key"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Use this key to access our API"})]}),(0,t.jsxs)(i.z,{size:"sm",variant:"outline",children:[(0,t.jsx)(b.Z,{className:"h-4 w-4 mr-2"}),"Generate New Key"]})]}),(0,t.jsx)("div",{className:"p-3 bg-muted rounded-md font-mono text-sm",children:(null==Z?void 0:Z.workspace_id)?"ws_".concat(Z.workspace_id.substring(0,8),"************************"):"No workspace ID"})]})})]})]}),(0,t.jsx)(m.TabsContent,{value:"billing",className:"space-y-4",children:(0,t.jsxs)(l.Zb,{children:[(0,t.jsx)(l.Ol,{children:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(l.ll,{children:"Billing & Subscription"}),(0,t.jsx)(l.SZ,{children:"Manage your subscription and payment methods"})]}),(0,t.jsxs)(i.z,{variant:"outline",size:"sm",onClick:es,children:[(0,t.jsx)(g.Z,{className:"h-4 w-4 mr-2"}),"Refresh"]})]})}),(0,t.jsx)(l.aY,{className:"space-y-6",children:X?(0,t.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,t.jsx)(p.Z,{className:"h-6 w-6 animate-spin"})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"p-4 border rounded-lg",children:(0,t.jsxs)("div",{className:"flex justify-between items-start",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"font-semibold",children:(null==J?void 0:null===(s=J.current_plan_sku)||void 0===s?void 0:s.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()))||"Trial Plan"}),q?(0,t.jsx)("p",{className:"text-muted-foreground",children:"Paid subscription"}):(0,t.jsx)("p",{className:"text-muted-foreground",children:Q>0?"".concat(Q," days remaining"):"Trial expired"}),(0,t.jsxs)("ul",{className:"mt-3 space-y-1 text-sm",children:[(0,t.jsxs)("li",{className:"flex items-center gap-2",children:[(0,t.jsx)(j.Z,{className:"h-4 w-4 text-green-500"}),"Unlimited team members"]}),(0,t.jsxs)("li",{className:"flex items-center gap-2",children:[(0,t.jsx)(j.Z,{className:"h-4 w-4 text-green-500"}),ee.toLocaleString()," credits available"]}),(0,t.jsxs)("li",{className:"flex items-center gap-2",children:[(0,t.jsx)(j.Z,{className:"h-4 w-4 text-green-500"}),"All integrations"]}),(0,t.jsxs)("li",{className:"flex items-center gap-2",children:[(0,t.jsx)(j.Z,{className:"h-4 w-4 text-green-500"}),"Priority support"]})]})]}),(0,t.jsx)(d.C,{className:q?"bg-green-500":(null==J?void 0:J.is_expired)?"bg-red-500":"bg-blue-500",children:q?"Active":(null==J?void 0:J.is_expired)?"Expired":"Trial"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-medium mb-3",children:"Credits Balance"}),(0,t.jsxs)("div",{className:"flex items-center gap-3 p-3 border rounded-lg",children:[(0,t.jsx)(y.Z,{className:"h-5 w-5 text-yellow-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("p",{className:"font-medium",children:[ee.toLocaleString()," credits"]}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Available for AI features"})]}),(0,t.jsx)(i.z,{size:"sm",variant:"outline",onClick:()=>window.location.href="/dashboard/credits",children:"Buy Credits"})]})]}),!q&&(0,t.jsxs)("div",{className:"p-4 bg-gradient-to-r from-purple-500/10 to-blue-500/10 rounded-lg border border-purple-200 dark:border-purple-800",children:[(0,t.jsx)("h4",{className:"font-medium mb-2",children:"Upgrade to Pro"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground mb-3",children:"Unlock all features and get unlimited access to our platform."}),(0,t.jsxs)(i.z,{onClick:()=>window.location.href="/dashboard/billing",children:[(0,t.jsx)(w.Z,{className:"h-4 w-4 mr-2"}),"View Plans"]})]})]})})]})}),(0,t.jsx)(m.TabsContent,{value:"security",className:"space-y-4",children:(0,t.jsxs)(l.Zb,{children:[(0,t.jsxs)(l.Ol,{children:[(0,t.jsx)(l.ll,{children:"Security Settings"}),(0,t.jsx)(l.SZ,{children:"Configure security options for your workspace"})]}),(0,t.jsxs)(l.aY,{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:"Two-Factor Authentication"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Add an extra layer of security"})]}),(0,t.jsx)(u.r,{checked:ex,onCheckedChange:ef})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:"Session Timeout"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Auto logout after inactivity"})]}),(0,t.jsxs)("select",{className:"p-2 border rounded-md",value:ep,onChange:e=>eg(e.target.value),children:[(0,t.jsx)("option",{value:"30",children:"30 minutes"}),(0,t.jsx)("option",{value:"60",children:"1 hour"}),(0,t.jsx)("option",{value:"240",children:"4 hours"}),(0,t.jsx)("option",{value:"0",children:"Never"})]})]}),(0,t.jsxs)(i.z,{onClick:eT,disabled:ev,children:[ev&&(0,t.jsx)(p.Z,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Security Settings"]}),(0,t.jsxs)("div",{className:"pt-4 border-t space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:"Active Sessions"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"View and manage active sessions"})]}),(0,t.jsx)(i.z,{size:"sm",variant:"outline",onClick:()=>D.A.info("Session management coming soon"),children:"View Sessions"})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium text-red-600",children:"Sign Out All Devices"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"This will log you out from all devices including this one"})]}),(0,t.jsxs)(i.z,{variant:"destructive",size:"sm",onClick:eF,disabled:eb,children:[eb&&(0,t.jsx)(p.Z,{className:"h-4 w-4 mr-2 animate-spin"}),"Sign Out All"]})]})]})]})]})}),(0,t.jsx)(m.TabsContent,{value:"audit-logs",className:"space-y-4",children:(0,t.jsx)(k.f,{workspaceId:(null==Z?void 0:Z.workspace_id)||""})})]})]})}},30767:function(e,s,a){a.d(s,{OL:function(){return g},_T:function(){return m},aR:function(){return c},f$:function(){return f},fY:function(){return h},le:function(){return v},vW:function(){return o},xo:function(){return x},yT:function(){return p}});var t=a(57437),r=a(2265),n=a(90277),l=a(93448),i=a(12381);let c=n.fC,o=n.xz,d=n.h_,u=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsx)(n.aV,{className:(0,l.cn)("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...r,ref:s})});u.displayName=n.aV.displayName;let m=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsxs)(d,{children:[(0,t.jsx)(u,{}),(0,t.jsx)(n.VY,{ref:s,className:(0,l.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rou
1nded-lg",a),...r})]})});m.displayName=n.VY.displayName;let h=e=>{let{className:s,...a}=e;return(0,t.jsx)("div",{className:(0,l.cn)("flex flex-col space-y-2 text-center sm:text-left",s),...a})};h.displayName="AlertDialogHeader";let x=e=>{let{className:s,...a}=e;return(0,t.jsx)("div",{className:(0,l.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...a})};x.displayName="AlertDialogFooter";let f=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsx)(n.Dx,{ref:s,className:(0,l.cn)("text-lg font-semibold",a),...r})});f.displayName=n.Dx.displayName;let p=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsx)(n.dk,{ref:s,className:(0,l.cn)("text-sm text-muted-foreground",a),...r})});p.displayName=n.dk.displayName;let g=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsx)(n.aU,{ref:s,className:(0,l.cn)((0,i.d)(),a),...r})});g.displayName=n.aU.displayName;let v=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsx)(n.$j,{ref:s,className:(0,l.cn)((0,i.d)({variant:"outline"}),"mt-2 sm:mt-0",a),...r})});v.displayName=n.$j.displayName},69174:function(e,s,a){a.d(s,{C:function(){return i}});var t=a(57437);a(2265);var r=a(90535),n=a(93448);let l=(0,r.j)("inline-flex items-center rounded-[4px] border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function i(e){let{className:s,variant:a,...r}=e;return(0,t.jsx)("div",{className:(0,n.cn)(l({variant:a}),s),...r})}},75060:function(e,s,a){a.d(s,{_:function(){return o}});var t=a(57437),r=a(2265),n=a(6394),l=a(90535),i=a(93448);let c=(0,l.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),o=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsx)(n.f,{ref:s,className:(0,i.cn)(c(),a),...r})});o.displayName=n.f.displayName},94589:function(e,s,a){a.d(s,{r:function(){return i}});var t=a(57437),r=a(2265),n=a(50721),l=a(93448);let i=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsx)(n.fC,{className:(0,l.cn)("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 dark:focus-visible:ring-gray-300 focus-visible:ring-offset-2 focus-visible:ring-offset-white dark:focus-visible:ring-offset-gray-950 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-gray-900 dark:data-[state=checked]:bg-gray-100 data-[state=unchecked]:bg-gray-200 dark:data-[state=unchecked]:bg-gray-700",a),...r,ref:s,children:(0,t.jsx)(n.bU,{className:(0,l.cn)("pointer-events-none block h-5 w-5 rounded-full bg-white dark:bg-gray-900 shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})})});i.displayName=n.fC.displayName},23675:function(e,s,a){a.d(s,{g:function(){return l}});var t=a(57437),r=a(2265),n=a(93448);let l=r.forwardRef((e,s)=>{let{className:a,error:r,...l}=e;return(0,t.jsx)("textarea",{"aria-invalid":r?"true":void 0,className:(0,n.cn)("flex min-h-[80px] w-full rounded-[4px] border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r&&"border-red-500 focus-visible:ring-red-500",a),ref:s,...l})});l.displayName="Textarea"},9310:function(e,s,a){a.d(s,{H:function(){return c},K:function(){return i}});var t=a(57437),r=a(2265),n=a(99376);let l=(0,r.createContext)(void 0);function i(e){let{children:s}=e,[a,i]=(0,r.useState)(!1),c=(0,n.useRouter)(),o=(0,n.usePathname)(),d=(0,r.useRef)(o),u=(0,r.useRef)(null),m=(0,r.useCallback)(()=>{u.current&&(clearTimeout(u.current),u.current=null)},[]),h=(0,r.useCallback)(()=>{m(),i(!0),u.current=setTimeout(()=>{i(!1)},4e3)},[m]),x=(0,r.useCallback)(()=>{m(),i(!1)},[m]),f=(0,r.useCallback)(e=>{e!==o&&(h(),c.push(e))},[c,o,h]);return(0,r.useEffect)(()=>(o!==d.current&&(d.current=o),()=>m()),[o,m]),(0,t.jsx)(l.Provider,{value:{isNavigating:a,startNavigation:h,endNavigation:x,navigateTo:f},children:s})}function c(){let e=(0,r.useContext)(l);if(!e)throw Error("useNavigation must be used within a NavigationProvider");return e}},73608:function(e,s,a){a.d(s,{J:function(){return r}});var t=a(2265);function r(){let[e,s]=(0,t.useState)([]),[a,r]=(0,t.useState)([]),[n,l]=(0,t.useState)({}),[i,c]=(0,t.useState)({}),[o,d]=(0,t.useState)(!0),[u,m]=(0,t.useState)(!1),[h,x]=(0,t.useState)(!1),[f,p]=(0,t.useState)(null),[g,v]=(0,t.useState)(0),[j,b]=(0,t.useState)(0),y=(0,t.useCallback)(()=>{let e=localStorage.getItem("access_token"),s=localStorage.getItem("workspace_id");return{"Content-Type":"application/json",...e&&{Authorization:"Bearer ".concat(e)},...s&&{"X-Workspace-ID":s}}},[]),w=(0,t.useCallback)(async()=>{m(!0);try{let e=await fetch("".concat("","/api/social/platforms"),{headers:y()});if(!e.ok)throw Error("Failed to fetch platforms");let a=await e.json();s(a.platforms),b(a.configuredCount),p(null)}catch(e){console.error("Error fetching platforms:",e),p("Failed to load platforms")}finally{m(!1)}},[y]),N=(0,t.useCallback)(async()=>{x(!0);try{let e=await fetch("".concat("","/api/social/connected-assets"),{headers:y()});if(!e.ok)throw Error("Failed to fetch connected accounts");let s=await e.json();r(s.accounts),c(s.byPlatform),p(null)}catch(e){console.error("Error fetching accounts:",e),p("Failed to load connected accounts")}finally{x(!1)}},[y]),k=(0,t.useCallback)(async()=>{try{let e=await fetch("".concat("","/api/social/oauth-status"),{headers:y()});if(!e.ok)throw Error("Failed to fetch OAuth status");let s=await e.json();l(s.status),v(s.connectedCount),p(null)}catch(e){console.error("Error fetching OAuth status:",e),p("Failed to load OAuth status")}},[y]),C=(0,t.useCallback)(async()=>{d(!0),await Promise.all([w(),N(),k()]),d(!1)},[w,N,k]),S=(0,t.useCallback)(function(e){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=arguments.length>2?arguments[2]:void 0,t=arguments.length>3?arguments[3]:void 0,r=localStorage.getItem("workspace_id"),n=new URLSearchParams;r&&n.append("workspace_id",r),s&&n.append("force_reauth","true");let l=a||window.location.href;l&&n.append("redirect_uri",l),t&&t.length>0&&n.append("segments",t.join(","));let i=n.toString(),c="".concat("","/api/social/connect/").concat(e).concat(i?"?".concat(i):"");window.location.href=c},[]),_=(0,t.useCallback)(async(e,s)=>{try{let a=s?"".concat("","/api/social/disconnect/").concat(e,"?account_id=").concat(s):"".concat("","/api/social/disconnect/").concat(e);if(!(await fetch(a,{method:"DELETE",headers:y()})).ok)throw Error("Failed to disconnect");return await C(),!0}catch(e){return console.error("Error disconnecting:",e),p("Failed to disconnect account"),!1}},[y,C]),E=(0,t.useCallback)(async e=>{try{if(!(await fetch("".concat("","/api/social/refresh-token/").concat(e),{method:"POST",headers:y()})).ok)throw Error("Failed to refresh token");return await k(),!0}catch(e){return console.error("Error refreshing token:",e),p("Failed to refresh token"),!1}},[y,k]),T=(0,t.useCallback)(async e=>{try{if(!(await fetch("".concat("","/api/social/sync-accounts/").concat(e),{method:"POST",headers:y()})).ok)throw Error("Failed to sync accounts");return await N(),!0}catch(e){return console.error("Error syncing accounts:",e),p("Failed to sync accounts"),!1}},[y,N]),F=(0,t.useCallback)(async e=>{try{if(!(await fetch("".concat("","/api/social/mock/connect/").concat(e),{method:"POST",headers:y()})).ok)throw Error("Failed to mock connect");return await C(),!0}catch(e){return console.error("Error mock connecting:",e),p("Failed to mock connect platform"),!1}},[y,C]),A=(0,t.useCallback)(async e=>{try{if(!(await fetch("".concat("","/api/social/mock/disconnect/").concat(e),{method:"DELETE",headers:y()})).ok)throw Error("Failed to mock disconnect");return await C(),!0}catch(e){return console.error("Error mock disconnecting:",e),p("Failed to mock disconnect platform"),!1}},[y,C]),D=(0,t.useCallback)(async()=>{try{if(!(await fetch("".concat("","/api/social/mock/clear-all"),{method:"DELETE",headers:y()})).ok)throw Error("Failed to clear mock accounts");return await C(),!0}catch(e){return console.error("Error clearing mock accounts:",e),p("Failed to clear mock accounts"),!1}},[y,C]),z=(0,t.useRef)(!1);return(0,t.useEffect)(()=>{z.current||(z.current=!0,(async()=>{d(!0);try{await Promise.all([w(),N(),k()])}finally{d(!1)}})())},[]),{platforms:e,accounts:a,oauthStatus:n,accountsByPlatform:i,loading:o,platformsLoading:u,accountsLoading:h,error:f,connectedCount:g,configuredCount:j,fetchPlatforms:w,fetchAccounts:N,fetchOAuthStatus:k,refreshAll:C,connectPlatform:S,disconnectPlatform:_,refreshToken:E,syncAccounts:T,mockConnectPlatform:F,mockDisconnectPlatform:A,mockClearAll:D}}},79587:function(e,s,a){a.d(s,{U:function(){return n},d:function(){return l}});
1var t=a(2265),r=a(71837);function n(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{autoFetch:!0},[s,a]=(0,t.useState)([]),[n,l]=(0,t.useState)([]),[i,c]=(0,t.useState)(!0),[o,d]=(0,t.useState)(null),u=(0,t.useCallback)(async e=>{try{c(!0),d(null);let s={};e&&Object.entries(e).forEach(e=>{let[a,t]=e;null!=t&&""!==t&&("boolean"==typeof t?s[a]=t.toString():s[a]=t)});let t=await r.api.get("/users",{params:s});a(t.data)}catch(e){d(e instanceof Error?e.message:"Failed to fetch users"),console.error("Failed to fetch users:",e)}finally{c(!1)}},[]),m=(0,t.useCallback)(async()=>{try{let e=await r.api.get("/users/pending-invitations");l(e.data)}catch(e){console.error("Failed to fetch invitations:",e)}},[]),h=(0,t.useCallback)(async e=>{try{return(await r.api.get("/users/".concat(e))).data}catch(e){return console.error("Failed to fetch user detail:",e),null}},[]),x=(0,t.useCallback)(async e=>{try{let s=await r.api.post("/users",e);return await u(),await m(),{success:!0,message:s.data.message}}catch(t){var s,a;let e=t instanceof Error?t.message:"Failed to invite user";return{success:!1,error:(null===(a=t.response)||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.detail)||e}}},[u,m]),f=(0,t.useCallback)(async(e,s)=>{try{let a=await r.api.put("/users/".concat(e),s);return await u(),{success:!0,message:a.data.message}}catch(s){var a,t;let e=s instanceof Error?s.message:"Failed to update user";return{success:!1,error:(null===(t=s.response)||void 0===t?void 0:null===(a=t.data)||void 0===a?void 0:a.detail)||e}}},[u]),p=(0,t.useCallback)(async e=>{try{let s=await r.api.delete("/users/".concat(e));return await u(),{success:!0,message:s.data.message}}catch(t){var s,a;let e=t instanceof Error?t.message:"Failed to remove user";return{success:!1,error:(null===(a=t.response)||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.detail)||e}}},[u]),g=(0,t.useCallback)(async(e,s)=>{try{let a=await r.api.post("/users/".concat(e,"/reset-password"),{new_password:s});return{success:!0,message:a.data.message}}catch(r){var a,t;let e=r instanceof Error?r.message:"Failed to reset password",s=null===(t=r.response)||void 0===t?void 0:null===(a=t.data)||void 0===a?void 0:a.detail;return{success:!1,error:"object"==typeof s&&(null==s?void 0:s.message)?s.message:"string"==typeof s?s:e}}},[]),v=(0,t.useCallback)(async e=>{try{let s=await r.api.post("/users/".concat(e,"/ban"),{});return await u(),{success:!0,message:s.data.message}}catch(r){var s,a;let e=r instanceof Error?r.message:"Failed to ban user",t=null===(a=r.response)||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.detail;return{success:!1,error:"object"==typeof t&&(null==t?void 0:t.message)?t.message:"string"==typeof t?t:e}}},[u]),j=(0,t.useCallback)(async e=>{try{let s=await r.api.post("/users/".concat(e,"/unban"),{});return await u(),{success:!0,message:s.data.message}}catch(r){var s,a;let e=r instanceof Error?r.message:"Failed to unban user",t=null===(a=r.response)||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.detail;return{success:!1,error:"object"==typeof t&&(null==t?void 0:t.message)?t.message:"string"==typeof t?t:e}}},[u]),b=(0,t.useCallback)(async e=>{try{let s=await r.api.delete("/users/invitations/".concat(e));return await m(),{success:!0,message:s.data.message}}catch(t){var s,a;let e=t instanceof Error?t.message:"Failed to cancel invitation";return{success:!1,error:(null===(a=t.response)||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.detail)||e}}},[m]),y=(0,t.useCallback)(async e=>{try{let s=await r.api.post("/users/invitations/".concat(e,"/resend"));return await m(),{success:!0,message:s.data.message}}catch(t){var s,a;let e=t instanceof Error?t.message:"Failed to resend invitation";return{success:!1,error:(null===(a=t.response)||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.detail)||e}}},[m]),w=(0,t.useCallback)(async()=>{await Promise.all([u(),m()])},[u,m]),N=(0,t.useCallback)(async e=>{try{let s=await r.api.post("/users/bulk/assign-groups",e);return await u(),s.data}catch(n){var s,a;let t=n instanceof Error?n.message:"Failed to bulk assign groups",r=(null===(a=n.response)||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.detail)||t;return{success:!1,total:e.user_ids.length,updated:0,failed:e.user_ids.length,errors:[{user_id:"all",error:r}],message:r}}},[u]),k=(0,t.useCallback)(async e=>{try{let s=await r.api.post("/users/bulk/assign-skills",e);return await u(),s.data}catch(n){var s,a;let t=n instanceof Error?n.message:"Failed to bulk assign skills",r=(null===(a=n.response)||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.detail)||t;return{success:!1,total:e.user_ids.length,updated:0,failed:e.user_ids.length,errors:[{user_id:"all",error:r}],message:r}}},[u]),C=(0,t.useCallback)(async e=>{try{let s=await r.api.post("/users/bulk/update-status",e);return await u(),s.data}catch(n){var s,a;let t=n instanceof Error?n.message:"Failed to bulk update status",r=(null===(a=n.response)||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.detail)||t;return{success:!1,total:e.user_ids.length,updated:0,failed:e.user_ids.length,errors:[{user_id:"all",error:r}],message:r}}},[u]),S=(0,t.useCallback)(async e=>{try{let s=await r.api.post("/users/bulk/update-enterprise-role",e);return await u(),s.data}catch(n){var s,a;let t=n instanceof Error?n.message:"Failed to bulk update enterprise role",r=(null===(a=n.response)||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.detail)||t;return{success:!1,total:e.user_ids.length,updated:0,failed:e.user_ids.length,errors:[{user_id:"all",error:r}],message:r}}},[u]),_=(0,t.useCallback)(async()=>{try{return(await r.api.get("/users/admin/overview")).data}catch(e){return console.error("Failed to fetch admin overview:",e),null}},[]);return(0,t.useEffect)(()=>{e.autoFetch&&(u(),m())},[e.autoFetch,u,m]),{users:s,invitations:n,loading:i,error:o,fetchUsers:u,fetchInvitations:m,getUserDetail
1:h,inviteUser:x,updateUser:f,removeUser:p,resetUserPassword:g,banUser:v,unbanUser:j,cancelInvitation:b,resendInvitation:y,refresh:w,bulkAssignGroups:N,bulkAssignSkills:k,bulkUpdateStatus:C,bulkUpdateEnterpriseRole:S,getAdminOverview:_}}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{autoFetch:!0,includePredefined:!0},[s,a]=(0,t.useState)([]),[n,l]=(0,t.useState)([]),[i,c]=(0,t.useState)([]),[o,d]=(0,t.useState)([]),[u,m]=(0,t.useState)(!0),[h,x]=(0,t.useState)(null),f=(0,t.useCallback)(async()=>{try{m(!0),x(null);let s=await r.api.get("/roles",{params:{include_predefined:e.includePredefined}});a(s.data)}catch(e){x(e instanceof Error?e.message:"Failed to fetch roles"),console.error("Failed to fetch roles:",e)}finally{m(!1)}},[e.includePredefined]),p=(0,t.useCallback)(async()=>{try{let e=await r.api.get("/enterprise-roles");l(e.data)}catch(e){console.error("Failed to fetch enterprise roles:",e)}},[]),g=(0,t.useCallback)(async()=>{try{let[e,s]=await Promise.all([r.api.get("/roles/permissions"),r.api.get("/roles/permissions/grouped")]);c(e.data),d(s.data)}catch(e){console.error("Failed to fetch permissions:",e)}},[]),v=(0,t.useCallback)(async e=>{try{return(await r.api.get("/roles/".concat(e))).data}catch(e){return console.error("Failed to fetch role:",e),null}},[]),j=(0,t.useCallback)(async e=>{try{let s=await r.api.post("/roles",e);return await f(),{success:!0,role:s.data}}catch(t){var s,a;let e=t instanceof Error?t.message:"Failed to create role";return{success:!1,error:(null===(a=t.response)||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.detail)||e}}},[f]),b=(0,t.useCallback)(async(e,s)=>{try{let a=await r.api.put("/roles/".concat(e),s);return await f(),{success:!0,role:a.data}}catch(s){var a,t;let e=s instanceof Error?s.message:"Failed to update role";return{success:!1,error:(null===(t=s.response)||void 0===t?void 0:null===(a=t.data)||void 0===a?void 0:a.detail)||e}}},[f]),y=(0,t.useCallback)(async e=>{try{return await r.api.delete("/roles/".concat(e)),await f(),{success:!0}}catch(t){var s,a;let e=t instanceof Error?t.message:"Failed to delete role";return{success:!1,error:(null===(a=t.response)||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.detail)||e}}},[f]),w=(0,t.useCallback)(async()=>{await Promise.all([f(),p(),g()])},[f,p,g]);return(0,t.useEffect)(()=>{e.autoFetch&&(f(),p(),g())},[e.autoFetch,f,p,g]),{roles:s,enterpriseRoles:n,permissions:i,permissionCategories:o,loading:u,error:h,fetchRoles:f,fetchEnterpriseRoles:p,fetchPermissions:g,getRole:v,createRole:j,updateRole:b,deleteRole:y,refresh:w}}}}]);

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.