@flamingo-stack/openframe-frontend-core 0.0.828 → 0.0.830

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 (166) hide show
  1. package/dist/build/export-map.json +1 -1
  2. package/dist/{chunk-DU6AF77X.cjs → chunk-2BGLALP5.cjs} +14 -14
  3. package/dist/{chunk-QMQWXGCH.cjs → chunk-56EP4QM2.cjs} +29 -25
  4. package/dist/{chunk-4ZH7RPEA.cjs → chunk-5KSPG3TV.cjs} +388 -388
  5. package/dist/{chunk-BGT6JFMP.cjs → chunk-5LED4QHZ.cjs} +527 -434
  6. package/dist/{chunk-6ZLCEIIC.cjs → chunk-CAGQAMJ6.cjs} +23 -23
  7. package/dist/{chunk-ALRX2VIY.cjs → chunk-D2LXFMZI.cjs} +26 -26
  8. package/dist/{chunk-VAIML6YU.cjs → chunk-DUGOOTER.cjs} +13 -13
  9. package/dist/{chunk-XPF74L76.cjs → chunk-E6W4YDPS.cjs} +2 -2
  10. package/dist/{chunk-UULSSD56.cjs → chunk-FFFN4IY2.cjs} +5 -5
  11. package/dist/{chunk-UWGPYAB3.cjs → chunk-HYCMMECU.cjs} +51 -51
  12. package/dist/{chunk-DR4P7AEU.cjs → chunk-HYGWRUEM.cjs} +3 -3
  13. package/dist/chunk-IX2E3AN7.cjs +77 -0
  14. package/dist/{chunk-YKUL6JBI.cjs → chunk-M75723HD.cjs} +46 -34
  15. package/dist/{chunk-RPKWEBHC.cjs → chunk-PUXYAHH3.cjs} +3 -3
  16. package/dist/{chunk-3B6ZE4EZ.cjs → chunk-QTLWU6FY.cjs} +5 -5
  17. package/dist/{chunk-3WKQ2GCR.cjs → chunk-RRPID7Z7.cjs} +6 -8
  18. package/dist/{chunk-6SFCI6D4.cjs → chunk-SAW7V7CU.cjs} +14 -16
  19. package/dist/{chunk-B5H7RKFF.cjs → chunk-TUMSVFVS.cjs} +4 -4
  20. package/dist/{chunk-7VC5FVWT.cjs → chunk-ULF4ZOUM.cjs} +65 -65
  21. package/dist/{chunk-ZT7JHN7G.cjs → chunk-WCCE4WF3.cjs} +57 -62
  22. package/dist/{chunk-7PZQ7SHB.cjs → chunk-WWDNLMB7.cjs} +16 -16
  23. package/dist/{chunk-K6X7VP2Y.cjs → chunk-WZYBUJJG.cjs} +43 -43
  24. package/dist/{chunk-SVCTAOJR.cjs → chunk-X425BGXS.cjs} +2 -2
  25. package/dist/{chunk-BIG3O33P.cjs → chunk-YJZ7R3W5.cjs} +28 -2
  26. package/dist/{cloud-tenants-LKTWIZNS.cjs → cloud-tenants-4KQQPXPM.cjs} +12 -11
  27. package/dist/components/case-studies/index.cjs +24 -23
  28. package/dist/components/chat/assistant-ask-prompts.d.ts +5 -1
  29. package/dist/components/chat/assistant-ask-prompts.d.ts.map +1 -1
  30. package/dist/components/chat/assistant-ask-prompts.js +3 -1
  31. package/dist/components/chat/embeddable-chat.d.ts +3 -3
  32. package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
  33. package/dist/components/chat/embeddable-chat.js +22 -14
  34. package/dist/components/chat/guide-welcome.d.ts +14 -16
  35. package/dist/components/chat/guide-welcome.d.ts.map +1 -1
  36. package/dist/components/chat/guide-welcome.js +9 -24
  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 +13 -5
  41. package/dist/components/chat/mingo-quick-action-wall.d.ts +42 -16
  42. package/dist/components/chat/mingo-quick-action-wall.d.ts.map +1 -1
  43. package/dist/components/chat/mingo-quick-action-wall.js +105 -19
  44. package/dist/components/chat/mingo-welcome.d.ts +6 -13
  45. package/dist/components/chat/mingo-welcome.d.ts.map +1 -1
  46. package/dist/components/chat/mingo-welcome.js +5 -9
  47. package/dist/components/chat/quick-action-chip.d.ts +8 -2
  48. package/dist/components/chat/quick-action-chip.d.ts.map +1 -1
  49. package/dist/components/chat/quick-action-chip.js +18 -8
  50. package/dist/components/contact/index.cjs +13 -12
  51. package/dist/components/docs/index.cjs +16 -15
  52. package/dist/components/embeds/index.cjs +13 -12
  53. package/dist/components/faq/faq-ask-card.d.ts +2 -13
  54. package/dist/components/faq/faq-ask-card.d.ts.map +1 -1
  55. package/dist/components/faq/faq-ask-card.js +1 -2
  56. package/dist/components/faq/faq-document-page.d.ts +2 -4
  57. package/dist/components/faq/faq-document-page.d.ts.map +1 -1
  58. package/dist/components/faq/faq-document-page.js +0 -2
  59. package/dist/components/faq/faq-section.d.ts +16 -29
  60. package/dist/components/faq/faq-section.d.ts.map +1 -1
  61. package/dist/components/faq/faq-section.js +23 -15
  62. package/dist/components/faq/index.cjs +14 -13
  63. package/dist/components/faq/index.d.ts +1 -1
  64. package/dist/components/faq/index.d.ts.map +1 -1
  65. package/dist/components/faq/index.js +2 -2
  66. package/dist/components/features/index.cjs +12 -11
  67. package/dist/components/help-center-pages/delivery-page.d.ts +1 -8
  68. package/dist/components/help-center-pages/delivery-page.d.ts.map +1 -1
  69. package/dist/components/help-center-pages/delivery-page.js +4 -16
  70. package/dist/components/help-center-pages/download-apps-page.d.ts +1 -8
  71. package/dist/components/help-center-pages/download-apps-page.d.ts.map +1 -1
  72. package/dist/components/help-center-pages/download-apps-page.js +3 -4
  73. package/dist/components/help-center-pages/index.cjs +123 -171
  74. package/dist/components/help-center-pages/onboarding-guides-catalog-page.d.ts +1 -8
  75. package/dist/components/help-center-pages/onboarding-guides-catalog-page.d.ts.map +1 -1
  76. package/dist/components/help-center-pages/onboarding-guides-catalog-page.js +14 -26
  77. package/dist/components/help-center-pages/product-releases-list-page.d.ts +1 -8
  78. package/dist/components/help-center-pages/product-releases-list-page.d.ts.map +1 -1
  79. package/dist/components/help-center-pages/product-releases-list-page.js +12 -24
  80. package/dist/components/help-center-pages/roadmap-page.d.ts +1 -8
  81. package/dist/components/help-center-pages/roadmap-page.d.ts.map +1 -1
  82. package/dist/components/help-center-pages/roadmap-page.js +13 -25
  83. package/dist/components/help-center-pages/trust-center-page.d.ts +1 -1
  84. package/dist/components/help-center-pages/trust-center-page.d.ts.map +1 -1
  85. package/dist/components/index.cjs +58 -49
  86. package/dist/components/index.d.ts +1 -0
  87. package/dist/components/index.d.ts.map +1 -1
  88. package/dist/components/index.js +1 -0
  89. package/dist/components/meeting-scheduler/index.cjs +50 -49
  90. package/dist/components/navigation/index.cjs +15 -14
  91. package/dist/components/onboarding-guides/index.cjs +14 -13
  92. package/dist/components/page-topic-label.d.ts +13 -0
  93. package/dist/components/page-topic-label.d.ts.map +1 -0
  94. package/dist/components/page-topic-label.js +20 -0
  95. package/dist/components/product-demo/index.cjs +23 -22
  96. package/dist/components/shared/dev-section/dev-section-page.d.ts +1 -8
  97. package/dist/components/shared/dev-section/dev-section-page.d.ts.map +1 -1
  98. package/dist/components/shared/dev-section/dev-section-page.js +2 -3
  99. package/dist/components/shared/legal-document/legal-document-page.d.ts +2 -10
  100. package/dist/components/shared/legal-document/legal-document-page.d.ts.map +1 -1
  101. package/dist/components/shared/legal-document/legal-document-page.js +2 -5
  102. package/dist/components/shared/legal-document/use-legal-documents.d.ts +0 -2
  103. package/dist/components/shared/legal-document/use-legal-documents.d.ts.map +1 -1
  104. package/dist/components/shared/legal-document/use-legal-documents.js +0 -1
  105. package/dist/components/tickets/index.cjs +17 -16
  106. package/dist/components/ui/actions-menu.d.ts.map +1 -1
  107. package/dist/components/ui/actions-menu.js +27 -1
  108. package/dist/components/ui/index.cjs +18 -11
  109. package/dist/contexts/endpoints-runtime-context.d.ts +5 -0
  110. package/dist/contexts/endpoints-runtime-context.d.ts.map +1 -1
  111. package/dist/contexts/index.cjs +10 -1
  112. package/dist/contexts/index.d.ts +1 -0
  113. package/dist/contexts/index.d.ts.map +1 -1
  114. package/dist/contexts/index.js +4 -0
  115. package/dist/contexts/page-topics-context.d.ts +30 -0
  116. package/dist/contexts/page-topics-context.d.ts.map +1 -0
  117. package/dist/contexts/page-topics-context.js +27 -0
  118. package/dist/{devices-JWG72ANF.cjs → devices-H6C4NMIY.cjs} +13 -12
  119. package/dist/{embeddable-chat-5UT6UHEO.cjs → embeddable-chat-KUESE7P6.cjs} +107 -97
  120. package/dist/hooks/index.cjs +3 -3
  121. package/dist/index.cjs +33 -15
  122. package/dist/{knowledge-DQXVSHME.cjs → knowledge-O6IBO5Y5.cjs} +13 -12
  123. package/dist/{logs-Z33VBTVX.cjs → logs-Y2UCF24Z.cjs} +19 -18
  124. package/dist/{policies-XE4UMH6Z.cjs → policies-J6O3RLJT.cjs} +16 -15
  125. package/dist/{remote-session-QGFG5WAL.cjs → remote-session-RVTFWSU4.cjs} +5 -5
  126. package/dist/{scripts-MECQG5GG.cjs → scripts-N67MM4T2.cjs} +19 -18
  127. package/dist/{software-update-PCSIA6BP.cjs → software-update-HB7F6KNG.cjs} +16 -15
  128. package/dist/{tickets-board-KCH6ITUV.cjs → tickets-board-2K3PBCNW.cjs} +8 -8
  129. package/dist/utils/index.cjs +46 -0
  130. package/dist/utils/index.d.ts +1 -0
  131. package/dist/utils/index.d.ts.map +1 -1
  132. package/dist/utils/index.js +12 -0
  133. package/dist/utils/page-topics.cjs +48 -0
  134. package/dist/utils/page-topics.d.ts +34 -0
  135. package/dist/utils/page-topics.d.ts.map +1 -0
  136. package/dist/utils/page-topics.js +46 -0
  137. package/package.json +7 -1
  138. package/src/components/chat/assistant-ask-prompts.tsx +8 -2
  139. package/src/components/chat/embeddable-chat.tsx +32 -45
  140. package/src/components/chat/guide-welcome.tsx +28 -49
  141. package/src/components/chat/hooks/use-empty-state-config.ts +22 -5
  142. package/src/components/chat/mingo-quick-action-wall.tsx +166 -31
  143. package/src/components/chat/mingo-welcome.tsx +16 -35
  144. package/src/components/chat/quick-action-chip.tsx +32 -8
  145. package/src/components/faq/faq-ask-card.tsx +2 -12
  146. package/src/components/faq/faq-document-page.tsx +1 -5
  147. package/src/components/faq/faq-section.tsx +47 -50
  148. package/src/components/faq/index.ts +1 -2
  149. package/src/components/help-center-pages/delivery-page.tsx +1 -16
  150. package/src/components/help-center-pages/download-apps-page.tsx +2 -9
  151. package/src/components/help-center-pages/onboarding-guides-catalog-page.tsx +1 -16
  152. package/src/components/help-center-pages/product-releases-list-page.tsx +1 -16
  153. package/src/components/help-center-pages/roadmap-page.tsx +1 -16
  154. package/src/components/help-center-pages/trust-center-page.tsx +1 -1
  155. package/src/components/index.ts +1 -0
  156. package/src/components/page-topic-label.tsx +30 -0
  157. package/src/components/shared/dev-section/dev-section-page.tsx +2 -9
  158. package/src/components/shared/legal-document/legal-document-page.tsx +3 -13
  159. package/src/components/shared/legal-document/use-legal-documents.ts +0 -3
  160. package/src/components/ui/actions-menu.tsx +35 -1
  161. package/src/contexts/endpoints-runtime-context.tsx +5 -0
  162. package/src/contexts/index.ts +1 -0
  163. package/src/contexts/page-topics-context.tsx +68 -0
  164. package/src/utils/index.ts +8 -0
  165. package/src/utils/page-topics.ts +81 -0
  166. package/dist/{chunk-IKWQW3YJ.cjs → chunk-AY6XJOIN.cjs} +4 -4
