@flexkit/studio 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/astro.js +1 -1
- package/dist/{chat-page-S2YGOKO5.js → chat-page-EXKQ2EYM.js} +3 -3
- package/dist/{chat-page-S2YGOKO5.js.map → chat-page-EXKQ2EYM.js.map} +1 -1
- package/dist/{chunk-6RDPFMLK.js → chunk-26UJ2WUB.js} +2 -2
- package/dist/{chunk-6RDPFMLK.js.map → chunk-26UJ2WUB.js.map} +1 -1
- package/dist/{chunk-TXK4OFAG.js → chunk-2AVINVYN.js} +4 -0
- package/dist/{chunk-LN55VJ35.js → chunk-EUGE3XWF.js} +3 -3
- package/dist/{chunk-LN55VJ35.js.map → chunk-EUGE3XWF.js.map} +1 -1
- package/dist/chunk-LP2JI25S.js +2 -0
- package/dist/chunk-LP2JI25S.js.map +1 -0
- package/dist/{chunk-NYKATVPZ.js → chunk-NDM2RAQE.js} +3 -3
- package/dist/{chunk-NYKATVPZ.js.map → chunk-NDM2RAQE.js.map} +1 -1
- package/dist/{chunk-SVZY7ZZD.js → chunk-NGO6CTAU.js} +3 -3
- package/dist/{chunk-SVZY7ZZD.js.map → chunk-NGO6CTAU.js.map} +1 -1
- package/dist/chunk-TYDYAOQ7.js +3 -0
- package/dist/chunk-TYDYAOQ7.js.map +1 -0
- package/dist/{chunk-2AHDTE5T.js → chunk-UM74MG43.js} +2 -2
- package/dist/{chunk-2AHDTE5T.js.map → chunk-UM74MG43.js.map} +1 -1
- package/dist/{chunk-NOFQHWES.js → chunk-UULO2DWJ.js} +2 -2
- package/dist/{chunk-NOFQHWES.js.map → chunk-UULO2DWJ.js.map} +1 -1
- package/dist/{chunk-7SK5YPHT.js → chunk-V64P56OA.js} +2 -2
- package/dist/{chunk-7SK5YPHT.js.map → chunk-V64P56OA.js.map} +1 -1
- package/dist/{chunk-J2G4C6I5.js → chunk-XWC47CBM.js} +2 -2
- package/dist/{chunk-J2G4C6I5.js.map → chunk-XWC47CBM.js.map} +1 -1
- package/dist/{chunk-KWS3NAYS.js → chunk-Y7ZSQPKF.js} +3 -3
- package/dist/{chunk-KWS3NAYS.js.map → chunk-Y7ZSQPKF.js.map} +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/{list-PNKQAYUK.js → list-WETJWRMH.js} +2 -2
- package/dist/{list-PNKQAYUK.js.map → list-WETJWRMH.js.map} +1 -1
- package/dist/nextjs.js +1 -1
- package/dist/pages-PIZB3YDN.js +3 -0
- package/dist/pages-PIZB3YDN.js.map +1 -0
- package/dist/{plugin-pages-SE52XFFW.js → plugin-pages-QLMZNHSK.js} +2 -2
- package/dist/{plugin-pages-SE52XFFW.js.map → plugin-pages-QLMZNHSK.js.map} +1 -1
- package/dist/{root-X5NDURAN.js → root-L4SMLNEV.js} +3 -3
- package/dist/{root-X5NDURAN.js.map → root-L4SMLNEV.js.map} +1 -1
- package/dist/{root-BH3PQS2H.js → root-N6PIMO2T.js} +3 -3
- package/dist/{root-BH3PQS2H.js.map → root-N6PIMO2T.js.map} +1 -1
- package/dist/{root-LFQA2VSE.js → root-QN7KVPCD.js} +2 -2
- package/dist/{root-LFQA2VSE.js.map → root-QN7KVPCD.js.map} +1 -1
- package/dist/{root-44ZJLA4E.js → root-R7URTGY7.js} +2 -2
- package/dist/{root-44ZJLA4E.js.map → root-R7URTGY7.js.map} +1 -1
- package/dist/{search-Q65IC67C.js → search-3LHBSNDF.js} +2 -2
- package/dist/{search-Q65IC67C.js.map → search-3LHBSNDF.js.map} +1 -1
- package/dist/{skills-pages-TWOIIU5J.js → skills-pages-ZN4LII2R.js} +2 -2
- package/dist/{skills-pages-TWOIIU5J.js.map → skills-pages-ZN4LII2R.js.map} +1 -1
- package/dist/tanstack-start.js +1 -1
- package/dist/{user-nav-QZTYBG45.js → user-nav-DCAHVWN7.js} +2 -2
- package/dist/{user-nav-QZTYBG45.js.map → user-nav-DCAHVWN7.js.map} +1 -1
- package/package.json +2 -2
- package/dist/chunk-3TGCCDOR.js +0 -2
- package/dist/chunk-3TGCCDOR.js.map +0 -1
- package/dist/chunk-NNA4MLFC.js +0 -3
- package/dist/chunk-NNA4MLFC.js.map +0 -1
- package/dist/pages-KHFSZ3PH.js +0 -3
- package/dist/pages-KHFSZ3PH.js.map +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import'./index.css';import {h,e}from'./chunk-
|
|
2
|
-
export{x as a,d as b,f as c,Re as d,De as e,Ze as f};//# sourceMappingURL=chunk-
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import'./index.css';import {h,e}from'./chunk-TYDYAOQ7.js';import {b as b$1}from'./chunk-U45E5X3H.js';import {createContext,lazy,Suspense,useMemo,useContext}from'react';import {Navigate,useParams}from'react-router-dom';import {Bot,Layout,FileStack,SquarePlay}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';import C,{mutate}from'swr';var d={name:"_asset",plural:"_assets",display:"originalFilename",menu:{hidden:true},attributes:[{name:"path",label:"Asset",scope:"global",options:{size:140},dataType:"string",inputType:"text",previewType:"assetPreviewField",defaultValue:""},{name:"originalFilename",label:"Filename",scope:"global",options:{size:320},dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"size",label:"Size",scope:"global",options:{size:120},dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"width",label:"Width",scope:"global",options:{size:90},dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"height",label:"Height",scope:"global",options:{size:100},dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"mimeType",label:"Mime Type",scope:"global",options:{size:160},dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"lqip",label:"lqip",scope:"global",hidden:true,dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"url",label:"URL",scope:"global",hidden:true,readOnly:true,dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"_updatedAt",label:"Updated At",scope:"global",options:{size:220},readOnly:true,hidden:true,dataType:"datetime",inputType:"datetime",previewType:"datetime",defaultValue:""},{name:"tags",label:"Tags",scope:"relationship",dataType:"string",inputType:"relationship",defaultValue:"",previewType:"tags",options:{size:300},relationship:{mode:"multiple",field:"name",entity:"_tag"}}]};var f={name:"_tag",plural:"_tags",display:"name",menu:{hidden:true},attributes:[{name:"name",label:"Tag Name",scope:"global",options:{size:220},dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"_updatedAt",label:"Updated At",scope:"global",options:{size:220},readOnly:true,hidden:true,dataType:"datetime",inputType:"datetime",previewType:"datetime",defaultValue:""},{name:"assets",label:"Assets",scope:"relationship",dataType:"string",inputType:"relationship",defaultValue:"",relationship:{mode:"multiple",field:"originalFilename",entity:"_asset"}}]};function x(){let{resolvedTheme:e}=b$1();return jsx("div",{className:"fk:flex fk:w-full fk:h-full fk:justify-center fk:items-center fk:bg-background",children:jsxs("div",{className:"fk:flex fk:flex-col fk:items-center",children:[e==="dark"?jsxs("svg",{className:"fk:h-8 fk:w-8 fk:animate-bounce",fill:"none",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M7 8H41V40H7V8Z",fill:"#020817"}),jsx("path",{d:"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z",fill:"white"})]}):jsxs("svg",{className:"fk:h-8 fk:w-8 fk:animate-bounce",fill:"none",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M7 8H41V40H7V8Z",fill:"white"}),jsx("path",{d:"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z",fill:"#020817"})]}),jsx("div",{className:"fk:text-foreground fk:text-center fk:mt-4 fk:animate-pulse",children:"Loading..."})]})})}var _=Navigate;function o(e){let t=lazy(e);return jsx(Suspense,{fallback:jsx(x,{}),children:jsx(t,{})})}var B=o(()=>import('./root-QN7KVPCD.js').then(e=>({default:e.Root}))),J=o(()=>import('./list-WETJWRMH.js').then(e=>({default:e.List}))),W=o(()=>import('./edit-entity-PVT34FD7.js').then(e=>({default:e.EditEntity}))),X=o(()=>import('./root-L4SMLNEV.js').then(e=>({default:e.Root}))),q=o(()=>import('./root-N6PIMO2T.js').then(e=>({default:e.Root}))),K=o(()=>import('./root-R7URTGY7.js').then(e=>({default:e.Root}))),$=o(()=>import('./plugin-pages-QLMZNHSK.js').then(e=>({default:e.PluginsPage}))),G=o(()=>import('./plugin-pages-QLMZNHSK.js').then(e=>({default:e.InstalledPluginsPage}))),Q=o(()=>import('./plugin-pages-QLMZNHSK.js').then(e=>({default:e.PluginDetailPage}))),T=o(()=>import('./chat-page-EXKQ2EYM.js').then(e=>({default:e.AgentChatPage}))),Y=o(()=>import('./pages-PIZB3YDN.js').then(e=>({default:e.AutomationsPage}))),ee=o(()=>import('./pages-PIZB3YDN.js').then(e=>({default:e.RunHistoryPage}))),te=o(()=>import('./pages-PIZB3YDN.js').then(e=>({default:e.ApprovalsPage}))),oe=o(()=>import('./pages-PIZB3YDN.js').then(e=>({default:e.ActivityPage}))),ae=o(()=>import('./pages-PIZB3YDN.js').then(e=>({default:e.ActivityItemPage}))),ne=o(()=>import('./pages-PIZB3YDN.js').then(e=>({default:e.CreateAutomationPage}))),ie=o(()=>import('./pages-PIZB3YDN.js').then(e=>({default:e.AutomationDetailPage}))),re=o(()=>import('./pages-PIZB3YDN.js').then(e=>({default:e.RunsPage}))),se=o(()=>import('./pages-PIZB3YDN.js').then(e=>({default:e.RunDetailPage}))),pe=o(()=>import('./skills-pages-ZN4LII2R.js').then(e=>({default:e.SkillsPage}))),ce=o(()=>import('./skills-pages-ZN4LII2R.js').then(e=>({default:e.CreateSkillPage}))),le=o(()=>import('./skills-pages-ZN4LII2R.js').then(e=>({default:e.SkillDetailPage}))),l=[{name:"ai",icon:jsx(Bot,{strokeWidth:1.5}),title:"AI",component:K,routes:[{path:"plugins",component:$},{path:"plugins/installed",component:G},{path:"plugins/:pluginId",component:Q},{component:jsx(_,{replace:true,to:"agent"}),path:""},{component:T,path:"agent"},{component:T,path:"agent/chats/:chatId"},{component:Y,path:"automations"},{component:ee,path:"runs"},{component:te,path:"approvals"},{component:oe,path:"activity"},{component:ae,path:"activity/:itemId"},{component:ne,path:"automations/new"},{component:ie,path:"automations/:automationId"},{component:re,path:"automations/:automationId/runs"},{component:se,path:"automations/:automationId/runs/:runId"},{component:pe,path:"skills"},{component:ce,path:"skills/new"},{component:le,path:"skills/:skillId"}]},{name:"desk",icon:jsx(Layout,{strokeWidth:1.5}),title:"Desk",component:B,routes:[{path:"list/:entity",component:J,children:[{path:"edit/:id",component:W}]}]},{name:"asset-manager",icon:jsx(FileStack,{strokeWidth:1.5}),title:"Asset Manager",component:X,routes:[]},{name:"explorer",icon:jsx(SquarePlay,{strokeWidth:1.5}),title:"Explorer",component:q,routes:[]}];async function b(e$1){try{let t=await fetch(e(e$1).schema,{credentials:"include",mode:"cors"});if(!t.ok){let n=t.statusText||`Request failed with status ${String(t.status)}`;try{let i=await t.json();n=i.error??i.message??n;}catch{}return {ok:!1,projectId:e$1,error:{status:t.status,message:n}}}let a=await t.json();return {ok:!0,project:{...a,projectId:a.projectId||e$1}}}catch(t){return {ok:false,projectId:e$1,error:{status:0,message:t instanceof Error?t.message:"Network error"}}}}function w(e,t){let a=[],n={};for(let i of e??[])i.ok?a.push(i.project):n[i.projectId]=i.error;return {projects:a,errors:n,isLoading:t}}function A(e,t){let a=t&&e.length>0?["project-schemas",t,...e]:null,{data:n,isLoading:i}=C(a,()=>Promise.all(e.map(s=>b(s))),{revalidateOnFocus:false,revalidateOnReconnect:false});return w(n,!!a&&(i||n===void 0))}function ue(e,t){return w(e?[e]:void 0,t)}function L(e,t){let a=t&&e?["project-schema",t,e]:null,{data:n,isLoading:i}=C(a,()=>b(e??""),{revalidateOnFocus:false,revalidateOnReconnect:false});return ue(n,!!a&&(i||n===void 0))}function de(e,t){return Array.isArray(e)&&(e[0]==="project-schema"||e[0]==="project-schemas")&&e.slice(2).includes(t)}function Re(e){return mutate(t=>de(t,e))}var I=createContext({mode:"projects",apps:l,contributions:{apps:l},currentProjectId:void 0,currentProject:void 0,currentProjectSchema:[],projects:[],projectIds:[],projectSummaries:[],schemaErrors:{},isLoadingSchemas:false});function ye(e){return [...e.filter(a=>a.name!==d.name&&a.name!==f.name),d,f]}function De({projectIds:e,projectSummaries:t=[],mode:a="projects",userId:n,children:i}){let{projectId:s}=useParams(),[,R]=h(),h$1=R.user?.id??n,V=A(a==="projects"?e:[],h$1),O=L(a==="hosted"&&s&&e.includes(s)?s:void 0,h$1),{projects:y,errors:P,isLoading:S}=a==="hosted"?O:V,m=useMemo(()=>e.map(r=>y.find(u=>u.projectId===r)).filter(r=>r!==void 0).map(r=>({...r,schema:ye(r.schema)})),[y,e]),H=useMemo(()=>{let r=m.find(u=>u.projectId===s);return {mode:a,apps:l,contributions:{apps:l},currentProjectId:s,currentProject:r,currentProjectSchema:r?.schema??[],projects:m,projectIds:e,projectSummaries:t,schemaErrors:P,isLoadingSchemas:S}},[s,P,S,a,e,t,m]);return jsx(I.Provider,{value:H,children:i})}function Ze(){return useContext(I)}
|
|
2
|
+
export{x as a,d as b,f as c,Re as d,De as e,Ze as f};//# sourceMappingURL=chunk-EUGE3XWF.js.map
|
|
3
|
+
//# sourceMappingURL=chunk-EUGE3XWF.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/entities/assets-schema.ts","../src/entities/tags-schema.ts","../src/ui/components/loading.tsx","../src/core/apps/built-in-apps.tsx","../src/core/config/use-project-schemas.ts","../src/core/config/config-context.tsx"],"names":["assetSchema","tagSchema","Loading","resolvedTheme","useTheme","jsx","jsxs","NavigateCompat","Navigate","lazyElement","loader","Component","lazy","Suspense","deskRoot","m","deskList","deskEditEntity","assetManagerRoot","explorerRoot","aiRoot","aiPluginsPage","aiInstalledPluginsPage","aiPluginDetailPage","aiAgentChatPage","aiAutomationsPage","aiRunHistoryPage","aiApprovalsPage","aiActivityPage","aiActivityItemPage","aiCreateAutomationPage","aiAutomationDetailPage","aiRunsPage","aiRunDetailPage","aiSkillsPage","aiCreateSkillPage","aiSkillDetailPage","builtInApps","BotIcon","LayoutIcon","FileStackIcon","SquarePlayIcon","fetchProjectSchema","projectId","response","apiPaths","message","body","project","error","toProjectSchemasState","outcomes","isLoading","projects","errors","outcome","useProjectSchemas","projectIds","userId","key","data","useSWR","toProjectSchemaState","useProjectSchema","isProjectSchemaKey","revalidateProjectSchema","mutate","ConfigContext","createContext","upsertReservedEntities","schema","entity","ConfigProvider","projectSummaries","mode","children","currentProjectId","useParams","auth","useAuth","schemaUserId","allSchemas","currentSchema","loadedProjects","useMemo","value","currentProject","useConfig","useContext"],"mappings":"yVAEO,IAAMA,CAAAA,CAAsB,CACjC,IAAA,CAAM,QAAA,CACN,OAAQ,SAAA,CACR,OAAA,CAAS,mBACT,IAAA,CAAM,CACJ,OAAQ,IACV,CAAA,CACA,WAAY,CACV,CACE,KAAM,MAAA,CACN,KAAA,CAAO,QACP,KAAA,CAAO,QAAA,CACP,QAAS,CACP,IAAA,CAAM,GACR,CAAA,CACA,QAAA,CAAU,SACV,SAAA,CAAW,MAAA,CACX,YAAa,mBAAA,CACb,YAAA,CAAc,EAChB,CAAA,CACA,CACE,KAAM,kBAAA,CACN,KAAA,CAAO,WACP,KAAA,CAAO,QAAA,CACP,QAAS,CACP,IAAA,CAAM,GACR,CAAA,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A,CAAkBpB,CAAQ,CAAC,CAAA,CAEtF,OAAOhD,GAAAA,CAAC8D,CAAAA,CAAc,SAAd,CAAuB,KAAA,CAAOkB,EAAQ,QAAA,CAAAV,CAAAA,CAAS,CACzD,CAEO,SAASY,IAA2B,CACzC,OAAOC,UAAAA,CAAWrB,CAAa,CACjC","file":"chunk-LN55VJ35.js","sourcesContent":["import type { Entity } from '../core/types';\n\nexport const assetSchema: Entity = {\n name: '_asset',\n plural: '_assets',\n display: 'originalFilename',\n menu: {\n hidden: true,\n },\n attributes: [\n {\n name: 'path',\n label: 'Asset',\n scope: 'global',\n options: {\n size: 140,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'assetPreviewField',\n defaultValue: '',\n },\n {\n name: 'originalFilename',\n label: 'Filename',\n scope: 'global',\n options: {\n size: 320,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'size',\n label: 'Size',\n scope: 'global',\n options: {\n size: 120,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'width',\n label: 'Width',\n scope: 'global',\n options: {\n size: 90,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'height',\n label: 'Height',\n scope: 'global',\n options: {\n size: 100,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'mimeType',\n label: 'Mime Type',\n scope: 'global',\n options: {\n size: 160,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'lqip',\n label: 'lqip',\n scope: 'global',\n hidden: true,\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'url',\n label: 'URL',\n scope: 'global',\n hidden: true,\n readOnly: true,\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: '_updatedAt',\n label: 'Updated At',\n scope: 'global',\n options: {\n size: 220,\n },\n readOnly: true,\n hidden: true,\n dataType: 'datetime',\n inputType: 'datetime',\n previewType: 'datetime',\n defaultValue: '',\n },\n {\n name: 'tags',\n label: 'Tags',\n scope: 'relationship',\n dataType: 'string',\n inputType: 'relationship',\n defaultValue: '',\n previewType: 'tags',\n options: {\n size: 300,\n },\n relationship: {\n mode: 'multiple',\n field: 'name',\n entity: '_tag',\n },\n },\n ],\n};\n","import type { Entity } from '../core/types';\n\nexport const tagSchema: Entity = {\n name: '_tag',\n plural: '_tags',\n display: 'name',\n menu: {\n hidden: true,\n },\n attributes: [\n {\n name: 'name',\n label: 'Tag Name',\n scope: 'global',\n options: {\n size: 220,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: '_updatedAt',\n label: 'Updated At',\n scope: 'global',\n options: {\n size: 220,\n },\n readOnly: true,\n hidden: true,\n dataType: 'datetime',\n inputType: 'datetime',\n previewType: 'datetime',\n defaultValue: '',\n },\n {\n name: 'assets',\n label: 'Assets',\n scope: 'relationship',\n dataType: 'string',\n inputType: 'relationship',\n defaultValue: '',\n relationship: {\n mode: 'multiple',\n field: 'originalFilename',\n entity: '_asset',\n },\n },\n ],\n};\n","import type { JSX } from 'react';\nimport { useTheme } from '../theme-context';\n\nexport function Loading(): JSX.Element {\n const { resolvedTheme } = useTheme();\n\n return (\n <div className=\"fk:flex fk:w-full fk:h-full fk:justify-center fk:items-center fk:bg-background\">\n <div className=\"fk:flex fk:flex-col fk:items-center\">\n {resolvedTheme === 'dark' ? (\n <svg\n className=\"fk:h-8 fk:w-8 fk:animate-bounce\"\n fill=\"none\"\n viewBox=\"0 0 48 48\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M7 8H41V40H7V8Z\" fill=\"#020817\" />\n <path\n d=\"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z\"\n fill=\"white\"\n />\n </svg>\n ) : (\n <svg\n className=\"fk:h-8 fk:w-8 fk:animate-bounce\"\n fill=\"none\"\n viewBox=\"0 0 48 48\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M7 8H41V40H7V8Z\" fill=\"white\" />\n <path\n d=\"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z\"\n fill=\"#020817\"\n />\n </svg>\n )}\n <div className=\"fk:text-foreground fk:text-center fk:mt-4 fk:animate-pulse\">Loading...</div>\n </div>\n </div>\n );\n}\n","import { lazy, Suspense } from 'react';\nimport type { ComponentType, JSX } from 'react';\nimport {\n Bot as BotIcon,\n FileStack as FileStackIcon,\n Layout as LayoutIcon,\n SquarePlay as SquarePlayIcon,\n} from 'lucide-react';\nimport { Navigate } from 'react-router-dom';\nimport { Loading } from '../../ui/components/loading';\nimport type { AppOptions } from '../config/types';\n\nconst NavigateCompat = Navigate as unknown as ComponentType<{\n replace?: boolean;\n to: string;\n}>;\n\n/**\n * Wraps a lazily imported component in Suspense so each built-in app (and each of its routes)\n * is only downloaded when it is first rendered.\n */\nfunction lazyElement(loader: () => Promise<{ default: ComponentType }>): JSX.Element {\n const Component = lazy(loader);\n\n return (\n <Suspense fallback={<Loading />}>\n <Component />\n </Suspense>\n );\n}\n\n// Desk\nconst deskRoot = lazyElement(() => import('../../apps/desk/root').then((m) => ({ default: m.Root })));\nconst deskList = lazyElement(() => import('../../apps/desk/list').then((m) => ({ default: m.List })));\nconst deskEditEntity = lazyElement(() =>\n import('../../apps/desk/edit-entity').then((m) => ({ default: m.EditEntity }))\n);\n\n// Asset Manager\nconst assetManagerRoot = lazyElement(() =>\n import('../../apps/asset-manager/root').then((m) => ({ default: m.Root }))\n);\n\n// Explorer\nconst explorerRoot = lazyElement(() => import('../../apps/explorer/root').then((m) => ({ default: m.Root })));\n\n// AI\nconst aiRoot = lazyElement(() => import('../../apps/ai/root').then((m) => ({ default: m.Root })));\nconst aiPluginsPage = lazyElement(() =>\n import('../../apps/ai/plugin-pages').then((m) => ({ default: m.PluginsPage }))\n);\nconst aiInstalledPluginsPage = lazyElement(() =>\n import('../../apps/ai/plugin-pages').then((m) => ({ default: m.InstalledPluginsPage }))\n);\nconst aiPluginDetailPage = lazyElement(() =>\n import('../../apps/ai/plugin-pages').then((m) => ({ default: m.PluginDetailPage }))\n);\nconst aiAgentChatPage = lazyElement(() =>\n import('../../apps/ai/agent/chat-page').then((m) => ({ default: m.AgentChatPage }))\n);\nconst aiAutomationsPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.AutomationsPage }))\n);\nconst aiRunHistoryPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.RunHistoryPage }))\n);\nconst aiApprovalsPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.ApprovalsPage })));\nconst aiActivityPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.ActivityPage })));\nconst aiActivityItemPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.ActivityItemPage }))\n);\nconst aiCreateAutomationPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.CreateAutomationPage }))\n);\nconst aiAutomationDetailPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.AutomationDetailPage }))\n);\nconst aiRunsPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.RunsPage })));\nconst aiRunDetailPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.RunDetailPage })));\nconst aiSkillsPage = lazyElement(() =>\n import('../../apps/ai/skills-pages').then((m) => ({ default: m.SkillsPage }))\n);\nconst aiCreateSkillPage = lazyElement(() =>\n import('../../apps/ai/skills-pages').then((m) => ({ default: m.CreateSkillPage }))\n);\nconst aiSkillDetailPage = lazyElement(() =>\n import('../../apps/ai/skills-pages').then((m) => ({ default: m.SkillDetailPage }))\n);\n\nexport const builtInApps: AppOptions[] = [\n {\n name: 'ai',\n icon: <BotIcon strokeWidth={1.5} />,\n title: 'AI',\n component: aiRoot,\n routes: [\n { path: 'plugins', component: aiPluginsPage },\n { path: 'plugins/installed', component: aiInstalledPluginsPage },\n { path: 'plugins/:pluginId', component: aiPluginDetailPage },\n {\n component: <NavigateCompat replace to=\"agent\" />,\n path: '',\n },\n {\n component: aiAgentChatPage,\n path: 'agent',\n },\n {\n component: aiAgentChatPage,\n path: 'agent/chats/:chatId',\n },\n {\n component: aiAutomationsPage,\n path: 'automations',\n },\n {\n component: aiRunHistoryPage,\n path: 'runs',\n },\n {\n component: aiApprovalsPage,\n path: 'approvals',\n },\n {\n component: aiActivityPage,\n path: 'activity',\n },\n {\n component: aiActivityItemPage,\n path: 'activity/:itemId',\n },\n {\n component: aiCreateAutomationPage,\n path: 'automations/new',\n },\n {\n component: aiAutomationDetailPage,\n path: 'automations/:automationId',\n },\n {\n component: aiRunsPage,\n path: 'automations/:automationId/runs',\n },\n {\n component: aiRunDetailPage,\n path: 'automations/:automationId/runs/:runId',\n },\n {\n component: aiSkillsPage,\n path: 'skills',\n },\n {\n component: aiCreateSkillPage,\n path: 'skills/new',\n },\n {\n component: aiSkillDetailPage,\n path: 'skills/:skillId',\n },\n ],\n },\n {\n name: 'desk',\n icon: <LayoutIcon strokeWidth={1.5} />,\n title: 'Desk',\n component: deskRoot,\n routes: [\n {\n path: 'list/:entity',\n component: deskList,\n children: [\n {\n path: 'edit/:id',\n component: deskEditEntity, // Not used, left here as an example of how to nest routes in apps\n },\n ],\n },\n ],\n },\n {\n name: 'asset-manager',\n icon: <FileStackIcon strokeWidth={1.5} />,\n title: 'Asset Manager',\n component: assetManagerRoot,\n routes: [],\n },\n {\n name: 'explorer',\n icon: <SquarePlayIcon strokeWidth={1.5} />,\n title: 'Explorer',\n component: explorerRoot,\n routes: [],\n },\n];\n","'use client';\n\nimport useSWR, { mutate } from 'swr';\nimport { apiPaths } from '../api-paths';\nimport type { ProjectSchemaError, ProjectUiConfig } from './types';\n\nexport type ProjectSchemasState = {\n projects: ProjectUiConfig[];\n errors: { [projectId: string]: ProjectSchemaError };\n isLoading: boolean;\n};\n\ntype FetchOutcome = { ok: true; project: ProjectUiConfig } | { ok: false; projectId: string; error: ProjectSchemaError };\n\nasync function fetchProjectSchema(projectId: string): Promise<FetchOutcome> {\n try {\n const response = await fetch(apiPaths(projectId).schema, { credentials: 'include', mode: 'cors' });\n\n if (!response.ok) {\n let message = response.statusText || `Request failed with status ${String(response.status)}`;\n\n try {\n const body = (await response.json()) as { error?: string; message?: string };\n message = body.error ?? body.message ?? message;\n } catch {\n // keep the status text\n }\n\n return { ok: false, projectId, error: { status: response.status, message } };\n }\n\n const project = (await response.json()) as ProjectUiConfig;\n\n return { ok: true, project: { ...project, projectId: project.projectId || projectId } };\n } catch (error) {\n return {\n ok: false,\n projectId,\n error: { status: 0, message: error instanceof Error ? error.message : 'Network error' },\n };\n }\n}\n\nexport function toProjectSchemasState(outcomes: FetchOutcome[] | undefined, isLoading: boolean): ProjectSchemasState {\n const projects: ProjectUiConfig[] = [];\n const errors: { [projectId: string]: ProjectSchemaError } = {};\n\n for (const outcome of outcomes ?? []) {\n if (outcome.ok) {\n projects.push(outcome.project);\n } else {\n errors[outcome.projectId] = outcome.error;\n }\n }\n\n return { projects, errors, isLoading };\n}\n\n/**\n * Loads the deployed schema of every project the Studio can open. Fetching\n * starts once the user is known (the endpoint needs a session) and the result\n * is kept for the lifetime of the page: schemas only change on deploy.\n */\nexport function useProjectSchemas(projectIds: string[], userId: string | undefined): ProjectSchemasState {\n const key = userId && projectIds.length > 0 ? ['project-schemas', userId, ...projectIds] : null;\n const { data, isLoading } = useSWR(key, () => Promise.all(projectIds.map((projectId) => fetchProjectSchema(projectId))), {\n revalidateOnFocus: false,\n revalidateOnReconnect: false,\n });\n\n return toProjectSchemasState(data, Boolean(key) && (isLoading || data === undefined));\n}\n\n/** State of a single project's schema, in the same shape as the multi-project hook. */\nexport function toProjectSchemaState(outcome: FetchOutcome | undefined, isLoading: boolean): ProjectSchemasState {\n return toProjectSchemasState(outcome ? [outcome] : undefined, isLoading);\n}\n\n/**\n * Hosted mode: loads only the project currently open. Each project has its own\n * SWR key, so switching back to a project reuses the schema already fetched.\n */\nexport function useProjectSchema(projectId: string | undefined, userId: string | undefined): ProjectSchemasState {\n const key = userId && projectId ? ['project-schema', userId, projectId] : null;\n const { data, isLoading } = useSWR(key, () => fetchProjectSchema(projectId ?? ''), {\n revalidateOnFocus: false,\n revalidateOnReconnect: false,\n });\n\n return toProjectSchemaState(data, Boolean(key) && (isLoading || data === undefined));\n}\n\n/** True for the SWR keys that hold `projectId`'s schema (single- and multi-project hooks). */\nexport function isProjectSchemaKey(key: unknown, projectId: string): boolean {\n return (\n Array.isArray(key) &&\n (key[0] === 'project-schema' || key[0] === 'project-schemas') &&\n key.slice(2).includes(projectId)\n );\n}\n\n/** Refetches the deployed schema of `projectId`, e.g. after the agent deployed a schema change. */\nexport function revalidateProjectSchema(projectId: string): Promise<unknown> {\n return mutate((key) => isProjectSchemaKey(key, projectId));\n}\n","'use client';\n\nimport { createContext, useContext, useMemo } from 'react';\nimport type { JSX } from 'react';\nimport { useParams } from 'react-router-dom';\nimport { useAuth } from '../../auth/auth-context';\nimport { assetSchema } from '../../entities/assets-schema';\nimport { tagSchema } from '../../entities/tags-schema';\nimport { builtInApps } from '../apps/built-in-apps';\nimport type { AppOptions, ProjectSchemaError, ProjectSummary, ProjectUiConfig, StudioMode } from './types';\nimport type { Entity } from '../types';\nimport { useProjectSchema, useProjectSchemas } from './use-project-schemas';\n\nexport interface ConfigContext {\n /** `projects` when the host passed `projectIds`, `hosted` when the Studio listed the user's projects itself. */\n mode: StudioMode;\n /** The Studio apps shown in the app bar, in order. */\n apps: AppOptions[];\n /** Kept for callers that read `contributions.apps`; same list as `apps`. */\n contributions: {\n apps: AppOptions[];\n };\n currentProjectId?: string;\n /** The project named by the `:projectId` route param, once its schema has loaded. */\n currentProject?: ProjectUiConfig;\n currentProjectSchema: Entity[];\n /** Projects whose schema loaded, in `projectIds` order. */\n projects: ProjectUiConfig[];\n /** Every project id the Studio can open, loaded or not. */\n projectIds: string[];\n /** Hosted mode: name, avatar, role and team of each project, known before any schema loads. */\n projectSummaries: ProjectSummary[];\n /** Per project id: why its schema could not be loaded. */\n schemaErrors: { [projectId: string]: ProjectSchemaError };\n isLoadingSchemas: boolean;\n}\n\nconst ConfigContext = createContext<ConfigContext>({\n mode: 'projects',\n apps: builtInApps,\n contributions: { apps: builtInApps },\n currentProjectId: undefined,\n currentProject: undefined,\n currentProjectSchema: [],\n projects: [],\n projectIds: [],\n projectSummaries: [],\n schemaErrors: {},\n isLoadingSchemas: false,\n});\n\n/** Appends the reserved asset and tag entities to a deployed schema. */\nexport function upsertReservedEntities(schema: Entity[]): Entity[] {\n const withoutReserved = schema.filter((entity) => entity.name !== assetSchema.name && entity.name !== tagSchema.name);\n\n return [...withoutReserved, assetSchema, tagSchema];\n}\n\nexport function ConfigProvider({\n projectIds,\n projectSummaries = [],\n mode = 'projects',\n userId,\n children,\n}: {\n projectIds: string[];\n projectSummaries?: ProjectSummary[];\n mode?: StudioMode;\n /** Hosted mode: the signed-in user's id, known before the per-project `/users/me` call. */\n userId?: string;\n children: React.ReactNode;\n}): JSX.Element {\n /**\n * Getting the projectId from the URL via react-router-dom's useParams hook triggers a rerender of this Context\n * every time the URL changes.\n */\n const { projectId: currentProjectId } = useParams<{ projectId: string }>();\n const [, auth] = useAuth();\n const schemaUserId = auth.user?.id ?? userId;\n // Project mode loads every project up front (short, host-defined list); hosted mode only the one open.\n const allSchemas = useProjectSchemas(mode === 'projects' ? projectIds : [], schemaUserId);\n const currentSchema = useProjectSchema(\n mode === 'hosted' && currentProjectId && projectIds.includes(currentProjectId) ? currentProjectId : undefined,\n schemaUserId\n );\n const { projects: loadedProjects, errors, isLoading } = mode === 'hosted' ? currentSchema : allSchemas;\n const projects = useMemo(\n () =>\n projectIds\n .map((projectId) => loadedProjects.find((project) => project.projectId === projectId))\n .filter((project): project is ProjectUiConfig => project !== undefined)\n .map((project) => ({ ...project, schema: upsertReservedEntities(project.schema) })),\n [loadedProjects, projectIds]\n );\n\n const value = useMemo<ConfigContext>(() => {\n const currentProject = projects.find((project) => project.projectId === currentProjectId);\n\n return {\n mode,\n apps: builtInApps,\n contributions: { apps: builtInApps },\n currentProjectId,\n currentProject,\n currentProjectSchema: currentProject?.schema ?? [],\n projects,\n projectIds,\n projectSummaries,\n schemaErrors: errors,\n isLoadingSchemas: isLoading,\n };\n }, [currentProjectId, errors, isLoading, mode, projectIds, projectSummaries, projects]);\n\n return <ConfigContext.Provider value={value}>{children}</ConfigContext.Provider>;\n}\n\nexport function useConfig(): ConfigContext {\n return useContext(ConfigContext);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/entities/assets-schema.ts","../src/entities/tags-schema.ts","../src/ui/components/loading.tsx","../src/core/apps/built-in-apps.tsx","../src/core/config/use-project-schemas.ts","../src/core/config/config-context.tsx"],"names":["assetSchema","tagSchema","Loading","resolvedTheme","useTheme","jsx","jsxs","NavigateCompat","Navigate","lazyElement","loader","Component","lazy","Suspense","deskRoot","m","deskList","deskEditEntity","assetManagerRoot","explorerRoot","aiRoot","aiPluginsPage","aiInstalledPluginsPage","aiPluginDetailPage","aiAgentChatPage","aiAutomationsPage","aiRunHistoryPage","aiApprovalsPage","aiActivityPage","aiActivityItemPage","aiCreateAutomationPage","aiAutomationDetailPage","aiRunsPage","aiRunDetailPage","aiSkillsPage","aiCreateSkillPage","aiSkillDetailPage","builtInApps","BotIcon","LayoutIcon","FileStackIcon","SquarePlayIcon","fetchProjectSchema","projectId","response","apiPaths","message","body","project","error","toProjectSchemasState","outcomes","isLoading","projects","errors","outcome","useProjectSchemas","projectIds","userId","key","data","useSWR","toProjectSchemaState","useProjectSchema","isProjectSchemaKey","revalidateProjectSchema","mutate","ConfigContext","createContext","upsertReservedEntities","schema","entity","ConfigProvider","projectSummaries","mode","children","currentProjectId","useParams","auth","useAuth","schemaUserId","allSchemas","currentSchema","loadedProjects","useMemo","value","currentProject","useConfig","useContext"],"mappings":"yVAEO,IAAMA,CAAAA,CAAsB,CACjC,IAAA,CAAM,QAAA,CACN,OAAQ,SAAA,CACR,OAAA,CAAS,mBACT,IAAA,CAAM,CACJ,OAAQ,IACV,CAAA,CACA,WAAY,CACV,CACE,KAAM,MAAA,CACN,KAAA,CAAO,QACP,KAAA,CAAO,QAAA,CACP,QAAS,CACP,IAAA,CAAM,GACR,CAAA,CACA,QAAA,CAAU,SACV,SAAA,CAAW,MAAA,CACX,YAAa,mBAAA,CACb,YAAA,CAAc,EAChB,CAAA,CACA,CACE,KAAM,kBAAA,CACN,KAAA,CAAO,WACP,KAAA,CAAO,QAAA,CACP,QAAS,CACP,IAAA,CAAM,GACR,CAAA,CACA,QAAA,CAAU,SACV,SAAA,CAAW,MAAA,CACX,YAAa,MAAA,CACb,YAAA,CAAc,EAChB,CAAA,CACA,CACE,KAAM,MAAA,CACN,KAAA,CAAO,OACP,KAAA,CAAO,QAAA,CACP,QAAS,CACP,IAAA,CAAM,GACR,CAAA,CACA,QAAA,CAAU,MACV,SAAA,CAAW,MAAA,CACX,YAAa,MAAA,CACb,YAAA,CAAc,EAChB,CAAA,CACA,CACE,KAAM,OAAA,CACN,KAAA,CAAO,QACP,KAAA,CAAO,QAAA,CACP,QAAS,CACP,IAAA,CAAM,EACR,CAAA,CACA,QAAA,CAAU,KAAA,CACV,SAAA,CAAW,MAAA,CACX,WAAA,CAAa,OACb,YA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A,CAAAA,CAAQ,SAAA,GAAcL,CAAS,CAAC,CAAA,CACpF,MAAA,CAAQK,GAAwCA,CAAAA,GAAY,MAAS,EACrE,GAAA,CAAKA,CAAAA,GAAa,CAAE,GAAGA,CAAAA,CAAS,OAAQqB,EAAAA,CAAuBrB,CAAAA,CAAQ,MAAM,CAAE,CAAA,CAAE,EACtF,CAACmC,CAAAA,CAAgB1B,CAAU,CAC7B,CAAA,CAEM4B,EAAQD,OAAAA,CAAuB,IAAM,CACzC,IAAME,CAAAA,CAAiBjC,EAAS,IAAA,CAAML,CAAAA,EAAYA,EAAQ,SAAA,GAAc4B,CAAgB,EAExF,OAAO,CACL,KAAAF,CAAAA,CACA,IAAA,CAAMrC,EACN,aAAA,CAAe,CAAE,IAAA,CAAMA,CAAY,CAAA,CACnC,gBAAA,CAAAuC,EACA,cAAA,CAAAU,CAAAA,CACA,qBAAsBA,CAAAA,EAAgB,MAAA,EAAU,EAAC,CACjD,QAAA,CAAAjC,EACA,UAAA,CAAAI,CAAAA,CACA,iBAAAgB,CAAAA,CACA,YAAA,CAAcnB,EACd,gBAAA,CAAkBF,CACpB,CACF,CAAA,CAAG,CAACwB,EAAkBtB,CAAAA,CAAQF,CAAAA,CAAWsB,EAAMjB,CAAAA,CAAYgB,CAAAA,CAAkBpB,CAAQ,CAAC,CAAA,CAEtF,OAAOhD,GAAAA,CAAC8D,CAAAA,CAAc,SAAd,CAAuB,KAAA,CAAOkB,EAAQ,QAAA,CAAAV,CAAAA,CAAS,CACzD,CAEO,SAASY,IAA2B,CACzC,OAAOC,UAAAA,CAAWrB,CAAa,CACjC","file":"chunk-EUGE3XWF.js","sourcesContent":["import type { Entity } from '../core/types';\n\nexport const assetSchema: Entity = {\n name: '_asset',\n plural: '_assets',\n display: 'originalFilename',\n menu: {\n hidden: true,\n },\n attributes: [\n {\n name: 'path',\n label: 'Asset',\n scope: 'global',\n options: {\n size: 140,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'assetPreviewField',\n defaultValue: '',\n },\n {\n name: 'originalFilename',\n label: 'Filename',\n scope: 'global',\n options: {\n size: 320,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'size',\n label: 'Size',\n scope: 'global',\n options: {\n size: 120,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'width',\n label: 'Width',\n scope: 'global',\n options: {\n size: 90,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'height',\n label: 'Height',\n scope: 'global',\n options: {\n size: 100,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'mimeType',\n label: 'Mime Type',\n scope: 'global',\n options: {\n size: 160,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'lqip',\n label: 'lqip',\n scope: 'global',\n hidden: true,\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'url',\n label: 'URL',\n scope: 'global',\n hidden: true,\n readOnly: true,\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: '_updatedAt',\n label: 'Updated At',\n scope: 'global',\n options: {\n size: 220,\n },\n readOnly: true,\n hidden: true,\n dataType: 'datetime',\n inputType: 'datetime',\n previewType: 'datetime',\n defaultValue: '',\n },\n {\n name: 'tags',\n label: 'Tags',\n scope: 'relationship',\n dataType: 'string',\n inputType: 'relationship',\n defaultValue: '',\n previewType: 'tags',\n options: {\n size: 300,\n },\n relationship: {\n mode: 'multiple',\n field: 'name',\n entity: '_tag',\n },\n },\n ],\n};\n","import type { Entity } from '../core/types';\n\nexport const tagSchema: Entity = {\n name: '_tag',\n plural: '_tags',\n display: 'name',\n menu: {\n hidden: true,\n },\n attributes: [\n {\n name: 'name',\n label: 'Tag Name',\n scope: 'global',\n options: {\n size: 220,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: '_updatedAt',\n label: 'Updated At',\n scope: 'global',\n options: {\n size: 220,\n },\n readOnly: true,\n hidden: true,\n dataType: 'datetime',\n inputType: 'datetime',\n previewType: 'datetime',\n defaultValue: '',\n },\n {\n name: 'assets',\n label: 'Assets',\n scope: 'relationship',\n dataType: 'string',\n inputType: 'relationship',\n defaultValue: '',\n relationship: {\n mode: 'multiple',\n field: 'originalFilename',\n entity: '_asset',\n },\n },\n ],\n};\n","import type { JSX } from 'react';\nimport { useTheme } from '../theme-context';\n\nexport function Loading(): JSX.Element {\n const { resolvedTheme } = useTheme();\n\n return (\n <div className=\"fk:flex fk:w-full fk:h-full fk:justify-center fk:items-center fk:bg-background\">\n <div className=\"fk:flex fk:flex-col fk:items-center\">\n {resolvedTheme === 'dark' ? (\n <svg\n className=\"fk:h-8 fk:w-8 fk:animate-bounce\"\n fill=\"none\"\n viewBox=\"0 0 48 48\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M7 8H41V40H7V8Z\" fill=\"#020817\" />\n <path\n d=\"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z\"\n fill=\"white\"\n />\n </svg>\n ) : (\n <svg\n className=\"fk:h-8 fk:w-8 fk:animate-bounce\"\n fill=\"none\"\n viewBox=\"0 0 48 48\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M7 8H41V40H7V8Z\" fill=\"white\" />\n <path\n d=\"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z\"\n fill=\"#020817\"\n />\n </svg>\n )}\n <div className=\"fk:text-foreground fk:text-center fk:mt-4 fk:animate-pulse\">Loading...</div>\n </div>\n </div>\n );\n}\n","import { lazy, Suspense } from 'react';\nimport type { ComponentType, JSX } from 'react';\nimport {\n Bot as BotIcon,\n FileStack as FileStackIcon,\n Layout as LayoutIcon,\n SquarePlay as SquarePlayIcon,\n} from 'lucide-react';\nimport { Navigate } from 'react-router-dom';\nimport { Loading } from '../../ui/components/loading';\nimport type { AppOptions } from '../config/types';\n\nconst NavigateCompat = Navigate as unknown as ComponentType<{\n replace?: boolean;\n to: string;\n}>;\n\n/**\n * Wraps a lazily imported component in Suspense so each built-in app (and each of its routes)\n * is only downloaded when it is first rendered.\n */\nfunction lazyElement(loader: () => Promise<{ default: ComponentType }>): JSX.Element {\n const Component = lazy(loader);\n\n return (\n <Suspense fallback={<Loading />}>\n <Component />\n </Suspense>\n );\n}\n\n// Desk\nconst deskRoot = lazyElement(() => import('../../apps/desk/root').then((m) => ({ default: m.Root })));\nconst deskList = lazyElement(() => import('../../apps/desk/list').then((m) => ({ default: m.List })));\nconst deskEditEntity = lazyElement(() =>\n import('../../apps/desk/edit-entity').then((m) => ({ default: m.EditEntity }))\n);\n\n// Asset Manager\nconst assetManagerRoot = lazyElement(() =>\n import('../../apps/asset-manager/root').then((m) => ({ default: m.Root }))\n);\n\n// Explorer\nconst explorerRoot = lazyElement(() => import('../../apps/explorer/root').then((m) => ({ default: m.Root })));\n\n// AI\nconst aiRoot = lazyElement(() => import('../../apps/ai/root').then((m) => ({ default: m.Root })));\nconst aiPluginsPage = lazyElement(() =>\n import('../../apps/ai/plugin-pages').then((m) => ({ default: m.PluginsPage }))\n);\nconst aiInstalledPluginsPage = lazyElement(() =>\n import('../../apps/ai/plugin-pages').then((m) => ({ default: m.InstalledPluginsPage }))\n);\nconst aiPluginDetailPage = lazyElement(() =>\n import('../../apps/ai/plugin-pages').then((m) => ({ default: m.PluginDetailPage }))\n);\nconst aiAgentChatPage = lazyElement(() =>\n import('../../apps/ai/agent/chat-page').then((m) => ({ default: m.AgentChatPage }))\n);\nconst aiAutomationsPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.AutomationsPage }))\n);\nconst aiRunHistoryPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.RunHistoryPage }))\n);\nconst aiApprovalsPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.ApprovalsPage })));\nconst aiActivityPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.ActivityPage })));\nconst aiActivityItemPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.ActivityItemPage }))\n);\nconst aiCreateAutomationPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.CreateAutomationPage }))\n);\nconst aiAutomationDetailPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.AutomationDetailPage }))\n);\nconst aiRunsPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.RunsPage })));\nconst aiRunDetailPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.RunDetailPage })));\nconst aiSkillsPage = lazyElement(() =>\n import('../../apps/ai/skills-pages').then((m) => ({ default: m.SkillsPage }))\n);\nconst aiCreateSkillPage = lazyElement(() =>\n import('../../apps/ai/skills-pages').then((m) => ({ default: m.CreateSkillPage }))\n);\nconst aiSkillDetailPage = lazyElement(() =>\n import('../../apps/ai/skills-pages').then((m) => ({ default: m.SkillDetailPage }))\n);\n\nexport const builtInApps: AppOptions[] = [\n {\n name: 'ai',\n icon: <BotIcon strokeWidth={1.5} />,\n title: 'AI',\n component: aiRoot,\n routes: [\n { path: 'plugins', component: aiPluginsPage },\n { path: 'plugins/installed', component: aiInstalledPluginsPage },\n { path: 'plugins/:pluginId', component: aiPluginDetailPage },\n {\n component: <NavigateCompat replace to=\"agent\" />,\n path: '',\n },\n {\n component: aiAgentChatPage,\n path: 'agent',\n },\n {\n component: aiAgentChatPage,\n path: 'agent/chats/:chatId',\n },\n {\n component: aiAutomationsPage,\n path: 'automations',\n },\n {\n component: aiRunHistoryPage,\n path: 'runs',\n },\n {\n component: aiApprovalsPage,\n path: 'approvals',\n },\n {\n component: aiActivityPage,\n path: 'activity',\n },\n {\n component: aiActivityItemPage,\n path: 'activity/:itemId',\n },\n {\n component: aiCreateAutomationPage,\n path: 'automations/new',\n },\n {\n component: aiAutomationDetailPage,\n path: 'automations/:automationId',\n },\n {\n component: aiRunsPage,\n path: 'automations/:automationId/runs',\n },\n {\n component: aiRunDetailPage,\n path: 'automations/:automationId/runs/:runId',\n },\n {\n component: aiSkillsPage,\n path: 'skills',\n },\n {\n component: aiCreateSkillPage,\n path: 'skills/new',\n },\n {\n component: aiSkillDetailPage,\n path: 'skills/:skillId',\n },\n ],\n },\n {\n name: 'desk',\n icon: <LayoutIcon strokeWidth={1.5} />,\n title: 'Desk',\n component: deskRoot,\n routes: [\n {\n path: 'list/:entity',\n component: deskList,\n children: [\n {\n path: 'edit/:id',\n component: deskEditEntity, // Not used, left here as an example of how to nest routes in apps\n },\n ],\n },\n ],\n },\n {\n name: 'asset-manager',\n icon: <FileStackIcon strokeWidth={1.5} />,\n title: 'Asset Manager',\n component: assetManagerRoot,\n routes: [],\n },\n {\n name: 'explorer',\n icon: <SquarePlayIcon strokeWidth={1.5} />,\n title: 'Explorer',\n component: explorerRoot,\n routes: [],\n },\n];\n","'use client';\n\nimport useSWR, { mutate } from 'swr';\nimport { apiPaths } from '../api-paths';\nimport type { ProjectSchemaError, ProjectUiConfig } from './types';\n\nexport type ProjectSchemasState = {\n projects: ProjectUiConfig[];\n errors: { [projectId: string]: ProjectSchemaError };\n isLoading: boolean;\n};\n\ntype FetchOutcome = { ok: true; project: ProjectUiConfig } | { ok: false; projectId: string; error: ProjectSchemaError };\n\nasync function fetchProjectSchema(projectId: string): Promise<FetchOutcome> {\n try {\n const response = await fetch(apiPaths(projectId).schema, { credentials: 'include', mode: 'cors' });\n\n if (!response.ok) {\n let message = response.statusText || `Request failed with status ${String(response.status)}`;\n\n try {\n const body = (await response.json()) as { error?: string; message?: string };\n message = body.error ?? body.message ?? message;\n } catch {\n // keep the status text\n }\n\n return { ok: false, projectId, error: { status: response.status, message } };\n }\n\n const project = (await response.json()) as ProjectUiConfig;\n\n return { ok: true, project: { ...project, projectId: project.projectId || projectId } };\n } catch (error) {\n return {\n ok: false,\n projectId,\n error: { status: 0, message: error instanceof Error ? error.message : 'Network error' },\n };\n }\n}\n\nexport function toProjectSchemasState(outcomes: FetchOutcome[] | undefined, isLoading: boolean): ProjectSchemasState {\n const projects: ProjectUiConfig[] = [];\n const errors: { [projectId: string]: ProjectSchemaError } = {};\n\n for (const outcome of outcomes ?? []) {\n if (outcome.ok) {\n projects.push(outcome.project);\n } else {\n errors[outcome.projectId] = outcome.error;\n }\n }\n\n return { projects, errors, isLoading };\n}\n\n/**\n * Loads the deployed schema of every project the Studio can open. Fetching\n * starts once the user is known (the endpoint needs a session) and the result\n * is kept for the lifetime of the page: schemas only change on deploy.\n */\nexport function useProjectSchemas(projectIds: string[], userId: string | undefined): ProjectSchemasState {\n const key = userId && projectIds.length > 0 ? ['project-schemas', userId, ...projectIds] : null;\n const { data, isLoading } = useSWR(key, () => Promise.all(projectIds.map((projectId) => fetchProjectSchema(projectId))), {\n revalidateOnFocus: false,\n revalidateOnReconnect: false,\n });\n\n return toProjectSchemasState(data, Boolean(key) && (isLoading || data === undefined));\n}\n\n/** State of a single project's schema, in the same shape as the multi-project hook. */\nexport function toProjectSchemaState(outcome: FetchOutcome | undefined, isLoading: boolean): ProjectSchemasState {\n return toProjectSchemasState(outcome ? [outcome] : undefined, isLoading);\n}\n\n/**\n * Hosted mode: loads only the project currently open. Each project has its own\n * SWR key, so switching back to a project reuses the schema already fetched.\n */\nexport function useProjectSchema(projectId: string | undefined, userId: string | undefined): ProjectSchemasState {\n const key = userId && projectId ? ['project-schema', userId, projectId] : null;\n const { data, isLoading } = useSWR(key, () => fetchProjectSchema(projectId ?? ''), {\n revalidateOnFocus: false,\n revalidateOnReconnect: false,\n });\n\n return toProjectSchemaState(data, Boolean(key) && (isLoading || data === undefined));\n}\n\n/** True for the SWR keys that hold `projectId`'s schema (single- and multi-project hooks). */\nexport function isProjectSchemaKey(key: unknown, projectId: string): boolean {\n return (\n Array.isArray(key) &&\n (key[0] === 'project-schema' || key[0] === 'project-schemas') &&\n key.slice(2).includes(projectId)\n );\n}\n\n/** Refetches the deployed schema of `projectId`, e.g. after the agent deployed a schema change. */\nexport function revalidateProjectSchema(projectId: string): Promise<unknown> {\n return mutate((key) => isProjectSchemaKey(key, projectId));\n}\n","'use client';\n\nimport { createContext, useContext, useMemo } from 'react';\nimport type { JSX } from 'react';\nimport { useParams } from 'react-router-dom';\nimport { useAuth } from '../../auth/auth-context';\nimport { assetSchema } from '../../entities/assets-schema';\nimport { tagSchema } from '../../entities/tags-schema';\nimport { builtInApps } from '../apps/built-in-apps';\nimport type { AppOptions, ProjectSchemaError, ProjectSummary, ProjectUiConfig, StudioMode } from './types';\nimport type { Entity } from '../types';\nimport { useProjectSchema, useProjectSchemas } from './use-project-schemas';\n\nexport interface ConfigContext {\n /** `projects` when the host passed `projectIds`, `hosted` when the Studio listed the user's projects itself. */\n mode: StudioMode;\n /** The Studio apps shown in the app bar, in order. */\n apps: AppOptions[];\n /** Kept for callers that read `contributions.apps`; same list as `apps`. */\n contributions: {\n apps: AppOptions[];\n };\n currentProjectId?: string;\n /** The project named by the `:projectId` route param, once its schema has loaded. */\n currentProject?: ProjectUiConfig;\n currentProjectSchema: Entity[];\n /** Projects whose schema loaded, in `projectIds` order. */\n projects: ProjectUiConfig[];\n /** Every project id the Studio can open, loaded or not. */\n projectIds: string[];\n /** Hosted mode: name, avatar, role and team of each project, known before any schema loads. */\n projectSummaries: ProjectSummary[];\n /** Per project id: why its schema could not be loaded. */\n schemaErrors: { [projectId: string]: ProjectSchemaError };\n isLoadingSchemas: boolean;\n}\n\nconst ConfigContext = createContext<ConfigContext>({\n mode: 'projects',\n apps: builtInApps,\n contributions: { apps: builtInApps },\n currentProjectId: undefined,\n currentProject: undefined,\n currentProjectSchema: [],\n projects: [],\n projectIds: [],\n projectSummaries: [],\n schemaErrors: {},\n isLoadingSchemas: false,\n});\n\n/** Appends the reserved asset and tag entities to a deployed schema. */\nexport function upsertReservedEntities(schema: Entity[]): Entity[] {\n const withoutReserved = schema.filter((entity) => entity.name !== assetSchema.name && entity.name !== tagSchema.name);\n\n return [...withoutReserved, assetSchema, tagSchema];\n}\n\nexport function ConfigProvider({\n projectIds,\n projectSummaries = [],\n mode = 'projects',\n userId,\n children,\n}: {\n projectIds: string[];\n projectSummaries?: ProjectSummary[];\n mode?: StudioMode;\n /** Hosted mode: the signed-in user's id, known before the per-project `/users/me` call. */\n userId?: string;\n children: React.ReactNode;\n}): JSX.Element {\n /**\n * Getting the projectId from the URL via react-router-dom's useParams hook triggers a rerender of this Context\n * every time the URL changes.\n */\n const { projectId: currentProjectId } = useParams<{ projectId: string }>();\n const [, auth] = useAuth();\n const schemaUserId = auth.user?.id ?? userId;\n // Project mode loads every project up front (short, host-defined list); hosted mode only the one open.\n const allSchemas = useProjectSchemas(mode === 'projects' ? projectIds : [], schemaUserId);\n const currentSchema = useProjectSchema(\n mode === 'hosted' && currentProjectId && projectIds.includes(currentProjectId) ? currentProjectId : undefined,\n schemaUserId\n );\n const { projects: loadedProjects, errors, isLoading } = mode === 'hosted' ? currentSchema : allSchemas;\n const projects = useMemo(\n () =>\n projectIds\n .map((projectId) => loadedProjects.find((project) => project.projectId === projectId))\n .filter((project): project is ProjectUiConfig => project !== undefined)\n .map((project) => ({ ...project, schema: upsertReservedEntities(project.schema) })),\n [loadedProjects, projectIds]\n );\n\n const value = useMemo<ConfigContext>(() => {\n const currentProject = projects.find((project) => project.projectId === currentProjectId);\n\n return {\n mode,\n apps: builtInApps,\n contributions: { apps: builtInApps },\n currentProjectId,\n currentProject,\n currentProjectSchema: currentProject?.schema ?? [],\n projects,\n projectIds,\n projectSummaries,\n schemaErrors: errors,\n isLoadingSchemas: isLoading,\n };\n }, [currentProjectId, errors, isLoading, mode, projectIds, projectSummaries, projects]);\n\n return <ConfigContext.Provider value={value}>{children}</ConfigContext.Provider>;\n}\n\nexport function useConfig(): ConfigContext {\n return useContext(ConfigContext);\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import'./index.css';import {d}from'./chunk-TYDYAOQ7.js';import {createContext,useState,useEffect,useContext}from'react';import m from'swr';var v=createContext(true);function A(){return useContext(v)}function f(){return typeof document>"u"||document.visibilityState==="visible"&&document.hasFocus()}function P(){let t=A(),[i,n]=useState(f);return useEffect(()=>{let e=()=>n(f());return e(),window.addEventListener("focus",e),window.addEventListener("blur",e),document.addEventListener("visibilitychange",e),()=>{window.removeEventListener("focus",e),window.removeEventListener("blur",e),document.removeEventListener("visibilitychange",e);}},[]),t&&i}var g="1970-01-01T00:00:00.000Z";function T(t){return t.chatId?`agent/chats/${t.chatId}`:t.automationId&&t.automationRunId?`automations/${t.automationId}/runs/${t.automationRunId}`:null}function R(t){return t.chatId?"View chat":t.automationId&&t.automationRunId?"View run":null}var b={approved:"Approved",cancelled:"Cancelled",expired:"Expired",rejected:"Rejected"};function L(t){return t.kind==="automation_failure"?"Failed":t.kind==="automation_result"?"Result":t.resolution?b[t.resolution]:t.requiresAction&&t.state!=="done"&&t.state!=="dismissed"?"Needs approval":null}function O(t){return t.kind==="automation_failure"?"failure":I(t)?"attention":"neutral"}function I(t){return t.requiresAction&&t.resolvedAt===null&&t.state!=="dismissed"&&t.state!=="done"}function K({mutedKinds:t=[],newItems:i,since:n}){let e=i.reduce((o,u)=>o===null||u.createdAt>o?u.createdAt:o,null);if(n===null)return {notifications:[],since:e??g};let r=i.filter(o=>o.createdAt>n&&!t.includes(o.kind)),a=e!==null&&e>n?e:n;return r.length===0?{notifications:[],since:a}:r.length>3?{notifications:[{body:"Open Activity in Flexkit Studio to review them.",path:"activity",tag:`flexkit-activity-batch:${a}`,title:`${r.length.toString()} new items in Activity`}],since:a}:{notifications:r.map(o=>({body:o.body??"",path:`activity/${encodeURIComponent(o.id)}`,tag:`flexkit-activity:${o.id}`,title:o.title})),since:a}}var h={approvalEmail:true,desktopMutedKinds:[]};async function c(t,i){let n=await fetch(t,{credentials:"same-origin",...i,headers:{"Content-Type":"application/json",...i?.headers}});if(!n.ok)throw new Error(`Request failed with ${n.status.toString()}.`);return await n.json()}function _(){let{data:t,error:i,mutate:n}=m(d.notificationPreferences,e=>c(e));return {isLoaded:t!==void 0||i!==void 0,mutate:n,preferences:t?.preferences??h}}function $(t){return c(d.notificationPreferences,{body:JSON.stringify(t),method:"PUT"})}function w(){return typeof window<"u"&&typeof Notification<"u"&&"serviceWorker"in navigator&&"PushManager"in window}function S(t){let i=`${t}${"=".repeat((4-t.length%4)%4)}`.replace(/-/g,"+").replace(/_/g,"/"),n=atob(i),e=new Uint8Array(new ArrayBuffer(n.length));for(let r=0;r<n.length;r+=1)e[r]=n.charCodeAt(r);return e}async function M(){if(!w()||Notification.permission!=="granted")return false;let{publicKey:t}=await c(d.push);if(!t)return false;await navigator.serviceWorker.register("/sw.js",{scope:"/"});let{pushManager:i}=await navigator.serviceWorker.ready,n=S(t),e=await i.getSubscription();return e&&!N(e.options.applicationServerKey,n)&&(await e.unsubscribe(),e=null),e??=await i.subscribe({applicationServerKey:n,userVisibleOnly:true}),await c(d.push,{body:JSON.stringify(e.toJSON()),method:"POST"}),true}function N(t,i){return !t||t.byteLength!==i.byteLength?false:new Uint8Array(t).every((e,r)=>e===i[r])}export{v as a,P as b,T as c,R as d,L as e,O as f,I as g,K as h,_ as i,$ as j,M as k};//# sourceMappingURL=chunk-LP2JI25S.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-LP2JI25S.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/apps/app-active.ts","../src/apps/ai/activity.ts","../src/apps/ai/notification-settings.ts"],"names":["AppActiveContext","createContext","useIsAppActive","useContext","isWindowInFront","useIsViewing","isAppActive","isInFront","setIsInFront","useState","useEffect","update","EPOCH","getActivitySourcePath","item","getActivitySourceLabel","RESOLUTION_LABELS","getActivityStatusLabel","getActivityStatusTone","isActivityItemOpen","planActivityNotifications","mutedKinds","newItems","since","newest","latest","fresh","nextSince","DEFAULT_NOTIFICATION_PREFERENCES","userRequest","url","init","response","useNotificationPreferences","data","error","mutate","useSWR","userApiPaths","saveNotificationPreferences","preferences","isWebPushSupported","decodeApplicationServerKey","base64Url","base64","binary","bytes","index","ensurePushSubscription","publicKey","pushManager","applicationServerKey","subscription","sameKey","current","expected","byte"],"mappings":"2IAOO,IAAMA,EAAmBC,aAAAA,CAAc,IAAI,EAE3C,SAASC,GAA0B,CACxC,OAAOC,UAAAA,CAAWH,CAAgB,CACpC,CAEA,SAASI,CAAAA,EAA2B,CAClC,OAAO,OAAO,QAAA,CAAa,GAAA,EAAgB,QAAA,CAAS,kBAAoB,SAAA,EAAa,QAAA,CAAS,UAChG,CAMO,SAASC,CAAAA,EAAwB,CACtC,IAAMC,CAAAA,CAAcJ,GAAe,CAC7B,CAACK,CAAAA,CAAWC,CAAY,EAAIC,QAAAA,CAASL,CAAe,CAAA,CAE1D,OAAAM,UAAU,IAAM,CACd,IAAMC,CAAAA,CAAS,IAAYH,EAAaJ,CAAAA,EAAiB,CAAA,CAEzD,OAAAO,GAAO,CACP,MAAA,CAAO,gBAAA,CAAiB,OAAA,CAASA,CAAM,CAAA,CACvC,MAAA,CAAO,gBAAA,CAAiB,MAAA,CAAQA,CAAM,CAAA,CACtC,QAAA,CAAS,iBAAiB,kBAAA,CAAoBA,CAAM,EAE7C,IAAM,CACX,MAAA,CAAO,mBAAA,CAAoB,QAASA,CAAM,CAAA,CAC1C,MAAA,CAAO,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AAA,CAAY,eAAA,EAAgB,CAGrD,OAAIE,CAAAA,EAAgB,CAACC,CAAAA,CAAQD,CAAAA,CAAa,QAAQ,oBAAA,CAAsBD,CAAoB,CAAA,GAC1F,MAAMC,EAAa,WAAA,EAAY,CAC/BA,CAAAA,CAAe,IAAA,CAAA,CAGjBA,IAAiB,MAAMF,CAAAA,CAAY,SAAA,CAAU,CAAE,qBAAAC,CAAAA,CAAsB,eAAA,CAAiB,IAAK,CAAC,CAAA,CAE5F,MAAMtB,CAAAA,CAAYS,CAAAA,CAAa,IAAA,CAAM,CAAE,KAAM,IAAA,CAAK,SAAA,CAAUc,CAAAA,CAAa,MAAA,EAAQ,CAAA,CAAG,MAAA,CAAQ,MAAO,CAAC,EAE7F,IACT,CAEA,SAASC,CAAAA,CAAQC,CAAAA,CAA6BC,EAA+B,CAC3E,OAAI,CAACD,CAAAA,EAAWA,EAAQ,UAAA,GAAeC,CAAAA,CAAS,UAAA,CACvC,KAAA,CAGK,IAAI,UAAA,CAAWD,CAAO,CAAA,CAEvB,KAAA,CAAM,CAACE,CAAAA,CAAMT,CAAAA,GAAUS,IAASD,CAAAA,CAASR,CAAK,CAAC,CAC9D","file":"chunk-LP2JI25S.js","sourcesContent":["import { createContext, useContext, useEffect, useState } from 'react';\n\n/**\n * Whether the app around a component is the one in front. Opened apps stay\n * mounted behind the active one (see `AppOutlet`), so their effects keep\n * running; this tells them apart. Outside an app it is `true`.\n */\nexport const AppActiveContext = createContext(true);\n\nexport function useIsAppActive(): boolean {\n return useContext(AppActiveContext);\n}\n\nfunction isWindowInFront(): boolean {\n return typeof document === 'undefined' || (document.visibilityState === 'visible' && document.hasFocus());\n}\n\n/**\n * The person is looking at this app right now: it is the app in front, the\n * tab is visible and the browser window has focus.\n */\nexport function useIsViewing(): boolean {\n const isAppActive = useIsAppActive();\n const [isInFront, setIsInFront] = useState(isWindowInFront);\n\n useEffect(() => {\n const update = (): void => setIsInFront(isWindowInFront());\n\n update();\n window.addEventListener('focus', update);\n window.addEventListener('blur', update);\n document.addEventListener('visibilitychange', update);\n\n return () => {\n window.removeEventListener('focus', update);\n window.removeEventListener('blur', update);\n document.removeEventListener('visibilitychange', update);\n };\n }, []);\n\n return isAppActive && isInFront;\n}\n","import type { ActivityItem, ActivityItemKind, ActivityItemResolution } from './types';\n\n/** More new items than this in one poll are announced by a single summary notification. */\nconst MAX_SEPARATE_NOTIFICATIONS = 3;\n\n/** Watermark before the first item exists: every later unread item is new. */\nconst EPOCH = '1970-01-01T00:00:00.000Z';\n\nexport interface ActivityNotification {\n body: string;\n /** AI-app relative path opened on click, e.g. `activity/<id>`. */\n path: string;\n /** Same tag = same notification across tabs and repeated polls. */\n tag: string;\n title: string;\n}\n\n/** Path, relative to the AI app, of the chat or run an item came from. */\nexport function getActivitySourcePath(item: ActivityItem): string | null {\n if (item.chatId) {\n return `agent/chats/${item.chatId}`;\n }\n\n if (item.automationId && item.automationRunId) {\n return `automations/${item.automationId}/runs/${item.automationRunId}`;\n }\n\n return null;\n}\n\nexport function getActivitySourceLabel(item: ActivityItem): string | null {\n if (item.chatId) {\n return 'View chat';\n }\n\n return item.automationId && item.automationRunId ? 'View run' : null;\n}\n\nconst RESOLUTION_LABELS: { [key in ActivityItemResolution]: string } = {\n approved: 'Approved',\n cancelled: 'Cancelled',\n expired: 'Expired',\n rejected: 'Rejected',\n};\n\n/** Short status for a row: what happened to it, or that it still waits on the viewer. */\nexport function getActivityStatusLabel(item: ActivityItem): string | null {\n if (item.kind === 'automation_failure') {\n return 'Failed';\n }\n\n if (item.kind === 'automation_result') {\n return 'Result';\n }\n\n if (item.resolution) {\n return RESOLUTION_LABELS[item.resolution];\n }\n\n return item.requiresAction && item.state !== 'done' && item.state !== 'dismissed' ? 'Needs approval' : null;\n}\n\n/** How a row's status badge reads: waiting on the viewer, a failure, or neutral. */\nexport function getActivityStatusTone(item: ActivityItem): 'attention' | 'failure' | 'neutral' {\n if (item.kind === 'automation_failure') {\n return 'failure';\n }\n\n return isActivityItemOpen(item) ? 'attention' : 'neutral';\n}\n\n/** True while the item still waits on the viewer. */\nexport function isActivityItemOpen(item: ActivityItem): boolean {\n return item.requiresAction && item.resolvedAt === null && item.state !== 'dismissed' && item.state !== 'done';\n}\n\n/**\n * Turns one summary poll into desktop notifications and the next watermark.\n * The first poll (no watermark yet) only seeds it, so opening Studio never\n * replays notifications for items the user already had.\n */\nexport function planActivityNotifications({\n mutedKinds = [],\n newItems,\n since,\n}: {\n /** Kinds the viewer turned off for desktop notifications; they still move the watermark. */\n mutedKinds?: ActivityItemKind[];\n newItems: ActivityItem[];\n since: string | null;\n}): { notifications: ActivityNotification[]; since: string } {\n const newest = newItems.reduce<string | null>(\n (latest, item) => (latest === null || item.createdAt > latest ? item.createdAt : latest),\n null\n );\n\n if (since === null) {\n return { notifications: [], since: newest ?? EPOCH };\n }\n\n const fresh = newItems.filter((item) => item.createdAt > since && !mutedKinds.includes(item.kind));\n const nextSince = newest !== null && newest > since ? newest : since;\n\n if (fresh.length === 0) {\n return { notifications: [], since: nextSince };\n }\n\n if (fresh.length > MAX_SEPARATE_NOTIFICATIONS) {\n return {\n notifications: [\n {\n body: 'Open Activity in Flexkit Studio to review them.',\n path: 'activity',\n tag: `flexkit-activity-batch:${nextSince}`,\n title: `${fresh.length.toString()} new items in Activity`,\n },\n ],\n since: nextSince,\n };\n }\n\n return {\n notifications: fresh.map((item) => ({\n body: item.body ?? '',\n path: `activity/${encodeURIComponent(item.id)}`,\n tag: `flexkit-activity:${item.id}`,\n title: item.title,\n })),\n since: nextSince,\n };\n}\n","import useSWR, { type KeyedMutator } from 'swr';\nimport { userApiPaths } from '../../core/api-paths';\nimport type { ActivityItemKind } from './types';\n\n/** A person's notification choices, shared by every project they open. */\nexport interface NotificationPreferences {\n /** Email an approval request left unread past the project's delay. */\n approvalEmail: boolean;\n /** Kinds that never raise a desktop notification. */\n desktopMutedKinds: ActivityItemKind[];\n}\n\nexport const DEFAULT_NOTIFICATION_PREFERENCES: NotificationPreferences = { approvalEmail: true, desktopMutedKinds: [] };\n\nasync function userRequest<T>(url: string, init?: RequestInit): Promise<T> {\n const response = await fetch(url, {\n credentials: 'same-origin',\n ...init,\n headers: { 'Content-Type': 'application/json', ...init?.headers },\n });\n\n if (!response.ok) {\n throw new Error(`Request failed with ${response.status.toString()}.`);\n }\n\n return (await response.json()) as T;\n}\n\nexport function useNotificationPreferences(): {\n /** False until the stored preferences arrived (or could not be loaded, which means the defaults). */\n isLoaded: boolean;\n mutate: KeyedMutator<{ preferences: NotificationPreferences }>;\n preferences: NotificationPreferences;\n} {\n const { data, error, mutate } = useSWR<{ preferences: NotificationPreferences }>(\n userApiPaths.notificationPreferences,\n (url: string) => userRequest<{ preferences: NotificationPreferences }>(url)\n );\n\n return {\n isLoaded: data !== undefined || error !== undefined,\n mutate,\n preferences: data?.preferences ?? DEFAULT_NOTIFICATION_PREFERENCES,\n };\n}\n\nexport function saveNotificationPreferences(preferences: NotificationPreferences): Promise<{ preferences: NotificationPreferences }> {\n return userRequest(userApiPaths.notificationPreferences, { body: JSON.stringify(preferences), method: 'PUT' });\n}\n\nexport function isWebPushSupported(): boolean {\n return (\n typeof window !== 'undefined' &&\n typeof Notification !== 'undefined' &&\n 'serviceWorker' in navigator &&\n 'PushManager' in window\n );\n}\n\n/** The VAPID public key as the bytes `PushManager.subscribe` expects. */\nexport function decodeApplicationServerKey(base64Url: string): Uint8Array<ArrayBuffer> {\n const base64 = `${base64Url}${'='.repeat((4 - (base64Url.length % 4)) % 4)}`.replace(/-/g, '+').replace(/_/g, '/');\n const binary = atob(base64);\n const bytes = new Uint8Array(new ArrayBuffer(binary.length));\n\n for (let index = 0; index < binary.length; index += 1) {\n bytes[index] = binary.charCodeAt(index);\n }\n\n return bytes;\n}\n\n/**\n * Hosted Studio only: registers the service worker and saves this browser's\n * push subscription for the signed-in user, so Activity items arrive while no\n * Studio tab is open. Needs notification permission; never asks for it.\n * Safe to call on every load: an existing subscription is saved again.\n * Returns false when Web Push is unavailable here.\n */\nexport async function ensurePushSubscription(): Promise<boolean> {\n if (!isWebPushSupported() || Notification.permission !== 'granted') {\n return false;\n }\n\n const { publicKey } = await userRequest<{ publicKey: string | null }>(userApiPaths.push);\n\n if (!publicKey) {\n return false;\n }\n\n await navigator.serviceWorker.register('/sw.js', { scope: '/' });\n\n const { pushManager } = await navigator.serviceWorker.ready;\n const applicationServerKey = decodeApplicationServerKey(publicKey);\n let subscription = await pushManager.getSubscription();\n\n // A subscription made with an older key would never receive again.\n if (subscription && !sameKey(subscription.options.applicationServerKey, applicationServerKey)) {\n await subscription.unsubscribe();\n subscription = null;\n }\n\n subscription ??= await pushManager.subscribe({ applicationServerKey, userVisibleOnly: true });\n\n await userRequest(userApiPaths.push, { body: JSON.stringify(subscription.toJSON()), method: 'POST' });\n\n return true;\n}\n\nfunction sameKey(current: ArrayBuffer | null, expected: Uint8Array): boolean {\n if (!current || current.byteLength !== expected.byteLength) {\n return false;\n }\n\n const bytes = new Uint8Array(current);\n\n return bytes.every((byte, index) => byte === expected[index]);\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import'./index.css';import {A,C,B,p,o as o$1,h as h$1,i}from'./chunk-
|
|
1
|
+
import'./index.css';import {A,C,B,p,o as o$1,h as h$1,i}from'./chunk-Y7ZSQPKF.js';import {d,c}from'./chunk-P6BZ4QP7.js';import {b}from'./chunk-V64P56OA.js';import {f}from'./chunk-EUGE3XWF.js';import {ma}from'./chunk-YCCFUGWJ.js';import {a,d as d$1,c as c$1,e as e$1,g as g$1}from'./chunk-HDOIOXMP.js';import {e,g,h,j,o,n,k}from'./chunk-SZEGGBOC.js';import {b as b$1}from'./chunk-6NRQMG26.js';import {PencilIcon,Trash2Icon,Ellipsis,Settings2,RefreshCw,Loader2,Trash2}from'lucide-react';import {jsxs,jsx}from'react/jsx-runtime';import {useState}from'react';import {find,propEq}from'ramda';import {gql}from'@apollo/client';import {useApolloClient}from'@apollo/client/react';import {toast}from'sonner';function Me({entityName:l,entityNamePlural:a,row:r,options:s={canDelete:true,canEdit:true}}){let f=A(),E=b(),c=r.original._id,D=(s.canDelete??true)&&E,p=s.canEdit??true;function h$1(){f({type:"EditEntity",payload:{entityId:c,entityNamePlural:a}});}function d(){f({type:"DeleteEntity",payload:{entityId:c,entityName:l}});}return jsxs("div",{className:"fk:flex",children:[p&&jsxs(b$1,{className:"fk:flex fk:h-7 fk:w-7 fk:p-0 fk:mr-1",onClick:h$1,variant:"ghost",children:[jsx(PencilIcon,{className:"fk:h-4 fk:w-4"}),jsx("span",{className:"fk:sr-only",children:"Edit"})]}),D&&!p&&jsxs(b$1,{className:"fk:flex fk:h-7 fk:w-7 fk:p-0 fk:mr-1",onClick:d,variant:"ghost",children:[jsx(Trash2Icon,{className:"fk:h-4 fk:w-4"}),jsx("span",{className:"fk:sr-only",children:"Delete"})]}),p&&D&&jsxs(e,{children:[jsx(g,{asChild:true,children:jsxs(b$1,{className:"fk:flex fk:h-7 fk:w-7 fk:p-0",variant:"ghost",children:[jsx(Ellipsis,{className:"fk:h-4 fk:w-4"}),jsx("span",{className:"fk:sr-only",children:"Additional actions"})]})}),jsxs(h,{align:"end",className:"w-[160px]",children:[jsxs(j,{onClick:h$1,children:[jsx(PencilIcon,{className:"fk:mr-2 fk:h-4 fk:w-4"}),"Edit"]}),jsx(o,{}),jsxs(j,{className:"fk:text-destructive",onClick:d,children:[jsx(Trash2Icon,{className:"fk:mr-2 fk:h-4 fk:w-4"}),"Delete"]})]})]})]})}function Y({table:l}){return jsxs(e,{children:[jsx(g,{asChild:true,children:jsxs(b$1,{className:"fk:hidden fk:h-8 fk:lg:flex",size:"sm",variant:"outline",children:[jsx(Settings2,{className:"fk:mr-2 fk:h-4 fk:w-4"}),"View"]})}),jsxs(h,{align:"end",className:"fk:w-[150px]",children:[jsx(n,{children:"Toggle columns"}),jsx(o,{}),l.getAllColumns().filter(a=>typeof a.accessorFn<"u"&&a.getCanHide()).map(a=>jsx(k,{checked:a.getIsVisible(),className:"capitalize",onCheckedChange:r=>{a.toggleVisibility(!!r);},children:a.id},a.id))]})]})}function Ue({entityName:l,isReloading:a$1=false,onReload:r,table:s}){let f$1=A(),E=d(),c$2=c(),D=useApolloClient(),{currentProject:p$1,currentProjectId:h}=f(),d$2=p$1?.schema??[],w=p$1?.scopes,[ee,te,ae]=C(),[b$2,B$1]=useState(false),y=b(),m=s.getSelectedRowModel().rows.map(e=>e.original._id);function oe(){f$1({type:"AddEntity",payload:{entityName:l}});}function ne(e){E({type:"setScope",payload:{projectId:h,scope:e}});}async function le(e){if(e.length===0)return;let u=h$1(l,d$2,e);await new Promise((se,re)=>{te(gql`
|
|
2
2
|
${u}
|
|
3
|
-
`),ae({variables:{where:i(e)},update(x){for(let ce of e)x.evict({id:ce});},onCompleted:()=>{se();},onError:x=>{re(x);}}),ee(true);});}function ie(){let e=l==="_asset"?"asset":l.toLowerCase();f$1({type:"AlertDialog",payload:{options:{dialogTitle:`Delete ${m.length} ${e}${m.length>1?"s":""}`,dialogMessage:m.length>1?`Are you sure you want to delete the selected ${e}s? They will be deleted permanently.`:`Are you sure you want to delete the selected ${e}? The item will be deleted permanently.`,dialogCancelTitle:"Cancel",dialogActionLabel:"Delete",isDestructive:true,dialogActionSubmit:async()=>{B$1(true);try{let u=[...m];await le(u),s.resetRowSelection(),await p(D,o$1(l,d$2),u),toast.success(u.length>1?"Items successfully deleted.":"Item successfully deleted.");}catch{toast.error("Failed to delete selected items.");}finally{B$1(false);}},dialogActionCancel:()=>{}}}});}return jsxs("div",{className:"fk:flex fk:items-center fk:justify-between",children:[jsxs("div",{className:"fk:flex fk:flex-1 fk:items-center fk:space-x-2",children:[w&&w.length>0?jsxs(a,{defaultValue:c$2.scope,onValueChange:e=>{ne(e);},value:c$2.scope,children:[jsxs(d$1,{className:"fk:w-48!",id:"project",size:"sm",children:[jsx("span",{className:"fk:text-muted-foreground",children:"Scope:"}),jsx(c$1,{children:(find(propEq(c$2.scope??"","name"))(w)||null)?.label})]}),jsx(e$1,{children:w.map(e=>jsx(g$1,{value:e.name,children:e.label},e.name))})]}):null,jsx(Y,{table:s}),r?jsx(b$1,{"aria-label":"Reload",className:"fk:h-8",disabled:b$2||a$1,onClick:r,size:"icon-sm",variant:"outline",children:jsx(RefreshCw,{className:a$1?"fk:animate-spin":void 0})}):null,jsx(B,{table:s})]}),m.length>0?jsx(ma,{disabled:!y,children:jsxs(b$1,{className:"fk:h-8 fk:mr-2 fk:lg:flex",disabled:b$2||!y,onClick:ie,size:"sm",variant:"destructive",children:[b$2?jsx(Loader2,{className:"fk:mr-2 fk:h-4 fk:w-4 fk:animate-spin"}):jsx(Trash2,{className:"fk:mr-2 fk:h-4 fk:w-4"}),"Delete (",m.length,")"]})}):null,jsx(ma,{disabled:!y,children:jsx(b$1,{className:"fk:ml-auto fk:h-8 fk:lg:flex",disabled:b$2||!y,onClick:oe,size:"sm",variant:"default",children:"Create"})})]})}export{Me as a,Y as b,Ue as c};//# sourceMappingURL=chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
`),ae({variables:{where:i(e)},update(x){for(let ce of e)x.evict({id:ce});},onCompleted:()=>{se();},onError:x=>{re(x);}}),ee(true);});}function ie(){let e=l==="_asset"?"asset":l.toLowerCase();f$1({type:"AlertDialog",payload:{options:{dialogTitle:`Delete ${m.length} ${e}${m.length>1?"s":""}`,dialogMessage:m.length>1?`Are you sure you want to delete the selected ${e}s? They will be deleted permanently.`:`Are you sure you want to delete the selected ${e}? The item will be deleted permanently.`,dialogCancelTitle:"Cancel",dialogActionLabel:"Delete",isDestructive:true,dialogActionSubmit:async()=>{B$1(true);try{let u=[...m];await le(u),s.resetRowSelection(),await p(D,o$1(l,d$2),u),toast.success(u.length>1?"Items successfully deleted.":"Item successfully deleted.");}catch{toast.error("Failed to delete selected items.");}finally{B$1(false);}},dialogActionCancel:()=>{}}}});}return jsxs("div",{className:"fk:flex fk:items-center fk:justify-between",children:[jsxs("div",{className:"fk:flex fk:flex-1 fk:items-center fk:space-x-2",children:[w&&w.length>0?jsxs(a,{defaultValue:c$2.scope,onValueChange:e=>{ne(e);},value:c$2.scope,children:[jsxs(d$1,{className:"fk:w-48!",id:"project",size:"sm",children:[jsx("span",{className:"fk:text-muted-foreground",children:"Scope:"}),jsx(c$1,{children:(find(propEq(c$2.scope??"","name"))(w)||null)?.label})]}),jsx(e$1,{children:w.map(e=>jsx(g$1,{value:e.name,children:e.label},e.name))})]}):null,jsx(Y,{table:s}),r?jsx(b$1,{"aria-label":"Reload",className:"fk:h-8",disabled:b$2||a$1,onClick:r,size:"icon-sm",variant:"outline",children:jsx(RefreshCw,{className:a$1?"fk:animate-spin":void 0})}):null,jsx(B,{table:s})]}),m.length>0?jsx(ma,{disabled:!y,children:jsxs(b$1,{className:"fk:h-8 fk:mr-2 fk:lg:flex",disabled:b$2||!y,onClick:ie,size:"sm",variant:"destructive",children:[b$2?jsx(Loader2,{className:"fk:mr-2 fk:h-4 fk:w-4 fk:animate-spin"}):jsx(Trash2,{className:"fk:mr-2 fk:h-4 fk:w-4"}),"Delete (",m.length,")"]})}):null,jsx(ma,{disabled:!y,children:jsx(b$1,{className:"fk:ml-auto fk:h-8 fk:lg:flex",disabled:b$2||!y,onClick:oe,size:"sm",variant:"default",children:"Create"})})]})}export{Me as a,Y as b,Ue as c};//# sourceMappingURL=chunk-NDM2RAQE.js.map
|
|
4
|
+
//# sourceMappingURL=chunk-NDM2RAQE.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/data-grid/data-table-row-actions.tsx","../src/data-grid/data-table-view-options.tsx","../src/data-grid/data-table-toolbar.tsx"],"names":["DataTableRowActions","entityName","entityNamePlural","row","options","actionDispatch","useDispatch","canMutate","useCanMutate","entityId","canDelete","canEdit","handleEdit","handleDelete","jsxs","Button","jsx","PencilIcon","Trash2Icon","DropdownMenu","DropdownMenuTrigger","Ellipsis","DropdownMenuContent","DropdownMenuItem","DropdownMenuSeparator","DataTableViewOptions","table","Settings2","DropdownMenuLabel","column","DropdownMenuCheckboxItem","value","DataTableToolbar","isReloading","onReload","appDispatch","useAppDispatch","appContext","useAppContext","apolloClient","useApolloClient","currentProject","currentProjectId","useConfig","schema","scopes","runMutation","setMutation","setOptions","useEntityMutation","isDeleting","setIsDeleting","useState","selectedIds","handleCreate","handleScopeChange","deleteSelected","ids","mutation","getEntityDeleteMutation","resolve","reject","gql","getEntityDeleteWhere","cache","id","error","handleBatchDelete","itemLabel","idsToDelete","scheduleEntityListRemoval","getEntityListQueryName","toast","Select","SelectTrigger","SelectValue","find","propEq","SelectContent","scopeItem","SelectItem","RefreshCw","DataTableSortedBy","PermissionTooltip","Loader2","Trash2"],"mappings":"0rBA0BO,SAASA,EAAAA,CAA2B,CACzC,UAAA,CAAAC,CAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,GAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CAAU,CAAE,SAAA,CAAW,IAAA,CAAM,OAAA,CAAS,IAAK,CAC7C,CAAA,CAAiD,CAC/C,IAAMC,CAAAA,CAAiBC,CAAAA,EAAY,CAC7BC,CAAAA,CAAYC,CAAAA,EAAa,CAEzBC,CAAAA,CAAWN,CAAAA,CAAI,QAAA,CAAS,GAAA,CAGxBO,CAAAA,CAAAA,CAAaN,CAAAA,CAAQ,SAAA,EAAa,IAAA,GAASG,CAAAA,CAC3CI,CAAAA,CAAUP,CAAAA,CAAQ,OAAA,EAAW,IAAA,CAEnC,SAASQ,GAAAA,EAAmB,CAC1BP,CAAAA,CAAe,CAAE,IAAA,CAAM,YAAA,CAAc,OAAA,CAAS,CAAE,QAAA,CAAAI,CAAAA,CAAU,gBAAA,CAAAP,CAAiB,CAAE,CAAC,EAChF,CAEA,SAASW,CAAAA,EAAqB,CAC5BR,CAAAA,CAAe,CAAE,IAAA,CAAM,cAAA,CAAgB,OAAA,CAAS,CAAE,QAAA,CAAAI,CAAAA,CAAU,UAAA,CAAAR,CAAW,CAAE,CAAC,EAC5E,CAEA,OACEa,IAAAA,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,aAAA,CAEP,UAAAjB,GAAAA,CACClC,GAAAA,CAACoE,OAAAA,CAAA,CAAQ,UAAU,uCAAA,CAAwC,CAAA,CAE3DpE,IAACqE,MAAAA,CAAA,CAAO,UAAU,uBAAA,CAAwB,CAAA,CAC1C,UAAA,CACOhC,CAAAA,CAAY,OAAO,GAAA,CAAA,CAC9B,CAAA,CACF,EACE,IAAA,CACJrC,GAAAA,CAACmE,GAAA,CAAkB,QAAA,CAAU,CAAC5E,CAAAA,CAC5B,SAAAS,GAAAA,CAACD,GAAAA,CAAA,CACC,SAAA,CAAU,8BAAA,CACV,SAAUmC,GAAAA,EAAc,CAAC3C,EACzB,OAAA,CAAS+C,EAAAA,CACT,KAAK,IAAA,CACL,OAAA,CAAQ,UACT,QAAA,CAAA,QAAA,CAED,CAAA,CACF,GACF,CAEJ","file":"chunk-NYKATVPZ.js","sourcesContent":["'use client';\n\nimport type { JSX } from 'react';\nimport { Ellipsis, PencilIcon, Trash2Icon } from 'lucide-react';\nimport type { Row } from '@tanstack/react-table';\nimport { Button } from '../ui/primitives/button';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from '../ui/primitives/dropdown-menu';\nimport { useDispatch } from '../entities/actions-context';\nimport { useCanMutate } from '../core/permissions';\n\ninterface DataTableRowActionsProps<TData> {\n entityName: string;\n entityNamePlural: string;\n row: Row<TData>;\n options?: {\n canDelete?: boolean;\n canEdit?: boolean;\n };\n}\n\nexport function DataTableRowActions<TData>({\n entityName,\n entityNamePlural,\n row,\n options = { canDelete: true, canEdit: true },\n}: DataTableRowActionsProps<TData>): JSX.Element {\n const actionDispatch = useDispatch();\n const canMutate = useCanMutate();\n // @ts-expect-error -- the DataGrid's original type doesn't know about the _id property\n const entityId = row.original._id;\n // Read-only roles keep the pencil (the drawer doubles as their read view)\n // but lose the delete affordance entirely.\n const canDelete = (options.canDelete ?? true) && canMutate;\n const canEdit = options.canEdit ?? true;\n\n function handleEdit(): void {\n actionDispatch({ type: 'EditEntity', payload: { entityId, entityNamePlural } });\n }\n\n function handleDelete(): void {\n actionDispatch({ type: 'DeleteEntity', payload: { entityId, entityName } });\n }\n\n return (\n <div className=\"fk:flex\">\n {canEdit && (\n <Button className=\"fk:flex fk:h-7 fk:w-7 fk:p-0 fk:mr-1\" onClick={handleEdit} variant=\"ghost\">\n <PencilIcon className=\"fk:h-4 fk:w-4\" />\n <span className=\"fk:sr-only\">Edit</span>\n </Button>\n )}\n {canDelete && !canEdit && (\n <Button className=\"fk:flex fk:h-7 fk:w-7 fk:p-0 fk:mr-1\" onClick={handleDelete} variant=\"ghost\">\n <Trash2Icon className=\"fk:h-4 fk:w-4\" />\n <span className=\"fk:sr-only\">Delete</span>\n </Button>\n )}\n {canEdit && canDelete && (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button className=\"fk:flex fk:h-7 fk:w-7 fk:p-0\" variant=\"ghost\">\n <Ellipsis className=\"fk:h-4 fk:w-4\" />\n <span className=\"fk:sr-only\">Additional actions</span>\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"w-[160px]\">\n <DropdownMenuItem onClick={handleEdit}>\n <PencilIcon className=\"fk:mr-2 fk:h-4 fk:w-4\" />\n Edit\n </DropdownMenuItem>\n <DropdownMenuSeparator />\n <DropdownMenuItem className=\"fk:text-destructive\" onClick={handleDelete}>\n <Trash2Icon className=\"fk:mr-2 fk:h-4 fk:w-4\" />\n Delete\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n )}\n </div>\n );\n}\n","'use client';\n\nimport type { JSX } from 'react';\nimport { Settings2 } from 'lucide-react';\nimport type { Table } from '@tanstack/react-table';\nimport { Button } from '../ui/primitives/button';\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from '../ui/primitives/dropdown-menu';\n\ninterface DataTableViewOptionsProps<TData> {\n table: Table<TData>;\n}\n\nexport function DataTableViewOptions<TData>({ table }: DataTableViewOptionsProps<TData>): JSX.Element {\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button className=\"fk:hidden fk:h-8 fk:lg:flex\" size=\"sm\" variant=\"outline\">\n <Settings2 className=\"fk:mr-2 fk:h-4 fk:w-4\" />\n View\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"fk:w-[150px]\">\n <DropdownMenuLabel>Toggle columns</DropdownMenuLabel>\n <DropdownMenuSeparator />\n {table\n .getAllColumns()\n .filter((column) => typeof column.accessorFn !== 'undefined' && column.getCanHide())\n .map((column) => {\n return (\n <DropdownMenuCheckboxItem\n checked={column.getIsVisible()}\n className=\"capitalize\"\n key={column.id}\n onCheckedChange={(value) => {\n column.toggleVisibility(Boolean(value));\n }}\n >\n {column.id}\n </DropdownMenuCheckboxItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n","'use client';\n\nimport { useState } from 'react';\nimport type { JSX } from 'react';\nimport { find, propEq } from 'ramda';\nimport type { Table } from '@tanstack/react-table';\nimport { Loader2, RefreshCw, Trash2 } from 'lucide-react';\nimport { gql } from '@apollo/client';\nimport { useApolloClient } from '@apollo/client/react';\nimport { toast } from 'sonner';\nimport { Button } from '../ui/primitives/button';\nimport { PermissionTooltip } from '../ui/components/permission-tooltip';\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../ui/primitives/select';\nimport { useDispatch } from '../entities/actions-context';\nimport { useAppContext, useAppDispatch } from '../core/app-context';\nimport { useCanMutate } from '../core/permissions';\nimport { useConfig } from '../core/config/config-context';\nimport { DataTableViewOptions } from './data-table-view-options';\nimport { DataTableSortedBy } from './data-table-sorted-by';\nimport { useEntityMutation } from '../graphql-client/use-entity-mutation';\nimport { getEntityDeleteMutation, getEntityDeleteWhere } from '../graphql-client/queries';\nimport { getEntityListQueryName, scheduleEntityListRemoval } from '../graphql-client/refetch-entity-lists';\n\ninterface DataTableToolbarProps<TData> {\n entityName: string;\n isReloading?: boolean;\n onReload?: () => void;\n table: Table<TData>;\n}\n\nexport function DataTableToolbar<TData>({\n entityName,\n isReloading = false,\n onReload,\n table,\n}: DataTableToolbarProps<TData>): JSX.Element {\n const actionDispatch = useDispatch();\n const appDispatch = useAppDispatch();\n const appContext = useAppContext();\n const apolloClient = useApolloClient();\n const { currentProject, currentProjectId } = useConfig();\n const schema = currentProject?.schema ?? [];\n const scopes = currentProject?.scopes;\n const [runMutation, setMutation, setOptions] = useEntityMutation();\n const [isDeleting, setIsDeleting] = useState(false);\n const canMutate = useCanMutate();\n\n // Collect selected entity ids from the table\n // @ts-expect-error -- the DataGrid's original type doesn't know about the _id property\n const selectedIds: string[] = table.getSelectedRowModel().rows.map((row) => row.original._id as string);\n\n function handleCreate(): void {\n actionDispatch({ type: 'AddEntity', payload: { entityName } });\n }\n\n function handleScopeChange(value: string): void {\n appDispatch({ type: 'setScope', payload: { projectId: currentProjectId, scope: value } });\n }\n\n async function deleteSelected(ids: string[]): Promise<void> {\n if (ids.length === 0) {\n return;\n }\n\n const mutation = getEntityDeleteMutation(entityName, schema, ids);\n\n await new Promise<void>((resolve, reject) => {\n setMutation(gql`\n ${mutation}\n `);\n\n setOptions({\n variables: { where: getEntityDeleteWhere(ids) },\n update(cache: { evict: (arg0: { id: string }) => void }) {\n for (const id of ids) {\n cache.evict({ id });\n }\n },\n onCompleted: () => {\n resolve();\n },\n onError: (error: Error) => {\n reject(error);\n },\n });\n\n runMutation(true);\n });\n }\n\n function handleBatchDelete(): void {\n const itemLabel = entityName === '_asset' ? 'asset' : entityName.toLowerCase();\n\n actionDispatch({\n type: 'AlertDialog',\n payload: {\n options: {\n dialogTitle: `Delete ${selectedIds.length} ${itemLabel}${selectedIds.length > 1 ? 's' : ''}`,\n dialogMessage:\n selectedIds.length > 1\n ? `Are you sure you want to delete the selected ${itemLabel}s? They will be deleted permanently.`\n : `Are you sure you want to delete the selected ${itemLabel}? The item will be deleted permanently.`,\n dialogCancelTitle: 'Cancel',\n dialogActionLabel: 'Delete',\n isDestructive: true,\n dialogActionSubmit: async () => {\n setIsDeleting(true);\n\n try {\n const idsToDelete = [...selectedIds];\n\n await deleteSelected(idsToDelete);\n\n table.resetRowSelection();\n // Drop rows immediately, then soft-refetch counts/pages.\n await scheduleEntityListRemoval(\n apolloClient,\n getEntityListQueryName(entityName, schema),\n idsToDelete\n );\n toast.success(idsToDelete.length > 1 ? 'Items successfully deleted.' : 'Item successfully deleted.');\n } catch {\n toast.error('Failed to delete selected items.');\n } finally {\n setIsDeleting(false);\n }\n },\n dialogActionCancel: () => {\n // no-op\n },\n },\n },\n });\n }\n\n return (\n <div className=\"fk:flex fk:items-center fk:justify-between\">\n <div className=\"fk:flex fk:flex-1 fk:items-center fk:space-x-2\">\n {scopes && scopes.length > 0 ? (\n <Select\n defaultValue={appContext.scope}\n onValueChange={(value) => {\n handleScopeChange(value);\n }}\n value={appContext.scope}\n >\n <SelectTrigger className=\"fk:w-48!\" id=\"project\" size=\"sm\">\n <span className=\"fk:text-muted-foreground\">Scope:</span>\n <SelectValue>\n {\n ((find(propEq(appContext.scope ?? '', 'name'))(scopes) as { name: string; label: string }) || null)\n ?.label\n }\n </SelectValue>\n </SelectTrigger>\n <SelectContent>\n {scopes.map((scopeItem) => (\n <SelectItem key={scopeItem.name} value={scopeItem.name}>\n {scopeItem.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n ) : null}\n <DataTableViewOptions table={table} />\n {onReload ? (\n <Button\n aria-label=\"Reload\"\n className=\"fk:h-8\"\n disabled={isDeleting || isReloading}\n onClick={onReload}\n size=\"icon-sm\"\n variant=\"outline\"\n >\n <RefreshCw className={isReloading ? 'fk:animate-spin' : undefined} />\n </Button>\n ) : null}\n <DataTableSortedBy table={table} />\n </div>\n {selectedIds.length > 0 ? (\n <PermissionTooltip disabled={!canMutate}>\n <Button\n className=\"fk:h-8 fk:mr-2 fk:lg:flex\"\n disabled={isDeleting || !canMutate}\n onClick={handleBatchDelete}\n size=\"sm\"\n variant=\"destructive\"\n >\n {isDeleting ? (\n <Loader2 className=\"fk:mr-2 fk:h-4 fk:w-4 fk:animate-spin\" />\n ) : (\n <Trash2 className=\"fk:mr-2 fk:h-4 fk:w-4\" />\n )}\n Delete ({selectedIds.length})\n </Button>\n </PermissionTooltip>\n ) : null}\n <PermissionTooltip disabled={!canMutate}>\n <Button\n className=\"fk:ml-auto fk:h-8 fk:lg:flex\"\n disabled={isDeleting || !canMutate}\n onClick={handleCreate}\n size=\"sm\"\n variant=\"default\"\n >\n Create\n </Button>\n </PermissionTooltip>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/data-grid/data-table-row-actions.tsx","../src/data-grid/data-table-view-options.tsx","../src/data-grid/data-table-toolbar.tsx"],"names":["DataTableRowActions","entityName","entityNamePlural","row","options","actionDispatch","useDispatch","canMutate","useCanMutate","entityId","canDelete","canEdit","handleEdit","handleDelete","jsxs","Button","jsx","PencilIcon","Trash2Icon","DropdownMenu","DropdownMenuTrigger","Ellipsis","DropdownMenuContent","DropdownMenuItem","DropdownMenuSeparator","DataTableViewOptions","table","Settings2","DropdownMenuLabel","column","DropdownMenuCheckboxItem","value","DataTableToolbar","isReloading","onReload","appDispatch","useAppDispatch","appContext","useAppContext","apolloClient","useApolloClient","currentProject","currentProjectId","useConfig","schema","scopes","runMutation","setMutation","setOptions","useEntityMutation","isDeleting","setIsDeleting","useState","selectedIds","handleCreate","handleScopeChange","deleteSelected","ids","mutation","getEntityDeleteMutation","resolve","reject","gql","getEntityDeleteWhere","cache","id","error","handleBatchDelete","itemLabel","idsToDelete","scheduleEntityListRemoval","getEntityListQueryName","toast","Select","SelectTrigger","SelectValue","find","propEq","SelectContent","scopeItem","SelectItem","RefreshCw","DataTableSortedBy","PermissionTooltip","Loader2","Trash2"],"mappings":"0rBA0BO,SAASA,EAAAA,CAA2B,CACzC,UAAA,CAAAC,C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,UACT,QAAA,CAAA,QAAA,CAED,CAAA,CACF,GACF,CAEJ","file":"chunk-NDM2RAQE.js","sourcesContent":["'use client';\n\nimport type { JSX } from 'react';\nimport { Ellipsis, PencilIcon, Trash2Icon } from 'lucide-react';\nimport type { Row } from '@tanstack/react-table';\nimport { Button } from '../ui/primitives/button';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from '../ui/primitives/dropdown-menu';\nimport { useDispatch } from '../entities/actions-context';\nimport { useCanMutate } from '../core/permissions';\n\ninterface DataTableRowActionsProps<TData> {\n entityName: string;\n entityNamePlural: string;\n row: Row<TData>;\n options?: {\n canDelete?: boolean;\n canEdit?: boolean;\n };\n}\n\nexport function DataTableRowActions<TData>({\n entityName,\n entityNamePlural,\n row,\n options = { canDelete: true, canEdit: true },\n}: DataTableRowActionsProps<TData>): JSX.Element {\n const actionDispatch = useDispatch();\n const canMutate = useCanMutate();\n // @ts-expect-error -- the DataGrid's original type doesn't know about the _id property\n const entityId = row.original._id;\n // Read-only roles keep the pencil (the drawer doubles as their read view)\n // but lose the delete affordance entirely.\n const canDelete = (options.canDelete ?? true) && canMutate;\n const canEdit = options.canEdit ?? true;\n\n function handleEdit(): void {\n actionDispatch({ type: 'EditEntity', payload: { entityId, entityNamePlural } });\n }\n\n function handleDelete(): void {\n actionDispatch({ type: 'DeleteEntity', payload: { entityId, entityName } });\n }\n\n return (\n <div className=\"fk:flex\">\n {canEdit && (\n <Button className=\"fk:flex fk:h-7 fk:w-7 fk:p-0 fk:mr-1\" onClick={handleEdit} variant=\"ghost\">\n <PencilIcon className=\"fk:h-4 fk:w-4\" />\n <span className=\"fk:sr-only\">Edit</span>\n </Button>\n )}\n {canDelete && !canEdit && (\n <Button className=\"fk:flex fk:h-7 fk:w-7 fk:p-0 fk:mr-1\" onClick={handleDelete} variant=\"ghost\">\n <Trash2Icon className=\"fk:h-4 fk:w-4\" />\n <span className=\"fk:sr-only\">Delete</span>\n </Button>\n )}\n {canEdit && canDelete && (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button className=\"fk:flex fk:h-7 fk:w-7 fk:p-0\" variant=\"ghost\">\n <Ellipsis className=\"fk:h-4 fk:w-4\" />\n <span className=\"fk:sr-only\">Additional actions</span>\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"w-[160px]\">\n <DropdownMenuItem onClick={handleEdit}>\n <PencilIcon className=\"fk:mr-2 fk:h-4 fk:w-4\" />\n Edit\n </DropdownMenuItem>\n <DropdownMenuSeparator />\n <DropdownMenuItem className=\"fk:text-destructive\" onClick={handleDelete}>\n <Trash2Icon className=\"fk:mr-2 fk:h-4 fk:w-4\" />\n Delete\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n )}\n </div>\n );\n}\n","'use client';\n\nimport type { JSX } from 'react';\nimport { Settings2 } from 'lucide-react';\nimport type { Table } from '@tanstack/react-table';\nimport { Button } from '../ui/primitives/button';\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from '../ui/primitives/dropdown-menu';\n\ninterface DataTableViewOptionsProps<TData> {\n table: Table<TData>;\n}\n\nexport function DataTableViewOptions<TData>({ table }: DataTableViewOptionsProps<TData>): JSX.Element {\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button className=\"fk:hidden fk:h-8 fk:lg:flex\" size=\"sm\" variant=\"outline\">\n <Settings2 className=\"fk:mr-2 fk:h-4 fk:w-4\" />\n View\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"fk:w-[150px]\">\n <DropdownMenuLabel>Toggle columns</DropdownMenuLabel>\n <DropdownMenuSeparator />\n {table\n .getAllColumns()\n .filter((column) => typeof column.accessorFn !== 'undefined' && column.getCanHide())\n .map((column) => {\n return (\n <DropdownMenuCheckboxItem\n checked={column.getIsVisible()}\n className=\"capitalize\"\n key={column.id}\n onCheckedChange={(value) => {\n column.toggleVisibility(Boolean(value));\n }}\n >\n {column.id}\n </DropdownMenuCheckboxItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n","'use client';\n\nimport { useState } from 'react';\nimport type { JSX } from 'react';\nimport { find, propEq } from 'ramda';\nimport type { Table } from '@tanstack/react-table';\nimport { Loader2, RefreshCw, Trash2 } from 'lucide-react';\nimport { gql } from '@apollo/client';\nimport { useApolloClient } from '@apollo/client/react';\nimport { toast } from 'sonner';\nimport { Button } from '../ui/primitives/button';\nimport { PermissionTooltip } from '../ui/components/permission-tooltip';\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../ui/primitives/select';\nimport { useDispatch } from '../entities/actions-context';\nimport { useAppContext, useAppDispatch } from '../core/app-context';\nimport { useCanMutate } from '../core/permissions';\nimport { useConfig } from '../core/config/config-context';\nimport { DataTableViewOptions } from './data-table-view-options';\nimport { DataTableSortedBy } from './data-table-sorted-by';\nimport { useEntityMutation } from '../graphql-client/use-entity-mutation';\nimport { getEntityDeleteMutation, getEntityDeleteWhere } from '../graphql-client/queries';\nimport { getEntityListQueryName, scheduleEntityListRemoval } from '../graphql-client/refetch-entity-lists';\n\ninterface DataTableToolbarProps<TData> {\n entityName: string;\n isReloading?: boolean;\n onReload?: () => void;\n table: Table<TData>;\n}\n\nexport function DataTableToolbar<TData>({\n entityName,\n isReloading = false,\n onReload,\n table,\n}: DataTableToolbarProps<TData>): JSX.Element {\n const actionDispatch = useDispatch();\n const appDispatch = useAppDispatch();\n const appContext = useAppContext();\n const apolloClient = useApolloClient();\n const { currentProject, currentProjectId } = useConfig();\n const schema = currentProject?.schema ?? [];\n const scopes = currentProject?.scopes;\n const [runMutation, setMutation, setOptions] = useEntityMutation();\n const [isDeleting, setIsDeleting] = useState(false);\n const canMutate = useCanMutate();\n\n // Collect selected entity ids from the table\n // @ts-expect-error -- the DataGrid's original type doesn't know about the _id property\n const selectedIds: string[] = table.getSelectedRowModel().rows.map((row) => row.original._id as string);\n\n function handleCreate(): void {\n actionDispatch({ type: 'AddEntity', payload: { entityName } });\n }\n\n function handleScopeChange(value: string): void {\n appDispatch({ type: 'setScope', payload: { projectId: currentProjectId, scope: value } });\n }\n\n async function deleteSelected(ids: string[]): Promise<void> {\n if (ids.length === 0) {\n return;\n }\n\n const mutation = getEntityDeleteMutation(entityName, schema, ids);\n\n await new Promise<void>((resolve, reject) => {\n setMutation(gql`\n ${mutation}\n `);\n\n setOptions({\n variables: { where: getEntityDeleteWhere(ids) },\n update(cache: { evict: (arg0: { id: string }) => void }) {\n for (const id of ids) {\n cache.evict({ id });\n }\n },\n onCompleted: () => {\n resolve();\n },\n onError: (error: Error) => {\n reject(error);\n },\n });\n\n runMutation(true);\n });\n }\n\n function handleBatchDelete(): void {\n const itemLabel = entityName === '_asset' ? 'asset' : entityName.toLowerCase();\n\n actionDispatch({\n type: 'AlertDialog',\n payload: {\n options: {\n dialogTitle: `Delete ${selectedIds.length} ${itemLabel}${selectedIds.length > 1 ? 's' : ''}`,\n dialogMessage:\n selectedIds.length > 1\n ? `Are you sure you want to delete the selected ${itemLabel}s? They will be deleted permanently.`\n : `Are you sure you want to delete the selected ${itemLabel}? The item will be deleted permanently.`,\n dialogCancelTitle: 'Cancel',\n dialogActionLabel: 'Delete',\n isDestructive: true,\n dialogActionSubmit: async () => {\n setIsDeleting(true);\n\n try {\n const idsToDelete = [...selectedIds];\n\n await deleteSelected(idsToDelete);\n\n table.resetRowSelection();\n // Drop rows immediately, then soft-refetch counts/pages.\n await scheduleEntityListRemoval(\n apolloClient,\n getEntityListQueryName(entityName, schema),\n idsToDelete\n );\n toast.success(idsToDelete.length > 1 ? 'Items successfully deleted.' : 'Item successfully deleted.');\n } catch {\n toast.error('Failed to delete selected items.');\n } finally {\n setIsDeleting(false);\n }\n },\n dialogActionCancel: () => {\n // no-op\n },\n },\n },\n });\n }\n\n return (\n <div className=\"fk:flex fk:items-center fk:justify-between\">\n <div className=\"fk:flex fk:flex-1 fk:items-center fk:space-x-2\">\n {scopes && scopes.length > 0 ? (\n <Select\n defaultValue={appContext.scope}\n onValueChange={(value) => {\n handleScopeChange(value);\n }}\n value={appContext.scope}\n >\n <SelectTrigger className=\"fk:w-48!\" id=\"project\" size=\"sm\">\n <span className=\"fk:text-muted-foreground\">Scope:</span>\n <SelectValue>\n {\n ((find(propEq(appContext.scope ?? '', 'name'))(scopes) as { name: string; label: string }) || null)\n ?.label\n }\n </SelectValue>\n </SelectTrigger>\n <SelectContent>\n {scopes.map((scopeItem) => (\n <SelectItem key={scopeItem.name} value={scopeItem.name}>\n {scopeItem.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n ) : null}\n <DataTableViewOptions table={table} />\n {onReload ? (\n <Button\n aria-label=\"Reload\"\n className=\"fk:h-8\"\n disabled={isDeleting || isReloading}\n onClick={onReload}\n size=\"icon-sm\"\n variant=\"outline\"\n >\n <RefreshCw className={isReloading ? 'fk:animate-spin' : undefined} />\n </Button>\n ) : null}\n <DataTableSortedBy table={table} />\n </div>\n {selectedIds.length > 0 ? (\n <PermissionTooltip disabled={!canMutate}>\n <Button\n className=\"fk:h-8 fk:mr-2 fk:lg:flex\"\n disabled={isDeleting || !canMutate}\n onClick={handleBatchDelete}\n size=\"sm\"\n variant=\"destructive\"\n >\n {isDeleting ? (\n <Loader2 className=\"fk:mr-2 fk:h-4 fk:w-4 fk:animate-spin\" />\n ) : (\n <Trash2 className=\"fk:mr-2 fk:h-4 fk:w-4\" />\n )}\n Delete ({selectedIds.length})\n </Button>\n </PermissionTooltip>\n ) : null}\n <PermissionTooltip disabled={!canMutate}>\n <Button\n className=\"fk:ml-auto fk:h-8 fk:lg:flex\"\n disabled={isDeleting || !canMutate}\n onClick={handleCreate}\n size=\"sm\"\n variant=\"default\"\n >\n Create\n </Button>\n </PermissionTooltip>\n </div>\n );\n}\n"]}
|