@burdenoff/microfe-botmanor 2026.1120.23 → 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.
Files changed (38) hide show
  1. package/dist/botlit/BotlitRoutes.js +37 -33
  2. package/dist/botlit/BotlitRoutes.js.map +1 -1
  3. package/dist/botlit/components/StoreOwnPackagesCard.d.ts +13 -0
  4. package/dist/botlit/components/StoreOwnPackagesCard.js +101 -0
  5. package/dist/botlit/components/StoreOwnPackagesCard.js.map +1 -0
  6. package/dist/botlit/components/StorePackageDraftCard.d.ts +13 -0
  7. package/dist/botlit/components/StorePackageDraftCard.js +200 -0
  8. package/dist/botlit/components/StorePackageDraftCard.js.map +1 -0
  9. package/dist/botlit/components/StorePolicyBundleCard.d.ts +8 -0
  10. package/dist/botlit/components/StorePolicyBundleCard.js +143 -0
  11. package/dist/botlit/components/StorePolicyBundleCard.js.map +1 -0
  12. package/dist/botlit/components/StorePublishingParts.d.ts +39 -0
  13. package/dist/botlit/components/StorePublishingParts.js +95 -0
  14. package/dist/botlit/components/StorePublishingParts.js.map +1 -0
  15. package/dist/botlit/components/StoreReviewQueueCard.d.ts +13 -0
  16. package/dist/botlit/components/StoreReviewQueueCard.js +131 -0
  17. package/dist/botlit/components/StoreReviewQueueCard.js.map +1 -0
  18. package/dist/botlit/components/StoreSubmissionsCard.d.ts +15 -0
  19. package/dist/botlit/components/StoreSubmissionsCard.js +168 -0
  20. package/dist/botlit/components/StoreSubmissionsCard.js.map +1 -0
  21. package/dist/botlit/hooks/useStorePublishing.d.ts +164 -0
  22. package/dist/botlit/hooks/useStorePublishing.js +234 -0
  23. package/dist/botlit/hooks/useStorePublishing.js.map +1 -0
  24. package/dist/botlit/pages/StorePage.js +89 -82
  25. package/dist/botlit/pages/StorePage.js.map +1 -1
  26. package/dist/botlit/pages/StorePublishingPage.d.ts +3 -0
  27. package/dist/botlit/pages/StorePublishingPage.js +77 -0
  28. package/dist/botlit/pages/StorePublishingPage.js.map +1 -0
  29. package/dist/botlit/pages/index.d.ts +1 -0
  30. package/dist/botlit/utils/storePublishing.d.ts +19 -0
  31. package/dist/botlit/utils/storePublishing.js +65 -0
  32. package/dist/botlit/utils/storePublishing.js.map +1 -0
  33. package/dist/generated/wspace-operations.d.ts +764 -0
  34. package/dist/generated/wspace-operations.js +257 -128
  35. package/dist/generated/wspace-operations.js.map +1 -1
  36. package/dist/generated/wspace-types.d.ts +201 -0
  37. package/dist/generated/wspace-types.js.map +1 -1
  38. package/package.json +1 -1
