@flamingo-stack/openframe-frontend-core 0.0.816 → 0.0.818
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 → case-study-card-IZBMHA6R.cjs} +3 -3
- package/dist/{chunk-VDXI26G7.cjs → chunk-4XASD2TL.cjs} +81 -78
- package/dist/{chunk-5TUR7O7H.cjs → chunk-5AIOYEXW.cjs} +90 -90
- package/dist/{chunk-RYJJHSHV.cjs → chunk-5VRSUEC5.cjs} +23 -23
- package/dist/{chunk-633NTKO2.cjs → chunk-6QT5K5I5.cjs} +31 -53
- package/dist/{chunk-CNTBGJA7.cjs → chunk-A34UNP5V.cjs} +65 -1
- package/dist/{chunk-3ELDGEM2.cjs → chunk-AE22KOW3.cjs} +87 -84
- package/dist/{chunk-EJCUAADF.cjs → chunk-BD42NMCT.cjs} +4 -4
- package/dist/{chunk-7NYWHEQM.cjs → chunk-DGAX5WG2.cjs} +15 -15
- package/dist/{chunk-L7W4455K.cjs → chunk-DL4HWYIB.cjs} +3 -3
- package/dist/chunk-DVHSYPDB.cjs +471 -0
- package/dist/{chunk-GAR2IIU6.cjs → chunk-IM366HS6.cjs} +105 -157
- package/dist/{chunk-7ERD34HQ.cjs → chunk-IQCHV7Z2.cjs} +571 -823
- package/dist/{chunk-3E4FIJAM.cjs → chunk-JTBJB4JF.cjs} +15 -15
- package/dist/{chunk-PAI4A3UM.cjs → chunk-K5IICQNF.cjs} +61 -54
- package/dist/{chunk-JOKOQOLJ.cjs → chunk-LUID2IB3.cjs} +2 -2
- package/dist/{chunk-JOOZTRXQ.cjs → chunk-NEXMK6OP.cjs} +4 -4
- package/dist/{chunk-4PMD3JUC.cjs → chunk-NPNZAAOB.cjs} +2 -2
- package/dist/{chunk-JH65CEO4.cjs → chunk-NWIEZUM7.cjs} +36 -36
- package/dist/{chunk-HM7VCQSX.cjs → chunk-SBFBNOKU.cjs} +4 -4
- package/dist/{chunk-7O7EX7HQ.cjs → chunk-T266OITJ.cjs} +28 -20
- package/dist/{chunk-SWBLTIN4.cjs → chunk-U2THWP25.cjs} +54 -52
- package/dist/{chunk-F4ZJRMMM.cjs → chunk-UDLDXVY4.cjs} +8 -8
- package/dist/{chunk-Y6MJMPHV.cjs → chunk-UEULXVW2.cjs} +32 -84
- package/dist/{chunk-O6VWD2SB.cjs → chunk-VGZXB3SY.cjs} +3 -3
- package/dist/{chunk-ZAWHRYJZ.cjs → chunk-VRXDTRIY.cjs} +45 -45
- package/dist/{chunk-EB7YAUER.cjs → chunk-YHPUD4PM.cjs} +19 -19
- package/dist/{chunk-FUEK43FL.cjs → chunk-YMPPE322.cjs} +206 -200
- package/dist/{chunk-IKB6AZPV.cjs → chunk-ZECG6GU5.cjs} +2 -2
- package/dist/{chunk-53JJLHJM.cjs → chunk-ZWAVMZIF.cjs} +20 -20
- package/dist/{cloud-tenants-SRTX2FZC.cjs → cloud-tenants-V6EV4OGK.cjs} +11 -11
- package/dist/components/announcement-bar.d.ts.map +1 -1
- package/dist/components/announcement-bar.js +5 -5
- package/dist/components/case-studies/index.cjs +26 -26
- package/dist/components/chat/chat-markdown-link.d.ts +15 -0
- package/dist/components/chat/chat-markdown-link.d.ts.map +1 -0
- package/dist/components/chat/chat-markdown-link.js +22 -0
- package/dist/components/chat/chat-message-enhanced.d.ts.map +1 -1
- package/dist/components/chat/chat-message-enhanced.js +3 -9
- package/dist/components/chat/embeddable-chat.d.ts +4 -8
- package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
- package/dist/components/chat/embeddable-chat.js +31 -125
- package/dist/components/chat/entity-cards/chat-card-disclosure.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/chat-card-disclosure.js +8 -11
- package/dist/components/chat/entity-cards/dispatch.d.ts +8 -15
- package/dist/components/chat/entity-cards/dispatch.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/dispatch.js +22 -40
- package/dist/components/chat/entity-cards/github-activity-card.d.ts +1 -1
- package/dist/components/chat/entity-cards/use-entity-card-link.d.ts +3 -2
- package/dist/components/chat/entity-cards/use-entity-card-link.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/use-entity-card-link.js +6 -4
- package/dist/components/chat/index.cjs +28 -21
- package/dist/components/chat/index.d.ts +2 -2
- package/dist/components/chat/index.d.ts.map +1 -1
- package/dist/components/chat/index.js +4 -3
- package/dist/components/chat/{inline-app-link-chip.d.ts → inline-chip.d.ts} +1 -14
- package/dist/components/chat/inline-chip.d.ts.map +1 -0
- package/dist/components/chat/inline-chip.js +27 -0
- package/dist/components/chat/nav-link-anchor-via-runtime.d.ts +45 -11
- package/dist/components/chat/nav-link-anchor-via-runtime.d.ts.map +1 -1
- package/dist/components/chat/nav-link-anchor-via-runtime.js +32 -24
- package/dist/components/chat/source-action-button.d.ts +12 -3
- package/dist/components/chat/source-action-button.d.ts.map +1 -1
- package/dist/components/chat/source-action-button.js +41 -26
- package/dist/components/chat/types/component.types.d.ts +1 -1
- package/dist/components/chat/types/entities/data-room-doc.d.ts +0 -12
- package/dist/components/chat/types/entities/data-room-doc.d.ts.map +1 -1
- package/dist/components/chat/types/message.types.d.ts +1 -1
- package/dist/components/chat/types/message.types.d.ts.map +1 -1
- package/dist/components/chat/utils/chat-nav-resolution.d.ts +1 -6
- package/dist/components/chat/utils/chat-nav-resolution.d.ts.map +1 -1
- package/dist/components/chat/utils/chat-nav-resolution.js +2 -3
- package/dist/components/chat/utils/decide-new-tab.d.ts +0 -3
- package/dist/components/chat/utils/decide-new-tab.d.ts.map +1 -1
- package/dist/components/chat/utils/decide-new-tab.js +0 -1
- package/dist/components/chat/utils/execute-navigation.d.ts +36 -34
- package/dist/components/chat/utils/execute-navigation.d.ts.map +1 -1
- package/dist/components/chat/utils/execute-navigation.js +23 -19
- package/dist/components/chat/utils/index.d.ts +5 -5
- package/dist/components/chat/utils/index.d.ts.map +1 -1
- package/dist/components/chat/utils/index.js +14 -6
- package/dist/components/chat/utils/nav-anchor-props.d.ts +35 -8
- package/dist/components/chat/utils/nav-anchor-props.d.ts.map +1 -1
- package/dist/components/chat/utils/nav-anchor-props.js +14 -5
- package/dist/components/chat/utils/new-tab-rel.d.ts +15 -0
- package/dist/components/chat/utils/new-tab-rel.d.ts.map +1 -0
- package/dist/components/chat/utils/new-tab-rel.js +25 -0
- package/dist/components/chat/utils/source-row-cta.d.ts +9 -48
- package/dist/components/chat/utils/source-row-cta.d.ts.map +1 -1
- package/dist/components/chat/utils/source-row-cta.js +7 -32
- package/dist/components/contact/index.cjs +12 -12
- package/dist/components/docs/index.cjs +15 -15
- package/dist/components/embeds/index.cjs +12 -12
- package/dist/components/faq/index.cjs +13 -13
- package/dist/components/features/devices/devices-table-columns.d.ts.map +1 -1
- package/dist/components/features/devices/devices-table-columns.js +4 -1
- package/dist/components/features/index.cjs +11 -11
- package/dist/components/help-center-pages/index.cjs +105 -105
- package/dist/components/index.cjs +91 -83
- package/dist/components/meeting-scheduler/index.cjs +50 -50
- package/dist/components/navigation/app-header.d.ts +1 -4
- package/dist/components/navigation/app-header.d.ts.map +1 -1
- package/dist/components/navigation/app-header.js +0 -2
- package/dist/components/navigation/index.cjs +14 -14
- package/dist/components/navigation/ticket-alerts-button.d.ts +1 -4
- package/dist/components/navigation/ticket-alerts-button.d.ts.map +1 -1
- package/dist/components/navigation/ticket-alerts-button.js +5 -5
- package/dist/components/onboarding-guides/index.cjs +14 -14
- package/dist/components/product-demo/index.cjs +20 -20
- package/dist/components/related-content/card-registry.d.ts +1 -1
- package/dist/components/related-content/index.cjs +7 -7
- package/dist/components/related-content/related-content-section.d.ts +3 -3
- package/dist/components/related-content/related-content-section.d.ts.map +1 -1
- package/dist/components/related-content/related-content-section.js +5 -3
- package/dist/components/shared/doc-search/resolve-search-result-action.d.ts +10 -3
- package/dist/components/shared/doc-search/resolve-search-result-action.d.ts.map +1 -1
- package/dist/components/shared/doc-search/resolve-search-result-action.js +8 -17
- package/dist/components/shared/doc-search/use-doc-search.d.ts.map +1 -1
- package/dist/components/shared/doc-search/use-doc-search.js +15 -27
- package/dist/components/shared/product-release/product-release-card.d.ts +2 -2
- package/dist/components/shared/product-release/product-releases-view.d.ts.map +1 -1
- package/dist/components/shared/product-release/product-releases-view.js +1 -3
- package/dist/components/tickets/index.cjs +18 -18
- package/dist/components/tickets/ticket-detail-drawer.d.ts.map +1 -1
- package/dist/components/tickets/ticket-detail-drawer.js +6 -3
- package/dist/components/tickets/types.d.ts +1 -1
- package/dist/components/ui/button/button.d.ts +1 -1
- package/dist/components/ui/hover-dropdown.d.ts +2 -2
- package/dist/components/ui/index.cjs +31 -23
- package/dist/components/ui/service-card.d.ts.map +1 -1
- package/dist/components/ui/service-card.js +4 -1
- package/dist/components/vendor-display-button.d.ts.map +1 -1
- package/dist/components/vendor-display-button.js +4 -1
- package/dist/contexts/chat-runtime-context.d.ts +14 -25
- package/dist/contexts/chat-runtime-context.d.ts.map +1 -1
- package/dist/{devices-DL4YU64N.cjs → devices-6KZAJAAS.cjs} +12 -12
- package/dist/{embeddable-chat-YRKMPFDY.cjs → embeddable-chat-5IHA5SUZ.cjs} +95 -193
- package/dist/hooks/index.cjs +5 -5
- package/dist/hooks/use-contact-submission.d.ts.map +1 -1
- package/dist/hooks/use-contact-submission.js +11 -8
- package/dist/index.cjs +40 -34
- package/dist/{knowledge-VQW5JL2Z.cjs → knowledge-I7FDQQYJ.cjs} +12 -12
- package/dist/{logs-IY3WBLMW.cjs → logs-Q7PAVJUG.cjs} +19 -19
- package/dist/{policies-IXWTWMJO.cjs → policies-C3DW5CHS.cjs} +15 -15
- package/dist/{scripts-D5CLO5EG.cjs → scripts-BET663HD.cjs} +16 -16
- package/dist/{software-update-ULNP6CKJ.cjs → software-update-W7ZQXEPK.cjs} +14 -14
- package/dist/utils/index.cjs +116 -89
- package/dist/utils/open-in-new-tab.d.ts +2 -1
- package/dist/utils/open-in-new-tab.d.ts.map +1 -1
- package/dist/utils/open-in-new-tab.js +2 -1
- package/dist/utils/scroll-into-view.d.ts +1 -1
- package/dist/utils/source-grouping.d.ts +2 -2
- package/eslint-config/base.js +11 -0
- package/eslint-config/navigation.js +142 -0
- package/package.json +1 -1
- package/src/components/announcement-bar.tsx +8 -6
- package/src/components/chat/chat-markdown-link.tsx +42 -0
- package/src/components/chat/chat-message-enhanced.tsx +10 -36
- package/src/components/chat/embeddable-chat.tsx +66 -173
- package/src/components/chat/entity-cards/chat-card-disclosure.tsx +9 -13
- package/src/components/chat/entity-cards/data-room-doc-card.tsx +1 -1
- package/src/components/chat/entity-cards/dispatch.tsx +51 -66
- package/src/components/chat/entity-cards/github-activity-card.tsx +1 -1
- package/src/components/chat/entity-cards/use-entity-card-link.ts +11 -16
- package/src/components/chat/index.ts +3 -1
- package/src/components/chat/{inline-app-link-chip.tsx → inline-chip.tsx} +1 -27
- package/src/components/chat/nav-link-anchor-via-runtime.tsx +73 -33
- package/src/components/chat/source-action-button.tsx +57 -33
- package/src/components/chat/types/component.types.ts +1 -1
- package/src/components/chat/types/entities/data-room-doc.ts +0 -12
- package/src/components/chat/types/message.types.ts +1 -1
- package/src/components/chat/utils/chat-nav-resolution.ts +3 -8
- package/src/components/chat/utils/decide-new-tab.ts +0 -3
- package/src/components/chat/utils/execute-navigation.ts +58 -58
- package/src/components/chat/utils/index.ts +13 -6
- package/src/components/chat/utils/nav-anchor-props.ts +56 -9
- package/src/components/chat/utils/new-tab-rel.ts +39 -0
- package/src/components/chat/utils/source-row-cta.ts +21 -102
- package/src/components/features/devices/devices-table-columns.tsx +4 -1
- package/src/components/navigation/app-header.tsx +0 -5
- package/src/components/navigation/ticket-alerts-button.tsx +7 -8
- package/src/components/related-content/card-registry.tsx +1 -1
- package/src/components/related-content/related-content-section.tsx +10 -10
- package/src/components/shared/doc-search/resolve-search-result-action.ts +19 -33
- package/src/components/shared/doc-search/use-doc-search.ts +21 -44
- package/src/components/shared/product-release/product-release-card.tsx +4 -4
- package/src/components/shared/product-release/product-releases-view.tsx +2 -5
- package/src/components/tickets/ticket-detail-drawer.tsx +7 -4
- package/src/components/tickets/types.ts +1 -1
- package/src/components/ui/button/button.tsx +2 -2
- package/src/components/ui/hover-dropdown.tsx +2 -2
- package/src/components/ui/service-card.tsx +4 -1
- package/src/components/vendor-display-button.tsx +5 -2
- package/src/contexts/chat-runtime-context.tsx +18 -23
- package/src/hooks/use-contact-submission.ts +13 -8
- package/src/utils/index.ts +1 -1
- package/src/utils/open-in-new-tab.ts +4 -2
- package/src/utils/scroll-into-view.ts +1 -1
- package/src/utils/source-grouping.ts +2 -2
- package/dist/chunk-RD66AGUI.cjs +0 -156
- package/dist/components/chat/inline-app-link-chip.d.ts.map +0 -1
- package/dist/components/chat/inline-app-link-chip.js +0 -37
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* EmbeddableChat — lib-portable port of the hub's `<GlobalAskAI>` component.
|
|
5
5
|
*
|
|
6
|
-
* Drops every hub-only import (auth-provider,
|
|
6
|
+
* Drops every hub-only import (auth-provider, useNavLinkViaRuntime, currentPlatform,
|
|
7
7
|
* tableIdForDocumentType, rag-table-config, etc.) and routes ALL navigation
|
|
8
8
|
* + identity decisions through `useRequiredChatRuntime()`. Host wires the
|
|
9
9
|
* runtime once at root (HubRuntimeProvider in the hub, custom provider in
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* - `useAuth()` → `useRequiredChatRuntime().user` (greeting + identity only;
|
|
14
14
|
* the requireAuth render gate is dropped — hub's wrapper handles it).
|
|
15
15
|
* - `currentPlatform()` → `useRequiredChatRuntime().source`.
|
|
16
|
-
* - `
|
|
17
|
-
* `
|
|
16
|
+
* - `useNavLinkViaRuntime`/`NavLinkAnchor` → chip-anchor rewrite via
|
|
17
|
+
* `executeNavigation` + lib's `NavLinkAnchorViaRuntime`.
|
|
18
18
|
* - `useDocChat(source)` → `useSseChatAdapter()` (reads source from runtime).
|
|
19
19
|
* - `tableIdForDocumentType` import deleted (dead per audit).
|
|
20
20
|
* - `renderChatInlineEntityCard` imported from lib's entity-cards barrel.
|
|
@@ -42,8 +42,6 @@ import { MessageSquare } from 'lucide-react';
|
|
|
42
42
|
import React, { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
43
43
|
import { chatProgressLabel } from '../../chat-protocol/progress';
|
|
44
44
|
import { useRequiredChatRuntime } from '../../contexts/chat-runtime-context';
|
|
45
|
-
import Link from '../../embed-shims/next-link';
|
|
46
|
-
import { useRouter } from '../../embed-shims/next-navigation';
|
|
47
45
|
import { useIsHydrated } from '../../hooks/ui/use-is-hydrated';
|
|
48
46
|
import { cn } from '../../utils/cn';
|
|
49
47
|
import { formatCitationIndices } from '../../utils/source-grouping';
|
|
@@ -65,7 +63,7 @@ import { Button } from '../ui/button';
|
|
|
65
63
|
import { Drawer, DrawerContent } from '../ui/drawer';
|
|
66
64
|
import { HoverDropdown, type HoverDropdownItem } from '../ui/hover-dropdown';
|
|
67
65
|
import { TextHold } from '../ui/layout-hold';
|
|
68
|
-
import { LoadingItems } from '../ui/loading-scope';
|
|
66
|
+
import { LoadingItems, loadingItemProps } from '../ui/loading-scope';
|
|
69
67
|
import { CollisionBoundaryContext, PortalContainerContext } from '../ui/portal-container';
|
|
70
68
|
import { SKELETON_SURFACE_CLASS } from '../ui/skeleton-surface';
|
|
71
69
|
import { SquareAvatar } from '../ui/square-avatar';
|
|
@@ -115,14 +113,11 @@ import type {
|
|
|
115
113
|
} from './types/unified-chat-state.types';
|
|
116
114
|
import { ASK_AI_OPEN_EVENT, ASK_AI_OPEN_WITH_REF_EVENT, chatListensForAskAiOpens } from './utils/ask-ai-events';
|
|
117
115
|
import { formatChatAttachmentMarkdownForBubble } from './utils/chat-attachment-markdown';
|
|
118
|
-
import { resolveHrefForRuntime } from './utils/chat-nav-resolution';
|
|
119
116
|
import { chatChipClass } from './utils/chip-styles';
|
|
120
117
|
import { FALLBACK_TOP_RETRIEVED, splitCitedSources } from './utils/cited-sources';
|
|
121
|
-
import { executeNavigation } from './utils/execute-navigation';
|
|
122
118
|
import { flattenAssistantContent } from './utils/flatten-assistant-content';
|
|
123
119
|
import { mapHostMessage, pruneTimestampCache } from './utils/host-message';
|
|
124
120
|
import { resolveIcon } from './utils/icon-library';
|
|
125
|
-
import { computeIsNewTab, newTabAnchorAttrs } from './utils/nav-anchor-props';
|
|
126
121
|
import { formatSingularLookupInvocation } from './utils/slash-dispatch-utils';
|
|
127
122
|
import { resolveSourceRowCTA, sourceRowCtxFromRuntime } from './utils/source-row-cta';
|
|
128
123
|
|
|
@@ -169,14 +164,10 @@ const drawerDefaultWidthWithoutRail = (viewportWidth: number) => drawerDefaultWi
|
|
|
169
164
|
// =============================================================================
|
|
170
165
|
|
|
171
166
|
export interface EmbeddableChatProps {
|
|
172
|
-
/**
|
|
173
|
-
*
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
* chips against, set this to a platform that does. Chips with
|
|
177
|
-
* `externalUrl: null` resolve to `getPlatformUrl(chipBasePlatform) +
|
|
178
|
-
* '/knowledge-base/' + path` and open in a new tab. */
|
|
179
|
-
chipBasePlatform?: string;
|
|
167
|
+
/** How many source chips the strip under an answer draws while the answer is written (default 1). `0` draws no
|
|
168
|
+
* strip until the answer ends: for a host whose answers rarely cite sources, where a strip that appears and then
|
|
169
|
+
* goes away would move the thread. */
|
|
170
|
+
sourceSkeletonCount?: number;
|
|
180
171
|
/** DB-driven list of enabled RAG table ids (chip catalog filter).
|
|
181
172
|
* Prefetched server-side by the embedder's wrapper. Empty/null → no
|
|
182
173
|
* empty-state chips render. */
|
|
@@ -716,17 +707,18 @@ function dispatchSlashCommandAction(
|
|
|
716
707
|
/** A no-break space: one line of the chip's text, so a bar that holds it is exactly one text line tall. */
|
|
717
708
|
const ONE_TEXT_LINE = '\u00a0';
|
|
718
709
|
|
|
719
|
-
/** How many chips the strip's loading form draws
|
|
720
|
-
*
|
|
721
|
-
|
|
710
|
+
/** How many chips the strip's loading form draws by default, at every width: one, the row a phone shows a strip's
|
|
711
|
+
* first chip in (a strip has no page size, so its loading form draws a typical count, and the strip is one row either
|
|
712
|
+
* way). An embedder sets its own with `sourceSkeletonCount`. */
|
|
713
|
+
const SOURCE_CHIP_SKELETON_COUNT = 1;
|
|
722
714
|
|
|
723
715
|
/**
|
|
724
716
|
* A source chip's loading form, built like the chip (`wrapChip` around `chipBody`): the chip's frame, its icon,
|
|
725
717
|
* its title as a bar one text line tall (so the chip is the loaded chip's height), and the Ask slot beside it.
|
|
726
718
|
*/
|
|
727
|
-
function SourceChipSkeleton(
|
|
719
|
+
function SourceChipSkeleton(props: { 'data-loading-item'?: boolean }) {
|
|
728
720
|
return (
|
|
729
|
-
<span aria-hidden className=
|
|
721
|
+
<span aria-hidden className="pointer-events-none inline-flex shrink-0 items-center" {...loadingItemProps(props)}>
|
|
730
722
|
<span className={chatChipClass({ tone: 'secondary' })}>
|
|
731
723
|
<span className={cn(SKELETON_SURFACE_CLASS, 'inline-block h-3.5 w-3.5 rounded-sm')} />
|
|
732
724
|
<span className={cn(SKELETON_SURFACE_CLASS, 'w-28 rounded-sm')}>{ONE_TEXT_LINE}</span>
|
|
@@ -736,21 +728,15 @@ function SourceChipSkeleton({ className }: { className?: string }) {
|
|
|
736
728
|
);
|
|
737
729
|
}
|
|
738
730
|
|
|
739
|
-
function SourceChip({
|
|
740
|
-
src,
|
|
741
|
-
baseRoute,
|
|
742
|
-
chipBasePlatform,
|
|
743
|
-
onClose,
|
|
744
|
-
onDiscuss,
|
|
745
|
-
}: {
|
|
731
|
+
function SourceChip(props: {
|
|
746
732
|
src: ChatSource;
|
|
747
|
-
baseRoute: string;
|
|
748
|
-
chipBasePlatform?: string;
|
|
749
|
-
onClose: () => void;
|
|
750
733
|
onDiscuss?: (ref: ChatRef) => void;
|
|
734
|
+
/** The strip's list-item marker, carried by the chip's frame like its loading form's. */
|
|
735
|
+
'data-loading-item'?: boolean;
|
|
751
736
|
}) {
|
|
737
|
+
const { src, onDiscuss } = props;
|
|
738
|
+
const marks = loadingItemProps(props);
|
|
752
739
|
const runtime = useRequiredChatRuntime();
|
|
753
|
-
const router = useRouter();
|
|
754
740
|
// Single CTA resolver — same icon, same href chain, same ChatRef
|
|
755
741
|
// synthesis the inline card and search-result paths use.
|
|
756
742
|
const cta = resolveSourceRowCTA(
|
|
@@ -763,17 +749,12 @@ function SourceChip({
|
|
|
763
749
|
targetPlatform: src.targetPlatform ?? null,
|
|
764
750
|
path: src.path,
|
|
765
751
|
},
|
|
766
|
-
sourceRowCtxFromRuntime(runtime
|
|
752
|
+
sourceRowCtxFromRuntime(runtime),
|
|
767
753
|
);
|
|
768
754
|
const Icon = cta.icon;
|
|
769
755
|
const icon = <Icon className="h-3.5 w-3.5" />;
|
|
770
756
|
const chipClass = chatChipClass({ tone: 'secondary' });
|
|
771
757
|
|
|
772
|
-
// Single source for the new-tab decision — same `computeIsNewTab` the
|
|
773
|
-
// inline cards consume via `ChatCardLoader`.
|
|
774
|
-
const decideTab = (href: string | null, targetPlatform: string | null) =>
|
|
775
|
-
computeIsNewTab(runtime, href, targetPlatform);
|
|
776
|
-
|
|
777
758
|
// Grouped source — hover/click reveals a dropdown with Open + Ask per row.
|
|
778
759
|
if (src.items && src.items.length > 0) {
|
|
779
760
|
const dropdownItems: HoverDropdownItem[] = src.items.map(item => {
|
|
@@ -787,7 +768,7 @@ function SourceChip({
|
|
|
787
768
|
targetPlatform: item.targetPlatform ?? null,
|
|
788
769
|
path: item.path,
|
|
789
770
|
},
|
|
790
|
-
sourceRowCtxFromRuntime(runtime
|
|
771
|
+
sourceRowCtxFromRuntime(runtime),
|
|
791
772
|
);
|
|
792
773
|
const ItemIcon = itemCta.icon;
|
|
793
774
|
// Read out of the CTA before the `onClick` closure below is built: a
|
|
@@ -820,26 +801,28 @@ function SourceChip({
|
|
|
820
801
|
const groupIndices = itemIndices.length > 0 ? formatCitationIndices(itemIndices) : `${src.index}`;
|
|
821
802
|
|
|
822
803
|
return (
|
|
823
|
-
<
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
{
|
|
838
|
-
|
|
839
|
-
[
|
|
804
|
+
<span className="inline-flex" {...marks}>
|
|
805
|
+
<HoverDropdown
|
|
806
|
+
items={dropdownItems}
|
|
807
|
+
renderAnchor={({ href, targetPlatform, path, className, children }) => (
|
|
808
|
+
<NavLinkAnchorViaRuntime
|
|
809
|
+
href={href}
|
|
810
|
+
targetPlatform={targetPlatform ?? null}
|
|
811
|
+
path={path}
|
|
812
|
+
className={className}
|
|
813
|
+
>
|
|
814
|
+
{children}
|
|
815
|
+
</NavLinkAnchorViaRuntime>
|
|
816
|
+
)}
|
|
817
|
+
>
|
|
818
|
+
<span className={`${chipClass} cursor-pointer`}>
|
|
819
|
+
{icon}
|
|
820
|
+
<span className="max-w-[160px] truncate">
|
|
821
|
+
[{groupIndices}] {src.name}
|
|
822
|
+
</span>
|
|
840
823
|
</span>
|
|
841
|
-
</
|
|
842
|
-
</
|
|
824
|
+
</HoverDropdown>
|
|
825
|
+
</span>
|
|
843
826
|
);
|
|
844
827
|
}
|
|
845
828
|
|
|
@@ -855,63 +838,26 @@ function SourceChip({
|
|
|
855
838
|
</>
|
|
856
839
|
);
|
|
857
840
|
const wrapChip = (clickable: React.ReactNode) => (
|
|
858
|
-
<span className="inline-flex items-center">
|
|
841
|
+
<span className="inline-flex items-center" {...marks}>
|
|
859
842
|
{clickable}
|
|
860
843
|
<SourceActionButton chatRef={cta.chatRef} onDiscuss={onDiscuss} density="inline" className="-mr-1 ml-1" />
|
|
861
844
|
</span>
|
|
862
845
|
);
|
|
863
846
|
|
|
864
|
-
//
|
|
865
|
-
// panel
|
|
866
|
-
// open so the user keeps their context while reading the new tab.
|
|
867
|
-
// Modifier-clicks pass through to the browser's native behavior.
|
|
868
|
-
// Single close model: matches `ChatCardNavWrap` for inline cards.
|
|
869
|
-
const buildClickHandler =
|
|
870
|
-
(href: string, path: string | null | undefined, targetPlatform: string | null, isNewTab: boolean) =>
|
|
871
|
-
(e: React.MouseEvent<HTMLAnchorElement>) => {
|
|
872
|
-
const handled = executeNavigation({
|
|
873
|
-
event: e,
|
|
874
|
-
runtime,
|
|
875
|
-
href,
|
|
876
|
-
path,
|
|
877
|
-
targetPlatform,
|
|
878
|
-
fallbackNavigate: router.push,
|
|
879
|
-
});
|
|
880
|
-
if (handled && !isNewTab && onClose) onClose();
|
|
881
|
-
};
|
|
882
|
-
|
|
883
|
-
// Entity chip with a resolved external URL. `resolveHrefForRuntime`
|
|
884
|
-
// applies embed-mode origin prefix so modifier-click / hover-preview
|
|
885
|
-
// / right-click "copy link" all land on the hub origin.
|
|
886
|
-
if (cta.href && !!src.externalUrl) {
|
|
887
|
-
const resolvedHref = resolveHrefForRuntime(cta.href, runtime);
|
|
888
|
-
const isNewTab = decideTab(resolvedHref, cta.targetPlatform ?? null);
|
|
889
|
-
return wrapChip(
|
|
890
|
-
<Link
|
|
891
|
-
href={resolvedHref}
|
|
892
|
-
{...newTabAnchorAttrs(isNewTab)}
|
|
893
|
-
onClick={buildClickHandler(resolvedHref, null, cta.targetPlatform ?? null, isNewTab)}
|
|
894
|
-
className={chipClass}
|
|
895
|
-
>
|
|
896
|
-
{chipBody(src.name)}
|
|
897
|
-
</Link>,
|
|
898
|
-
);
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
// In-app navigable doc (markdown / data-room PDF).
|
|
847
|
+
// A chip that opens something is THE chat link (`NavLinkAnchorViaRuntime`): the one navigation decision, the one
|
|
848
|
+
// click executor, and the panel closing on a same-tab navigation, exactly as markdown links and cards.
|
|
902
849
|
if (cta.href) {
|
|
903
|
-
const
|
|
904
|
-
const isNewTab = decideTab(resolvedHref, cta.targetPlatform ?? null);
|
|
850
|
+
const isEntity = !!src.externalUrl;
|
|
905
851
|
return wrapChip(
|
|
906
|
-
<
|
|
907
|
-
href={
|
|
908
|
-
{
|
|
909
|
-
|
|
852
|
+
<NavLinkAnchorViaRuntime
|
|
853
|
+
href={cta.href}
|
|
854
|
+
path={isEntity ? null : src.path}
|
|
855
|
+
targetPlatform={cta.targetPlatform ?? null}
|
|
910
856
|
className={chipClass}
|
|
911
|
-
title={displayName}
|
|
857
|
+
title={isEntity ? undefined : displayName}
|
|
912
858
|
>
|
|
913
|
-
{chipBody(displayName)}
|
|
914
|
-
</
|
|
859
|
+
{chipBody(isEntity ? src.name : displayName)}
|
|
860
|
+
</NavLinkAnchorViaRuntime>,
|
|
915
861
|
);
|
|
916
862
|
}
|
|
917
863
|
|
|
@@ -930,21 +876,18 @@ function SourceChip({
|
|
|
930
876
|
function SourceChips({
|
|
931
877
|
cited,
|
|
932
878
|
uncited,
|
|
933
|
-
baseRoute,
|
|
934
|
-
chipBasePlatform,
|
|
935
|
-
onClose,
|
|
936
879
|
onDiscuss,
|
|
937
880
|
loading,
|
|
881
|
+
skeletonCount,
|
|
938
882
|
}: {
|
|
939
883
|
cited: ChatSource[];
|
|
940
884
|
uncited: ChatSource[];
|
|
941
|
-
baseRoute: string;
|
|
942
|
-
chipBasePlatform?: string;
|
|
943
|
-
onClose: () => void;
|
|
944
885
|
onDiscuss?: (ref: ChatRef) => void;
|
|
945
886
|
/** The answer is still being written: the strip's frame, heading and a row of chips in their loading form, so
|
|
946
887
|
* the strip does not appear under the answer when it finishes. */
|
|
947
888
|
loading?: boolean;
|
|
889
|
+
/** How many chips the loading form draws (`EmbeddableChatProps.sourceSkeletonCount`). */
|
|
890
|
+
skeletonCount: number;
|
|
948
891
|
}) {
|
|
949
892
|
const [expanded, setExpanded] = useState(false);
|
|
950
893
|
|
|
@@ -957,9 +900,7 @@ function SourceChips({
|
|
|
957
900
|
{/* One row at every width: a chip that does not fit is cut, never wrapped (a strip's chips fit one row in
|
|
958
901
|
the answers measured, and a wrapped skeleton shrinks when the answer ends). */}
|
|
959
902
|
<div className="flex flex-nowrap gap-1.5 overflow-hidden">
|
|
960
|
-
{
|
|
961
|
-
<SourceChipSkeleton key={i} className={i > 0 ? 'max-md:hidden' : undefined} />
|
|
962
|
-
))}
|
|
903
|
+
<LoadingItems count={skeletonCount}>{() => <SourceChipSkeleton data-loading-item />}</LoadingItems>
|
|
963
904
|
</div>
|
|
964
905
|
</div>
|
|
965
906
|
);
|
|
@@ -973,14 +914,7 @@ function SourceChips({
|
|
|
973
914
|
<span className="uppercase text-ods-text-muted text-h6">Top retrieved sources</span>
|
|
974
915
|
<div className="flex flex-wrap gap-1.5">
|
|
975
916
|
{fallback.map(src => (
|
|
976
|
-
<SourceChip
|
|
977
|
-
key={src.index}
|
|
978
|
-
src={src}
|
|
979
|
-
baseRoute={baseRoute}
|
|
980
|
-
chipBasePlatform={chipBasePlatform}
|
|
981
|
-
onClose={onClose}
|
|
982
|
-
onDiscuss={onDiscuss}
|
|
983
|
-
/>
|
|
917
|
+
<SourceChip data-loading-item key={src.index} src={src} onDiscuss={onDiscuss} />
|
|
984
918
|
))}
|
|
985
919
|
</div>
|
|
986
920
|
</div>
|
|
@@ -995,26 +929,10 @@ function SourceChips({
|
|
|
995
929
|
<span className="uppercase text-ods-text-muted text-h6">Sources</span>
|
|
996
930
|
<div className={`flex flex-wrap gap-1.5 ${expanded ? 'max-h-[200px] overflow-y-auto overscroll-contain' : ''}`}>
|
|
997
931
|
{cited.map(src => (
|
|
998
|
-
<SourceChip
|
|
999
|
-
key={src.index}
|
|
1000
|
-
src={src}
|
|
1001
|
-
baseRoute={baseRoute}
|
|
1002
|
-
chipBasePlatform={chipBasePlatform}
|
|
1003
|
-
onClose={onClose}
|
|
1004
|
-
onDiscuss={onDiscuss}
|
|
1005
|
-
/>
|
|
932
|
+
<SourceChip data-loading-item key={src.index} src={src} onDiscuss={onDiscuss} />
|
|
1006
933
|
))}
|
|
1007
934
|
{expanded &&
|
|
1008
|
-
uncited.map(src =>
|
|
1009
|
-
<SourceChip
|
|
1010
|
-
key={src.index}
|
|
1011
|
-
src={src}
|
|
1012
|
-
baseRoute={baseRoute}
|
|
1013
|
-
chipBasePlatform={chipBasePlatform}
|
|
1014
|
-
onClose={onClose}
|
|
1015
|
-
onDiscuss={onDiscuss}
|
|
1016
|
-
/>
|
|
1017
|
-
))}
|
|
935
|
+
uncited.map(src => <SourceChip data-loading-item key={src.index} src={src} onDiscuss={onDiscuss} />)}
|
|
1018
936
|
{hasOverflow && (
|
|
1019
937
|
<Button
|
|
1020
938
|
variant="link"
|
|
@@ -1082,8 +1000,7 @@ export const EmbeddableChat = React.forwardRef<EmbeddableChatHandle, EmbeddableC
|
|
|
1082
1000
|
EmbeddableChat.displayName = 'EmbeddableChat';
|
|
1083
1001
|
|
|
1084
1002
|
function EmbeddableChatInner({
|
|
1085
|
-
|
|
1086
|
-
chipBasePlatform,
|
|
1003
|
+
sourceSkeletonCount = SOURCE_CHIP_SKELETON_COUNT,
|
|
1087
1004
|
enabledRagTableIds = null,
|
|
1088
1005
|
emptyStateGreeting = null,
|
|
1089
1006
|
suggestedQueries = null,
|
|
@@ -1662,15 +1579,6 @@ function EmbeddableChatInner({
|
|
|
1662
1579
|
// forwards it verbatim to the message list and calls it from the `mention://`
|
|
1663
1580
|
// override; the host returns a self-fetching chip.
|
|
1664
1581
|
|
|
1665
|
-
// Resolve base route. Hub default mapping: flamingo → /knowledge-base,
|
|
1666
|
-
// anything else → /data-room. Embedders override per platform. An embedder that
|
|
1667
|
-
// doesn't host an in-app doc viewer should NOT pass an empty baseRoute (that just
|
|
1668
|
-
// falls back to the platform default here) — instead it sets a truthy baseRoute +
|
|
1669
|
-
// `chipBasePlatform` so doc chips with no externalUrl resolve cross-platform to that
|
|
1670
|
-
// platform's public knowledge hub (`getPlatformUrl(chipBasePlatform)/knowledge-base/…`),
|
|
1671
|
-
// exactly like the hub's openframe config (baseRoute:'/', chipBasePlatform:'openframe').
|
|
1672
|
-
const resolvedBaseRoute = baseRoute || (source === 'flamingo' ? '/knowledge-base' : '/data-room');
|
|
1673
|
-
|
|
1674
1582
|
const handleClose = useCallback(() => setIsOpen(false), [setIsOpen]);
|
|
1675
1583
|
// What the header close controls call; absent on a panel that cannot close.
|
|
1676
1584
|
const closeControl = closable ? handleClose : undefined;
|
|
@@ -1714,11 +1622,9 @@ function EmbeddableChatInner({
|
|
|
1714
1622
|
renderChatInlineEntityCard(reference, {
|
|
1715
1623
|
onDiscuss: askAbout,
|
|
1716
1624
|
onDisplay: displayRef,
|
|
1717
|
-
baseRoute: resolvedBaseRoute,
|
|
1718
|
-
chipBasePlatform,
|
|
1719
1625
|
extras,
|
|
1720
1626
|
}),
|
|
1721
|
-
[askAbout, displayRef,
|
|
1627
|
+
[askAbout, displayRef, extras],
|
|
1722
1628
|
);
|
|
1723
1629
|
|
|
1724
1630
|
// Stable assistant-icon element. `<ChatMessageList>` forwards this prop to
|
|
@@ -2116,16 +2022,10 @@ function EmbeddableChatInner({
|
|
|
2116
2022
|
// for the duration of an unrelated turn.
|
|
2117
2023
|
// Its strip is drawn in its loading form meanwhile, so the strip is already there when the answer ends.
|
|
2118
2024
|
if (chatLoading && index === messages.length - 1) {
|
|
2025
|
+
if (sourceSkeletonCount <= 0) return null;
|
|
2119
2026
|
return (
|
|
2120
2027
|
<div className="pb-2">
|
|
2121
|
-
<SourceChips
|
|
2122
|
-
loading
|
|
2123
|
-
cited={[]}
|
|
2124
|
-
uncited={[]}
|
|
2125
|
-
baseRoute={resolvedBaseRoute}
|
|
2126
|
-
chipBasePlatform={chipBasePlatform}
|
|
2127
|
-
onClose={handleNavigationClose}
|
|
2128
|
-
/>
|
|
2028
|
+
<SourceChips loading skeletonCount={sourceSkeletonCount} cited={[]} uncited={[]} />
|
|
2129
2029
|
</div>
|
|
2130
2030
|
);
|
|
2131
2031
|
}
|
|
@@ -2133,18 +2033,11 @@ function EmbeddableChatInner({
|
|
|
2133
2033
|
if (cited.length === 0 && uncited.length === 0) return null;
|
|
2134
2034
|
return (
|
|
2135
2035
|
<div className="pb-2">
|
|
2136
|
-
<SourceChips
|
|
2137
|
-
cited={cited}
|
|
2138
|
-
uncited={uncited}
|
|
2139
|
-
baseRoute={resolvedBaseRoute}
|
|
2140
|
-
chipBasePlatform={chipBasePlatform}
|
|
2141
|
-
onClose={handleNavigationClose}
|
|
2142
|
-
onDiscuss={askAbout}
|
|
2143
|
-
/>
|
|
2036
|
+
<SourceChips cited={cited} uncited={uncited} onDiscuss={askAbout} skeletonCount={sourceSkeletonCount} />
|
|
2144
2037
|
</div>
|
|
2145
2038
|
);
|
|
2146
2039
|
},
|
|
2147
|
-
[chatLoading, messages.length,
|
|
2040
|
+
[chatLoading, messages.length, askAbout, sourceSkeletonCount],
|
|
2148
2041
|
);
|
|
2149
2042
|
|
|
2150
2043
|
// Host node for in-panel Radix portals (see the body wrapper below).
|
|
@@ -28,11 +28,10 @@
|
|
|
28
28
|
import type React from 'react';
|
|
29
29
|
import { type ReactNode, useState } from 'react';
|
|
30
30
|
import { PlayIcon } from '../../icons-v2-generated/media-playback/play-icon';
|
|
31
|
-
import { Button } from '../../ui/button';
|
|
32
31
|
import type { ChatRef } from '../chat-ref.types';
|
|
33
32
|
import { ExpandChevron } from '../expand-chevron';
|
|
34
33
|
import { useCollapsible } from '../hooks/use-collapsible';
|
|
35
|
-
import { CARD_FOOTER_ACTION_CLASS,
|
|
34
|
+
import { CARD_FOOTER_ACTION_CLASS, FooterAction } from '../source-action-button';
|
|
36
35
|
import { ChatVideoEntityCard } from './chat-video-entity-card';
|
|
37
36
|
|
|
38
37
|
/** The kinds of content a chat card can open below itself. */
|
|
@@ -142,27 +141,24 @@ export function ChatCardDisclosureButton({
|
|
|
142
141
|
loading?: boolean;
|
|
143
142
|
}): React.ReactElement {
|
|
144
143
|
const spec = CHAT_CARD_DISCLOSURES[kind];
|
|
145
|
-
if (loading) return <FooterActionSkeleton label={spec.label} className={CARD_FOOTER_ACTION_CLASS} />;
|
|
146
144
|
const label = open ? spec.openLabel : spec.label;
|
|
147
145
|
const Icon = spec.icon;
|
|
148
146
|
return (
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
rightIcon={<ExpandChevron expanded={open} className="!h-3 !w-3" />}
|
|
147
|
+
<FooterAction
|
|
148
|
+
label={label}
|
|
149
|
+
icon={<Icon className="!h-3 !w-3" />}
|
|
150
|
+
trailingIcon={<ExpandChevron expanded={open} className="!h-3 !w-3" />}
|
|
154
151
|
onClick={(e: React.MouseEvent) => {
|
|
155
152
|
// The card around it is a link: the action must not follow it.
|
|
156
153
|
e.preventDefault();
|
|
157
154
|
e.stopPropagation();
|
|
158
155
|
onToggle?.();
|
|
159
156
|
}}
|
|
160
|
-
|
|
161
|
-
|
|
157
|
+
ariaExpanded={open}
|
|
158
|
+
ariaLabel={title ? `${label}: ${title}` : label}
|
|
162
159
|
className={CARD_FOOTER_ACTION_CLASS}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
</Button>
|
|
160
|
+
loading={loading}
|
|
161
|
+
/>
|
|
166
162
|
);
|
|
167
163
|
}
|
|
168
164
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Renders `[card://data_room_doc:<id>]` and `[card://markdown:<id>]` markers
|
|
12
12
|
* — both use this card because their viewer surface is structurally
|
|
13
|
-
* identical;
|
|
13
|
+
* identical; where each one's viewer lives is the host composer's decision.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import { ExternalLink } from 'lucide-react';
|