@flamingo-stack/openframe-frontend-core 0.0.647 → 0.0.648-snapshot.20260917211410

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 (155) hide show
  1. package/dist/chat-protocol/index.cjs.map +1 -1
  2. package/dist/chat-protocol/index.js.map +1 -1
  3. package/dist/{chunk-RXIFYEL7.js → chunk-4OAG7752.js} +5 -5
  4. package/dist/{chunk-MKGAIWQ5.cjs → chunk-742HTNAE.cjs} +3 -3
  5. package/dist/{chunk-MKGAIWQ5.cjs.map → chunk-742HTNAE.cjs.map} +1 -1
  6. package/dist/{chunk-IBTOED4M.cjs → chunk-C3CJJC2A.cjs} +7 -7
  7. package/dist/{chunk-IBTOED4M.cjs.map → chunk-C3CJJC2A.cjs.map} +1 -1
  8. package/dist/{chunk-ZNSBWM2D.js → chunk-C4VPCRSI.js} +4 -4
  9. package/dist/{chunk-RUEVZAPN.js → chunk-CZVFFD3P.js} +5 -5
  10. package/dist/{chunk-V33TSVUR.js → chunk-DVD4CMKB.js} +3 -3
  11. package/dist/{chunk-ABVOAYYS.cjs → chunk-EDDAU2BP.cjs} +44 -44
  12. package/dist/{chunk-ABVOAYYS.cjs.map → chunk-EDDAU2BP.cjs.map} +1 -1
  13. package/dist/{chunk-SS2RN4TU.cjs → chunk-EUGIXBAC.cjs} +13 -24
  14. package/dist/chunk-EUGIXBAC.cjs.map +1 -0
  15. package/dist/{chunk-IKMETQWQ.js → chunk-H6ND7FKB.js} +5 -5
  16. package/dist/{chunk-H3EJDISW.js → chunk-IEM2Z6K6.js} +10 -2
  17. package/dist/chunk-IEM2Z6K6.js.map +1 -0
  18. package/dist/{chunk-VXG43NJD.js → chunk-J2T3XDZX.js} +4 -4
  19. package/dist/{chunk-QPAQEPA3.js → chunk-J5VVA2KW.js} +2 -2
  20. package/dist/{chunk-AKM4AIZY.cjs → chunk-JYFCKQ2K.cjs} +22 -22
  21. package/dist/{chunk-AKM4AIZY.cjs.map → chunk-JYFCKQ2K.cjs.map} +1 -1
  22. package/dist/{chunk-T7NBMDDE.js → chunk-KQGTQXG2.js} +2 -2
  23. package/dist/{chunk-YCSYKAT2.cjs → chunk-KUCBDDQB.cjs} +248 -248
  24. package/dist/{chunk-YCSYKAT2.cjs.map → chunk-KUCBDDQB.cjs.map} +1 -1
  25. package/dist/{chunk-5XBO6URE.cjs → chunk-M2FFL6OG.cjs} +25 -25
  26. package/dist/{chunk-5XBO6URE.cjs.map → chunk-M2FFL6OG.cjs.map} +1 -1
  27. package/dist/{chunk-DLJHXLFG.js → chunk-MAFPT6GS.js} +6 -6
  28. package/dist/{chunk-ASPNYVGE.cjs → chunk-MB33V5S6.cjs} +51 -51
  29. package/dist/{chunk-ASPNYVGE.cjs.map → chunk-MB33V5S6.cjs.map} +1 -1
  30. package/dist/{chunk-ERLGZPCY.js → chunk-MXGGYW2R.js} +7 -7
  31. package/dist/{chunk-EG3PA7L2.cjs → chunk-N72F2XWZ.cjs} +10 -10
  32. package/dist/{chunk-EG3PA7L2.cjs.map → chunk-N72F2XWZ.cjs.map} +1 -1
  33. package/dist/{chunk-L6ES7O6B.js → chunk-O3B34KLC.js} +4 -4
  34. package/dist/{chunk-5YW3GAUR.cjs → chunk-OE6KUWRA.cjs} +424 -305
  35. package/dist/chunk-OE6KUWRA.cjs.map +1 -0
  36. package/dist/{chunk-DIGCERY4.js → chunk-OHNBWBZH.js} +7 -18
  37. package/dist/chunk-OHNBWBZH.js.map +1 -0
  38. package/dist/{chunk-VIAMEQM2.cjs → chunk-OWPMODYT.cjs} +5 -5
  39. package/dist/{chunk-VIAMEQM2.cjs.map → chunk-OWPMODYT.cjs.map} +1 -1
  40. package/dist/{chunk-DWJREJRA.cjs → chunk-PSXUY4K5.cjs} +10 -2
  41. package/dist/chunk-PSXUY4K5.cjs.map +1 -0
  42. package/dist/{chunk-TO4UY3P5.cjs → chunk-QFWZIXJ3.cjs} +75 -75
  43. package/dist/{chunk-TO4UY3P5.cjs.map → chunk-QFWZIXJ3.cjs.map} +1 -1
  44. package/dist/{chunk-GB2RYIVM.js → chunk-QG3ZNNKG.js} +2 -2
  45. package/dist/{chunk-5DCRDV7Y.js → chunk-QVAFZGCF.js} +7 -7
  46. package/dist/{chunk-N6ZYJXVJ.js → chunk-QVKRSUGB.js} +125 -6
  47. package/dist/chunk-QVKRSUGB.js.map +1 -0
  48. package/dist/{chunk-6Z4GSQPB.js → chunk-RHJ4NU3W.js} +2 -2
  49. package/dist/{chunk-RIOWS34T.js → chunk-UOOXFD74.js} +3 -3
  50. package/dist/{chunk-F4I46MKF.cjs → chunk-W554ING6.cjs} +12 -12
  51. package/dist/{chunk-F4I46MKF.cjs.map → chunk-W554ING6.cjs.map} +1 -1
  52. package/dist/{chunk-Q2XH3HW6.cjs → chunk-W7KFDHIU.cjs} +37 -37
  53. package/dist/{chunk-Q2XH3HW6.cjs.map → chunk-W7KFDHIU.cjs.map} +1 -1
  54. package/dist/{chunk-RSRYEVGZ.cjs → chunk-XIBBDYJK.cjs} +5 -5
  55. package/dist/{chunk-RSRYEVGZ.cjs.map → chunk-XIBBDYJK.cjs.map} +1 -1
  56. package/dist/{chunk-EZ6HGRLP.cjs → chunk-Y5EEPXT3.cjs} +33 -33
  57. package/dist/{chunk-EZ6HGRLP.cjs.map → chunk-Y5EEPXT3.cjs.map} +1 -1
  58. package/dist/{chunk-DBSU5RAE.cjs → chunk-YCBGEHWC.cjs} +3 -3
  59. package/dist/{chunk-DBSU5RAE.cjs.map → chunk-YCBGEHWC.cjs.map} +1 -1
  60. package/dist/components/case-studies/index.cjs +20 -20
  61. package/dist/components/case-studies/index.js +5 -5
  62. package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
  63. package/dist/components/chat/index.cjs +3 -3
  64. package/dist/components/chat/index.js +2 -2
  65. package/dist/components/chat/types/message.types.d.ts +5 -0
  66. package/dist/components/chat/types/message.types.d.ts.map +1 -1
  67. package/dist/components/chat/utils/cited-sources.d.ts +5 -0
  68. package/dist/components/chat/utils/cited-sources.d.ts.map +1 -1
  69. package/dist/components/chat/utils/source-row-cta.d.ts +2 -7
  70. package/dist/components/chat/utils/source-row-cta.d.ts.map +1 -1
  71. package/dist/components/contact/index.cjs +6 -6
  72. package/dist/components/contact/index.js +5 -5
  73. package/dist/components/docs/index.cjs +9 -9
  74. package/dist/components/docs/index.js +8 -8
  75. package/dist/components/embeds/index.cjs +6 -6
  76. package/dist/components/embeds/index.js +5 -5
  77. package/dist/components/faq/index.cjs +6 -6
  78. package/dist/components/faq/index.js +5 -5
  79. package/dist/components/features/index.cjs +5 -5
  80. package/dist/components/features/index.js +4 -4
  81. package/dist/components/help-center-pages/index.cjs +25 -25
  82. package/dist/components/help-center-pages/index.js +16 -16
  83. package/dist/components/icons/index.cjs +4 -2
  84. package/dist/components/icons/index.cjs.map +1 -1
  85. package/dist/components/icons/index.d.ts +1 -0
  86. package/dist/components/icons/index.d.ts.map +1 -1
  87. package/dist/components/icons/index.js +3 -1
  88. package/dist/components/icons/quickbooks-icon.d.ts +7 -0
  89. package/dist/components/icons/quickbooks-icon.d.ts.map +1 -0
  90. package/dist/components/index.cjs +44 -42
  91. package/dist/components/index.cjs.map +1 -1
  92. package/dist/components/index.js +17 -15
  93. package/dist/components/index.js.map +1 -1
  94. package/dist/components/meeting-scheduler/index.cjs +28 -28
  95. package/dist/components/meeting-scheduler/index.js +4 -4
  96. package/dist/components/navigation/index.cjs +8 -8
  97. package/dist/components/navigation/index.js +7 -7
  98. package/dist/components/onboarding-guides/index.cjs +8 -8
  99. package/dist/components/onboarding-guides/index.js +7 -7
  100. package/dist/components/shared/doc-search/map-doc-search-results.d.ts.map +1 -1
  101. package/dist/components/tickets/index.cjs +9 -9
  102. package/dist/components/tickets/index.js +8 -8
  103. package/dist/components/ui/index.cjs +5 -5
  104. package/dist/components/ui/index.js +4 -4
  105. package/dist/hooks/index.cjs +3 -3
  106. package/dist/hooks/index.js +2 -2
  107. package/dist/index.cjs +23 -9
  108. package/dist/index.cjs.map +1 -1
  109. package/dist/index.js +22 -8
  110. package/dist/index.js.map +1 -1
  111. package/dist/utils/index.cjs +163 -0
  112. package/dist/utils/index.cjs.map +1 -1
  113. package/dist/utils/index.d.ts +1 -0
  114. package/dist/utils/index.d.ts.map +1 -1
  115. package/dist/utils/index.js +158 -1
  116. package/dist/utils/index.js.map +1 -1
  117. package/dist/utils/source-grouping.d.ts +86 -0
  118. package/dist/utils/source-grouping.d.ts.map +1 -0
  119. package/dist/utils/source-icons.d.ts +7 -0
  120. package/dist/utils/source-icons.d.ts.map +1 -1
  121. package/package.json +1 -1
  122. package/src/components/chat/embeddable-chat.tsx +10 -2
  123. package/src/components/chat/types/message.types.ts +5 -0
  124. package/src/components/chat/utils/cited-sources.ts +7 -1
  125. package/src/components/chat/utils/source-row-cta.ts +4 -7
  126. package/src/components/icons/index.ts +1 -0
  127. package/src/components/icons/quickbooks-icon.tsx +13 -0
  128. package/src/components/shared/doc-search/__tests__/map-doc-search-results.test.ts +48 -0
  129. package/src/components/shared/doc-search/map-doc-search-results.ts +6 -16
  130. package/src/components/ui/markdown/__tests__/mermaid-zoom.test.tsx +2 -0
  131. package/src/utils/__tests__/source-grouping.test.ts +240 -0
  132. package/src/utils/index.ts +11 -0
  133. package/src/utils/source-grouping.ts +215 -0
  134. package/src/utils/source-icons.ts +13 -0
  135. package/dist/chunk-5YW3GAUR.cjs.map +0 -1
  136. package/dist/chunk-DIGCERY4.js.map +0 -1
  137. package/dist/chunk-DWJREJRA.cjs.map +0 -1
  138. package/dist/chunk-H3EJDISW.js.map +0 -1
  139. package/dist/chunk-N6ZYJXVJ.js.map +0 -1
  140. package/dist/chunk-SS2RN4TU.cjs.map +0 -1
  141. /package/dist/{chunk-RXIFYEL7.js.map → chunk-4OAG7752.js.map} +0 -0
  142. /package/dist/{chunk-ZNSBWM2D.js.map → chunk-C4VPCRSI.js.map} +0 -0
  143. /package/dist/{chunk-RUEVZAPN.js.map → chunk-CZVFFD3P.js.map} +0 -0
  144. /package/dist/{chunk-V33TSVUR.js.map → chunk-DVD4CMKB.js.map} +0 -0
  145. /package/dist/{chunk-IKMETQWQ.js.map → chunk-H6ND7FKB.js.map} +0 -0
  146. /package/dist/{chunk-VXG43NJD.js.map → chunk-J2T3XDZX.js.map} +0 -0
  147. /package/dist/{chunk-QPAQEPA3.js.map → chunk-J5VVA2KW.js.map} +0 -0
  148. /package/dist/{chunk-T7NBMDDE.js.map → chunk-KQGTQXG2.js.map} +0 -0
  149. /package/dist/{chunk-DLJHXLFG.js.map → chunk-MAFPT6GS.js.map} +0 -0
  150. /package/dist/{chunk-ERLGZPCY.js.map → chunk-MXGGYW2R.js.map} +0 -0
  151. /package/dist/{chunk-L6ES7O6B.js.map → chunk-O3B34KLC.js.map} +0 -0
  152. /package/dist/{chunk-GB2RYIVM.js.map → chunk-QG3ZNNKG.js.map} +0 -0
  153. /package/dist/{chunk-5DCRDV7Y.js.map → chunk-QVAFZGCF.js.map} +0 -0
  154. /package/dist/{chunk-6Z4GSQPB.js.map → chunk-RHJ4NU3W.js.map} +0 -0
  155. /package/dist/{chunk-RIOWS34T.js.map → chunk-UOOXFD74.js.map} +0 -0