@@ -0,0 +1,234 @@
1
+ import { CreatePolicyBundleDraftDocument as e, CreateStorePackageDraftDocument as t, DeleteStorePackageDraftDocument as n, ListOwnStorePackagesDocument as r, ListStorePackageSubmissionsDocument as i, ReviewStorePackageSubmissionDocument as a, StorePackageReviewQueueDocument as o, SubmitStorePackageForReviewDocument as s, UnpublishStorePackageDocument as c, UpdateStorePackageDraftDocument as l, ValidateStorePackageDocument as u, WithdrawStorePackageSubmissionDocument as d } from "../../generated/wspace-operations.js";
2
+ import { useBotlit as f } from "../providers/BotlitProvider.js";
3
+ import { useCallback as p, useEffect as m, useRef as h, useState as g } from "react";
4
+ import { useGatewayClient as _ } from "@burdenoff/fe-libs/shared/graphql";
5
+ // src/botlit/hooks/useStorePublishing.ts
6
+ var v = /* @__PURE__ */ new Set([
7
+ "DRAFT",
8
+ "REJECTED",
9
+ "WITHDRAWN"
10
+ ]);
11
+ function y(e, t) {
12
+ return e instanceof Error ? e : Error(t);
13
+ }
14
+ function b(e, t) {
15
+ let n = e?.error;
16
+ if (n != null) throw y(n, t);
17
+ }
18
+ function x(e) {
19
+ let t = e instanceof Error ? e.message : String(e ?? ""), n = e;
20
+ return [...n?.errors ?? [], ...n?.graphQLErrors ?? []].map((e) => e.extensions?.code).includes("FORBIDDEN") || /forbidden|not allowed|reviewers? only|permission/i.test(t);
21
+ }
22
+ function S(e, t) {
23
+ let n = _("workspace"), { workspaceId: r } = f(), i = h(e);
24
+ m(() => {
25
+ i.current = e;
26
+ });
27
+ let a = !!r && t !== "", [o, s] = g([]), [c, l] = g(!0), [u, d] = g(), [v, b] = g(!1), x = p((e, t) => {
28
+ s(e), d(t), l(!1), b(!0);
29
+ }, []), S = p(async () => {
30
+ if (a) {
31
+ l(!0);
32
+ try {
33
+ x(await i.current(n), void 0);
34
+ } catch (e) {
35
+ x([], y(e, "Failed to load"));
36
+ }
37
+ }
38
+ }, [
39
+ x,
40
+ n,
41
+ a
42
+ ]);
43
+ return m(() => {
44
+ if (!a) return;
45
+ let e = !0;
46
+ return i.current(n).then((t) => {
47
+ e && x(t, void 0);
48
+ }, (t) => {
49
+ e && x([], y(t, "Failed to load"));
50
+ }), () => {
51
+ e = !1;
52
+ };
53
+ }, [
54
+ x,
55
+ n,
56
+ a,
57
+ t
58
+ ]), a ? {
59
+ data: o,
60
+ loading: c,
61
+ error: u,
62
+ settled: v,
63
+ refetch: S
64
+ } : {
65
+ data: [],
66
+ loading: !1,
67
+ error: void 0,
68
+ settled: !0,
69
+ refetch: S
70
+ };
71
+ }
72
+ function C(e) {
73
+ let { workspaceId: t } = f();
74
+ return S(async (n) => {
75
+ let r = await n.query({
76
+ query: i,
77
+ variables: {
78
+ filters: {
79
+ workspaceId: t,
80
+ status: e || void 0
81
+ },
82
+ pagination: {
83
+ limit: 100,
84
+ offset: 0
85
+ }
86
+ },
87
+ fetchPolicy: "network-only"
88
+ });
89
+ return b(r, "Failed to load submissions"), r.data?.listStorePackageSubmissions ?? [];
90
+ }, `submissions:${e ?? "all"}`);
91
+ }
92
+ function w() {
93
+ return S(async (e) => {
94
+ let t = await e.query({
95
+ query: r,
96
+ variables: { pagination: {
97
+ limit: 100,
98
+ offset: 0
99
+ } },
100
+ fetchPolicy: "network-only"
101
+ });
102
+ return b(t, "Failed to load packages"), t.data?.listStorePackages ?? [];
103
+ }, "own-packages");
104
+ }
105
+ function T() {
106
+ let e = S(async (e) => {
107
+ let t = await e.query({
108
+ query: o,
109
+ variables: { pagination: {
110
+ limit: 50,
111
+ offset: 0
112
+ } },
113
+ fetchPolicy: "network-only"
114
+ });
115
+ return b(t, "Failed to load the review queue"), t.data?.storePackageReviewQueue ?? [];
116
+ }, "review-queue");
117
+ return {
118
+ ...e,
119
+ forbidden: e.error ? x(e.error) : !1
120
+ };
121
+ }
122
+ function E() {
123
+ let r = _("workspace"), { workspaceId: i } = f(), [o, m] = g(null), h = p(async (e, t, n) => {
124
+ let i = await r.mutate({
125
+ mutation: e,
126
+ variables: t
127
+ });
128
+ b(i, `${n} failed`);
129
+ let a = i.data?.[n];
130
+ if (a == null) throw Error(`${n} returned nothing`);
131
+ return a;
132
+ }, [r]), v = p(async (e) => {
133
+ m("validate");
134
+ try {
135
+ let t = await r.query({
136
+ query: u,
137
+ variables: { input: {
138
+ workspaceId: i,
139
+ ...e
140
+ } },
141
+ fetchPolicy: "network-only"
142
+ });
143
+ if (b(t, "Failed to validate the package"), !t.data?.validateStorePackage) throw Error("Validation returned nothing");
144
+ return t.data.validateStorePackage;
145
+ } catch (e) {
146
+ throw y(e, "Failed to validate the package");
147
+ } finally {
148
+ m(null);
149
+ }
150
+ }, [r, i]), x = p(async (r) => {
151
+ m(r.kind);
152
+ try {
153
+ switch (r.kind) {
154
+ case "create": return await h(t, { input: {
155
+ workspaceId: i,
156
+ ...r.draft
157
+ } }, "createStorePackageDraft");
158
+ case "update": return await h(l, {
159
+ id: r.id,
160
+ input: r.draft
161
+ }, "updateStorePackageDraft");
162
+ case "delete": return await h(n, { id: r.id }, "deleteStorePackageDraft");
163
+ case "bundle": return await h(e, { input: {
164
+ workspaceId: i,
165
+ ...r.bundle
166
+ } }, "createPolicyBundleDraft");
167
+ case "submit": return await h(s, { id: r.id }, "submitStorePackageForReview");
168
+ case "withdraw": return await h(d, { id: r.id }, "withdrawStorePackageSubmission");
169
+ case "review": return await h(a, { input: {
170
+ submissionId: r.id,
171
+ decision: r.decision,
172
+ note: r.note?.trim() || void 0
173
+ } }, "reviewStorePackageSubmission");
174
+ case "unpublish": return await h(c, {
175
+ id: r.id,
176
+ reason: r.reason?.trim() || void 0
177
+ }, "unpublishStorePackage");
178
+ }
179
+ } catch (e) {
180
+ throw y(e, `Failed to ${r.kind}`);
181
+ } finally {
182
+ m(null);
183
+ }
184
+ }, [h, i]);
185
+ return {
186
+ validate: v,
187
+ run: p((e) => x(e), [x]),
188
+ pending: o
189
+ };
190
+ }
191
+ function D(e) {
192
+ switch (e) {
193
+ case "PUBLISHED": return "success";
194
+ case "IN_REVIEW": return "warning";
195
+ case "REJECTED": return "destructive";
196
+ case "WITHDRAWN": return "outline";
197
+ default: return "secondary";
198
+ }
199
+ }
200
+ function O(e, t) {
201
+ let n = e?.name;
202
+ return typeof n == "string" && n.trim() ? n.trim() : t;
203
+ }
204
+ function k(e) {
205
+ let t = {
206
+ name: e.name.trim(),
207
+ content: e.content
208
+ };
209
+ return e.description.trim() && (t.description = e.description.trim()), e.secrets && e.secrets.length > 0 && (t.secrets = e.secrets), t;
210
+ }
211
+ function A(e) {
212
+ if (!e.trim()) return {
213
+ value: {},
214
+ error: null
215
+ };
216
+ try {
217
+ let t = JSON.parse(e);
218
+ return typeof t != "object" || !t || Array.isArray(t) ? {
219
+ value: null,
220
+ error: "Content must be a JSON object."
221
+ } : {
222
+ value: t,
223
+ error: null
224
+ };
225
+ } catch (e) {
226
+ return {
227
+ value: null,
228
+ error: e instanceof Error ? e.message : "Invalid JSON"
229
+ };
230
+ }
231
+ }
232
+ export { v as EDITABLE_SUBMISSION_STATUSES, k as buildManifest, x as isForbiddenError, O as manifestName, A as parseContentJson, D as submissionStatusVariant, w as useOwnStorePackages, E as useStorePublishingActions, T as useStoreReviewQueue, C as useStoreSubmissions };
233
+
234
+ //# sourceMappingURL=useStorePublishing.js.map
@@ -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,KAAkB,MAAM,MAAMJ,EAAQI,GAAgBF,CAAQ;AACpE;AAOA,SAAgBI,EAAiB,GAAyB;CACxD,IAAMC,IAA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,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"}
@@ -1,34 +1,34 @@
1
1
  import { useBotlit as e } from "../providers/BotlitProvider.js";
