@flamingo-stack/openframe-frontend-core 0.0.827 → 0.0.829

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 (151) hide show
  1. package/dist/build/export-map.json +1 -1
  2. package/dist/chat-protocol/frames.d.ts +2 -0
  3. package/dist/chat-protocol/frames.d.ts.map +1 -1
  4. package/dist/chat-protocol/index.cjs +9 -6
  5. package/dist/chat-protocol/progress.d.ts +2 -1
  6. package/dist/chat-protocol/progress.d.ts.map +1 -1
  7. package/dist/chat-protocol/progress.js +6 -6
  8. package/dist/{chunk-ALRX2VIY.cjs → chunk-4DUVTJ6A.cjs} +13 -13
  9. package/dist/{chunk-B5H7RKFF.cjs → chunk-4ZIKDOPY.cjs} +4 -4
  10. package/dist/{chunk-6SFCI6D4.cjs → chunk-6WNSZ5XP.cjs} +12 -14
  11. package/dist/{chunk-UULSSD56.cjs → chunk-AH4YWTWZ.cjs} +5 -5
  12. package/dist/{chunk-7VC5FVWT.cjs → chunk-DWSU35QQ.cjs} +62 -62
  13. package/dist/{chunk-3WKQ2GCR.cjs → chunk-HMC2IWV4.cjs} +4 -6
  14. package/dist/{chunk-RPKWEBHC.cjs → chunk-IBQ3CSKL.cjs} +3 -3
  15. package/dist/{chunk-ZT7JHN7G.cjs → chunk-IFLGIBFZ.cjs} +54 -59
  16. package/dist/{chunk-4ZH7RPEA.cjs → chunk-IHRMX3X6.cjs} +154 -154
  17. package/dist/{chunk-6ZLCEIIC.cjs → chunk-IMDYB77M.cjs} +21 -21
  18. package/dist/chunk-IX2E3AN7.cjs +77 -0
  19. package/dist/{chunk-VAIML6YU.cjs → chunk-LNXRTVOY.cjs} +13 -13
  20. package/dist/{chunk-QMQWXGCH.cjs → chunk-MFYSV7DE.cjs} +23 -19
  21. package/dist/{chunk-K6X7VP2Y.cjs → chunk-PRZAEPGG.cjs} +41 -41
  22. package/dist/{chunk-XPF74L76.cjs → chunk-R3PKAIX3.cjs} +2 -2
  23. package/dist/{chunk-UWGPYAB3.cjs → chunk-THPAGFT6.cjs} +47 -47
  24. package/dist/{chunk-DR4P7AEU.cjs → chunk-UE5ZBCJ4.cjs} +3 -3
  25. package/dist/{chunk-BGT6JFMP.cjs → chunk-UO6F6LLI.cjs} +41 -5
  26. package/dist/{chunk-SVCTAOJR.cjs → chunk-YHQDB5QJ.cjs} +2 -2
  27. package/dist/{chunk-YKUL6JBI.cjs → chunk-ZJXLNIWC.cjs} +46 -34
  28. package/dist/{cloud-tenants-LKTWIZNS.cjs → cloud-tenants-YVCSVVIS.cjs} +8 -7
  29. package/dist/components/case-studies/index.cjs +20 -19
  30. package/dist/components/chat/assistant-ask-prompts.d.ts +5 -1
  31. package/dist/components/chat/assistant-ask-prompts.d.ts.map +1 -1
  32. package/dist/components/chat/assistant-ask-prompts.js +3 -1
  33. package/dist/components/chat/embeddable-chat.js +1 -0
  34. package/dist/components/chat/guide-welcome.d.ts +10 -1
  35. package/dist/components/chat/guide-welcome.d.ts.map +1 -1
  36. package/dist/components/chat/guide-welcome.js +12 -2
  37. package/dist/components/chat/hooks/use-empty-state-config.d.ts +13 -3
  38. package/dist/components/chat/hooks/use-empty-state-config.d.ts.map +1 -1
  39. package/dist/components/chat/hooks/use-empty-state-config.js +10 -2
  40. package/dist/components/chat/index.cjs +7 -3
  41. package/dist/components/contact/index.cjs +9 -8
  42. package/dist/components/docs/index.cjs +12 -11
  43. package/dist/components/embeds/index.cjs +9 -8
  44. package/dist/components/faq/faq-ask-card.d.ts +2 -13
  45. package/dist/components/faq/faq-ask-card.d.ts.map +1 -1
  46. package/dist/components/faq/faq-ask-card.js +1 -2
  47. package/dist/components/faq/faq-document-page.d.ts +2 -4
  48. package/dist/components/faq/faq-document-page.d.ts.map +1 -1
  49. package/dist/components/faq/faq-document-page.js +0 -2
  50. package/dist/components/faq/faq-section.d.ts +16 -29
  51. package/dist/components/faq/faq-section.d.ts.map +1 -1
  52. package/dist/components/faq/faq-section.js +23 -15
  53. package/dist/components/faq/index.cjs +10 -9
  54. package/dist/components/faq/index.d.ts +1 -1
  55. package/dist/components/faq/index.d.ts.map +1 -1
  56. package/dist/components/faq/index.js +2 -2
  57. package/dist/components/features/index.cjs +8 -7
  58. package/dist/components/help-center-pages/delivery-page.d.ts +1 -8
  59. package/dist/components/help-center-pages/delivery-page.d.ts.map +1 -1
  60. package/dist/components/help-center-pages/delivery-page.js +4 -16
  61. package/dist/components/help-center-pages/download-apps-page.d.ts +1 -8
  62. package/dist/components/help-center-pages/download-apps-page.d.ts.map +1 -1
  63. package/dist/components/help-center-pages/download-apps-page.js +3 -4
  64. package/dist/components/help-center-pages/index.cjs +114 -162
  65. package/dist/components/help-center-pages/onboarding-guides-catalog-page.d.ts +1 -8
  66. package/dist/components/help-center-pages/onboarding-guides-catalog-page.d.ts.map +1 -1
  67. package/dist/components/help-center-pages/onboarding-guides-catalog-page.js +14 -26
  68. package/dist/components/help-center-pages/product-releases-list-page.d.ts +1 -8
  69. package/dist/components/help-center-pages/product-releases-list-page.d.ts.map +1 -1
  70. package/dist/components/help-center-pages/product-releases-list-page.js +12 -24
  71. package/dist/components/help-center-pages/roadmap-page.d.ts +1 -8
  72. package/dist/components/help-center-pages/roadmap-page.d.ts.map +1 -1
  73. package/dist/components/help-center-pages/roadmap-page.js +13 -25
  74. package/dist/components/help-center-pages/trust-center-page.d.ts +1 -1
  75. package/dist/components/help-center-pages/trust-center-page.d.ts.map +1 -1
  76. package/dist/components/index.cjs +50 -45
  77. package/dist/components/index.d.ts +1 -0
  78. package/dist/components/index.d.ts.map +1 -1
  79. package/dist/components/index.js +1 -0
  80. package/dist/components/meeting-scheduler/index.cjs +39 -38
  81. package/dist/components/navigation/index.cjs +11 -10
  82. package/dist/components/onboarding-guides/index.cjs +10 -9
  83. package/dist/components/page-topic-label.d.ts +13 -0
  84. package/dist/components/page-topic-label.d.ts.map +1 -0
  85. package/dist/components/page-topic-label.js +20 -0
  86. package/dist/components/product-demo/index.cjs +17 -16
  87. package/dist/components/shared/dev-section/dev-section-page.d.ts +1 -8
  88. package/dist/components/shared/dev-section/dev-section-page.d.ts.map +1 -1
  89. package/dist/components/shared/dev-section/dev-section-page.js +2 -3
  90. package/dist/components/shared/legal-document/legal-document-page.d.ts +2 -10
  91. package/dist/components/shared/legal-document/legal-document-page.d.ts.map +1 -1
  92. package/dist/components/shared/legal-document/legal-document-page.js +2 -5
  93. package/dist/components/shared/legal-document/use-legal-documents.d.ts +0 -2
  94. package/dist/components/shared/legal-document/use-legal-documents.d.ts.map +1 -1
  95. package/dist/components/shared/legal-document/use-legal-documents.js +0 -1
  96. package/dist/components/tickets/index.cjs +13 -12
  97. package/dist/components/ui/index.cjs +10 -7
  98. package/dist/contexts/endpoints-runtime-context.d.ts +5 -0
  99. package/dist/contexts/endpoints-runtime-context.d.ts.map +1 -1
  100. package/dist/contexts/index.cjs +10 -1
  101. package/dist/contexts/index.d.ts +1 -0
  102. package/dist/contexts/index.d.ts.map +1 -1
  103. package/dist/contexts/index.js +4 -0
  104. package/dist/contexts/page-topics-context.d.ts +30 -0
  105. package/dist/contexts/page-topics-context.d.ts.map +1 -0
  106. package/dist/contexts/page-topics-context.js +27 -0
  107. package/dist/{devices-JWG72ANF.cjs → devices-AW6BERJF.cjs} +9 -8
  108. package/dist/{embeddable-chat-5UT6UHEO.cjs → embeddable-chat-ZJIOMMSA.cjs} +74 -71
  109. package/dist/hooks/index.cjs +3 -3
  110. package/dist/index.cjs +25 -11
  111. package/dist/{knowledge-DQXVSHME.cjs → knowledge-PEOXTIVS.cjs} +9 -8
  112. package/dist/{logs-Z33VBTVX.cjs → logs-CYA7H4KM.cjs} +15 -14
  113. package/dist/{policies-XE4UMH6Z.cjs → policies-M6QSFL5G.cjs} +12 -11
  114. package/dist/{scripts-MECQG5GG.cjs → scripts-Y46ECDDP.cjs} +13 -12
  115. package/dist/{software-update-PCSIA6BP.cjs → software-update-OTC2DGQZ.cjs} +11 -10
  116. package/dist/utils/index.cjs +46 -0
  117. package/dist/utils/index.d.ts +1 -0
  118. package/dist/utils/index.d.ts.map +1 -1
  119. package/dist/utils/index.js +12 -0
  120. package/dist/utils/page-topics.cjs +48 -0
  121. package/dist/utils/page-topics.d.ts +34 -0
  122. package/dist/utils/page-topics.d.ts.map +1 -0
  123. package/dist/utils/page-topics.js +46 -0
  124. package/package.json +7 -1
  125. package/src/chat-protocol/frames.ts +3 -0
  126. package/src/chat-protocol/progress.ts +11 -10
  127. package/src/components/chat/assistant-ask-prompts.tsx +8 -2
  128. package/src/components/chat/embeddable-chat.tsx +3 -0
  129. package/src/components/chat/guide-welcome.tsx +26 -2
  130. package/src/components/chat/hooks/use-empty-state-config.ts +22 -5
  131. package/src/components/faq/faq-ask-card.tsx +2 -12
  132. package/src/components/faq/faq-document-page.tsx +1 -5
  133. package/src/components/faq/faq-section.tsx +47 -50
  134. package/src/components/faq/index.ts +1 -2
  135. package/src/components/help-center-pages/delivery-page.tsx +1 -16
  136. package/src/components/help-center-pages/download-apps-page.tsx +2 -9
  137. package/src/components/help-center-pages/onboarding-guides-catalog-page.tsx +1 -16
  138. package/src/components/help-center-pages/product-releases-list-page.tsx +1 -16
  139. package/src/components/help-center-pages/roadmap-page.tsx +1 -16
  140. package/src/components/help-center-pages/trust-center-page.tsx +1 -1
  141. package/src/components/index.ts +1 -0
  142. package/src/components/page-topic-label.tsx +30 -0
  143. package/src/components/shared/dev-section/dev-section-page.tsx +2 -9
  144. package/src/components/shared/legal-document/legal-document-page.tsx +3 -13
  145. package/src/components/shared/legal-document/use-legal-documents.ts +0 -3
  146. package/src/contexts/endpoints-runtime-context.tsx +5 -0
  147. package/src/contexts/index.ts +1 -0
  148. package/src/contexts/page-topics-context.tsx +68 -0
  149. package/src/utils/index.ts +8 -0
  150. package/src/utils/page-topics.ts +81 -0
  151. package/dist/{chunk-IKWQW3YJ.cjs → chunk-AY6XJOIN.cjs} +4 -4