@@ -0,0 +1,215 @@
1
+ /**
2
+ * Grouped source chips: THE one owner, for every producer.
3
+ *
4
+ * "ClickUp Tasks (14 records)" with a per-row dropdown is built in exactly one
5
+ * place, `buildGroupedSource`, and WHICH rows group is decided in exactly one
6
+ * place, `groupsByTable`. Three producers call them:
7
+ *
8
+ * 1. the hub's web chat (`buildSourcesMeta`), server-side, over the rows it
9
+ * retrieved;
10
+ * 2. the hub's side-channel chips (my-tickets / my-tasks), server-side, over
11
+ * rows a strategy injected;
12
+ * 3. this chat's strip, client-side, over the FLAT sources a remote MCP tool
13
+ * returns (`groupSourcesByTable`).
14
+ *
15
+ * Why the third one is client-side: an MCP tool result is one self-describing
16
+ * citation per record, which is what a citation contract should be, and a turn
17
+ * that calls several tools yields several flat lists only the client ever sees
18
+ * merged. Grouping is presentation. It is the SAME presentation everywhere
19
+ * because it is the same two functions everywhere.
20
+ *
21
+ * Server-safe: no React, no browser APIs. The hub imports it from the `utils`
22
+ * barrel next to `getSourceLabel`.
23
+ */
24
+
25
+ import type { ChatSource } from '../components/chat/types/message.types';
26
+ import { defaultDocumentTypeForTableId, getSourceLabel } from './source-icons';
27
+
28
+ /**
29
+ * Doc-table documentTypes: whole documents with their own viewer (markdown =
30
+ * product docs, data_room_doc = data room). They carry an in-app `path`, an
31
+ * embedder keys `docPlatformTargets` by them, and they NEVER group: one chip
32
+ * per document. The hub's per-source contract test pins this list to its
33
+ * doc-table configs.
34
+ */
35
+ export const DOC_TABLE_TYPES = ['markdown', 'data_room_doc'] as const;
36
+
37
+ /** THE rule: rows of a knowledge table share one chip unless they are whole
38
+ * documents. Decided by `documentType`, the one fact every producer has. */
39
+ export function groupsByTable(documentType: string | null | undefined): boolean {
40
+ return !(DOC_TABLE_TYPES as readonly string[]).includes(documentType ?? '');
41
+ }
42
+
43
+ /** `(1 record)` / `(14 records)`: the count every grouped chip states. */
44
+ export function recordCountLabel(count: number): string {
45
+ return `(${count} ${count === 1 ? 'record' : 'records'})`;
46
+ }
47
+
48
+ type GroupedItem = NonNullable<ChatSource['items']>[number];
49
+
50
+ /** One row of a group. `index` is set only when the row was cited on its own
51
+ * (a flat MCP source); a server-grouped row shares the group's number. */
52
+ export type GroupedSourceRow = GroupedItem;
53
+
54
+ /**
55
+ * THE grouped-chip constructor. Order-preserving: a producer that wants its
56
+ * dropdown by date sorts `rows` first.
57
+ *
58
+ * `items` is ALWAYS populated, rows without a public URL included: per-row
59
+ * `id` + `documentType` is what gives every dropdown row its Ask action, and a
60
+ * chip with `items` never navigates to `path`, which for an entity table is
61
+ * mapper bookkeeping and not a route.
62
+ */
63
+ export function buildGroupedSource(spec: {
64
+ /** The chip's citation number (and React key). */
65
+ index: number;
66
+ sourceRepo: string;
67
+ rows: GroupedSourceRow[];
68
+ /** Chip-level link, when it is not the first row's own. */
69
+ externalUrl?: string;
70
+ targetPlatform?: string | null;
71
+ }): ChatSource {
72
+ const first = spec.rows[0];
73
+ const externalUrl = spec.externalUrl ?? first?.externalUrl;
74
+ const targetPlatform = spec.targetPlatform !== undefined ? spec.targetPlatform : first?.targetPlatform;
75
+ return {
76
+ index: spec.index,
77
+ name: `${getSourceLabel(spec.sourceRepo)} ${recordCountLabel(spec.rows.length)}`,
78
+ path: first?.path ?? '',
79
+ documentType: first?.documentType ?? '',
80
+ ...(externalUrl ? { externalUrl } : {}),
81
+ targetPlatform: targetPlatform ?? null,
82
+ sourceRepo: spec.sourceRepo,
83
+ items: spec.rows,
84
+ };
85
+ }
86
+
87
+ type TableSource = ChatSource & { sourceRepo: string };
88
+
89
+ /** A chip the server already grouped (it carries `items`). */
90
+ function isGroupedChip(source: ChatSource): boolean {
91
+ return !!source.items && source.items.length > 0;
92
+ }
93
+
94
+ /** A source's type, or its TABLE's canonical type when the row arrived without
95
+ * one. The table is the stronger fact: a typeless row of a doc table is still
96
+ * a whole document, and a typeless row of an entity table still groups. */
97
+ function typeOf(source: TableSource): string {
98
+ return source.documentType || defaultDocumentTypeForTableId(source.sourceRepo) || '';
99
+ }
100
+
101
+ /** A source that belongs to its table's chip: it names its table and is not a
102
+ * whole document. Both shapes qualify, a flat row AND a chip the server
103
+ * already grouped, so one table is never drawn twice. Naming the table is the
104
+ * ONLY requirement: a row with no `id`, or no `documentType`, still joins (as
105
+ * the hub's server-side chips do). Leaving it out would split one table
106
+ * across a group AND a stray chip. What it lacks only limits its dropdown
107
+ * row: no `id` or no type means Open-only, no Ask. */
108
+ function joinsTableChip(source: ChatSource): source is TableSource {
109
+ if (!source.sourceRepo) return false;
110
+ return groupsByTable(typeOf({ ...source, sourceRepo: source.sourceRepo }));
111
+ }
112
+
113
+ /** A source's dropdown rows: a grouped chip's own items, or the flat row itself. */
114
+ function rowsOf(source: TableSource): GroupedSourceRow[] {
115
+ if (isGroupedChip(source)) return source.items ?? [];
116
+ return [
117
+ {
118
+ index: source.index,
119
+ id: source.id ?? '',
120
+ documentType: typeOf(source),
121
+ name: source.name,
122
+ ...(source.externalUrl ? { externalUrl: source.externalUrl } : {}),
123
+ targetPlatform: source.targetPlatform ?? null,
124
+ path: source.path || null,
125
+ },
126
+ ];
127
+ }
128
+
129
+ /** First occurrence wins per record, so a record that arrived both inside a
130
+ * server chip and as a flat row is one dropdown row. Id-less rows cannot be
131
+ * told apart and are all kept. */
132
+ function uniqueRows(rows: GroupedSourceRow[]): GroupedSourceRow[] {
133
+ const seen = new Set<string>();
134
+ return rows.filter(row => {
135
+ if (!row.id) return true;
136
+ const identity = `${row.documentType}:${row.id}`;
137
+ if (seen.has(identity)) return false;
138
+ seen.add(identity);
139
+ return true;
140
+ });
141
+ }
142
+
143
+ /**
144
+ * Flat sources in, the strip's chips out: ONE chip per table.
145
+ *
146
+ * Every row that names its table joins that table's chip, a lone record and a
147
+ * row missing its `id` or `documentType` included, exactly as the hub's web chat draws it. Each flat row
148
+ * keeps the citation number it was given, so `[3]` in the answer still
149
+ * resolves inside the group. The chip sits where its table first appeared and
150
+ * takes that source's `index` (unique, members are disjoint), so the strip
151
+ * keeps the order it was handed: reading order for cited sources.
152
+ *
153
+ * A chip the server already grouped passes through UNTOUCHED when it is its
154
+ * table's only source. When flat rows of the same table arrive beside it (a
155
+ * hub-injected chip plus MCP-cited rows in one answer), they merge into it:
156
+ * its rows first, its chip-level link kept, the count restated. Whole
157
+ * documents and rows naming no table pass through as their own chips.
158
+ */
159
+ export function groupSourcesByTable(sources: ChatSource[]): ChatSource[] {
160
+ const membersByTable = new Map<string, TableSource[]>();
161
+ for (const source of sources) {
162
+ if (!joinsTableChip(source)) continue;
163
+ const members = membersByTable.get(source.sourceRepo) ?? [];
164
+ members.push(source);
165
+ membersByTable.set(source.sourceRepo, members);
166
+ }
167
+
168
+ const emitted = new Set<string>();
169
+ const chips: ChatSource[] = [];
170
+ for (const source of sources) {
171
+ if (!joinsTableChip(source)) {
172
+ chips.push(source);
173
+ continue;
174
+ }
175
+ if (emitted.has(source.sourceRepo)) continue;
176
+ emitted.add(source.sourceRepo);
177
+
178
+ const members = membersByTable.get(source.sourceRepo) ?? [];
179
+ if (members.length === 1 && isGroupedChip(source)) {
180
+ chips.push(source);
181
+ continue;
182
+ }
183
+ // A server chip may carry a chip-level link that is not its first row's.
184
+ const serverChip = members.find(isGroupedChip);
185
+ chips.push(
186
+ buildGroupedSource({
187
+ index: source.index,
188
+ sourceRepo: source.sourceRepo,
189
+ rows: uniqueRows(members.flatMap(rowsOf)),
190
+ ...(serverChip?.externalUrl ? { externalUrl: serverChip.externalUrl } : {}),
191
+ ...(serverChip && serverChip.targetPlatform !== undefined ? { targetPlatform: serverChip.targetPlatform } : {}),
192
+ }),
193
+ );
194
+ }
195
+ return chips;
196
+ }
197
+
198
+ /**
199
+ * The citation numbers a chip answers to, as compact text: `1-3, 7`.
200
+ *
201
+ * A chip grouped from flat sources stands for several `[N]` markers, so it
202
+ * shows all of them. Consecutive numbers fold into a range, which keeps a
203
+ * 25-row group readable.
204
+ */
205
+ export function formatCitationIndices(indices: number[]): string {
206
+ const sorted = [...new Set(indices)].sort((a, b) => a - b);
207
+ const runs: string[] = [];
208
+ for (let start = 0; start < sorted.length;) {
209
+ let end = start;
210
+ while (end + 1 < sorted.length && sorted[end + 1] === sorted[end] + 1) end++;
211
+ runs.push(end === start ? `${sorted[start]}` : `${sorted[start]}-${sorted[end]}`);
212
+ start = end + 1;
213
+ }
214
+ return runs.join(', ');
215
+ }
@@ -256,3 +256,16 @@ export const DEFAULT_DOCUMENT_TYPE_TO_TABLE_ID: Record<string, string> = {
256
256
  export function defaultTableIdForDocumentType(documentType: string): string | null {
257
257
  return DEFAULT_DOCUMENT_TYPE_TO_TABLE_ID[documentType] ?? null;
258
258
  }
259
+
260
+ /**
261
+ * The reverse lookup: a table's canonical `documentType`. The map above is
262
+ * 1:1 (the hub's per-source contract test pins one type per table), so a row
263
+ * that names its table but arrived with no type still has one. `null` for a
264
+ * table the map does not list.
265
+ */
266
+ export function defaultDocumentTypeForTableId(tableId: string): string | null {
267
+ for (const [documentType, table] of Object.entries(DEFAULT_DOCUMENT_TYPE_TO_TABLE_ID)) {
268
+ if (table === tableId) return documentType;
269
+ }
270
+ return null;
271
+ }