2
2
  import { useTr as t } from "../../shared/hooks/useTr.js";
3
- import { PageLayout as n } from "../components/PageLayout.js";
4
- import { BOTMANOR_PERMISSIONS as r } from "../permissions/botmanorPermissions.js";
5
- import { BotmanorPermissionGate as ee } from "../permissions/useBotmanorPermissions.js";
6
- import { Card as i, CardContent as a, CardDescription as o, CardHeader as s, CardTitle as c } from "../components/Card.js";
7
- import { Button as l } from "../components/Button.js";
8
- import { Input as u } from "../components/Input.js";
9
- import { Badge as d } from "../components/Badge.js";
10
- import { EmptyState as te } from "../components/EmptyState.js";
11
- import { LoadMore as ne } from "../components/LoadMore.js";
12
- import { ErrorState as re } from "../components/ErrorState.js";
3
+ import { PageLayout as ee } from "../components/PageLayout.js";
4
+ import { BOTMANOR_PERMISSIONS as te } from "../permissions/botmanorPermissions.js";
5
+ import { BotmanorPermissionGate as n } from "../permissions/useBotmanorPermissions.js";
6
+ import { Card as r, CardContent as i, CardDescription as a, CardHeader as o, CardTitle as s } from "../components/Card.js";
7
+ import { Button as c } from "../components/Button.js";
8
+ import { Input as ne } from "../components/Input.js";
9
+ import { Badge as l } from "../components/Badge.js";
10
+ import { EmptyState as re } from "../components/EmptyState.js";
11
+ import { LoadMore as u } from "../components/LoadMore.js";
12
+ import { ErrorState as d } from "../components/ErrorState.js";
13
13
  import "../hooks/index.js";
