@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.
Files changed (203) hide show
  1. package/dist/build/export-map.json +1 -1
  2. package/dist/{case-study-card-NLT2JVI7.cjs → case-study-card-IZBMHA6R.cjs} +3 -3
  3. package/dist/{chunk-VDXI26G7.cjs → chunk-4XASD2TL.cjs} +81 -78
  4. package/dist/{chunk-5TUR7O7H.cjs → chunk-5AIOYEXW.cjs} +90 -90
  5. package/dist/{chunk-RYJJHSHV.cjs → chunk-5VRSUEC5.cjs} +23 -23
  6. package/dist/{chunk-633NTKO2.cjs → chunk-6QT5K5I5.cjs} +31 -53
  7. package/dist/{chunk-CNTBGJA7.cjs → chunk-A34UNP5V.cjs} +65 -1
  8. package/dist/{chunk-3ELDGEM2.cjs → chunk-AE22KOW3.cjs} +87 -84
  9. package/dist/{chunk-EJCUAADF.cjs → chunk-BD42NMCT.cjs} +4 -4
  10. package/dist/{chunk-7NYWHEQM.cjs → chunk-DGAX5WG2.cjs} +15 -15
  11. package/dist/{chunk-L7W4455K.cjs → chunk-DL4HWYIB.cjs} +3 -3
  12. package/dist/chunk-DVHSYPDB.cjs +471 -0
  13. package/dist/{chunk-GAR2IIU6.cjs → chunk-IM366HS6.cjs} +105 -157
  14. package/dist/{chunk-7ERD34HQ.cjs → chunk-IQCHV7Z2.cjs} +571 -823
  15. package/dist/{chunk-3E4FIJAM.cjs → chunk-JTBJB4JF.cjs} +15 -15
  16. package/dist/{chunk-PAI4A3UM.cjs → chunk-K5IICQNF.cjs} +61 -54
  17. package/dist/{chunk-JOKOQOLJ.cjs → chunk-LUID2IB3.cjs} +2 -2
  18. package/dist/{chunk-JOOZTRXQ.cjs → chunk-NEXMK6OP.cjs} +4 -4
  19. package/dist/{chunk-4PMD3JUC.cjs → chunk-NPNZAAOB.cjs} +2 -2
  20. package/dist/{chunk-JH65CEO4.cjs → chunk-NWIEZUM7.cjs} +36 -36
  21. package/dist/{chunk-HM7VCQSX.cjs → chunk-SBFBNOKU.cjs} +4 -4
  22. package/dist/{chunk-7O7EX7HQ.cjs → chunk-T266OITJ.cjs} +28 -20
  23. package/dist/{chunk-SWBLTIN4.cjs → chunk-U2THWP25.cjs} +54 -52
  24. package/dist/{chunk-F4ZJRMMM.cjs → chunk-UDLDXVY4.cjs} +8 -8
  25. package/dist/{chunk-Y6MJMPHV.cjs → chunk-UEULXVW2.cjs} +32 -84
  26. package/dist/{chunk-O6VWD2SB.cjs → chunk-VGZXB3SY.cjs} +3 -3
  27. package/dist/{chunk-ZAWHRYJZ.cjs → chunk-VRXDTRIY.cjs} +45 -45
  28. package/dist/{chunk-EB7YAUER.cjs → chunk-YHPUD4PM.cjs} +19 -19
  29. package/dist/{chunk-FUEK43FL.cjs → chunk-YMPPE322.cjs} +206 -200
  30. package/dist/{chunk-IKB6AZPV.cjs → chunk-ZECG6GU5.cjs} +2 -2
  31. package/dist/{chunk-53JJLHJM.cjs → chunk-ZWAVMZIF.cjs} +20 -20
  32. package/dist/{cloud-tenants-SRTX2FZC.cjs → cloud-tenants-V6EV4OGK.cjs} +11 -11
  33. package/dist/components/announcement-bar.d.ts.map +1 -1
  34. package/dist/components/announcement-bar.js +5 -5
  35. package/dist/components/case-studies/index.cjs +26 -26
  36. package/dist/components/chat/chat-markdown-link.d.ts +15 -0
  37. package/dist/components/chat/chat-markdown-link.d.ts.map +1 -0
  38. package/dist/components/chat/chat-markdown-link.js +22 -0
  39. package/dist/components/chat/chat-message-enhanced.d.ts.map +1 -1
  40. package/dist/components/chat/chat-message-enhanced.js +3 -9
  41. package/dist/components/chat/embeddable-chat.d.ts +4 -8
  42. package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
  43. package/dist/components/chat/embeddable-chat.js +31 -125
  44. package/dist/components/chat/entity-cards/chat-card-disclosure.d.ts.map +1 -1
  45. package/dist/components/chat/entity-cards/chat-card-disclosure.js +8 -11
  46. package/dist/components/chat/entity-cards/dispatch.d.ts +8 -15
  47. package/dist/components/chat/entity-cards/dispatch.d.ts.map +1 -1
  48. package/dist/components/chat/entity-cards/dispatch.js +22 -40
  49. package/dist/components/chat/entity-cards/github-activity-card.d.ts +1 -1
  50. package/dist/components/chat/entity-cards/use-entity-card-link.d.ts +3 -2
  51. package/dist/components/chat/entity-cards/use-entity-card-link.d.ts.map +1 -1
  52. package/dist/components/chat/entity-cards/use-entity-card-link.js +6 -4
  53. package/dist/components/chat/index.cjs +28 -21
  54. package/dist/components/chat/index.d.ts +2 -2
  55. package/dist/components/chat/index.d.ts.map +1 -1
  56. package/dist/components/chat/index.js +4 -3
  57. package/dist/components/chat/{inline-app-link-chip.d.ts → inline-chip.d.ts} +1 -14
  58. package/dist/components/chat/inline-chip.d.ts.map +1 -0
  59. package/dist/components/chat/inline-chip.js +27 -0
  60. package/dist/components/chat/nav-link-anchor-via-runtime.d.ts +45 -11
  61. package/dist/components/chat/nav-link-anchor-via-runtime.d.ts.map +1 -1
  62. package/dist/components/chat/nav-link-anchor-via-runtime.js +32 -24
  63. package/dist/components/chat/source-action-button.d.ts +12 -3
  64. package/dist/components/chat/source-action-button.d.ts.map +1 -1
  65. package/dist/components/chat/source-action-button.js +41 -26
  66. package/dist/components/chat/types/component.types.d.ts +1 -1
  67. package/dist/components/chat/types/entities/data-room-doc.d.ts +0 -12
  68. package/dist/components/chat/types/entities/data-room-doc.d.ts.map +1 -1
  69. package/dist/components/chat/types/message.types.d.ts +1 -1
  70. package/dist/components/chat/types/message.types.d.ts.map +1 -1
  71. package/dist/components/chat/utils/chat-nav-resolution.d.ts +1 -6
  72. package/dist/components/chat/utils/chat-nav-resolution.d.ts.map +1 -1
  73. package/dist/components/chat/utils/chat-nav-resolution.js +2 -3
  74. package/dist/components/chat/utils/decide-new-tab.d.ts +0 -3
  75. package/dist/components/chat/utils/decide-new-tab.d.ts.map +1 -1
  76. package/dist/components/chat/utils/decide-new-tab.js +0 -1
  77. package/dist/components/chat/utils/execute-navigation.d.ts +36 -34
  78. package/dist/components/chat/utils/execute-navigation.d.ts.map +1 -1
  79. package/dist/components/chat/utils/execute-navigation.js +23 -19
  80. package/dist/components/chat/utils/index.d.ts +5 -5
  81. package/dist/components/chat/utils/index.d.ts.map +1 -1
  82. package/dist/components/chat/utils/index.js +14 -6
  83. package/dist/components/chat/utils/nav-anchor-props.d.ts +35 -8
  84. package/dist/components/chat/utils/nav-anchor-props.d.ts.map +1 -1
  85. package/dist/components/chat/utils/nav-anchor-props.js +14 -5
  86. package/dist/components/chat/utils/new-tab-rel.d.ts +15 -0
  87. package/dist/components/chat/utils/new-tab-rel.d.ts.map +1 -0
  88. package/dist/components/chat/utils/new-tab-rel.js +25 -0
  89. package/dist/components/chat/utils/source-row-cta.d.ts +9 -48
  90. package/dist/components/chat/utils/source-row-cta.d.ts.map +1 -1
  91. package/dist/components/chat/utils/source-row-cta.js +7 -32
  92. package/dist/components/contact/index.cjs +12 -12
  93. package/dist/components/docs/index.cjs +15 -15
  94. package/dist/components/embeds/index.cjs +12 -12
  95. package/dist/components/faq/index.cjs +13 -13
  96. package/dist/components/features/devices/devices-table-columns.d.ts.map +1 -1
  97. package/dist/components/features/devices/devices-table-columns.js +4 -1
  98. package/dist/components/features/index.cjs +11 -11
  99. package/dist/components/help-center-pages/index.cjs +105 -105
  100. package/dist/components/index.cjs +91 -83
  101. package/dist/components/meeting-scheduler/index.cjs +50 -50
  102. package/dist/components/navigation/app-header.d.ts +1 -4
  103. package/dist/components/navigation/app-header.d.ts.map +1 -1
  104. package/dist/components/navigation/app-header.js +0 -2
  105. package/dist/components/navigation/index.cjs +14 -14
  106. package/dist/components/navigation/ticket-alerts-button.d.ts +1 -4
  107. package/dist/components/navigation/ticket-alerts-button.d.ts.map +1 -1
  108. package/dist/components/navigation/ticket-alerts-button.js +5 -5
  109. package/dist/components/onboarding-guides/index.cjs +14 -14
  110. package/dist/components/product-demo/index.cjs +20 -20
  111. package/dist/components/related-content/card-registry.d.ts +1 -1
  112. package/dist/components/related-content/index.cjs +7 -7
  113. package/dist/components/related-content/related-content-section.d.ts +3 -3
  114. package/dist/components/related-content/related-content-section.d.ts.map +1 -1
  115. package/dist/components/related-content/related-content-section.js +5 -3
  116. package/dist/components/shared/doc-search/resolve-search-result-action.d.ts +10 -3
  117. package/dist/components/shared/doc-search/resolve-search-result-action.d.ts.map +1 -1
  118. package/dist/components/shared/doc-search/resolve-search-result-action.js +8 -17
  119. package/dist/components/shared/doc-search/use-doc-search.d.ts.map +1 -1
  120. package/dist/components/shared/doc-search/use-doc-search.js +15 -27
  121. package/dist/components/shared/product-release/product-release-card.d.ts +2 -2
  122. package/dist/components/shared/product-release/product-releases-view.d.ts.map +1 -1
  123. package/dist/components/shared/product-release/product-releases-view.js +1 -3
  124. package/dist/components/tickets/index.cjs +18 -18
  125. package/dist/components/tickets/ticket-detail-drawer.d.ts.map +1 -1
  126. package/dist/components/tickets/ticket-detail-drawer.js +6 -3
  127. package/dist/components/tickets/types.d.ts +1 -1
  128. package/dist/components/ui/button/button.d.ts +1 -1
  129. package/dist/components/ui/hover-dropdown.d.ts +2 -2
  130. package/dist/components/ui/index.cjs +31 -23
  131. package/dist/components/ui/service-card.d.ts.map +1 -1
  132. package/dist/components/ui/service-card.js +4 -1
  133. package/dist/components/vendor-display-button.d.ts.map +1 -1
  134. package/dist/components/vendor-display-button.js +4 -1
  135. package/dist/contexts/chat-runtime-context.d.ts +14 -25
  136. package/dist/contexts/chat-runtime-context.d.ts.map +1 -1
  137. package/dist/{devices-DL4YU64N.cjs → devices-6KZAJAAS.cjs} +12 -12
  138. package/dist/{embeddable-chat-YRKMPFDY.cjs → embeddable-chat-5IHA5SUZ.cjs} +95 -193
  139. package/dist/hooks/index.cjs +5 -5
  140. package/dist/hooks/use-contact-submission.d.ts.map +1 -1
  141. package/dist/hooks/use-contact-submission.js +11 -8
  142. package/dist/index.cjs +40 -34
  143. package/dist/{knowledge-VQW5JL2Z.cjs → knowledge-I7FDQQYJ.cjs} +12 -12
  144. package/dist/{logs-IY3WBLMW.cjs → logs-Q7PAVJUG.cjs} +19 -19
  145. package/dist/{policies-IXWTWMJO.cjs → policies-C3DW5CHS.cjs} +15 -15
  146. package/dist/{scripts-D5CLO5EG.cjs → scripts-BET663HD.cjs} +16 -16
  147. package/dist/{software-update-ULNP6CKJ.cjs → software-update-W7ZQXEPK.cjs} +14 -14
  148. package/dist/utils/index.cjs +116 -89
  149. package/dist/utils/open-in-new-tab.d.ts +2 -1
  150. package/dist/utils/open-in-new-tab.d.ts.map +1 -1
  151. package/dist/utils/open-in-new-tab.js +2 -1
  152. package/dist/utils/scroll-into-view.d.ts +1 -1
  153. package/dist/utils/source-grouping.d.ts +2 -2
  154. package/eslint-config/base.js +11 -0
  155. package/eslint-config/navigation.js +142 -0
  156. package/package.json +1 -1
  157. package/src/components/announcement-bar.tsx +8 -6
  158. package/src/components/chat/chat-markdown-link.tsx +42 -0
  159. package/src/components/chat/chat-message-enhanced.tsx +10 -36
  160. package/src/components/chat/embeddable-chat.tsx +66 -173
  161. package/src/components/chat/entity-cards/chat-card-disclosure.tsx +9 -13
  162. package/src/components/chat/entity-cards/data-room-doc-card.tsx +1 -1
  163. package/src/components/chat/entity-cards/dispatch.tsx +51 -66
  164. package/src/components/chat/entity-cards/github-activity-card.tsx +1 -1
  165. package/src/components/chat/entity-cards/use-entity-card-link.ts +11 -16
  166. package/src/components/chat/index.ts +3 -1
  167. package/src/components/chat/{inline-app-link-chip.tsx → inline-chip.tsx} +1 -27
  168. package/src/components/chat/nav-link-anchor-via-runtime.tsx +73 -33
  169. package/src/components/chat/source-action-button.tsx +57 -33
  170. package/src/components/chat/types/component.types.ts +1 -1
  171. package/src/components/chat/types/entities/data-room-doc.ts +0 -12
  172. package/src/components/chat/types/message.types.ts +1 -1
  173. package/src/components/chat/utils/chat-nav-resolution.ts +3 -8
  174. package/src/components/chat/utils/decide-new-tab.ts +0 -3
  175. package/src/components/chat/utils/execute-navigation.ts +58 -58
  176. package/src/components/chat/utils/index.ts +13 -6
  177. package/src/components/chat/utils/nav-anchor-props.ts +56 -9
  178. package/src/components/chat/utils/new-tab-rel.ts +39 -0
  179. package/src/components/chat/utils/source-row-cta.ts +21 -102
  180. package/src/components/features/devices/devices-table-columns.tsx +4 -1
  181. package/src/components/navigation/app-header.tsx +0 -5
  182. package/src/components/navigation/ticket-alerts-button.tsx +7 -8
  183. package/src/components/related-content/card-registry.tsx +1 -1
  184. package/src/components/related-content/related-content-section.tsx +10 -10
  185. package/src/components/shared/doc-search/resolve-search-result-action.ts +19 -33
  186. package/src/components/shared/doc-search/use-doc-search.ts +21 -44
  187. package/src/components/shared/product-release/product-release-card.tsx +4 -4
  188. package/src/components/shared/product-release/product-releases-view.tsx +2 -5
  189. package/src/components/tickets/ticket-detail-drawer.tsx +7 -4
  190. package/src/components/tickets/types.ts +1 -1
  191. package/src/components/ui/button/button.tsx +2 -2
  192. package/src/components/ui/hover-dropdown.tsx +2 -2
  193. package/src/components/ui/service-card.tsx +4 -1
  194. package/src/components/vendor-display-button.tsx +5 -2
  195. package/src/contexts/chat-runtime-context.tsx +18 -23
  196. package/src/hooks/use-contact-submission.ts +13 -8
  197. package/src/utils/index.ts +1 -1
  198. package/src/utils/open-in-new-tab.ts +4 -2
  199. package/src/utils/scroll-into-view.ts +1 -1
  200. package/src/utils/source-grouping.ts +2 -2
  201. package/dist/chunk-RD66AGUI.cjs +0 -156
  202. package/dist/components/chat/inline-app-link-chip.d.ts.map +0 -1
  203. package/dist/components/chat/inline-app-link-chip.js +0 -37
