@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
|
@@ -2,30 +2,28 @@
|
|
|
2
2
|
* THE single navigation-EXECUTION primitive for the whole lib.
|
|
3
3
|
*
|
|
4
4
|
* Link BUILDING is unified by `composeContentUrl`; the new-tab DECISION is
|
|
5
|
-
*
|
|
6
|
-
* that EXECUTES a navigation —
|
|
7
|
-
*
|
|
8
|
-
* surface routes through it:
|
|
9
|
-
* - chat cards / chips / markdown links → `executeNavigation` (click form)
|
|
10
|
-
* via the thin `handleChatNavClick` wrapper.
|
|
5
|
+
* `navLinkTarget` (nav-anchor-props). This is the third leg: ONE place
|
|
6
|
+
* that EXECUTES a navigation — new tab or same tab, in the app through the host's
|
|
7
|
+
* `runtime.navigation.navigate`, or by the browser when the host does not take it.
|
|
8
|
+
* Every surface routes through it:
|
|
9
|
+
* - chat cards / chips / markdown links → `executeNavigation` (click form).
|
|
11
10
|
* - buttons / page rows / form redirects → `executeNavigationImperative` directly.
|
|
12
11
|
*
|
|
13
|
-
* Decision tree
|
|
14
|
-
* behavior is byte-identical; the hub's chat-click behavior MUST NOT change):
|
|
12
|
+
* Decision tree:
|
|
15
13
|
* 1. empty href → no-op (click form preventDefaults + reports handled)
|
|
16
14
|
* 2. (click form) modifier / non-primary button → NOT handled — let the
|
|
17
15
|
* browser do its native thing (`<a>` opens a new tab, etc.)
|
|
18
|
-
* 3. `
|
|
19
|
-
* `window.open
|
|
20
|
-
* 4. else (same-tab) → `runtime.navigation.navigate({href,path,targetPlatform})
|
|
21
|
-
*
|
|
22
|
-
* `window.location.assign
|
|
16
|
+
* 3. `navLinkTarget(...).isNewTab` true → `executeNewTabNavigation` (the host's `openExternal`, else
|
|
17
|
+
* `window.open` with the one referrer rule, `newTabFeatures`)
|
|
18
|
+
* 4. else (same-tab) → `runtime.navigation.navigate({href,path,targetPlatform})`,
|
|
19
|
+
* the host's in-app navigation (every host wires it); a target the host does
|
|
20
|
+
* not take (another origin) is a browser navigation, `window.location.assign`.
|
|
23
21
|
*
|
|
24
|
-
* `runtime` is nullable:
|
|
25
|
-
*
|
|
26
|
-
* new-tab/embed decision to make without a runtime.
|
|
22
|
+
* `runtime` is nullable: a surface with no `ChatRuntimeContext` mounted has no
|
|
23
|
+
* host navigation, so its links are browser navigations.
|
|
27
24
|
*/
|
|
28
25
|
import type { ChatRuntime } from '../../../contexts/chat-runtime-context';
|
|
26
|
+
import { type NavOpenIn } from './nav-anchor-props';
|
|
29
27
|
/** Minimal mouse-event surface — structural so chip buttons / tiles can call it
|
|
30
28
|
* without casting `React.MouseEvent`. */
|
|
31
29
|
export interface NavClickEvent {
|
|
@@ -42,37 +40,41 @@ export interface ExecuteNavigationClickArgs {
|
|
|
42
40
|
href: string;
|
|
43
41
|
path?: string | null;
|
|
44
42
|
targetPlatform?: string | null;
|
|
45
|
-
/**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
/** The host's `composeContentUrl` returned `href` as its own relative route (see `navLinkTarget`). */
|
|
44
|
+
hostRoute?: boolean;
|
|
45
|
+
/** The caller's explicit tab (see `navLinkTarget`). */
|
|
46
|
+
openIn?: NavOpenIn;
|
|
49
47
|
}
|
|
50
48
|
export interface ExecuteNavigationImperativeArgs {
|
|
51
49
|
runtime: ChatRuntime | null | undefined;
|
|
52
50
|
href: string;
|
|
51
|
+
/** Doc-tree path, for a host that swaps a mounted doc viewer in place (`runtime.navigation.navigate`). */
|
|
52
|
+
path?: string | null;
|
|
53
53
|
targetPlatform?: string | null;
|
|
54
|
-
|
|
54
|
+
/** The host's `composeContentUrl` returned `href` as its own relative route (see `navLinkTarget`). */
|
|
55
|
+
hostRoute?: boolean;
|
|
56
|
+
/** The caller's explicit tab (see `navLinkTarget`). */
|
|
57
|
+
openIn?: NavOpenIn;
|
|
55
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Open `href` in a new tab: the host's `openExternal` (through `resolveExternalNavigation`, which absolutizes it in
|
|
61
|
+
* embed mode), else the browser. THE one way the lib opens a tab, for the decision below and for a click that asks
|
|
62
|
+
* for a new tab itself (a modifier click on a row that is not an anchor).
|
|
63
|
+
*/
|
|
64
|
+
export declare function executeNewTabNavigation({ runtime, href, targetPlatform, }: {
|
|
65
|
+
runtime: ChatRuntime | null | undefined;
|
|
66
|
+
href: string;
|
|
67
|
+
targetPlatform?: string | null;
|
|
68
|
+
}): void;
|
|
56
69
|
/**
|
|
57
70
|
* Click-handler form. Returns `true` when it took action (called
|
|
58
71
|
* `preventDefault`); `false` for modifier / non-primary clicks the browser
|
|
59
72
|
* should handle natively. Spread the result into your anchor's `onClick`.
|
|
60
73
|
*/
|
|
61
|
-
export declare function executeNavigation({ event, runtime, href, path, targetPlatform,
|
|
74
|
+
export declare function executeNavigation({ event, runtime, href, path, targetPlatform, hostRoute, openIn, }: ExecuteNavigationClickArgs): boolean;
|
|
62
75
|
/**
|
|
63
76
|
* Imperative form — for buttons, list-row onClicks, and post-action redirects
|
|
64
77
|
* that aren't anchor clicks. Same decision tree, no event/modifier handling.
|
|
65
78
|
*/
|
|
66
|
-
export declare function executeNavigationImperative({ runtime, href, targetPlatform,
|
|
67
|
-
/**
|
|
68
|
-
* @deprecated Call {@link executeNavigation} directly. Kept only so external
|
|
69
|
-
* embedders' imports keep resolving; no lib code path goes through it.
|
|
70
|
-
*/
|
|
71
|
-
export declare function handleChatNavClick(event: NavClickEvent, runtime: ChatRuntime | null | undefined, { href, path, targetPlatform }: ChatNavClickInput, fallbackNavigate?: (path: string) => void): boolean;
|
|
72
|
-
/** @deprecated Argument shape of the deprecated {@link handleChatNavClick}. */
|
|
73
|
-
export interface ChatNavClickInput {
|
|
74
|
-
href: string;
|
|
75
|
-
path?: string | null;
|
|
76
|
-
targetPlatform?: string | null;
|
|
77
|
-
}
|
|
79
|
+
export declare function executeNavigationImperative({ runtime, href, path, targetPlatform, hostRoute, openIn, }: ExecuteNavigationImperativeArgs): void;
|
|
78
80
|
//# sourceMappingURL=execute-navigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute-navigation.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/utils/execute-navigation.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"execute-navigation.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/utils/execute-navigation.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAG1E,OAAO,EAA4B,KAAK,SAAS,EAAiB,MAAM,oBAAoB,CAAC;AAQ7F;0CAC0C;AAC1C,MAAM,WAAW,aAAa;IAC5B,cAAc,IAAI,IAAI,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,sGAAsG;IACtG,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uDAAuD;IACvD,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AAED,MAAM,WAAW,+BAA+B;IAC9C,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,0GAA0G;IAC1G,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,sGAAsG;IACtG,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uDAAuD;IACvD,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,OAAO,EACP,IAAI,EACJ,cAAc,GACf,EAAE;IACD,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC,GAAG,IAAI,CAGP;AAuCD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,cAAc,EACd,SAAS,EACT,MAAM,GACP,EAAE,0BAA0B,GAAG,OAAO,CActC;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,cAAc,EACd,SAAS,EACT,MAAM,GACP,EAAE,+BAA+B,GAAG,IAAI,CAExC"}
|
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { navigateSamePageHash, STICKY_HEADER_OFFSET_PX } from "../../../utils/same-page-hash-nav.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { resolveExternalNavigation, stripSameOriginToPath } from "./chat-nav-resolution.js";
|
|
4
|
+
import { isSameOriginAbsoluteHref, navLinkTarget } from "./nav-anchor-props.js";
|
|
5
|
+
import { newTabFeatures } from "./new-tab-rel.js";
|
|
5
6
|
function isForeignOriginHref(href) {
|
|
6
7
|
return /^https?:\/\//i.test(href) && !isSameOriginAbsoluteHref(href);
|
|
7
8
|
}
|
|
8
|
-
function
|
|
9
|
-
|
|
9
|
+
function executeNewTabNavigation({
|
|
10
|
+
runtime,
|
|
11
|
+
href,
|
|
12
|
+
targetPlatform
|
|
13
|
+
}) {
|
|
14
|
+
if (runtime) resolveExternalNavigation({ href, targetPlatform, runtime }).open();
|
|
15
|
+
else window.open(href, "_blank", newTabFeatures(href, targetPlatform));
|
|
16
|
+
}
|
|
17
|
+
function runNavigation(runtime, href, path, targetPlatform, hostRoute, openIn) {
|
|
18
|
+
const { isNewTab } = navLinkTarget(runtime, href, targetPlatform, { hostRoute, openIn });
|
|
10
19
|
if (isNewTab) {
|
|
11
|
-
|
|
12
|
-
else window.open(href, "_blank", NEW_TAB_FEATURES);
|
|
20
|
+
executeNewTabNavigation({ runtime, href, targetPlatform });
|
|
13
21
|
return;
|
|
14
22
|
}
|
|
15
23
|
const target = isForeignOriginHref(href) ? href : stripSameOriginToPath(href);
|
|
16
24
|
if (target.includes("#") && navigateSamePageHash(target, { headerOffset: STICKY_HEADER_OFFSET_PX })) {
|
|
17
25
|
return;
|
|
18
26
|
}
|
|
19
|
-
|
|
20
|
-
if (!handled) {
|
|
21
|
-
if (fallbackNavigate) fallbackNavigate(target);
|
|
22
|
-
else window.location.assign(target);
|
|
23
|
-
}
|
|
27
|
+
if (!runtime?.navigation.navigate?.({ href, path, targetPlatform })) window.location.assign(target);
|
|
24
28
|
}
|
|
25
29
|
function executeNavigation({
|
|
26
30
|
event,
|
|
@@ -28,7 +32,8 @@ function executeNavigation({
|
|
|
28
32
|
href,
|
|
29
33
|
path,
|
|
30
34
|
targetPlatform,
|
|
31
|
-
|
|
35
|
+
hostRoute,
|
|
36
|
+
openIn
|
|
32
37
|
}) {
|
|
33
38
|
if (!href) {
|
|
34
39
|
event.preventDefault();
|
|
@@ -37,22 +42,21 @@ function executeNavigation({
|
|
|
37
42
|
if (event.button !== void 0 && event.button !== 0) return false;
|
|
38
43
|
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return false;
|
|
39
44
|
event.preventDefault();
|
|
40
|
-
runNavigation(runtime, href, path, targetPlatform,
|
|
45
|
+
runNavigation(runtime, href, path, targetPlatform, hostRoute, openIn);
|
|
41
46
|
return true;
|
|
42
47
|
}
|
|
43
48
|
function executeNavigationImperative({
|
|
44
49
|
runtime,
|
|
45
50
|
href,
|
|
51
|
+
path,
|
|
46
52
|
targetPlatform,
|
|
47
|
-
|
|
53
|
+
hostRoute,
|
|
54
|
+
openIn
|
|
48
55
|
}) {
|
|
49
|
-
runNavigation(runtime, href,
|
|
50
|
-
}
|
|
51
|
-
function handleChatNavClick(event, runtime, { href, path, targetPlatform }, fallbackNavigate) {
|
|
52
|
-
return executeNavigation({ event, runtime, href, path, targetPlatform, fallbackNavigate });
|
|
56
|
+
runNavigation(runtime, href, path, targetPlatform, hostRoute, openIn);
|
|
53
57
|
}
|
|
54
58
|
export {
|
|
55
59
|
executeNavigation,
|
|
56
60
|
executeNavigationImperative,
|
|
57
|
-
|
|
61
|
+
executeNewTabNavigation
|
|
58
62
|
};
|
|
@@ -11,12 +11,12 @@ export { createChatConversationsApi, type ChatConversationsApi, type ChatConvers
|
|
|
11
11
|
export { getCommandText } from './tool-call-helpers';
|
|
12
12
|
export { CHIP_ACTION_BUTTON_CLASS } from './chip-action-class';
|
|
13
13
|
export { chatChipClass, type ChipClassOptions } from './chip-styles';
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export { computeIsNewTab, newTabAnchorAttrs, buildAnchorProps } from './nav-anchor-props';
|
|
14
|
+
export { isModifierClick, stripSameOriginToPath, resolveExternalNavigation, type ExternalNavResolution, } from './chat-nav-resolution';
|
|
15
|
+
export { executeNavigation, executeNavigationImperative, executeNewTabNavigation, type ExecuteNavigationClickArgs, type ExecuteNavigationImperativeArgs, type NavClickEvent, } from './execute-navigation';
|
|
16
|
+
export { computeIsNewTab, navLinkTarget, type NavLinkTarget, type NavOpenIn, newTabAnchorAttrs, buildAnchorProps, } from './nav-anchor-props';
|
|
18
17
|
export { isCrossOriginUrl } from './is-cross-origin-url';
|
|
19
|
-
export {
|
|
18
|
+
export { isRelativeHref, newTabFeatures, newTabRel, type NewTabRel } from './new-tab-rel';
|
|
19
|
+
export { decideNewTab, type DecideNewTabInput, type RuntimeMode } from './decide-new-tab';
|
|
20
20
|
export { flattenAssistantContent } from './flatten-assistant-content';
|
|
21
21
|
export { SCROLL_ANCHOR_WIRE_KEY, parseScrollAnchor } from './scroll-anchor';
|
|
22
22
|
export { SCROLL_ANCHOR, type ScrollAnchor } from '../types/message.types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/utils/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EACL,yBAAyB,EACzB,+BAA+B,EAC/B,KAAK,oBAAoB,GAC1B,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,mCAAmC,EACnC,2BAA2B,GAC5B,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAG/G,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,gCAAgC,EAChC,qBAAqB,EACrB,8BAA8B,EAC9B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,GAC1B,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,0BAA0B,EAC1B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,GAC5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_BUTTON_CLASS } from "./chip-action-class.js";
|
|
25
25
|
import { chatChipClass } from "./chip-styles.js";
|
|
26
26
|
import {
|
|
27
|
-
NEW_TAB_FEATURES,
|
|
28
27
|
isModifierClick,
|
|
29
28
|
stripSameOriginToPath,
|
|
30
29
|
resolveExternalNavigation
|
|
31
30
|
} from "./chat-nav-resolution.js";
|
|
32
|
-
import { handleChatNavClick } from "./execute-navigation.js";
|
|
33
31
|
import {
|
|
34
32
|
executeNavigation,
|
|
35
|
-
executeNavigationImperative
|
|
33
|
+
executeNavigationImperative,
|
|
34
|
+
executeNewTabNavigation
|
|
36
35
|
} from "./execute-navigation.js";
|
|
37
|
-
import {
|
|
36
|
+
import {
|
|
37
|
+
computeIsNewTab,
|
|
38
|
+
navLinkTarget,
|
|
39
|
+
newTabAnchorAttrs,
|
|
40
|
+
buildAnchorProps
|
|
41
|
+
} from "./nav-anchor-props.js";
|
|
38
42
|
import { isCrossOriginUrl } from "./is-cross-origin-url.js";
|
|
43
|
+
import { isRelativeHref, newTabFeatures, newTabRel } from "./new-tab-rel.js";
|
|
39
44
|
import { decideNewTab } from "./decide-new-tab.js";
|
|
40
45
|
import { flattenAssistantContent } from "./flatten-assistant-content.js";
|
|
41
46
|
import { SCROLL_ANCHOR_WIRE_KEY, parseScrollAnchor } from "./scroll-anchor.js";
|
|
@@ -139,7 +144,6 @@ export {
|
|
|
139
144
|
ICON_OPTIONS,
|
|
140
145
|
ICON_REGISTRY,
|
|
141
146
|
MessageSegmentAccumulator,
|
|
142
|
-
NEW_TAB_FEATURES,
|
|
143
147
|
SCROLL_ANCHOR,
|
|
144
148
|
SCROLL_ANCHOR_WIRE_KEY,
|
|
145
149
|
SOURCE_ICON_NAMES,
|
|
@@ -163,6 +167,7 @@ export {
|
|
|
163
167
|
escapeMarkdownInline,
|
|
164
168
|
executeNavigation,
|
|
165
169
|
executeNavigationImperative,
|
|
170
|
+
executeNewTabNavigation,
|
|
166
171
|
extractEntityIdFilter,
|
|
167
172
|
extractErrorMessages,
|
|
168
173
|
extractIncompleteMessageState,
|
|
@@ -179,12 +184,15 @@ export {
|
|
|
179
184
|
getSourceLabel,
|
|
180
185
|
getStatusColorScheme,
|
|
181
186
|
getTaskTypeLabel,
|
|
182
|
-
handleChatNavClick,
|
|
183
187
|
isCrossOriginUrl,
|
|
184
188
|
isModifierClick,
|
|
189
|
+
isRelativeHref,
|
|
185
190
|
maxPersistedStreamSeq,
|
|
186
191
|
mergeHistoryWithRealtime,
|
|
192
|
+
navLinkTarget,
|
|
187
193
|
newTabAnchorAttrs,
|
|
194
|
+
newTabFeatures,
|
|
195
|
+
newTabRel,
|
|
188
196
|
normalizeIconKey,
|
|
189
197
|
parseScrollAnchor,
|
|
190
198
|
parseWireCommandOverride,
|
|
@@ -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
|
*
|
|
@@ -27,23 +27,50 @@
|
|
|
27
27
|
* (cross-platform → new-tab) or the lib's default.
|
|
28
28
|
*/
|
|
29
29
|
import type { ChatRuntime } from '../../../contexts/chat-runtime-context';
|
|
30
|
+
import { type NewTabRel } from './new-tab-rel';
|
|
30
31
|
/** An ABSOLUTE `http(s)` URL on the current page's origin. Relative hrefs return
|
|
31
32
|
* false (in embed mode they're hub-relative, not in-app), as do cross-origin
|
|
32
33
|
* and non-http URLs. SSR-safe: no `window` → false. */
|
|
33
34
|
export declare function isSameOriginAbsoluteHref(href: string): boolean;
|
|
34
35
|
export declare function computeIsNewTab(runtime: ChatRuntime, href: string | null | undefined, targetPlatform: string | null): boolean;
|
|
36
|
+
/** A caller's explicit tab for a link (an admin preview always opens a new tab); absent = the rule decides. */
|
|
37
|
+
export type NavOpenIn = 'new-tab' | 'same-tab';
|
|
38
|
+
/** Where a chat link goes: its href as the runtime resolves it, and whether it opens in a new tab. */
|
|
39
|
+
export interface NavLinkTarget {
|
|
40
|
+
href: string;
|
|
41
|
+
isNewTab: boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* THE navigation decision for every link the lib renders or follows: the href resolved for the runtime
|
|
45
|
+
* (`resolveHrefForRuntime`) and the new-tab rule on that resolved href (`computeIsNewTab`). Anchors
|
|
46
|
+
* (`useNavLinkTarget` / `useNavLinkViaRuntime`), cards, chips, search results and the click executor
|
|
47
|
+
* (`executeNavigation`) all read it; nothing else calls `computeIsNewTab` or `decideNewTab` (a test fails if it does).
|
|
48
|
+
* Without a runtime there is no embed or host rule to apply: the href as given, decided by the lib's default rule
|
|
49
|
+
* (the caller's `openIn`, else another origin opens a new tab).
|
|
50
|
+
*
|
|
51
|
+
* `hostRoute`: the host's `composeContentUrl` returned this href as a RELATIVE route of its own (a type it serves
|
|
52
|
+
* 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
|
|
53
|
+
* tab in any mode (in embed mode a relative href is otherwise taken as hub-relative), unless the caller asks for a new
|
|
54
|
+
* tab itself (`openIn: 'new-tab'`).
|
|
55
|
+
*
|
|
56
|
+
* `openIn`: the caller names the tab itself (an admin preview always opens a new one). The embed rule still comes
|
|
57
|
+
* first: an embedded guest never navigates its host page to the hub.
|
|
58
|
+
*/
|
|
59
|
+
export declare function navLinkTarget(runtime: ChatRuntime | null | undefined, href: string, targetPlatform?: string | null, { hostRoute, openIn }?: {
|
|
60
|
+
hostRoute?: boolean;
|
|
61
|
+
openIn?: NavOpenIn;
|
|
62
|
+
}): NavLinkTarget;
|
|
35
63
|
/**
|
|
36
64
|
* Returns the `target` + `rel` attribute pair for an inner `<a>` based
|
|
37
65
|
* on the new-tab decision. Spread directly into JSX:
|
|
38
66
|
* <a href={href} {...newTabAnchorAttrs(isNewTab)} />
|
|
39
67
|
*
|
|
40
|
-
* Single helper so
|
|
41
|
-
*
|
|
42
|
-
* tab-nabbing) and same-tab links don't render either attribute.
|
|
68
|
+
* Single helper so anchors stay consistent: a new-tab link pairs `_blank` with the one referrer rule
|
|
69
|
+
* (`newTabRel`: `noopener` always, `noreferrer` for a third party) and a same-tab link renders neither.
|
|
43
70
|
*/
|
|
44
|
-
export declare function newTabAnchorAttrs(isNewTab: boolean): {
|
|
71
|
+
export declare function newTabAnchorAttrs(isNewTab: boolean, href?: string | null, targetPlatform?: string | null): {
|
|
45
72
|
target?: '_blank';
|
|
46
|
-
rel?:
|
|
73
|
+
rel?: NewTabRel;
|
|
47
74
|
};
|
|
48
75
|
/**
|
|
49
76
|
* Combine `href` + new-tab attrs into a card's `anchorProps` slot.
|
|
@@ -55,9 +82,9 @@ export declare function newTabAnchorAttrs(isNewTab: boolean): {
|
|
|
55
82
|
* `chatRef.url ? { href: chatRef.url, ...newTabAnchorAttrs(isNewTab) } : undefined`
|
|
56
83
|
* pattern across the 7 dispatcher wrappers.
|
|
57
84
|
*/
|
|
58
|
-
export declare function buildAnchorProps(href: string | null | undefined, isNewTab: boolean): {
|
|
85
|
+
export declare function buildAnchorProps(href: string | null | undefined, isNewTab: boolean, targetPlatform?: string | null): {
|
|
59
86
|
href: string;
|
|
60
87
|
target?: '_blank';
|
|
61
|
-
rel?:
|
|
88
|
+
rel?: NewTabRel;
|
|
62
89
|
} | undefined;
|
|
63
90
|
//# sourceMappingURL=nav-anchor-props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nav-anchor-props.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/utils/nav-anchor-props.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAG1E;;wDAEwD;AACxD,wB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AQ,EAAE,OAAO,EACjB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,EACpB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,GAC7B;IACD,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB,CAEA;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC/B,QAAQ,EAAE,OAAO,EACjB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,GAC7B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,QAAQ,CAAC;IAAC,GAAG,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG,SAAS,CAElE"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { resolveHrefForRuntime } from "./chat-nav-resolution.js";
|
|
2
2
|
import { decideNewTab as libDecideNewTab } from "./decide-new-tab.js";
|
|
3
|
+
import { isRelativeHref, newTabRel } from "./new-tab-rel.js";
|
|
3
4
|
function isSameOriginAbsoluteHref(href) {
|
|
4
5
|
if (typeof window === "undefined") return false;
|
|
5
6
|
if (!/^https?:\/\//i.test(href)) return false;
|
|
@@ -18,15 +19,23 @@ function computeIsNewTab(runtime, href, targetPlatform) {
|
|
|
18
19
|
currentSource: runtime.source ?? ""
|
|
19
20
|
});
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
22
|
+
function navLinkTarget(runtime, href, targetPlatform, { hostRoute = false, openIn } = {}) {
|
|
23
|
+
if (!runtime) return { href, isNewTab: libDecideNewTab({ href, openIn, currentSource: "" }) };
|
|
24
|
+
if (hostRoute && isRelativeHref(href)) return { href, isNewTab: openIn === "new-tab" };
|
|
25
|
+
const resolved = resolveHrefForRuntime(href, runtime);
|
|
26
|
+
const isNewTab = runtime.navigation.mode !== "embed" && openIn ? openIn === "new-tab" : computeIsNewTab(runtime, resolved, targetPlatform ?? null);
|
|
27
|
+
return { href: resolved, isNewTab };
|
|
23
28
|
}
|
|
24
|
-
function
|
|
25
|
-
return
|
|
29
|
+
function newTabAnchorAttrs(isNewTab, href, targetPlatform) {
|
|
30
|
+
return isNewTab ? { target: "_blank", rel: newTabRel(href, targetPlatform) } : {};
|
|
31
|
+
}
|
|
32
|
+
function buildAnchorProps(href, isNewTab, targetPlatform) {
|
|
33
|
+
return href ? { href, ...newTabAnchorAttrs(isNewTab, href, targetPlatform) } : void 0;
|
|
26
34
|
}
|
|
27
35
|
export {
|
|
28
36
|
buildAnchorProps,
|
|
29
37
|
computeIsNewTab,
|
|
30
38
|
isSameOriginAbsoluteHref,
|
|
39
|
+
navLinkTarget,
|
|
31
40
|
newTabAnchorAttrs
|
|
32
41
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
export type NewTabRel = 'noopener' | 'noopener noreferrer';
|
|
10
|
+
/** True for a path with no scheme and no host (`/help-center/x`, `x`); false for `https://…` and `//…`. */
|
|
11
|
+
export declare function isRelativeHref(href: string): boolean;
|
|
12
|
+
export declare function newTabRel(href: string | null | undefined, targetPlatform?: string | null): NewTabRel;
|
|
13
|
+
/** {@link newTabRel} in `window.open` features syntax (comma-separated). */
|
|
14
|
+
export declare function newTabFeatures(href: string | null | undefined, targetPlatform?: string | null): string;
|
|
15
|
+
//# sourceMappingURL=new-tab-rel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-tab-rel.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/utils/new-tab-rel.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,qBAAqB,CAAC;AAE3D,2GAA2G;AAC3G,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAeD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAEpG;AAED,4EAA4E;AAC5E,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAEtG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getPlatformByHostname, isLocalUrl } from "../../../platform-domains.js";
|
|
2
|
+
function isRelativeHref(href) {
|
|
3
|
+
return !/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(href);
|
|
4
|
+
}
|
|
5
|
+
function isOwnSiteHref(href) {
|
|
6
|
+
if (!href) return false;
|
|
7
|
+
if (href.startsWith("/") && !href.startsWith("//")) return true;
|
|
8
|
+
try {
|
|
9
|
+
const url = new URL(href);
|
|
10
|
+
return isLocalUrl(url.href) || getPlatformByHostname(url.hostname) !== null;
|
|
11
|
+
} catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function newTabRel(href, targetPlatform) {
|
|
16
|
+
return targetPlatform || isOwnSiteHref(href) ? "noopener" : "noopener noreferrer";
|
|
17
|
+
}
|
|
18
|
+
function newTabFeatures(href, targetPlatform) {
|
|
19
|
+
return newTabRel(href, targetPlatform).replace(" ", ",");
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
isRelativeHref,
|
|
23
|
+
newTabFeatures,
|
|
24
|
+
newTabRel
|
|
25
|
+
};
|
|
@@ -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.
|
|
@@ -43,18 +40,6 @@ export interface SourceRowInput {
|
|
|
43
40
|
path?: string | null;
|
|
44
41
|
}
|
|
45
42
|
export interface SourceRowContext {
|
|
46
|
-
/** Chat shell's base route — `/data-room`, `/knowledge-base`, etc. */
|
|
47
|
-
baseRoute?: string;
|
|
48
|
-
/** Cross-platform target for the chip / card click. */
|
|
49
|
-
chipBasePlatform?: string;
|
|
50
|
-
/**
|
|
51
|
-
* Host-supplied current-platform identifier. Used as the
|
|
52
|
-
* `targetPlatform` for path-based fallback URLs that point to the
|
|
53
|
-
* host's own surface. When omitted, path-based fallback rows get a
|
|
54
|
-
* `null` targetPlatform — consumers fall back to their legacy
|
|
55
|
-
* origin-check.
|
|
56
|
-
*/
|
|
57
|
-
currentPlatform?: string | null;
|
|
58
43
|
/**
|
|
59
44
|
* Host-supplied reverse map: documentType → tableId. Used to derive
|
|
60
45
|
* `sourceRepo` from `documentType` when the caller didn't supply it
|
|
@@ -64,28 +49,12 @@ export interface SourceRowContext {
|
|
|
64
49
|
*/
|
|
65
50
|
tableIdForDocumentType?: (documentType: string) => string | null;
|
|
66
51
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* types, the hub URL otherwise). When omitted, the row's `externalUrl` is used
|
|
72
|
-
* verbatim (legacy).
|
|
52
|
+
* The host's ONE address rule (`runtime.composeContentUrl`). Every row resolves its href through it: a record by
|
|
53
|
+
* its `externalUrl`, a doc by its tree `path` (passed as the `slug`). The host decides where each type lives and
|
|
54
|
+
* whether that is this site or another platform; the lib builds no address of its own. With no composer, a
|
|
55
|
+
* record's `externalUrl` is used as given and a doc has no link.
|
|
73
56
|
*/
|
|
74
57
|
composeContentUrl?: ComposeContentUrl;
|
|
75
|
-
/**
|
|
76
|
-
* Host-supplied per-`documentType` doc-viewer targets — the UNIFIED, DYNAMIC
|
|
77
|
-
* replacement for the single `chipBasePlatform`. Maps a doc-table documentType
|
|
78
|
-
* (`'markdown'`, `'data_room_doc'`, …) → the platform whose PUBLIC doc viewer
|
|
79
|
-
* hosts it + that viewer's base path. A doc chip with no `externalUrl` resolves
|
|
80
|
-
* to `getPlatformUrl(platform)/<basePath>/<path>` PER ROW — so a chat mixing several
|
|
81
|
-
* doc sources sends EACH to its own home (markdown→flamingo/knowledge-base,
|
|
82
|
-
* data_room_doc→company-hub/data-room) instead of one static fallback for all.
|
|
83
|
-
* Wins over `chipBasePlatform` when a row's documentType has an entry.
|
|
84
|
-
*/
|
|
85
|
-
docPlatformTargets?: Record<string, {
|
|
86
|
-
platform: string;
|
|
87
|
-
basePath: string;
|
|
88
|
-
}>;
|
|
89
58
|
}
|
|
90
59
|
export interface SourceRowCTA {
|
|
91
60
|
/** Source icon component. Always defined — falls back to `FileText`. */
|
|
@@ -106,19 +75,11 @@ export interface SourceRowCTA {
|
|
|
106
75
|
chatRef: ChatRef | null;
|
|
107
76
|
}
|
|
108
77
|
/**
|
|
109
|
-
* Build a `SourceRowContext` from a `ChatRuntime
|
|
110
|
-
*
|
|
111
|
-
* `docPlatformTargets`) are wired identically at every `resolveSourceRowCTA` call site
|
|
112
|
-
* (source chips + inline cards), so they live here once — adding a ctx field is then a
|
|
113
|
-
* one-line change instead of editing all three call sites.
|
|
78
|
+
* Build a `SourceRowContext` from a `ChatRuntime`. Wired identically at every `resolveSourceRowCTA` call site
|
|
79
|
+
* (source chips + inline cards), so it lives here once.
|
|
114
80
|
*/
|
|
115
81
|
export declare function sourceRowCtxFromRuntime(runtime: {
|
|
116
|
-
source?: string;
|
|
117
82
|
composeContentUrl?: ComposeContentUrl;
|
|
118
|
-
docPlatformTargets?: SourceRowContext['docPlatformTargets'];
|
|
119
|
-
}, surface?: {
|
|
120
|
-
baseRoute?: string;
|
|
121
|
-
chipBasePlatform?: string;
|
|
122
83
|
}): SourceRowContext;
|
|
123
84
|
/**
|
|
124
85
|
* Resolve the CTA contract for a row. Pure function — no DOM, no fetch,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-row-cta.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/utils/source-row-cta.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"source-row-cta.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/utils/source-row-cta.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,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