14
- import { formatRelativeTime as ie } from "../utils/formatters.js";
15
- import { storePackageDescription as ae, storePackageName as f, useInstallPackage as oe, useInstalledPackageCount as p, useInstalledPackages as m, useStorePackageCount as h, useStorePackages as g } from "../hooks/useStore.js";
16
- import { InstallPackageDialog as _, STORE_PACKAGE_KINDS as v, packageKindLabels as y } from "../components/StoreDialogs.js";
14
+ import { formatRelativeTime as f } from "../utils/formatters.js";
15
+ import { storePackageDescription as p, storePackageName as m, useInstallPackage as h, useInstalledPackageCount as g, useInstalledPackages as ie, useStorePackageCount as _, useStorePackages as ae } from "../hooks/useStore.js";
16
+ import { InstallPackageDialog as v, STORE_PACKAGE_KINDS as y, packageKindLabels as oe } from "../components/StoreDialogs.js";
17
17
  import "../permissions/index.js";
18
18
  import { useMemo as b, useState as x } from "react";
19
19
  import { GlassCard as S, PagePurpose as C } from "@burdenoff/fe-libs/ui";
20
20
  import { jsx as w, jsxs as T } from "react/jsx-runtime";
21
21
  import { Link as E } from "react-router";
22
- import { Bot as D, Check as O, Database as k, FileText as A, Package as j, Search as se, Shield as M, Sparkles as N, Store as P, Wrench as F } from "lucide-react";
23
- import { toast as I } from "sonner";
22
+ import { Bot as D, Check as O, Database as k, FileText as A, Package as j, Search as se, Shield as M, Sparkles as N, Store as P, Upload as F, Wrench as I } from "lucide-react";
23
+ import { toast as L } from "sonner";
24
24
  // src/botlit/pages/StorePage.tsx
