@flamingo-stack/openframe-frontend-core 0.0.346 → 0.0.347-snapshot.20260630182958
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/{chunk-ZRDNWL5E.cjs → chunk-3JIUN64F.cjs} +34 -34
- package/dist/{chunk-ZRDNWL5E.cjs.map → chunk-3JIUN64F.cjs.map} +1 -1
- package/dist/{chunk-N2DVKXN4.cjs → chunk-3KEBI6TP.cjs} +1 -1
- package/dist/chunk-3KEBI6TP.cjs.map +1 -0
- package/dist/{chunk-MN22HDBG.js → chunk-4RMUTJTZ.js} +3 -3
- package/dist/{chunk-OTBKT3TK.cjs → chunk-4UUFNLXQ.cjs} +7 -7
- package/dist/{chunk-OTBKT3TK.cjs.map → chunk-4UUFNLXQ.cjs.map} +1 -1
- package/dist/{chunk-TMSJLMQR.js → chunk-6BW37KWJ.js} +7 -7
- package/dist/{chunk-F2I4MATE.js → chunk-7CBXPBSB.js} +13 -5
- package/dist/{chunk-F2I4MATE.js.map → chunk-7CBXPBSB.js.map} +1 -1
- package/dist/{chunk-J5MX3DVV.cjs → chunk-CH2F32CW.cjs} +72 -72
- package/dist/{chunk-J5MX3DVV.cjs.map → chunk-CH2F32CW.cjs.map} +1 -1
- package/dist/{chunk-ZOJXKWZ2.js → chunk-DU5LLHRI.js} +7 -7
- package/dist/{chunk-SWGXCGQ3.js → chunk-FPAF4JHM.js} +2 -2
- package/dist/{chunk-TYQIQRKP.cjs → chunk-IROBEIGB.cjs} +41 -41
- package/dist/{chunk-TYQIQRKP.cjs.map → chunk-IROBEIGB.cjs.map} +1 -1
- package/dist/{chunk-SY37FQHF.cjs → chunk-JKJO7HVH.cjs} +3 -3
- package/dist/{chunk-SY37FQHF.cjs.map → chunk-JKJO7HVH.cjs.map} +1 -1
- package/dist/{chunk-UVMYVFKF.cjs → chunk-K5G3JKIU.cjs} +7 -7
- package/dist/{chunk-UVMYVFKF.cjs.map → chunk-K5G3JKIU.cjs.map} +1 -1
- package/dist/{chunk-65VXW6GZ.js → chunk-KYCZ4ISB.js} +2 -2
- package/dist/{chunk-4VTLGXPP.cjs → chunk-LBBRR56M.cjs} +29 -29
- package/dist/{chunk-4VTLGXPP.cjs.map → chunk-LBBRR56M.cjs.map} +1 -1
- package/dist/{chunk-U753V4RJ.cjs → chunk-MZGJBQ72.cjs} +15 -15
- package/dist/{chunk-U753V4RJ.cjs.map → chunk-MZGJBQ72.cjs.map} +1 -1
- package/dist/{chunk-2FI3USTC.js → chunk-NA7XJRWB.js} +1 -1
- package/dist/chunk-NA7XJRWB.js.map +1 -0
- package/dist/{chunk-PJURNBZN.js → chunk-NUO4JXTS.js} +2 -2
- package/dist/{chunk-IHF4X2CV.cjs → chunk-O5D3YWMW.cjs} +78 -70
- package/dist/chunk-O5D3YWMW.cjs.map +1 -0
- package/dist/{chunk-DD2N4TYV.cjs → chunk-PQG3L4MK.cjs} +40 -40
- package/dist/{chunk-DD2N4TYV.cjs.map → chunk-PQG3L4MK.cjs.map} +1 -1
- package/dist/{chunk-SSYBCT2I.cjs → chunk-QZVKSUPR.cjs} +77 -77
- package/dist/{chunk-SSYBCT2I.cjs.map → chunk-QZVKSUPR.cjs.map} +1 -1
- package/dist/{chunk-DCIB6AK3.cjs → chunk-RD3HIB25.cjs} +5 -5
- package/dist/{chunk-DCIB6AK3.cjs.map → chunk-RD3HIB25.cjs.map} +1 -1
- package/dist/{chunk-P6B7EX3K.js → chunk-RDJNK5AV.js} +2 -2
- package/dist/{chunk-SBCKCSKU.js → chunk-RT6GEODM.js} +4 -4
- package/dist/{chunk-5RKCZ6IG.js → chunk-WADLOXCY.js} +6 -6
- package/dist/{chunk-3TRA3DMM.js → chunk-XBJJIMIG.js} +4 -4
- package/dist/{chunk-RVQ2K44P.cjs → chunk-YFOLFU7F.cjs} +14 -14
- package/dist/{chunk-RVQ2K44P.cjs.map → chunk-YFOLFU7F.cjs.map} +1 -1
- package/dist/{chunk-UMY7EN5L.js → chunk-YOVM7KGM.js} +3 -3
- package/dist/{chunk-LAWMFRKL.cjs → chunk-YTSX3CIK.cjs} +19 -19
- package/dist/{chunk-LAWMFRKL.cjs.map → chunk-YTSX3CIK.cjs.map} +1 -1
- package/dist/{chunk-BQN7VPXU.js → chunk-YWEWRAMA.js} +6 -6
- package/dist/{chunk-J6HCSDFS.js → chunk-ZS7YHQXO.js} +3 -3
- package/dist/components/announcement-bar.d.ts.map +1 -1
- package/dist/components/case-studies/index.cjs +10 -10
- package/dist/components/case-studies/index.js +4 -4
- package/dist/components/chat/embeddable-chat.d.ts +24 -0
- package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
- package/dist/components/chat/index.cjs +4 -4
- package/dist/components/chat/index.js +3 -3
- package/dist/components/contact/index.cjs +5 -5
- package/dist/components/contact/index.js +4 -4
- package/dist/components/docs/index.cjs +7 -7
- package/dist/components/docs/index.js +6 -6
- package/dist/components/embeds/index.cjs +5 -5
- package/dist/components/embeds/index.js +4 -4
- package/dist/components/faq/index.cjs +6 -6
- package/dist/components/faq/index.js +5 -5
- package/dist/components/features/index.cjs +4 -4
- package/dist/components/features/index.js +3 -3
- package/dist/components/help-center-pages/index.cjs +23 -23
- package/dist/components/help-center-pages/index.js +14 -14
- package/dist/components/index.cjs +135 -135
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +18 -18
- package/dist/components/index.js.map +1 -1
- package/dist/components/navigation/index.cjs +4 -4
- package/dist/components/navigation/index.js +3 -3
- package/dist/components/onboarding-guides/index.cjs +8 -8
- package/dist/components/onboarding-guides/index.js +7 -7
- package/dist/components/related-content/index.cjs +6 -6
- package/dist/components/related-content/index.js +5 -5
- package/dist/components/tickets/index.cjs +7 -7
- package/dist/components/tickets/index.js +6 -6
- package/dist/components/ui/index.cjs +4 -4
- package/dist/components/ui/index.js +3 -3
- package/dist/contexts/chat-runtime-context.d.ts +9 -0
- package/dist/contexts/chat-runtime-context.d.ts.map +1 -1
- package/dist/contexts/index.cjs +2 -2
- package/dist/contexts/index.js +1 -1
- package/dist/hooks/index.cjs +3 -3
- package/dist/hooks/index.js +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.js +3 -3
- package/dist/types/announcement.cjs.map +1 -1
- package/dist/types/announcement.d.ts +17 -22
- package/dist/types/announcement.d.ts.map +1 -1
- package/dist/types/announcement.js.map +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/supabase.d.ts +6 -9
- package/dist/types/supabase.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/announcement-bar.tsx +9 -6
- package/src/components/chat/.embeddable-chat.md +34 -1
- package/src/components/chat/embeddable-chat.tsx +59 -2
- package/src/contexts/chat-runtime-context.tsx +9 -0
- package/src/stories/AnnouncementBar.stories.tsx +9 -11
- package/src/types/announcement.ts +17 -23
- package/src/types/supabase.ts +6 -9
- package/dist/chunk-2FI3USTC.js.map +0 -1
- package/dist/chunk-IHF4X2CV.cjs.map +0 -1
- package/dist/chunk-N2DVKXN4.cjs.map +0 -1
- /package/dist/{chunk-MN22HDBG.js.map → chunk-4RMUTJTZ.js.map} +0 -0
- /package/dist/{chunk-TMSJLMQR.js.map → chunk-6BW37KWJ.js.map} +0 -0
- /package/dist/{chunk-ZOJXKWZ2.js.map → chunk-DU5LLHRI.js.map} +0 -0
- /package/dist/{chunk-SWGXCGQ3.js.map → chunk-FPAF4JHM.js.map} +0 -0
- /package/dist/{chunk-65VXW6GZ.js.map → chunk-KYCZ4ISB.js.map} +0 -0
- /package/dist/{chunk-PJURNBZN.js.map → chunk-NUO4JXTS.js.map} +0 -0
- /package/dist/{chunk-P6B7EX3K.js.map → chunk-RDJNK5AV.js.map} +0 -0
- /package/dist/{chunk-SBCKCSKU.js.map → chunk-RT6GEODM.js.map} +0 -0
- /package/dist/{chunk-5RKCZ6IG.js.map → chunk-WADLOXCY.js.map} +0 -0
- /package/dist/{chunk-3TRA3DMM.js.map → chunk-XBJJIMIG.js.map} +0 -0
- /package/dist/{chunk-UMY7EN5L.js.map → chunk-YOVM7KGM.js.map} +0 -0
- /package/dist/{chunk-BQN7VPXU.js.map → chunk-YWEWRAMA.js.map} +0 -0
- /package/dist/{chunk-J6HCSDFS.js.map → chunk-ZS7YHQXO.js.map} +0 -0
|
@@ -45,4 +45,37 @@ Portable, lib-safe port of the hub's `<GlobalAskAI>` chat panel component, decou
|
|
|
45
45
|
| `useAuth()` | `useRequiredChatRuntime().user` |
|
|
46
46
|
| `currentPlatform()` | `useRequiredChatRuntime().source` |
|
|
47
47
|
| `useNavLink` / `NavLinkAnchor` | `handleChatNavClick` + `NavLinkAnchorViaRuntime` |
|
|
48
|
-
| `useDocChat(source)` | `useSseChatAdapter()` (source from runtime) |
|
|
48
|
+
| `useDocChat(source)` | `useSseChatAdapter()` (source from runtime) |
|
|
49
|
+
## Agent mode (OpenFrame AI agents — Fae / Mingo)
|
|
50
|
+
|
|
51
|
+
Reuse the SAME `<EmbeddableChat>` to render a global OpenFrame AI agent. No new
|
|
52
|
+
component, no agent-specific render path — an "agent mode" just OVERRIDES the
|
|
53
|
+
empty-state URL so the chat fetches the agent's display config (greeting +
|
|
54
|
+
suggested prompts + source chips) from the public `/api/ai-agents/[slug]`
|
|
55
|
+
endpoint, which is byte-compatible with the `EmptyStateConfig` wire shape
|
|
56
|
+
(`{ greeting, suggestedQueries, enabledRagTableIds }`).
|
|
57
|
+
|
|
58
|
+
- Pass `activeAgentSlug` (e.g. `"fae"`) to `<EmbeddableChat>`. **Works in BOTH
|
|
59
|
+
regular (host) and embedded modes** — there is no navigation-mode gate.
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
<EmbeddableChat activeAgentSlug="fae" />
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Default routes, fully overridable.** Agent mode works with ZERO endpoint
|
|
66
|
+
wiring — the component falls back to a built-in default route. Resolution order
|
|
67
|
+
for the agent display-config route (highest → lowest precedence):
|
|
68
|
+
|
|
69
|
+
1. `aiAgentConfigUrl` prop on `<EmbeddableChat>` (per-mount override)
|
|
70
|
+
2. `runtime.endpoints.aiAgentConfigUrl(slug)` (shared runtime override)
|
|
71
|
+
3. built-in default `` (slug) => `/api/ai-agents/${encodeURIComponent(slug)}` ``
|
|
72
|
+
|
|
73
|
+
Same-origin embedders need nothing; cross-origin embedders behind a proxy set
|
|
74
|
+
`runtime.endpoints.aiAgentConfigUrl` (or the prop) to their absolute proxied
|
|
75
|
+
path. Every other chat route (`chatStreamUrl`, `commandsUrl`, …) comes from
|
|
76
|
+
`runtime.endpoints` and is likewise overridable.
|
|
77
|
+
|
|
78
|
+
DISPLAY-ONLY this phase: retrieval still resolves server-side from the platform
|
|
79
|
+
(the chat route derives `source` from the deployment, not the client) — the
|
|
80
|
+
agent customizes the greeting + suggested-prompt chips, not the corpus. In mingo
|
|
81
|
+
mode, `mingoWelcome` still owns its own welcome surface.
|
|
@@ -209,6 +209,33 @@ export interface EmbeddableChatProps {
|
|
|
209
209
|
/** Controlled active-mode change handler. Required when `activeMode` is set. */
|
|
210
210
|
onActiveModeChange?: (mode: ChatMode) => void
|
|
211
211
|
|
|
212
|
+
/**
|
|
213
|
+
* OpenFrame AI agent mode — render a global agent (e.g. `'fae'`, `'mingo'`).
|
|
214
|
+
* Works in BOTH regular (host) AND embedded modes. When set, the chat fetches
|
|
215
|
+
* that agent's display config (greeting + suggested prompts) instead of the
|
|
216
|
+
* platform empty-state — the "agent mode" URL override. DISPLAY-only this
|
|
217
|
+
* phase: retrieval still resolves server-side from the platform. Optional;
|
|
218
|
+
* unset = today's behavior.
|
|
219
|
+
*
|
|
220
|
+
* Route resolution (highest → lowest precedence):
|
|
221
|
+
* 1. `aiAgentConfigUrl` prop (below)
|
|
222
|
+
* 2. `runtime.endpoints.aiAgentConfigUrl`
|
|
223
|
+
* 3. the component's built-in default (`/api/ai-agents/<slug>`)
|
|
224
|
+
* So agent mode works with ZERO wiring, yet every route stays overridable.
|
|
225
|
+
*/
|
|
226
|
+
activeAgentSlug?: string
|
|
227
|
+
|
|
228
|
+
/** Optional agent switcher callback (host renders the agent picker UI). */
|
|
229
|
+
onAgentChange?: (slug: string) => void
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Per-component override for the agent display-config route. Highest
|
|
233
|
+
* precedence (over `runtime.endpoints.aiAgentConfigUrl` and the built-in
|
|
234
|
+
* default). Lets a single embed point a specific agent at a custom/proxied
|
|
235
|
+
* endpoint without changing the shared runtime. Optional.
|
|
236
|
+
*/
|
|
237
|
+
aiAgentConfigUrl?: (slug: string) => string
|
|
238
|
+
|
|
212
239
|
/**
|
|
213
240
|
* Initial active mode for uncontrolled mode. Ignored when `activeMode`
|
|
214
241
|
* is set. Defaults to `'guide'` when `modes.guide` is configured,
|
|
@@ -338,6 +365,16 @@ const mentionTokenOf = (key: string, markerByType: Map<string, string>): string
|
|
|
338
365
|
*/
|
|
339
366
|
const FALLBACK_TOP_RETRIEVED = 3
|
|
340
367
|
|
|
368
|
+
/**
|
|
369
|
+
* Built-in default route for an OpenFrame AI agent's display config — the
|
|
370
|
+
* lowest-precedence fallback so "agent mode" works with ZERO endpoint wiring.
|
|
371
|
+
* Overridden by `runtime.endpoints.aiAgentConfigUrl` or the `aiAgentConfigUrl`
|
|
372
|
+
* prop. Same-origin relative path (works for host + same-origin embeds);
|
|
373
|
+
* cross-origin embedders behind a proxy override with their absolute path.
|
|
374
|
+
*/
|
|
375
|
+
const DEFAULT_AI_AGENT_CONFIG_URL = (slug: string): string =>
|
|
376
|
+
`/api/ai-agents/${encodeURIComponent(slug)}`
|
|
377
|
+
|
|
341
378
|
/**
|
|
342
379
|
* Per-row width palette for the empty-state skeleton stack. Cycled
|
|
343
380
|
* by index so each render is deterministic (no jitter between
|
|
@@ -720,6 +757,9 @@ function EmbeddableChatInner({
|
|
|
720
757
|
mingoDialogCapabilities,
|
|
721
758
|
activeMode: controlledActiveMode,
|
|
722
759
|
onActiveModeChange,
|
|
760
|
+
activeAgentSlug,
|
|
761
|
+
onAgentChange: _onAgentChange,
|
|
762
|
+
aiAgentConfigUrl: aiAgentConfigUrlProp,
|
|
723
763
|
defaultActiveMode,
|
|
724
764
|
shell = 'drawer',
|
|
725
765
|
mingoWelcome,
|
|
@@ -956,9 +996,26 @@ function EmbeddableChatInner({
|
|
|
956
996
|
// hits the endpoint. Cached with `staleTime/gcTime: Infinity` inside the hook,
|
|
957
997
|
// so toggling to Guide or reopening the (remounting) drawer reads from cache
|
|
958
998
|
// — NOT a request per open.
|
|
959
|
-
|
|
999
|
+
// Agent-mode URL override: when an OpenFrame agent is selected, point the
|
|
1000
|
+
// empty-state fetch at the agent's display-config endpoint (byte-compatible
|
|
1001
|
+
// EmptyStateConfig shape) instead of the platform `emptyStateUrl`. Works in
|
|
1002
|
+
// BOTH host and embed mode (no navigation-mode gate). Route precedence:
|
|
1003
|
+
// prop `aiAgentConfigUrl` → runtime endpoint → built-in default
|
|
1004
|
+
// so agent mode functions with zero wiring yet stays fully overridable. The
|
|
1005
|
+
// single `emptyStateUrl` var below feeds BOTH the fetch AND the downstream
|
|
1006
|
+
// `emptyStateUrl ? fetched : prop` discriminator, so no other code changes.
|
|
1007
|
+
const resolveAgentConfigUrl =
|
|
1008
|
+
aiAgentConfigUrlProp ?? runtime.endpoints.aiAgentConfigUrl ?? DEFAULT_AI_AGENT_CONFIG_URL
|
|
1009
|
+
const agentConfigUrl = activeAgentSlug ? resolveAgentConfigUrl(activeAgentSlug) : undefined
|
|
1010
|
+
const emptyStateUrl = agentConfigUrl ?? runtime.endpoints.emptyStateUrl
|
|
1011
|
+
// Widen the fetch gate so a selected agent's display loads regardless of the
|
|
1012
|
+
// guide/mingo active mode (the platform empty-state stays Guide-only).
|
|
1013
|
+
// `MingoWelcome` still owns its own surface in mingo mode — this just warms
|
|
1014
|
+
// the agent config so greeting/suggested prompts are ready.
|
|
960
1015
|
const { config: emptyStateConfig, loading: emptyStateLoading } =
|
|
961
|
-
useEmptyStateConfig(emptyStateUrl, {
|
|
1016
|
+
useEmptyStateConfig(emptyStateUrl, {
|
|
1017
|
+
enabled: activeMode === 'guide' || !!activeAgentSlug,
|
|
1018
|
+
})
|
|
962
1019
|
// Resolution: fetched (when `emptyStateUrl` set) → explicit prop → default.
|
|
963
1020
|
// `greeting` is null-unambiguous so `??` chains cleanly; the arrays use
|
|
964
1021
|
// `emptyStateUrl` as the discriminator because `[]` is a legitimate fetched
|
|
@@ -81,6 +81,15 @@ export interface ChatRuntime {
|
|
|
81
81
|
* unset, the chat falls back to the explicit `emptyStateGreeting` /
|
|
82
82
|
* `suggestedQueries` / `enabledRagTableIds` props (or in-code defaults). */
|
|
83
83
|
emptyStateUrl?: string
|
|
84
|
+
/** Build the per-agent display-config URL for an OpenFrame AI agent
|
|
85
|
+
* (Fae/Mingo). OPTIONAL. The returned endpoint MUST be byte-compatible
|
|
86
|
+
* with the empty-state wire shape ({ greeting, suggestedQueries,
|
|
87
|
+
* enabledRagTableIds }). When set AND `EmbeddableChat` receives an
|
|
88
|
+
* `activeAgentSlug` in embed mode, the chat fetches THIS url instead of
|
|
89
|
+
* `emptyStateUrl` to render the selected agent's greeting + suggested
|
|
90
|
+
* prompts (the "agent mode" URL override). Hub: `(slug) =>
|
|
91
|
+
* '/api/ai-agents/' + encodeURIComponent(slug)`. */
|
|
92
|
+
aiAgentConfigUrl?: (slug: string) => string
|
|
84
93
|
/** Build entity-card list URL for a content type + ids. Hub delegates
|
|
85
94
|
* to the rag-table-config registry; embedded app provides its own
|
|
86
95
|
* per-type URL builder against the reverse proxy. Returns null when
|
|
@@ -40,8 +40,7 @@ const baseAnnouncement: Announcement = {
|
|
|
40
40
|
title: 'New Feature Released',
|
|
41
41
|
description: 'Check out our latest updates and improvements to the platform.',
|
|
42
42
|
background_color: '#FFD951',
|
|
43
|
-
|
|
44
|
-
icon_svg_name: 'rocket',
|
|
43
|
+
icon_name: 'rocket',
|
|
45
44
|
platform_id: 'openframe',
|
|
46
45
|
is_active: true,
|
|
47
46
|
created_at: now,
|
|
@@ -95,12 +94,12 @@ export const WithCTA: Story = {
|
|
|
95
94
|
title: 'OpenFrame v2.0 is here!',
|
|
96
95
|
description: 'Explore the new dashboard, improved device management, and more.',
|
|
97
96
|
background_color: '#FFD951',
|
|
98
|
-
|
|
97
|
+
icon_name: 'star',
|
|
99
98
|
cta_enabled: true,
|
|
100
99
|
cta_text: 'Learn More',
|
|
101
100
|
cta_url: 'https://example.com',
|
|
102
101
|
cta_target: '_blank',
|
|
103
|
-
|
|
102
|
+
cta_icon_name: 'rocket',
|
|
104
103
|
cta_show_icon: true,
|
|
105
104
|
cta_button_background_color: '#1A1A1A',
|
|
106
105
|
cta_button_text_color: '#FFFFFF',
|
|
@@ -122,7 +121,7 @@ export const WithCTASameTab: Story = {
|
|
|
122
121
|
title: 'Scheduled Maintenance',
|
|
123
122
|
description: 'We will perform maintenance on Saturday from 2:00 AM to 4:00 AM UTC.',
|
|
124
123
|
background_color: '#FFE082',
|
|
125
|
-
|
|
124
|
+
icon_name: 'info',
|
|
126
125
|
cta_enabled: true,
|
|
127
126
|
cta_text: 'View Status',
|
|
128
127
|
cta_url: '/status',
|
|
@@ -145,7 +144,7 @@ export const BlueBackground: Story = {
|
|
|
145
144
|
title: 'Join our Community',
|
|
146
145
|
description: 'Connect with other MSPs and share best practices.',
|
|
147
146
|
background_color: '#60A5FA',
|
|
148
|
-
|
|
147
|
+
icon_name: 'megaphone',
|
|
149
148
|
})
|
|
150
149
|
return <Story />
|
|
151
150
|
},
|
|
@@ -164,7 +163,7 @@ export const GreenBackground: Story = {
|
|
|
164
163
|
title: 'All Systems Operational',
|
|
165
164
|
description: 'Everything is running smoothly. No issues detected.',
|
|
166
165
|
background_color: '#86EFAC',
|
|
167
|
-
|
|
166
|
+
icon_name: 'bell',
|
|
168
167
|
})
|
|
169
168
|
return <Story />
|
|
170
169
|
},
|
|
@@ -183,7 +182,7 @@ export const WithOpenFrameLogo: Story = {
|
|
|
183
182
|
title: 'Welcome to OpenFrame',
|
|
184
183
|
description: 'Your open-source IT infrastructure management platform.',
|
|
185
184
|
background_color: '#FFD951',
|
|
186
|
-
|
|
185
|
+
icon_name: 'openframe-logo',
|
|
187
186
|
cta_enabled: true,
|
|
188
187
|
cta_text: 'Get Started',
|
|
189
188
|
cta_url: '/getting-started',
|
|
@@ -208,8 +207,7 @@ export const WithPNGIcon: Story = {
|
|
|
208
207
|
title: 'Partner Program Launch',
|
|
209
208
|
description: 'Become an OpenFrame certified partner and grow your business.',
|
|
210
209
|
background_color: '#C4B5FD',
|
|
211
|
-
|
|
212
|
-
icon_png_url: 'https://placehold.co/32x32/1a1a1a/white?text=OF',
|
|
210
|
+
icon_url: 'https://placehold.co/32x32/1a1a1a/white?text=OF',
|
|
213
211
|
})
|
|
214
212
|
return <Story />
|
|
215
213
|
},
|
|
@@ -229,7 +227,7 @@ export const LongContent: Story = {
|
|
|
229
227
|
description:
|
|
230
228
|
'This is an extremely long description that goes into great detail about the announcement. It should be truncated on the desktop view and hidden on mobile view to keep the bar compact and readable.',
|
|
231
229
|
background_color: '#FCA5A5',
|
|
232
|
-
|
|
230
|
+
icon_name: 'info',
|
|
233
231
|
cta_enabled: true,
|
|
234
232
|
cta_text: 'Read Full Announcement',
|
|
235
233
|
cta_url: '/announcements/long',
|
|
@@ -2,26 +2,23 @@
|
|
|
2
2
|
import type { LegacyPlatform, PlatformFilter, PlatformRecord } from './platform';
|
|
3
3
|
|
|
4
4
|
// For backward compatibility, maintain the old Platform type temporarily
|
|
5
|
-
export type IconType = 'svg' | 'png';
|
|
6
|
-
|
|
7
5
|
// Database Models
|
|
8
6
|
export interface Announcement {
|
|
9
7
|
id: string;
|
|
10
8
|
title: string;
|
|
11
9
|
description: string;
|
|
12
10
|
background_color: string;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
icon_png_url?: string;
|
|
11
|
+
icon_name?: string;
|
|
12
|
+
icon_url?: string;
|
|
16
13
|
/** Extra props for the main bar/icon */
|
|
17
|
-
|
|
14
|
+
icon_props?: Record<string, any>;
|
|
18
15
|
platform_id: string; // Foreign key to platforms table
|
|
19
16
|
platform?: PlatformRecord; // Joined platform data
|
|
20
17
|
is_active: boolean;
|
|
21
18
|
// CTA (Call-To-Action) fields
|
|
22
19
|
cta_enabled?: boolean;
|
|
23
20
|
cta_text?: string;
|
|
24
|
-
|
|
21
|
+
cta_icon_name?: string;
|
|
25
22
|
cta_show_icon?: boolean;
|
|
26
23
|
cta_url?: string;
|
|
27
24
|
cta_target?: '_self' | '_blank';
|
|
@@ -57,17 +54,16 @@ export interface CreateAnnouncementData {
|
|
|
57
54
|
title: string;
|
|
58
55
|
description: string;
|
|
59
56
|
background_color: string;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
icon_png_url?: string;
|
|
57
|
+
icon_name?: string;
|
|
58
|
+
icon_url?: string;
|
|
63
59
|
/** Extra props for the main bar/icon */
|
|
64
|
-
|
|
60
|
+
icon_props?: Record<string, any>;
|
|
65
61
|
platforms?: string[]; // entity_platforms set (multi-select)
|
|
66
62
|
is_active?: boolean;
|
|
67
63
|
// CTA (Call-To-Action) fields
|
|
68
64
|
cta_enabled?: boolean;
|
|
69
65
|
cta_text?: string;
|
|
70
|
-
|
|
66
|
+
cta_icon_name?: string;
|
|
71
67
|
cta_show_icon?: boolean;
|
|
72
68
|
cta_url?: string;
|
|
73
69
|
cta_target?: '_self' | '_blank';
|
|
@@ -81,17 +77,16 @@ export interface UpdateAnnouncementData {
|
|
|
81
77
|
title?: string;
|
|
82
78
|
description?: string;
|
|
83
79
|
background_color?: string;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
icon_png_url?: string;
|
|
80
|
+
icon_name?: string;
|
|
81
|
+
icon_url?: string;
|
|
87
82
|
/** Extra props for the main bar/icon */
|
|
88
|
-
|
|
83
|
+
icon_props?: Record<string, any>;
|
|
89
84
|
platforms?: string[]; // entity_platforms set (multi-select)
|
|
90
85
|
is_active?: boolean;
|
|
91
86
|
// CTA (Call-To-Action) fields
|
|
92
87
|
cta_enabled?: boolean;
|
|
93
88
|
cta_text?: string;
|
|
94
|
-
|
|
89
|
+
cta_icon_name?: string;
|
|
95
90
|
cta_show_icon?: boolean;
|
|
96
91
|
cta_url?: string;
|
|
97
92
|
cta_target?: '_self' | '_blank';
|
|
@@ -123,15 +118,14 @@ export interface AnnouncementFormData {
|
|
|
123
118
|
title: string;
|
|
124
119
|
description: string;
|
|
125
120
|
background_color: string;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
icon_png_file?: File;
|
|
121
|
+
icon_name: string;
|
|
122
|
+
icon_url?: string;
|
|
129
123
|
platforms: string[]; // entity_platforms set (multi-select; no single platform_id)
|
|
130
124
|
is_active: boolean;
|
|
131
125
|
// CTA (Call-To-Action) fields
|
|
132
126
|
cta_enabled: boolean;
|
|
133
127
|
cta_text: string;
|
|
134
|
-
|
|
128
|
+
cta_icon_name: string;
|
|
135
129
|
cta_show_icon: boolean;
|
|
136
130
|
cta_url: string;
|
|
137
131
|
cta_target: '_self' | '_blank';
|
|
@@ -140,7 +134,7 @@ export interface AnnouncementFormData {
|
|
|
140
134
|
cta_button_text_color?: string;
|
|
141
135
|
cta_icon_props?: string; // JSON string in form
|
|
142
136
|
/** Extra props for the main bar/icon */
|
|
143
|
-
|
|
137
|
+
icon_props?: string;
|
|
144
138
|
}
|
|
145
139
|
|
|
146
140
|
// API Query Parameters
|
|
@@ -197,7 +191,7 @@ export interface AnnouncementValidation {
|
|
|
197
191
|
required: boolean;
|
|
198
192
|
pattern: RegExp;
|
|
199
193
|
};
|
|
200
|
-
|
|
194
|
+
icon_name: {
|
|
201
195
|
required: boolean;
|
|
202
196
|
validOptions: string[];
|
|
203
197
|
};
|
package/src/types/supabase.ts
CHANGED
|
@@ -56,9 +56,8 @@ export type Database = {
|
|
|
56
56
|
created_at: string | null
|
|
57
57
|
created_by: string | null
|
|
58
58
|
description: string
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
icon_type: string | null
|
|
59
|
+
icon_url: string | null
|
|
60
|
+
icon_name: string | null
|
|
62
61
|
id: string
|
|
63
62
|
is_active: boolean | null
|
|
64
63
|
title: string
|
|
@@ -69,9 +68,8 @@ export type Database = {
|
|
|
69
68
|
created_at?: string | null
|
|
70
69
|
created_by?: string | null
|
|
71
70
|
description: string
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
icon_type?: string | null
|
|
71
|
+
icon_url?: string | null
|
|
72
|
+
icon_name?: string | null
|
|
75
73
|
id?: string
|
|
76
74
|
is_active?: boolean | null
|
|
77
75
|
title: string
|
|
@@ -82,9 +80,8 @@ export type Database = {
|
|
|
82
80
|
created_at?: string | null
|
|
83
81
|
created_by?: string | null
|
|
84
82
|
description?: string
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
icon_type?: string | null
|
|
83
|
+
icon_url?: string | null
|
|
84
|
+
icon_name?: string | null
|
|
88
85
|
id?: string
|
|
89
86
|
is_active?: boolean | null
|
|
90
87
|
title?: string
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/contexts/endpoints-runtime-context.tsx","../src/contexts/chat-runtime-context.tsx"],"sourcesContent":["'use client'\n\n/**\n * Endpoints runtime — sibling of ChatRuntime. Carries the API path\n * literals consumed by oss-lib components/hooks/utils so a host\n * application can override them (e.g. when running behind a reverse\n * proxy as `user1.openframe.ai` → `/api/mingo-guide/*`).\n *\n * The hub mounts `<HubRuntimeProvider>` at root with the\n * canonical hub paths; an embedded app mounts its own provider with\n * remapped paths. The pattern mirrors ChatRuntimeContext exactly:\n *\n * - `useEndpointsRuntime()` returns null when no provider is mounted.\n * For optional consumers that should gracefully no-op without one.\n * - `useRequiredEndpointsRuntime()` throws on missing provider — for\n * hooks/components that cannot function without endpoints.\n *\n * IMPORTANT for embedders: memoize the value passed to\n * `<EndpointsRuntimeContext.Provider value={...}>` (e.g. React.useMemo).\n * Reference changes invalidate downstream effect dependency arrays and\n * trigger unnecessary re-fetches.\n */\n\nimport { createContext, useContext } from 'react'\n\nexport interface EndpointsRuntime {\n /** GET active announcement (used by `<AnnouncementBar>` polling). */\n announcementsUrl: string\n accessCode: {\n /** POST validate access code. */\n validateUrl: string\n /** POST consume / redeem access code after registration. */\n consumeUrl: string\n }\n /** POST contact-form submission. */\n contactUrl: string\n}\n\nexport const EndpointsRuntimeContext = createContext<EndpointsRuntime | null>(null)\n\n/**\n * Optional read — returns null when no provider is mounted. Use for\n * surfaces that should silently skip the fetch (e.g. announcement\n * polling on a page rendered outside the provider tree).\n */\nexport function useEndpointsRuntime(): EndpointsRuntime | null {\n return useContext(EndpointsRuntimeContext)\n}\n\n/**\n * Strict variant — throws on missing provider. Use for consumers that\n * cannot function without an endpoint (form submission, code\n * validation). In tests/Storybook, wrap with the hub's\n * `<HubRuntimeProvider>` or a stub\n * `<EndpointsRuntimeContext.Provider value={mockedEndpoints}>`.\n */\nexport function useRequiredEndpointsRuntime(): EndpointsRuntime {\n const v = useContext(EndpointsRuntimeContext)\n if (!v) {\n throw new Error(\n '[endpoints-runtime] hook called outside an <EndpointsRuntimeContext.Provider>. ' +\n 'Hub: mount <HubRuntimeProvider> in your providers tree. ' +\n 'Embedded app: mount your own provider with proxied URLs at the tree root. ' +\n 'Tests/Storybook: wrap render() in <EndpointsRuntimeContext.Provider value={mocked}>.',\n )\n }\n return v\n}\n","'use client'\n\n/**\n * Chat runtime context — single seam for embedding the chat panel in a\n * different host (e.g. user1.openframe.ai reverse-proxying API calls\n * under /api/mingo-guide/* to hub.openframe.ai/api/*).\n *\n * Three concerns, one context:\n * 1. API endpoints: chatStreamUrl / approvalToolUrl / commandsUrl /\n * buildListUrl + attachment endpoints + chat-identity. The chat\n * reads them from runtime; hub vs embedded app supply different\n * strings via different providers.\n * 2. Navigation mode + callbacks: 'host' or 'embed' mode. Host wires\n * its own router/docNav via the optional `navigate` callback\n * (plain function, NOT a hook); embed forces new-tab via\n * `defaultContentOrigin` + lib's `resolveExternalNavigation`.\n * 3. Identity context: only `source` (required for localStorage\n * namespacing). The display identity (greeting first-name etc.)\n * comes from the server via `useChatIdentity()` — never injected\n * client-side, so it always matches the server-resolved auth.\n *\n * Sibling of EndpointsRuntimeContext (announcement bar, contact form,\n * access codes). Each runtime stays an independent React context so\n * embedders can opt into either feature without forcing the other.\n *\n * IMPORTANT for embedders: memoize the value passed to\n * `<ChatRuntimeContext.Provider value={...}>` (e.g. via React.useMemo).\n * Every change to its reference identity invalidates downstream\n * `useMemo` consumers (the chat input's slash-commands binding,\n * useNavLink's embed-resolution memo, useDocChat's streamFn factory).\n * The hub's `<HubRuntimeProvider>` already memoizes correctly with\n * stable deps. Embedded apps that build the value inline on each render\n * will pay an avoidable re-render cost across the entire chat tree.\n */\n\nimport { createContext, useContext, type ReactNode } from 'react'\n\nimport type { ComposeContentUrl } from '../utils/content-href'\n\n/**\n * Runtime config consumed by the chat panel.\n */\nexport interface ChatRuntime {\n endpoints: {\n /** POST streaming chat. Hub: '/api/docs/chat'. */\n chatStreamUrl: string\n /** POST agent approve/reject. Hub: '/api/chat/agent/confirm-tool'. */\n approvalToolUrl: string\n /** Customer-ticket agent endpoints (Help Center). OPTIONAL — when unset,\n * the ticket hooks fall back to the bare hub paths\n * (`/api/chat/agent/{find-ticket,ticket-action,list-engagements}`).\n * Embedders behind a reverse proxy set these to their proxied paths\n * (e.g. `/content/api/chat/agent/...`) so tickets route through the SAME\n * endpoint config + proxy as every other endpoint. */\n findTicketUrl?: string\n ticketActionUrl?: string\n listEngagementsUrl?: string\n /** GET slash-command catalog. Hub: '/api/docs/commands'. */\n commandsUrl: string\n /** GET RAG-search endpoint behind `<DocSearchBar>` (the in-source search\n * bar mounted by `<DocViewer>` / `<DocsHubPage>` when `showAIChat` is on).\n * Hub: '/api/docs/search'. OPTIONAL — falls back to the hub path so\n * same-origin Next.js hosts don't need to set it. Cross-origin embedders\n * set their proxied path so the search bar routes through the same\n * reverse proxy as everything else. Same pattern as `findTicketUrl`. */\n docsSearchUrl?: string\n /** POST internal-link resolver. The in-source markdown renderer (lib or\n * custom) calls `<DocViewer>`'s `handlers.onResolveLink(href, currentPath)`\n * for relative hrefs like `./getting-started/intro.md` — that callback\n * posts to this URL with `{ link, currentPath, source }` and expects a\n * `ResolveLinkResult` back. Hub: '/api/docs/resolve-link'. OPTIONAL — same\n * fall-back chain as `docsSearchUrl`: prop override → runtime → default. */\n docsResolveLinkUrl?: string\n /** GET per-platform empty-state config (admin-edited in\n * `/admin/chat-config`): `{ greeting, enabledRagTableIds, suggestedQueries }`.\n * Hub: '/api/docs/empty-state'. OPTIONAL — the in-app (host-mode) chat\n * injects these values as SSR props instead, so it leaves this unset.\n * Cross-origin EMBEDDERS (no server hop) set it to their proxied path\n * (e.g. '/content/api/docs/empty-state') so `<EmbeddableChat>` can fetch\n * the greeting / quick-action chips / RAG-source filter at runtime. When\n * unset, the chat falls back to the explicit `emptyStateGreeting` /\n * `suggestedQueries` / `enabledRagTableIds` props (or in-code defaults). */\n emptyStateUrl?: string\n /** Build entity-card list URL for a content type + ids. Hub delegates\n * to the rag-table-config registry; embedded app provides its own\n * per-type URL builder against the reverse proxy. Returns null when\n * the type has no list endpoint (caller skips rendering). */\n buildListUrl: (type: string, ids: string[]) => string | null\n /** Chat-attachment endpoints — added for the v2 attachment feature.\n *\n * Three concerns:\n * - `attachmentUploadUrl` — POSTed by the chat-attachment hook\n * to mint a Supabase signed-upload-URL + HMAC view token.\n * - `attachmentViewUrlPrefix` — embedded in markdown URLs the\n * chat hosts in user message bubbles (`![]()` / `[Attached]`).\n * Stored in chat history; chosen at SEND time. In host mode the\n * relative `/api/storage/view/chat-attachments/` is sufficient\n * (same-origin); embedders supply an absolute hub URL so the\n * browser can fetch cross-origin.\n * - `identityUrl` — GET endpoint the `useChatIdentity` hook\n * hits to learn the `{authTier, source, attachmentsEnabled}`\n * capability bag for the current session. Used beyond chat\n * (tickets / contact form / any embedded surface that needs\n * to identify the proxied customer), so the name has no\n * \"chat\" prefix even though the consuming hook still does. */\n attachmentUploadUrl: string\n attachmentViewUrlPrefix: string\n identityUrl: string\n /** Optional URL prefix for the image proxy (`<prefix>?url=<external>`).\n * When unset, lib's `getProxiedImageUrl` returns the original URL\n * unchanged. Hub default: '/api/image-proxy'. Embedders that don't\n * host an image-proxy route leave this undefined → images load\n * directly cross-origin (CORS-permitting). */\n imageProxyUrlPrefix?: string\n /** Optional list of hostnames that should bypass the image proxy\n * (rendered direct). Hub uses ['openmsp.ai']; embedders typically\n * leave it unset. Matches the `skipDomains` parameter of\n * `getProxiedImageUrl`. */\n imageProxySkipDomains?: string[]\n /** Optional base URL for the branded og-placeholder image route — the\n * DEFAULT cover-image fallback for entity cards with no image. The lib\n * appends `?title=…` (+ `w`/`h` for square slots) itself, so this is\n * the base, NOT a full URL: relative (`/api/og-placeholder`) for same-\n * origin hosts, or the proxied path (`/content/api/og-placeholder`) for\n * cross-origin embedders. May carry baked-in query params (preserved when\n * the lib layers `title`/dimensions on top) — but per-platform brand\n * colors are NO LONGER baked here; the `/api/og-placeholder` route\n * resolves them server-side from the platform. Most hosts leave this unset\n * and let the lib derive the base from `imageProxyUrlPrefix`.\n *\n * OPTIONAL — when unset the lib derives the base from the sibling\n * `imageProxyUrlPrefix` (same API base, route name swapped), then falls\n * back to the relative `/api/og-placeholder`. So an embedder that already\n * proxies images needs NO og-placeholder wiring. See\n * `resolveOgPlaceholderBase` / `buildOgPlaceholderUrl` in `../utils`. */\n ogPlaceholderUrl?: string\n /** Supabase storage origin (e.g. `https://xyz.supabase.co`) — used\n * by `useVideoWarmup` to scope the `<link rel=\"preload\" as=\"video\">`\n * hint to MP4s the deployment actually hosts. Hub wires it via\n * `getSupabaseStorageOrigin()`; embedders without a Supabase\n * storage origin leave it unset (preload is then skipped; Mux/\n * YouTube preconnect still fires). */\n supabaseStorageOrigin?: string\n }\n navigation: {\n /** ONE knob, two behaviors:\n * - 'host' = use the host page's existing click-routing untouched.\n * The chat panel calls `navigate?.()` for in-app routing.\n * - 'embed' = guest inside another app: short-circuit at the top\n * of click handlers to force new-tab + absolutize via\n * resolveExternalNavigation. */\n mode: 'host' | 'embed'\n /** Embed-only fallback origin for relative URLs whose target platform\n * can't be inferred. Used by resolveExternalNavigation when\n * `targetPlatform` is null — without this, a relative `/foo` href would\n * window.open against the embedder's origin, which is WRONG.\n * Set to your content host (e.g. 'https://hub.openframe.ai').\n * Required by the embedded app whenever mode='embed'. */\n defaultContentOrigin?: string\n /** Override for opening external URLs. MUST BE SYNCHRONOUS —\n * Safari/Firefox block popups opened outside a direct user gesture.\n * Default: window.open(href, '_blank', 'noopener,noreferrer'). */\n openExternal?: (href: string) => void\n /** Optional in-app navigation callback (host-mode only).\n * Returns `true` if the host handled the click in-app\n * (router.push + docNav.navigate); returns `false`, `undefined`,\n * or `void` → lib falls back to window.location.assign(href).\n * Hub wires this via HubRuntimeProvider's HubNavigationWiring;\n * embedders not in Next.js leave it undefined. */\n navigate?: (input: { href: string; path?: string | null; targetPlatform?: string | null }) => boolean | void\n /** Optional new-tab decision callback. Returns true → lib opens in\n * new tab; false → same tab via `navigate`. Hub wires the existing\n * `decideNewTab` logic from use-nav-link.tsx (re-imports the pure\n * helper from lib). Embedders may omit; lib defaults to:\n * same-origin/same-platform → same tab, else new tab. */\n decideNewTab?: (args: { href: string; targetPlatform?: string | null }) => boolean\n }\n /** Optional content-URL composer. Returns the platform-aware href +\n * target-platform tuple for a content entity. Hub wires this to its\n * `buildContentURL(type, slug, extractPrimaryPlatform(platforms))`\n * pipeline so the lib catalog/detail views can derive cross-\n * platform hrefs without knowing the hub's platform topology\n * (openmsp.ai / openframe.app / flamingo.run / tmcg).\n *\n * THE single content-href authority for every embeddable surface — page\n * views (onboarding catalog/detail, releases) AND chat cards / chips /\n * search results all resolve content links through this one seam, so a\n * given type lands in the SAME place regardless of where it's rendered.\n * Embedders wire `makeComposeContentUrl({ hostedTypes, contentOrigin })`;\n * omit it and lib views fall back to a same-origin relative path\n * (`buildDefaultHref`).\n *\n * Takes a single `ComposeContentUrlInput`: `type` + `identifier` (page\n * views pass the slug; chat rows pass the id + `externalUrl`, whose path\n * yields the slug for in-app routing) + optional `platforms` /\n * `externalUrl` / `targetPlatform`. */\n composeContentUrl?: ComposeContentUrl\n /** Per-`documentType` doc-viewer targets — the UNIFIED, DYNAMIC replacement for\n * the single `chipBasePlatform` prop. Maps a doc-table documentType\n * (`'markdown'`, `'data_room_doc'`, …) → `{ platform, basePath }` for the PUBLIC\n * doc viewer that hosts it. Doc chips with no `externalUrl` resolve PER ROW to\n * `getBaseUrl(platform)/<basePath>/<path>`, so a chat mixing several doc sources\n * sends EACH to its own home (markdown→flamingo/knowledge-base,\n * data_room_doc→company-hub/data-room) instead of one static fallback. The hub\n * may keep using `chipBasePlatform` (one doc source per platform); embedders that\n * surface multiple doc sources wire this. Threaded into `resolveSourceRowCTA`. */\n docPlatformTargets?: Record<string, { platform: string; basePath: string }>\n /** Chat source / platform identifier — OPTIONAL. The hub sets it from\n * `currentPlatform()`; EMBEDDERS leave it unset and stay platform-agnostic.\n *\n * It is NOT required for chat to work. The wire resolves source server-side\n * (`/docs/chat|search|commands` reject any client `source`); the\n * same-tab-vs-new-tab link decision falls back to an origin comparison when\n * it's absent (`decideNewTab` → `isCrossOriginUrl`); and the localStorage\n * history namespace falls back to a stable constant. Set it only where the\n * client legitimately needs to know its platform a priori — i.e. the hub,\n * where several platforms share related origins so \"same platform\" can't be\n * inferred from a URL alone. */\n source?: string\n // NOTE: No `user` field. The chat's display identity (greeting\n // first-name, etc.) comes from the SERVER-resolved auth via\n // `useChatIdentity()` — the same identity the server uses to\n // authorize requests. Letting embedders pass a client-side `user`\n // would let it desync from the actual auth tier, causing greetings\n // like \"Hey Bob\" while the server treats the session as\n // alice@example.com. Single source of truth: the server.\n}\n\nexport const ChatRuntimeContext = createContext<ChatRuntime | null>(null)\n\n/**\n * Returns the active runtime, or null when no provider is mounted.\n * NULL is a first-class value — it signals \"no chat runtime configured.\"\n * Optional consumers fall back to no-op behavior; strict consumers\n * use `useRequiredChatRuntime` (below).\n */\nexport function useChatRuntime(): ChatRuntime | null {\n return useContext(ChatRuntimeContext)\n}\n\n/**\n * Strict variant used INSIDE the chat panel. Throws if no provider.\n * The hub guarantees one exists by mounting `<HubRuntimeProvider>` at\n * root; the embedded app mounts its own `<ChatRuntimeContext.Provider>`\n * at the tree root. In Jest / Storybook tests that render chat\n * internals directly, wrap with `<HubRuntimeProvider>` (hub defaults)\n * or supply `<ChatRuntimeContext.Provider value={mockedRuntime}>`.\n */\nexport function useRequiredChatRuntime(): ChatRuntime {\n const v = useContext(ChatRuntimeContext)\n if (!v) {\n throw new Error(\n '[chat-runtime] hook called outside a <ChatRuntimeContext.Provider>. ' +\n 'The hub mounts <HubRuntimeProvider> at root — this only fires when ' +\n 'chat internals are rendered above the provider tree. ' +\n 'Fix: ensure the rendering subtree descends from the runtime provider. ' +\n 'In tests/Storybook: wrap with <HubRuntimeProvider> or supply ' +\n 'a <ChatRuntimeContext.Provider value={mockedRuntime}>.',\n )\n }\n return v\n}\n"],"mappings":";;;AAuBA,SAAS,eAAe,kBAAkB;AAenC,IAAM,0BAA0B,cAAuC,IAAI;AAO3E,SAAS,sBAA+C;AAC7D,SAAO,WAAW,uBAAuB;AAC3C;AASO,SAAS,8BAAgD;AAC9D,QAAM,IAAI,WAAW,uBAAuB;AAC5C,MAAI,CAAC,GAAG;AACN,UAAM,IAAI;AAAA,MACR;AAAA,IAIF;AAAA,EACF;AACA,SAAO;AACT;;;AChCA,SAAS,iBAAAA,gBAAe,cAAAC,mBAAkC;AAiMnD,IAAM,qBAAqBD,eAAkC,IAAI;AAQjE,SAAS,iBAAqC;AACnD,SAAOC,YAAW,kBAAkB;AACtC;AAUO,SAAS,yBAAsC;AACpD,QAAM,IAAIA,YAAW,kBAAkB;AACvC,MAAI,CAAC,GAAG;AACN,UAAM,IAAI;AAAA,MACR;AAAA,IAMF;AAAA,EACF;AACA,SAAO;AACT;","names":["createContext","useContext"]}
|