@flamingo-stack/openframe-frontend-core 0.0.813 → 0.0.814

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 (74) hide show
  1. package/dist/build/export-map.json +1 -1
  2. package/dist/{chunk-GTOT4ZQV.cjs → chunk-2H7XPKKT.cjs} +2 -2
  3. package/dist/{chunk-5RBL7A2Y.cjs → chunk-7ERD34HQ.cjs} +539 -291
  4. package/dist/{chunk-JFA3VHXC.cjs → chunk-AYMKG55T.cjs} +19 -19
  5. package/dist/{chunk-7BJ22OH2.cjs → chunk-CVPHODOE.cjs} +32 -32
  6. package/dist/{chunk-PXR27MXW.cjs → chunk-D23VVC3K.cjs} +11 -11
  7. package/dist/{chunk-TOBROYSJ.cjs → chunk-E5VF3IXO.cjs} +4 -4
  8. package/dist/{chunk-EJQRX6S5.cjs → chunk-G2B6EA4J.cjs} +39 -39
  9. package/dist/{chunk-XWCZSEW7.cjs → chunk-G5CCYMCU.cjs} +3 -3
  10. package/dist/{chunk-MUH7X7ZA.cjs → chunk-IBYT5I7K.cjs} +3 -3
  11. package/dist/{chunk-MBU45QUB.cjs → chunk-IDEOLXY6.cjs} +109 -142
  12. package/dist/{chunk-FTGXZHLO.cjs → chunk-ILV243HM.cjs} +7 -7
  13. package/dist/{chunk-5V3CNLCB.cjs → chunk-KINBPFAC.cjs} +18 -18
  14. package/dist/{chunk-WKODIG3L.cjs → chunk-KNGULKOU.cjs} +10 -10
  15. package/dist/{chunk-2WD7XGWA.cjs → chunk-LUR2ED43.cjs} +4 -4
  16. package/dist/{chunk-GNGXHIBC.cjs → chunk-M6VLEXN3.cjs} +48 -48
  17. package/dist/{chunk-G2AN67DP.cjs → chunk-UTRRECPV.cjs} +53 -53
  18. package/dist/{chunk-5M5JVVSL.cjs → chunk-WJPEDREU.cjs} +6 -6
  19. package/dist/{chunk-OGHG6REG.cjs → chunk-ZNZ6453J.cjs} +9 -9
  20. package/dist/{cloud-tenants-ODZVCP5X.cjs → cloud-tenants-JSH6AQMZ.cjs} +4 -4
  21. package/dist/components/case-studies/index.cjs +16 -16
  22. package/dist/components/chat/chat-message-enhanced.d.ts.map +1 -1
  23. package/dist/components/chat/chat-message-enhanced.js +8 -1
  24. package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
  25. package/dist/components/chat/embeddable-chat.js +34 -2
  26. package/dist/components/chat/entity-cards/chat-card-disclosure.d.ts +93 -0
  27. package/dist/components/chat/entity-cards/chat-card-disclosure.d.ts.map +1 -0
  28. package/dist/components/chat/entity-cards/chat-card-disclosure.js +126 -0
  29. package/dist/components/chat/entity-cards/dispatch.d.ts +5 -0
  30. package/dist/components/chat/entity-cards/dispatch.d.ts.map +1 -1
  31. package/dist/components/chat/entity-cards/dispatch.js +82 -55
  32. package/dist/components/chat/entity-cards/index.d.ts +1 -0
  33. package/dist/components/chat/entity-cards/index.d.ts.map +1 -1
  34. package/dist/components/chat/entity-cards/index.js +14 -0
  35. package/dist/components/chat/index.cjs +19 -3
  36. package/dist/components/chat/index.d.ts +1 -0
  37. package/dist/components/chat/index.d.ts.map +1 -1
  38. package/dist/components/chat/index.js +3 -0
  39. package/dist/components/chat/inline-app-link-chip.d.ts +35 -0
  40. package/dist/components/chat/inline-app-link-chip.d.ts.map +1 -0
  41. package/dist/components/chat/inline-app-link-chip.js +37 -0
  42. package/dist/components/chat/source-action-button.d.ts +15 -1
  43. package/dist/components/chat/source-action-button.d.ts.map +1 -1
  44. package/dist/components/chat/source-action-button.js +40 -2
  45. package/dist/components/contact/index.cjs +5 -5
  46. package/dist/components/docs/index.cjs +8 -8
  47. package/dist/components/embeds/index.cjs +5 -5
  48. package/dist/components/faq/index.cjs +6 -6
  49. package/dist/components/features/index.cjs +4 -4
  50. package/dist/components/help-center-pages/index.cjs +61 -61
  51. package/dist/components/index.cjs +56 -40
  52. package/dist/components/meeting-scheduler/index.cjs +29 -29
  53. package/dist/components/navigation/index.cjs +7 -7
  54. package/dist/components/onboarding-guides/index.cjs +6 -6
  55. package/dist/components/product-demo/index.cjs +13 -13
  56. package/dist/components/tickets/index.cjs +9 -9
  57. package/dist/components/ui/index.cjs +22 -6
  58. package/dist/{devices-GWBR7MJD.cjs → devices-OCEOO6OW.cjs} +5 -5
  59. package/dist/{embeddable-chat-4RLUXHDH.cjs → embeddable-chat-YRKMPFDY.cjs} +95 -62
  60. package/dist/index.cjs +26 -10
  61. package/dist/{knowledge-ZNRITHW5.cjs → knowledge-3GEE4LPY.cjs} +5 -5
  62. package/dist/{logs-QN5H5JT6.cjs → logs-7GGUZSDB.cjs} +12 -12
  63. package/dist/{policies-SCUYEYGJ.cjs → policies-S74WTNL4.cjs} +8 -8
  64. package/dist/{scripts-BP7UTAG5.cjs → scripts-G4QAT4NZ.cjs} +9 -9
  65. package/dist/{software-update-O4BQJCJ4.cjs → software-update-IYHJABLP.cjs} +7 -7
  66. package/package.json +1 -1
  67. package/src/components/chat/chat-message-enhanced.tsx +24 -1
  68. package/src/components/chat/embeddable-chat.tsx +61 -1
  69. package/src/components/chat/entity-cards/chat-card-disclosure.tsx +233 -0
  70. package/src/components/chat/entity-cards/dispatch.tsx +104 -63
  71. package/src/components/chat/entity-cards/index.ts +9 -0
  72. package/src/components/chat/index.ts +1 -0
  73. package/src/components/chat/inline-app-link-chip.tsx +79 -0
  74. package/src/components/chat/source-action-button.tsx +53 -2
