@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
|
@@ -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
|
|
|
@@ -23,11 +23,13 @@
|
|
|
23
23
|
|
|
24
24
|
import { useEffect, useRef } from 'react';
|
|
25
25
|
import { useStickToBottom } from 'use-stick-to-bottom';
|
|
26
|
+
import { type ChatRuntime, useChatRuntime } from '../../contexts/chat-runtime-context';
|
|
26
27
|
import { LoadingRegion } from '../loading/loading-region';
|
|
27
28
|
import { formatRelativeTime } from './../../utils/date-utils';
|
|
28
29
|
import { ChatMessageRow } from './../chat/chat-message-row';
|
|
29
30
|
import { useChatIdentity } from './../chat/hooks/use-chat-identity';
|
|
30
31
|
import type { ChatAttachment } from './../chat/utils/chat-attachment-markdown';
|
|
32
|
+
import { executeNewTabNavigation } from './../chat/utils/execute-navigation';
|
|
31
33
|
import { EmptyState } from './../empty-state';
|
|
32
34
|
import { Button } from './../ui/button';
|
|
33
35
|
import { LoadingItems } from './../ui/loading-scope';
|
|
@@ -178,6 +180,7 @@ const TICKET_FEED_SKELETON_ROWS = 6;
|
|
|
178
180
|
|
|
179
181
|
function TicketTimelinePanel({ ticket }: { ticket: AnyTicket }) {
|
|
180
182
|
const identity = useChatIdentity();
|
|
183
|
+
const runtime = useChatRuntime();
|
|
181
184
|
// Optimistic placeholders don't have a real external_id yet — skip
|
|
182
185
|
// the engagement fetch until the real ticket lands.
|
|
183
186
|
const externalId = isOptimistic(ticket) ? null : ticket.external_id;
|
|
@@ -441,7 +444,7 @@ function TicketTimelinePanel({ ticket }: { ticket: AnyTicket }) {
|
|
|
441
444
|
// support bubbles was a legacy artifact from when Notes
|
|
442
445
|
// were rendered and made customers think their support
|
|
443
446
|
// engineer was leaving internal comments on their ticket.
|
|
444
|
-
const engAttachments = mapEngagementAttachments(eng.attachments);
|
|
447
|
+
const engAttachments = mapEngagementAttachments(eng.attachments, runtime);
|
|
445
448
|
return (
|
|
446
449
|
<ChatMessageRow
|
|
447
450
|
key={eng.id}
|
|
@@ -474,9 +477,9 @@ function TicketTimelinePanel({ ticket }: { ticket: AnyTicket }) {
|
|
|
474
477
|
/** Map the engagement file shape to the lib's canonical
|
|
475
478
|
* `TicketAttachment` so we can hand it straight to
|
|
476
479
|
* `<TicketAttachmentsList>`. Engagement `url` becomes a
|
|
477
|
-
*
|
|
480
|
+
* download click in a new tab; missing names degrade to
|
|
478
481
|
* `file-<id>` so the chip never renders an empty label. */
|
|
479
|
-
function mapEngagementAttachments(files: TicketEngagementFile[]): TicketAttachment[] {
|
|
482
|
+
function mapEngagementAttachments(files: TicketEngagementFile[], runtime: ChatRuntime | null): TicketAttachment[] {
|
|
480
483
|
return files.map(f => {
|
|
481
484
|
// Captured before the `onDownload` closure below: a narrowing of `f.url`
|
|
482
485
|
// does not reach into a callback that runs on a later click.
|
|
@@ -489,7 +492,7 @@ function mapEngagementAttachments(files: TicketEngagementFile[]): TicketAttachme
|
|
|
489
492
|
// viewable URL). Non-images fall back to the file-type icon. SquareAvatar
|
|
490
493
|
// degrades to initials on a broken/expired image URL.
|
|
491
494
|
thumbnailSrc: url && (f.mime?.startsWith('image/') ?? false) ? url : undefined,
|
|
492
|
-
onDownload: url ? () =>
|
|
495
|
+
onDownload: url ? () => executeNewTabNavigation({ runtime, href: url }) : undefined,
|
|
493
496
|
};
|
|
494
497
|
});
|
|
495
498
|
}
|
|
@@ -114,7 +114,7 @@ export interface TicketClickupSummary {
|
|
|
114
114
|
* chat-inline delivery card uses. Carries `?search=<id>` so the
|
|
115
115
|
* delivery list filters to that single task on landing. */
|
|
116
116
|
delivery_href: string;
|
|
117
|
-
/** Target platform name for the host's `
|
|
117
|
+
/** Target platform name for the host's `useNavLinkViaRuntime` to decide
|
|
118
118
|
* same-tab vs new-tab on cross-platform links. */
|
|
119
119
|
delivery_target_platform: string;
|
|
120
120
|
/** Release version label set by the delivery team, e.g. "0.9" / "1.0".
|
|
@@ -225,7 +225,7 @@ interface ButtonProps
|
|
|
225
225
|
openInNewTab?: boolean;
|
|
226
226
|
prefetch?: boolean;
|
|
227
227
|
/**
|
|
228
|
-
* Pre-resolved anchor bundle (from `
|
|
228
|
+
* Pre-resolved anchor bundle (from `useNavLinkViaRuntime({ href, targetPlatform })`).
|
|
229
229
|
* When set, renders the Button as `<Link>` with `href` / `target` / `rel`
|
|
230
230
|
* / `onClick` spread from this object. Lets callers thread the unified
|
|
231
231
|
* nav decision directly without `<Button asChild><a {...linkProps}/>`
|
|
@@ -364,7 +364,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function ButtonI
|
|
|
364
364
|
);
|
|
365
365
|
}
|
|
366
366
|
|
|
367
|
-
// `linkProps` (the pre-resolved bundle from `
|
|
367
|
+
// `linkProps` (the pre-resolved bundle from `useNavLinkViaRuntime({ href, targetPlatform })`)
|
|
368
368
|
// wins over the legacy `href` + `openInNewTab` props so callers can thread
|
|
369
369
|
// the unified nav decision directly. Either path produces the same `<Link>`.
|
|
370
370
|
const splitAnchor =
|
|
@@ -23,7 +23,7 @@ export interface HoverDropdownItem {
|
|
|
23
23
|
/**
|
|
24
24
|
* In-app doc-tree path for `markdown` / `data_room_doc` refs. Threaded
|
|
25
25
|
* through to the caller's `renderAnchor` so chat consumers can wire it
|
|
26
|
-
* into `
|
|
26
|
+
* into `executeNavigation` and trigger an in-page doc-tree swap
|
|
27
27
|
* (parity with source chips and inline cards).
|
|
28
28
|
*/
|
|
29
29
|
path?: string | null;
|
|
@@ -47,7 +47,7 @@ export interface HoverDropdownItem {
|
|
|
47
47
|
export interface HoverDropdownRenderAnchorArgs {
|
|
48
48
|
href: string;
|
|
49
49
|
targetPlatform?: string | null;
|
|
50
|
-
/** In-app doc-tree path — chat consumers forward to `
|
|
50
|
+
/** In-app doc-tree path — chat consumers forward to `executeNavigation`
|
|
51
51
|
* for doc-tree swap parity with chips + inline cards. */
|
|
52
52
|
path?: string | null;
|
|
53
53
|
alwaysNewTab?: boolean;
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
import { ExternalLink } from 'lucide-react';
|
|
4
4
|
import type React from 'react';
|
|
5
5
|
import { useMemo, useState } from 'react';
|
|
6
|
+
import { useChatRuntime } from '../../contexts/chat-runtime-context';
|
|
6
7
|
import { useIsTruncated } from '../../hooks/ui/use-is-truncated';
|
|
7
8
|
import { useCopyToClipboard } from '../../hooks/use-copy-to-clipboard';
|
|
8
9
|
import { cn } from '../../utils/cn';
|
|
10
|
+
import { executeNewTabNavigation } from '../chat/utils/execute-navigation';
|
|
9
11
|
import { Copy01Icon } from '../icons-v2-generated/documents';
|
|
10
12
|
import { EyeClassicIcon } from '../icons-v2-generated/interface/eye-classic-icon';
|
|
11
13
|
import { EyeOffClassicIcon } from '../icons-v2-generated/interface/eye-off-classic-icon';
|
|
@@ -143,6 +145,7 @@ function ServiceCardRowItem({ row, loading: loadingProp }: { row: ServiceCardRow
|
|
|
143
145
|
const { copy, copied } = useCopyToClipboard();
|
|
144
146
|
const { ref: valueRef, isTruncated: valueTruncated } = useIsTruncated<HTMLDivElement>(row.value);
|
|
145
147
|
const actions = useMemo<ServiceCardRowAction>(() => rowActions(row), [row]);
|
|
148
|
+
const runtime = useChatRuntime();
|
|
146
149
|
|
|
147
150
|
const displayValue = row.isSecret ? (
|
|
148
151
|
<MaskedValue value={row.value} isRevealed={revealed} />
|
|
@@ -154,7 +157,7 @@ function ServiceCardRowItem({ row, loading: loadingProp }: { row: ServiceCardRow
|
|
|
154
157
|
|
|
155
158
|
const openInNewTab = () => {
|
|
156
159
|
if (!row.href) return;
|
|
157
|
-
|
|
160
|
+
executeNewTabNavigation({ runtime, href: row.href });
|
|
158
161
|
};
|
|
159
162
|
|
|
160
163
|
// A label column only where the loaded row has one; while loading, a label not here yet is a bar in it.
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { useChatRuntime } from '../contexts/chat-runtime-context';
|
|
3
4
|
import Image from '../embed-shims/next-image';
|
|
4
5
|
import { IMAGE_FIXED_PX } from '../styles/image-sizes';
|
|
5
6
|
import { cn } from '../utils/cn';
|
|
6
7
|
import { getVendorLogo, type VendorWithMedia } from '../utils/vendor-media-stub';
|
|
7
8
|
import { useProxiedImageUrl } from './chat/hooks/use-proxied-image-url';
|
|
9
|
+
import { executeNewTabNavigation } from './chat/utils/execute-navigation';
|
|
8
10
|
import { BUTTON_KIND_CLASS, Button } from './ui/button';
|
|
9
11
|
|
|
10
12
|
/** The default button's place in its row (it never outgrows it). */
|
|
@@ -22,12 +24,13 @@ interface VendorDisplayButtonProps {
|
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
export function VendorDisplayButton({ vendor, onClick, variant = 'default', externalUrl }: VendorDisplayButtonProps) {
|
|
27
|
+
const runtime = useChatRuntime();
|
|
25
28
|
const handleClick = () => {
|
|
26
29
|
if (externalUrl && vendor.slug) {
|
|
27
30
|
// `externalUrl` is the caller-resolved platform base URL (the openmsp SSOT via
|
|
28
31
|
// getPlatformProductionUrl, scheme-normalized). The old `process.env.NEXT_PUBLIC_OPENMSP_URL`
|
|
29
|
-
// override is gone — it's stored scheme-less, which made this a relative
|
|
30
|
-
|
|
32
|
+
// override is gone — it's stored scheme-less, which made this a relative link.
|
|
33
|
+
executeNewTabNavigation({ runtime, href: `${externalUrl}/vendor/${vendor.slug}`, targetPlatform: 'openmsp' });
|
|
31
34
|
} else if (onClick && vendor.slug) {
|
|
32
35
|
onClick(vendor.slug);
|
|
33
36
|
}
|
|
@@ -23,11 +23,14 @@
|
|
|
23
23
|
* access codes). Each runtime stays an independent React context so
|
|
24
24
|
* embedders can opt into either feature without forcing the other.
|
|
25
25
|
*
|
|
26
|
+
* Without a provider, the lib's links follow its default rule: a link to another origin opens a new tab, any other
|
|
27
|
+
* stays in this tab (`navLinkTarget`).
|
|
28
|
+
*
|
|
26
29
|
* IMPORTANT for embedders: memoize the value passed to
|
|
27
30
|
* `<ChatRuntimeContext.Provider value={...}>` (e.g. via React.useMemo).
|
|
28
31
|
* Every change to its reference identity invalidates downstream
|
|
29
32
|
* `useMemo` consumers (the chat input's slash-commands binding,
|
|
30
|
-
*
|
|
33
|
+
* useDocChat's streamFn factory).
|
|
31
34
|
* The hub's `<HubRuntimeProvider>` already memoizes correctly with
|
|
32
35
|
* stable deps. Embedded apps that build the value inline on each render
|
|
33
36
|
* will pay an avoidable re-render cost across the entire chat tree.
|
|
@@ -208,18 +211,18 @@ export interface ChatRuntime {
|
|
|
208
211
|
* Safari/Firefox block popups opened outside a direct user gesture.
|
|
209
212
|
* Default: window.open(href, '_blank', 'noopener,noreferrer'). */
|
|
210
213
|
openExternal?: (href: string) => void;
|
|
211
|
-
/**
|
|
212
|
-
* Returns `true`
|
|
213
|
-
* (router
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
214
|
+
/** The host's in-app navigation (host mode): every same-tab link the lib
|
|
215
|
+
* executes goes through it. Returns `true` when the host navigated in the app
|
|
216
|
+
* (its router, a docNav swap); `false`, `undefined` or `void` for a target it
|
|
217
|
+
* does not take (another origin), which the browser then opens
|
|
218
|
+
* (`window.location.assign`). Every host wires it: the hub
|
|
219
|
+
* (HubRuntimeProvider), the OpenFrame app (OpenframeChatRuntimeProvider) and
|
|
220
|
+
* the embedding example (its react-router). */
|
|
217
221
|
navigate?: (input: { href: string; path?: string | null; targetPlatform?: string | null }) => boolean | void;
|
|
218
|
-
/** Optional new-tab
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
* same-origin/same-platform → same tab, else new tab. */
|
|
222
|
+
/** Optional new-tab rule of the host's own, for a host whose links need one: returns true → a new tab, false →
|
|
223
|
+
* same tab via `navigate`. Omitted, the lib's rule decides (a named platform other than `source`, or another
|
|
224
|
+
* origin → new tab). The OpenFrame app wires it to ignore `targetPlatform` (its knowledge base tags every row
|
|
225
|
+
* with its own platform); the hub omits it. */
|
|
223
226
|
decideNewTab?: (args: { href: string; targetPlatform?: string | null }) => boolean;
|
|
224
227
|
};
|
|
225
228
|
/** Optional content-URL composer. Returns the platform-aware href +
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useState, useCallback, useEffect } from 'react';
|
|
2
|
+
import { executeNavigationImperative } from '../components/chat/utils/execute-navigation';
|
|
3
|
+
import { isRelativeHref } from '../components/chat/utils/new-tab-rel';
|
|
4
|
+
import { useChatRuntime } from '../contexts/chat-runtime-context';
|
|
2
5
|
import { useRequiredEndpointsRuntime } from '../contexts/endpoints-runtime-context';
|
|
3
|
-
import { useRouter } from '../embed-shims/next-navigation';
|
|
4
6
|
import { apiErrorMessage } from '../utils/common';
|
|
5
7
|
import { contentFetch } from '../utils/embed-content-fetch';
|
|
6
8
|
import { useToast } from './use-toast';
|
|
@@ -46,7 +48,7 @@ interface ContactFormData {
|
|
|
46
48
|
export function useContactSubmission(options: ContactSubmissionOptions = {}) {
|
|
47
49
|
const { userId, successRedirectUrl, successToastMessage, onSuccess } = options;
|
|
48
50
|
const { toast } = useToast();
|
|
49
|
-
const
|
|
51
|
+
const runtime = useChatRuntime();
|
|
50
52
|
// Endpoint URL injected via context — hub provides hub default, embedded
|
|
51
53
|
// app provides its proxied path. Throws if no provider is mounted.
|
|
52
54
|
const { contactUrl } = useRequiredEndpointsRuntime();
|
|
@@ -109,15 +111,18 @@ export function useContactSubmission(options: ContactSubmissionOptions = {}) {
|
|
|
109
111
|
console.log('🚀 Contact submission successful, redirecting to:', successRedirectUrl);
|
|
110
112
|
const timer = setTimeout(() => {
|
|
111
113
|
console.log('🎯 Performing redirect now to:', successRedirectUrl);
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
// A relative redirect is the host's own page (`hostRoute`): it replaces this page in every mode, an embedded
|
|
115
|
+
// form's included. An absolute one follows the navigation rule.
|
|
116
|
+
executeNavigationImperative({
|
|
117
|
+
runtime,
|
|
118
|
+
href: successRedirectUrl,
|
|
119
|
+
openIn: 'same-tab',
|
|
120
|
+
hostRoute: isRelativeHref(successRedirectUrl),
|
|
121
|
+
});
|
|
117
122
|
}, 1500);
|
|
118
123
|
|
|
119
124
|
return () => clearTimeout(timer);
|
|
120
|
-
}, [isSuccess, successRedirectUrl,
|
|
125
|
+
}, [isSuccess, successRedirectUrl, runtime]);
|
|
121
126
|
|
|
122
127
|
// Call onSuccess callback if provided
|
|
123
128
|
useEffect(() => {
|
package/src/utils/index.ts
CHANGED
|
@@ -343,7 +343,7 @@ export { type ScrollElementIntoViewOptions, scrollElementIntoView } from './scro
|
|
|
343
343
|
|
|
344
344
|
// Same-page hash navigation — owns pushState + synthetic hashchange +
|
|
345
345
|
// anchoring-proof scroll. Pair of `scrollElementIntoView`. Used by the
|
|
346
|
-
//
|
|
346
|
+
// `useNavigateViaRuntime` + chat-runtime `navigate`, AND by every
|
|
347
347
|
// embeddable surface that drives state off the URL hash.
|
|
348
348
|
export {
|
|
349
349
|
ACTIVE_ANCHOR_ATTRIBUTE,
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { MouseEvent } from 'react';
|
|
2
|
+
import { executeNewTabNavigation } from '../components/chat/utils/execute-navigation';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* A click handler that opens `href` in a new tab and does nothing else: the
|
|
5
|
-
* "open in new tab" cell of a table whose rows are links themselves.
|
|
6
|
+
* "open in new tab" cell of a table whose rows are links themselves. Opened the
|
|
7
|
+
* one way the lib opens a tab (`executeNewTabNavigation`).
|
|
6
8
|
*/
|
|
7
9
|
export function openInNewTab(href: string) {
|
|
8
10
|
return (event: MouseEvent) => {
|
|
9
11
|
event.preventDefault();
|
|
10
|
-
|
|
12
|
+
executeNewTabNavigation({ runtime: null, href });
|
|
11
13
|
};
|
|
12
14
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* viewport, account for sticky chrome, survive layout shifts" helper.
|
|
4
4
|
*
|
|
5
5
|
* One shared implementation so every caller (the ticket drawer expand, the
|
|
6
|
-
*
|
|
6
|
+
* the lib's navigation executor hash scroll, doc-tree, delivery
|
|
7
7
|
* `?focus=`, sticky-section-nav, …) inherits the SAME cancellation-proof
|
|
8
8
|
* motion.
|
|
9
9
|
*
|