25
- var L = ({ kind: e, className: t }) => {
25
+ var R = ({ kind: e, className: t }) => {
26
26
  switch (e) {
27
27
  case "APP": return /* @__PURE__ */ w(j, { className: t });
28
28
  case "AGENT":
29
29
  case "A2A_AGENT": return /* @__PURE__ */ w(D, { className: t });
30
30
  case "MCP_PACK":
31
- case "TOOL": return /* @__PURE__ */ w(F, { className: t });
31
+ case "TOOL": return /* @__PURE__ */ w(I, { className: t });
32
32
  case "PROMPT_TEMPLATE":
33
33
  case "PROMPT": return /* @__PURE__ */ w(A, { className: t });
34
34
  case "SKILL": return /* @__PURE__ */ w(N, { className: t });
@@ -39,43 +39,50 @@ var L = ({ kind: e, className: t }) => {
39
39
  default: return /* @__PURE__ */ w(j, { className: t });
40
40
  }
41
41
  };
42
- function R(e) {
42
+ function z(e) {
43
43
  let t = e.manifest?.security;
44
44
  return !(!t || typeof t != "object" || Array.isArray(t) || t.requiresSecrets !== !0);
45
45
  }
46
- var z = () => {
47
- let D = t(), { getPath: k } = e(), A = y(D), [j, M] = x(""), [N, F] = x([]), [z, B] = x("recent"), [V, H] = x(null), U = b(() => ({
46
+ var B = () => {
47
+ let D = t(), { getPath: k } = e(), A = oe(D), [j, M] = x(""), [N, I] = x([]), [B, V] = x("recent"), [H, U] = x(null), W = b(() => ({
48
48
  search: j,
49
49
  kind: N,
50
- sortBy: z
50
+ sortBy: B
51
51
  }), [
52
52
  j,
53
53
  N,
54
- z
55
- ]), { data: W, loading: G, error: K, refetch: ce, hasMore: le, loadingMore: ue, loadMore: de } = g(U), fe = h(), q = h(U), J = p(), { data: Y, refetch: X } = m(), { install: pe, loading: me } = oe(), Z = j.trim().length > 0 || N.length > 0, Q = b(() => new Set(Y.map((e) => e.package?.slug).filter((e) => typeof e == "string")), [Y]), he = (e) => F((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]), ge = async (e, t) => {
54
+ B
55
+ ]), { data: G, loading: K, error: q, refetch: ce, hasMore: le, loadingMore: ue, loadMore: de } = ae(W), fe = _(), J = _(W), Y = g(), { data: X, refetch: pe } = ie(), { install: me, loading: he } = h(), Z = j.trim().length > 0 || N.length > 0, Q = b(() => new Set(X.map((e) => e.package?.slug).filter((e) => typeof e == "string")), [X]), ge = (e) => I((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]), _e = async (e, t) => {
56
56
  try {
57
- await pe({
57
+ await me({
58
58
  packageId: e.id,
59
59
  mode: t
60
60
  });
61
61
  } catch (e) {
62
- I.error(e instanceof Error ? e.message : D("botlit.store.install.error", "Could not install the package."));
62
+ L.error(e instanceof Error ? e.message : D("botlit.store.install.error", "Could not install the package."));
63
63
  return;
64
64
  }
65
- I.success(D("botlit.store.install.success", "Installed \"{{name}}\"", { name: f(e) })), H(null), X(), J.refetch();
66
- }, $ = W.slice(0, 3);
67
- return /* @__PURE__ */ T(n, {
65
+ L.success(D("botlit.store.install.success", "Installed \"{{name}}\"", { name: m(e) })), U(null), pe(), Y.refetch();
66
+ }, $ = G.slice(0, 3);
67
+ return /* @__PURE__ */ T(ee, {
68
68
  title: D("botlit.store.title", "BotManor Store"),
69
69
  description: D("botlit.store.description", "Discover and install pre-built agents, tools, and configurations"),
70
- actions: /* @__PURE__ */ w("div", {
70
+ actions: /* @__PURE__ */ T("div", {
71
71
  className: "flex gap-2",
72
- children: /* @__PURE__ */ w(l, {
72
+ children: [/* @__PURE__ */ w(c, {
73
73
  variant: "outline",
74
74
  children: /* @__PURE__ */ w(E, {
75
75
  to: k("store/installed"),
76
- children: D("botlit.store.actions.viewInstalled", "View Installed ({{count}})", { count: J.data ?? Y.length })
76
+ children: D("botlit.store.actions.viewInstalled", "View Installed ({{count}})", { count: Y.data ?? X.length })
77
77
  })
78
- })
78
+ }), /* @__PURE__ */ w(c, {
79
+ variant: "outline",
80
+ leftIcon: /* @__PURE__ */ w(F, { size: 16 }),
81
+ children: /* @__PURE__ */ w(E, {
82
+ to: k("store/publish"),
83
+ children: D("botlit.store.actions.publishPackage", "Publish Package")
84
+ })
85
+ })]
79
86
  }),
80
87
  children: [/* @__PURE__ */ T("div", {
81
88
  className: "space-y-6",
@@ -89,7 +96,7 @@ var z = () => {
89
96
  children: [
90
97
  /* @__PURE__ */ T("div", {
91
98
  className: "relative flex-1 max-w-md",
92
- children: [/* @__PURE__ */ w(se, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-text-secondary" }), /* @__PURE__ */ w(u, {
99
+ children: [/* @__PURE__ */ w(se, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-text-secondary" }), /* @__PURE__ */ w(ne, {
93
100
  placeholder: D("botlit.store.searchPlaceholder", "Search packages..."),
94
101
  value: j,
95
102
  onChange: (e) => M(e.target.value),
@@ -100,18 +107,18 @@ var z = () => {
100
107
  className: "flex flex-wrap gap-2",
101
108
  role: "group",
102
109
  "aria-label": D("botlit.store.filters.kindsLabel", "Filter by type"),
103
- children: [/* @__PURE__ */ w(l, {
110
+ children: [/* @__PURE__ */ w(c, {
104
111
  variant: N.length === 0 ? "default" : "outline",
105
112
  size: "sm",
106
113
  "aria-pressed": N.length === 0,
107
- onClick: () => F([]),
114
+ onClick: () => I([]),
108
115
  children: D("botlit.store.filters.all", "All")
109
- }), v.map((e) => /* @__PURE__ */ w(l, {
116
+ }), y.map((e) => /* @__PURE__ */ w(c, {
110
117
  variant: N.includes(e) ? "default" : "outline",
111
118
  size: "sm",
112
119
  "aria-pressed": N.includes(e),
113
- onClick: () => he(e),
114
- leftIcon: /* @__PURE__ */ w(L, {
120
+ onClick: () => ge(e),
121
+ leftIcon: /* @__PURE__ */ w(R, {
115
122
  kind: e,
116
123
  className: "h-4 w-4"
117
124
  }),
@@ -121,8 +128,8 @@ var z = () => {
121
128
  /* @__PURE__ */ T("select", {
122
129
  "aria-label": D("botlit.store.filters.sortLabel", "Sort packages"),
123
130
  className: "h-9 px-3 border border-border-default rounded-md bg-bg-surface text-sm",
124
- value: z,
125
- onChange: (e) => B(e.target.value),
131
+ value: B,
132
+ onChange: (e) => V(e.target.value),
126
133
  children: [/* @__PURE__ */ w("option", {
127
134
  value: "recent",
128
135
  children: D("botlit.store.sort.recent", "Recently Published")
@@ -168,7 +175,7 @@ var z = () => {
168
175
  className: "text-center",
169
176
  children: [/* @__PURE__ */ w("p", {
170
177
  className: "text-2xl font-bold tabular-nums",
171
- children: J.data ?? "…"
178
+ children: Y.data ?? "…"
172
179
  }), /* @__PURE__ */ w("p", {
173
180
  className: "text-xs text-text-secondary",
174
181
  children: D("botlit.store.featured.installed", "Installed")
@@ -177,15 +184,15 @@ var z = () => {
177
184
  })
178
185
  ] })]
179
186
  })
180
- }), /* @__PURE__ */ T(i, { children: [/* @__PURE__ */ w(s, {
187
+ }), /* @__PURE__ */ T(r, { children: [/* @__PURE__ */ w(o, {
181
188
  className: "pb-2",
182
- children: /* @__PURE__ */ w(c, {
189
+ children: /* @__PURE__ */ w(s, {
183
190
  className: "text-sm",
184
191
  children: D("botlit.store.featured.quickInstall", "Quick Install")
185
192
  })
186
- }), /* @__PURE__ */ w(a, {
193
+ }), /* @__PURE__ */ w(i, {
187
194
  className: "space-y-2",
188
- children: G ? /* @__PURE__ */ w("p", {
195
+ children: K ? /* @__PURE__ */ w("p", {
189
196
  className: "text-sm text-text-secondary",
190
197
  children: D("botlit.store.quickInstall.loading", "Loading packages…")
191
198
  }) : $.length === 0 ? /* @__PURE__ */ w("p", {
@@ -195,35 +202,35 @@ var z = () => {
195
202
  className: "flex items-center justify-between rounded bg-bg-sunken p-2",
196
203
  children: [/* @__PURE__ */ T("div", {
197
204
  className: "flex min-w-0 items-center gap-2",
198
- children: [/* @__PURE__ */ w(L, {
205
+ children: [/* @__PURE__ */ w(R, {
199
206
  kind: e.kind,
200
207
  className: "h-4 w-4 text-text-secondary"
201
208
  }), /* @__PURE__ */ w("span", {
202
209
  className: "max-w-[150px] truncate text-sm",
203
- children: f(e)
210
+ children: m(e)
204
211
  })]
205
- }), Q.has(e.slug) ? /* @__PURE__ */ T(d, {
212
+ }), Q.has(e.slug) ? /* @__PURE__ */ T(l, {
206
213
  variant: "success",
207
214
  className: "text-xs",
208
215
  children: [/* @__PURE__ */ w(O, {
209
216
  size: 12,
210
217
  className: "mr-1"
211
218
  }), D("botlit.store.install.installedBadge", "Installed")]
212
- }) : /* @__PURE__ */ w(ee, {
213
- permission: r.STORE_CREATE,
214
- children: /* @__PURE__ */ w(l, {
219
+ }) : /* @__PURE__ */ w(n, {
220
+ permission: te.STORE_CREATE,
221
+ children: /* @__PURE__ */ w(c, {
215
222
  size: "sm",
216
223
  variant: "ghost",
217
224
  className: "h-6 text-xs",
218
- "aria-label": D("botlit.store.install.actionFor", "Install {{name}}", { name: f(e) }),
219
- onClick: () => H(e),
225
+ "aria-label": D("botlit.store.install.actionFor", "Install {{name}}", { name: m(e) }),
226
+ onClick: () => U(e),
220
227
  children: D("botlit.store.install.action", "Install")
221
228
  })
222
229
  })]
223
230
  }, e.id))
224
231
  })] })]
225
232
  }),
226
- G ? /* @__PURE__ */ w("div", {
233
+ K ? /* @__PURE__ */ w("div", {
227
234
  className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",
228
235
  children: [
229
236
  1,
@@ -233,30 +240,30 @@ var z = () => {
233
240
  5,
234
241
  6
235
242
  ].map((e) => /* @__PURE__ */ w("div", { className: "h-56 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" }, e))
236
- }) : K ? /* @__PURE__ */ w(re, {
243
+ }) : q ? /* @__PURE__ */ w(d, {
237
244
  resource: "store packages",
238
- error: K,
245
+ error: q,
239
246
  onRetry: () => void ce()
240
- }) : W.length > 0 ? /* @__PURE__ */ w("div", {
247
+ }) : G.length > 0 ? /* @__PURE__ */ w("div", {
241
248
  className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",
242
- children: W.map((e) => /* @__PURE__ */ w(E, {
249
+ children: G.map((e) => /* @__PURE__ */ w(E, {
243
250
  to: k(`store/package/${e.slug}`),
244
- children: /* @__PURE__ */ T(i, {
251
+ children: /* @__PURE__ */ T(r, {
245
252
  className: "h-full hover:border-primary/50 transition-colors cursor-pointer",
246
- children: [/* @__PURE__ */ w(s, { children: /* @__PURE__ */ T("div", {
253
+ children: [/* @__PURE__ */ w(o, { children: /* @__PURE__ */ T("div", {
247
254
  className: "flex items-start justify-between",
248
255
  children: [/* @__PURE__ */ T("div", {
249
256
  className: "flex items-center gap-3",
250
257
  children: [/* @__PURE__ */ w("div", {
251
258
  className: "p-2 bg-action-primary-bg/10 rounded-lg",
252
- children: /* @__PURE__ */ w(L, {
259
+ children: /* @__PURE__ */ w(R, {
253
260
  kind: e.kind,
254
261
  className: "h-5 w-5 text-primary"
255
262
  })
256
- }), /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w(c, {
263
+ }), /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w(s, {
257
264
  className: "text-base",
258
- children: f(e)
259
- }), /* @__PURE__ */ T(o, {
265
+ children: m(e)
266
+ }), /* @__PURE__ */ T(a, {
260
267
  className: "text-xs",
261
268
  children: [
262
269
  e.slug,
@@ -264,7 +271,7 @@ var z = () => {
264
271
  e.version
265
272
  ]
266
273
  })] })]
267
- }), Q.has(e.slug) && /* @__PURE__ */ T(d, {
274
+ }), Q.has(e.slug) && /* @__PURE__ */ T(l, {
268
275
  variant: "success",
269
276
  className: "text-xs",
270
277
  children: [/* @__PURE__ */ w(O, {
@@ -272,52 +279,52 @@ var z = () => {
272
279
  className: "mr-1"
273
280
  }), D("botlit.store.install.installedBadge", "Installed")]
274
281
  })]
275
- }) }), /* @__PURE__ */ w(a, { children: /* @__PURE__ */ T("div", {
282
+ }) }), /* @__PURE__ */ w(i, { children: /* @__PURE__ */ T("div", {
276
283
  className: "space-y-3",
277
284
  children: [/* @__PURE__ */ w("p", {
278
285
  className: "text-sm text-text-secondary line-clamp-2",
279
- children: ae(e)
286
+ children: p(e)
280
287
  }), /* @__PURE__ */ T("div", {
281
288
  className: "pt-3 border-t border-border-subtle flex items-center justify-between",
282
- children: [/* @__PURE__ */ w(d, {
289
+ children: [/* @__PURE__ */ w(l, {
283
290
  variant: "outline",
284
291
  className: "text-xs",
285
292
  children: A[e.kind] ?? e.kind
286
293
  }), /* @__PURE__ */ w("span", {
287
294
  className: "text-xs text-text-secondary",
288
- children: ie(e.publishedAt)
295
+ children: f(e.publishedAt)
289
296
  })]
290
297
  })]
291
298
  }) })]
292
299
  })
293
300
  }, e.id))
294
- }) : /* @__PURE__ */ w(te, {
301
+ }) : /* @__PURE__ */ w(re, {
295
302
  illustration: "empty-search",
296
303
  title: D("botlit.store.empty.title", "No packages found"),
297
304
  description: Z ? D("botlit.store.empty.descriptionFiltered", "Try adjusting your search or filters.") : D("botlit.store.empty.descriptionNoPackages", "No packages available in the store yet.")
298
305
  }),
299
- Z && q.data !== null && W.length > 0 ? /* @__PURE__ */ w("p", {
306
+ Z && J.data !== null && G.length > 0 ? /* @__PURE__ */ w("p", {
300
307
  className: "text-sm text-text-secondary",
301
308
  "aria-live": "polite",
302
- children: D("botlit.store.matchCount", "{{count}} package(s) match", { count: q.data })
309
+ children: D("botlit.store.matchCount", "{{count}} package(s) match", { count: J.data })
303
310
  }) : null,
304
- /* @__PURE__ */ w(ne, {
311
+ /* @__PURE__ */ w(u, {
305
312
  hasMore: le,
306
313
  loadingMore: ue,
307
314
  onLoadMore: () => void de(),
308
- loadedCount: W.length
315
+ loadedCount: G.length
309
316
  })
310
317
  ]
311
- }), /* @__PURE__ */ w(_, {
312
- pkg: V,
313
- name: V ? f(V) : "",
314
- requiresSecrets: V ? R(V) : !1,
315
- installing: me,
316
- onConfirm: (e, t) => void ge(e, t),
317
- onClose: () => H(null)
318
+ }), /* @__PURE__ */ w(v, {
319
+ pkg: H,
320
+ name: H ? m(H) : "",
321
+ requiresSecrets: H ? z(H) : !1,
322
+ installing: he,
323
+ onConfirm: (e, t) => void _e(e, t),
324
+ onClose: () => U(null)
318
325
  })]
319
326
  });
320
327
  };
321
- export { z as StorePage };
328
+ export { B as StorePage };
322
329
 
323
330
  //# sourceMappingURL=StorePage.js.map