11"use client"
22
33import type { TemplateCategory } from "@chatbotx.io/database/partials"
4- import {
5- templateCategories ,
6- templateResourceCategories ,
7- } from "@chatbotx.io/database/partials"
4+ import { templateCategories } from "@chatbotx.io/database/partials"
85import {
96 Accordion ,
107 AccordionContent ,
@@ -28,27 +25,43 @@ import { EMPTY_SELECTION, selectionCount } from "../lib/selection"
2825import { CategoryResourceList } from "./category-resource-list"
2926
3027/**
31- * Categories with a working `listSelectableResources` picker query +
32- * `ResourceCollector.resolveIds`/`collect` — derived from
33- * `templateResourceCategories` (`packages/database/src/partials/template.ts`)
34- * so this list cannot drift from the adapter registry it mirrors: every
35- * resource category has an adapter (`registry.ts`'s
36- * `satisfies Record<TemplateResourceCategory, ResourceAdapter>` with no
37- * `Partial` guarantees that at compile time), so every resource category is
38- * available here too. `tags`/`customFields` are added on top since those two
39- * manifest-only categories also have their own picker + ownership check
40- * (`snapshot.service.ts`'s inline `assertIdsBelongToWorkspace` path).
41- * `productCategories` stays excluded — it is never independently selectable;
42- * a product's category comes along automatically via `productsAdapter`'s
43- * collector.
28+ * Categories currently exposed for sharing. This is a deliberate **product**
29+ * restriction, not a technical one: every category in `ALL_CATEGORIES` still
30+ * has a working adapter and picker query (`registry.ts` enforces adapter
31+ * completeness at compile time via
32+ * `satisfies Record<TemplateResourceCategory, ResourceAdapter>`), so the rest
33+ * are fully implemented — they are just held back from the share flow for now
34+ * and render disabled with a "Coming soon" badge.
35+ *
36+ * Kept as an explicit list rather than derived from
37+ * `templateResourceCategories` so that narrowing what users can share never
38+ * requires touching the enum: that enum feeds a `pgEnum`
39+ * (`schema/template-installed-resource.ts`) and the adapter registry, so
40+ * editing it to gate the UI breaks the build and drifts from the database.
41+ * To release a category, add it back to this array — nothing else.
42+ *
43+ * `productCategories` is excluded for a different, permanent reason: it is
44+ * never independently selectable — a product's category comes along
45+ * automatically via `productsAdapter`'s collector.
4446 */
4547const AVAILABLE_CATEGORIES : readonly TemplateCategory [ ] = [
46- ... templateResourceCategories . options ,
48+ "flows" ,
4749 "tags" ,
4850 "customFields" ,
4951]
5052
51- const ALL_CATEGORIES : readonly TemplateCategory [ ] = templateCategories . options
53+ /**
54+ * Display order: the available categories first, in the order above, then
55+ * every remaining category. The tail is derived from `templateCategories`
56+ * rather than hand-listed so a newly added category still shows up here (as
57+ * "Coming soon") instead of silently vanishing from the form.
58+ */
59+ const ALL_CATEGORIES : readonly TemplateCategory [ ] = [
60+ ...AVAILABLE_CATEGORIES ,
61+ ...templateCategories . options . filter (
62+ ( category ) => ! AVAILABLE_CATEGORIES . includes ( category ) ,
63+ ) ,
64+ ]
5265
5366type TemplateContentsCardProps = {
5467 workspaceId : string
0 commit comments