@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
|
@@ -23,6 +23,7 @@ import type React from 'react';
|
|
|
23
23
|
import { cn } from '../../utils/cn';
|
|
24
24
|
import { Button } from '../ui/button';
|
|
25
25
|
import { TextHold } from '../ui/layout-hold';
|
|
26
|
+
import { useLoadingScope } from '../ui/loading-scope';
|
|
26
27
|
import { SKELETON_SURFACE_CLASS } from '../ui/skeleton-surface';
|
|
27
28
|
import type { ChatRef } from './chat-ref.types';
|
|
28
29
|
|
|
@@ -87,33 +88,67 @@ const DENSITY_STYLES: Record<
|
|
|
87
88
|
};
|
|
88
89
|
|
|
89
90
|
/**
|
|
90
|
-
* A footer
|
|
91
|
-
*
|
|
91
|
+
* A card footer's action: a small transparent button with an icon (and a trailing icon when it opens something below
|
|
92
|
+
* the card) and its label, or the icon alone when `showLabel` is off. Its loading form is the same button, inert and
|
|
93
|
+
* unread, with the icons and the label drawn as skeleton bars, so the box is exactly the loaded action's. THE one
|
|
94
|
+
* footer action: the Ask action and a card's "Watch video" both draw it.
|
|
92
95
|
*/
|
|
93
|
-
export function
|
|
96
|
+
export function FooterAction({
|
|
94
97
|
label,
|
|
98
|
+
icon,
|
|
99
|
+
trailingIcon,
|
|
95
100
|
className,
|
|
96
101
|
showLabel = true,
|
|
97
102
|
size = 'small',
|
|
103
|
+
onClick,
|
|
104
|
+
ariaLabel,
|
|
105
|
+
ariaExpanded,
|
|
106
|
+
title,
|
|
107
|
+
loading,
|
|
98
108
|
}: {
|
|
99
109
|
label: string;
|
|
110
|
+
icon: React.ReactNode;
|
|
111
|
+
trailingIcon?: React.ReactNode;
|
|
100
112
|
className: string;
|
|
101
113
|
showLabel?: boolean;
|
|
102
114
|
size?: 'small' | 'icon';
|
|
115
|
+
onClick?: (event: React.MouseEvent) => void;
|
|
116
|
+
ariaLabel?: string;
|
|
117
|
+
ariaExpanded?: boolean;
|
|
118
|
+
title?: string;
|
|
119
|
+
loading?: boolean;
|
|
103
120
|
}): React.ReactElement {
|
|
104
|
-
|
|
121
|
+
if (useLoadingScope() || loading) {
|
|
122
|
+
const mark = <span className={cn(SKELETON_SURFACE_CLASS, 'inline-block h-3 w-3 rounded-sm')} />;
|
|
123
|
+
return (
|
|
124
|
+
<span aria-hidden inert className="contents">
|
|
125
|
+
<Button
|
|
126
|
+
variant="transparent"
|
|
127
|
+
size={size}
|
|
128
|
+
tabIndex={-1}
|
|
129
|
+
leftIcon={showLabel ? mark : undefined}
|
|
130
|
+
rightIcon={trailingIcon ? mark : undefined}
|
|
131
|
+
className={cn(className, 'pointer-events-none')}
|
|
132
|
+
>
|
|
133
|
+
{showLabel ? <TextHold>{label}</TextHold> : mark}
|
|
134
|
+
</Button>
|
|
135
|
+
</span>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
105
138
|
return (
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
139
|
+
<Button
|
|
140
|
+
variant="transparent"
|
|
141
|
+
size={size}
|
|
142
|
+
leftIcon={showLabel ? icon : undefined}
|
|
143
|
+
rightIcon={trailingIcon}
|
|
144
|
+
onClick={onClick}
|
|
145
|
+
aria-label={ariaLabel}
|
|
146
|
+
aria-expanded={ariaExpanded}
|
|
147
|
+
title={title}
|
|
148
|
+
className={className}
|
|
149
|
+
>
|
|
150
|
+
{showLabel ? label : icon}
|
|
151
|
+
</Button>
|
|
117
152
|
);
|
|
118
153
|
}
|
|
119
154
|
|
|
@@ -126,17 +161,6 @@ export function SourceActionButton({
|
|
|
126
161
|
loading,
|
|
127
162
|
}: SourceActionButtonProps): React.ReactElement | null {
|
|
128
163
|
if (!chatRef || !onDiscuss) return null;
|
|
129
|
-
if (loading) {
|
|
130
|
-
const s = DENSITY_STYLES[density];
|
|
131
|
-
return (
|
|
132
|
-
<FooterActionSkeleton
|
|
133
|
-
label={label}
|
|
134
|
-
size={s.size}
|
|
135
|
-
showLabel={s.showLabel}
|
|
136
|
-
className={`${s.className}${className ? ` ${className}` : ''}`}
|
|
137
|
-
/>
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
164
|
|
|
141
165
|
// Label-driven icon. "Display" reads as a verbatim-content action so a
|
|
142
166
|
// FileText icon reinforces "show me the body" semantics; the default
|
|
@@ -154,16 +178,16 @@ export function SourceActionButton({
|
|
|
154
178
|
const icon = <IconComponent className={styles.iconSize} />;
|
|
155
179
|
|
|
156
180
|
return (
|
|
157
|
-
<
|
|
158
|
-
|
|
181
|
+
<FooterAction
|
|
182
|
+
label={label}
|
|
183
|
+
icon={icon}
|
|
159
184
|
size={styles.size}
|
|
160
|
-
|
|
185
|
+
showLabel={styles.showLabel}
|
|
161
186
|
onClick={handle}
|
|
162
|
-
|
|
187
|
+
ariaLabel={verbLabel}
|
|
163
188
|
title={verbLabel}
|
|
164
189
|
className={`${styles.className}${className ? ` ${className}` : ''}`}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
</Button>
|
|
190
|
+
loading={loading}
|
|
191
|
+
/>
|
|
168
192
|
);
|
|
169
193
|
}
|
|
@@ -224,7 +224,7 @@ export interface ChatMessageEnhancedProps extends Omit<HTMLAttributes<HTMLDivEle
|
|
|
224
224
|
/**
|
|
225
225
|
* Host-provided anchor component for markdown links. When supplied, the
|
|
226
226
|
* `<a>` override in the markdown renderer delegates to this component
|
|
227
|
-
* so the host's unified click rule (e.g. `
|
|
227
|
+
* so the host's unified click rule (e.g. `useNavLinkViaRuntime`) owns routing
|
|
228
228
|
* for every link in the message — same-origin → soft RSC nav,
|
|
229
229
|
* cross-origin → new tab, modifier-clicks defer to the browser.
|
|
230
230
|
*
|
|
@@ -470,7 +470,7 @@ export interface ChatSource {
|
|
|
470
470
|
targetPlatform?: string | null;
|
|
471
471
|
/** In-app doc-tree path for markdown / data-room-doc rows so the
|
|
472
472
|
* grouped chip's anchor can trigger an in-page doc-tree swap via
|
|
473
|
-
* `
|
|
473
|
+
* `executeNavigation` (parity with single-row chips + cards). */
|
|
474
474
|
path?: string | null;
|
|
475
475
|
}>;
|
|
476
476
|
/** RagTableConfig.id for this source. */
|
|
@@ -14,14 +14,9 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import type { ChatRuntime } from '../../../contexts/chat-runtime-context';
|
|
17
|
+
import { newTabFeatures } from './new-tab-rel';
|
|
17
18
|
|
|
18
|
-
/**
|
|
19
|
-
* + `noreferrer` to prevent the opened page from accessing
|
|
20
|
-
* window.opener (reverse-tabnabbing class). */
|
|
21
|
-
export const NEW_TAB_FEATURES = 'noopener,noreferrer';
|
|
22
|
-
|
|
23
|
-
/** Modifier-click predicate — matches the existing useNavLink branch
|
|
24
|
-
* (cmd/ctrl/shift/alt OR non-primary mouse button). */
|
|
19
|
+
/** Modifier-click predicate: cmd/ctrl/shift/alt or a non-primary mouse button. */
|
|
25
20
|
export function isModifierClick(e: {
|
|
26
21
|
button?: number;
|
|
27
22
|
metaKey?: boolean;
|
|
@@ -137,7 +132,7 @@ export function resolveExternalNavigation(args: {
|
|
|
137
132
|
if (args.runtime.navigation.openExternal) {
|
|
138
133
|
args.runtime.navigation.openExternal(abs);
|
|
139
134
|
} else {
|
|
140
|
-
window.open(abs, '_blank',
|
|
135
|
+
window.open(abs, '_blank', newTabFeatures(abs, args.targetPlatform));
|
|
141
136
|
}
|
|
142
137
|
};
|
|
143
138
|
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
|
|
21
21
|
import { isCrossOriginUrl } from './is-cross-origin-url';
|
|
22
22
|
|
|
23
|
-
export type NavSurface = 'useNavLink' | 'useUnifiedNav';
|
|
24
23
|
export type RuntimeMode = 'host' | 'embed';
|
|
25
24
|
|
|
26
25
|
export interface DecideNewTabInput {
|
|
@@ -28,8 +27,6 @@ export interface DecideNewTabInput {
|
|
|
28
27
|
targetPlatform?: string | null;
|
|
29
28
|
openIn?: 'new-tab' | 'same-tab';
|
|
30
29
|
alwaysNewTab?: boolean;
|
|
31
|
-
/** Caller tag — labels the decision in any external trace logging. */
|
|
32
|
-
surface?: NavSurface;
|
|
33
30
|
/** Optional chat-runtime mode. When omitted OR set to `'host'`,
|
|
34
31
|
* behavior is byte-equivalent to the legacy logic. Only `'embed'`
|
|
35
32
|
* triggers the new priority-1 branch that forces new-tab. */
|
|
@@ -4,34 +4,32 @@
|
|
|
4
4
|
* THE single navigation-EXECUTION primitive for the whole lib.
|
|
5
5
|
*
|
|
6
6
|
* Link BUILDING is unified by `composeContentUrl`; the new-tab DECISION is
|
|
7
|
-
*
|
|
8
|
-
* that EXECUTES a navigation —
|
|
9
|
-
*
|
|
10
|
-
* surface routes through it:
|
|
11
|
-
* - chat cards / chips / markdown links → `executeNavigation` (click form)
|
|
12
|
-
* via the thin `handleChatNavClick` wrapper.
|
|
7
|
+
* `navLinkTarget` (nav-anchor-props). This is the third leg: ONE place
|
|
8
|
+
* that EXECUTES a navigation — new tab or same tab, in the app through the host's
|
|
9
|
+
* `runtime.navigation.navigate`, or by the browser when the host does not take it.
|
|
10
|
+
* Every surface routes through it:
|
|
11
|
+
* - chat cards / chips / markdown links → `executeNavigation` (click form).
|
|
13
12
|
* - buttons / page rows / form redirects → `executeNavigationImperative` directly.
|
|
14
13
|
*
|
|
15
|
-
* Decision tree
|
|
16
|
-
* behavior is byte-identical; the hub's chat-click behavior MUST NOT change):
|
|
14
|
+
* Decision tree:
|
|
17
15
|
* 1. empty href → no-op (click form preventDefaults + reports handled)
|
|
18
16
|
* 2. (click form) modifier / non-primary button → NOT handled — let the
|
|
19
17
|
* browser do its native thing (`<a>` opens a new tab, etc.)
|
|
20
|
-
* 3. `
|
|
21
|
-
* `window.open
|
|
22
|
-
* 4. else (same-tab) → `runtime.navigation.navigate({href,path,targetPlatform})
|
|
23
|
-
*
|
|
24
|
-
* `window.location.assign
|
|
18
|
+
* 3. `navLinkTarget(...).isNewTab` true → `executeNewTabNavigation` (the host's `openExternal`, else
|
|
19
|
+
* `window.open` with the one referrer rule, `newTabFeatures`)
|
|
20
|
+
* 4. else (same-tab) → `runtime.navigation.navigate({href,path,targetPlatform})`,
|
|
21
|
+
* the host's in-app navigation (every host wires it); a target the host does
|
|
22
|
+
* not take (another origin) is a browser navigation, `window.location.assign`.
|
|
25
23
|
*
|
|
26
|
-
* `runtime` is nullable:
|
|
27
|
-
*
|
|
28
|
-
* new-tab/embed decision to make without a runtime.
|
|
24
|
+
* `runtime` is nullable: a surface with no `ChatRuntimeContext` mounted has no
|
|
25
|
+
* host navigation, so its links are browser navigations.
|
|
29
26
|
*/
|
|
30
27
|
|
|
31
28
|
import type { ChatRuntime } from '../../../contexts/chat-runtime-context';
|
|
32
29
|
import { navigateSamePageHash, STICKY_HEADER_OFFSET_PX } from '../../../utils/same-page-hash-nav';
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
30
|
+
import { resolveExternalNavigation, stripSameOriginToPath } from './chat-nav-resolution';
|
|
31
|
+
import { isSameOriginAbsoluteHref, type NavOpenIn, navLinkTarget } from './nav-anchor-props';
|
|
32
|
+
import { newTabFeatures } from './new-tab-rel';
|
|
35
33
|
|
|
36
34
|
/** Absolute `http(s)` URL pointing at an origin that is not ours. */
|
|
37
35
|
function isForeignOriginHref(href: string): boolean {
|
|
@@ -55,17 +53,40 @@ export interface ExecuteNavigationClickArgs {
|
|
|
55
53
|
href: string;
|
|
56
54
|
path?: string | null;
|
|
57
55
|
targetPlatform?: string | null;
|
|
58
|
-
/**
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
/** The host's `composeContentUrl` returned `href` as its own relative route (see `navLinkTarget`). */
|
|
57
|
+
hostRoute?: boolean;
|
|
58
|
+
/** The caller's explicit tab (see `navLinkTarget`). */
|
|
59
|
+
openIn?: NavOpenIn;
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
export interface ExecuteNavigationImperativeArgs {
|
|
63
|
+
runtime: ChatRuntime | null | undefined;
|
|
64
|
+
href: string;
|
|
65
|
+
/** Doc-tree path, for a host that swaps a mounted doc viewer in place (`runtime.navigation.navigate`). */
|
|
66
|
+
path?: string | null;
|
|
67
|
+
targetPlatform?: string | null;
|
|
68
|
+
/** The host's `composeContentUrl` returned `href` as its own relative route (see `navLinkTarget`). */
|
|
69
|
+
hostRoute?: boolean;
|
|
70
|
+
/** The caller's explicit tab (see `navLinkTarget`). */
|
|
71
|
+
openIn?: NavOpenIn;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Open `href` in a new tab: the host's `openExternal` (through `resolveExternalNavigation`, which absolutizes it in
|
|
76
|
+
* embed mode), else the browser. THE one way the lib opens a tab, for the decision below and for a click that asks
|
|
77
|
+
* for a new tab itself (a modifier click on a row that is not an anchor).
|
|
78
|
+
*/
|
|
79
|
+
export function executeNewTabNavigation({
|
|
80
|
+
runtime,
|
|
81
|
+
href,
|
|
82
|
+
targetPlatform,
|
|
83
|
+
}: {
|
|
65
84
|
runtime: ChatRuntime | null | undefined;
|
|
66
85
|
href: string;
|
|
67
86
|
targetPlatform?: string | null;
|
|
68
|
-
|
|
87
|
+
}): void {
|
|
88
|
+
if (runtime) resolveExternalNavigation({ href, targetPlatform, runtime }).open();
|
|
89
|
+
else window.open(href, '_blank', newTabFeatures(href, targetPlatform));
|
|
69
90
|
}
|
|
70
91
|
|
|
71
92
|
/** Core: make the new-tab decision (when a runtime is present) and execute. */
|
|
@@ -74,13 +95,13 @@ function runNavigation(
|
|
|
74
95
|
href: string,
|
|
75
96
|
path: string | null | undefined,
|
|
76
97
|
targetPlatform: string | null | undefined,
|
|
77
|
-
|
|
98
|
+
hostRoute?: boolean,
|
|
99
|
+
openIn?: NavOpenIn,
|
|
78
100
|
): void {
|
|
79
|
-
//
|
|
80
|
-
const isNewTab =
|
|
101
|
+
// THE navigation decision (no runtime → same tab).
|
|
102
|
+
const { isNewTab } = navLinkTarget(runtime, href, targetPlatform, { hostRoute, openIn });
|
|
81
103
|
if (isNewTab) {
|
|
82
|
-
|
|
83
|
-
else window.open(href, '_blank', NEW_TAB_FEATURES);
|
|
104
|
+
executeNewTabNavigation({ runtime, href, targetPlatform });
|
|
84
105
|
return;
|
|
85
106
|
}
|
|
86
107
|
// A FOREIGN href that the host's `decideNewTab` routed same-tab must reach the
|
|
@@ -97,16 +118,12 @@ function runNavigation(
|
|
|
97
118
|
// neither opens nor scrolls. `navigateSamePageHash` does the pushState AND
|
|
98
119
|
// dispatches the synthetic `hashchange` (+ anchoring-proof scroll). It returns
|
|
99
120
|
// false for cross-page targets (different pathname/search) — those fall through
|
|
100
|
-
// to the host
|
|
121
|
+
// to the host's navigation below, which mounts the new route where the hash is
|
|
101
122
|
// read fresh on first render.
|
|
102
123
|
if (target.includes('#') && navigateSamePageHash(target, { headerOffset: STICKY_HEADER_OFFSET_PX })) {
|
|
103
124
|
return;
|
|
104
125
|
}
|
|
105
|
-
|
|
106
|
-
if (!handled) {
|
|
107
|
-
if (fallbackNavigate) fallbackNavigate(target);
|
|
108
|
-
else window.location.assign(target);
|
|
109
|
-
}
|
|
126
|
+
if (!runtime?.navigation.navigate?.({ href, path, targetPlatform })) window.location.assign(target);
|
|
110
127
|
}
|
|
111
128
|
|
|
112
129
|
/**
|
|
@@ -120,7 +137,8 @@ export function executeNavigation({
|
|
|
120
137
|
href,
|
|
121
138
|
path,
|
|
122
139
|
targetPlatform,
|
|
123
|
-
|
|
140
|
+
hostRoute,
|
|
141
|
+
openIn,
|
|
124
142
|
}: ExecuteNavigationClickArgs): boolean {
|
|
125
143
|
if (!href) {
|
|
126
144
|
event.preventDefault();
|
|
@@ -133,7 +151,7 @@ export function executeNavigation({
|
|
|
133
151
|
if (event.button !== undefined && event.button !== 0) return false;
|
|
134
152
|
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return false;
|
|
135
153
|
event.preventDefault();
|
|
136
|
-
runNavigation(runtime, href, path, targetPlatform,
|
|
154
|
+
runNavigation(runtime, href, path, targetPlatform, hostRoute, openIn);
|
|
137
155
|
return true;
|
|
138
156
|
}
|
|
139
157
|
|
|
@@ -144,28 +162,10 @@ export function executeNavigation({
|
|
|
144
162
|
export function executeNavigationImperative({
|
|
145
163
|
runtime,
|
|
146
164
|
href,
|
|
165
|
+
path,
|
|
147
166
|
targetPlatform,
|
|
148
|
-
|
|
167
|
+
hostRoute,
|
|
168
|
+
openIn,
|
|
149
169
|
}: ExecuteNavigationImperativeArgs): void {
|
|
150
|
-
runNavigation(runtime, href,
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* @deprecated Call {@link executeNavigation} directly. Kept only so external
|
|
155
|
-
* embedders' imports keep resolving; no lib code path goes through it.
|
|
156
|
-
*/
|
|
157
|
-
export function handleChatNavClick(
|
|
158
|
-
event: NavClickEvent,
|
|
159
|
-
runtime: ChatRuntime | null | undefined,
|
|
160
|
-
{ href, path, targetPlatform }: ChatNavClickInput,
|
|
161
|
-
fallbackNavigate?: (path: string) => void,
|
|
162
|
-
): boolean {
|
|
163
|
-
return executeNavigation({ event, runtime, href, path, targetPlatform, fallbackNavigate });
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/** @deprecated Argument shape of the deprecated {@link handleChatNavClick}. */
|
|
167
|
-
export interface ChatNavClickInput {
|
|
168
|
-
href: string;
|
|
169
|
-
path?: string | null;
|
|
170
|
-
targetPlatform?: string | null;
|
|
170
|
+
runNavigation(runtime, href, path, targetPlatform, hostRoute, openIn);
|
|
171
171
|
}
|
|
@@ -55,26 +55,33 @@ export { getCommandText } from './tool-call-helpers';
|
|
|
55
55
|
export { CHIP_ACTION_BUTTON_CLASS } from './chip-action-class';
|
|
56
56
|
export { chatChipClass, type ChipClassOptions } from './chip-styles';
|
|
57
57
|
export {
|
|
58
|
-
NEW_TAB_FEATURES,
|
|
59
58
|
isModifierClick,
|
|
60
59
|
stripSameOriginToPath,
|
|
61
60
|
resolveExternalNavigation,
|
|
62
61
|
type ExternalNavResolution,
|
|
63
62
|
} from './chat-nav-resolution';
|
|
64
|
-
export { handleChatNavClick, type ChatNavClickInput } from './execute-navigation';
|
|
65
63
|
// The unified navigation-execution primitive — single source of truth for
|
|
66
|
-
// new-tab/same-tab + internal/external + embed/host
|
|
67
|
-
//
|
|
64
|
+
// new-tab/same-tab + internal/external + embed/host, through the host's
|
|
65
|
+
// `runtime.navigation.navigate`. Every surface routes through it.
|
|
68
66
|
export {
|
|
69
67
|
executeNavigation,
|
|
70
68
|
executeNavigationImperative,
|
|
69
|
+
executeNewTabNavigation,
|
|
71
70
|
type ExecuteNavigationClickArgs,
|
|
72
71
|
type ExecuteNavigationImperativeArgs,
|
|
73
72
|
type NavClickEvent,
|
|
74
73
|
} from './execute-navigation';
|
|
75
|
-
export {
|
|
74
|
+
export {
|
|
75
|
+
computeIsNewTab,
|
|
76
|
+
navLinkTarget,
|
|
77
|
+
type NavLinkTarget,
|
|
78
|
+
type NavOpenIn,
|
|
79
|
+
newTabAnchorAttrs,
|
|
80
|
+
buildAnchorProps,
|
|
81
|
+
} from './nav-anchor-props';
|
|
76
82
|
export { isCrossOriginUrl } from './is-cross-origin-url';
|
|
77
|
-
export {
|
|
83
|
+
export { isRelativeHref, newTabFeatures, newTabRel, type NewTabRel } from './new-tab-rel';
|
|
84
|
+
export { decideNewTab, type DecideNewTabInput, type RuntimeMode } from './decide-new-tab';
|
|
78
85
|
|
|
79
86
|
// Embed-surface auth moved to `utils/` (embed-proxy-auth-storage /
|
|
80
87
|
// embed-authed-fetch) — import the Embed* names from
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* After the navigation unification (ChatCardLoader pre-resolves
|
|
6
6
|
* `chatRef.url` via `resolveSourceRowCTA` + `resolveHrefForRuntime`,
|
|
7
7
|
* and `ChatCardNavWrap` handles every primary click via `onClickCapture`
|
|
8
|
-
* → `
|
|
8
|
+
* → `executeNavigation`), the per-card wrapper only needs
|
|
9
9
|
* `{href, target, rel}` on its inner `<a>` so modifier-click /
|
|
10
10
|
* hover-preview / copy-link work natively.
|
|
11
11
|
*
|
|
@@ -28,7 +28,9 @@
|
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
import type { ChatRuntime } from '../../../contexts/chat-runtime-context';
|
|
31
|
+
import { resolveHrefForRuntime } from './chat-nav-resolution';
|
|
31
32
|
import { decideNewTab as libDecideNewTab } from './decide-new-tab';
|
|
33
|
+
import { isRelativeHref, newTabRel, type NewTabRel } from './new-tab-rel';
|
|
32
34
|
|
|
33
35
|
/** An ABSOLUTE `http(s)` URL on the current page's origin. Relative hrefs return
|
|
34
36
|
* false (in embed mode they're hub-relative, not in-app), as do cross-origin
|
|
@@ -62,20 +64,64 @@ export function computeIsNewTab(
|
|
|
62
64
|
);
|
|
63
65
|
}
|
|
64
66
|
|
|
67
|
+
/** A caller's explicit tab for a link (an admin preview always opens a new tab); absent = the rule decides. */
|
|
68
|
+
export type NavOpenIn = 'new-tab' | 'same-tab';
|
|
69
|
+
|
|
70
|
+
/** Where a chat link goes: its href as the runtime resolves it, and whether it opens in a new tab. */
|
|
71
|
+
export interface NavLinkTarget {
|
|
72
|
+
href: string;
|
|
73
|
+
isNewTab: boolean;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* THE navigation decision for every link the lib renders or follows: the href resolved for the runtime
|
|
78
|
+
* (`resolveHrefForRuntime`) and the new-tab rule on that resolved href (`computeIsNewTab`). Anchors
|
|
79
|
+
* (`useNavLinkTarget` / `useNavLinkViaRuntime`), cards, chips, search results and the click executor
|
|
80
|
+
* (`executeNavigation`) all read it; nothing else calls `computeIsNewTab` or `decideNewTab` (a test fails if it does).
|
|
81
|
+
* Without a runtime there is no embed or host rule to apply: the href as given, decided by the lib's default rule
|
|
82
|
+
* (the caller's `openIn`, else another origin opens a new tab).
|
|
83
|
+
*
|
|
84
|
+
* `hostRoute`: the host's `composeContentUrl` returned this href as a RELATIVE route of its own (a type it serves
|
|
85
|
+
* in-app). It is the host's page, not the hub's, so it is never resolved against the hub's origin and stays in this
|
|
86
|
+
* tab in any mode (in embed mode a relative href is otherwise taken as hub-relative), unless the caller asks for a new
|
|
87
|
+
* tab itself (`openIn: 'new-tab'`).
|
|
88
|
+
*
|
|
89
|
+
* `openIn`: the caller names the tab itself (an admin preview always opens a new one). The embed rule still comes
|
|
90
|
+
* first: an embedded guest never navigates its host page to the hub.
|
|
91
|
+
*/
|
|
92
|
+
export function navLinkTarget(
|
|
93
|
+
runtime: ChatRuntime | null | undefined,
|
|
94
|
+
href: string,
|
|
95
|
+
targetPlatform?: string | null,
|
|
96
|
+
{ hostRoute = false, openIn }: { hostRoute?: boolean; openIn?: NavOpenIn } = {},
|
|
97
|
+
): NavLinkTarget {
|
|
98
|
+
if (!runtime) return { href, isNewTab: libDecideNewTab({ href, openIn, currentSource: '' }) };
|
|
99
|
+
if (hostRoute && isRelativeHref(href)) return { href, isNewTab: openIn === 'new-tab' };
|
|
100
|
+
const resolved = resolveHrefForRuntime(href, runtime);
|
|
101
|
+
const isNewTab =
|
|
102
|
+
runtime.navigation.mode !== 'embed' && openIn
|
|
103
|
+
? openIn === 'new-tab'
|
|
104
|
+
: computeIsNewTab(runtime, resolved, targetPlatform ?? null);
|
|
105
|
+
return { href: resolved, isNewTab };
|
|
106
|
+
}
|
|
107
|
+
|
|
65
108
|
/**
|
|
66
109
|
* Returns the `target` + `rel` attribute pair for an inner `<a>` based
|
|
67
110
|
* on the new-tab decision. Spread directly into JSX:
|
|
68
111
|
* <a href={href} {...newTabAnchorAttrs(isNewTab)} />
|
|
69
112
|
*
|
|
70
|
-
* Single helper so
|
|
71
|
-
*
|
|
72
|
-
* tab-nabbing) and same-tab links don't render either attribute.
|
|
113
|
+
* Single helper so anchors stay consistent: a new-tab link pairs `_blank` with the one referrer rule
|
|
114
|
+
* (`newTabRel`: `noopener` always, `noreferrer` for a third party) and a same-tab link renders neither.
|
|
73
115
|
*/
|
|
74
|
-
export function newTabAnchorAttrs(
|
|
116
|
+
export function newTabAnchorAttrs(
|
|
117
|
+
isNewTab: boolean,
|
|
118
|
+
href?: string | null,
|
|
119
|
+
targetPlatform?: string | null,
|
|
120
|
+
): {
|
|
75
121
|
target?: '_blank';
|
|
76
|
-
rel?:
|
|
122
|
+
rel?: NewTabRel;
|
|
77
123
|
} {
|
|
78
|
-
return isNewTab ? { target: '_blank' as const, rel:
|
|
124
|
+
return isNewTab ? { target: '_blank' as const, rel: newTabRel(href, targetPlatform) } : {};
|
|
79
125
|
}
|
|
80
126
|
|
|
81
127
|
/**
|
|
@@ -91,6 +137,7 @@ export function newTabAnchorAttrs(isNewTab: boolean): {
|
|
|
91
137
|
export function buildAnchorProps(
|
|
92
138
|
href: string | null | undefined,
|
|
93
139
|
isNewTab: boolean,
|
|
94
|
-
|
|
95
|
-
|
|
140
|
+
targetPlatform?: string | null,
|
|
141
|
+
): { href: string; target?: '_blank'; rel?: NewTabRel } | undefined {
|
|
142
|
+
return href ? { href, ...newTabAnchorAttrs(isNewTab, href, targetPlatform) } : undefined;
|
|
96
143
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a link opened in a new tab tells its destination. A destination on one of OUR platforms (named by the
|
|
3
|
+
* composer's `targetPlatform`, or an href on a platform's own host, or a path of the current site) keeps the Referer:
|
|
4
|
+
* HubSpot and PostHog attribute the cross-domain visit by it, and `noreferrer` turned every trial signup into direct
|
|
5
|
+
* traffic. Anything else is a third party and also gets `noreferrer`. `noopener` always (tab-nabbing).
|
|
6
|
+
*
|
|
7
|
+
* THE one rule for a new tab, for an anchor's `rel` and for `window.open`'s features alike.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { getPlatformByHostname, isLocalUrl } from '../../../platform-domains';
|
|
11
|
+
|
|
12
|
+
export type NewTabRel = 'noopener' | 'noopener noreferrer';
|
|
13
|
+
|
|
14
|
+
/** True for a path with no scheme and no host (`/help-center/x`, `x`); false for `https://…` and `//…`. */
|
|
15
|
+
export function isRelativeHref(href: string): boolean {
|
|
16
|
+
return !/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(href);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** A path on this site (`/x`), or an absolute URL on a platform's own host (or a local one). Not a bare anchor
|
|
20
|
+
* (`#x`), a `mailto:` or any other scheme, and not a protocol-relative `//host`. */
|
|
21
|
+
function isOwnSiteHref(href: string | null | undefined): boolean {
|
|
22
|
+
if (!href) return false;
|
|
23
|
+
if (href.startsWith('/') && !href.startsWith('//')) return true;
|
|
24
|
+
try {
|
|
25
|
+
const url = new URL(href);
|
|
26
|
+
return isLocalUrl(url.href) || getPlatformByHostname(url.hostname) !== null;
|
|
27
|
+
} catch {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function newTabRel(href: string | null | undefined, targetPlatform?: string | null): NewTabRel {
|
|
33
|
+
return targetPlatform || isOwnSiteHref(href) ? 'noopener' : 'noopener noreferrer';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** {@link newTabRel} in `window.open` features syntax (comma-separated). */
|
|
37
|
+
export function newTabFeatures(href: string | null | undefined, targetPlatform?: string | null): string {
|
|
38
|
+
return newTabRel(href, targetPlatform).replace(' ', ',');
|
|
39
|
+
}
|
|
@@ -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
|