@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,6 @@
|
|
|
3
3
|
* the chat-adjacent surfaces (source chips, inline cards, search results).
|
|
4
4
|
*
|
|
5
5
|
* Lib-side refactor of the hub's `lib/utils/source-row-cta.ts`. Drops:
|
|
6
|
-
* - `currentPlatform()` — host injects via `ctx.currentPlatform`
|
|
7
6
|
* - `traceCompose()` logging — lib stays log-free; hosts can wrap
|
|
8
7
|
* - `tableIdForDocumentType` — host injects via `ctx.tableIdForDocumentType`
|
|
9
8
|
*
|
|
@@ -11,11 +10,9 @@
|
|
|
11
10
|
* - `icon` + `iconLabel` — for visual + a11y. Sourced from
|
|
12
11
|
* `SOURCE_ICON_NAMES` keyed by the row's `sourceRepo` (config id),
|
|
13
12
|
* resolved to a React component via `ICON_REGISTRY`.
|
|
14
|
-
* - `href` — destination URL. `null` means "no
|
|
15
|
-
* the only action".
|
|
16
|
-
*
|
|
17
|
-
* also runs `safeHref()` on the final value so a hostile RAG row
|
|
18
|
-
* can't land `javascript:` / `data:` in the DOM.
|
|
13
|
+
* - `href` — destination URL, from the host's composer (`composeContentUrl`). `null` means "no viewer; Ask is
|
|
14
|
+
* the only action". Runs `safeHref()` on the final value so a hostile RAG row can't land `javascript:` /
|
|
15
|
+
* `data:` in the DOM.
|
|
19
16
|
* - `askable` — whether the Ask drill-in flow can fire. Requires a
|
|
20
17
|
* non-empty `id` AND a `documentType`.
|
|
21
18
|
* - `chatRef` — pre-synthesized `ChatRef` for the Ask handler.
|
|
@@ -23,7 +20,6 @@
|
|
|
23
20
|
|
|
24
21
|
import { FileText } from 'lucide-react';
|
|
25
22
|
import type React from 'react';
|
|
26
|
-
import { getPlatformUrl } from '../../../platform-domains';
|
|
27
23
|
import type { ComposeContentUrl } from '../../../utils/content-href';
|
|
28
24
|
import { canonicalContentRefType } from '../../../utils/list-url';
|
|
29
25
|
import { DOC_TABLE_TYPES } from '../../../utils/source-grouping';
|
|
@@ -60,18 +56,6 @@ export interface SourceRowInput {
|
|
|
60
56
|
}
|
|
61
57
|
|
|
62
58
|
export interface SourceRowContext {
|
|
63
|
-
/** Chat shell's base route — `/data-room`, `/knowledge-base`, etc. */
|
|
64
|
-
baseRoute?: string;
|
|
65
|
-
/** Cross-platform target for the chip / card click. */
|
|
66
|
-
chipBasePlatform?: string;
|
|
67
|
-
/**
|
|
68
|
-
* Host-supplied current-platform identifier. Used as the
|
|
69
|
-
* `targetPlatform` for path-based fallback URLs that point to the
|
|
70
|
-
* host's own surface. When omitted, path-based fallback rows get a
|
|
71
|
-
* `null` targetPlatform — consumers fall back to their legacy
|
|
72
|
-
* origin-check.
|
|
73
|
-
*/
|
|
74
|
-
currentPlatform?: string | null;
|
|
75
59
|
/**
|
|
76
60
|
* Host-supplied reverse map: documentType → tableId. Used to derive
|
|
77
61
|
* `sourceRepo` from `documentType` when the caller didn't supply it
|
|
@@ -81,25 +65,12 @@ export interface SourceRowContext {
|
|
|
81
65
|
*/
|
|
82
66
|
tableIdForDocumentType?: (documentType: string) => string | null;
|
|
83
67
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* types, the hub URL otherwise). When omitted, the row's `externalUrl` is used
|
|
89
|
-
* verbatim (legacy).
|
|
68
|
+
* The host's ONE address rule (`runtime.composeContentUrl`). Every row resolves its href through it: a record by
|
|
69
|
+
* its `externalUrl`, a doc by its tree `path` (passed as the `slug`). The host decides where each type lives and
|
|
70
|
+
* whether that is this site or another platform; the lib builds no address of its own. With no composer, a
|
|
71
|
+
* record's `externalUrl` is used as given and a doc has no link.
|
|
90
72
|
*/
|
|
91
73
|
composeContentUrl?: ComposeContentUrl;
|
|
92
|
-
/**
|
|
93
|
-
* Host-supplied per-`documentType` doc-viewer targets — the UNIFIED, DYNAMIC
|
|
94
|
-
* replacement for the single `chipBasePlatform`. Maps a doc-table documentType
|
|
95
|
-
* (`'markdown'`, `'data_room_doc'`, …) → the platform whose PUBLIC doc viewer
|
|
96
|
-
* hosts it + that viewer's base path. A doc chip with no `externalUrl` resolves
|
|
97
|
-
* to `getPlatformUrl(platform)/<basePath>/<path>` PER ROW — so a chat mixing several
|
|
98
|
-
* doc sources sends EACH to its own home (markdown→flamingo/knowledge-base,
|
|
99
|
-
* data_room_doc→company-hub/data-room) instead of one static fallback for all.
|
|
100
|
-
* Wins over `chipBasePlatform` when a row's documentType has an entry.
|
|
101
|
-
*/
|
|
102
|
-
docPlatformTargets?: Record<string, { platform: string; basePath: string }>;
|
|
103
74
|
}
|
|
104
75
|
|
|
105
76
|
export interface SourceRowCTA {
|
|
@@ -120,27 +91,11 @@ export interface SourceRowCTA {
|
|
|
120
91
|
}
|
|
121
92
|
|
|
122
93
|
/**
|
|
123
|
-
* Build a `SourceRowContext` from a `ChatRuntime
|
|
124
|
-
*
|
|
125
|
-
* `docPlatformTargets`) are wired identically at every `resolveSourceRowCTA` call site
|
|
126
|
-
* (source chips + inline cards), so they live here once — adding a ctx field is then a
|
|
127
|
-
* one-line change instead of editing all three call sites.
|
|
94
|
+
* Build a `SourceRowContext` from a `ChatRuntime`. Wired identically at every `resolveSourceRowCTA` call site
|
|
95
|
+
* (source chips + inline cards), so it lives here once.
|
|
128
96
|
*/
|
|
129
|
-
export function sourceRowCtxFromRuntime(
|
|
130
|
-
|
|
131
|
-
source?: string;
|
|
132
|
-
composeContentUrl?: ComposeContentUrl;
|
|
133
|
-
docPlatformTargets?: SourceRowContext['docPlatformTargets'];
|
|
134
|
-
},
|
|
135
|
-
surface: { baseRoute?: string; chipBasePlatform?: string } = {},
|
|
136
|
-
): SourceRowContext {
|
|
137
|
-
return {
|
|
138
|
-
currentPlatform: runtime.source ?? null,
|
|
139
|
-
composeContentUrl: runtime.composeContentUrl,
|
|
140
|
-
docPlatformTargets: runtime.docPlatformTargets,
|
|
141
|
-
baseRoute: surface.baseRoute,
|
|
142
|
-
chipBasePlatform: surface.chipBasePlatform,
|
|
143
|
-
};
|
|
97
|
+
export function sourceRowCtxFromRuntime(runtime: { composeContentUrl?: ComposeContentUrl }): SourceRowContext {
|
|
98
|
+
return { composeContentUrl: runtime.composeContentUrl };
|
|
144
99
|
}
|
|
145
100
|
|
|
146
101
|
/**
|
|
@@ -155,12 +110,8 @@ function pickSourceIcon(sourceRepo: string | null, documentType: string | null |
|
|
|
155
110
|
return { icon, iconLabel };
|
|
156
111
|
}
|
|
157
112
|
|
|
158
|
-
/**
|
|
159
|
-
|
|
160
|
-
* `externalUrl` is set; the in-app/per-platform viewer can render them. Entity-table
|
|
161
|
-
* rows MUST come with an explicit `externalUrl` from the mapper.
|
|
162
|
-
*/
|
|
163
|
-
function shouldFallbackToPathNav(row: SourceRowInput): boolean {
|
|
113
|
+
/** A doc-table row (DOC_TABLE_TYPES) is addressed by its tree `path`; every other row by its `externalUrl`. */
|
|
114
|
+
function isDocRow(row: SourceRowInput): boolean {
|
|
164
115
|
return !!row.documentType && (DOC_TABLE_TYPES as readonly string[]).includes(row.documentType);
|
|
165
116
|
}
|
|
166
117
|
|
|
@@ -186,57 +137,25 @@ export function resolveSourceRowCTA(row: SourceRowInput, ctx: SourceRowContext =
|
|
|
186
137
|
let href: string | null = null;
|
|
187
138
|
let targetPlatform: string | null = null;
|
|
188
139
|
const idValue = (row.id ?? '').trim();
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
// The UNIFIED, DYNAMIC path: a chat mixing multiple doc sources routes
|
|
195
|
-
// EACH row to its own home (markdown→flamingo, data_room_doc→company-hub).
|
|
196
|
-
// 2. chipBasePlatform — legacy SINGLE cross-platform fallback (one platform
|
|
197
|
-
// for every doc; only safe when a surface sees just one doc source).
|
|
198
|
-
// 3. baseRoute — the host serves the doc viewer in-app → relative path nav.
|
|
199
|
-
// else → null (no viewer configured → Ask-only).
|
|
200
|
-
const safePath = sanitizePath(row.path);
|
|
201
|
-
if (safePath) {
|
|
202
|
-
const docTarget = row.documentType ? ctx.docPlatformTargets?.[row.documentType] : undefined;
|
|
203
|
-
if (docTarget) {
|
|
204
|
-
// Trim leading/trailing (and collapse empty) segments WITHOUT a regex — the
|
|
205
|
-
// slash-stripping regex `/^\/+|\/+$/g` tripped CodeQL's js/polynomial-redos (high)
|
|
206
|
-
// since `\/+$` backtracks on inputs with many '/'. split/filter/join is linear.
|
|
207
|
-
const seg = docTarget.basePath.split('/').filter(Boolean).join('/');
|
|
208
|
-
const base = `${getPlatformUrl(docTarget.platform)}${seg ? `/${seg}` : ''}/`;
|
|
209
|
-
href = safeHref(new URL(safePath, base).toString()) ?? null;
|
|
210
|
-
targetPlatform = docTarget.platform;
|
|
211
|
-
} else if (ctx.chipBasePlatform) {
|
|
212
|
-
const base = `${getPlatformUrl(ctx.chipBasePlatform)}/knowledge-base/`;
|
|
213
|
-
href = safeHref(new URL(safePath, base).toString()) ?? null;
|
|
214
|
-
targetPlatform = ctx.chipBasePlatform;
|
|
215
|
-
} else if (ctx.baseRoute) {
|
|
216
|
-
const synthetic = `https://_internal_.local${ctx.baseRoute.startsWith('/') ? ctx.baseRoute : '/' + ctx.baseRoute}/`;
|
|
217
|
-
const absolute = new URL(safePath, synthetic).toString();
|
|
218
|
-
href = safeHref(absolute.replace('https://_internal_.local', '')) ?? null;
|
|
219
|
-
targetPlatform = ctx.currentPlatform ?? null;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
} else if (ctx.composeContentUrl && row.documentType && row.externalUrl) {
|
|
223
|
-
// Entity content WITH a public viewer → the unified content-href seam. The
|
|
224
|
-
// host's hostedTypes/overrides route hosted types in-app (slug relativized
|
|
225
|
-
// from the externalUrl) and everything else to the externalUrl verbatim —
|
|
226
|
-
// the SAME resolver the page-view cards use, so chat + page links match.
|
|
140
|
+
// ONE address rule, the host's (`composeContentUrl`): a record by its `externalUrl`, a doc by its tree `path`
|
|
141
|
+
// (passed as the `slug`). The host's composer decides where the type lives and whether that is this site (a
|
|
142
|
+
// relative link) or another platform; the lib builds no address of its own (CU-17tkuw61kfy).
|
|
143
|
+
const docPath = !row.externalUrl && row.path && isDocRow(row) ? sanitizePath(row.path) : '';
|
|
144
|
+
if (ctx.composeContentUrl && row.documentType && (row.externalUrl || docPath)) {
|
|
227
145
|
const composed = ctx.composeContentUrl({
|
|
228
146
|
// Canonical vocabulary only — a rail-vocab alias would miss the host's
|
|
229
147
|
// `hostedTypes` / `overrides` and fall through to the seam's default
|
|
230
148
|
// `<origin>/<type>/<id>` branch. Same canonicalizer `buildListUrl` uses.
|
|
231
149
|
type: canonicalContentRefType(row.documentType),
|
|
232
150
|
identifier: idValue,
|
|
233
|
-
|
|
151
|
+
...(docPath ? { slug: docPath } : {}),
|
|
152
|
+
externalUrl: row.externalUrl ?? null,
|
|
234
153
|
targetPlatform: row.targetPlatform ?? null,
|
|
235
154
|
});
|
|
236
155
|
href = composed.href ? (safeHref(composed.href) ?? null) : null;
|
|
237
156
|
targetPlatform = composed.targetPlatform;
|
|
238
157
|
} else if (row.externalUrl) {
|
|
239
|
-
// No composer wired
|
|
158
|
+
// No composer wired: the record's own address, as given.
|
|
240
159
|
href = safeHref(row.externalUrl) ?? null;
|
|
241
160
|
targetPlatform = row.targetPlatform ?? null;
|
|
242
161
|
}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import type React from 'react';
|
|
4
4
|
import { type MouseEvent, type ReactNode, useMemo } from 'react';
|
|
5
|
+
import { useChatRuntime } from '../../../contexts/chat-runtime-context';
|
|
5
6
|
import { formatDate, formatTime } from '../../../utils/format-date';
|
|
7
|
+
import { executeNewTabNavigation } from '../../chat/utils/execute-navigation';
|
|
6
8
|
import { ArrowRightUpIcon } from '../../icons-v2-generated';
|
|
7
9
|
import { TextLineSkeleton } from '../../loading/unified-skeleton';
|
|
8
10
|
import {
|
|
@@ -72,12 +74,13 @@ export function getDeviceActionsColumn<T extends DeviceRow = DeviceRow>(
|
|
|
72
74
|
/** Opens the device's page in a new tab. A button, because the row is itself a link and a link cannot hold a link. */
|
|
73
75
|
function OpenDeviceButton({ device }: { device: DeviceRow }) {
|
|
74
76
|
const { getDeviceHref } = useDevicesViewConfig();
|
|
77
|
+
const runtime = useChatRuntime();
|
|
75
78
|
// The button is static chrome: drawn real while the row is read, and inert.
|
|
76
79
|
const loading = useLoadingScope();
|
|
77
80
|
const href = loading ? undefined : getDeviceHref?.(device);
|
|
78
81
|
const open = (event: MouseEvent) => {
|
|
79
82
|
event.preventDefault();
|
|
80
|
-
if (href)
|
|
83
|
+
if (href) executeNewTabNavigation({ runtime, href });
|
|
81
84
|
};
|
|
82
85
|
return (
|
|
83
86
|
<div data-no-row-click className="pointer-events-auto flex items-center justify-end">
|
|
@@ -40,9 +40,6 @@ export interface AppHeaderProps {
|
|
|
40
40
|
* the SSOT deep link `<href>?ticket=<id>` for the newest-unread
|
|
41
41
|
* ticket before navigating. */
|
|
42
42
|
ticketAlertsHref?: string;
|
|
43
|
-
/** Host navigation (router push) — receives the FULL computed href.
|
|
44
|
-
* Defaults to `window.location.assign`. */
|
|
45
|
-
onTicketAlerts?: (href: string) => void;
|
|
46
43
|
/** Render the time-tracker button + popup. Requires wrapping the app in `<TimeTrackerProvider>`. */
|
|
47
44
|
showTimeTracker?: boolean;
|
|
48
45
|
/** Render the "Mingo AI" launcher button (drawer-style trigger for an
|
|
@@ -135,7 +132,6 @@ export const AppHeader = React.memo(function AppHeaderImpl({
|
|
|
135
132
|
unreadCount = 0,
|
|
136
133
|
showTicketAlerts = false,
|
|
137
134
|
ticketAlertsHref,
|
|
138
|
-
onTicketAlerts,
|
|
139
135
|
showTimeTracker = false,
|
|
140
136
|
showMingoAI = false,
|
|
141
137
|
onMingoAI,
|
|
@@ -259,7 +255,6 @@ export const AppHeader = React.memo(function AppHeaderImpl({
|
|
|
259
255
|
{showTicketAlerts && (
|
|
260
256
|
<TicketAlertsButton
|
|
261
257
|
href={ticketAlertsHref ?? '/tickets'}
|
|
262
|
-
onNavigate={onTicketAlerts}
|
|
263
258
|
disabled={disabled}
|
|
264
259
|
className={cn(cellDivider, dimmedClass)}
|
|
265
260
|
/>
|
|
@@ -28,8 +28,10 @@
|
|
|
28
28
|
* this dedicated cell, not the bell.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
+
import { useChatRuntime } from '../../contexts/chat-runtime-context';
|
|
31
32
|
import { cn } from '../../utils/cn';
|
|
32
33
|
import { buildTicketOpenHref } from '../../utils/dev-sections/dev-section-param-keys';
|
|
34
|
+
import { executeNavigationImperative } from '../chat/utils/execute-navigation';
|
|
33
35
|
import { LifeBuoyIcon } from '../icons-v2-generated/interface/life-buoy-icon';
|
|
34
36
|
import { useOptionalTicketLive } from '../tickets/ticket-live-provider';
|
|
35
37
|
import { HeaderButton } from './header-button';
|
|
@@ -43,25 +45,22 @@ export interface TicketAlertsButtonProps {
|
|
|
43
45
|
* param `HelpCenterList` derives its drawer state from; opening the
|
|
44
46
|
* drawer also smooth-scrolls the row). */
|
|
45
47
|
href: string;
|
|
46
|
-
/** Host navigation (router push) — receives the FULL computed href.
|
|
47
|
-
* Defaults to `window.location.assign`. */
|
|
48
|
-
onNavigate?: (href: string) => void;
|
|
49
48
|
disabled?: boolean;
|
|
50
49
|
className?: string;
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
export function TicketAlertsButton({ href,
|
|
52
|
+
export function TicketAlertsButton({ href, disabled, className }: TicketAlertsButtonProps) {
|
|
54
53
|
const live = useOptionalTicketLive();
|
|
54
|
+
const runtime = useChatRuntime();
|
|
55
55
|
// Attention-only: no provider, signed out, or nothing unread → no cell.
|
|
56
56
|
if (!live || !live.authed || live.unreadTotal === 0) return null;
|
|
57
57
|
|
|
58
58
|
const targetId = live.nextUnreadTicketId;
|
|
59
59
|
const target = targetId ? buildTicketOpenHref(href, targetId) : href;
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
};
|
|
61
|
+
// Followed through the lib's navigation executor: the host's `navigate` (a soft navigation, so the ticket drawer
|
|
62
|
+
// opens on its row).
|
|
63
|
+
const handleClick = () => executeNavigationImperative({ runtime, href: target });
|
|
65
64
|
|
|
66
65
|
return (
|
|
67
66
|
<HeaderButton
|
|
@@ -73,7 +73,7 @@ import { ProductReleaseCard } from '../shared/product-release/product-release-ca
|
|
|
73
73
|
export type CardSize = 'lg' | 'default' | 'sm';
|
|
74
74
|
|
|
75
75
|
/** Anchor prop bundle the per-card link surface receives — same shape the
|
|
76
|
-
*
|
|
76
|
+
* `useNavLinkViaRuntime` returns and the chat dispatcher's anchor builders
|
|
77
77
|
* produce. `null` = non-anchor mode (no URL). */
|
|
78
78
|
export interface CardLinkAnchorProps {
|
|
79
79
|
href: string;
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
|
|
51
51
|
import type React from 'react';
|
|
52
52
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
53
|
+
import { useChatRuntime } from '../../contexts/chat-runtime-context';
|
|
53
54
|
import { useSelfFetch } from '../../hooks/use-self-fetch';
|
|
54
55
|
import type { ContentRef, ContentRefWithReason } from '../../types/content-ref';
|
|
55
56
|
import {
|
|
@@ -65,7 +66,7 @@ import { pageCount } from '../../utils/search-params';
|
|
|
65
66
|
import { buildSuggestionUrl } from '../../utils/suggestion-url';
|
|
66
67
|
// Type-only — erased at build, no runtime dependency on the dispatch module.
|
|
67
68
|
import type { ChatCardDispatchExtras } from '../chat/entity-cards/dispatch';
|
|
68
|
-
import {
|
|
69
|
+
import { navLinkTarget, newTabAnchorAttrs } from '../chat/utils/nav-anchor-props';
|
|
69
70
|
import { accentSentenceMarks } from '../layout/page-heading';
|
|
70
71
|
import { LoadingRegion } from '../loading/loading-region';
|
|
71
72
|
import { TextLineSkeleton } from '../loading/unified-skeleton';
|
|
@@ -87,8 +88,8 @@ import {
|
|
|
87
88
|
|
|
88
89
|
/** Render-prop component injection for the navigation decision — keeps hook
|
|
89
90
|
* calls legal (hooks live INSIDE the injected component; `CardForType`
|
|
90
|
-
* itself calls zero hooks). The hub injects a `
|
|
91
|
-
* the default
|
|
91
|
+
* itself calls zero hooks). The hub injects a `useNavLinkViaRuntime`-backed provider;
|
|
92
|
+
* the default reads THE navigation decision (`navLinkTarget`). MUST be defined at module
|
|
92
93
|
* scope by hosts — an inline arrow would remount every card each render. */
|
|
93
94
|
export interface CardLinkProviderProps {
|
|
94
95
|
href: string | null;
|
|
@@ -97,18 +98,17 @@ export interface CardLinkProviderProps {
|
|
|
97
98
|
}
|
|
98
99
|
export type CardLinkProvider = React.ComponentType<CardLinkProviderProps>;
|
|
99
100
|
|
|
100
|
-
/** Default link provider for
|
|
101
|
-
*
|
|
102
|
-
* platform context — `currentSource: ''` falls through to the origin
|
|
103
|
-
* check). No router integration, no hooks. */
|
|
101
|
+
/** Default link provider: THE navigation decision (`navLinkTarget`) for the chat runtime the rail is mounted in
|
|
102
|
+
* (none: the href as given, same tab), as the anchor's href and target/rel. */
|
|
104
103
|
function DefaultLinkPropsProvider({
|
|
105
104
|
href,
|
|
106
105
|
targetPlatform,
|
|
107
106
|
children,
|
|
108
107
|
}: CardLinkProviderProps): React.ReactElement | null {
|
|
108
|
+
const runtime = useChatRuntime();
|
|
109
109
|
if (!href) return children(null);
|
|
110
|
-
const
|
|
111
|
-
return children(
|
|
110
|
+
const target = navLinkTarget(runtime, href, targetPlatform);
|
|
111
|
+
return children({ href: target.href, ...newTabAnchorAttrs(target.isNewTab, target.href, targetPlatform) });
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
/** Default href resolution: trust the ref's stored url/targetPlatform as the
|
|
@@ -601,7 +601,7 @@ export interface RelatedContentSectionProps {
|
|
|
601
601
|
/** Hub injects its registry-driven entity-list-api builder; default = the
|
|
602
602
|
* lib's `buildListUrl(type, ids, apiBaseUrl)`. */
|
|
603
603
|
buildListUrl?: (type: string, ids: string[]) => string | null;
|
|
604
|
-
/** Hub injects a `
|
|
604
|
+
/** Hub injects a `useNavLinkViaRuntime`-backed render-prop provider; default = pure
|
|
605
605
|
* anchor via `decideNewTab`. MUST be a module-scope component. */
|
|
606
606
|
LinkProvider?: CardLinkProvider;
|
|
607
607
|
/** Renderer pair for the admin-only `marketing_campaign` type. Absent →
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Resolution order:
|
|
6
6
|
* 1. `externalUrl` present → resolve the href through the host's
|
|
7
|
-
* `composeContentUrl` seam (when wired), then
|
|
8
|
-
*
|
|
7
|
+
* `composeContentUrl` seam (when wired), then THE navigation decision
|
|
8
|
+
* (`navLinkTarget`, the one every chat link uses) chooses same-tab vs new-tab.
|
|
9
9
|
* 2. Row has `id` + `sourceRepo` + `documentType` → synth an Ask-AI
|
|
10
10
|
* action (entity drill-in via primary key, no URL).
|
|
11
11
|
* 3. Row has only `path` → legacy navigation fallback.
|
|
@@ -15,21 +15,16 @@
|
|
|
15
15
|
* Pure — no React, no telemetry.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
import type { ChatRuntime } from '../../../contexts/chat-runtime-context';
|
|
18
19
|
import type { ComposeContentUrl } from '../../../utils/content-href';
|
|
19
20
|
import type { ChatRef } from '../../chat/chat-ref.types';
|
|
20
|
-
import {
|
|
21
|
+
import { navLinkTarget } from '../../chat/utils/nav-anchor-props';
|
|
22
|
+
import { isRelativeHref } from '../../chat/utils/new-tab-rel';
|
|
21
23
|
import type { SearchResult } from '../../ui/search-input';
|
|
22
24
|
|
|
23
|
-
/** True for `https://…` and protocol-relative `//…`. A composed href that is
|
|
24
|
-
* NOT absolute is an in-app route the host claimed via `hostedTypes` /
|
|
25
|
-
* `overrides`. */
|
|
26
|
-
function isAbsoluteHref(href: string): boolean {
|
|
27
|
-
return /^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(href);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
25
|
export type SearchResultAction =
|
|
31
|
-
| { kind: 'navigate-same-tab'; href: string }
|
|
32
|
-
| { kind: 'navigate-new-tab'; href: string }
|
|
26
|
+
| { kind: 'navigate-same-tab'; href: string; targetPlatform: string | null; hostRoute?: boolean }
|
|
27
|
+
| { kind: 'navigate-new-tab'; href: string; targetPlatform: string | null; hostRoute?: boolean }
|
|
33
28
|
| { kind: 'ask-ai'; detail: { source: string; ref: ChatRef } }
|
|
34
29
|
| { kind: 'route'; path: string }
|
|
35
30
|
| { kind: 'noop' };
|
|
@@ -37,7 +32,8 @@ export type SearchResultAction =
|
|
|
37
32
|
export function resolveSearchResultAction(
|
|
38
33
|
result: SearchResult,
|
|
39
34
|
source: string,
|
|
40
|
-
|
|
35
|
+
/** The chat runtime the search runs in; null outside one (same tab, the decision's no-runtime rule). */
|
|
36
|
+
runtime: ChatRuntime | null | undefined,
|
|
41
37
|
/** The host's unified content-href seam (`runtime.composeContentUrl`).
|
|
42
38
|
* When wired, an entity row's RAG `externalUrl` is re-resolved through it,
|
|
43
39
|
* so a type the host serves in-app (`hostedTypes`) or deep-links itself
|
|
@@ -65,26 +61,16 @@ export function resolveSearchResultAction(
|
|
|
65
61
|
targetPlatform: targetPlatform ?? null,
|
|
66
62
|
})
|
|
67
63
|
: null;
|
|
68
|
-
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
// the caller's `source` as `currentSource` so the platform-vs-
|
|
79
|
-
// platform comparison matches the hub's pre-migration behavior.
|
|
80
|
-
const isNewTab = decideNewTab({
|
|
81
|
-
href,
|
|
82
|
-
targetPlatform: composed ? composed.targetPlatform : targetPlatform,
|
|
83
|
-
surface: 'useUnifiedNav',
|
|
84
|
-
runtimeMode,
|
|
85
|
-
currentSource: source,
|
|
86
|
-
});
|
|
87
|
-
return isNewTab ? { kind: 'navigate-new-tab', href } : { kind: 'navigate-same-tab', href };
|
|
64
|
+
// THE navigation decision. A RELATIVE composed href is a route the host claimed as in-app (`hostRoute`): it stays
|
|
65
|
+
// in this window in every mode, never handed to `window.open`.
|
|
66
|
+
const hostRoute = !!composed?.href && isRelativeHref(composed.href);
|
|
67
|
+
const actionPlatform = composed ? composed.targetPlatform : (targetPlatform ?? null);
|
|
68
|
+
const target = navLinkTarget(runtime, composed?.href || externalUrl, actionPlatform, { hostRoute });
|
|
69
|
+
const kind = target.isNewTab ? 'navigate-new-tab' : 'navigate-same-tab';
|
|
70
|
+
// The executor decides again from these same inputs, so the click lands where this action says.
|
|
71
|
+
return hostRoute
|
|
72
|
+
? { kind, href: target.href, targetPlatform: actionPlatform, hostRoute }
|
|
73
|
+
: { kind, href: target.href, targetPlatform: actionPlatform };
|
|
88
74
|
}
|
|
89
75
|
if (rowId && sourceRepo && documentType) {
|
|
90
76
|
return {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* equivalent runtime-context yet; bring it back when there is one.
|
|
25
25
|
*
|
|
26
26
|
* Everything else (debounce, `useChatRuntime` for embed-mode short-
|
|
27
|
-
* circuit,
|
|
27
|
+
* circuit, the action-resolver + result-mapper) is
|
|
28
28
|
* now lib-resident.
|
|
29
29
|
*
|
|
30
30
|
* ## Result hrefs go through the content-href seam
|
|
@@ -40,16 +40,11 @@
|
|
|
40
40
|
|
|
41
41
|
import { useState, useEffect, useCallback } from 'react';
|
|
42
42
|
import { useChatRuntime } from '../../../contexts/chat-runtime-context';
|
|
43
|
-
import { useRouter } from '../../../embed-shims';
|
|
44
43
|
import { useDebounce } from '../../../hooks/ui/use-debounce';
|
|
45
44
|
import type { ComposeContentUrl } from '../../../utils/content-href';
|
|
46
45
|
import { contentFetch } from '../../../utils/embed-content-fetch';
|
|
47
46
|
import { ASK_AI_OPEN_WITH_REF_EVENT } from '../../chat/utils/ask-ai-events';
|
|
48
|
-
import {
|
|
49
|
-
resolveExternalNavigation,
|
|
50
|
-
stripSameOriginToPath,
|
|
51
|
-
NEW_TAB_FEATURES,
|
|
52
|
-
} from '../../chat/utils/chat-nav-resolution';
|
|
47
|
+
import { executeNavigationImperative, executeNewTabNavigation } from '../../chat/utils/execute-navigation';
|
|
53
48
|
import type { SearchResult } from '../../ui/search-input';
|
|
54
49
|
import { mapDocSearchResults } from './map-doc-search-results';
|
|
55
50
|
import { resolveSearchResultAction } from './resolve-search-result-action';
|
|
@@ -153,7 +148,6 @@ export function useDocSearch(config: UseDocSearchConfig) {
|
|
|
153
148
|
const { source, baseRoute, onNavigate, tableIds, onInPageSwap, searchEndpoint, composeContentUrl } = config;
|
|
154
149
|
const tableIdsKey = tableIds && tableIds.length > 0 ? tableIds.join(',') : '';
|
|
155
150
|
|
|
156
|
-
const router = useRouter();
|
|
157
151
|
// Optional chat-runtime read — when present and mode='embed' the
|
|
158
152
|
// search-result row click short-circuits to a new-tab open against
|
|
159
153
|
// the absolutized URL. Null/host preserves today's behavior.
|
|
@@ -255,7 +249,7 @@ export function useDocSearch(config: UseDocSearchConfig) {
|
|
|
255
249
|
button?: number;
|
|
256
250
|
},
|
|
257
251
|
) => {
|
|
258
|
-
const action = resolveSearchResultAction(result, source, runtime
|
|
252
|
+
const action = resolveSearchResultAction(result, source, runtime, resolvedComposeContentUrl);
|
|
259
253
|
// Modifier / non-primary mouse click → force new tab regardless of
|
|
260
254
|
// same-tab/new-tab decision. The dropdown row is a `<div>`, not an
|
|
261
255
|
// `<a target="_blank">`, so the browser doesn't background-tab
|
|
@@ -270,48 +264,31 @@ export function useDocSearch(config: UseDocSearchConfig) {
|
|
|
270
264
|
modifiers.altKey ||
|
|
271
265
|
(typeof modifiers.button === 'number' && modifiers.button !== 0));
|
|
272
266
|
switch (action.kind) {
|
|
273
|
-
case 'navigate-same-tab':
|
|
267
|
+
case 'navigate-same-tab':
|
|
268
|
+
case 'navigate-new-tab': {
|
|
269
|
+
// A modifier / non-primary click asks for a new tab, whatever the decision: the row is a `<div>`, not an
|
|
270
|
+
// anchor, so the browser will not do it natively. Opened the one way a new tab is opened.
|
|
274
271
|
if (wantsNewTab) {
|
|
275
272
|
setKeepOpen(true);
|
|
276
|
-
|
|
273
|
+
executeNewTabNavigation({ runtime, href: action.href, targetPlatform: action.targetPlatform });
|
|
277
274
|
return;
|
|
278
275
|
}
|
|
279
|
-
//
|
|
280
|
-
|
|
281
|
-
//
|
|
282
|
-
// consider in-page swap handled.
|
|
283
|
-
// 2. Otherwise → embed-shim `router.push()` (soft RSC nav on
|
|
284
|
-
// Next.js hosts, window.location.assign on bare hosts).
|
|
285
|
-
setKeepOpen(false);
|
|
276
|
+
// A new-tab result keeps the dropdown open, so the user can pick another without searching again.
|
|
277
|
+
setKeepOpen(action.kind === 'navigate-new-tab');
|
|
278
|
+
// The host's in-place doc swap, when the href is under the current doc tree.
|
|
286
279
|
const path =
|
|
287
280
|
baseRoute && action.href.startsWith(`${baseRoute}/`) ? action.href.slice(baseRoute.length + 1) : null;
|
|
288
|
-
if (path && onInPageSwap?.(path)) return;
|
|
289
|
-
|
|
281
|
+
if (action.kind === 'navigate-same-tab' && path && onInPageSwap?.(path)) return;
|
|
282
|
+
// THE click executor, given the inputs the action was decided from, so it decides the same way.
|
|
283
|
+
executeNavigationImperative({
|
|
284
|
+
runtime,
|
|
285
|
+
href: action.href,
|
|
286
|
+
path,
|
|
287
|
+
targetPlatform: action.targetPlatform,
|
|
288
|
+
hostRoute: action.hostRoute,
|
|
289
|
+
});
|
|
290
290
|
return;
|
|
291
291
|
}
|
|
292
|
-
case 'navigate-new-tab':
|
|
293
|
-
// Cross-origin (e.g. clicking a flamingo.run release from
|
|
294
|
-
// product-hub) — open in a new tab. Keep dropdown open so the
|
|
295
|
-
// user can pick another result without re-searching.
|
|
296
|
-
setKeepOpen(true);
|
|
297
|
-
// Embed-mode short-circuit — the row was clicked while the panel is
|
|
298
|
-
// hosted inside an embedding app, so absolutize against the
|
|
299
|
-
// embedder-supplied content origin and honor its `openExternal`
|
|
300
|
-
// override. Not the only path an embed host takes: a composed
|
|
301
|
-
// RELATIVE href resolves to `navigate-same-tab` above and never
|
|
302
|
-
// reaches `decideNewTab`, which is what lets an embedder keep its
|
|
303
|
-
// own in-app routes in-app.
|
|
304
|
-
if (runtime?.navigation.mode === 'embed') {
|
|
305
|
-
const targetPlatform = (result.metadata?.targetPlatform as string | null | undefined) ?? null;
|
|
306
|
-
resolveExternalNavigation({
|
|
307
|
-
href: action.href,
|
|
308
|
-
targetPlatform,
|
|
309
|
-
runtime,
|
|
310
|
-
}).open();
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
window.open(action.href, '_blank', NEW_TAB_FEATURES);
|
|
314
|
-
return;
|
|
315
292
|
case 'ask-ai':
|
|
316
293
|
// Row is searchable-but-not-openable (cap_table positions,
|
|
317
294
|
// financial-kpi snapshots, anything backed by
|
|
@@ -331,7 +308,7 @@ export function useDocSearch(config: UseDocSearchConfig) {
|
|
|
331
308
|
return;
|
|
332
309
|
}
|
|
333
310
|
},
|
|
334
|
-
[onNavigate, source, baseRoute,
|
|
311
|
+
[onNavigate, source, baseRoute, onInPageSwap, runtime, resolvedComposeContentUrl],
|
|
335
312
|
);
|
|
336
313
|
|
|
337
314
|
// Reset keepOpen when query changes. Adjusted while rendering, not from an
|
|
@@ -63,7 +63,7 @@ export type ProductReleaseCardSize = 'lg' | 'sm';
|
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* Minimal structural `<Link>` prop bundle the consumer composes (typically
|
|
66
|
-
* via
|
|
66
|
+
* via `useNavLinkViaRuntime` — single source of truth for click
|
|
67
67
|
* routing). Kept structural here so the OSS lib has zero hub coupling;
|
|
68
68
|
* the consumer's `NavLinkProps` is type-compatible by shape.
|
|
69
69
|
*
|
|
@@ -97,7 +97,7 @@ export interface LoadedProductReleaseCardProps {
|
|
|
97
97
|
*/
|
|
98
98
|
onClick?: () => void;
|
|
99
99
|
/**
|
|
100
|
-
* `<Link>` prop bundle from the consumer's `
|
|
100
|
+
* `<Link>` prop bundle from the consumer's `useNavLinkViaRuntime` (or equivalent).
|
|
101
101
|
* When provided, the card's outer element renders as a real anchor so
|
|
102
102
|
* routing (cross-origin → new tab, same-origin → soft RSC nav,
|
|
103
103
|
* modifier-click → browser default) is owned by the hook — the card
|
|
@@ -433,7 +433,7 @@ function LoadedProductReleaseCard({
|
|
|
433
433
|
// cannot reuse `InteractiveCard` (a `<div>`).
|
|
434
434
|
//
|
|
435
435
|
// - When `anchorProps` is set, render as a real `<Link>` so the consumer's
|
|
436
|
-
// click hook (`
|
|
436
|
+
// click hook (`useNavLinkViaRuntime`) owns routing identically to every other
|
|
437
437
|
// entity card — cross-origin → new tab, same-origin → soft RSC nav.
|
|
438
438
|
// - Else fall back to legacy `<span role="button">` behavior driven by
|
|
439
439
|
// `onClick` (kept for the public `/releases` page caller).
|
|
@@ -528,7 +528,7 @@ function LoadedProductReleaseCard({
|
|
|
528
528
|
</span>
|
|
529
529
|
</>
|
|
530
530
|
);
|
|
531
|
-
// Anchor variant — consumer's `
|
|
531
|
+
// Anchor variant — consumer's `useNavLinkViaRuntime` (or equivalent) owns the
|
|
532
532
|
// click decision; the card just spreads the prop bundle and renders
|
|
533
533
|
// a real `<Link>` so cmd/ctrl-click new-tab + middle-click work without
|
|
534
534
|
// any extra JS. This is the SAME pattern BlogCard / CaseStudyCard /
|
|
@@ -88,7 +88,7 @@ export interface ProductReleasesViewProps {
|
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
90
|
* Per-row child — owns the per-release hooks (`useChatRuntime` +
|
|
91
|
-
* `useEntityCardLink`
|
|
91
|
+
* `useEntityCardLink`) so they run at a component top level, NOT
|
|
92
92
|
* inside the parent `.map()` (Rules-of-Hooks).
|
|
93
93
|
*/
|
|
94
94
|
function ReleaseRow({
|
|
@@ -101,7 +101,6 @@ function ReleaseRow({
|
|
|
101
101
|
buildCardProps: (release: ProductRelease) => ProductReleaseCardExtras;
|
|
102
102
|
}) {
|
|
103
103
|
const runtime = useChatRuntime();
|
|
104
|
-
const router = useRouter();
|
|
105
104
|
// Pass the HYDRATED junction (`product_release_platforms` — the release DAL
|
|
106
105
|
// flattens each platform's `name` onto it), like the blog / case-study /
|
|
107
106
|
// interview grids. The composer reads `name` → resolves to the CURRENT
|
|
@@ -116,15 +115,13 @@ function ReleaseRow({
|
|
|
116
115
|
|
|
117
116
|
const onClick = (e: MouseEvent<HTMLAnchorElement>) => {
|
|
118
117
|
// Let the browser handle modifier / middle / new-tab clicks (shared
|
|
119
|
-
// `isModifierClick` rule). Otherwise
|
|
120
|
-
// `navigate` (hub docNav) if wired, else the registered embed-shims router.
|
|
118
|
+
// `isModifierClick` rule). Otherwise the host's in-app `navigate`.
|
|
121
119
|
if (e.defaultPrevented || isModifierClick(e) || target === '_blank') return;
|
|
122
120
|
e.preventDefault();
|
|
123
121
|
executeNavigationImperative({
|
|
124
122
|
runtime,
|
|
125
123
|
href: cta.href,
|
|
126
124
|
targetPlatform: cta.targetPlatform,
|
|
127
|
-
fallbackNavigate: router.push,
|
|
128
125
|
});
|
|
129
126
|
};
|
|
130
127
|
|