@flamingo-stack/openframe-frontend-core 0.0.816 → 0.0.817
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-7ERD34HQ.cjs → chunk-24M2JYM5.cjs} +566 -774
- package/dist/{chunk-3E4FIJAM.cjs → chunk-4ROR52OW.cjs} +15 -15
- package/dist/{chunk-SWBLTIN4.cjs → chunk-5TSYOIIZ.cjs} +54 -52
- package/dist/{chunk-JH65CEO4.cjs → chunk-6F4YGHGM.cjs} +36 -36
- package/dist/{chunk-VDXI26G7.cjs → chunk-7KBHLP4E.cjs} +81 -78
- package/dist/{chunk-CNTBGJA7.cjs → chunk-A34UNP5V.cjs} +65 -1
- package/dist/{chunk-633NTKO2.cjs → chunk-BL2J5RJK.cjs} +31 -53
- package/dist/{chunk-7NYWHEQM.cjs → chunk-C2OUXL3Q.cjs} +15 -15
- package/dist/{chunk-53JJLHJM.cjs → chunk-DSBRWP5M.cjs} +20 -20
- package/dist/chunk-DVHSYPDB.cjs +471 -0
- package/dist/{chunk-5TUR7O7H.cjs → chunk-EX7M3VQC.cjs} +90 -90
- package/dist/{chunk-EJCUAADF.cjs → chunk-F2LVBRHC.cjs} +4 -4
- package/dist/{chunk-GAR2IIU6.cjs → chunk-IM366HS6.cjs} +105 -157
- package/dist/{chunk-FUEK43FL.cjs → chunk-IOFIHVVW.cjs} +206 -200
- package/dist/{chunk-JOOZTRXQ.cjs → chunk-JMOCM2SW.cjs} +4 -4
- package/dist/{chunk-PAI4A3UM.cjs → chunk-K5IICQNF.cjs} +61 -54
- package/dist/{chunk-JOKOQOLJ.cjs → chunk-LUID2IB3.cjs} +2 -2
- package/dist/{chunk-L7W4455K.cjs → chunk-MAHJY2PO.cjs} +3 -3
- package/dist/{chunk-4PMD3JUC.cjs → chunk-NPNZAAOB.cjs} +2 -2
- package/dist/{chunk-EB7YAUER.cjs → chunk-P7JQGOX4.cjs} +19 -19
- package/dist/{chunk-O6VWD2SB.cjs → chunk-RDHF3F5R.cjs} +3 -3
- package/dist/{chunk-HM7VCQSX.cjs → chunk-SBFBNOKU.cjs} +4 -4
- package/dist/{chunk-7O7EX7HQ.cjs → chunk-T266OITJ.cjs} +28 -20
- package/dist/{chunk-ZAWHRYJZ.cjs → chunk-TKEYWSDZ.cjs} +45 -45
- package/dist/{chunk-F4ZJRMMM.cjs → chunk-UDLDXVY4.cjs} +8 -8
- package/dist/{chunk-Y6MJMPHV.cjs → chunk-UEULXVW2.cjs} +32 -84
- package/dist/{chunk-RYJJHSHV.cjs → chunk-UFBVOBYR.cjs} +23 -23
- package/dist/{chunk-IKB6AZPV.cjs → chunk-ZECG6GU5.cjs} +2 -2
- package/dist/{chunk-3ELDGEM2.cjs → chunk-ZP4JMX7G.cjs} +87 -84
- package/dist/{cloud-tenants-SRTX2FZC.cjs → cloud-tenants-NMAXIJLL.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 -0
- package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
- package/dist/components/chat/embeddable-chat.js +30 -67
- 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 +5 -5
- package/dist/components/chat/entity-cards/dispatch.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/dispatch.js +18 -17
- 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/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/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 +11 -11
- package/dist/contexts/chat-runtime-context.d.ts.map +1 -1
- package/dist/{devices-DL4YU64N.cjs → devices-QBKWVHE6.cjs} +12 -12
- package/dist/{embeddable-chat-YRKMPFDY.cjs → embeddable-chat-WNPCPMDL.cjs} +96 -137
- 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-FSAYWM25.cjs} +12 -12
- package/dist/{logs-IY3WBLMW.cjs → logs-OZX4SYHG.cjs} +19 -19
- package/dist/{policies-IXWTWMJO.cjs → policies-LPCUCTLX.cjs} +15 -15
- package/dist/{scripts-D5CLO5EG.cjs → scripts-ZNFZSONW.cjs} +16 -16
- package/dist/{software-update-ULNP6CKJ.cjs → software-update-BRYOVQVY.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/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 +63 -106
- package/src/components/chat/entity-cards/chat-card-disclosure.tsx +9 -13
- package/src/components/chat/entity-cards/dispatch.tsx +45 -35
- 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/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/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 +15 -12
- 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/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
|
|
|
@@ -177,6 +172,10 @@ export interface EmbeddableChatProps {
|
|
|
177
172
|
* `externalUrl: null` resolve to `getPlatformUrl(chipBasePlatform) +
|
|
178
173
|
* '/knowledge-base/' + path` and open in a new tab. */
|
|
179
174
|
chipBasePlatform?: string;
|
|
175
|
+
/** How many source chips the strip under an answer draws while the answer is written (default 1). `0` draws no
|
|
176
|
+
* strip until the answer ends: for a host whose answers rarely cite sources, where a strip that appears and then
|
|
177
|
+
* goes away would move the thread. */
|
|
178
|
+
sourceSkeletonCount?: number;
|
|
180
179
|
/** DB-driven list of enabled RAG table ids (chip catalog filter).
|
|
181
180
|
* Prefetched server-side by the embedder's wrapper. Empty/null → no
|
|
182
181
|
* empty-state chips render. */
|
|
@@ -716,17 +715,18 @@ function dispatchSlashCommandAction(
|
|
|
716
715
|
/** A no-break space: one line of the chip's text, so a bar that holds it is exactly one text line tall. */
|
|
717
716
|
const ONE_TEXT_LINE = '\u00a0';
|
|
718
717
|
|
|
719
|
-
/** How many chips the strip's loading form draws
|
|
720
|
-
*
|
|
721
|
-
|
|
718
|
+
/** How many chips the strip's loading form draws by default, at every width: one, the row a phone shows a strip's
|
|
719
|
+
* first chip in (a strip has no page size, so its loading form draws a typical count, and the strip is one row either
|
|
720
|
+
* way). An embedder sets its own with `sourceSkeletonCount`. */
|
|
721
|
+
const SOURCE_CHIP_SKELETON_COUNT = 1;
|
|
722
722
|
|
|
723
723
|
/**
|
|
724
724
|
* A source chip's loading form, built like the chip (`wrapChip` around `chipBody`): the chip's frame, its icon,
|
|
725
725
|
* 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
726
|
*/
|
|
727
|
-
function SourceChipSkeleton(
|
|
727
|
+
function SourceChipSkeleton(props: { 'data-loading-item'?: boolean }) {
|
|
728
728
|
return (
|
|
729
|
-
<span aria-hidden className=
|
|
729
|
+
<span aria-hidden className="pointer-events-none inline-flex shrink-0 items-center" {...loadingItemProps(props)}>
|
|
730
730
|
<span className={chatChipClass({ tone: 'secondary' })}>
|
|
731
731
|
<span className={cn(SKELETON_SURFACE_CLASS, 'inline-block h-3.5 w-3.5 rounded-sm')} />
|
|
732
732
|
<span className={cn(SKELETON_SURFACE_CLASS, 'w-28 rounded-sm')}>{ONE_TEXT_LINE}</span>
|
|
@@ -736,21 +736,17 @@ function SourceChipSkeleton({ className }: { className?: string }) {
|
|
|
736
736
|
);
|
|
737
737
|
}
|
|
738
738
|
|
|
739
|
-
function SourceChip({
|
|
740
|
-
src,
|
|
741
|
-
baseRoute,
|
|
742
|
-
chipBasePlatform,
|
|
743
|
-
onClose,
|
|
744
|
-
onDiscuss,
|
|
745
|
-
}: {
|
|
739
|
+
function SourceChip(props: {
|
|
746
740
|
src: ChatSource;
|
|
747
741
|
baseRoute: string;
|
|
748
742
|
chipBasePlatform?: string;
|
|
749
|
-
onClose: () => void;
|
|
750
743
|
onDiscuss?: (ref: ChatRef) => void;
|
|
744
|
+
/** The strip's list-item marker, carried by the chip's frame like its loading form's. */
|
|
745
|
+
'data-loading-item'?: boolean;
|
|
751
746
|
}) {
|
|
747
|
+
const { src, baseRoute, chipBasePlatform, onDiscuss } = props;
|
|
748
|
+
const marks = loadingItemProps(props);
|
|
752
749
|
const runtime = useRequiredChatRuntime();
|
|
753
|
-
const router = useRouter();
|
|
754
750
|
// Single CTA resolver — same icon, same href chain, same ChatRef
|
|
755
751
|
// synthesis the inline card and search-result paths use.
|
|
756
752
|
const cta = resolveSourceRowCTA(
|
|
@@ -769,11 +765,6 @@ function SourceChip({
|
|
|
769
765
|
const icon = <Icon className="h-3.5 w-3.5" />;
|
|
770
766
|
const chipClass = chatChipClass({ tone: 'secondary' });
|
|
771
767
|
|
|
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
768
|
// Grouped source — hover/click reveals a dropdown with Open + Ask per row.
|
|
778
769
|
if (src.items && src.items.length > 0) {
|
|
779
770
|
const dropdownItems: HoverDropdownItem[] = src.items.map(item => {
|
|
@@ -820,26 +811,28 @@ function SourceChip({
|
|
|
820
811
|
const groupIndices = itemIndices.length > 0 ? formatCitationIndices(itemIndices) : `${src.index}`;
|
|
821
812
|
|
|
822
813
|
return (
|
|
823
|
-
<
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
{
|
|
838
|
-
|
|
839
|
-
[
|
|
814
|
+
<span className="inline-flex" {...marks}>
|
|
815
|
+
<HoverDropdown
|
|
816
|
+
items={dropdownItems}
|
|
817
|
+
renderAnchor={({ href, targetPlatform, path, className, children }) => (
|
|
818
|
+
<NavLinkAnchorViaRuntime
|
|
819
|
+
href={href}
|
|
820
|
+
targetPlatform={targetPlatform ?? null}
|
|
821
|
+
path={path}
|
|
822
|
+
className={className}
|
|
823
|
+
>
|
|
824
|
+
{children}
|
|
825
|
+
</NavLinkAnchorViaRuntime>
|
|
826
|
+
)}
|
|
827
|
+
>
|
|
828
|
+
<span className={`${chipClass} cursor-pointer`}>
|
|
829
|
+
{icon}
|
|
830
|
+
<span className="max-w-[160px] truncate">
|
|
831
|
+
[{groupIndices}] {src.name}
|
|
832
|
+
</span>
|
|
840
833
|
</span>
|
|
841
|
-
</
|
|
842
|
-
</
|
|
834
|
+
</HoverDropdown>
|
|
835
|
+
</span>
|
|
843
836
|
);
|
|
844
837
|
}
|
|
845
838
|
|
|
@@ -855,63 +848,26 @@ function SourceChip({
|
|
|
855
848
|
</>
|
|
856
849
|
);
|
|
857
850
|
const wrapChip = (clickable: React.ReactNode) => (
|
|
858
|
-
<span className="inline-flex items-center">
|
|
851
|
+
<span className="inline-flex items-center" {...marks}>
|
|
859
852
|
{clickable}
|
|
860
853
|
<SourceActionButton chatRef={cta.chatRef} onDiscuss={onDiscuss} density="inline" className="-mr-1 ml-1" />
|
|
861
854
|
</span>
|
|
862
855
|
);
|
|
863
856
|
|
|
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).
|
|
857
|
+
// A chip that opens something is THE chat link (`NavLinkAnchorViaRuntime`): the one navigation decision, the one
|
|
858
|
+
// click executor, and the panel closing on a same-tab navigation, exactly as markdown links and cards.
|
|
902
859
|
if (cta.href) {
|
|
903
|
-
const
|
|
904
|
-
const isNewTab = decideTab(resolvedHref, cta.targetPlatform ?? null);
|
|
860
|
+
const isEntity = !!src.externalUrl;
|
|
905
861
|
return wrapChip(
|
|
906
|
-
<
|
|
907
|
-
href={
|
|
908
|
-
{
|
|
909
|
-
|
|
862
|
+
<NavLinkAnchorViaRuntime
|
|
863
|
+
href={cta.href}
|
|
864
|
+
path={isEntity ? null : src.path}
|
|
865
|
+
targetPlatform={cta.targetPlatform ?? null}
|
|
910
866
|
className={chipClass}
|
|
911
|
-
title={displayName}
|
|
867
|
+
title={isEntity ? undefined : displayName}
|
|
912
868
|
>
|
|
913
|
-
{chipBody(displayName)}
|
|
914
|
-
</
|
|
869
|
+
{chipBody(isEntity ? src.name : displayName)}
|
|
870
|
+
</NavLinkAnchorViaRuntime>,
|
|
915
871
|
);
|
|
916
872
|
}
|
|
917
873
|
|
|
@@ -932,19 +888,20 @@ function SourceChips({
|
|
|
932
888
|
uncited,
|
|
933
889
|
baseRoute,
|
|
934
890
|
chipBasePlatform,
|
|
935
|
-
onClose,
|
|
936
891
|
onDiscuss,
|
|
937
892
|
loading,
|
|
893
|
+
skeletonCount,
|
|
938
894
|
}: {
|
|
939
895
|
cited: ChatSource[];
|
|
940
896
|
uncited: ChatSource[];
|
|
941
897
|
baseRoute: string;
|
|
942
898
|
chipBasePlatform?: string;
|
|
943
|
-
onClose: () => void;
|
|
944
899
|
onDiscuss?: (ref: ChatRef) => void;
|
|
945
900
|
/** The answer is still being written: the strip's frame, heading and a row of chips in their loading form, so
|
|
946
901
|
* the strip does not appear under the answer when it finishes. */
|
|
947
902
|
loading?: boolean;
|
|
903
|
+
/** How many chips the loading form draws (`EmbeddableChatProps.sourceSkeletonCount`). */
|
|
904
|
+
skeletonCount: number;
|
|
948
905
|
}) {
|
|
949
906
|
const [expanded, setExpanded] = useState(false);
|
|
950
907
|
|
|
@@ -957,9 +914,7 @@ function SourceChips({
|
|
|
957
914
|
{/* One row at every width: a chip that does not fit is cut, never wrapped (a strip's chips fit one row in
|
|
958
915
|
the answers measured, and a wrapped skeleton shrinks when the answer ends). */}
|
|
959
916
|
<div className="flex flex-nowrap gap-1.5 overflow-hidden">
|
|
960
|
-
{
|
|
961
|
-
<SourceChipSkeleton key={i} className={i > 0 ? 'max-md:hidden' : undefined} />
|
|
962
|
-
))}
|
|
917
|
+
<LoadingItems count={skeletonCount}>{() => <SourceChipSkeleton data-loading-item />}</LoadingItems>
|
|
963
918
|
</div>
|
|
964
919
|
</div>
|
|
965
920
|
);
|
|
@@ -974,11 +929,11 @@ function SourceChips({
|
|
|
974
929
|
<div className="flex flex-wrap gap-1.5">
|
|
975
930
|
{fallback.map(src => (
|
|
976
931
|
<SourceChip
|
|
932
|
+
data-loading-item
|
|
977
933
|
key={src.index}
|
|
978
934
|
src={src}
|
|
979
935
|
baseRoute={baseRoute}
|
|
980
936
|
chipBasePlatform={chipBasePlatform}
|
|
981
|
-
onClose={onClose}
|
|
982
937
|
onDiscuss={onDiscuss}
|
|
983
938
|
/>
|
|
984
939
|
))}
|
|
@@ -996,22 +951,22 @@ function SourceChips({
|
|
|
996
951
|
<div className={`flex flex-wrap gap-1.5 ${expanded ? 'max-h-[200px] overflow-y-auto overscroll-contain' : ''}`}>
|
|
997
952
|
{cited.map(src => (
|
|
998
953
|
<SourceChip
|
|
954
|
+
data-loading-item
|
|
999
955
|
key={src.index}
|
|
1000
956
|
src={src}
|
|
1001
957
|
baseRoute={baseRoute}
|
|
1002
958
|
chipBasePlatform={chipBasePlatform}
|
|
1003
|
-
onClose={onClose}
|
|
1004
959
|
onDiscuss={onDiscuss}
|
|
1005
960
|
/>
|
|
1006
961
|
))}
|
|
1007
962
|
{expanded &&
|
|
1008
963
|
uncited.map(src => (
|
|
1009
964
|
<SourceChip
|
|
965
|
+
data-loading-item
|
|
1010
966
|
key={src.index}
|
|
1011
967
|
src={src}
|
|
1012
968
|
baseRoute={baseRoute}
|
|
1013
969
|
chipBasePlatform={chipBasePlatform}
|
|
1014
|
-
onClose={onClose}
|
|
1015
970
|
onDiscuss={onDiscuss}
|
|
1016
971
|
/>
|
|
1017
972
|
))}
|
|
@@ -1084,6 +1039,7 @@ EmbeddableChat.displayName = 'EmbeddableChat';
|
|
|
1084
1039
|
function EmbeddableChatInner({
|
|
1085
1040
|
baseRoute,
|
|
1086
1041
|
chipBasePlatform,
|
|
1042
|
+
sourceSkeletonCount = SOURCE_CHIP_SKELETON_COUNT,
|
|
1087
1043
|
enabledRagTableIds = null,
|
|
1088
1044
|
emptyStateGreeting = null,
|
|
1089
1045
|
suggestedQueries = null,
|
|
@@ -2116,15 +2072,16 @@ function EmbeddableChatInner({
|
|
|
2116
2072
|
// for the duration of an unrelated turn.
|
|
2117
2073
|
// Its strip is drawn in its loading form meanwhile, so the strip is already there when the answer ends.
|
|
2118
2074
|
if (chatLoading && index === messages.length - 1) {
|
|
2075
|
+
if (sourceSkeletonCount <= 0) return null;
|
|
2119
2076
|
return (
|
|
2120
2077
|
<div className="pb-2">
|
|
2121
2078
|
<SourceChips
|
|
2122
2079
|
loading
|
|
2080
|
+
skeletonCount={sourceSkeletonCount}
|
|
2123
2081
|
cited={[]}
|
|
2124
2082
|
uncited={[]}
|
|
2125
2083
|
baseRoute={resolvedBaseRoute}
|
|
2126
2084
|
chipBasePlatform={chipBasePlatform}
|
|
2127
|
-
onClose={handleNavigationClose}
|
|
2128
2085
|
/>
|
|
2129
2086
|
</div>
|
|
2130
2087
|
);
|
|
@@ -2138,13 +2095,13 @@ function EmbeddableChatInner({
|
|
|
2138
2095
|
uncited={uncited}
|
|
2139
2096
|
baseRoute={resolvedBaseRoute}
|
|
2140
2097
|
chipBasePlatform={chipBasePlatform}
|
|
2141
|
-
onClose={handleNavigationClose}
|
|
2142
2098
|
onDiscuss={askAbout}
|
|
2099
|
+
skeletonCount={sourceSkeletonCount}
|
|
2143
2100
|
/>
|
|
2144
2101
|
</div>
|
|
2145
2102
|
);
|
|
2146
2103
|
},
|
|
2147
|
-
[chatLoading, messages.length, resolvedBaseRoute, chipBasePlatform,
|
|
2104
|
+
[chatLoading, messages.length, resolvedBaseRoute, chipBasePlatform, askAbout, sourceSkeletonCount],
|
|
2148
2105
|
);
|
|
2149
2106
|
|
|
2150
2107
|
// 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
|
|