@@ -0,0 +1,233 @@
1
+ 'use client';
2
+
3
+ /**
4
+ * What a chat card can open below itself: ONE disclosure, with a KIND per kind of content (`CHAT_CARD_DISCLOSURE`:
5
+ * VIDEO today; IMAGE and the like are one entry each in `CHAT_CARD_DISCLOSURES`). A kind owns everything about its
6
+ * content: the action's words and icon, how to find the content on a fetched record (`fromItem`), and how to draw it.
7
+ *
8
+ * A card shows the kind's action in the footer row it already draws ("Watch video"), and the content opens below
9
+ * the card only when the reader asks for it, so the answer keeps its height while it loads (CU-17tkuw61kfy: the
10
+ * player used to be drawn the moment its card resolved, and an answer with three recordings grew by three players
11
+ * while it was being read). A height change the reader asked for is not a layout shift.
12
+ *
13
+ * It opens and closes like every other expander in the chat (the thinking block, tool calls, approval batches, error
14
+ * details): `ExpandChevron` turns, and `useCollapsible` animates the height. The content mounts on open and unmounts
15
+ * when the close has finished, so a closed player is not playing out of sight.
16
+ *
17
+ * The action's space never changes. A card type whose records can carry a kind's content (`disclosure` on its registry
18
+ * entry, `disclosure: CHAT_CARD_DISCLOSURE.VIDEO`) draws the action in its skeleton (`ChatCardDisclosureButton
19
+ * loading`), and a record of that type without the content keeps the slot, unseen
20
+ * (`useChatCardDisclosure(kind, null, { reserve: true })`).
21
+ *
22
+ * Two shapes, one state:
23
+ * - `useChatCardDisclosure` for a card with a footer row (the action goes in the row, the panel below the card);
24
+ * - `ChatCardDisclosureRow` for content with no card of its own (a `[card://video:<id>]` marker): the same action on
25
+ * a row of its own.
26
+ */
27
+
28
+ import type React from 'react';
29
+ import { type ReactNode, useState } from 'react';
30
+ import { PlayIcon } from '../../icons-v2-generated/media-playback/play-icon';
31
+ import { Button } from '../../ui/button';
32
+ import type { ChatRef } from '../chat-ref.types';
33
+ import { ExpandChevron } from '../expand-chevron';
34
+ import { useCollapsible } from '../hooks/use-collapsible';
35
+ import { CARD_FOOTER_ACTION_CLASS, FooterActionSkeleton } from '../source-action-button';
36
+ import { ChatVideoEntityCard } from './chat-video-entity-card';
37
+
38
+ /** The kinds of content a chat card can open below itself. */
39
+ export const CHAT_CARD_DISCLOSURE = {
40
+ VIDEO: 'VIDEO',
41
+ } as const;
42
+
43
+ export type ChatCardDisclosureKind = (typeof CHAT_CARD_DISCLOSURE)[keyof typeof CHAT_CARD_DISCLOSURE];
44
+
45
+ /**
46
+ * The fields of a fetched card record a kind reads. Two shapes: a ChatRef-shaped item (per-object hydration routes)
47
+ * carries `metadata` keys directly; a content row (public list APIs) carries its canonical columns.
48
+ */
49
+ export interface ChatCardDisclosureSource {
50
+ metadata?: Record<string, unknown> | null;
51
+ custom_video_url?: string | null;
52
+ main_video_url?: string | null;
53
+ youtube_url?: string | null;
54
+ testimonial_video_url?: string | null;
55
+ highlight_video_url?: string | null;
56
+ main_video_thumbnail?: string | null;
57
+ highlight_video_thumbnail?: string | null;
58
+ featured_image?: string | null;
59
+ }
60
+
61
+ interface ChatCardDisclosureSpec {
62
+ /** The action while the content is closed. */
63
+ label: string;
64
+ /** The action while it is open. */
65
+ openLabel: string;
66
+ icon: React.ComponentType<{ className?: string }>;
67
+ /** This kind's content on a fetched record, as the ref its `render` draws; null when the record has none. */
68
+ fromItem: (item: ChatCardDisclosureSource | undefined, chatRef: ChatRef) => ChatRef | null;
69
+ /** The content, for the ref `fromItem` produced (or a ref that describes it on its own, e.g. a video marker). */
70
+ render: (chatRef: ChatRef) => ReactNode;
71
+ }
72
+
73
+ /** First non-empty string. */
74
+ function pick(...values: unknown[]): string | undefined {
75
+ for (const v of values) if (typeof v === 'string' && v.length > 0) return v;
76
+ return undefined;
77
+ }
78
+
79
+ /**
80
+ * A record's hero video, in the player's metadata keys (`custom_video_url` for recordings, `main_video_url` elsewhere,
81
+ * `testimonial_video_url` is the case-study mapper's youtube column, `featured_image` the customer-interview mapper's
82
+ * poster). Null when the record carries no video.
83
+ */
84
+ function videoFromItem(item: ChatCardDisclosureSource | undefined, chatRef: ChatRef): ChatRef | null {
85
+ const m: Record<string, unknown> = item?.metadata ?? {};
86
+ const out: Record<string, string> = {};
87
+ const videoUrl = pick(m.videoUrl, item?.custom_video_url, item?.main_video_url);
88
+ const youtubeUrl = pick(m.youtubeUrl, item?.youtube_url, item?.testimonial_video_url);
89
+ const highlightVideoUrl = pick(m.highlightVideoUrl, item?.highlight_video_url);
90
+ const videoPoster = pick(
91
+ m.videoPoster,
92
+ item?.main_video_thumbnail,
93
+ item?.highlight_video_thumbnail,
94
+ item?.featured_image,
95
+ );
96
+ const highlightVideoPoster = pick(m.highlightVideoPoster, item?.highlight_video_thumbnail);
97
+ if (videoUrl) out.videoUrl = videoUrl;
98
+ if (youtubeUrl) out.youtubeUrl = youtubeUrl;
99
+ if (highlightVideoUrl) out.highlightVideoUrl = highlightVideoUrl;
100
+ if (videoPoster) out.videoPoster = videoPoster;
101
+ if (highlightVideoPoster) out.highlightVideoPoster = highlightVideoPoster;
102
+ if (!out.videoUrl && !out.youtubeUrl && !out.highlightVideoUrl) return null;
103
+ return { ...chatRef, metadata: { ...(chatRef.metadata ?? {}), ...out } };
104
+ }
105
+
106
+ /** Every kind of content a chat card can open. A new kind is one entry here and one in `CHAT_CARD_DISCLOSURE`. */
107
+ export const CHAT_CARD_DISCLOSURES: Record<ChatCardDisclosureKind, ChatCardDisclosureSpec> = {
108
+ VIDEO: {
109
+ label: 'Watch video',
110
+ openLabel: 'Hide video',
111
+ icon: PlayIcon,
112
+ fromItem: videoFromItem,
113
+ render: chatRef => <ChatVideoEntityCard chatRef={chatRef} />,
114
+ },
115
+ };
116
+
117
+ /** The first kind whose content a fetched record carries, with that content; null when it carries none. */
118
+ export function chatCardDisclosureOf(
119
+ item: ChatCardDisclosureSource | undefined,
120
+ chatRef: ChatRef,
121
+ ): { kind: ChatCardDisclosureKind; content: ChatRef } | null {
122
+ for (const kind of Object.values(CHAT_CARD_DISCLOSURE)) {
123
+ const content = CHAT_CARD_DISCLOSURES[kind].fromItem(item, chatRef);
124
+ if (content) return { kind, content };
125
+ }
126
+ return null;
127
+ }
128
+
129
+ /** The footer action that opens and closes a kind's content. */
130
+ export function ChatCardDisclosureButton({
131
+ kind,
132
+ open = false,
133
+ onToggle,
134
+ title,
135
+ loading,
136
+ }: {
137
+ kind: ChatCardDisclosureKind;
138
+ open?: boolean;
139
+ onToggle?: () => void;
140
+ title?: string;
141
+ /** The action's loading form, drawn in the skeleton of a card that can carry this content. */
142
+ loading?: boolean;
143
+ }): React.ReactElement {
144
+ const spec = CHAT_CARD_DISCLOSURES[kind];
145
+ if (loading) return <FooterActionSkeleton label={spec.label} className={CARD_FOOTER_ACTION_CLASS} />;
146
+ const label = open ? spec.openLabel : spec.label;
147
+ const Icon = spec.icon;
148
+ return (
149
+ <Button
150
+ variant="transparent"
151
+ size="small"
152
+ leftIcon={<Icon className="!h-3 !w-3" />}
153
+ rightIcon={<ExpandChevron expanded={open} className="!h-3 !w-3" />}
154
+ onClick={(e: React.MouseEvent) => {
155
+ // The card around it is a link: the action must not follow it.
156
+ e.preventDefault();
157
+ e.stopPropagation();
158
+ onToggle?.();
159
+ }}
160
+ aria-expanded={open}
161
+ aria-label={title ? `${label}: ${title}` : label}
162
+ className={CARD_FOOTER_ACTION_CLASS}
163
+ >
164
+ {label}
165
+ </Button>
166
+ );
167
+ }
168
+
169
+ /** The panel below the card: animated like every chat expander, its content mounted only while open or closing. */
170
+ function DisclosurePanel({ open, children }: { open: boolean; children: ReactNode }): React.ReactElement {
171
+ const { innerRef, containerStyle } = useCollapsible({ expanded: open });
172
+ return (
173
+ <div style={containerStyle}>
174
+ <div ref={innerRef}>{children}</div>
175
+ </div>
176
+ );
177
+ }
178
+
179
+ /**
180
+ * The action for a card's footer row, and the panel to draw below the card. With no content (`chatRef` null),
181
+ * `reserve` keeps the action's slot, unseen and unreachable, for a card type whose records can carry it.
182
+ */
183
+ export function useChatCardDisclosure(
184
+ kind: ChatCardDisclosureKind,
185
+ chatRef: ChatRef | null,
186
+ { reserve = false }: { reserve?: boolean } = {},
187
+ ): { action: ReactNode; panel: ReactNode } {
188
+ const [open, setOpen] = useState(false);
189
+ // Mounted from the first open until a close has finished animating.
190
+ const [mounted, setMounted] = useState(false);
191
+ if (!chatRef) {
192
+ return {
193
+ action: reserve ? (
194
+ <span aria-hidden inert className="invisible">
195
+ <ChatCardDisclosureButton kind={kind} />
196
+ </span>
197
+ ) : null,
198
+ panel: null,
199
+ };
200
+ }
201
+ const toggle = () => {
202
+ if (!open) setMounted(true);
203
+ setOpen(o => !o);
204
+ };
205
+ return {
206
+ action: <ChatCardDisclosureButton kind={kind} open={open} onToggle={toggle} title={chatRef.title} />,
207
+ panel: mounted ? (
208
+ <div data-testid="chat-card-disclosure-panel" onTransitionEnd={() => !open && setMounted(false)}>
209
+ <DisclosurePanel open={open}>{CHAT_CARD_DISCLOSURES[kind].render(chatRef)}</DisclosurePanel>
210
+ </div>
211
+ ) : null,
212
+ };
213
+ }
214
+
215
+ /** Content with no card of its own: the action on its own row, the panel below it once opened. */
216
+ export function ChatCardDisclosureRow({
217
+ kind,
218
+ chatRef,
219
+ }: {
220
+ kind: ChatCardDisclosureKind;
221
+ chatRef: ChatRef;
222
+ }): React.ReactElement {
223
+ const { action, panel } = useChatCardDisclosure(kind, chatRef);
224
+ return (
225
+ <div className="grid min-w-0 grid-cols-1 gap-3">
226
+ <div className="flex items-center gap-2 pl-0.5">
227
+ {action}
228
+ <span className="min-w-0 truncate text-ods-text-secondary text-h6">{chatRef.title}</span>
229
+ </div>
230
+ {panel}
231
+ </div>
232
+ );
233
+ }
@@ -109,7 +109,15 @@ import { resolveSourceIcon, sourceRowCtxFromRuntime } from '../utils/source-row-
109
109
  import { BlockCard } from './block-card';
