@burdenoff/microfe-botmanor 2026.1120.22 → 2026.1120.24
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/botlit/BotlitRoutes.js +37 -33
- package/dist/botlit/BotlitRoutes.js.map +1 -1
- package/dist/botlit/BotmanorRootInner.js +46 -45
- package/dist/botlit/BotmanorRootInner.js.map +1 -1
- package/dist/botlit/components/PlanUsageCard.d.ts +2 -0
- package/dist/botlit/components/PlanUsageCard.js +79 -0
- package/dist/botlit/components/PlanUsageCard.js.map +1 -0
- package/dist/botlit/components/QuotaExhaustedDialog.d.ts +14 -3
- package/dist/botlit/components/QuotaExhaustedDialog.js +33 -13
- package/dist/botlit/components/QuotaExhaustedDialog.js.map +1 -1
- package/dist/botlit/components/StoreOwnPackagesCard.d.ts +13 -0
- package/dist/botlit/components/StoreOwnPackagesCard.js +101 -0
- package/dist/botlit/components/StoreOwnPackagesCard.js.map +1 -0
- package/dist/botlit/components/StorePackageDraftCard.d.ts +13 -0
- package/dist/botlit/components/StorePackageDraftCard.js +200 -0
- package/dist/botlit/components/StorePackageDraftCard.js.map +1 -0
- package/dist/botlit/components/StorePolicyBundleCard.d.ts +8 -0
- package/dist/botlit/components/StorePolicyBundleCard.js +143 -0
- package/dist/botlit/components/StorePolicyBundleCard.js.map +1 -0
- package/dist/botlit/components/StorePublishingParts.d.ts +39 -0
- package/dist/botlit/components/StorePublishingParts.js +95 -0
- package/dist/botlit/components/StorePublishingParts.js.map +1 -0
- package/dist/botlit/components/StoreReviewQueueCard.d.ts +13 -0
- package/dist/botlit/components/StoreReviewQueueCard.js +131 -0
- package/dist/botlit/components/StoreReviewQueueCard.js.map +1 -0
- package/dist/botlit/components/StoreSubmissionsCard.d.ts +15 -0
- package/dist/botlit/components/StoreSubmissionsCard.js +168 -0
- package/dist/botlit/components/StoreSubmissionsCard.js.map +1 -0
- package/dist/botlit/hooks/usePlanUsage.d.ts +19 -0
- package/dist/botlit/hooks/usePlanUsage.js +45 -0
- package/dist/botlit/hooks/usePlanUsage.js.map +1 -0
- package/dist/botlit/hooks/useStorePublishing.d.ts +164 -0
- package/dist/botlit/hooks/useStorePublishing.js +234 -0
- package/dist/botlit/hooks/useStorePublishing.js.map +1 -0
- package/dist/botlit/pages/BotDetailPage.js +4 -4
- package/dist/botlit/pages/DashboardPage.js +151 -149
- package/dist/botlit/pages/DashboardPage.js.map +1 -1
- package/dist/botlit/pages/StorePage.js +89 -82
- package/dist/botlit/pages/StorePage.js.map +1 -1
- package/dist/botlit/pages/StorePublishingPage.d.ts +3 -0
- package/dist/botlit/pages/StorePublishingPage.js +77 -0
- package/dist/botlit/pages/StorePublishingPage.js.map +1 -0
- package/dist/botlit/pages/index.d.ts +1 -0
- package/dist/botlit/providers/QuotaGuard.d.ts +2 -0
- package/dist/botlit/providers/QuotaGuard.js +51 -0
- package/dist/botlit/providers/QuotaGuard.js.map +1 -0
- package/dist/botlit/providers/quotaGuardContext.d.ts +11 -0
- package/dist/botlit/providers/quotaGuardContext.js +9 -0
- package/dist/botlit/providers/quotaGuardContext.js.map +1 -0
- package/dist/botlit/utils/quotaErrors.d.ts +48 -0
- package/dist/botlit/utils/quotaErrors.js +118 -0
- package/dist/botlit/utils/quotaErrors.js.map +1 -0
- package/dist/botlit/utils/storePublishing.d.ts +19 -0
- package/dist/botlit/utils/storePublishing.js +65 -0
- package/dist/botlit/utils/storePublishing.js.map +1 -0
- package/dist/botlit/utils/watchPlanLimits.d.ts +12 -0
- package/dist/botlit/utils/watchPlanLimits.js +27 -0
- package/dist/botlit/utils/watchPlanLimits.js.map +1 -0
- package/dist/generated/wspace-operations.d.ts +816 -0
- package/dist/generated/wspace-operations.js +276 -127
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +201 -0
- package/dist/generated/wspace-types.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStorePublishing.js","names":["EDITABLE_SUBMISSION_STATUSES","toError","error","fallback","throwResultError","operationError","result","isForbiddenError","message","withErrors","entry","useListQuery","client","useGatewayClient","useBotlit","loadRef","useRef","load","enabled","workspaceId","key","data","setData","useState","loading","setLoading","setError","settled","setSettled","apply","useCallback","rows","failure","refetch","queryError","useEffect","current","useStoreSubmissions","ListStorePackageSubmissionsDocument","status","useOwnStorePackages","ListOwnStorePackagesDocument","useStoreReviewQueue","query","StorePackageReviewQueueDocument","useStorePublishingActions","pending","setPending","mutate","field","value","validate","ValidateStorePackageDocument","draft","runAction","action","CreateStorePackageDraftDocument","UpdateStorePackageDraftDocument","DeleteStorePackageDraftDocument","CreatePolicyBundleDraftDocument","SubmitStorePackageForReviewDocument","WithdrawStorePackageSubmissionDocument","ReviewStorePackageSubmissionDocument","UnpublishStorePackageDocument","submissionStatusVariant","manifestName","name","manifest","slug","buildManifest","values","parseContentJson","text","parsed"],"sources":["../../../src/botlit/hooks/useStorePublishing.ts"],"sourcesContent":["/**\n * Store publishing hooks (BOFF-15360).\n *\n * The publishing flow of wspace-botmanor-svc: a workspace saves a package\n * draft, validates it and submits it for review; a platform reviewer approves\n * (publishing it to the store for every workspace) or rejects it. The owning\n * workspace can unpublish its package later. Policy bundles are built from the\n * workspace's existing policies.\n *\n * Lifecycle: DRAFT -> IN_REVIEW -> PUBLISHED | REJECTED; IN_REVIEW -> WITHDRAWN.\n */\nimport type { ApolloClient } from '@apollo/client';\nimport type { DocumentNode } from 'graphql';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { useGatewayClient } from '@burdenoff/fe-libs/shared/graphql';\n\nimport {\n CreatePolicyBundleDraftDocument,\n CreateStorePackageDraftDocument,\n DeleteStorePackageDraftDocument,\n ListOwnStorePackagesDocument,\n ListStorePackageSubmissionsDocument,\n ReviewStorePackageSubmissionDocument,\n StorePackageReviewQueueDocument,\n SubmitStorePackageForReviewDocument,\n UnpublishStorePackageDocument,\n UpdateStorePackageDraftDocument,\n ValidateStorePackageDocument,\n WithdrawStorePackageSubmissionDocument,\n} from '../../generated/wspace-operations';\nimport { useBotlit } from '../providers/BotlitProvider';\n\nexport type SubmissionStatus = 'DRAFT' | 'IN_REVIEW' | 'PUBLISHED' | 'REJECTED' | 'WITHDRAWN';\n\nexport interface ValidationIssue {\n field: string;\n code: string;\n message: string;\n}\n\nexport interface PackageValidation {\n valid: boolean;\n errors: ValidationIssue[];\n warnings: ValidationIssue[];\n}\n\nexport interface StoreSubmissionRecord {\n id: string;\n workspaceId: string;\n packageId?: string | null;\n slug: string;\n kind: string;\n version: string;\n manifest: Record<string, unknown>;\n readme?: string | null;\n status: SubmissionStatus;\n validation?: PackageValidation | null;\n submittedAt?: string | null;\n submittedBy?: string | null;\n reviewedAt?: string | null;\n reviewedBy?: string | null;\n reviewNote?: string | null;\n publishedAt?: string | null;\n createdBy: string;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface OwnStorePackageRecord {\n id: string;\n slug: string;\n kind: string;\n version: string;\n manifest: Record<string, unknown>;\n publishedAt?: string | null;\n listingStatus: 'PUBLISHED' | 'UNPUBLISHED';\n unpublishedAt?: string | null;\n unpublishReason?: string | null;\n ownedByCurrentWorkspace: boolean;\n}\n\nexport interface PackageDraftValues {\n slug: string;\n kind: string;\n version: string;\n manifest: Record<string, unknown>;\n readme?: string | null;\n}\n\nexport interface PolicyBundleValues {\n policyIds: string[];\n name: string;\n slug: string;\n version: string;\n description?: string;\n readme?: string;\n}\n\n/** Statuses a workspace can still edit, delete or submit. */\nexport const EDITABLE_SUBMISSION_STATUSES: ReadonlySet<SubmissionStatus> = new Set([\n 'DRAFT',\n 'REJECTED',\n 'WITHDRAWN',\n]);\n\nfunction toError(error: unknown, fallback: string): Error {\n return error instanceof Error ? error : new Error(fallback);\n}\n\n/**\n * Apollo v4 resolves (not rejects) with `result.error` set on GraphQL errors.\n * Throw it, so a failed or refused request is an error and never an empty result.\n */\nfunction throwResultError(result: unknown, fallback: string): void {\n const operationError = (result as { error?: unknown } | null)?.error;\n if (operationError != null) throw toError(operationError, fallback);\n}\n\n/**\n * True when a query failed because the caller may not use it (the gateway's\n * RBAC refusal or the service's FORBIDDEN), which for the review queue simply\n * means \"not a reviewer\".\n */\nexport function isForbiddenError(error: unknown): boolean {\n const message = error instanceof Error ? error.message : String(error ?? '');\n // Apollo v4 `CombinedGraphQLErrors` carries `errors`; older errors carry `graphQLErrors`.\n const withErrors = error as {\n errors?: Array<{ extensions?: { code?: unknown } }>;\n graphQLErrors?: Array<{ extensions?: { code?: unknown } }>;\n } | null;\n const entries = [...(withErrors?.errors ?? []), ...(withErrors?.graphQLErrors ?? [])];\n const codes = entries.map((entry) => entry.extensions?.code);\n return (\n codes.includes('FORBIDDEN') || /forbidden|not allowed|reviewers? only|permission/i.test(message)\n );\n}\n\n/**\n * Load a list through `load`. `key` names what `load` reads besides the\n * client and workspace, so a change of filter refetches.\n */\nfunction useListQuery<T>(load: (client: ApolloClient) => Promise<T[]>, key: string) {\n const client = useGatewayClient('workspace') as ApolloClient;\n const { workspaceId } = useBotlit();\n const loadRef = useRef(load);\n // Declared before the fetch effect, so the fetch always sees the latest `load`.\n useEffect(() => {\n loadRef.current = load;\n });\n const enabled = Boolean(workspaceId) && key !== '';\n const [data, setData] = useState<T[]>([]);\n // The first fetch starts on mount, so the first render already reports\n // loading instead of an empty \"nothing here\" result.\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | undefined>();\n // True once a fetch has finished (with data or an error).\n const [settled, setSettled] = useState(false);\n\n const apply = useCallback((rows: T[], failure: Error | undefined): void => {\n setData(rows);\n setError(failure);\n setLoading(false);\n setSettled(true);\n }, []);\n\n /** Load again (after a change); resolves once the new rows are in. */\n const refetch = useCallback(async (): Promise<void> => {\n if (!enabled) return;\n setLoading(true);\n try {\n apply(await loadRef.current(client), undefined);\n } catch (queryError) {\n apply([], toError(queryError, 'Failed to load'));\n }\n }, [apply, client, enabled]);\n\n // Load on mount and whenever the workspace or the list key changes. State is\n // only set when the request answers, and an outdated answer is dropped.\n useEffect(() => {\n if (!enabled) return undefined;\n let current = true;\n loadRef.current(client).then(\n (rows) => {\n if (current) apply(rows, undefined);\n },\n (queryError: unknown) => {\n if (current) apply([], toError(queryError, 'Failed to load'));\n }\n );\n return () => {\n current = false;\n };\n }, [apply, client, enabled, key]);\n\n // Without a workspace there is nothing to load.\n return enabled\n ? { data, loading, error, settled, refetch }\n : { data: [] as T[], loading: false, error: undefined, settled: true, refetch };\n}\n\n/** This workspace's submissions, newest first. */\nexport function useStoreSubmissions(status?: SubmissionStatus) {\n const { workspaceId } = useBotlit();\n return useListQuery<StoreSubmissionRecord>(\n async (client) => {\n const result = await client.query<{ listStorePackageSubmissions: StoreSubmissionRecord[] }>({\n query: ListStorePackageSubmissionsDocument,\n variables: {\n filters: { workspaceId, status: status || undefined },\n pagination: { limit: 100, offset: 0 },\n },\n fetchPolicy: 'network-only',\n });\n throwResultError(result, 'Failed to load submissions');\n return result.data?.listStorePackageSubmissions ?? [];\n },\n `submissions:${status ?? 'all'}`\n );\n}\n\n/** Packages this workspace publishes, listed or unpublished. */\nexport function useOwnStorePackages() {\n return useListQuery<OwnStorePackageRecord>(async (client) => {\n const result = await client.query<{ listStorePackages: OwnStorePackageRecord[] }>({\n query: ListOwnStorePackagesDocument,\n variables: { pagination: { limit: 100, offset: 0 } },\n fetchPolicy: 'network-only',\n });\n throwResultError(result, 'Failed to load packages');\n return result.data?.listStorePackages ?? [];\n }, 'own-packages');\n}\n\n/**\n * Submissions waiting for review in every workspace (platform reviewers only).\n * `forbidden` is true when the caller is not a reviewer.\n */\nexport function useStoreReviewQueue() {\n const query = useListQuery<StoreSubmissionRecord>(async (client) => {\n const result = await client.query<{ storePackageReviewQueue: StoreSubmissionRecord[] }>({\n query: StorePackageReviewQueueDocument,\n variables: { pagination: { limit: 50, offset: 0 } },\n fetchPolicy: 'network-only',\n });\n throwResultError(result, 'Failed to load the review queue');\n return result.data?.storePackageReviewQueue ?? [];\n }, 'review-queue');\n return { ...query, forbidden: query.error ? isForbiddenError(query.error) : false };\n}\n\ntype PublishingAction =\n | { kind: 'validate'; draft: PackageDraftValues }\n | { kind: 'create'; draft: PackageDraftValues }\n | { kind: 'update'; id: string; draft: Partial<PackageDraftValues> }\n | { kind: 'delete'; id: string }\n | { kind: 'bundle'; bundle: PolicyBundleValues }\n | { kind: 'submit'; id: string }\n | { kind: 'withdraw'; id: string }\n | { kind: 'review'; id: string; decision: 'APPROVE' | 'REJECT'; note?: string }\n | { kind: 'unpublish'; id: string; reason?: string };\n\ntype RunnableAction = Exclude<PublishingAction, { kind: 'validate' }>;\n\n/** What each publishing action resolves to. */\ninterface PublishingResult {\n create: StoreSubmissionRecord;\n update: StoreSubmissionRecord;\n delete: boolean;\n bundle: StoreSubmissionRecord;\n submit: StoreSubmissionRecord;\n withdraw: StoreSubmissionRecord;\n review: StoreSubmissionRecord;\n unpublish: OwnStorePackageRecord;\n}\n\n/** Run one publishing action against the workspace gateway. */\nexport function useStorePublishingActions() {\n const client = useGatewayClient('workspace') as ApolloClient;\n const { workspaceId } = useBotlit();\n const [pending, setPending] = useState<PublishingAction['kind'] | null>(null);\n\n const mutate = useCallback(\n async <T>(mutation: DocumentNode, variables: Record<string, unknown>, field: string) => {\n const result = await client.mutate<Record<string, T>>({ mutation, variables });\n throwResultError(result, `${field} failed`);\n const value = result.data?.[field];\n if (value === undefined || value === null) throw new Error(`${field} returned nothing`);\n return value;\n },\n [client]\n );\n\n const validate = useCallback(\n async (draft: PackageDraftValues): Promise<PackageValidation> => {\n setPending('validate');\n try {\n const result = await client.query<{ validateStorePackage: PackageValidation }>({\n query: ValidateStorePackageDocument,\n variables: { input: { workspaceId, ...draft } },\n fetchPolicy: 'network-only',\n });\n throwResultError(result, 'Failed to validate the package');\n if (!result.data?.validateStorePackage) throw new Error('Validation returned nothing');\n return result.data.validateStorePackage;\n } catch (error) {\n throw toError(error, 'Failed to validate the package');\n } finally {\n setPending(null);\n }\n },\n [client, workspaceId]\n );\n\n const runAction = useCallback(\n async (action: RunnableAction): Promise<PublishingResult[RunnableAction['kind']]> => {\n setPending(action.kind);\n try {\n switch (action.kind) {\n case 'create':\n return await mutate<StoreSubmissionRecord>(\n CreateStorePackageDraftDocument,\n { input: { workspaceId, ...action.draft } },\n 'createStorePackageDraft'\n );\n case 'update':\n return await mutate<StoreSubmissionRecord>(\n UpdateStorePackageDraftDocument,\n { id: action.id, input: action.draft },\n 'updateStorePackageDraft'\n );\n case 'delete':\n return await mutate<boolean>(\n DeleteStorePackageDraftDocument,\n { id: action.id },\n 'deleteStorePackageDraft'\n );\n case 'bundle':\n return await mutate<StoreSubmissionRecord>(\n CreatePolicyBundleDraftDocument,\n { input: { workspaceId, ...action.bundle } },\n 'createPolicyBundleDraft'\n );\n case 'submit':\n return await mutate<StoreSubmissionRecord>(\n SubmitStorePackageForReviewDocument,\n { id: action.id },\n 'submitStorePackageForReview'\n );\n case 'withdraw':\n return await mutate<StoreSubmissionRecord>(\n WithdrawStorePackageSubmissionDocument,\n { id: action.id },\n 'withdrawStorePackageSubmission'\n );\n case 'review':\n return await mutate<StoreSubmissionRecord>(\n ReviewStorePackageSubmissionDocument,\n {\n input: {\n submissionId: action.id,\n decision: action.decision,\n note: action.note?.trim() || undefined,\n },\n },\n 'reviewStorePackageSubmission'\n );\n case 'unpublish':\n return await mutate<OwnStorePackageRecord>(\n UnpublishStorePackageDocument,\n { id: action.id, reason: action.reason?.trim() || undefined },\n 'unpublishStorePackage'\n );\n }\n } catch (error) {\n throw toError(error, `Failed to ${action.kind}`);\n } finally {\n setPending(null);\n }\n },\n [mutate, workspaceId]\n );\n\n /**\n * Run one action; the result type follows the action kind (a draft for\n * create/update/bundle/submit/withdraw/review, the package for unpublish,\n * a boolean for delete).\n */\n const run = useCallback(\n <A extends RunnableAction>(action: A): Promise<PublishingResult[A['kind']]> =>\n // runAction's switch returns exactly PublishingResult[action.kind] for\n // each case; TypeScript cannot narrow a generic through a switch, so the\n // union result is narrowed here once instead of at every call site.\n runAction(action) as Promise<PublishingResult[A['kind']]>,\n [runAction]\n );\n\n return { validate, run, pending };\n}\n\n/** Badge variant for a submission status. */\nexport function submissionStatusVariant(\n status: SubmissionStatus\n): 'default' | 'secondary' | 'success' | 'warning' | 'destructive' | 'outline' {\n switch (status) {\n case 'PUBLISHED':\n return 'success';\n case 'IN_REVIEW':\n return 'warning';\n case 'REJECTED':\n return 'destructive';\n case 'WITHDRAWN':\n return 'outline';\n default:\n return 'secondary';\n }\n}\n\n/** The package display name from a manifest, falling back to the slug. */\nexport function manifestName(\n manifest: Record<string, unknown> | null | undefined,\n slug: string\n): string {\n const name = manifest?.name;\n return typeof name === 'string' && name.trim() ? name.trim() : slug;\n}\n\n/** Build the manifest the draft form sends: header fields plus the parsed content JSON. */\nexport function buildManifest(values: {\n name: string;\n description: string;\n content: Record<string, unknown>;\n secrets?: unknown[];\n}): Record<string, unknown> {\n const manifest: Record<string, unknown> = {\n name: values.name.trim(),\n content: values.content,\n };\n if (values.description.trim()) manifest.description = values.description.trim();\n if (values.secrets && values.secrets.length > 0) manifest.secrets = values.secrets;\n return manifest;\n}\n\n/** Parse the content JSON the form holds; returns an error message instead of throwing. */\nexport function parseContentJson(text: string): {\n value: Record<string, unknown> | null;\n error: string | null;\n} {\n if (!text.trim()) return { value: {}, error: null };\n try {\n const parsed: unknown = JSON.parse(text);\n if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {\n return { value: null, error: 'Content must be a JSON object.' };\n }\n return { value: parsed as Record<string, unknown>, error: null };\n } catch (error) {\n return { value: null, error: error instanceof Error ? error.message : 'Invalid JSON' };\n }\n}\n"],"mappings":";;;;;AAmGA,IAAaA,oBAA8D,IAAI,IAAI;CACjF;CACA;CACA;AACF,CAAC;AAED,SAASC,EAAQ,GAAgB,GAAyB;CACxD,OAAOC,aAAiB,QAAQA,IAAY,MAAMC,CAAQ;AAC5D;AAMA,SAASC,EAAiB,GAAiB,GAAwB;CACjE,IAAMC,IAAkBC,GAAuC;CAC/D,IAAID,K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IA,EAAK,KAAK,IAAIE;AACjE;AAGA,SAAgBC,EAAc,GAKF;CAC1B,IAAMF,IAAoC;EACxC,MAAMG,EAAO,KAAK,KAAK;EACvB,SAASA,EAAO;CAClB;CAGA,OAFIA,EAAO,YAAY,KAAK,MAAG,EAAS,cAAcA,EAAO,YAAY,KAAK,IAC1EA,EAAO,WAAWA,EAAO,QAAQ,SAAS,MAAG,EAAS,UAAUA,EAAO,UACpEH;AACT;AAGA,SAAgBI,EAAiB,GAG/B;CACA,IAAI,CAACC,EAAK,KAAK,GAAG,OAAO;EAAE,OAAO,CAAC;EAAG,OAAO;CAAK;CAClD,IAAI;EACF,IAAMC,IAAkB,KAAK,MAAMD,CAAI;EAIvC,OAHuB,OAAOC,KAAW,aAArCA,KAAiD,MAAM,QAAQA,CAAM,IAChE;GAAE,OAAO;GAAM,OAAO;EAAiC,IAEzD;GAAE,OAAOA;GAAmC,OAAO;EAAK;CACjE,SAASvE,GAAO;EACd,OAAO;GAAE,OAAO;GAAM,OAAOA,aAAiB,QAAQA,EAAM,UAAU;EAAe;CACvF;AACF"}
|
|
@@ -4,9 +4,9 @@ import { AiOperationsPanel as ee } from "../components/AiOperationsPanel.js";
|
|
|
4
4
|
import { Card as n, CardContent as r, CardHeader as i, CardTitle as a } from "../components/Card.js";
|
|
5
5
|
import { Button as o } from "../components/Button.js";
|
|
6
6
|
import { Badge as s, StatusBadge as c } from "../components/Badge.js";
|
|
7
|
+
import { EmptyState as te } from "../components/EmptyState.js";
|
|
7
8
|
import { BOTMANOR_PERMISSIONS as l } from "../permissions/botmanorPermissions.js";
|
|
8
|
-
import { BotmanorPermissionGate as u, useBotmanorCan as
|
|
9
|
-
import { EmptyState as ne } from "../components/EmptyState.js";
|
|
9
|
+
import { BotmanorPermissionGate as u, useBotmanorCan as ne } from "../permissions/useBotmanorPermissions.js";
|
|
10
10
|
import { ErrorState as re } from "../components/ErrorState.js";
|
|
11
11
|
import { BOT_VISIBILITIES as d, BotFormFields as f, DEFAULT_BOT_FORM as p, ROUTING_STRATEGIES as m } from "../components/BotFormFields.js";
|
|
12
12
|
import { useBot as ie, useCreateBot as ae, useDeleteBot as oe, useUpdateBot as se } from "../hooks/useBots.js";
|
|
@@ -92,7 +92,7 @@ function qe(e) {
|
|
|
92
92
|
return N.find((e) => e === t) ?? "overview";
|
|
93
93
|
}
|
|
94
94
|
var P = ({ isNew: d, isEditing: m }) => {
|
|
95
|
-
let h = e(), { botId: v } = je(), [k] = Me(), A =
|
|
95
|
+
let h = e(), { botId: v } = je(), [k] = Me(), A = ne(), { navigateTo: j, getPath: M, workspaceId: N, navigate: P } = ue(), { data: F, loading: Je, error: I, refetch: L } = ie(d ? void 0 : v), { data: R } = ce(), [Ye, Xe] = ae(), [z, B] = se(), [Ze, Qe] = oe(), [V, H] = b(() => qe(k)), [U, W] = b(p), [$e, et] = b(p), [G, K] = b(!1), [tt, q] = b(!1), [nt, J] = b(!1), Y = me(U.name, U.slug), rt = Object.keys(Y).length > 0, X = !tt && JSON.stringify(U) !== JSON.stringify($e), it = !!(d || m), at = () => {
|
|
96
96
|
P ? P("/billing") : window.location.assign("/billing");
|
|
97
97
|
};
|
|
98
98
|
y(() => {
|
|
@@ -256,7 +256,7 @@ var P = ({ isNew: d, isEditing: m }) => {
|
|
|
256
256
|
});
|
|
257
257
|
if (!F) return /* @__PURE__ */ S(t, {
|
|
258
258
|
title: h("botlit.botDetail.notFound.title", "Bot Not Found"),
|
|
259
|
-
children: /* @__PURE__ */ S(
|
|
259
|
+
children: /* @__PURE__ */ S(te, {
|
|
260
260
|
illustration: "empty-agents",
|
|
261
261
|
title: h("botlit.botDetail.notFound.title", "Bot Not Found"),
|
|
262
262
|
description: h("botlit.botDetail.notFound.description", "The bot you're looking for doesn't exist."),
|
|
@@ -7,19 +7,20 @@ import { BOTMANOR_PERMISSIONS as s } from "../permissions/botmanorPermissions.js
|
|
|
7
7
|
import { BotmanorPermissionGate as c, useBotmanorPermissionDecision as l } from "../permissions/useBotmanorPermissions.js";
|
|
8
8
|
import { ErrorState as u } from "../components/ErrorState.js";
|
|
9
9
|
import { DashboardUsagePanel as te } from "../components/DashboardUsagePanel.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { PlanUsageCard as ne } from "../components/PlanUsageCard.js";
|
|
11
|
+
import { useBotAppCounts as re, useBots as ie } from "../hooks/useBots.js";
|
|
12
|
+
import { useAgentCounts as ae, useAgents as oe } from "../hooks/useAgents.js";
|
|
13
|
+
import { useBotlit as se } from "../providers/BotlitProvider.js";
|
|
13
14
|
import { formatNumber as d } from "../utils/formatters.js";
|
|
14
|
-
import { byRecentActivity as f, getGreetingName as
|
|
15
|
+
import { byRecentActivity as f, getGreetingName as ce } from "../utils/greeting.js";
|
|
15
16
|
import "../permissions/index.js";
|
|
16
|
-
import { Fragment as
|
|
17
|
-
import { GlassCard as
|
|
18
|
-
import { Fragment as
|
|
19
|
-
import { Link as
|
|
20
|
-
import { AppWindow as
|
|
17
|
+
import { Fragment as le, useMemo as p } from "react";
|
|
18
|
+
import { GlassCard as ue, GradientText as de, PagePurpose as fe } from "@burdenoff/fe-libs/ui";
|
|
19
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
20
|
+
import { Link as _, useLocation as pe } from "react-router";
|
|
21
|
+
import { AppWindow as v, ArrowRight as y, BookOpen as me, Bot as b, Headset as he, KeyRound as ge, Lock as _e, MessagesSquare as ve, Plus as ye, Zap as be } from "lucide-react";
|
|
21
22
|
// src/botlit/pages/DashboardPage.tsx
|
|
22
|
-
var
|
|
23
|
+
var x = "", S = "flex flex-col items-center gap-2 p-4 rounded-card border border-border-seam bg-bg-surface hover:border-border-strong hover:shadow-elevation-2 transition-[box-shadow,border-color]", C = ({ label: e }) => /* @__PURE__ */ h("div", {
|
|
23
24
|
className: "space-y-3",
|
|
24
25
|
role: "status",
|
|
25
26
|
"aria-busy": "true",
|
|
@@ -28,38 +29,38 @@ var S = "", C = "flex flex-col items-center gap-2 p-4 rounded-card border borde
|
|
|
28
29
|
1,
|
|
29
30
|
2,
|
|
30
31
|
3
|
|
31
|
-
].map((e) => /* @__PURE__ */
|
|
32
|
-
}),
|
|
33
|
-
let i = /* @__PURE__ */
|
|
32
|
+
].map((e) => /* @__PURE__ */ h("div", { className: "h-16 bg-bg-sunken rounded-lg motion-safe:animate-vc-shimmer" }, e))
|
|
33
|
+
}), w = ({ permission: e, to: t, icon: n, label: r }) => {
|
|
34
|
+
let i = /* @__PURE__ */ h("li", { children: /* @__PURE__ */ g(_, {
|
|
34
35
|
to: t,
|
|
35
|
-
className:
|
|
36
|
-
children: [n, /* @__PURE__ */
|
|
36
|
+
className: S,
|
|
37
|
+
children: [n, /* @__PURE__ */ h("span", {
|
|
37
38
|
className: "text-sm font-medium",
|
|
38
39
|
children: r
|
|
39
40
|
})]
|
|
40
41
|
}) });
|
|
41
|
-
return e ? /* @__PURE__ */
|
|
42
|
+
return e ? /* @__PURE__ */ h(c, {
|
|
42
43
|
permission: e,
|
|
43
44
|
children: i
|
|
44
45
|
}) : i;
|
|
45
|
-
},
|
|
46
|
-
let
|
|
46
|
+
}, T = () => {
|
|
47
|
+
let S = e(), T = pe(), { currentUser: xe, navigateTo: E, getPath: D } = se(), O = l(s.APP_READ), k = l(s.AGENT_READ), A = l(s.EXECUTION_READ), j = O === "allowed", M = k === "allowed", N = O === "loading" || k === "loading", { data: P, loading: F, error: I, hasMore: Se, refetch: Ce } = ie(), { data: L, loading: R, error: z, hasMore: B, refetch: we } = oe(), V = re(j), H = ae(M), U = p(() => [...P].sort(f).slice(0, 4), [P]), W = p(() => L.filter((e) => e.status === "ACTIVE"), [L]), G = p(() => [...W].sort(f).slice(0, 4), [W]), Te = !N && !j && !M, K = j && P.length > 0 || M && L.length > 0, q = (e, t) => t ? `${d(e)}+` : d(e), J = V.data ? V.data.total - V.data.archived : void 0, Y = H.data ? H.data.active : void 0, X = H.data ? H.data.total - H.data.archived : void 0, Z = [];
|
|
47
48
|
j && Z.push({
|
|
48
49
|
key: "bots",
|
|
49
|
-
label:
|
|
50
|
-
value: J === void 0 ? I ? "—" : q(P.length,
|
|
50
|
+
label: S("botlit.dashboard.stats.totalBots", "Total Bots"),
|
|
51
|
+
value: J === void 0 ? I ? "—" : q(P.length, Se) : d(J),
|
|
51
52
|
loading: J === void 0 && (V.loading || F),
|
|
52
|
-
icon: /* @__PURE__ */
|
|
53
|
+
icon: /* @__PURE__ */ h(v, {
|
|
53
54
|
className: "h-5 w-5",
|
|
54
55
|
"aria-hidden": "true"
|
|
55
56
|
}),
|
|
56
57
|
hero: !0
|
|
57
58
|
}), M && Z.push({
|
|
58
59
|
key: "agents",
|
|
59
|
-
label:
|
|
60
|
+
label: S("botlit.dashboard.stats.activeAgents", "Active Agents"),
|
|
60
61
|
value: Y === void 0 ? z ? "—" : q(W.length, B) : d(Y),
|
|
61
62
|
loading: Y === void 0 && (H.loading || R),
|
|
62
|
-
icon: /* @__PURE__ */
|
|
63
|
+
icon: /* @__PURE__ */ h(b, {
|
|
63
64
|
className: "h-5 w-5",
|
|
64
65
|
"aria-hidden": "true"
|
|
65
66
|
}),
|
|
@@ -67,78 +68,78 @@ var S = "", C = "flex flex-col items-center gap-2 p-4 rounded-card border borde
|
|
|
67
68
|
});
|
|
68
69
|
let Q = (e) => {
|
|
69
70
|
let t = e ?? 0;
|
|
70
|
-
return t === 1 ?
|
|
71
|
-
}, $ =
|
|
72
|
-
return /* @__PURE__ */
|
|
71
|
+
return t === 1 ? S("botlit.common.executionsOne", "{{count}} execution", { count: d(t) }) : S("botlit.common.executionsOther", "{{count}} executions", { count: d(t) });
|
|
72
|
+
}, $ = ce(xe), Ee = ($ ? K ? S("botlit.dashboard.titleNamed", "Welcome back, {{name}}", { name: x }) : S("botlit.dashboard.welcomeNamed", "Welcome, {{name}}", { name: x }) : K ? S("botlit.dashboard.title", "Welcome back") : S("botlit.dashboard.welcome", "Welcome")).split(x).map((e, t, n) => /* @__PURE__ */ g(le, { children: [e, t < n.length - 1 ? /* @__PURE__ */ h(de, { children: $ }) : null] }, t));
|
|
73
|
+
return /* @__PURE__ */ h(t, {
|
|
73
74
|
hero: !0,
|
|
74
|
-
title:
|
|
75
|
-
description:
|
|
76
|
-
actions: /* @__PURE__ */
|
|
75
|
+
title: Ee,
|
|
76
|
+
description: S("botlit.dashboard.description", "Here's an overview of your AI agents and bots"),
|
|
77
|
+
actions: /* @__PURE__ */ g("div", {
|
|
77
78
|
className: "flex gap-2",
|
|
78
|
-
children: [/* @__PURE__ */
|
|
79
|
+
children: [/* @__PURE__ */ h(c, {
|
|
79
80
|
permission: s.AGENT_CREATE,
|
|
80
|
-
children: /* @__PURE__ */
|
|
81
|
-
leftIcon: /* @__PURE__ */
|
|
82
|
-
onClick: () =>
|
|
83
|
-
children:
|
|
81
|
+
children: /* @__PURE__ */ h(o, {
|
|
82
|
+
leftIcon: /* @__PURE__ */ h(b, { size: 16 }),
|
|
83
|
+
onClick: () => E("agents/new"),
|
|
84
|
+
children: S("botlit.dashboard.actions.createAgent", "Create Agent")
|
|
84
85
|
})
|
|
85
|
-
}), /* @__PURE__ */
|
|
86
|
+
}), /* @__PURE__ */ h(c, {
|
|
86
87
|
permission: s.APP_CREATE,
|
|
87
|
-
children: /* @__PURE__ */
|
|
88
|
+
children: /* @__PURE__ */ h(o, {
|
|
88
89
|
variant: "outline",
|
|
89
|
-
leftIcon: /* @__PURE__ */
|
|
90
|
-
onClick: () =>
|
|
91
|
-
children:
|
|
90
|
+
leftIcon: /* @__PURE__ */ h(ye, { size: 16 }),
|
|
91
|
+
onClick: () => E("bots/new"),
|
|
92
|
+
children: S("botlit.dashboard.actions.createBot", "Create Bot")
|
|
92
93
|
})
|
|
93
94
|
})]
|
|
94
95
|
}),
|
|
95
|
-
children: /* @__PURE__ */
|
|
96
|
+
children: /* @__PURE__ */ g("div", {
|
|
96
97
|
className: "space-y-6",
|
|
97
|
-
children: [/* @__PURE__ */
|
|
98
|
-
icon: /* @__PURE__ */
|
|
98
|
+
children: [/* @__PURE__ */ h(fe, {
|
|
99
|
+
icon: /* @__PURE__ */ h(be, {
|
|
99
100
|
size: 18,
|
|
100
101
|
"aria-hidden": "true"
|
|
101
102
|
}),
|
|
102
|
-
children:
|
|
103
|
-
}),
|
|
103
|
+
children: S("botlit.dashboard.purpose", "This is your home base — a quick pulse on every bot and agent in your workspace. Glance at the headline numbers, jump back into recent work, and use the quick actions below to start something new. If you are just getting started, create your first agent and connect it to a bot.")
|
|
104
|
+
}), Te ? /* @__PURE__ */ g("div", {
|
|
104
105
|
role: "status",
|
|
105
106
|
className: "flex flex-col items-center justify-center gap-3 rounded-lg border border-border-subtle bg-bg-surface px-4 py-12 text-center",
|
|
106
|
-
children: [/* @__PURE__ */
|
|
107
|
+
children: [/* @__PURE__ */ h(_e, {
|
|
107
108
|
size: 28,
|
|
108
109
|
className: "text-text-secondary",
|
|
109
110
|
"aria-hidden": "true"
|
|
110
|
-
}), /* @__PURE__ */
|
|
111
|
+
}), /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("h2", {
|
|
111
112
|
className: "text-lg font-medium text-text-primary",
|
|
112
|
-
children:
|
|
113
|
-
}), /* @__PURE__ */
|
|
113
|
+
children: S("botlit.dashboard.noAccess.title", "You do not have access to this dashboard")
|
|
114
|
+
}), /* @__PURE__ */ h("p", {
|
|
114
115
|
className: "mt-2 max-w-md text-sm text-text-secondary",
|
|
115
|
-
children:
|
|
116
|
+
children: S("botlit.dashboard.noAccess.description", "Your role in this workspace cannot view bots or agents. Ask a workspace admin for read access.")
|
|
116
117
|
})] })]
|
|
117
|
-
}) : /* @__PURE__ */
|
|
118
|
-
/* @__PURE__ */
|
|
118
|
+
}) : /* @__PURE__ */ g(m, { children: [
|
|
119
|
+
/* @__PURE__ */ h("ul", {
|
|
119
120
|
className: "grid grid-cols-1 md:grid-cols-2 gap-4",
|
|
120
|
-
"aria-label":
|
|
121
|
-
children: N ? /* @__PURE__ */
|
|
121
|
+
"aria-label": S("botlit.dashboard.stats.title", "Workspace totals"),
|
|
122
|
+
children: N ? /* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(C, { label: S("botlit.common.loading", "Loading") }) }) : Z.map((e) => /* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(n, {
|
|
122
123
|
treatment: e.hero ? "glass" : "metric",
|
|
123
124
|
glow: e.hero,
|
|
124
|
-
children: /* @__PURE__ */
|
|
125
|
+
children: /* @__PURE__ */ h(r, {
|
|
125
126
|
className: "pt-6",
|
|
126
|
-
children: /* @__PURE__ */
|
|
127
|
+
children: /* @__PURE__ */ g("div", {
|
|
127
128
|
className: "flex items-center gap-4",
|
|
128
|
-
children: [/* @__PURE__ */
|
|
129
|
+
children: [/* @__PURE__ */ h("div", {
|
|
129
130
|
className: "p-3 rounded-lg bg-[var(--color-accent-soft)] text-text-primary [&>svg]:text-text-primary",
|
|
130
131
|
children: e.icon
|
|
131
|
-
}), /* @__PURE__ */
|
|
132
|
+
}), /* @__PURE__ */ g("div", {
|
|
132
133
|
className: "flex flex-col-reverse",
|
|
133
|
-
children: [/* @__PURE__ */
|
|
134
|
+
children: [/* @__PURE__ */ h("p", {
|
|
134
135
|
className: "text-sm text-text-secondary",
|
|
135
136
|
children: e.label
|
|
136
|
-
}), e.loading ? /* @__PURE__ */
|
|
137
|
+
}), e.loading ? /* @__PURE__ */ h("div", {
|
|
137
138
|
role: "status",
|
|
138
139
|
"aria-busy": "true",
|
|
139
|
-
"aria-label":
|
|
140
|
+
"aria-label": S("botlit.common.loading", "Loading"),
|
|
140
141
|
className: "h-8 w-12 rounded bg-bg-sunken motion-safe:animate-vc-shimmer"
|
|
141
|
-
}) : /* @__PURE__ */
|
|
142
|
+
}) : /* @__PURE__ */ h("p", {
|
|
142
143
|
className: "text-2xl font-bold text-text-primary tabular-nums",
|
|
143
144
|
children: e.value
|
|
144
145
|
})]
|
|
@@ -147,110 +148,111 @@ var S = "", C = "flex flex-col items-center gap-2 p-4 rounded-card border borde
|
|
|
147
148
|
})
|
|
148
149
|
}) }, e.key))
|
|
149
150
|
}),
|
|
150
|
-
|
|
151
|
-
/* @__PURE__ */
|
|
151
|
+
A === "allowed" ? /* @__PURE__ */ h(te, {}) : null,
|
|
152
|
+
/* @__PURE__ */ h(ne, {}),
|
|
153
|
+
/* @__PURE__ */ g("div", {
|
|
152
154
|
className: "grid grid-cols-1 lg:grid-cols-2 gap-6",
|
|
153
|
-
children: [j ? /* @__PURE__ */
|
|
155
|
+
children: [j ? /* @__PURE__ */ g(n, {
|
|
154
156
|
treatment: "insight",
|
|
155
|
-
children: [/* @__PURE__ */
|
|
157
|
+
children: [/* @__PURE__ */ g(i, {
|
|
156
158
|
className: "flex flex-row items-center justify-between",
|
|
157
|
-
children: [/* @__PURE__ */
|
|
159
|
+
children: [/* @__PURE__ */ h(a, {
|
|
158
160
|
as: "h2",
|
|
159
|
-
children:
|
|
160
|
-
}), /* @__PURE__ */
|
|
161
|
+
children: S("botlit.dashboard.recentBots.title", "Recent Bots")
|
|
162
|
+
}), /* @__PURE__ */ h(o, {
|
|
161
163
|
variant: "ghost",
|
|
162
164
|
size: "sm",
|
|
163
|
-
rightIcon: /* @__PURE__ */
|
|
164
|
-
onClick: () =>
|
|
165
|
-
children:
|
|
165
|
+
rightIcon: /* @__PURE__ */ h(y, { size: 16 }),
|
|
166
|
+
onClick: () => E("bots"),
|
|
167
|
+
children: S("botlit.common.viewAll", "View All")
|
|
166
168
|
})]
|
|
167
|
-
}), /* @__PURE__ */
|
|
168
|
-
resource:
|
|
169
|
+
}), /* @__PURE__ */ h(r, { children: F ? /* @__PURE__ */ h(C, { label: S("botlit.common.loading", "Loading") }) : I ? /* @__PURE__ */ h(u, {
|
|
170
|
+
resource: S("botlit.dashboard.resource.bots", "bots"),
|
|
169
171
|
error: I,
|
|
170
|
-
onRetry: () => void
|
|
171
|
-
}) : U.length > 0 ? /* @__PURE__ */
|
|
172
|
+
onRetry: () => void Ce()
|
|
173
|
+
}) : U.length > 0 ? /* @__PURE__ */ h("ul", {
|
|
172
174
|
className: "space-y-3",
|
|
173
|
-
children: U.map((e) => /* @__PURE__ */
|
|
174
|
-
to:
|
|
175
|
+
children: U.map((e) => /* @__PURE__ */ h("li", { children: /* @__PURE__ */ g(_, {
|
|
176
|
+
to: D(`bots/${e.id}`),
|
|
175
177
|
className: "flex items-center justify-between p-3 rounded-lg border border-border-seam hover:border-border-strong hover:bg-accent transition-colors",
|
|
176
|
-
children: [/* @__PURE__ */
|
|
178
|
+
children: [/* @__PURE__ */ g("div", {
|
|
177
179
|
className: "flex items-center gap-3",
|
|
178
|
-
children: [/* @__PURE__ */
|
|
180
|
+
children: [/* @__PURE__ */ h("span", {
|
|
179
181
|
className: "text-2xl",
|
|
180
182
|
"aria-hidden": "true",
|
|
181
183
|
children: e.icon || "🤖"
|
|
182
|
-
}), /* @__PURE__ */
|
|
184
|
+
}), /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("p", {
|
|
183
185
|
className: "font-medium text-text-primary",
|
|
184
186
|
children: e.name
|
|
185
|
-
}), /* @__PURE__ */
|
|
187
|
+
}), /* @__PURE__ */ h("p", {
|
|
186
188
|
className: "text-xs text-text-secondary",
|
|
187
189
|
children: Q(e.executionCount)
|
|
188
190
|
})] })]
|
|
189
|
-
}), /* @__PURE__ */
|
|
191
|
+
}), /* @__PURE__ */ h(ee, { status: e.status })]
|
|
190
192
|
}) }, e.id))
|
|
191
|
-
}) : /* @__PURE__ */
|
|
193
|
+
}) : /* @__PURE__ */ g("div", {
|
|
192
194
|
className: "text-center py-8 text-text-secondary",
|
|
193
195
|
children: [
|
|
194
|
-
/* @__PURE__ */
|
|
196
|
+
/* @__PURE__ */ h(v, {
|
|
195
197
|
className: "h-8 w-8 mx-auto mb-2 opacity-50",
|
|
196
198
|
"aria-hidden": "true"
|
|
197
199
|
}),
|
|
198
|
-
/* @__PURE__ */
|
|
199
|
-
/* @__PURE__ */
|
|
200
|
+
/* @__PURE__ */ h("p", { children: S("botlit.dashboard.recentBots.emptyTitle", "No bots yet") }),
|
|
201
|
+
/* @__PURE__ */ h(c, {
|
|
200
202
|
permission: s.APP_CREATE,
|
|
201
|
-
children: /* @__PURE__ */
|
|
203
|
+
children: /* @__PURE__ */ h(o, {
|
|
202
204
|
variant: "outline",
|
|
203
205
|
size: "sm",
|
|
204
206
|
className: "mt-3",
|
|
205
|
-
onClick: () =>
|
|
206
|
-
children:
|
|
207
|
+
onClick: () => E("bots/new"),
|
|
208
|
+
children: S("botlit.dashboard.recentBots.emptyAction", "Create your first bot")
|
|
207
209
|
})
|
|
208
210
|
})
|
|
209
211
|
]
|
|
210
212
|
}) })]
|
|
211
|
-
}) : null, M ? /* @__PURE__ */
|
|
213
|
+
}) : null, M ? /* @__PURE__ */ g(n, {
|
|
212
214
|
treatment: "insight",
|
|
213
|
-
children: [/* @__PURE__ */
|
|
215
|
+
children: [/* @__PURE__ */ g(i, {
|
|
214
216
|
className: "flex flex-row items-center justify-between",
|
|
215
|
-
children: [/* @__PURE__ */
|
|
217
|
+
children: [/* @__PURE__ */ h(a, {
|
|
216
218
|
as: "h2",
|
|
217
|
-
children:
|
|
218
|
-
}), /* @__PURE__ */
|
|
219
|
+
children: S("botlit.dashboard.activeAgents.title", "Active Agents")
|
|
220
|
+
}), /* @__PURE__ */ h(o, {
|
|
219
221
|
variant: "ghost",
|
|
220
222
|
size: "sm",
|
|
221
|
-
rightIcon: /* @__PURE__ */
|
|
222
|
-
onClick: () =>
|
|
223
|
-
children:
|
|
223
|
+
rightIcon: /* @__PURE__ */ h(y, { size: 16 }),
|
|
224
|
+
onClick: () => E("agents"),
|
|
225
|
+
children: S("botlit.common.viewAll", "View All")
|
|
224
226
|
})]
|
|
225
|
-
}), /* @__PURE__ */
|
|
226
|
-
resource:
|
|
227
|
+
}), /* @__PURE__ */ h(r, { children: R ? /* @__PURE__ */ h(C, { label: S("botlit.common.loading", "Loading") }) : z ? /* @__PURE__ */ h(u, {
|
|
228
|
+
resource: S("botlit.dashboard.resource.agents", "agents"),
|
|
227
229
|
error: z,
|
|
228
|
-
onRetry: () => void
|
|
229
|
-
}) : G.length > 0 ? /* @__PURE__ */
|
|
230
|
+
onRetry: () => void we()
|
|
231
|
+
}) : G.length > 0 ? /* @__PURE__ */ h("ul", {
|
|
230
232
|
className: "space-y-3",
|
|
231
|
-
children: G.map((e) => /* @__PURE__ */
|
|
232
|
-
to:
|
|
233
|
+
children: G.map((e) => /* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(_, {
|
|
234
|
+
to: D(`agents/${e.id}`),
|
|
233
235
|
className: "flex items-center justify-between p-3 rounded-lg border border-border-seam hover:border-border-strong hover:bg-accent transition-colors",
|
|
234
|
-
children: /* @__PURE__ */
|
|
236
|
+
children: /* @__PURE__ */ g("div", {
|
|
235
237
|
className: "flex items-center gap-3",
|
|
236
|
-
children: [/* @__PURE__ */
|
|
238
|
+
children: [/* @__PURE__ */ g("span", {
|
|
237
239
|
className: "relative text-2xl",
|
|
238
|
-
children: [/* @__PURE__ */
|
|
240
|
+
children: [/* @__PURE__ */ h("span", {
|
|
239
241
|
"aria-hidden": "true",
|
|
240
242
|
children: "🤖"
|
|
241
|
-
}), /* @__PURE__ */
|
|
243
|
+
}), /* @__PURE__ */ h("span", {
|
|
242
244
|
"aria-hidden": "true",
|
|
243
245
|
className: "absolute -right-0.5 -top-0.5 size-2 rounded-full bg-status-success-text motion-safe:animate-vc-glow-pulse"
|
|
244
246
|
})]
|
|
245
|
-
}), /* @__PURE__ */
|
|
247
|
+
}), /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("p", {
|
|
246
248
|
className: "font-medium text-text-primary",
|
|
247
249
|
children: e.name
|
|
248
|
-
}), /* @__PURE__ */
|
|
250
|
+
}), /* @__PURE__ */ g("p", {
|
|
249
251
|
className: "text-xs text-text-secondary",
|
|
250
|
-
children: [/* @__PURE__ */
|
|
252
|
+
children: [/* @__PURE__ */ g("span", {
|
|
251
253
|
className: "sr-only",
|
|
252
254
|
children: [
|
|
253
|
-
|
|
255
|
+
S("botlit.status.active", "Active"),
|
|
254
256
|
".",
|
|
255
257
|
" "
|
|
256
258
|
]
|
|
@@ -258,94 +260,94 @@ var S = "", C = "flex flex-col items-center gap-2 p-4 rounded-card border borde
|
|
|
258
260
|
})] })]
|
|
259
261
|
})
|
|
260
262
|
}) }, e.id))
|
|
261
|
-
}) : /* @__PURE__ */
|
|
263
|
+
}) : /* @__PURE__ */ g("div", {
|
|
262
264
|
className: "text-center py-8 text-text-secondary",
|
|
263
|
-
children: [/* @__PURE__ */
|
|
265
|
+
children: [/* @__PURE__ */ h(b, {
|
|
264
266
|
className: "h-8 w-8 mx-auto mb-2 opacity-50",
|
|
265
267
|
"aria-hidden": "true"
|
|
266
|
-
}), L.length === 0 ? /* @__PURE__ */
|
|
268
|
+
}), L.length === 0 ? /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("p", { children: S("botlit.dashboard.activeAgents.emptyTitle", "No agents yet") }), /* @__PURE__ */ h(c, {
|
|
267
269
|
permission: s.AGENT_CREATE,
|
|
268
|
-
children: /* @__PURE__ */
|
|
270
|
+
children: /* @__PURE__ */ h(o, {
|
|
269
271
|
variant: "outline",
|
|
270
272
|
size: "sm",
|
|
271
273
|
className: "mt-3",
|
|
272
|
-
onClick: () =>
|
|
273
|
-
children:
|
|
274
|
+
onClick: () => E("agents/new"),
|
|
275
|
+
children: S("botlit.dashboard.activeAgents.emptyAction", "Create your first agent")
|
|
274
276
|
})
|
|
275
|
-
})] }) : /* @__PURE__ */
|
|
277
|
+
})] }) : /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("p", { children: Y !== void 0 && Y > 0 ? S("botlit.dashboard.activeAgents.activeElsewhere", "{{count}} active agents", { count: d(Y) }) : S("botlit.dashboard.activeAgents.noneActive", "{{count}} agents, none active", { count: X === void 0 ? q(L.length, B) : d(X) }) }), /* @__PURE__ */ h(o, {
|
|
276
278
|
variant: "outline",
|
|
277
279
|
size: "sm",
|
|
278
280
|
className: "mt-3",
|
|
279
|
-
onClick: () =>
|
|
280
|
-
children:
|
|
281
|
+
onClick: () => E("agents"),
|
|
282
|
+
children: S("botlit.dashboard.activeAgents.viewAgents", "Review agents")
|
|
281
283
|
})] })]
|
|
282
284
|
}) })]
|
|
283
285
|
}) : null]
|
|
284
286
|
}),
|
|
285
|
-
/* @__PURE__ */
|
|
287
|
+
/* @__PURE__ */ g(ue, {
|
|
286
288
|
treatment: "plain",
|
|
287
289
|
className: "border-border-seam p-6",
|
|
288
|
-
children: [/* @__PURE__ */
|
|
290
|
+
children: [/* @__PURE__ */ h("h2", {
|
|
289
291
|
className: "text-lg font-semibold tracking-tight text-text-primary",
|
|
290
|
-
children:
|
|
291
|
-
}), /* @__PURE__ */
|
|
292
|
+
children: S("botlit.dashboard.quickActions.title", "Quick Actions")
|
|
293
|
+
}), /* @__PURE__ */ g("ul", {
|
|
292
294
|
className: "mt-4 grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4",
|
|
293
295
|
children: [
|
|
294
|
-
/* @__PURE__ */
|
|
296
|
+
/* @__PURE__ */ h(w, {
|
|
295
297
|
permission: s.KNOWLEDGE_CREATE,
|
|
296
|
-
to:
|
|
297
|
-
icon: /* @__PURE__ */
|
|
298
|
+
to: D("knowledge/new"),
|
|
299
|
+
icon: /* @__PURE__ */ h(me, {
|
|
298
300
|
className: "h-8 w-8 text-text-secondary",
|
|
299
301
|
"aria-hidden": "true"
|
|
300
302
|
}),
|
|
301
|
-
label:
|
|
303
|
+
label: S("botlit.dashboard.quickActions.addKnowledge", "Add Knowledge")
|
|
302
304
|
}),
|
|
303
|
-
/* @__PURE__ */
|
|
305
|
+
/* @__PURE__ */ h(w, {
|
|
304
306
|
permission: s.LLM_CREATE,
|
|
305
|
-
to:
|
|
306
|
-
icon: /* @__PURE__ */
|
|
307
|
+
to: D("settings"),
|
|
308
|
+
icon: /* @__PURE__ */ h(ge, {
|
|
307
309
|
className: "h-8 w-8 text-text-secondary",
|
|
308
310
|
"aria-hidden": "true"
|
|
309
311
|
}),
|
|
310
|
-
label:
|
|
312
|
+
label: S("botlit.dashboard.quickActions.connectModel", "Connect LLM Provider")
|
|
311
313
|
}),
|
|
312
|
-
/* @__PURE__ */
|
|
314
|
+
/* @__PURE__ */ h(w, {
|
|
313
315
|
permission: s.AGENT_CREATE,
|
|
314
|
-
to:
|
|
315
|
-
icon: /* @__PURE__ */
|
|
316
|
+
to: D("agents/new"),
|
|
317
|
+
icon: /* @__PURE__ */ h(b, {
|
|
316
318
|
className: "h-8 w-8 text-text-secondary",
|
|
317
319
|
"aria-hidden": "true"
|
|
318
320
|
}),
|
|
319
|
-
label:
|
|
321
|
+
label: S("botlit.dashboard.actions.createAgent", "Create Agent")
|
|
320
322
|
}),
|
|
321
|
-
/* @__PURE__ */
|
|
323
|
+
/* @__PURE__ */ h(w, {
|
|
322
324
|
permission: s.APP_CREATE,
|
|
323
|
-
to:
|
|
324
|
-
icon: /* @__PURE__ */
|
|
325
|
+
to: D("bots/new"),
|
|
326
|
+
icon: /* @__PURE__ */ h(v, {
|
|
325
327
|
className: "h-8 w-8 text-text-secondary",
|
|
326
328
|
"aria-hidden": "true"
|
|
327
329
|
}),
|
|
328
|
-
label:
|
|
330
|
+
label: S("botlit.dashboard.actions.createBot", "Create Bot")
|
|
329
331
|
}),
|
|
330
|
-
/* @__PURE__ */
|
|
332
|
+
/* @__PURE__ */ h(w, {
|
|
331
333
|
permission: s.CHANNEL_MESSAGE_READ,
|
|
332
334
|
to: {
|
|
333
335
|
pathname: "/conversations",
|
|
334
|
-
search:
|
|
336
|
+
search: T.search
|
|
335
337
|
},
|
|
336
|
-
icon: /* @__PURE__ */
|
|
338
|
+
icon: /* @__PURE__ */ h(ve, {
|
|
337
339
|
className: "h-8 w-8 text-text-secondary",
|
|
338
340
|
"aria-hidden": "true"
|
|
339
341
|
}),
|
|
340
|
-
label:
|
|
342
|
+
label: S("botlit.dashboard.quickActions.conversations", "Conversations")
|
|
341
343
|
}),
|
|
342
|
-
/* @__PURE__ */
|
|
343
|
-
to:
|
|
344
|
-
icon: /* @__PURE__ */
|
|
344
|
+
/* @__PURE__ */ h(w, {
|
|
345
|
+
to: D("handoffs"),
|
|
346
|
+
icon: /* @__PURE__ */ h(he, {
|
|
345
347
|
className: "h-8 w-8 text-text-secondary",
|
|
346
348
|
"aria-hidden": "true"
|
|
347
349
|
}),
|
|
348
|
-
label:
|
|
350
|
+
label: S("botlit.dashboard.quickActions.handoffs", "Human Handoffs")
|
|
349
351
|
})
|
|
350
352
|
]
|
|
351
353
|
})]
|
|
@@ -354,6 +356,6 @@ var S = "", C = "flex flex-col items-center gap-2 p-4 rounded-card border borde
|
|
|
354
356
|
})
|
|
355
357
|
});
|
|
356
358
|
};
|
|
357
|
-
export {
|
|
359
|
+
export { T as DashboardPage };
|
|
358
360
|
|
|
359
361
|
//# sourceMappingURL=DashboardPage.js.map
|