@@ -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
- * window.open-style download click; missing names degrade to
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 ? () => window.open(url, '_blank', 'noopener,noreferrer') : undefined,
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 `useNavLink` to decide
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 `useNavLink({ href, targetPlatform })`).
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 `useNavLink({ href, targetPlatform })`)
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 `handleChatNavClick` and trigger an in-page doc-tree swap
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 `handleChatNavClick`
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
- window.open(row.href, '_blank', 'noopener,noreferrer');
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 window.open().
30
- window.open(`${externalUrl}/vendor/${vendor.slug}`, '_blank', 'noopener,noreferrer');
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
- * useNavLink's embed-resolution memo, useDocChat's streamFn factory).
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
- /** Optional in-app navigation callback (host-mode only).
212
- * Returns `true` if the host handled the click in-app
213
- * (router.push + docNav.navigate); returns `false`, `undefined`,
214
- * or `void` → lib falls back to window.location.assign(href).
215
- * Hub wires this via HubRuntimeProvider's HubNavigationWiring;
216
- * embedders not in Next.js leave it undefined. */
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 decision callback. Returns true → lib opens in
219
- * new tab; false → same tab via `navigate`. Hub wires the existing
220
- * `decideNewTab` logic from use-nav-link.tsx (re-imports the pure
221
- * helper from lib). Embedders may omit; lib defaults to:
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 +
@@ -240,18 +243,10 @@ export interface ChatRuntime {
240
243
  * Takes a single `ComposeContentUrlInput`: `type` + `identifier` (page
241
244
  * views pass the slug; chat rows pass the id + `externalUrl`, whose path
242
245
  * yields the slug for in-app routing) + optional `platforms` /
243
- * `externalUrl` / `targetPlatform`. */
246
+ * `externalUrl` / `targetPlatform`. A document (a doc-table row: markdown,
247
+ * data-room) arrives with its tree path as the `slug` and no `externalUrl`:
248
+ * the composer decides where that type's viewer is, like any other type. */
244
249
  composeContentUrl?: ComposeContentUrl;
245
- /** Per-`documentType` doc-viewer targets — the UNIFIED, DYNAMIC replacement for
246
- * the single `chipBasePlatform` prop. Maps a doc-table documentType
247
- * (`'markdown'`, `'data_room_doc'`, …) → `{ platform, basePath }` for the PUBLIC
248
- * doc viewer that hosts it. Doc chips with no `externalUrl` resolve PER ROW to
249
- * `getPlatformUrl(platform)/<basePath>/<path>`, so a chat mixing several doc sources
250
- * sends EACH to its own home (markdown→flamingo/knowledge-base,
251
- * data_room_doc→company-hub/data-room) instead of one static fallback. The hub
252
- * may keep using `chipBasePlatform` (one doc source per platform); embedders that
253
- * surface multiple doc sources wire this. Threaded into `resolveSourceRowCTA`. */
254
- docPlatformTargets?: Record<string, { platform: string; basePath: string }>;
255
250
  /** Chat source / platform identifier — OPTIONAL. The hub sets it from
256
251
  * `currentPlatform()`; EMBEDDERS leave it unset and stay platform-agnostic.
257
252
  *
@@ -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 router = useRouter();
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
- if (successRedirectUrl.startsWith('http')) {
113
- window.location.href = successRedirectUrl;
114
- } else {
115
- router.push(successRedirectUrl);
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, router]);
125
+ }, [isSuccess, successRedirectUrl, runtime]);
121
126
 
122
127
  // Call onSuccess callback if provided
123
128
  useEffect(() => {
@@ -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
- // hub's `useUnifiedNav` + chat-runtime `navigate`, AND by every
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
- window.open(href, '_blank', 'noopener,noreferrer');
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
- * hub's `useUnifiedNav` / `use-nav-link` hash scroll, doc-tree, delivery
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
  *
@@ -27,8 +27,8 @@ import { defaultDocumentTypeForTableId, getSourceLabel } from './source-icons';
27
27
 
28
28
  /**
29
29
  * Doc-table documentTypes: whole documents with their own viewer (markdown =
30
- * product docs, data_room_doc = data room). They carry an in-app `path`, an
31
- * embedder keys `docPlatformTargets` by them, and a server never folds them
30
+ * product docs, data_room_doc = data room). They carry an in-app `path` (handed
31
+ * to the host's composer as the slug), and a server never folds them
32
32
  * into one citation (`groupsByTable`); the strip still draws them as one chip
33
33
  * per table. The hub's per-source contract test pins this list to its
34
34
  * doc-table configs.
@@ -1,156 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
2
-
3
-
4
- var _chunkQOAA7ZHBcjs = require('./chunk-QOAA7ZHB.cjs');
5
-
6
-
7
- var _chunk3V5JWG27cjs = require('./chunk-3V5JWG27.cjs');
8
-
9
-
10
- var _chunkUJ7AXHRZcjs = require('./chunk-UJ7AXHRZ.cjs');
11
-
12
-
13
- var _chunk63A4GZMBcjs = require('./chunk-63A4GZMB.cjs');
14
-
15
- // src/hooks/ui/use-image-edge-color.ts
16
- var _react = require('react');
17
- var EDGE_SAMPLE_WIDTH = _chunkQOAA7ZHBcjs.IMAGE_FIXED_WIDTHS[2];
18
- function extractEdgeColor(img) {
19
- const canvas = document.createElement("canvas");
20
- const ctx = canvas.getContext("2d");
21
- if (!ctx) return "#000000";
22
- const maxSize = EDGE_SAMPLE_WIDTH;
23
- const scale = Math.min(maxSize / img.naturalWidth, maxSize / img.naturalHeight);
24
- const w = Math.round(img.naturalWidth * scale);
25
- const h = Math.round(img.naturalHeight * scale);
26
- canvas.width = w;
27
- canvas.height = h;
28
- ctx.drawImage(img, 0, 0, w, h);
29
- const data = ctx.getImageData(0, 0, w, h).data;
30
- const edgeW = Math.max(2, Math.round(w * 0.15));
31
- const edgeH = Math.max(2, Math.round(h * 0.15));
32
- const bucketSize = 32;
33
- const buckets = /* @__PURE__ */ new Map();
34
- for (let y = 0; y < h; y++) {
35
- for (let x = 0; x < w; x++) {
36
- const isEdge = x < edgeW || x >= w - edgeW || y < edgeH || y >= h - edgeH;
37
- if (!isEdge) continue;
38
- const i = (y * w + x) * 4;
39
- const a = data[i + 3];
40
- if (a < 128) continue;
41
- const r2 = data[i];
42
- const g2 = data[i + 1];
43
- const b2 = data[i + 2];
44
- const br = Math.floor(r2 / bucketSize) * bucketSize;
45
- const bg = Math.floor(g2 / bucketSize) * bucketSize;
46
- const bb = Math.floor(b2 / bucketSize) * bucketSize;
47
- const key = `${br},${bg},${bb}`;
48
- const existing = buckets.get(key);
49
- if (existing) {
50
- existing.r += r2;
51
- existing.g += g2;
52
- existing.b += b2;
53
- existing.count++;
54
- } else {
55
- buckets.set(key, { r: r2, g: g2, b: b2, count: 1 });
56
- }
57
- }
58
- }
59
- if (buckets.size === 0) return "#000000";
60
- let bestBucket = null;
61
- for (const bucket of buckets.values()) {
62
- if (!bestBucket || bucket.count > bestBucket.count) {
63
- bestBucket = bucket;
64
- }
65
- }
66
- if (!bestBucket || bestBucket.count === 0) return "#000000";
67
- const r = Math.round(bestBucket.r / bestBucket.count);
68
- const g = Math.round(bestBucket.g / bestBucket.count);
69
- const b = Math.round(bestBucket.b / bestBucket.count);
70
- return `rgb(${r}, ${g}, ${b})`;
71
- }
72
- function useImageEdgeColor(givenUrl, fallback = "#000000") {
73
- const imageUrl = _chunk63A4GZMBcjs.useLoadingScope.call(void 0, ) ? null : givenUrl;
74
- const [color, setColor] = _react.useState.call(void 0, fallback);
75
- const [resetFor, setResetFor] = _react.useState.call(void 0, { imageUrl, fallback });
76
- if (resetFor.imageUrl !== imageUrl || resetFor.fallback !== fallback) {
77
- setResetFor({ imageUrl, fallback });
78
- if (!imageUrl) setColor(fallback);
79
- }
80
- _react.useEffect.call(void 0, () => {
81
- if (!imageUrl) return void 0;
82
- let cancelled = false;
83
- const img = new Image();
84
- img.crossOrigin = "anonymous";
85
- img.onload = () => {
86
- if (cancelled) return;
87
- try {
88
- setColor(extractEdgeColor(img));
89
- } catch (e) {
90
- setColor(fallback);
91
- }
92
- };
93
- const sampleUrl = _chunk3V5JWG27cjs.resizedImageUrl.call(void 0, imageUrl, EDGE_SAMPLE_WIDTH);
94
- let triedOriginal = sampleUrl === imageUrl;
95
- img.onerror = () => {
96
- if (cancelled) return;
97
- if (!triedOriginal) {
98
- triedOriginal = true;
99
- img.src = imageUrl;
100
- return;
101
- }
102
- setColor(fallback);
103
- };
104
- img.src = sampleUrl;
105
- return () => {
106
- cancelled = true;
107
- };
108
- }, [imageUrl, fallback]);
109
- return color;
110
- }
111
-
112
- // src/utils/og-placeholder.ts
113
- var DEFAULT_OG_PLACEHOLDER_PATH = "/api/og-placeholder";
114
- function resolveOgPlaceholderBase(endpoints) {
115
- if (_optionalChain([endpoints, 'optionalAccess', _ => _.ogPlaceholderUrl])) return endpoints.ogPlaceholderUrl;
116
- const imageProxy = _optionalChain([endpoints, 'optionalAccess', _2 => _2.imageProxyUrlPrefix]);
117
- if (imageProxy) {
118
- const derived = imageProxy.replace(/\/image-proxy(?=$|[?/])/, "/og-placeholder");
119
- if (derived !== imageProxy) return derived;
120
- }
121
- return DEFAULT_OG_PLACEHOLDER_PATH;
122
- }
123
- function buildOgPlaceholderUrl(endpoints, title, options = {}) {
124
- const base = resolveOgPlaceholderBase(endpoints);
125
- const qIndex = base.indexOf("?");
126
- const path = qIndex === -1 ? base : base.slice(0, qIndex);
127
- const params = new URLSearchParams(qIndex === -1 ? "" : base.slice(qIndex + 1));
128
- params.set("title", title);
129
- if (options.site) params.set("site", options.site);
130
- const width = _nullishCoalesce(options.width, () => ( (options.aspect === "square" ? 1024 : void 0)));
131
- const height = _nullishCoalesce(options.height, () => ( (options.aspect === "square" ? 1024 : void 0)));
132
- if (Number.isFinite(width)) params.set("w", String(width));
133
- if (Number.isFinite(height)) params.set("h", String(height));
134
- return `${path}?${params.toString()}`;
135
- }
136
-
137
- // src/hooks/use-og-placeholder-url.ts
138
-
139
- function useOgPlaceholderUrl({
140
- title,
141
- siteName = "",
142
- aspect = "wide",
143
- enabled = true
144
- }) {
145
- const endpoints = _optionalChain([_chunkUJ7AXHRZcjs.useChatRuntime.call(void 0, ), 'optionalAccess', _3 => _3.endpoints]);
146
- return _react.useMemo.call(void 0, () => {
147
- if (!enabled || !title) return null;
148
- return buildOgPlaceholderUrl(endpoints, title, { site: siteName || void 0, aspect });
149
- }, [endpoints, title, siteName, aspect, enabled]);
150
- }
151
-
152
-
153
-
154
-
155
-
156
- exports.useImageEdgeColor = useImageEdgeColor; exports.buildOgPlaceholderUrl = buildOgPlaceholderUrl; exports.useOgPlaceholderUrl = useOgPlaceholderUrl;
@@ -1 +0,0 @@
1
- {"version":3,"file":"inline-app-link-chip.d.ts","sourceRoot":"","sources":["../../../src/components/chat/inline-app-link-chip.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,KAAK,EACL,SAAS,EACT,OAAO,GACR,EAAE;IACD,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,KAAK,CAAC,YAAY,CAWrB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,QAAQ,EACR,MAAM,EAAE,MAAM,GACf,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE,CAAC,CAAC;CAChG,GAAG,KAAK,CAAC,YAAY,CAWrB"}
@@ -1,37 +0,0 @@
1
- "use client";
2
- import { jsx } from "react/jsx-runtime";
3
- import Link from "../../embed-shims/next-link.js";
4
- import { cn } from "../../utils/cn.js";
5
- import { BrowserWindowIcon } from "../icons-v2-generated/coding/browser-window-icon.js";
6
- import { Tag } from "../ui/tag.js";
7
- const INLINE_CHIP_CLASS = "max-w-[16rem] align-middle [&_svg]:size-4 [&_svg]:text-ods-text-secondary hover:border-ods-border";
8
- function InlineChip({
9
- icon,
10
- label,
11
- className,
12
- loading
13
- }) {
14
- return /* @__PURE__ */ jsx(
15
- Tag,
16
- {
17
- as: "span",
18
- variant: "badge",
19
- icon,
20
- label,
21
- loading,
22
- className: cn(INLINE_CHIP_CLASS, className)
23
- }
24
- );
25
- }
26
- function InlineAppLinkChip({
27
- href,
28
- children,
29
- anchor: Anchor
30
- }) {
31
- const chip = /* @__PURE__ */ jsx(InlineChip, { icon: /* @__PURE__ */ jsx(BrowserWindowIcon, {}), label: children, className: "hover:bg-ods-bg-hover" });
32
- return Anchor ? /* @__PURE__ */ jsx(Anchor, { href, className: "no-underline", children: chip }) : /* @__PURE__ */ jsx(Link, { href, className: "no-underline", children: chip });
33
- }
34
- export {
35
- InlineAppLinkChip,
36
- InlineChip
37
- };