110
110
  import { BlogCard } from './blog-card';
111
111
  import { CaseStudyCard } from './case-study-card';
112
- import { ChatVideoEntityCard } from './chat-video-entity-card';
112
+ import {
113
+ CHAT_CARD_DISCLOSURE,
114
+ CHAT_CARD_DISCLOSURES,
115
+ ChatCardDisclosureButton,
116
+ type ChatCardDisclosureKind,
117
+ ChatCardDisclosureRow,
118
+ chatCardDisclosureOf,
119
+ useChatCardDisclosure,
120
+ } from './chat-card-disclosure';
113
121
  import { CustomerInterviewCard } from './customer-interview-card';
114
122
  import { DeletedDataCard } from './deleted-data-card';
115
123
  import { designDocMetaLine } from './design-doc-card';
@@ -465,40 +473,6 @@ function decodeVideoMarkerId(id: string): { videoUrl?: string; youtubeUrl?: stri
465
473
  return null;
466
474
  }
467
475
 
468
- /** Read hero-video metadata off a FETCHED item — the API-driven
469
- * replacement for the retired refs-frame `metadata.videoUrl` check. Two item
470
- * shapes: ChatRef-shaped items (per-object hydration routes) carry the
471
- * SSOT `metadata` keys directly; content rows (public list APIs) carry
472
- * the canonical columns (`custom_video_url` for recordings,
473
- * `main_video_url` elsewhere — see the hub configs' videoUrlColumns).
474
- * Returns null when the item carries no video (compact card only). */
475
- function itemVideoMetadata(item: ChatCardItem | undefined): Record<string, string> | null {
476
- const pick = (...vals: unknown[]): string | undefined => {
477
- for (const v of vals) if (typeof v === 'string' && v.length > 0) return v;
478
- return undefined;
479
- };
480
- const m: Record<string, unknown> = item?.metadata ?? {};
481
- const out: Record<string, string> = {};
482
- const videoUrl = pick(m.videoUrl, item?.custom_video_url, item?.main_video_url);
483
- // `testimonial_video_url` is the case-study mapper's youtube column.
484
- const youtubeUrl = pick(m.youtubeUrl, item?.youtube_url, item?.testimonial_video_url);
485
- const highlightVideoUrl = pick(m.highlightVideoUrl, item?.highlight_video_url);
486
- // `featured_image` is the customer-interview mapper's poster column.
487
- const videoPoster = pick(
488
- m.videoPoster,
489
- item?.main_video_thumbnail,
490
- item?.highlight_video_thumbnail,
491
- item?.featured_image,
492
- );
493
- const highlightVideoPoster = pick(m.highlightVideoPoster, item?.highlight_video_thumbnail);
494
- if (videoUrl) out.videoUrl = videoUrl;
495
- if (youtubeUrl) out.youtubeUrl = youtubeUrl;
496
- if (highlightVideoUrl) out.highlightVideoUrl = highlightVideoUrl;
497
- if (videoPoster) out.videoPoster = videoPoster;
498
- if (highlightVideoPoster) out.highlightVideoPoster = highlightVideoPoster;
499
- return out.videoUrl || out.youtubeUrl || out.highlightVideoUrl ? out : null;
500
- }
501
-
502
476
  /** LOUD hydration-failure card — a card that fails to load renders a
503
477
  * VISIBLE error state instead of silently disappearing (explicit
504
478
  * product decision 2026-08-13: broken must look broken, both for
@@ -780,12 +754,18 @@ function ChatCardWithDiscuss({
780
754
  onDiscuss,
781
755
  onDisplay,
782
756
  displayAction,
757
+ footerAction,
758
+ loading,
783
759
  children,
784
760
  }: {
785
761
  chatRef: ChatRef;
786
762
  onDiscuss?: (ref: ChatRef) => void;
787
763
  onDisplay?: (ref: ChatRef) => void;
788
764
  displayAction?: boolean;
765
+ /** A further action in the footer row, beside Ask (the card's "Watch video"). */
766
+ footerAction?: React.ReactNode;
767
+ /** The card is still loading: the footer row is drawn too, its actions in their loading form. */
768
+ loading?: boolean;
789
769
  children: React.ReactNode;