@@ -0,0 +1,46 @@
1
+ const HOME_PATH = "/";
2
+ function decodeSegment(segment) {
3
+ try {
4
+ return decodeURIComponent(segment);
5
+ } catch {
6
+ return segment;
7
+ }
8
+ }
9
+ function normalizePath(pathname) {
10
+ const segments = (pathname.split(/[?#]/)[0] ?? "").split("/").filter(Boolean).map((segment) => decodeSegment(segment).toLowerCase());
11
+ return segments.length === 0 ? HOME_PATH : `/${segments.join("/")}`;
12
+ }
13
+ function pageTopicFor(pathname, options = {}) {
14
+ const path = normalizePath(pathname);
15
+ const base = options.basePath ? normalizePath(options.basePath) : HOME_PATH;
16
+ if (base === HOME_PATH) return path;
17
+ if (path === base) return HOME_PATH;
18
+ return path.startsWith(`${base}/`) ? path.slice(base.length) : path;
19
+ }
20
+ function isPagePathTopic(tag) {
21
+ return tag.startsWith(HOME_PATH);
22
+ }
23
+ function topicMatchesPath(tag, path) {
24
+ if (!isPagePathTopic(tag)) return tag === path;
25
+ if (tag === HOME_PATH || path === HOME_PATH) return tag === path;
26
+ return path === tag || path.startsWith(`${tag}/`);
27
+ }
28
+ function topicCandidates(path) {
29
+ if (!isPagePathTopic(path) || path === HOME_PATH) return [path];
30
+ const segments = path.split("/").filter(Boolean);
31
+ return segments.map((_, i) => `/${segments.slice(0, segments.length - i).join("/")}`);
32
+ }
33
+ function deepestTopic(tags, path) {
34
+ let best = null;
35
+ for (const tag of tags) {
36
+ if (topicMatchesPath(tag, path) && (best === null || tag.length > best.length)) best = tag;
37
+ }
38
+ return best;
39
+ }
40
+ export {
41
+ deepestTopic,
42
+ isPagePathTopic,
43
+ pageTopicFor,
44
+ topicCandidates,
45
+ topicMatchesPath
46
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flamingo-stack/openframe-frontend-core",
3
- "version": "0.0.827",
3
+ "version": "0.0.829",
4
4
  "description": "Shared design system and components for all Flamingo platforms",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -281,6 +281,12 @@
281
281
  "require": "./dist/utils/form-rescue.cjs",
282
282
  "default": "./dist/utils/form-rescue.js"
283
283
  },
284
+ "./utils/page-topics": {
285
+ "types": "./dist/utils/page-topics.d.ts",
286
+ "import": "./dist/utils/page-topics.js",
287
+ "require": "./dist/utils/page-topics.cjs",
288
+ "default": "./dist/utils/page-topics.js"
289
+ },
284
290
  "./utils/mobile-app": {
285
291
  "types": "./dist/utils/mobile-app.d.ts",
286
292
  "import": "./dist/utils/mobile-app.js",
@@ -18,6 +18,8 @@
18
18
  * Server-safe: no React, no browser APIs beyond TextEncoder/TextDecoder.
19
19
  */
20
20
 
21
+ import type { ToolType } from '../types/tool.types';
22
+
21
23
  // =============================================================================
22
24
  // Sentinel constants
23
25
  // =============================================================================
@@ -88,6 +90,7 @@ export interface StatusThinkingFrame {
88
90
  * `decodeNatsChunk` and the chat draws it as that run's row. */
89
91
  export interface ToolExecutionFrame {
90
92
  type: 'EXECUTING_TOOL' | 'EXECUTED_TOOL';
93
+ integratedToolType: ToolType;
91
94
  toolFunction: string;
92
95
  title: string;
93
96
  toolExecutionRequestId: string;
@@ -11,6 +11,7 @@
11
11
  * Server-safe: no React, no browser APIs.
12
12
  */
13
13
 
14
+ import { ToolTypeValues } from '../types/tool.types';
14
15
  import type { ToolExecutionFrame } from './frames';
15
16
 
16
17
  export const CHAT_PROGRESS_STAGES = ['understanding', 'searching', 'searching_again', 'reading'] as const;
@@ -37,7 +38,8 @@ export function chatProgressLabel(progress: ChatProgress): string {
37
38
 
38
39
  /**
39
40
  * The frame for a stage of one turn: `running` opens its row, `done` or `failed` closes it. `turnId` keeps the row's id
40
- * unique to the turn, since a closing frame updates the open row of the same id anywhere in the thread.
41
+ * unique to the turn, since a closing frame updates the open row of the same id anywhere in the thread. The tool type is
42
+ * the OpenFrame one, the icon Mingo's rows for the hub's tools show, so the stage is drawn as their one-line row.
41
43
  */
42
44
  export function chatProgressFrame(
43
45
  progress: ChatProgress,
@@ -45,14 +47,13 @@ export function chatProgressFrame(
45
47
  turnId: string,
46
48
  ): ToolExecutionFrame {
47
49
  const id = `${turnId}:${progress.stage}`;
48
- const title = chatProgressLabel(progress);
50
+ const row = {
51
+ integratedToolType: ToolTypeValues.OPENFRAME,
52
+ toolFunction: progress.stage,
53
+ title: chatProgressLabel(progress),
54
+ toolExecutionRequestId: id,
55
+ };
49
56
  return state === 'running'
50
- ? { type: 'EXECUTING_TOOL', toolFunction: progress.stage, title, toolExecutionRequestId: id }
51
- : {
52
- type: 'EXECUTED_TOOL',
53
- toolFunction: progress.stage,
54
- title,
55
- toolExecutionRequestId: id,
56
- success: state === 'done',
57
- };
57
+ ? { type: 'EXECUTING_TOOL', ...row }
58
+ : { type: 'EXECUTED_TOOL', ...row, success: state === 'done' };
58
59
  }
@@ -5,6 +5,7 @@ import {
5
5
  useAssistantRuntime,
6
6
  type AssistantOpenRequest,
7
7
  } from '../../contexts/assistant-runtime-context';
8
+ import { usePageTopic } from '../../contexts/page-topics-context';
8
9
  import { AskCard, AskPrompts, type AskPromptsProps } from './ask-prompts';
9
10
  import { assistantAvailable, ASK_PROMPTS_DEFAULT_COUNT, useAskSurface } from './hooks/use-ask-prompts';
10
11
 
@@ -23,7 +24,11 @@ export interface AssistantAskPromptsProps extends Pick<AskPromptsProps, 'align'
23
24
  * questions (a FAQ), with a title, a line of description and the launcher.
24
25
  */
25
26
  variant?: 'row' | 'card';
26
- /** What this surface is about: any string the host's questions endpoint knows. Reported with every click. */
27
+ /**
28
+ * A topic of the surface's OWN (a page section with a topic of its own, such
29
+ * as one row of questions). Absent: the page's topic, read from its address
30
+ * (`usePageTopic`), as every other surface of the page uses.
31
+ */
27
32
  topic?: string;
28
33
  /** How many questions it offers: the same number of slots on every load. Absent: three (a card: the runtime's, else three). */
29
34
  count?: number;
@@ -78,7 +83,8 @@ export function AssistantAskPrompts({
78
83
  const card = variant === 'card';
79
84
  const assistant = useAssistantRuntime();
80
85
  const slots = count ?? (card ? assistant?.askCard?.count : undefined) ?? ASK_PROMPTS_DEFAULT_COUNT;
81
- const ask = useAskSurface({ topic, count: slots, exclude, enabled, onOpen });
86
+ const pageTopic = usePageTopic();
87
+ const ask = useAskSurface({ topic: topic ?? pageTopic, count: slots, exclude, enabled, onOpen });
82
88
  if (!assistantAvailable(assistant)) return null;
83
89
 
84
90
  const shared = {
@@ -2897,6 +2897,9 @@ function EmbeddableChatInner({
2897
2897
  // While the admin greeting is still being fetched, render a
2898
2898
  // subtitle skeleton instead of flashing empty → text.
2899
2899
  subtitleLoading={emptyStateLoading}
2900
+ // The page's topic is read with the empty state: the chip wall
2901
+ // draws its loading form until that topic's chips land.
2902
+ quickActionsLoading={!!emptyStateUrl && emptyStateLoading}
2900
2903
  {...guideWelcome}
2901
2904
  // Agent identity (name → title, icon → empty-state glyph)
2902
2905
  // wins over the host `guideWelcome` spread + built-in
@@ -1,10 +1,12 @@
1
1
  'use client';
2
2
 
3
3
  import { type ReactNode, useMemo } from 'react';
4
+ import { usePageTopicStamp } from '../../contexts/page-topics-context';
4
5
  import { cn } from '../../utils/cn';
5
6
  import { AgentMark } from '../agent-mark';
6
7
  import { EntityIcon } from '../icon-display';
7
8
  import { TextLineSkeleton } from '../loading/unified-skeleton';
9
+ import { PageTopicLabel } from '../page-topic-label';
8
10
  import { useLoadingScope } from '../ui/loading-scope';
9
11
  import { ScrollFadeOverlay, useScrollFade } from '../ui/scroll-fade';
10
12
  import { accentFromIdentityIcon, type QuickActionAccent } from './quick-action-chip';
@@ -53,6 +55,15 @@ export interface GuideWelcomeProps {
53
55
  * is directly hoverable — hover/focus previews the action's full `prompt` in
54
56
  * the composer; click sends it. */
55
57
  quickActions?: ReadonlyArray<GuideQuickAction>;
58
+ /** The host is still reading the chips (e.g. the quick actions of the page's
59
+ * topic): with none to show yet the wall draws its own loading form. A
60
+ * loading scope draws it too. */
61
+ quickActionsLoading?: boolean;
62
+ /** Print the page's topic (`PageTopicLabel`, the label the FAQ block prints
63
+ * under its heading) above the chips, so whoever edits quick actions sees
64
+ * which topic's chips the page asked for. Default: the host's choice
65
+ * (`PageTopicsProvider showTopic`), else off. */
66
+ showTopic?: boolean;
56
67
  /** Fired when a quick-action chip is activated (click). */
57
68
  onQuickAction?: (action: GuideQuickAction) => void;
58
69
  /** Pointer/keyboard focus enters a quick-action chip — e.g. preview the
@@ -97,6 +108,8 @@ export function GuideWelcome({
97
108
  subtitle,
98
109
  subtitleLoading = false,
99
110
  quickActions = [],
111
+ quickActionsLoading = false,
112
+ showTopic: showTopicProp,
100
113
  onQuickAction,
101
114
  onQuickActionHover,
102
115
  onQuickActionHoverEnd,
@@ -104,12 +117,18 @@ export function GuideWelcome({
104
117
  children,
105
118
  className,
106
119
  }: GuideWelcomeProps) {
120
+ // The host's choice (`PageTopicsProvider showTopic`) unless this surface states its own.
121
+ const topicStamp = usePageTopicStamp();
122
+ const showTopic = showTopicProp ?? topicStamp;
107
123
  // Scroll-fade affordances: a 48px gradient at the top/bottom edge of the
108
124
  // scroll region, shown only while content is actually hidden in that
109
125
  // direction. (Same behaviour as MingoWelcome.)
110
126
  const { scrollRef, fadeTop, fadeBottom, update: updateScrollFade } = useScrollFade<HTMLDivElement>();
111
127
  // ONE switch for the greeting (read data): a loading scope, or the host still fetching it with none to show yet.
112
- const subtitleIsLoading = useLoadingScope() || (subtitleLoading && !subtitle);
128
+ const inLoadingScope = useLoadingScope();
129
+ const subtitleIsLoading = inLoadingScope || (subtitleLoading && !subtitle);
130
+ // The same switch for the chips (read data): the wall draws its loading form while there are none to show yet.
131
+ const chipsAreLoading = inLoadingScope || (quickActionsLoading && quickActions.length === 0);
113
132
 
114
133
  // Map to the shared {@link QuickActionChip} shape consumed by the unified
115
134
  // `QuickActionWall` — the SAME chip wall the website hero + deck render, so
@@ -200,9 +219,14 @@ export function GuideWelcome({
200
219
  Chips stay directly hoverable — hover/focus previews the action's full
201
220
  prompt in the composer, click sends it — and `pauseOnHover` freezes
202
221
  the hovered row so a moving chip never dodges a click. */}
203
- {quickActions.length > 0 && (
222
+ {/* Right-aligned and pulled against the chips, so it reads as a stamp on the wall, not a row of its own. */}
223
+ {showTopic && (
224
+ <PageTopicLabel className="-mb-[var(--spacing-system-xs)] shrink-0 px-[var(--spacing-system-l)] text-right" />
225
+ )}
226
+ {(quickActions.length > 0 || chipsAreLoading) && (
204
227
  <QuickActionWall
205
228
  chips={chipItems}
229
+ loading={chipsAreLoading}
206
230
  agentSlug={agentSlug}
207
231
  rows={4}
208
232
  pauseOnHover
@@ -14,6 +14,7 @@
14
14
  */
15
15
 
16
16
  import { useQuery } from '@tanstack/react-query';
17
+ import { usePageTopic } from '../../../contexts/page-topics-context';
17
18
  import { embedAuthedFetch } from '../../../utils/embed-authed-fetch';
18
19
 
19
20
  /** A structured empty-state quick-action chip — `{ id, label, prompt }` plus an
@@ -122,11 +123,25 @@ export async function fetchEmptyStateConfig(
122
123
  }
123
124
  }
124
125
 
126
+ /**
127
+ * The empty-state URL for the page the chat is on: the host's endpoint with the
128
+ * page's `topic` (its path: `/pricing`, `/`), which the host uses to place
129
+ * the quick actions (that topic's first, then the ones written for no topic,
130
+ * never another topic's). No topic: the endpoint as given.
131
+ */
132
+ export function emptyStateUrlForTopic(emptyStateUrl: string, topic?: string | null): string {
133
+ if (!topic) return emptyStateUrl;
134
+ return `${emptyStateUrl}${emptyStateUrl.includes('?') ? '&' : '?'}${new URLSearchParams({ topic }).toString()}`;
135
+ }
136
+
125
137
  /**
126
138
  * Shared empty-state config (single fetch per chat surface), via react-query
127
- * so every consumer dedupes to ONE request. Keyed on `emptyStateUrl` ALONE —
128
- * the request sends no `source` param (resolved server-side), so the URL
129
- * fully determines the response.
139
+ * so every consumer dedupes to ONE request. The request carries the topic of
140
+ * the page on screen, read from its address (`usePageTopic`), so the host
141
+ * places the quick actions for it. Keyed on the URL ALONE (the endpoint plus
142
+ * the topic, `emptyStateUrlForTopic`) — the request
143
+ * sends no `source` param (resolved server-side), so the URL fully determines
144
+ * the response: each topic is read once per session.
130
145
  *
131
146
  * `staleTime`/`gcTime: Infinity` → static per session (toggling modes or
132
147
  * remounting the drawer reads from cache, never refetches).
@@ -140,9 +155,11 @@ export function useEmptyStateConfig(
140
155
  options?: { enabled?: boolean },
141
156
  ): { config: EmptyStateConfig; loading: boolean; loaded: boolean } {
142
157
  const enabled = (options?.enabled ?? true) && !!emptyStateUrl;
158
+ const topic = usePageTopic();
159
+ const url = emptyStateUrl ? emptyStateUrlForTopic(emptyStateUrl, topic) : undefined;
143
160
  const query = useQuery({
144
- queryKey: ['chat-empty-state', emptyStateUrl],
145
- queryFn: ({ signal }) => fetchEmptyStateConfig(signal, emptyStateUrl as string),
161
+ queryKey: ['chat-empty-state', url],
162
+ queryFn: ({ signal }) => fetchEmptyStateConfig(signal, url as string),
146
163
  enabled,
147
164
  staleTime: Infinity,
148
165
  gcTime: Infinity,
@@ -6,17 +6,8 @@ import { useInView } from '../../hooks/ui/use-in-view';
6
6
  import { AssistantAskPrompts } from '../chat/assistant-ask-prompts';
7
7
  import { assistantAvailable } from '../chat/hooks/use-ask-prompts';
8
8
 
9
- /** The card beside a FAQ, as a host may shape it. Every field is optional. */
9
+ /** The card beside a FAQ, as a host may shape it. Every field is optional; its topic is the page's (`usePageTopic`). */
10
10
  export interface FaqAskOptions {
11
- /**
12
- * What this FAQ is about: ANY string the host's questions endpoint knows (it
13
- * is sent as `topic`, and reported with every click). Questions written
14
- * for the topic are picked first. Absent: the FAQ's own topic
15
- * (`FaqSection`'s `topic`), else the entity the FAQ is attached to (its
16
- * `entityType`). With none, the FAQ has no card: the lib names no topic of
17
- * its own.
18
- */
19
- topic?: string;
20
11
  /**
21
12
  * Ids of questions never to offer. Absent: the ones the page's other "ask"
22
13
  * surfaces show, which the card waits for. `null`: wait.
@@ -50,7 +41,7 @@ export function faqAskCardShown(assistant: AssistantRuntime | null): assistant i
50
41
  * card then leaves out every question the page above already shows. The card
51
42
  * is the same height before and after the questions arrive.
52
43
  */
53
- export function FaqAskCard({ topic, exclude, count, title, description, onOpen }: FaqAskOptions & { topic: string }) {
44
+ export function FaqAskCard({ exclude, count, title, description, onOpen }: FaqAskOptions) {
54
45
  const { ref, inView } = useInView<HTMLDivElement>({ rootMargin: PICK_ROOT_MARGIN });
55
46
  const [reached, setReached] = useState(false);
56
47
  if (inView && !reached) setReached(true);
@@ -58,7 +49,6 @@ export function FaqAskCard({ topic, exclude, count, title, description, onOpen }
58
49
  <div ref={ref}>
59
50
  <AssistantAskPrompts
60
51
  variant="card"
61
- topic={topic}
62
52
  count={count}
63
53
  exclude={exclude}
64
54
  enabled={reached}
@@ -49,15 +49,13 @@ export interface FaqDocumentPageProps {
49
49
  jsonLd?: FaqSchemaOptions;
50
50
  /** Base URL `FaqSection` appends `/api/faqs` to (reverse-proxy embedders). */
51
51
  apiBaseUrl?: string;
52
- /** What the page is about (forwarded to `FaqSection`): its FAQs and its ask card are the ones written for the topic. */
53
- topic?: string;
54
52
  /** Optional entity scoping forwarded to `FaqSection`. */
55
53
  entityType?: string;
56
54
  entityId?: number | string;
57
55
  /** Minimum FAQ count before the section renders (forwarded to `FaqSection`). */
58
56
  minResults?: number;
59
57
  /** The "ask the assistant" card beside the questions (forwarded to `FaqSection`): `false` switches it off, an
60
- * object states its topic, wording and the chat it opens. */
58
+ * object states its wording and the chat it opens; its topic is the page's (`usePageTopic`). */
61
59
  ask?: FaqSectionProps['ask'];
62
60
  /** The FAQ's loading state, group by group (forwarded to `FaqSection`). */
63
61
  skeletonShape?: FaqSectionProps['skeletonShape'];
@@ -76,7 +74,6 @@ export function FaqDocumentPage({
76
74
  entityType,
77
75
  entityId,
78
76
  minResults,
79
- topic,
80
77
  ask,
81
78
  skeletonShape,
82
79
  skeletonNav,
@@ -106,7 +103,6 @@ export function FaqDocumentPage({
106
103
  entityType={entityType}
107
104
  entityId={entityId}
108
105
  minResults={minResults}
109
- topic={topic}
110
106
  ask={ask}
111
107
  skeletonShape={skeletonShape}
112
108
  skeletonNav={skeletonNav}
@@ -3,6 +3,8 @@
3
3
  import type React from 'react';
4
4
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
5
5
  import { useAssistantRuntime } from '../../contexts/assistant-runtime-context';
6
+ import { useEndpointsRuntime } from '../../contexts/endpoints-runtime-context';
7
+ import { usePageTopic, usePageTopicStamp } from '../../contexts/page-topics-context';
6
8
  import Link from '../../embed-shims/next-link';
7
9
  import { useScrollToHash } from '../../hooks/use-scroll-to-hash';
8
10
  import { useSelfFetch } from '../../hooks/use-self-fetch';
@@ -16,6 +18,7 @@ import { FAQ_ACCORDION_SKELETON_ROWS, FaqAccordion, type FaqItem } from '../faq-
16
18
  import { SECTION_HEADING_CLASS } from '../layout/page-heading';
17
19
  import { LoadingRegion } from '../loading/loading-region';
18
20
  import { TextLineSkeleton } from '../loading/unified-skeleton';
21
+ import { PageTopicLabel } from '../page-topic-label';
19
22
  import { LoadingItems, useLoadingScope } from '../ui/loading-scope';
20
23
  import { FaqAskCard, faqAskCardShown, type FaqAskOptions } from './faq-ask-card';
21
24
  import { buildFaqJsonLdFromFaqs, type FaqSchemaOptions } from './json-ld';
@@ -30,15 +33,6 @@ export interface FaqSectionProps {
30
33
  /** Both required together for entity-attached FAQs; partial → bare /api/faqs. */
31
34
  entityType?: string;
32
35
  entityId?: number | string;
33
- /**
34
- * What the page this FAQ sits on is about: ANY string the host's FAQ
35
- * endpoint knows. ONE topic for the whole block: the questions are the FAQs
36
- * written for it (`/api/faqs?topic=`; `initialFaqs` are then the host's read
37
- * of the same topic) and the "ask the assistant" card offers the questions
38
- * written for it. Whoever renders the FAQ states it; the lib names none.
39
- * Ignored for the questions when the FAQ is attached to an entity.
40
- */
41
- topic?: string;
42
36
  /**
43
37
  * Heading node above the grouped list. `undefined` → default
44
38
  * `<h2>`"Frequently Asked Questions". `null` → no heading (the host page
@@ -58,16 +52,16 @@ export interface FaqSectionProps {
58
52
  /** The `id` of the rendered section: what an in-page link to the FAQ points at (`PAGE_FAQ_SECTION_ID` for a page's own block). */
59
53
  id?: string;
60
54
  /**
61
- * Print the topic's bare name in small muted text under the heading
55
+ * Print the page's topic (`usePageTopic`) in small muted text under the heading
62
56
  * (`pricing`), so whoever edits the FAQs can see which topic a page asks
63
- * for. Default off. The section always carries it as `data-faq-topic` too.
57
+ * for. Default: the host's choice (`PageTopicsProvider showTopic`), else off. The section always carries it as `data-faq-topic` too.
64
58
  */
65
59
  showTopic?: boolean;
66
60
  /** Maps to /api/faqs `?count=` (the 5-tier fill target). Absent → param
67
61
  * not sent (server default applies). */
68
62
  minResults?: number;
69
- /** Fetch-URL prefix for third-party embeds / reverse proxies
70
- * ('' = same-origin relative). */
63
+ /** Fetch-URL prefix for third-party embeds / reverse proxies ('' = same-origin relative). Absent: the host's
64
+ * `EndpointsRuntime.faqsUrl`, else the same-origin `/api/faqs`. */
71
65
  apiBaseUrl?: string;
72
66
  /**
73
67
  * A block beside the questions, in place of the "ask the assistant" card.
@@ -80,10 +74,9 @@ export interface FaqSectionProps {
80
74
  * The "ask the assistant" card beside the questions. Shown wherever the
81
75
  * host's assistant runtime says a chat is there to open
82
76
  * (`AssistantRuntimeContext`: its name, glyph, questions endpoint and
83
- * opener) AND the FAQ has a topic: the block's `topic`, else the
84
- * `entityType` the FAQ is attached to (`ask.topic` states another one for
85
- * the card alone). No runtime or no topic: the FAQ is the single column it
86
- * always was; the lib names no topic of its own. `false` switches the card off; the object
77
+ * opener) AND the page has a topic (`usePageTopic`: the host's map read at
78
+ * the page's address). No runtime or no topic: the FAQ is the single column
79
+ * it always was; the lib names no topic of its own. `false` switches the card off; the object
87
80
  * also states the questions to leave out, the wording and the chat it opens
88
81
  * (`onOpen`). An `aside` takes the card's place.
89
82
  */
@@ -102,6 +95,8 @@ export interface FaqSectionProps {
102
95
  }
103
96
 
104
97
  const DEFAULT_HEADING_TEXT = 'Frequently Asked Questions';
98
+ /** The hub's FAQ list, same-origin: what a host with no `apiBaseUrl` and no `faqsUrl` is asked. */
99
+ const DEFAULT_FAQS_PATH = '/api/faqs';
105
100
 
106
101
  /** The block's layout, read by the block and by its skeleton, so the skeleton is the block's size. */
107
102
  const SECTION_DEFAULT_CLASS = 'space-y-10';
@@ -116,7 +111,6 @@ const ASIDE_GRID_CLASS =
116
111
  const ASIDE_QUESTIONS_CELL_CLASS = 'content-lg:col-start-2 content-lg:row-span-2 content-lg:row-start-1';
117
112
  const ASIDE_CELL_CLASS = 'content-lg:col-start-1 content-lg:row-start-2';
118
113
  const TOPIC_STACK_CLASS = 'space-y-1';
119
- const TOPIC_CLASS = 'text-ods-text-muted text-h6';
120
114
  const CATEGORY_NAV_CLASS = 'flex flex-wrap gap-2';
121
115
  /**
122
116
  * The nav's row while the categories are read (`skeletonNav`): which categories there are, and how many, is read data,
@@ -216,7 +210,7 @@ function faqHeadingNode(heading: React.ReactNode | null | undefined, showTopic:
216
210
  return (
217
211
  <div className={TOPIC_STACK_CLASS}>
218
212
  <div>{titleNode}</div>
219
- <p className={TOPIC_CLASS}>{topic}</p>
213
+ <PageTopicLabel />
220
214
  </div>
221
215
  );
222
216
  }
@@ -228,35 +222,27 @@ export const PAGE_FAQ_SECTION_ID = 'faq';
228
222
  const PAGE_FAQ_IN_PAGE_CLASS = 'space-y-10 pt-12 md:pt-20';
229
223
 
230
224
  /**
231
- * What a shared page of the lib takes as its `faq` prop: the topic the page is
232
- * about (REQUIRED, stated by the host, never read from the page's address) and
233
- * where the host serves the FAQs. The page renders `FaqSection` with it, inside
234
- * its own container, after its content (`pageFaqProps`).
225
+ * A shared page's own FAQ block (roadmap, delivery, releases, onboarding guides, downloads, legal documents): the
226
+ * page's questions, for its topic, after its content and inside its container. Drawn where the host names its FAQ
227
+ * endpoint (`EndpointsRuntime.faqsUrl`); a host that draws every page's FAQ itself (the hub's layout) names none, so a
228
+ * page never shows two. No page passes anything: the endpoint is the host's, the topic is the page's path.
235
229
  */
236
- export type PageFaqSlot = Pick<
237
- FaqSectionProps,
238
- 'apiBaseUrl' | 'initialFaqs' | 'heading' | 'ask' | 'emitJsonLd' | 'jsonLd' | 'showTopic'
239
- > & { topic: string };
240
-
241
- /** The `FaqSection` props of a shared page's own FAQ block: the host's slot, as the page's `#faq` section. */
242
- export function pageFaqProps(faq: PageFaqSlot): FaqSectionProps {
243
- return { ...faq, id: PAGE_FAQ_SECTION_ID, className: PAGE_FAQ_IN_PAGE_CLASS };
230
+ export function SharedPageFaq() {
231
+ const faqsUrl = useEndpointsRuntime()?.faqsUrl;
232
+ return faqsUrl ? <FaqSection id={PAGE_FAQ_SECTION_ID} className={PAGE_FAQ_IN_PAGE_CLASS} /> : null;
244
233
  }
245
234
 
246
- /** URL composition shared with RelatedContentSection (`buildSuggestionUrl`)
247
- * — byte-identical to the historical `buildFaqsUrl` output when
248
- * `minResults`/`apiBaseUrl` are absent. */
235
+ /** The FAQ request on `endpoint`: the composition shared with RelatedContentSection (`buildSuggestionUrl`). */
249
236
  function buildFaqsUrl(
237
+ endpoint: string,
250
238
  entityType?: string,
251
239
  entityId?: number | string,
252
240
  minResults?: number,
253
- apiBaseUrl = '',
254
241
  topic?: string,
255
242
  ): string {
256
243
  // An entity's FAQs are the entity's: a topic narrows only the platform's own list.
257
244
  const entityScoped = !!entityType && entityId !== undefined && entityId !== null && entityId !== '';
258
- return buildSuggestionUrl('/api/faqs', {
259
- apiBaseUrl,
245
+ return buildSuggestionUrl(endpoint, {
260
246
  entityType,
261
247
  entityId,
262
248
  count: minResults,
@@ -554,8 +540,9 @@ interface FaqsResponse {
554
540
  * page owns the <h1>) + `emitJsonLd` with `jsonLd` overrides for SEO.
555
541
  * - Per-entity embed: pass `entityType` + `entityId` (no `initialFaqs`); the
556
542
  * hook self-fetches `GET /api/faqs`, and `heading` is this block's own <h2>.
557
- * - A page's own FAQ: pass `topic` (what the page is about); the hook
558
- * self-fetches `GET /api/faqs?topic=`, and the ask card takes the same topic.
543
+ * - A page's own FAQ: the page's topic is read from its address
544
+ * (`usePageTopic`); the hook self-fetches `GET /api/faqs?topic=`, and the ask
545
+ * card takes the same topic.
559
546
  *
560
547
  * CONTRACT: the consuming app MUST implement `GET /api/faqs`. On a fetch error
561
548
  * (or zero FAQs) the component renders nothing so the host page isn't
@@ -566,29 +553,34 @@ export function FaqSection({
566
553
  initialFaqs,
567
554
  entityType,
568
555
  entityId,
569
- topic,
570
556
  heading,
571
557
  emitJsonLd = false,
572
558
  jsonLd,
573
559
  className,
574
560
  id,
575
- showTopic = false,
561
+ showTopic: showTopicProp,
576
562
  minResults,
577
- apiBaseUrl = '',
563
+ apiBaseUrl,
578
564
  aside: asideProp,
579
565
  ask,
580
566
  skeletonShape,
581
567
  skeletonNav = false,
582
568
  }: FaqSectionProps) {
569
+ // The host's choice (`PageTopicsProvider showTopic`) unless this surface states its own.
570
+ const topicStamp = usePageTopicStamp();
571
+ const showTopic = showTopicProp ?? topicStamp;
583
572
  const assistant = useAssistantRuntime();
584
573
  const inScope = useLoadingScope();
585
- // The host's own block wins; else the card, where a chat is there to open and the FAQ has a topic
586
- // (an empty topic is no topic, as the questions request reads it).
587
- const askTopic = ask === false ? undefined : ask?.topic || topic || entityType;
574
+ // THE page's topic, from its address: the questions and the ask card are the ones written for it.
575
+ const topic = usePageTopic();
576
+ // The host's own block wins; else the card, where a chat is there to open and the page has a topic.
588
577
  const aside =
589
- asideProp ??
590
- (ask !== false && askTopic && faqAskCardShown(assistant) ? <FaqAskCard {...ask} topic={askTopic} /> : undefined);
591
- const url = buildFaqsUrl(entityType, entityId, minResults, apiBaseUrl, topic);
578
+ asideProp ?? (ask !== false && topic && faqAskCardShown(assistant) ? <FaqAskCard {...ask} /> : undefined);
579
+ // The endpoint: the caller's base (`apiBaseUrl`), else the host's (`EndpointsRuntime.faqsUrl`), else same-origin.
580
+ const runtimeFaqsUrl = useEndpointsRuntime()?.faqsUrl;
581
+ const endpoint =
582
+ apiBaseUrl !== undefined ? `${apiBaseUrl}${DEFAULT_FAQS_PATH}` : (runtimeFaqsUrl ?? DEFAULT_FAQS_PATH);
583
+ const url = buildFaqsUrl(endpoint, entityType, entityId, minResults, topic);
592
584
  // Memoized — useSelfFetch re-syncs on [initialData]; a fresh per-render
593
585
  // wrapper object would setState-loop under re-rendering parents.
594
586
  const initialData = useMemo<FaqsResponse | undefined>(
@@ -659,8 +651,10 @@ export function FaqSection({
659
651
 
660
652
  interface FaqSectionSkeletonProps extends Pick<
661
653
  FaqSectionProps,
662
- 'heading' | 'topic' | 'showTopic' | 'aside' | 'className' | 'id'
654
+ 'heading' | 'showTopic' | 'aside' | 'className' | 'id'
663
655
  > {
656
+ /** The page's topic, as the loaded block prints it. */
657
+ topic?: string;
664
658
  /** The groups drawn, in order. Default one group with no heading, of `FAQ_SECTION_SKELETON_QUESTIONS` rows. */
665
659
  shape?: FaqSkeletonShape;
666
660
  /** Draw the category nav's row (one line of pills) whatever `sections` is: the host's FAQs are categorised. */
@@ -677,13 +671,16 @@ const DEFAULT_SKELETON_SHAPE: FaqSkeletonShape = [{}];
677
671
  function FaqSectionSkeleton({
678
672
  heading,
679
673
  topic,
680
- showTopic = false,
674
+ showTopic: showTopicProp,
681
675
  aside,
682
676
  shape = DEFAULT_SKELETON_SHAPE,
683
677
  navRow = false,
684
678
  className,
685
679
  id,
686
680
  }: FaqSectionSkeletonProps) {
681
+ // The host's choice (`PageTopicsProvider showTopic`) unless this surface states its own.
682
+ const topicStamp = usePageTopicStamp();
683
+ const showTopic = showTopicProp ?? topicStamp;
687
684
  const headingNode = faqHeadingNode(heading, showTopic, topic);
688
685
  const CategoryHeading = heading === null ? 'h2' : 'h3';
689
686
  const groups = shape.length > 0 ? shape : DEFAULT_SKELETON_SHAPE;
@@ -13,11 +13,10 @@ export {
13
13
  FaqSection,
14
14
  FAQ_SECTION_SKELETON_QUESTIONS,
15
15
  PAGE_FAQ_SECTION_ID,
16
- pageFaqProps,
16
+ SharedPageFaq,
17
17
  type FaqSectionProps,
18
18
  type FaqSkeletonGroup,
19
19
  type FaqSkeletonShape,
20
- type PageFaqSlot,
21
20
  } from './faq-section';
22
21
  export { FaqDocumentPage, type FaqDocumentPageProps } from './faq-document-page';
23
22
  export { FaqAskCard, type FaqAskOptions } from './faq-ask-card';
@@ -8,7 +8,6 @@
8
8
  */
9
9
 
10
10
  import type { ReactNode } from 'react';
11
- import type { PageFaqSlot } from '../faq/faq-section';
12
11
  import { DeliveryLists } from '../shared/delivery';
13
12
  import { DevSectionPage } from '../shared/dev-section';
14
13
 
@@ -23,12 +22,6 @@ export interface DeliveryPageProps {
23
22
  subtitle?: string;
24
23
  /** Optional slot rendered below the lists, inside the page chrome. */
25
24
  belowContent?: ReactNode;
26
- /**
27
- * The page's own FAQ block: the topic the page is about (stated by the host,
28
- * never read from its address) and where the host serves the FAQs. Rendered
29
- * after the page's content, inside its container. Absent: no FAQ block.
30
- */
31
- faq?: PageFaqSlot;
32
25
  /** Render the standalone `<PageShell>`. Default true. Pass false when the host
33
26
  * layout already provides the page container (forwarded to `DevSectionPage`). */
34
27
  shell?: boolean;
@@ -41,18 +34,10 @@ export function DeliveryPage({
41
34
  title,
42
35
  subtitle,
43
36
  belowContent,
44
- faq,
45
37
  shell,
46
38
  }: DeliveryPageProps) {
47
39
  return (
48
- <DevSectionPage
49
- sectionKey="delivery"
50
- backButton={backButton}
51
- title={title}
52
- subtitle={subtitle}
53
- faq={faq}
54
- shell={shell}
55
- >
40
+ <DevSectionPage sectionKey="delivery" backButton={backButton} title={title} subtitle={subtitle} shell={shell}>
56
41
  <DeliveryLists completedApiEndpoint={completedEndpoint} inProgressApiEndpoint={inProgressEndpoint} />
57
42
  {belowContent}
58
43
  </DevSectionPage>