@@ -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>
@@ -54,7 +54,7 @@ import {
54
54
  import { cn } from '../../utils/cn';
55
55
  import { formatUrlForDisplay } from '../../utils/format';
56
56
  import { DESKTOP_OSES, type DesktopOs } from '../../utils/visitor-os';
57
- import { FaqSection, pageFaqProps, type PageFaqSlot } from '../faq/faq-section';
57
+ import { SharedPageFaq } from '../faq/faq-section';
58
58
  import { CommandBox } from '../features/command-box';
59
59
  import { AppleLogoIcon } from '../icons-v2-generated/brand-logos/apple-logo-icon';
60
60
  import { WindowsLogoGreyIcon } from '../icons-v2-generated/brand-logos/windows-logo-grey-icon';
@@ -99,12 +99,6 @@ export interface DownloadAppsPageProps {
99
99
  openAppHref?: (download: AppDownload) => string | null | undefined;
100
100
  /** The closing card, under the mobile app: using OpenFrame without installing anything. Default: none. */
101
101
  web?: DownloadAppsWebOption;
102
- /**
103
- * The page's own FAQ block: the topic the page is about (stated by the host,
104
- * never read from its address) and where the host serves the FAQs. Rendered
105
- * after the page's content, inside its container. Absent: no FAQ block.
106
- */
107
- faq?: PageFaqSlot;
108
102
  }
109
103
 
110
104
  /** The "no install" card: the host's words and its own button (the page holds no signup link). */
@@ -373,7 +367,6 @@ export function DownloadAppsPage({
373
367
  onDownloadAction,
374
368
  openAppHref,
375
369
  web,
376
- faq,
377
370
  }: DownloadAppsPageProps) {
378
371
  const { data, isLoading, error, reload } = useDownloads({ endpoint, initialData });
379
372
  // In a page's loading state the answer is read: the page draws its sections' skeletons, never nothing.
@@ -462,7 +455,7 @@ export function DownloadAppsPage({
462
455
  {body}
463
456
  {web && <WebCard web={web} />}
464
457
  </div>
465
- {faq && <FaqSection {...pageFaqProps(faq)} />}
458
+ <SharedPageFaq />
466
459
  </DownloadAppsChrome>
467
460
  );
468
461
  }
@@ -10,7 +10,6 @@
10
10
 
11
11
  import type { ReactNode } from 'react';
12
12
  import type { OnboardingGuide } from '../chat/types/entities/onboarding-guide';
13
- import type { PageFaqSlot } from '../faq/faq-section';
14
13
  import { OnboardingGuidesCatalogView } from '../onboarding-guides';
15
14
  import { DevSectionPage } from '../shared/dev-section';
16
15
 
@@ -33,12 +32,6 @@ export interface OnboardingGuidesCatalogPageProps {
33
32
  subtitle?: string;
34
33
  /** Optional slot rendered below the catalog, inside the page chrome. */
35
34
  belowContent?: ReactNode;
36
- /**
37
- * The page's own FAQ block: the topic the page is about (stated by the host,
38
- * never read from its address) and where the host serves the FAQs. Rendered
39
- * after the page's content, inside its container. Absent: no FAQ block.
40
- */
41
- faq?: PageFaqSlot;
42
35
  /** Render the standalone `<PageShell>`. Default true. Pass false when the host
43
36
  * layout already provides the page container (forwarded to `DevSectionPage`). */
44
37
  shell?: boolean;
@@ -55,18 +48,10 @@ export function OnboardingGuidesCatalogPage({
55
48
  title,
56
49
  subtitle,
57
50
  belowContent,
58
- faq,
59
51
  shell,
60
52
  }: OnboardingGuidesCatalogPageProps) {
61
53
  return (
62
- <DevSectionPage
63
- sectionKey="onboarding"
64
- backButton={backButton}
65
- title={title}
66
- subtitle={subtitle}
67
- faq={faq}
68
- shell={shell}
69
- >
54
+ <DevSectionPage sectionKey="onboarding" backButton={backButton} title={title} subtitle={subtitle} shell={shell}>
70
55
  <OnboardingGuidesCatalogView
71
56
  guidesEndpoint={guidesEndpoint}
72
57
  sectionsEndpoint={sectionsEndpoint}
@@ -10,7 +10,6 @@
10
10
 
11
11
  import type { ReactNode } from 'react';
12
12
  import type { ProductRelease, ProductReleaseListResponse } from '../../types/product-release';
13
- import type { PageFaqSlot } from '../faq/faq-section';
14
13
  import { DevSectionPage } from '../shared/dev-section';
15
14
  import { ProductReleasesView, type ProductReleaseCardExtras } from '../shared/product-release';
16
15
 
@@ -29,12 +28,6 @@ export interface ProductReleasesListPageProps {
29
28
  subtitle?: string;
30
29
  /** Optional slot rendered below the list, inside the page chrome. */
31
30
  belowContent?: ReactNode;
32
- /**
33
- * The page's own FAQ block: the topic the page is about (stated by the host,
34
- * never read from its address) and where the host serves the FAQs. Rendered
35
- * after the page's content, inside its container. Absent: no FAQ block.
36
- */
37
- faq?: PageFaqSlot;
38
31
  /** Render the standalone `<PageShell>`. Default true. Pass false when the host
39
32
  * layout already provides the page container (forwarded to `DevSectionPage`). */
40
33
  shell?: boolean;
@@ -49,18 +42,10 @@ export function ProductReleasesListPage({
49
42
  title,
50
43
  subtitle,
51
44
  belowContent,
52
- faq,
53
45
  shell,
54
46
  }: ProductReleasesListPageProps) {
55
47
  return (
56
- <DevSectionPage
57
- sectionKey="releases"
58
- backButton={backButton}
59
- title={title}
60
- subtitle={subtitle}
61
- faq={faq}
62
- shell={shell}
63
- >
48
+ <DevSectionPage sectionKey="releases" backButton={backButton} title={title} subtitle={subtitle} shell={shell}>
64
49
  <ProductReleasesView
65
50
  endpoint={releasesEndpoint}
66
51
  basePath={basePath}
@@ -10,7 +10,6 @@
10
10
 
11
11
  import type { ReactNode } from 'react';
12
12
  import type { RoadmapItem } from '../chat/types/entities/roadmap-item';
13
- import type { PageFaqSlot } from '../faq/faq-section';
14
13
  import { DevSectionPage } from '../shared/dev-section';
15
14
  import { RoadmapView } from '../shared/roadmap';
16
15
  import type { UseRoadmapVotingOptions } from '../shared/roadmap';
@@ -36,12 +35,6 @@ export interface RoadmapPageProps {
36
35
  /** Optional slot rendered below the list, inside the page chrome — e.g. the
37
36
  * hub's related-content rail. */
38
37
  belowContent?: ReactNode;
39
- /**
40
- * The page's own FAQ block: the topic the page is about (stated by the host,
41
- * never read from its address) and where the host serves the FAQs. Rendered
42
- * after the page's content, inside its container. Absent: no FAQ block.
43
- */
44
- faq?: PageFaqSlot;
45
38
  /** Render the standalone `<PageShell>`. Default true. Pass false when the host
46
39
  * layout already provides the page container (forwarded to `DevSectionPage`). */
47
40
  shell?: boolean;
@@ -58,18 +51,10 @@ export function RoadmapPage({
58
51
  title,
59
52
  subtitle,
60
53
  belowContent,
61
- faq,
62
54
  shell,
63
55
  }: RoadmapPageProps) {
64
56
  return (
65
- <DevSectionPage
66
- sectionKey="roadmap"
67
- backButton={backButton}
68
- title={title}
69
- subtitle={subtitle}
70
- faq={faq}
71
- shell={shell}
72
- >
57
+ <DevSectionPage sectionKey="roadmap" backButton={backButton} title={title} subtitle={subtitle} shell={shell}>
73
58
  <RoadmapView
74
59
  endpoint={roadmapEndpoint}
75
60
  initialItems={initialItems}
@@ -93,7 +93,7 @@ export interface TrustCenterPageProps {
93
93
  title?: string;
94
94
  /** Page subtitle. Default the brand-neutral `TRUST_CENTER_TAGLINE` (a host adds its brand here). */
95
95
  subtitle?: string;
96
- /** The FAQ section's "ask the assistant" card (`FaqSection`'s `ask`): the host states its topic. Absent: no card. */
96
+ /** The FAQ section's "ask the assistant" card (`FaqSection`'s `ask`), for the page's topic (`usePageTopic`): `false` switches it off. */
97
97
  ask?: FaqSectionProps['ask'];
98
98
  /**
99
99
  * Host content shown after the trust sections and BEFORE the FAQ (the hub's
@@ -50,6 +50,7 @@ export * from './persistent-pagination';
50
50
  export * from './pricing-display';
51
51
  export * from './agent-identity';
52
52
  export * from './agent-mark';
53
+ export * from './page-topic-label';
53
54
  export * from './results-count';
54
55
  export * from './selection-source-badge';
55
56
  export * from './social-icon-row';
@@ -0,0 +1,30 @@
1
+ 'use client';
2
+
3
+ import { usePageTopic } from '../contexts/page-topics-context';
4
+ import { cn } from '../utils/cn';
5
+
6
+ export interface PageTopicLabelProps {
7
+ className?: string;
8
+ }
9
+
10
+ /**
11
+ * The page's topic (`usePageTopic`) as a faint stamp: what the FAQ block prints
12
+ * under its heading and the chat prints by its quick actions, so whoever edits
13
+ * FAQs or quick actions can check which topic a page asks for. A debugging aid,
14
+ * not copy: the badge size at reduced opacity, named on hover. ONE label read
15
+ * from ONE source, so the two surfaces can never show different topics. Nothing
16
+ * renders when the page has no topic.
17
+ */
18
+ export function PageTopicLabel({ className }: PageTopicLabelProps) {
19
+ const topic = usePageTopic();
20
+ if (!topic) return null;
21
+ return (
22
+ <p
23
+ data-page-topic={topic}
24
+ title="Page topic"
25
+ className={cn('leading-none text-ods-text-muted opacity-60 text-badge', className)}
26
+ >
27
+ {topic}
28
+ </p>
29
+ );
30
+ }
@@ -22,7 +22,7 @@ import {
22
22
  OPENFRAME_DEV_SECTIONS,
23
23
  type OpenframeDevSectionKey,
24
24
  } from '../../../utils/dev-sections/openframe-dev-sections';
25
- import { FaqSection, pageFaqProps, type PageFaqSlot } from '../../faq/faq-section';
25
+ import { SharedPageFaq } from '../../faq/faq-section';
26
26
  import { PageShell, PageLayout } from '../../ui';
27
27
  import { DevSectionView } from './dev-section-view';
28
28
 
@@ -52,12 +52,6 @@ export interface DevSectionPageProps {
52
52
  * `false` when the host layout already provides the page container (e.g.
53
53
  * openframe-frontend's `AppLayout` `<main>`): then only the
54
54
  * `page-shell-content` padding box is rendered, avoiding a nested `<main>`. */
55
- /**
56
- * The page's own FAQ block: the topic the page is about (stated by the host,
57
- * never read from its address) and where the host serves the FAQs. Rendered
58
- * after the page's content, inside its container. Absent: no FAQ block.
59
- */
60
- faq?: PageFaqSlot;
61
55
  shell?: boolean;
62
56
  }
63
57
 
@@ -68,7 +62,6 @@ export function DevSectionPage({
68
62
  backButton,
69
63
  title,
70
64
  subtitle,
71
- faq,
72
65
  shell = true,
73
66
  }: DevSectionPageProps) {
74
67
  const router = useRouter();
@@ -103,7 +96,7 @@ export function DevSectionPage({
103
96
  <DevSectionView sectionKey={sectionKey} showHeading={false} preControls={preControls}>
104
97
  {children}
105
98
  </DevSectionView>
106
- {faq && <FaqSection {...pageFaqProps(faq)} />}
99
+ <SharedPageFaq />
107
100
  </PageLayout>
108
101
  );
109
102
 
@@ -21,7 +21,7 @@ import type { ComponentType } from 'react';
21
21
  import Link from '../../../embed-shims/next-link';
22
22
  import { useRouter } from '../../../embed-shims/next-navigation';
23
23
  import { cn } from '../../../utils/cn';
24
- import { FaqSection, pageFaqProps, type PageFaqSlot } from '../../faq/faq-section';
24
+ import { SharedPageFaq } from '../../faq/faq-section';
25
25
  import { LoadingRegion } from '../../loading/loading-region';
26
26
  import { PageShell, PageLayout } from '../../ui';
27
27
  import { DataSyncLine } from '../../ui/data-attribution';
@@ -68,18 +68,11 @@ export interface LegalDocumentPageProps {
68
68
  backButton?: { label?: string; href?: string } | false;
69
69
  /**
70
70
  * The hub's list of legal documents (`GET /api/legal`). Given it, the page
71
- * takes the document's title and FAQ topic from the list, so a host passes
71
+ * takes the document's title from the list, so a host passes
72
72
  * only the type and its endpoints and states nothing per document; the title
73
73
  * then names the document even when its text fails to load.
74
74
  */
75
75
  documentsEndpoint?: string;
76
- /**
77
- * The page's own FAQ block: the topic the page is about and where the host
78
- * serves the FAQs. Rendered after the page's content, inside its container.
79
- * Without a `topic`, the topic is the one the list (`documentsEndpoint`)
80
- * gives the document. Absent, or no topic known: no FAQ block.
81
- */
82
- faq?: PageFaqSlot | Omit<PageFaqSlot, 'topic'>;
83
76
  /** Render the standalone `<PageShell>`. Default true. Pass false when the host
84
77
  * layout already provides the page container — only the padding box renders,
85
78
  * avoiding a nested `<main>`. */
@@ -133,7 +126,6 @@ export function LegalDocumentPage({
133
126
  MarkdownRenderer = RichMarkdownRenderer,
134
127
  documentsEndpoint,
135
128
  backButton,
136
- faq,
137
129
  shell = true,
138
130
  }: LegalDocumentPageProps) {
139
131
  const router = useRouter();
@@ -155,8 +147,6 @@ export function LegalDocumentPage({
155
147
  const { documents } = useLegalDocuments({ apiEndpoint: documentsEndpoint, enabled: Boolean(documentsEndpoint) });
156
148
  const listed = documents.find(doc => doc.docType === docType);
157
149
  const title = titleProp ?? data?.title ?? listed?.title ?? 'Legal document';
158
- const faqTopic = faq && 'topic' in faq ? faq.topic : listed?.faqTopic;
159
- const faqSlot = faq && faqTopic ? { ...faq, topic: faqTopic } : null;
160
150
  const errorTitle = errorTitleProp ?? `Unable to load ${title}`;
161
151
  const emptyStateMessage = emptyStateMessageProp ?? `${title} is not available at this time.`;
162
152
 
@@ -221,7 +211,7 @@ export function LegalDocumentPage({
221
211
  </div>
222
212
  </div>
223
213
  </div>
224
- {faqSlot && <FaqSection {...pageFaqProps(faqSlot)} />}
214
+ <SharedPageFaq />
225
215
  </PageLayout>
226
216
  );
227
217
 
@@ -25,8 +25,6 @@ export interface LegalDocumentSummary {
25
25
  /** The document's page on the hub's own site (a path). */
26
26
  route: string;
27
27
  sourceFile: string;
28
- /** The topic the document's FAQs are written for, when the hub has one. */
29
- faqTopic: string | null;
30
28
  version: string | null;
31
29
  effectiveDate: string | null;
32
30
  /** False while the hub has no content for it yet. */
@@ -71,7 +69,6 @@ export function toLegalDocumentSummaries(payload: unknown): LegalDocumentSummary
71
69
  summary: text(row, 'summary') ?? '',
72
70
  route: text(row, 'route') ?? '',
73
71
  sourceFile: text(row, 'sourceFile') ?? '',
74
- faqTopic: text(row, 'faqTopic'),
75
72
  version: text(row, 'version'),
76
73
  effectiveDate: text(row, 'effectiveDate'),
77
74
  published: row.published === true,