@flamingo-stack/openframe-frontend-core 0.0.812 → 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.
- package/dist/build/export-map.json +1 -1
- package/dist/case-study-card-NLT2JVI7.cjs +23 -0
- package/dist/{chunk-5QLDHPPU.cjs → chunk-25HBH4J6.cjs} +15 -15
- package/dist/{chunk-WFJDKP2Q.cjs → chunk-2H7XPKKT.cjs} +37 -37
- package/dist/{chunk-LKQ33CMY.cjs → chunk-2XCORRJV.cjs} +3 -3
- package/dist/{chunk-JTIGKLKJ.cjs → chunk-2XLPRW7V.cjs} +23 -23
- package/dist/{chunk-4WIJI4AK.cjs → chunk-3TOWCFIK.cjs} +20 -26
- package/dist/{chunk-KUXHXLJQ.cjs → chunk-3V5JWG27.cjs} +5 -5
- package/dist/{chunk-CUDJP7R7.cjs → chunk-467T3LCG.cjs} +63 -63
- package/dist/{chunk-COTJLBOS.cjs → chunk-4PMD3JUC.cjs} +19 -19
- package/dist/{chunk-YR74H7Z3.cjs → chunk-5SZ4ILU3.cjs} +7 -7
- package/dist/{chunk-7JWFMAQB.cjs → chunk-63A4GZMB.cjs} +18 -2
- package/dist/{chunk-ZD6SZLO2.cjs → chunk-6CZVQ72C.cjs} +3 -3
- package/dist/{chunk-PQ76VC2P.cjs → chunk-7ERD34HQ.cjs} +1073 -825
- package/dist/{chunk-VEN6MGNX.cjs → chunk-7O7EX7HQ.cjs} +45 -45
- package/dist/{chunk-FCFLZPID.cjs → chunk-AYMKG55T.cjs} +51 -51
- package/dist/{chunk-U2MHQBL4.cjs → chunk-BOS7OIC4.cjs} +30 -30
- package/dist/{chunk-NEDFRRLM.cjs → chunk-CVPHODOE.cjs} +171 -171
- package/dist/{chunk-JMRO7CK2.cjs → chunk-D23VVC3K.cjs} +45 -45
- package/dist/{chunk-D2EPUQ35.cjs → chunk-E5VF3IXO.cjs} +4 -4
- package/dist/{chunk-SFUNXMY3.cjs → chunk-EHANO6UE.cjs} +16 -16
- package/dist/{chunk-4ZTGCCNI.cjs → chunk-F4ZJRMMM.cjs} +20 -20
- package/dist/{chunk-AHBTZ7DN.cjs → chunk-FCZAUK4D.cjs} +52 -50
- package/dist/{chunk-RSLLS6C4.cjs → chunk-G2B6EA4J.cjs} +62 -62
- package/dist/{chunk-XB7VPJNY.cjs → chunk-G5CCYMCU.cjs} +3 -3
- package/dist/{chunk-VT2ACO3Z.cjs → chunk-GAR2IIU6.cjs} +349 -349
- package/dist/{chunk-743MM5B6.cjs → chunk-HM7VCQSX.cjs} +10 -10
- package/dist/{chunk-DA2TWDGJ.cjs → chunk-IBYT5I7K.cjs} +13 -13
- package/dist/{chunk-D322VUSH.cjs → chunk-IDEOLXY6.cjs} +2050 -2078
- package/dist/{chunk-VYLBW6ZV.cjs → chunk-IJCSQFLD.cjs} +209 -209
- package/dist/{chunk-XZKYU57A.cjs → chunk-IKB6AZPV.cjs} +8 -8
- package/dist/{chunk-VPYGK4AV.cjs → chunk-ILV243HM.cjs} +31 -31
- package/dist/{chunk-TS4PKCG3.cjs → chunk-JOKOQOLJ.cjs} +22 -22
- package/dist/{chunk-TCMUVY3M.cjs → chunk-KINBPFAC.cjs} +199 -199
- package/dist/{chunk-2IZHRVKD.cjs → chunk-KNGULKOU.cjs} +46 -46
- package/dist/{chunk-JMAKYJ3Q.cjs → chunk-LUR2ED43.cjs} +6 -6
- package/dist/{chunk-EPMAMFQE.cjs → chunk-M6VLEXN3.cjs} +119 -119
- package/dist/{chunk-GD47ZGOU.cjs → chunk-N3MBQRCQ.cjs} +3 -3
- package/dist/{chunk-ZFUNSXSH.cjs → chunk-NONMZ5WJ.cjs} +5 -5
- package/dist/{chunk-E64HJMY6.cjs → chunk-OBQ5WUNG.cjs} +67 -67
- package/dist/{chunk-6LZ4BI7Z.cjs → chunk-PAI4A3UM.cjs} +60 -60
- package/dist/{chunk-4IU462LR.cjs → chunk-QDDBOCG3.cjs} +2 -2
- package/dist/{chunk-5DBW6ERF.cjs → chunk-QOAA7ZHB.cjs} +2 -2
- package/dist/{chunk-7Q2PFKU3.cjs → chunk-QQT23JJ7.cjs} +4 -4
- package/dist/{chunk-4SZKJPQJ.cjs → chunk-RD66AGUI.cjs} +6 -6
- package/dist/{chunk-NL3G642U.cjs → chunk-S3QXLD4X.cjs} +10 -10
- package/dist/{chunk-7RM4NM2C.cjs → chunk-SWF6TNZ3.cjs} +14 -14
- package/dist/{chunk-P4B6PVSG.cjs → chunk-USUVHAQ7.cjs} +7 -7
- package/dist/{chunk-K7IX2NAG.cjs → chunk-UTRRECPV.cjs} +110 -110
- package/dist/{chunk-7HNZHENA.cjs → chunk-WJPEDREU.cjs} +13 -13
- package/dist/{chunk-SC3I3YWM.cjs → chunk-Y6MJMPHV.cjs} +126 -126
- package/dist/{chunk-OKI5KSUV.cjs → chunk-ZNZ6453J.cjs} +44 -44
- package/dist/{chunk-7TBXHZLB.cjs → chunk-ZRDVFADQ.cjs} +61 -61
- package/dist/{cloud-tenants-CW3I7AIM.cjs → cloud-tenants-JSH6AQMZ.cjs} +32 -32
- package/dist/components/calendar.cjs +10 -10
- package/dist/components/case-studies/index.cjs +52 -52
- package/dist/components/chat/chat-message-enhanced.d.ts.map +1 -1
- package/dist/components/chat/chat-message-enhanced.js +8 -1
- package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
- package/dist/components/chat/embeddable-chat.js +34 -2
- package/dist/components/chat/entity-cards/chat-card-disclosure.d.ts +93 -0
- package/dist/components/chat/entity-cards/chat-card-disclosure.d.ts.map +1 -0
- package/dist/components/chat/entity-cards/chat-card-disclosure.js +126 -0
- package/dist/components/chat/entity-cards/dispatch.d.ts +5 -0
- package/dist/components/chat/entity-cards/dispatch.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/dispatch.js +82 -55
- package/dist/components/chat/entity-cards/index.d.ts +1 -0
- package/dist/components/chat/entity-cards/index.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/index.js +14 -0
- package/dist/components/chat/index.cjs +42 -26
- package/dist/components/chat/index.d.ts +1 -0
- package/dist/components/chat/index.d.ts.map +1 -1
- package/dist/components/chat/index.js +3 -0
- package/dist/components/chat/inline-app-link-chip.d.ts +35 -0
- package/dist/components/chat/inline-app-link-chip.d.ts.map +1 -0
- package/dist/components/chat/inline-app-link-chip.js +37 -0
- package/dist/components/chat/source-action-button.d.ts +15 -1
- package/dist/components/chat/source-action-button.d.ts.map +1 -1
- package/dist/components/chat/source-action-button.js +40 -2
- package/dist/components/contact/index.cjs +33 -33
- package/dist/components/docs/index.cjs +36 -36
- package/dist/components/embeds/index.cjs +33 -33
- package/dist/components/faq/index.cjs +34 -34
- package/dist/components/features/index.cjs +32 -32
- package/dist/components/features/scripts/schedule-form/schedule-script-picker-card.d.ts.map +1 -1
- package/dist/components/features/scripts/schedule-form/schedule-script-picker-card.js +4 -2
- package/dist/components/features/select-button.js +1 -1
- package/dist/components/help-center-pages/index.cjs +165 -165
- package/dist/components/index.cjs +238 -220
- package/dist/components/meeting-scheduler/index.cjs +196 -196
- package/dist/components/navigation/index.cjs +35 -35
- package/dist/components/onboarding-guides/index.cjs +35 -35
- package/dist/components/platform/ScriptArguments.d.ts +2 -0
- package/dist/components/platform/ScriptArguments.d.ts.map +1 -1
- package/dist/components/platform/ScriptArguments.js +3 -2
- package/dist/components/product-demo/index.cjs +45 -45
- package/dist/components/related-content/index.cjs +17 -17
- package/dist/components/tickets/index.cjs +39 -39
- package/dist/components/ui/button/button-styles.d.ts +8 -0
- package/dist/components/ui/button/button-styles.d.ts.map +1 -1
- package/dist/components/ui/button/button-styles.js +8 -1
- package/dist/components/ui/button/button.d.ts.map +1 -1
- package/dist/components/ui/button/button.js +6 -4
- package/dist/components/ui/button/split-button.d.ts.map +1 -1
- package/dist/components/ui/button/split-button.js +3 -2
- package/dist/components/ui/checkbox-block.d.ts.map +1 -1
- package/dist/components/ui/checkbox-block.js +3 -1
- package/dist/components/ui/file-manager/index.cjs +55 -55
- package/dist/components/ui/index.cjs +52 -34
- package/dist/components/ui/input-styles.d.ts +2 -0
- package/dist/components/ui/input-styles.d.ts.map +1 -1
- package/dist/components/ui/input-styles.js +2 -0
- package/dist/{devices-KKRAB4Q2.cjs → devices-OCEOO6OW.cjs} +33 -33
- package/dist/embed-shims/index.cjs +4 -4
- package/dist/embed-shims/next-image.cjs +4 -4
- package/dist/{embeddable-chat-5UO66U4F.cjs → embeddable-chat-YRKMPFDY.cjs} +150 -117
- package/dist/hooks/index.cjs +10 -10
- package/dist/index.cjs +68 -50
- package/dist/{knowledge-Z2PTGBA3.cjs → knowledge-3GEE4LPY.cjs} +33 -33
- package/dist/{logs-6T5VK2TY.cjs → logs-7GGUZSDB.cjs} +41 -41
- package/dist/{policies-JPIC5YDE.cjs → policies-S74WTNL4.cjs} +36 -36
- package/dist/{remote-session-VBVUMIUP.cjs → remote-session-BQMTIQTU.cjs} +17 -17
- package/dist/{scripts-BSYJJFBQ.cjs → scripts-G4QAT4NZ.cjs} +39 -39
- package/dist/{software-update-KVEYYORC.cjs → software-update-IYHJABLP.cjs} +36 -36
- package/dist/{tickets-board-YRZ54JJS.cjs → tickets-board-TRXOX77R.cjs} +17 -17
- package/dist/{video-file-player-4QMVTOBE.cjs → video-file-player-IAMWBKEQ.cjs} +14 -14
- package/package.json +1 -1
- package/src/components/chat/chat-message-enhanced.tsx +24 -1
- package/src/components/chat/embeddable-chat.tsx +61 -1
- package/src/components/chat/entity-cards/chat-card-disclosure.tsx +233 -0
- package/src/components/chat/entity-cards/dispatch.tsx +104 -63
- package/src/components/chat/entity-cards/index.ts +9 -0
- package/src/components/chat/index.ts +1 -0
- package/src/components/chat/inline-app-link-chip.tsx +79 -0
- package/src/components/chat/source-action-button.tsx +53 -2
- package/src/components/features/scripts/schedule-form/schedule-script-picker-card.tsx +4 -2
- package/src/components/features/select-button.tsx +1 -1
- package/src/components/platform/ScriptArguments.tsx +8 -1
- package/src/components/ui/button/button-styles.ts +18 -1
- package/src/components/ui/button/button.tsx +7 -4
- package/src/components/ui/button/split-button.tsx +3 -2
- package/src/components/ui/checkbox-block.tsx +3 -1
- package/src/components/ui/input-styles.ts +2 -0
- package/dist/case-study-card-3XLKCGLV.cjs +0 -23
|
@@ -64,8 +64,10 @@ import { ActionsMenuDropdown, type ActionsMenuItem } from '../ui/actions-menu';
|
|
|
64
64
|
import { Button } from '../ui/button';
|
|
65
65
|
import { Drawer, DrawerContent } from '../ui/drawer';
|
|
66
66
|
import { HoverDropdown, type HoverDropdownItem } from '../ui/hover-dropdown';
|
|
67
|
+
import { TextHold } from '../ui/layout-hold';
|
|
67
68
|
import { LoadingItems } from '../ui/loading-scope';
|
|
68
69
|
import { CollisionBoundaryContext, PortalContainerContext } from '../ui/portal-container';
|
|
70
|
+
import { SKELETON_SURFACE_CLASS } from '../ui/skeleton-surface';
|
|
69
71
|
import { SquareAvatar } from '../ui/square-avatar';
|
|
70
72
|
import { ChatAppearanceContext } from './chat-appearance-context';
|
|
71
73
|
import { ChatArchivePage } from './chat-archive-page';
|
|
@@ -705,6 +707,29 @@ function dispatchSlashCommandAction(
|
|
|
705
707
|
* 2. Ask: small `MessageSquare` icon-button on the right → fires
|
|
706
708
|
* `onDiscuss(ref)` to drill into THIS row via `entityIdFilter`.
|
|
707
709
|
*/
|
|
710
|
+
/** A no-break space: one line of the chip's text, so a bar that holds it is exactly one text line tall. */
|
|
711
|
+
const ONE_TEXT_LINE = '\u00a0';
|
|
712
|
+
|
|
713
|
+
/** How many chips the strip's loading form draws: the count real answers' strips showed (measured). On a phone,
|
|
714
|
+
* where a strip holds one chip a row, it draws one. */
|
|
715
|
+
const SOURCE_CHIP_SKELETON_COUNT = 2;
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* A source chip's loading form, built like the chip (`wrapChip` around `chipBody`): the chip's frame, its icon,
|
|
719
|
+
* its title as a bar one text line tall (so the chip is the loaded chip's height), and the Ask slot beside it.
|
|
720
|
+
*/
|
|
721
|
+
function SourceChipSkeleton({ className }: { className?: string }) {
|
|
722
|
+
return (
|
|
723
|
+
<span aria-hidden className={cn('pointer-events-none inline-flex shrink-0 items-center', className)}>
|
|
724
|
+
<span className={chatChipClass({ tone: 'secondary' })}>
|
|
725
|
+
<span className={cn(SKELETON_SURFACE_CLASS, 'inline-block h-3.5 w-3.5 rounded-sm')} />
|
|
726
|
+
<span className={cn(SKELETON_SURFACE_CLASS, 'w-28 rounded-sm')}>{ONE_TEXT_LINE}</span>
|
|
727
|
+
</span>
|
|
728
|
+
<span className={cn(SKELETON_SURFACE_CLASS, '-mr-1 ml-1 inline-block h-5 w-5 rounded-sm')} />
|
|
729
|
+
</span>
|
|
730
|
+
);
|
|
731
|
+
}
|
|
732
|
+
|
|
708
733
|
function SourceChip({
|
|
709
734
|
src,
|
|
710
735
|
baseRoute,
|
|
@@ -903,6 +928,7 @@ function SourceChips({
|
|
|
903
928
|
chipBasePlatform,
|
|
904
929
|
onClose,
|
|
905
930
|
onDiscuss,
|
|
931
|
+
loading,
|
|
906
932
|
}: {
|
|
907
933
|
cited: ChatSource[];
|
|
908
934
|
uncited: ChatSource[];
|
|
@@ -910,9 +936,29 @@ function SourceChips({
|
|
|
910
936
|
chipBasePlatform?: string;
|
|
911
937
|
onClose: () => void;
|
|
912
938
|
onDiscuss?: (ref: ChatRef) => void;
|
|
939
|
+
/** The answer is still being written: the strip's frame, heading and a row of chips in their loading form, so
|
|
940
|
+
* the strip does not appear under the answer when it finishes. */
|
|
941
|
+
loading?: boolean;
|
|
913
942
|
}) {
|
|
914
943
|
const [expanded, setExpanded] = useState(false);
|
|
915
944
|
|
|
945
|
+
if (loading) {
|
|
946
|
+
return (
|
|
947
|
+
<div aria-hidden className="mt-2 flex flex-col gap-1.5 border-t border-ods-border pt-2">
|
|
948
|
+
<span className="uppercase text-ods-text-muted text-h6">
|
|
949
|
+
<TextHold>Sources</TextHold>
|
|
950
|
+
</span>
|
|
951
|
+
{/* One row at every width: a chip that does not fit is cut, never wrapped (a strip's chips fit one row in
|
|
952
|
+
the answers measured, and a wrapped skeleton shrinks when the answer ends). */}
|
|
953
|
+
<div className="flex flex-nowrap gap-1.5 overflow-hidden">
|
|
954
|
+
{Array.from({ length: SOURCE_CHIP_SKELETON_COUNT }, (_, i) => (
|
|
955
|
+
<SourceChipSkeleton key={i} className={i > 0 ? 'max-md:hidden' : undefined} />
|
|
956
|
+
))}
|
|
957
|
+
</div>
|
|
958
|
+
</div>
|
|
959
|
+
);
|
|
960
|
+
}
|
|
961
|
+
|
|
916
962
|
if (cited.length === 0) {
|
|
917
963
|
const fallback = uncited.slice(0, FALLBACK_TOP_RETRIEVED);
|
|
918
964
|
if (fallback.length === 0) return null;
|
|
@@ -2062,7 +2108,21 @@ function EmbeddableChatInner({
|
|
|
2062
2108
|
// the THREAD, so testing it alone pulls the strips off every earlier
|
|
2063
2109
|
// answer too — a reader scrolled up watches finished citations blink out
|
|
2064
2110
|
// for the duration of an unrelated turn.
|
|
2065
|
-
|
|
2111
|
+
// Its strip is drawn in its loading form meanwhile, so the strip is already there when the answer ends.
|
|
2112
|
+
if (chatLoading && index === messages.length - 1) {
|
|
2113
|
+
return (
|
|
2114
|
+
<div className="pb-2">
|
|
2115
|
+
<SourceChips
|
|
2116
|
+
loading
|
|
2117
|
+
cited={[]}
|
|
2118
|
+
uncited={[]}
|
|
2119
|
+
baseRoute={resolvedBaseRoute}
|
|
2120
|
+
chipBasePlatform={chipBasePlatform}
|
|
2121
|
+
onClose={handleNavigationClose}
|
|
2122
|
+
/>
|
|
2123
|
+
</div>
|
|
2124
|
+
);
|
|
2125
|
+
}
|
|
2066
2126
|
const { cited, uncited } = splitCitedSources(message.sources, flattenAssistantContent(message.content));
|
|
2067
2127
|
if (cited.length === 0 && uncited.length === 0) return null;
|
|
2068
2128
|
return (
|
|
@@ -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 {
|
|
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
|
-
<
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
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: {
|
|
1596
|
-
|
|
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
|
-
|
|
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
|
-
<>
|
|
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)
|
|
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
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
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
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
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 (`
|
|
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
|
-
<
|
|
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,
|