790
770
  }) {
791
771
  const { Icon: SourceIcon, label: sourceLabel } = resolveSourceIcon({
@@ -799,13 +779,16 @@ function ChatCardWithDiscuss({
799
779
  <span className="mb-2 mt-1.5 block w-full">
800
780
  {cardBody}
801
781
  <span className="mt-1 flex items-center justify-between gap-2 pl-0.5">
802
- <SourceActionButton
803
- chatRef={chatRef}
804
- onDiscuss={useDisplay ? onDisplay : onDiscuss}
805
- label={useDisplay ? 'Display' : undefined}
806
- density="card"
807
- />
808
- {!onDiscuss && !useDisplay ? <span /> : null}
782
+ <span className="flex items-center gap-3">
783
+ <SourceActionButton
784
+ chatRef={chatRef}
785
+ onDiscuss={useDisplay ? onDisplay : onDiscuss}
786
+ label={useDisplay ? 'Display' : undefined}
787
+ density="card"
788
+ loading={loading}
789
+ />
790
+ {footerAction}
791
+ </span>
809
792
  {idDisplay ? (
810
793
  <span
811
794
  className="inline-flex shrink-0 items-center gap-1 text-ods-text-secondary opacity-60 transition-opacity text-code hover:text-ods-text-primary hover:opacity-100"
@@ -1327,6 +1310,10 @@ interface ChatCardRegistryEntry {
1327
1310
  contentRefType?: string;
1328
1311
  /** Required whenever `contentRefType` is set. */
1329
1312
  skeleton?: () => React.ReactNode;
1313
+ /** The kind of content this type's records can open below the card (`CHAT_CARD_DISCLOSURE.VIDEO`): the card's
1314
+ * footer row keeps that action's slot loading and loaded, with or without the content on a record, so the row
1315
+ * never changes height. */
1316
+ disclosure?: ChatCardDisclosureKind;
1330
1317
  /** `item` is the fetched row (`undefined` only on the ref-only render
1331
1318
  * path — `deleted_data` / `video`). */
1332
1319
  render: (item: ChatCardItem | undefined, chatRef: ChatRef, opts: ChatCardRenderOptions) => React.ReactNode;
@@ -1590,10 +1577,22 @@ interface ProgramCardConfig {
1590
1577
  label: string;
1591
1578
  configKey: ProgramConfigKey;
1592
1579
  contentRefType: string;
1580
+ /** Episodes and webinars have recordings; events do not. */
1581
+ disclosure?: ChatCardDisclosureKind;
1593
1582
  }
1594
1583
  const PROGRAM_CARD_CONFIGS: Record<string, ProgramCardConfig> = {
1595
- podcast: { label: 'Podcast episode', configKey: 'podcast', contentRefType: 'podcast' },
1596
- webinar: { label: 'Webinar', configKey: 'webinar', contentRefType: 'webinar' },
1584
+ podcast: {
1585
+ label: 'Podcast episode',
1586
+ configKey: 'podcast',
1587
+ contentRefType: 'podcast',
1588
+ disclosure: CHAT_CARD_DISCLOSURE.VIDEO,
1589
+ },
1590
+ webinar: {
1591
+ label: 'Webinar',
1592
+ configKey: 'webinar',
1593
+ contentRefType: 'webinar',
1594
+ disclosure: CHAT_CARD_DISCLOSURE.VIDEO,
1595
+ },
1597
1596
  event: { label: 'Event', configKey: 'event', contentRefType: 'event' },
1598
1597
  };
1599
1598
  function programRegistryEntries(): Record<string, ChatCardRegistryEntry> {
@@ -1601,6 +1600,7 @@ function programRegistryEntries(): Record<string, ChatCardRegistryEntry> {
1601
1600
  label: cfg.label,
1602
1601
  contentRefType: cfg.contentRefType,
1603
1602
  bareInline: true,
1603
+ disclosure: cfg.disclosure,
1604
1604
  skeleton: () => <ProgramCard loading size="sm" />,
1605
1605
  render: (item, chatRef, opts) => (
1606
1606
  <ProgramChatCard
@@ -1771,6 +1771,7 @@ export const CHAT_CARD_REGISTRY: Record<string, ChatCardRegistryEntry> = {
1771
1771
  ),
1772
1772
  },
1773
1773
  case_study: {
1774
+ disclosure: CHAT_CARD_DISCLOSURE.VIDEO,
1774
1775
  label: 'Case study',
1775
1776
  contentRefType: 'case_study',
1776
1777
  bareInline: true,
@@ -1797,6 +1798,7 @@ export const CHAT_CARD_REGISTRY: Record<string, ChatCardRegistryEntry> = {
1797
1798
  ),
1798
1799
  },
1799
1800
  customer_interview: {
1801
+ disclosure: CHAT_CARD_DISCLOSURE.VIDEO,
1800
1802
  label: 'Customer interview',
1801
1803
  contentRefType: 'customer_interview',
1802
1804
  bareInline: true,
@@ -1812,6 +1814,7 @@ export const CHAT_CARD_REGISTRY: Record<string, ChatCardRegistryEntry> = {
1812
1814
  ),
1813
1815
  },
1814
1816
  product_release: {
1817
+ disclosure: CHAT_CARD_DISCLOSURE.VIDEO,
1815
1818
  label: 'Product release',
1816
1819
  contentRefType: 'product_release',
1817
1820
  bareInline: true,
@@ -1837,6 +1840,7 @@ export const CHAT_CARD_REGISTRY: Record<string, ChatCardRegistryEntry> = {
1837
1840
  },
1838
1841
  ...programRegistryEntries(),
1839
1842
  investor_update: {
1843
+ disclosure: CHAT_CARD_DISCLOSURE.VIDEO,
1840
1844
  label: 'Investor update',
1841
1845
  contentRefType: 'investor_update',
1842
1846
  bareInline: true,
@@ -1852,6 +1856,7 @@ export const CHAT_CARD_REGISTRY: Record<string, ChatCardRegistryEntry> = {
1852
1856
  ),
1853
1857
  },
1854
1858
  onboarding_guide: {
1859
+ disclosure: CHAT_CARD_DISCLOSURE.VIDEO,
1855
1860
  label: 'Onboarding guide',
1856
1861
  contentRefType: 'onboarding_guide',
1857
1862
  bareInline: true,
@@ -2009,6 +2014,31 @@ interface ChatCardLoaderProps {
2009
2014
  extras?: ChatCardDispatchExtras;
2010
2015
  }
2011
2016
 
2017
+ /**
2018
+ * A fetched card with something to open below it: the kind's action in the card's footer row ("Watch video"), the
2019
+ * content below once opened; with no content on this record, the action's slot is kept unseen.
2020
+ */
2021
+ function CardWithDisclosure({
2022
+ kind,
2023
+ content,
2024
+ card,
2025
+ }: {
2026
+ kind: ChatCardDisclosureKind;
2027
+ content: ChatRef | null;
2028
+ card: (action: ReactNode) => ReactNode;
2029
+ }) {
2030
+ const { action, panel } = useChatCardDisclosure(kind, content, { reserve: true });
2031
+ return (
2032
+ // Same 12px rhythm as the message renderer's block-sibling wrapper
2033
+ // (`my-3` in chat-message-enhanced) so card→player spacing matches
2034
+ // the spacing between any two hoisted blocks.
2035
+ <div className="grid min-w-0 grid-cols-1 gap-3">
2036
+ {card(action)}
2037
+ {panel}
2038
+ </div>
2039
+ );
2040
+ }
2041
+
2012
2042
  /**
2013
2043
  * Generic fetch-mode card loader. Looks up the registry entry by
2014
2044
  * `chatRef.type`, fetches the full item via `useChatCardItem`, and
@@ -2131,17 +2161,24 @@ export function ChatCardLoader({
2131
2161
  // wrapper; everything else gets the ChatCardWithDiscuss chrome. Kept
2132
2162
  // here (not per-branch) so the two paths can never drift on the
2133
2163
  // discuss-menu wiring.
2134
- const finish = (node: React.ReactNode) =>
2164
+ // `loading` draws the same chrome around the card's skeleton (the footer row and its actions in their loading
2165
+ // form), so the card does not grow by a row when it loads.
2166
+ const finish = (node: React.ReactNode, footerAction?: React.ReactNode, loading?: boolean) =>
2135
2167
  entry.bareInline ? (
2136
- <>{navWrap(node)}</>
2168
+ <>
2169
+ {loading ? node : navWrap(node)}
2170
+ {footerAction ? <span className="mt-1 flex items-center pl-0.5">{footerAction}</span> : null}
2171
+ </>
2137
2172
  ) : (
2138
2173
  <ChatCardWithDiscuss
2139
2174
  chatRef={finalChatRef}
2140
2175
  onDiscuss={onDiscuss}
2141
2176
  onDisplay={onDisplay}
2142
2177
  displayAction={entry.displayAction}
2178
+ footerAction={footerAction}
2179
+ loading={loading}
2143
2180
  >
2144
- {navWrap(node)}
2181
+ {loading ? node : navWrap(node)}
2145
2182
  </ChatCardWithDiscuss>
2146
2183
  );
2147
2184
  if (!fetchEntry) {
@@ -2149,7 +2186,13 @@ export function ChatCardLoader({
2149
2186
  // to fetch): render straight from the marker's descriptor.
2150
2187
  return finish(entry.render(undefined, finalChatRef, renderOpts));
2151
2188
  }
2152
- if (isLoading) return <>{fetchEntry.skeleton?.() ?? null}</>;
2189
+ if (isLoading) {
2190
+ return finish(
2191
+ fetchEntry.skeleton?.() ?? null,
2192
+ entry.disclosure ? <ChatCardDisclosureButton kind={entry.disclosure} loading /> : undefined,
2193
+ true,
2194
+ );
2195
+ }
2153
2196
  if (!item) {
2154
2197
  // FAIL LOUD (explicit product decision 2026-08-13): a card that
2155
2198
  // cannot hydrate renders a VISIBLE error card — silent removal made
@@ -2175,20 +2218,18 @@ export function ChatCardLoader({
2175
2218
  // async) it renders nothing (the missing-videos regression,
2176
2219
  // 2026-08-13). The loader's output already lives in a hoisted
2177
2220
  // block-level sibling (`b-<key>`), so block content is legal here.
2178
- const videoMeta = itemVideoMetadata(item);
2179
- if (videoMeta) {
2180
- const videoRef: ChatRef = {
2181
- ...finalChatRef,
2182
- metadata: { ...(finalChatRef.metadata ?? {}), ...videoMeta },
2183
- };
2221
+ // The kind the type declares (its slot is reserved even when this record has no content), else the first kind
2222
+ // whose content the record carries. Collapsed: the footer row carries the action, and the content opens below the
2223
+ // card only when asked (`chat-card-disclosure.tsx`).
2224
+ const kind = entry.disclosure ?? chatCardDisclosureOf(item, finalChatRef)?.kind;
2225
+ if (kind) {
2226
+ const content = CHAT_CARD_DISCLOSURES[kind].fromItem(item, finalChatRef);
2184
2227
  return (
2185
- // Same 12px rhythm as the message renderer's block-sibling wrapper
2186
- // (`my-3` in chat-message-enhanced) so card→player spacing matches
2187
- // the spacing between any two hoisted blocks.
2188
- <div className="grid min-w-0 grid-cols-1 gap-3">
2189
- {finish(entry.render(item, finalChatRef, renderOpts))}
2190
- <ChatVideoEntityCard chatRef={videoRef} />
2191
- </div>
2228
+ <CardWithDisclosure
2229
+ kind={kind}
2230
+ content={content}
2231
+ card={action => finish(entry.render(item, finalChatRef, renderOpts), action)}
2232
+ />
2192
2233
  );
2193
2234
  }
2194
2235
  return finish(entry.render(item, finalChatRef, renderOpts));
@@ -2237,7 +2278,7 @@ export function renderChatInlineEntityCard(
2237
2278
  // transport with zero refs/fetch. Undecodable ids (legacy sha1 hashes,
2238
2279
  // hallucinations) fall through to the loader → plain-text degrade.
2239
2280
  // Hero videos on FETCHED entity types (webinars, releases, …) are
2240
- // handled post-fetch inside ChatCardLoader (`itemVideoMetadata`) — the
2281
+ // handled post-fetch inside ChatCardLoader (`chatCardDisclosureOf`) — the
2241
2282
  // marker's ref plays no part in either path.
2242
2283
  if (chatRef.type === 'video') {
2243
2284
  const decoded = decodeVideoMarkerId(chatRef.id);
@@ -2261,7 +2302,7 @@ export function renderChatInlineEntityCard(
2261
2302
  {externalUrl && !isAppOriginUrl(externalUrl) ? (
2262
2303
  <ExternalMediaNotice url={externalUrl} kind="video" label={displayRef.title} />
2263
2304
  ) : (
2264
- <ChatVideoEntityCard chatRef={displayRef} />
2305
+ <ChatCardDisclosureRow kind={CHAT_CARD_DISCLOSURE.VIDEO} chatRef={displayRef} />
2265
2306
  )}
2266
2307
  </BlockCard>
2267
2308
  );
@@ -43,6 +43,15 @@ export type { AiPromptCardData, AiPromptCardProps } from './ai-prompt-card';
43
43
  export { BlockCard, type BlockCardProps } from './block-card';
44
44
  export { ChatTicketItem, type ChatTicketItemData, type ChatTicketItemProps } from './chat-ticket-item';
45
45
  export { ChatVideoEntityCard, type ChatVideoEntityCardProps } from './chat-video-entity-card';
46
+ export {
47
+ CHAT_CARD_DISCLOSURE,
48
+ CHAT_CARD_DISCLOSURES,
49
+ ChatCardDisclosureButton,
50
+ type ChatCardDisclosureKind,
51
+ ChatCardDisclosureRow,
52
+ chatCardDisclosureOf,
53
+ useChatCardDisclosure,
54
+ } from './chat-card-disclosure';
46
55
  export {
47
56
  ProductReleaseCard,
48
57
  type ProductReleaseCardProps,
@@ -140,3 +140,4 @@ export {
140
140
  ASK_AI_TRIGGER_ATTRIBUTE,
141
141
  } from './utils/ask-ai-events';
142
142
  export * from './proxy-credentials-panel';
143
+ export { InlineAppLinkChip, InlineChip } from './inline-app-link-chip';
@@ -0,0 +1,79 @@
1
+ 'use client';
2
+
3
+ /**
4
+ * An inline box in the answer's text: the skin every chip a reader can click inside a chat sentence wears. The
5
+ * host's entity mentions (`@device:<id>`, drawn by its `renderMention`) and the links the answer makes to a screen of
6
+ * the app (`[Devices → Add Device](/devices/new)`) both use it, so a link to a place in the app reads as one at a
7
+ * glance (CU-17tkuw61kfy: drawn as a plain link, it was the colour of the text around it).
8
+ *
9
+ * ONE component draws the box, `InlineChip`: the lib's `Tag` badge, rendered as a `<span>` (the chip sits inside
10
+ * markdown's `<p>`, where a `<div>` is invalid), with the inline skin below. A host's chip (the frontend's
11
+ * `MentionTag`, both its segments) draws `InlineChip` too, and adds only its own behaviour (link, new-tab segment).
12
+ */
13
+
14
+ import type React from 'react';
15
+ import Link from '../../embed-shims/next-link';
16
+ import { cn } from '../../utils/cn';
17
+ import { BrowserWindowIcon } from '../icons-v2-generated/coding/browser-window-icon';
18
+ import { Tag } from '../ui/tag';
19
+
20
+ /**
21
+ * On top of `Tag`'s badge skin, for a chip in a line of text:
22
+ * - `align-middle`: centred on the text line;
23
+ * - `hover:border-ods-border`: no accent border on hover (the badge's default);
24
+ * - `[&_svg]:size-4` and `[&_svg]:text-ods-text-secondary`: a 16px muted lead icon, the label in the primary colour.
25
+ */
26
+ const INLINE_CHIP_CLASS =
27
+ 'max-w-[16rem] align-middle [&_svg]:size-4 [&_svg]:text-ods-text-secondary hover:border-ods-border';
28
+
29
+ /**
30
+ * The inline box: an icon and a label in a chat sentence. `className` adds to the skin (a segment's square corner, a
31
+ * hover fill); `loading` draws `Tag`'s own skeleton in the same box.
32
+ */
33
+ export function InlineChip({
34
+ icon,
35
+ label,
36
+ className,
37
+ loading,
38
+ }: {
39
+ icon?: React.ReactNode;
40
+ label: React.ReactNode;
41
+ className?: string;
42
+ loading?: boolean;
43
+ }): React.ReactElement {
44
+ return (
45
+ <Tag
46
+ as="span"
47
+ variant="badge"
48
+ icon={icon}
49
+ label={label}
50
+ loading={loading}
51
+ className={cn(INLINE_CHIP_CLASS, className)}
52
+ />
53
+ );
54
+ }
55
+
56
+ /**
57
+ * A link that stays in this app (the runtime's `computeIsNewTab` keeps it in this window), drawn as an inline box. `anchor` is the host's link element (its
58
+ * `NavLinkAnchor`, so the click follows the host's routing rule), else the lib's boxed `Link`.
59
+ */
60
+ export function InlineAppLinkChip({
61
+ href,
62
+ children,
63
+ anchor: Anchor,
64
+ }: {
65
+ href: string;
66
+ children: React.ReactNode;
67
+ anchor?: React.ComponentType<{ href: string; className?: string; children?: React.ReactNode }>;
68
+ }): React.ReactElement {
69
+ const chip = <InlineChip icon={<BrowserWindowIcon />} label={children} className="hover:bg-ods-bg-hover" />;
70
+ return Anchor ? (
71
+ <Anchor href={href} className="no-underline">
72
+ {chip}
73
+ </Anchor>
74
+ ) : (
75
+ <Link href={href} className="no-underline">
76
+ {chip}
77
+ </Link>
78
+ );
79
+ }