@flamingo-stack/openframe-frontend-core 0.0.285 → 0.0.286-snapshot.20260618154650
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-3MCHAFHB.js +89 -0
- package/dist/chunk-3MCHAFHB.js.map +1 -0
- package/dist/chunk-3SDBXXDP.cjs +1594 -0
- package/dist/chunk-3SDBXXDP.cjs.map +1 -0
- package/dist/{chunk-IMNGGLKL.js → chunk-3ZXUQQL4.js} +2 -2
- package/dist/chunk-5KD3S25X.cjs +312 -0
- package/dist/chunk-5KD3S25X.cjs.map +1 -0
- package/dist/{chunk-44ZFLMYC.cjs → chunk-6AW25OS6.cjs} +30 -30
- package/dist/{chunk-44ZFLMYC.cjs.map → chunk-6AW25OS6.cjs.map} +1 -1
- package/dist/{chunk-XDI5JSWB.cjs → chunk-6CSW5TMS.cjs} +45 -41
- package/dist/chunk-6CSW5TMS.cjs.map +1 -0
- package/dist/chunk-7EYWERFT.js +1594 -0
- package/dist/chunk-7EYWERFT.js.map +1 -0
- package/dist/{chunk-XX7P4IL2.js → chunk-7NM7DEUK.js} +4 -143
- package/dist/chunk-7NM7DEUK.js.map +1 -0
- package/dist/{chunk-GVSTRN36.cjs → chunk-D3LEFMOA.cjs} +3 -3
- package/dist/{chunk-GVSTRN36.cjs.map → chunk-D3LEFMOA.cjs.map} +1 -1
- package/dist/chunk-D6RK5YXX.cjs +2439 -0
- package/dist/chunk-D6RK5YXX.cjs.map +1 -0
- package/dist/{chunk-VQW7CEGS.js → chunk-EFYXPR43.js} +1831 -3672
- package/dist/chunk-EFYXPR43.js.map +1 -0
- package/dist/{chunk-PVXCVPJD.cjs → chunk-EI4WALN2.cjs} +67 -1626
- package/dist/chunk-EI4WALN2.cjs.map +1 -0
- package/dist/{chunk-ZIODAAFY.cjs → chunk-EL5GCMPU.cjs} +20 -159
- package/dist/chunk-EL5GCMPU.cjs.map +1 -0
- package/dist/{chunk-53CFL7PH.js → chunk-GJDXIVEQ.js} +11 -7
- package/dist/{chunk-53CFL7PH.js.map → chunk-GJDXIVEQ.js.map} +1 -1
- package/dist/chunk-I6ZPGKZ2.cjs +151 -0
- package/dist/chunk-I6ZPGKZ2.cjs.map +1 -0
- package/dist/{chunk-P45Q4QCU.cjs → chunk-JQ4I743L.cjs} +19 -15
- package/dist/chunk-JQ4I743L.cjs.map +1 -0
- package/dist/{chunk-J66U3LPZ.cjs → chunk-KBKZYJRI.cjs} +33 -332
- package/dist/chunk-KBKZYJRI.cjs.map +1 -0
- package/dist/chunk-MV67MBV3.js +290 -0
- package/dist/chunk-MV67MBV3.js.map +1 -0
- package/dist/chunk-MWS25U4U.cjs +290 -0
- package/dist/chunk-MWS25U4U.cjs.map +1 -0
- package/dist/{chunk-USPATRSC.js → chunk-N6ZM5PYZ.js} +45 -344
- package/dist/chunk-N6ZM5PYZ.js.map +1 -0
- package/dist/chunk-ODR6A6FC.js +2439 -0
- package/dist/chunk-ODR6A6FC.js.map +1 -0
- package/dist/{chunk-DPKUSBQH.cjs → chunk-OXC72UIP.cjs} +1073 -2914
- package/dist/chunk-OXC72UIP.cjs.map +1 -0
- package/dist/{chunk-RGALV4UX.js → chunk-POKKCWKF.js} +3 -82
- package/dist/chunk-POKKCWKF.js.map +1 -0
- package/dist/{chunk-Z3V2SGQZ.js → chunk-R2KT5GDD.js} +324 -1883
- package/dist/chunk-R2KT5GDD.js.map +1 -0
- package/dist/{chunk-RJUGNL2A.cjs → chunk-RG6FNZUA.cjs} +73 -31
- package/dist/chunk-RG6FNZUA.cjs.map +1 -0
- package/dist/{chunk-23UOJUDF.js → chunk-RWCA2ZQK.js} +4 -4
- package/dist/chunk-TFSYSWPS.cjs +89 -0
- package/dist/chunk-TFSYSWPS.cjs.map +1 -0
- package/dist/{chunk-KNCDUWY2.js → chunk-TY2EB7VK.js} +65 -23
- package/dist/chunk-TY2EB7VK.js.map +1 -0
- package/dist/chunk-TYZEMPPH.js +312 -0
- package/dist/chunk-TYZEMPPH.js.map +1 -0
- package/dist/chunk-VRSXJ5QJ.js +1599 -0
- package/dist/chunk-VRSXJ5QJ.js.map +1 -0
- package/dist/chunk-Y4JNA4W6.cjs +1599 -0
- package/dist/chunk-Y4JNA4W6.cjs.map +1 -0
- package/dist/{chunk-ZSUNQJRO.cjs → chunk-YETA25JW.cjs} +2 -81
- package/dist/chunk-YETA25JW.cjs.map +1 -0
- package/dist/chunk-ZLN6SM2U.js +151 -0
- package/dist/chunk-ZLN6SM2U.js.map +1 -0
- package/dist/{chunk-O5N57CRV.js → chunk-ZYLQMCHW.js} +12 -8
- package/dist/{chunk-O5N57CRV.js.map → chunk-ZYLQMCHW.js.map} +1 -1
- package/dist/components/chat/chat-attachment-bar.d.ts.map +1 -1
- package/dist/components/chat/index.cjs +12 -6
- package/dist/components/chat/index.cjs.map +1 -1
- package/dist/components/chat/index.js +45 -39
- package/dist/components/contact/index.cjs +11 -7
- package/dist/components/contact/index.cjs.map +1 -1
- package/dist/components/contact/index.js +10 -6
- package/dist/components/docs/doc-navigation-context.d.ts +39 -0
- package/dist/components/docs/doc-navigation-context.d.ts.map +1 -0
- package/dist/components/docs/doc-viewer.d.ts +66 -0
- package/dist/components/docs/doc-viewer.d.ts.map +1 -0
- package/dist/components/docs/index.cjs +34 -0
- package/dist/components/docs/index.cjs.map +1 -0
- package/dist/components/docs/index.d.ts +8 -0
- package/dist/components/docs/index.d.ts.map +1 -0
- package/dist/components/docs/index.js +34 -0
- package/dist/components/docs/index.js.map +1 -0
- package/dist/components/docs/use-document-tree.d.ts +41 -0
- package/dist/components/docs/use-document-tree.d.ts.map +1 -0
- package/dist/components/docs/use-scroll-spy.d.ts +16 -0
- package/dist/components/docs/use-scroll-spy.d.ts.map +1 -0
- package/dist/components/embeds/embed-iframe.d.ts +29 -0
- package/dist/components/embeds/embed-iframe.d.ts.map +1 -0
- package/dist/components/embeds/figma-embed.d.ts +27 -0
- package/dist/components/embeds/figma-embed.d.ts.map +1 -0
- package/dist/components/embeds/google-sheets-viewer.d.ts +8 -0
- package/dist/components/embeds/google-sheets-viewer.d.ts.map +1 -0
- package/dist/components/embeds/index.cjs +37 -0
- package/dist/components/embeds/index.cjs.map +1 -0
- package/dist/components/embeds/index.d.ts +9 -0
- package/dist/components/embeds/index.d.ts.map +1 -0
- package/dist/components/embeds/index.js +37 -0
- package/dist/components/embeds/index.js.map +1 -0
- package/dist/components/embeds/pdf-viewer.d.ts +10 -0
- package/dist/components/embeds/pdf-viewer.d.ts.map +1 -0
- package/dist/components/faq/faq-section.d.ts.map +1 -1
- package/dist/components/faq/index.cjs +12 -8
- package/dist/components/faq/index.cjs.map +1 -1
- package/dist/components/faq/index.js +11 -7
- package/dist/components/faq-accordion.d.ts.map +1 -1
- package/dist/components/features/index.cjs +10 -6
- package/dist/components/features/index.cjs.map +1 -1
- package/dist/components/features/index.js +9 -5
- package/dist/components/index.cjs +247 -1120
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +645 -1518
- package/dist/components/index.js.map +1 -1
- package/dist/components/navigation/index.cjs +15 -6
- package/dist/components/navigation/index.cjs.map +1 -1
- package/dist/components/navigation/index.d.ts +2 -0
- package/dist/components/navigation/index.d.ts.map +1 -1
- package/dist/components/navigation/index.js +15 -6
- package/dist/components/navigation/multi-level-navigation.d.ts +28 -0
- package/dist/components/navigation/multi-level-navigation.d.ts.map +1 -0
- package/dist/components/onboarding-guides/index.cjs +34 -29
- package/dist/components/onboarding-guides/index.cjs.map +1 -1
- package/dist/components/onboarding-guides/index.js +13 -8
- package/dist/components/onboarding-guides/index.js.map +1 -1
- package/dist/components/related-content/index.cjs +12 -8
- package/dist/components/related-content/index.cjs.map +1 -1
- package/dist/components/related-content/index.js +11 -7
- package/dist/components/tickets/index.cjs +75 -70
- package/dist/components/tickets/index.cjs.map +1 -1
- package/dist/components/tickets/index.js +16 -11
- package/dist/components/tickets/index.js.map +1 -1
- package/dist/components/ui/index.cjs +12 -6
- package/dist/components/ui/index.cjs.map +1 -1
- package/dist/components/ui/index.js +65 -59
- package/dist/embed-shims/index.cjs +3 -3
- package/dist/embed-shims/index.cjs.map +1 -1
- package/dist/embed-shims/index.js +8 -8
- package/dist/hooks/index.cjs +6 -3
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.js +7 -4
- package/dist/index.cjs +68 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +263 -201
- package/dist/types/doc-source.cjs +4 -0
- package/dist/types/doc-source.cjs.map +1 -0
- package/dist/types/doc-source.d.ts +86 -0
- package/dist/types/doc-source.d.ts.map +1 -0
- package/dist/types/doc-source.js +3 -0
- package/dist/types/doc-source.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/marketing.d.ts +1 -1
- package/dist/types/marketing.d.ts.map +1 -1
- package/dist/utils/doc-path-utils.d.ts +24 -0
- package/dist/utils/doc-path-utils.d.ts.map +1 -0
- package/dist/utils/doc-tree-nav.d.ts +35 -0
- package/dist/utils/doc-tree-nav.d.ts.map +1 -0
- package/dist/utils/embed-url-converters.d.ts +16 -0
- package/dist/utils/embed-url-converters.d.ts.map +1 -0
- package/dist/utils/faq-anchor.d.ts +51 -0
- package/dist/utils/faq-anchor.d.ts.map +1 -0
- package/dist/utils/format.d.ts +9 -0
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/index.cjs +320 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.ts +9 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +296 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/list-url.d.ts.map +1 -1
- package/dist/utils/markdown-section-extractor.d.ts +23 -0
- package/dist/utils/markdown-section-extractor.d.ts.map +1 -0
- package/dist/utils/markdown-to-plain.d.ts +32 -0
- package/dist/utils/markdown-to-plain.d.ts.map +1 -0
- package/dist/utils/tree-builder.d.ts +30 -0
- package/dist/utils/tree-builder.d.ts.map +1 -0
- package/package.json +19 -1
- package/src/components/chat/chat-attachment-bar.tsx +6 -11
- package/src/components/docs/doc-navigation-context.tsx +123 -0
- package/src/components/docs/doc-viewer.tsx +345 -0
- package/src/components/docs/index.ts +12 -0
- package/src/components/docs/use-document-tree.ts +427 -0
- package/src/components/docs/use-scroll-spy.ts +93 -0
- package/src/components/embeds/embed-iframe.tsx +103 -0
- package/src/components/embeds/figma-embed.tsx +147 -0
- package/src/components/embeds/google-sheets-viewer.tsx +54 -0
- package/src/components/embeds/index.ts +11 -0
- package/src/components/embeds/pdf-viewer.tsx +64 -0
- package/src/components/faq/faq-section.tsx +78 -26
- package/src/components/faq-accordion.tsx +8 -1
- package/src/components/index.ts +2 -0
- package/src/components/navigation/index.ts +5 -0
- package/src/components/navigation/multi-level-navigation.tsx +358 -0
- package/src/types/doc-source.ts +88 -0
- package/src/types/index.ts +4 -0
- package/src/types/marketing.ts +1 -0
- package/src/utils/doc-path-utils.ts +47 -0
- package/src/utils/doc-tree-nav.ts +111 -0
- package/src/utils/embed-url-converters.ts +77 -0
- package/src/utils/faq-anchor.ts +70 -0
- package/src/utils/format.ts +16 -0
- package/src/utils/index.ts +18 -0
- package/src/utils/list-url.ts +1 -0
- package/src/utils/markdown-section-extractor.ts +106 -0
- package/src/utils/markdown-to-plain.ts +69 -0
- package/src/utils/tree-builder.ts +114 -0
- package/dist/chunk-DPKUSBQH.cjs.map +0 -1
- package/dist/chunk-J66U3LPZ.cjs.map +0 -1
- package/dist/chunk-KNCDUWY2.js.map +0 -1
- package/dist/chunk-P45Q4QCU.cjs.map +0 -1
- package/dist/chunk-PVXCVPJD.cjs.map +0 -1
- package/dist/chunk-RGALV4UX.js.map +0 -1
- package/dist/chunk-RJUGNL2A.cjs.map +0 -1
- package/dist/chunk-USPATRSC.js.map +0 -1
- package/dist/chunk-VQW7CEGS.js.map +0 -1
- package/dist/chunk-XDI5JSWB.cjs.map +0 -1
- package/dist/chunk-XX7P4IL2.js.map +0 -1
- package/dist/chunk-Z3V2SGQZ.js.map +0 -1
- package/dist/chunk-ZIODAAFY.cjs.map +0 -1
- package/dist/chunk-ZSUNQJRO.cjs.map +0 -1
- /package/dist/{chunk-IMNGGLKL.js.map → chunk-3ZXUQQL4.js.map} +0 -0
- /package/dist/{chunk-23UOJUDF.js.map → chunk-RWCA2ZQK.js.map} +0 -0
|
@@ -1,18 +1,25 @@
|
|
|
1
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
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkD3LEFMOAcjs = require('./chunk-D3LEFMOA.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
var _chunkOXC72UIPcjs = require('./chunk-OXC72UIP.cjs');
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
var _chunkDPKUSBQHcjs = require('./chunk-DPKUSBQH.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkD6RK5YXXcjs = require('./chunk-D6RK5YXX.cjs');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _chunkEI4WALN2cjs = require('./chunk-EI4WALN2.cjs');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
var _chunkY4JNA4W6cjs = require('./chunk-Y4JNA4W6.cjs');
|
|
16
23
|
|
|
17
24
|
|
|
18
25
|
|
|
@@ -63,7 +70,8 @@ function FaqAccordion({ items, defaultOpenIds = [] }) {
|
|
|
63
70
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
64
71
|
"div",
|
|
65
72
|
{
|
|
66
|
-
|
|
73
|
+
id: _chunkD6RK5YXXcjs.faqItemAnchor.call(void 0, item.id),
|
|
74
|
+
className: _chunkFIG2RKZFcjs.cn.call(void 0, "group scroll-mt-24 transition-colors hover:bg-[#1E1E1E]", isOpen ? "bg-ods-bg" : "bg-transparent"),
|
|
67
75
|
children: [
|
|
68
76
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
69
77
|
"div",
|
|
@@ -82,7 +90,7 @@ function FaqAccordion({ items, defaultOpenIds = [] }) {
|
|
|
82
90
|
children: [
|
|
83
91
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "min-w-0 pr-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { children: item.question }) }),
|
|
84
92
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex-shrink-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
85
|
-
|
|
93
|
+
_chunkOXC72UIPcjs.ChevronButton,
|
|
86
94
|
{
|
|
87
95
|
"aria-label": isOpen ? "Collapse question" : "Expand question",
|
|
88
96
|
size: "md",
|
|
@@ -142,10 +150,7 @@ function buildFaqJsonLdFromFaqs(faqs, opts = {}) {
|
|
|
142
150
|
|
|
143
151
|
var DEFAULT_HEADING_TEXT = "Frequently Asked Questions";
|
|
144
152
|
function buildFaqsUrl(entityType, entityId, minResults, apiBaseUrl = "") {
|
|
145
|
-
return
|
|
146
|
-
}
|
|
147
|
-
function sectionSlug(section) {
|
|
148
|
-
return "faq-" + section.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
153
|
+
return _chunkD6RK5YXXcjs.buildSuggestionUrl.call(void 0, "/api/faqs", { apiBaseUrl, entityType, entityId, count: minResults });
|
|
149
154
|
}
|
|
150
155
|
function groupFaqsBySection(faqs) {
|
|
151
156
|
const order = [];
|
|
@@ -161,7 +166,7 @@ function groupFaqsBySection(faqs) {
|
|
|
161
166
|
}
|
|
162
167
|
let group = byName.get(name);
|
|
163
168
|
if (!group) {
|
|
164
|
-
group = { section: name, slug:
|
|
169
|
+
group = { section: name, slug: _chunkD6RK5YXXcjs.faqSectionSlug.call(void 0, name), items: [] };
|
|
165
170
|
byName.set(name, group);
|
|
166
171
|
order.push(name);
|
|
167
172
|
}
|
|
@@ -172,6 +177,8 @@ function groupFaqsBySection(faqs) {
|
|
|
172
177
|
return groups;
|
|
173
178
|
}
|
|
174
179
|
var FAQ_NAV_HEADER_OFFSET = 96;
|
|
180
|
+
var UNCATEGORIZED_KEY = "__uncategorized__";
|
|
181
|
+
var groupKey = (g) => _nullishCoalesce(g.slug, () => ( UNCATEGORIZED_KEY));
|
|
175
182
|
function GroupedFaqList({
|
|
176
183
|
groups,
|
|
177
184
|
categoryHeadingAs
|
|
@@ -208,11 +215,36 @@ function GroupedFaqList({
|
|
|
208
215
|
}
|
|
209
216
|
return () => observer.disconnect();
|
|
210
217
|
}, [slugKey]);
|
|
218
|
+
const [hashTarget, setHashTarget] = _react.useState.call(void 0, null);
|
|
219
|
+
_react.useEffect.call(void 0, () => {
|
|
220
|
+
const refresh = () => setHashTarget(_chunkD6RK5YXXcjs.parseFaqHash.call(void 0, window.location.hash));
|
|
221
|
+
refresh();
|
|
222
|
+
window.addEventListener("hashchange", refresh);
|
|
223
|
+
return () => window.removeEventListener("hashchange", refresh);
|
|
224
|
+
}, []);
|
|
225
|
+
const defaultOpenByGroupKey = _react.useMemo.call(void 0, () => {
|
|
226
|
+
if (_optionalChain([hashTarget, 'optionalAccess', _7 => _7.kind]) !== "item") return null;
|
|
227
|
+
const targetId = hashTarget.rawId;
|
|
228
|
+
const result = /* @__PURE__ */ new Map();
|
|
229
|
+
for (const group of groups) {
|
|
230
|
+
const hit = group.items.find((i) => String(i.id) === targetId);
|
|
231
|
+
if (hit) result.set(groupKey(group), [hit.id]);
|
|
232
|
+
}
|
|
233
|
+
return result.size > 0 ? result : null;
|
|
234
|
+
}, [groups, hashTarget]);
|
|
235
|
+
const accordionKeySuffix = _optionalChain([hashTarget, 'optionalAccess', _8 => _8.kind]) === "item" ? `item:${hashTarget.rawId}` : "default";
|
|
236
|
+
_react.useEffect.call(void 0, () => {
|
|
237
|
+
if (!hashTarget) return;
|
|
238
|
+
const elId = hashTarget.kind === "item" ? _chunkD6RK5YXXcjs.faqItemAnchor.call(void 0, hashTarget.rawId) : hashTarget.slug;
|
|
239
|
+
const el = document.getElementById(elId);
|
|
240
|
+
if (el) _chunkD6RK5YXXcjs.scrollElementIntoView.call(void 0, el, { headerOffset: FAQ_NAV_HEADER_OFFSET });
|
|
241
|
+
if (hashTarget.kind === "section") setActiveSlug(hashTarget.slug);
|
|
242
|
+
}, [hashTarget]);
|
|
211
243
|
const handleJump = _react.useCallback.call(void 0,
|
|
212
244
|
(e, slug) => {
|
|
213
245
|
e.preventDefault();
|
|
214
246
|
setActiveSlug(slug);
|
|
215
|
-
|
|
247
|
+
_chunkD6RK5YXXcjs.scrollElementIntoView.call(void 0, document.getElementById(slug), {
|
|
216
248
|
headerOffset: FAQ_NAV_HEADER_OFFSET
|
|
217
249
|
});
|
|
218
250
|
if (typeof history !== "undefined") history.replaceState(null, "", `#${slug}`);
|
|
@@ -237,18 +269,28 @@ function GroupedFaqList({
|
|
|
237
269
|
group.slug
|
|
238
270
|
);
|
|
239
271
|
}) }),
|
|
240
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-10", children: groups.map((group) =>
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
272
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-10", children: groups.map((group) => {
|
|
273
|
+
const key = groupKey(group);
|
|
274
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
275
|
+
"section",
|
|
276
|
+
{
|
|
277
|
+
id: _nullishCoalesce(group.slug, () => ( void 0)),
|
|
278
|
+
className: "scroll-mt-24 space-y-4",
|
|
279
|
+
children: [
|
|
280
|
+
group.section && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CategoryHeading, { className: _chunkY4JNA4W6cjs.SECTION_HEADING_CLASS, children: group.section }),
|
|
281
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
282
|
+
FaqAccordion,
|
|
283
|
+
{
|
|
284
|
+
items: group.items,
|
|
285
|
+
defaultOpenIds: _optionalChain([defaultOpenByGroupKey, 'optionalAccess', _9 => _9.get, 'call', _10 => _10(key)])
|
|
286
|
+
},
|
|
287
|
+
`${key}:${accordionKeySuffix}`
|
|
288
|
+
)
|
|
289
|
+
]
|
|
290
|
+
},
|
|
291
|
+
key
|
|
292
|
+
);
|
|
293
|
+
}) })
|
|
252
294
|
] });
|
|
253
295
|
}
|
|
254
296
|
function FaqSkeleton() {
|
|
@@ -276,10 +318,10 @@ function FaqSection({
|
|
|
276
318
|
() => initialFaqs ? { faqs: initialFaqs } : void 0,
|
|
277
319
|
[initialFaqs]
|
|
278
320
|
);
|
|
279
|
-
const { data, isLoading, error } =
|
|
280
|
-
const faqs = _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
321
|
+
const { data, isLoading, error } = _chunkD3LEFMOAcjs.useSelfFetch.call(void 0, url, { initialData });
|
|
322
|
+
const faqs = _nullishCoalesce(_optionalChain([data, 'optionalAccess', _11 => _11.faqs]), () => ( []));
|
|
281
323
|
const groups = _react.useMemo.call(void 0, () => faqs.length > 0 ? groupFaqsBySection(faqs) : [], [faqs]);
|
|
282
|
-
const headingNode = heading === void 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className:
|
|
324
|
+
const headingNode = heading === void 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: _chunkY4JNA4W6cjs.SECTION_HEADING_CLASS, children: DEFAULT_HEADING_TEXT }) : heading;
|
|
283
325
|
if (error) return null;
|
|
284
326
|
if (!isLoading && faqs.length === 0) return null;
|
|
285
327
|
if (isLoading && faqs.length === 0) {
|
|
@@ -295,7 +337,7 @@ function FaqSection({
|
|
|
295
337
|
"script",
|
|
296
338
|
{
|
|
297
339
|
type: "application/ld+json",
|
|
298
|
-
dangerouslySetInnerHTML: { __html:
|
|
340
|
+
dangerouslySetInnerHTML: { __html: _chunkD6RK5YXXcjs.serializeJsonLd.call(void 0, schema) }
|
|
299
341
|
}
|
|
300
342
|
)
|
|
301
343
|
] });
|
|
@@ -315,10 +357,10 @@ function FaqDocumentPage({
|
|
|
315
357
|
}) {
|
|
316
358
|
const router = _chunkG7UE6RKVcjs.useRouter.call(void 0, );
|
|
317
359
|
const backCfg = backButton === false ? void 0 : {
|
|
318
|
-
label: _nullishCoalesce(_optionalChain([backButton, 'optionalAccess',
|
|
319
|
-
onClick: () => router.push(_nullishCoalesce(_optionalChain([backButton, 'optionalAccess',
|
|
360
|
+
label: _nullishCoalesce(_optionalChain([backButton, 'optionalAccess', _12 => _12.label]), () => ( "Back to home")),
|
|
361
|
+
onClick: () => router.push(_nullishCoalesce(_optionalChain([backButton, 'optionalAccess', _13 => _13.href]), () => ( "/")))
|
|
320
362
|
};
|
|
321
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
363
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEI4WALN2cjs.PageShell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEI4WALN2cjs.PageLayout, { title, subtitle, backButton: backCfg, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
322
364
|
FaqSection,
|
|
323
365
|
{
|
|
324
366
|
heading: null,
|
|
@@ -335,4 +377,4 @@ function FaqDocumentPage({
|
|
|
335
377
|
|
|
336
378
|
|
|
337
379
|
exports.FaqAccordion = FaqAccordion; exports.FaqSection = FaqSection; exports.FaqDocumentPage = FaqDocumentPage;
|
|
338
|
-
//# sourceMappingURL=chunk-
|
|
380
|
+
//# sourceMappingURL=chunk-RG6FNZUA.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-RG6FNZUA.cjs","../src/components/faq/faq-section.tsx","../src/components/faq-accordion.tsx","../src/components/faq/json-ld.ts","../src/components/faq/faq-document-page.tsx"],"names":["jsx","jsxs"],"mappings":"AAAA,6rBAAY;AACZ;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;AC7BA,8BAAiE;AD+BjE;AACA;AEhCA;AAEA,uCAAA,CAAA;AAoEY,+CAAA;AArDZ,IAAM,kBAAA,EAAoB,CAAC,MAAA,EAAA,GAAoB;AAC7C,EAAA,MAAM,IAAA,EAAM,2BAAA,IAAkC,CAAA;AAC9C,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,EAAA,EAAI,6BAAA,KAAsB,CAAA;AAExD,EAAA,MAAM,QAAA,EAAU,gCAAA,CAAY,EAAA,GAAM;AAChC,IAAA,GAAA,CAAI,GAAA,CAAI,OAAA,EAAS;AACf,MAAA,MAAM,OAAA,EAAS,GAAA,CAAI,OAAA,CAAQ,YAAA;AAC3B,MAAA,YAAA,CAAa,CAAA,EAAA;AACf,IAAA;AACG,EAAA;AAGW,EAAA;AACF,IAAA;AACF,MAAA;AACH,IAAA;AACQ,MAAA;AACf,IAAA;AAC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AC,cAAA;AAAA,cAAA;AAKC,gBAAA;AACA,gBAAA;AAA8C,cAAA;AAFnC,cAAA;AAGb,YAAA;AAAA,UAAA;AAAA,QAAA;AAdK,QAAA;AAeP,MAAA;AAGN,IAAA;AACF,EAAA;AAEJ;AAES;AAEL,EAAA;AACEA,oBAAAA;AACAA,oBAAAA;AAGM,sBAAA;AACA,sBAAA;AAGN,IAAA;AACF,EAAA;AAEJ;AAuB2B;AACzB,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACa,EAAA;AACb,EAAA;AACA,EAAA;AACA,EAAA;AACa,EAAA;AACK;AACN,EAAA;AAGN,EAAA;AACG,IAAA;AACK,IAAA;AACd,EAAA;AACc,EAAA;AAED,EAAA;AAEE,EAAA;AAKT,EAAA;AAKY,EAAA;AACA,EAAA;AACD,EAAA;AAEb,IAAA;AAIJ,EAAA;AAEe,EAAA;AAGb,EAAA;AACEC,oBAAAA;AACG,MAAA;AACD,sBAAA;AACF,IAAA;AAEE,IAAA;AAAC,MAAA;AAAA,MAAA;AACM,QAAA;AAIL,QAAA;AAA2D,MAAA;AAC7D,IAAA;AAEJ,EAAA;AAEJ;ADxCoB;AACA;AI3UpB;AA4CQD;AAxBQ;AACN,EAAA;AACR,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACuB;AACR,EAAA;AAKb,EAAA;AAGa,IAAA;AACQ,IAAA;AACjB,EAAA;AAGJ,EAAA;AAEK,IAAA;AAAA,IAAA;AACU,MAAA;AACT,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AAAA,IAAA;AAGN,EAAA;AAEJ;AJiToB;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-RG6FNZUA.cjs","sourcesContent":[null,"\"use client\"\n\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\nimport type { Faq } from '../../types/faq'\nimport { FaqAccordion, type FaqItem } from '../faq-accordion'\nimport { useSelfFetch } from '../../hooks/use-self-fetch'\nimport { buildSuggestionUrl } from '../../utils/suggestion-url'\nimport { serializeJsonLd } from '../../utils/common'\nimport { scrollElementIntoView } from '../../utils/scroll-into-view'\nimport { faqSectionSlug, faqItemAnchor, parseFaqHash, type FaqHashTarget } from '../../utils/faq-anchor'\nimport { cn } from '../../utils/cn'\nimport { buildFaqJsonLdFromFaqs, type FaqSchemaOptions } from './json-ld'\nimport { SECTION_HEADING_CLASS } from '../layout/page-heading'\n\nexport interface FaqSectionProps {\n /**\n * SSR hydrate. When provided, the hook skips the first client fetch (per\n * useSelfFetch contract). The consuming server page resolves FAQs then drills\n * them into this prop — the lib never re-fetches what the host already gated on.\n */\n initialFaqs?: Faq[]\n /** Both required together for entity-attached FAQs; partial → bare /api/faqs. */\n entityType?: string\n entityId?: number | string\n /**\n * Heading node above the grouped list. `undefined` → default\n * `<h2>`\"Frequently Asked Questions\". `null` → no heading (the host page\n * owns the `<h1>`, as the standalone /faqs surface does). A React node lets a\n * platform drill its own <PageHeading> without the lib referencing platform\n * state. Also drives category nesting so the document outline stays correct:\n * `null` → categories render `<h2>` (directly under the page `<h1>`);\n * otherwise categories render `<h3>` beneath this heading.\n */\n heading?: React.ReactNode | null\n /** Inject FAQPage schema.org JSON-LD as a <script>. Off by default so embeds\n * don't emit duplicate schema. */\n emitJsonLd?: boolean\n /** Overrides for the JSON-LD's name/description/url. */\n jsonLd?: FaqSchemaOptions\n className?: string\n /** Maps to /api/faqs `?count=` (the 5-tier fill target). Absent → param\n * not sent (server default applies). */\n minResults?: number\n /** Fetch-URL prefix for third-party embeds / reverse proxies\n * ('' = same-origin relative). */\n apiBaseUrl?: string\n}\n\nconst DEFAULT_HEADING_TEXT = 'Frequently Asked Questions'\n\n/** URL composition shared with RelatedContentSection (`buildSuggestionUrl`)\n * — byte-identical to the historical `buildFaqsUrl` output when\n * `minResults`/`apiBaseUrl` are absent. */\nfunction buildFaqsUrl(\n entityType?: string,\n entityId?: number | string,\n minResults?: number,\n apiBaseUrl = '',\n): string {\n return buildSuggestionUrl('/api/faqs', { apiBaseUrl, entityType, entityId, count: minResults })\n}\n\ninterface FaqGroup {\n /** null → the uncategorized bucket: no heading, no jump pill, rendered last. */\n section: string | null\n slug: string | null\n items: FaqItem[]\n}\n\n/** Group FAQs by `faq.section`, preserving the server's first-seen\n * (display_order) order for BOTH the section order and the rows within each\n * section. The uncategorized bucket (blank/missing section) sinks to the end\n * since it renders without a heading. Items carry NO badge here — the `<h2>`\n * IS the category, so a per-row chip would be redundant. */\nfunction groupFaqsBySection(faqs: Faq[]): FaqGroup[] {\n const order: string[] = []\n const byName = new Map<string, FaqGroup>()\n let uncategorized: FaqGroup | null = null\n for (const faq of faqs) {\n const item: FaqItem = { id: faq.id, question: faq.question, answer: faq.answer }\n const name = faq.section?.trim()\n if (!name) {\n if (!uncategorized) uncategorized = { section: null, slug: null, items: [] }\n uncategorized.items.push(item)\n continue\n }\n let group = byName.get(name)\n if (!group) {\n group = { section: name, slug: faqSectionSlug(name), items: [] }\n byName.set(name, group)\n order.push(name)\n }\n group.items.push(item)\n }\n const groups = order.map((name) => byName.get(name)!)\n if (uncategorized) groups.push(uncategorized)\n return groups\n}\n\n/** The standard hub sticky-header height — same offset `useNavLink`'s hash\n * scroll uses, so a category jump lands below the header, not under it. */\nconst FAQ_NAV_HEADER_OFFSET = 96\n\n/** Map key for the uncategorized bucket — `group.slug` is null for it, so\n * every per-group map (default-open ids, accordion keys) uses this sentinel\n * to keep the lookup typed. */\nconst UNCATEGORIZED_KEY = '__uncategorized__'\nconst groupKey = (g: FaqGroup): string => g.slug ?? UNCATEGORIZED_KEY\n\n/**\n * Grouped FAQ layout: a category jump-nav above stacked `<h2>` category\n * sections (each its own accordion). Isolated into its own component so the\n * scroll-spy hooks only mount in grouped mode — `FaqSection`'s own hooks stay\n * unconditional.\n *\n * The pills are real `<a href=\"#slug\">` anchors (crawlable in-page links,\n * deep-linkable, work without JS); the click handler upgrades the jump to the\n * cancellation-proof `scrollElementIntoView` tween and syncs the URL hash.\n */\nfunction GroupedFaqList({\n groups,\n categoryHeadingAs,\n}: {\n groups: FaqGroup[]\n /** Heading tag for each category, so the document outline nests correctly\n * under whatever owns the heading above this block: `h2` on the standalone\n * page (the page owns the `<h1>`), `h3` beneath an embed's `<h2>` title.\n * The VISUAL is `SECTION_HEADING_CLASS` either way, so categories look\n * identical on every surface. */\n categoryHeadingAs: 'h2' | 'h3'\n}) {\n const CategoryHeading = categoryHeadingAs\n const navGroups = useMemo(() => groups.filter((g) => g.slug), [groups])\n const [activeSlug, setActiveSlug] = useState<string | null>(navGroups[0]?.slug ?? null)\n // Identity-stable key for the section set so the observer re-binds only when\n // the categories actually change (not on every parent re-render).\n const slugKey = navGroups.map((g) => g.slug).join('|')\n\n // Scroll-spy: mark the pill for the category currently at the top of the\n // viewport. rootMargin drops the trigger line just below the sticky header\n // and ignores the bottom ~55% so \"active\" is the section being read, not the\n // next one peeking in.\n useEffect(() => {\n if (navGroups.length < 2) return\n const tops = new Map<string, number>()\n const observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n const id = (entry.target as HTMLElement).id\n if (entry.isIntersecting) tops.set(id, entry.boundingClientRect.top)\n else tops.delete(id)\n }\n let bestId: string | null = null\n let bestTop = Number.POSITIVE_INFINITY\n for (const [id, top] of tops) {\n if (top < bestTop) {\n bestTop = top\n bestId = id\n }\n }\n if (bestId) setActiveSlug(bestId)\n },\n { rootMargin: `-${FAQ_NAV_HEADER_OFFSET}px 0px -55% 0px`, threshold: 0 },\n )\n for (const group of navGroups) {\n const el = group.slug ? document.getElementById(group.slug) : null\n if (el) observer.observe(el)\n }\n return () => observer.disconnect()\n // slugKey encodes the section set; re-observe only when it changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [slugKey])\n\n // ─── Hash dispatch — `/faqs#faq-item-<id>` or `/faqs#faq-<section-slug>` ──\n // Tracks the current hash so:\n // 1. an item-kind hash seeds `defaultOpenIds` on the matching accordion\n // (auto-expands the cited question);\n // 2. either kind triggers the cancellation-proof tween scroll with the\n // sticky-header offset (native browser hash scroll runs once, ignores\n // our offset — re-running the tween puts the target in the right spot).\n // Listens to `hashchange` so back/forward replays the same behavior. SSR-\n // safe: initial null state matches the server render; the first effect\n // tick on the client updates it.\n const [hashTarget, setHashTarget] = useState<FaqHashTarget | null>(null)\n useEffect(() => {\n const refresh = () => setHashTarget(parseFaqHash(window.location.hash))\n refresh()\n window.addEventListener('hashchange', refresh)\n return () => window.removeEventListener('hashchange', refresh)\n }, [])\n\n // Per-group default-open set when the hash points at an item. The map key\n // matches `groupKey(group)` so the render-time lookup is O(1) per group.\n const defaultOpenByGroupKey = useMemo(() => {\n if (hashTarget?.kind !== 'item') return null\n const targetId = hashTarget.rawId\n const result = new Map<string, (string | number)[]>()\n for (const group of groups) {\n const hit = group.items.find((i) => String(i.id) === targetId)\n if (hit) result.set(groupKey(group), [hit.id])\n }\n return result.size > 0 ? result : null\n }, [groups, hashTarget])\n\n // Accordion is uncontrolled — `defaultOpenIds` is only consumed at mount,\n // so a new item hash needs a remount to honor it. Keying off the item-id\n // suffix triggers exactly the remount we need (and stays stable when the\n // hash points at a section, so category navigation never disturbs the\n // accordion's open state).\n const accordionKeySuffix =\n hashTarget?.kind === 'item' ? `item:${hashTarget.rawId}` : 'default'\n\n useEffect(() => {\n if (!hashTarget) return\n const elId =\n hashTarget.kind === 'item' ? faqItemAnchor(hashTarget.rawId) : hashTarget.slug\n const el = document.getElementById(elId)\n if (el) scrollElementIntoView(el, { headerOffset: FAQ_NAV_HEADER_OFFSET })\n if (hashTarget.kind === 'section') setActiveSlug(hashTarget.slug)\n }, [hashTarget])\n\n const handleJump = useCallback(\n (e: React.MouseEvent<HTMLAnchorElement>, slug: string) => {\n e.preventDefault()\n setActiveSlug(slug)\n scrollElementIntoView(document.getElementById(slug), {\n headerOffset: FAQ_NAV_HEADER_OFFSET,\n })\n if (typeof history !== 'undefined') history.replaceState(null, '', `#${slug}`)\n },\n [],\n )\n\n return (\n <div className=\"space-y-8\">\n {navGroups.length > 1 && (\n <nav aria-label=\"FAQ categories\" className=\"flex flex-wrap gap-2\">\n {navGroups.map((group) => {\n const isActive = group.slug === activeSlug\n return (\n <a\n key={group.slug}\n href={`#${group.slug}`}\n aria-current={isActive ? 'true' : undefined}\n onClick={(e) => handleJump(e, group.slug as string)}\n className={cn(\n \"rounded-full border px-4 py-2 text-sm font-medium font-['DM_Sans'] transition-colors\",\n isActive\n ? 'border-ods-text-primary bg-ods-card text-ods-text-primary'\n : 'border-ods-border bg-ods-card text-ods-text-secondary hover:border-ods-text-secondary hover:text-ods-text-primary',\n )}\n >\n {group.section}\n </a>\n )\n })}\n </nav>\n )}\n <div className=\"space-y-10\">\n {groups.map((group) => {\n const key = groupKey(group)\n return (\n <section\n key={key}\n id={group.slug ?? undefined}\n className=\"scroll-mt-24 space-y-4\"\n >\n {group.section && (\n <CategoryHeading className={SECTION_HEADING_CLASS}>{group.section}</CategoryHeading>\n )}\n <FaqAccordion\n // Re-key on item-hash changes so the remount picks up the new\n // `defaultOpenIds` (the accordion is uncontrolled). Stable for\n // section hashes — category navigation doesn't disturb state.\n key={`${key}:${accordionKeySuffix}`}\n items={group.items}\n defaultOpenIds={defaultOpenByGroupKey?.get(key)}\n />\n </section>\n )\n })}\n </div>\n </div>\n )\n}\n\nfunction FaqSkeleton() {\n return (\n <div className=\"space-y-8 animate-pulse\">\n <div className=\"h-12 md:h-14 w-2/3 rounded bg-ods-border\" />\n <div className=\"rounded-3xl border border-ods-border overflow-hidden bg-ods-card divide-y divide-ods-border w-full\">\n {Array.from({ length: 8 }).map((_, idx) => (\n <div key={idx} className=\"flex items-center justify-between px-6 md:px-8 py-6\">\n <div className=\"h-6 w-5/6 rounded bg-ods-border\" />\n <div className=\"h-10 w-10 rounded-md bg-ods-border\" />\n </div>\n ))}\n </div>\n </div>\n )\n}\n\ninterface FaqsResponse {\n faqs: Faq[]\n}\n\n/**\n * The FAQ display surface — ONE rendering on every host: the list grouped by\n * `faq.section` (each category a heading + its own accordion, with a category\n * jump-nav once there are 2+ categories). There is no flat/ungrouped mode and\n * no page-vs-embedded shell fork; the standalone /faqs page and every embed\n * render through this single path, so they cannot drift.\n *\n * - Standalone /faqs page: pass `initialFaqs` (SSR) + `heading={null}` (the\n * page owns the <h1>) + `emitJsonLd` with `jsonLd` overrides for SEO.\n * - Per-entity embed: pass `entityType` + `entityId` (no `initialFaqs`); the\n * hook self-fetches `GET /api/faqs`, and `heading` is this block's own <h2>.\n *\n * CONTRACT: the consuming app MUST implement `GET /api/faqs`. On a fetch error\n * (or zero FAQs) the component renders nothing so the host page isn't\n * disfigured. The host always supplies the page shell — this renders a bare\n * <section>.\n */\nexport function FaqSection({\n initialFaqs,\n entityType,\n entityId,\n heading,\n emitJsonLd = false,\n jsonLd,\n className,\n minResults,\n apiBaseUrl = '',\n}: FaqSectionProps) {\n const url = buildFaqsUrl(entityType, entityId, minResults, apiBaseUrl)\n // Memoized — useSelfFetch re-syncs on [initialData]; a fresh per-render\n // wrapper object would setState-loop under re-rendering parents.\n const initialData = useMemo<FaqsResponse | undefined>(\n () => (initialFaqs ? { faqs: initialFaqs } : undefined),\n [initialFaqs],\n )\n const { data, isLoading, error } = useSelfFetch<FaqsResponse>(url, { initialData })\n\n const faqs = data?.faqs ?? []\n // Grouped before the early returns so the hook order stays stable.\n const groups = useMemo(() => (faqs.length > 0 ? groupFaqsBySection(faqs) : []), [faqs])\n\n // `undefined` → default <h2> title; `null` → the host page owns the <h1>, so\n // no title renders here. `heading === null` also makes the category headings\n // <h2> (directly under the page <h1>); otherwise they nest as <h3>.\n const headingNode =\n heading === undefined ? <h2 className={SECTION_HEADING_CLASS}>{DEFAULT_HEADING_TEXT}</h2> : heading\n\n // Degrade silently — never show an error banner or an empty section shell\n // where FAQs would be (host pages and the standalone surface both rely on it).\n if (error) return null\n if (!isLoading && faqs.length === 0) return null\n if (isLoading && faqs.length === 0) {\n return (\n <div className={className}>\n <FaqSkeleton />\n </div>\n )\n }\n\n const schema = emitJsonLd ? buildFaqJsonLdFromFaqs(faqs, jsonLd) : null\n\n return (\n <>\n <section className={className ?? 'space-y-10'}>\n {headingNode}\n <GroupedFaqList groups={groups} categoryHeadingAs={heading === null ? 'h2' : 'h3'} />\n </section>\n {schema && (\n <script\n type=\"application/ld+json\"\n // eslint-disable-next-line react/no-danger\n // serializeJsonLd, NOT raw JSON.stringify — FAQ answers are\n // admin-entered; an embedded \"</script>\" must not break the tag.\n dangerouslySetInnerHTML={{ __html: serializeJsonLd(schema) }}\n />\n )}\n </>\n )\n}\n","\"use client\"\n\nimport React, { useRef, useState, useEffect, useCallback } from 'react'\nimport { ChevronButton } from './ui/chevron-button'\nimport { cn } from \"../utils/cn\"\nimport { faqItemAnchor } from \"../utils/faq-anchor\"\n\nexport interface FaqItem {\n id: number | string\n question: string\n answer: string\n}\n\ninterface FaqAccordionProps {\n items: FaqItem[]\n defaultOpenIds?: (number | string)[]\n}\n\n// Utility to measure scrollHeight outside render cycle\nconst useMeasuredHeight = (isOpen: boolean) => {\n const ref = useRef<HTMLDivElement | null>(null)\n const [maxHeight, setMaxHeight] = useState<string>('0px')\n\n const measure = useCallback(() => {\n if (ref.current) {\n const height = ref.current.scrollHeight\n setMaxHeight(`${height}px`)\n }\n }, [])\n\n // Update height only when section is open\n useEffect(() => {\n if (isOpen) {\n measure()\n } else {\n setMaxHeight('0px')\n }\n }, [isOpen, measure])\n\n return { ref, maxHeight }\n}\n\nexport function FaqAccordion({ items, defaultOpenIds = [] }: FaqAccordionProps) {\n const [openSet, setOpenSet] = useState<Set<string | number>>(new Set(defaultOpenIds))\n\n const toggle = (id: string | number) => {\n setOpenSet(prev => {\n const next = new Set(prev)\n if (next.has(id)) next.delete(id)\n else next.add(id)\n return next\n })\n }\n\n return (\n <div className=\"rounded-3xl border border-ods-border divide-y divide-ods-border bg-ods-card overflow-hidden\">\n {items.map(item => {\n const isOpen = openSet.has(item.id)\n const { ref, maxHeight } = useMeasuredHeight(isOpen)\n\n return (\n <div\n key={item.id}\n // Per-row anchor — chat citation chips (`/faqs#faq-item-<id>`) land\n // here via native browser hash scroll AND via `FaqSection`'s tween\n // dispatch. `scroll-mt-24` keeps the row header below the 96px\n // sticky nav offset (matches `<section>`'s scroll-margin for\n // category anchors).\n id={faqItemAnchor(item.id)}\n className={cn('group scroll-mt-24 transition-colors hover:bg-[#1E1E1E]', isOpen ? 'bg-ods-bg' : 'bg-transparent')}\n >\n {/* Header */}\n <div\n role=\"button\"\n tabIndex={0}\n onClick={() => toggle(item.id)}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n toggle(item.id);\n }\n }}\n aria-expanded={isOpen}\n className=\"flex w-full items-center justify-between px-6 md:px-8 py-6 text-left focus:outline-none transition-colors cursor-pointer\"\n >\n <div className=\"min-w-0 pr-4\">\n <h3>\n {item.question}\n </h3>\n </div>\n <div className=\"flex-shrink-0\">\n <ChevronButton\n aria-label={isOpen ? 'Collapse question' : 'Expand question'}\n size=\"md\"\n isExpanded={isOpen}\n backgroundColor=\"transparent\"\n borderColor=\"#3A3A3A\"\n />\n </div>\n </div>\n {/* Content wrapper with max-height animation */}\n <div\n style={{ maxHeight, transition: 'max-height 0.35s ease-in-out, opacity 0.35s ease-in-out', opacity: isOpen ? 1 : 0 }}\n className=\"overflow-hidden group-hover:bg-[#1E1E1E]/30\"\n >\n <div ref={ref} className=\"px-6 md:px-8 pb-6 text-ods-text-primary text-h4\">\n {item.answer}\n </div>\n </div>\n </div>\n )\n })}\n </div>\n )\n} ","/**\n * Pure FAQ JSON-LD builder. No React, no client-only deps — safe to import from\n * Server Components via the `./components/faq` subpath export. (Do NOT import\n * through the root `./components` barrel — that barrel is `\"use client\"` and\n * dragging it into a Server Component would force the client graph into the\n * server.)\n *\n * The hub used to harcode `name`/`description` here for OpenMSP; in the lib we\n * accept overrides so every embedder can supply its own platform branding.\n */\nimport type { Faq } from '../../types/faq'\n\nexport interface FaqSchemaOptions {\n name?: string\n description?: string\n url?: string\n}\n\nconst DEFAULT_NAME = 'Frequently Asked Questions'\nconst DEFAULT_DESCRIPTION =\n 'Answers to common questions.'\n\nexport function baseFaqSchema(opts: FaqSchemaOptions = {}) {\n return {\n '@context': 'https://schema.org',\n '@type': 'FAQPage',\n name: opts.name ?? DEFAULT_NAME,\n description: opts.description ?? DEFAULT_DESCRIPTION,\n ...(opts.url ? { url: opts.url } : {}),\n } as const\n}\n\nexport function buildFaqJsonLdFromFaqs(faqs: Faq[], opts: FaqSchemaOptions = {}) {\n return {\n ...baseFaqSchema(opts),\n mainEntity: faqs.map((faq) => ({\n '@type': 'Question',\n name: faq.question,\n acceptedAnswer: {\n '@type': 'Answer',\n text: faq.answer,\n },\n })),\n } as const\n}\n","'use client';\n\n/**\n * FaqDocumentPage — the full `/faqs` page with chrome, so embedders drop in\n * ONE component instead of hand-assembling `PageShell` + `PageLayout` around the\n * bare `<FaqSection>`. Mirrors `LegalDocumentPage` / `DevSectionPage`: the\n * page-level layout lives in the lib, the host passes only config + a back button.\n *\n * `<FaqSection heading={null}>` lets `PageLayout`'s `TitleBlock` own the heading +\n * back button; it self-fetches `${apiBaseUrl}/api/faqs` via the authed\n * `useSelfFetch`, and renders nothing on a fetch error or zero FAQs.\n */\n\nimport { PageShell, PageLayout } from '../ui';\nimport { useRouter } from '../../embed-shims/next-navigation';\nimport { FaqSection } from './faq-section';\n\nexport interface FaqDocumentPageProps {\n /** Page title (PageLayout TitleBlock). Default \"FAQs\". */\n title?: string;\n /** Subtitle under the title. */\n subtitle?: string;\n /** Back-button config — same pattern as `DevSectionPage` / `LegalDocumentPage`.\n * Pass `false` to hide. Default `{ label: 'Back to home', href: '/' }`. */\n backButton?: { label?: string; href?: string } | false;\n /** Base URL `FaqSection` appends `/api/faqs` to (reverse-proxy embedders). */\n apiBaseUrl?: string;\n /** Optional entity scoping forwarded to `FaqSection`. */\n entityType?: string;\n entityId?: number | string;\n /** Minimum FAQ count before the section renders (forwarded to `FaqSection`). */\n minResults?: number;\n}\n\nexport function FaqDocumentPage({\n title = 'FAQs',\n subtitle,\n backButton,\n apiBaseUrl,\n entityType,\n entityId,\n minResults,\n}: FaqDocumentPageProps) {\n const router = useRouter();\n\n // Back-button config — mirrors LegalDocumentPage/DevSectionPage. Hide entirely\n // when the caller passes `false` (embed-mode where the host owns nav chrome).\n const backCfg =\n backButton === false\n ? undefined\n : {\n label: backButton?.label ?? 'Back to home',\n onClick: () => router.push(backButton?.href ?? '/'),\n };\n\n return (\n <PageShell>\n <PageLayout title={title} subtitle={subtitle} backButton={backCfg}>\n <FaqSection\n heading={null}\n apiBaseUrl={apiBaseUrl}\n entityType={entityType}\n entityId={entityId}\n minResults={minResults}\n />\n </PageLayout>\n </PageShell>\n );\n}\n"]}
|
|
@@ -11,17 +11,17 @@ import {
|
|
|
11
11
|
SelectValue,
|
|
12
12
|
Textarea,
|
|
13
13
|
useChatAttachments
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-EFYXPR43.js";
|
|
15
15
|
import {
|
|
16
16
|
useContactSubmission,
|
|
17
17
|
useHumanitySignals
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-N6ZM5PYZ.js";
|
|
19
19
|
import {
|
|
20
20
|
Input
|
|
21
21
|
} from "./chunk-M2OCXTNT.js";
|
|
22
22
|
import {
|
|
23
23
|
SECTION_HEADING_CLASS
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-VRSXJ5QJ.js";
|
|
25
25
|
import {
|
|
26
26
|
Button
|
|
27
27
|
} from "./chunk-5IJ46KAV.js";
|
|
@@ -376,4 +376,4 @@ function ContactForm({
|
|
|
376
376
|
export {
|
|
377
377
|
ContactForm
|
|
378
378
|
};
|
|
379
|
-
//# sourceMappingURL=chunk-
|
|
379
|
+
//# sourceMappingURL=chunk-RWCA2ZQK.js.map
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
|
+
|
|
5
|
+
var _chunkYETA25JWcjs = require('./chunk-YETA25JW.cjs');
|
|
6
|
+
|
|
7
|
+
// src/hooks/use-near-viewport.ts
|
|
8
|
+
var _react = require('react');
|
|
9
|
+
var observers = /* @__PURE__ */ new Map();
|
|
10
|
+
var subscribers = /* @__PURE__ */ new WeakMap();
|
|
11
|
+
function getObserverFor(rootMargin) {
|
|
12
|
+
const existing = observers.get(rootMargin);
|
|
13
|
+
if (existing) return existing;
|
|
14
|
+
const io = new IntersectionObserver(
|
|
15
|
+
(entries) => {
|
|
16
|
+
entries.forEach((entry) => {
|
|
17
|
+
if (!entry.isIntersecting) return;
|
|
18
|
+
const cb = subscribers.get(entry.target);
|
|
19
|
+
if (cb) {
|
|
20
|
+
cb();
|
|
21
|
+
io.unobserve(entry.target);
|
|
22
|
+
subscribers.delete(entry.target);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
{ rootMargin }
|
|
27
|
+
);
|
|
28
|
+
observers.set(rootMargin, io);
|
|
29
|
+
return io;
|
|
30
|
+
}
|
|
31
|
+
function useNearViewport(rootMargin = "500px") {
|
|
32
|
+
const [isNear, setIsNear] = _react.useState.call(void 0, false);
|
|
33
|
+
const elRef = _react.useRef.call(void 0, null);
|
|
34
|
+
const ref = _react.useCallback.call(void 0,
|
|
35
|
+
(node) => {
|
|
36
|
+
const prev = elRef.current;
|
|
37
|
+
if (prev) {
|
|
38
|
+
const stillOurs = subscribers.get(prev);
|
|
39
|
+
if (stillOurs) {
|
|
40
|
+
subscribers.delete(prev);
|
|
41
|
+
_optionalChain([observers, 'access', _ => _.get, 'call', _2 => _2(rootMargin), 'optionalAccess', _3 => _3.unobserve, 'call', _4 => _4(prev)]);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
elRef.current = node;
|
|
45
|
+
if (!node) return;
|
|
46
|
+
const cb = () => setIsNear(true);
|
|
47
|
+
subscribers.set(node, cb);
|
|
48
|
+
getObserverFor(rootMargin).observe(node);
|
|
49
|
+
},
|
|
50
|
+
[rootMargin]
|
|
51
|
+
);
|
|
52
|
+
_react.useEffect.call(void 0, () => {
|
|
53
|
+
return () => {
|
|
54
|
+
const el = elRef.current;
|
|
55
|
+
if (!el) return;
|
|
56
|
+
if (subscribers.get(el)) {
|
|
57
|
+
subscribers.delete(el);
|
|
58
|
+
_optionalChain([observers, 'access', _5 => _5.get, 'call', _6 => _6(rootMargin), 'optionalAccess', _7 => _7.unobserve, 'call', _8 => _8(el)]);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}, [rootMargin]);
|
|
62
|
+
return { ref, isNear };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// src/hooks/use-og-placeholder.ts
|
|
66
|
+
|
|
67
|
+
function useOgPlaceholder(buildUrl, title, siteName = "", enabled = true, aspect = "wide") {
|
|
68
|
+
return _react.useMemo.call(void 0, () => {
|
|
69
|
+
if (!enabled || !title) return null;
|
|
70
|
+
const options = {};
|
|
71
|
+
if (siteName) options.site = siteName;
|
|
72
|
+
if (aspect === "square") options.aspect = "square";
|
|
73
|
+
return buildUrl(title, options);
|
|
74
|
+
}, [buildUrl, title, siteName, enabled, aspect]);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// src/utils/embed-content-fetch.ts
|
|
78
|
+
var contentFetch = (input, init) => {
|
|
79
|
+
if (!_chunkYETA25JWcjs.hasEmbedAuthAdapter.call(void 0, )) return fetch(input, init);
|
|
80
|
+
const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
81
|
+
return _chunkYETA25JWcjs.embedAuthedFetch.call(void 0, url, init);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
exports.contentFetch = contentFetch; exports.useNearViewport = useNearViewport; exports.useOgPlaceholder = useOgPlaceholder;
|
|
89
|
+
//# sourceMappingURL=chunk-TFSYSWPS.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-TFSYSWPS.cjs","../src/hooks/use-near-viewport.ts","../src/hooks/use-og-placeholder.ts","../src/utils/embed-content-fetch.ts"],"names":[],"mappings":"AAAA,ylBAAY;AACZ;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACuBA,8BAAyD;AAIzD,IAAM,UAAA,kBAAY,IAAI,GAAA,CAAkC,CAAA;AACxD,IAAM,YAAA,kBAAc,IAAI,OAAA,CAA6B,CAAA;AAErD,SAAS,cAAA,CAAe,UAAA,EAA0C;AAChE,EAAA,MAAM,SAAA,EAAW,SAAA,CAAU,GAAA,CAAI,UAAU,CAAA;AACzC,EAAA,GAAA,CAAI,QAAA,EAAU,OAAO,QAAA;AAErB,EAAA,MAAM,GAAA,EAAK,IAAI,oBAAA;AAAA,IACb,CAAC,OAAA,EAAA,GAAY;AACX,MAAA,OAAA,CAAQ,OAAA,CAAQ,CAAC,KAAA,EAAA,GAAU;AACzB,QAAA,GAAA,CAAI,CAAC,KAAA,CAAM,cAAA,EAAgB,MAAA;AAG3B,QAAA,MAAM,GAAA,EAAK,WAAA,CAAY,GAAA,CAAI,KAAA,CAAM,MAAM,CAAA;AACvC,QAAA,GAAA,CAAI,EAAA,EAAI;AACN,UAAA,EAAA,CAAG,CAAA;AACH,UAAA,EAAA,CAAG,SAAA,CAAU,KAAA,CAAM,MAAM,CAAA;AACzB,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AA,EACJ,OAAO,MAAA,IAAU,SAAA,EAAW,MAAA,EAAQ,MAAA,WAAiB,IAAA,EAAM,KAAA,CAAM,KAAA,EAAQ,KAAA,CAAkB,GAAA;AAC7F,EAAA,OAAO,gDAAA,GAAiB,EAAK,IAAI,CAAA;AACnC,CAAA;AHqDA;AACA;AACE;AACA;AACA;AACF,4HAAC","file":"/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-TFSYSWPS.cjs","sourcesContent":[null,"/**\n * useNearViewport — module-level shared IntersectionObserver in hook form.\n *\n * Single IO instance per `rootMargin` value, shared across every component\n * that mounts the hook. Reduces overhead vs. one IO per component on\n * grid/list pages where many subscribers observe the viewport with the same\n * margin. Promoted from the inline singleton at\n * `multi-platform-hub/components/shared/video-bites-display.tsx:21-43`,\n * which is the only IO pattern in either repo today.\n *\n * Usage:\n * ```tsx\n * function MyCard() {\n * const { ref, isNear } = useNearViewport('500px');\n * return <div ref={ref}>{isNear ? <HeavyChild /> : <Placeholder />}</div>;\n * }\n * ```\n *\n * StrictMode safety: cleanup uses an identity check on the registered\n * callback so React's dev double-mount (mount → cleanup → re-mount) does\n * not drop the second mount's freshly-set subscription. The IO callback\n * also checks `subscribers.get(target)` before invoking so a fire that\n * races with unmount cannot crash on a torn-down component.\n *\n * The hook fires once — on first intersection it sets `isNear=true` and\n * unobserves the element. Callers that need re-observation should\n * unmount and remount (or fork the hook for two-way behavior).\n */\n\nimport { useEffect, useRef, useState, useCallback } from 'react';\n\n// Per-rootMargin IO map. Multiple call sites with different margins each\n// get their own singleton observer.\nconst observers = new Map<string, IntersectionObserver>();\nconst subscribers = new WeakMap<Element, () => void>();\n\nfunction getObserverFor(rootMargin: string): IntersectionObserver {\n const existing = observers.get(rootMargin);\n if (existing) return existing;\n\n const io = new IntersectionObserver(\n (entries) => {\n entries.forEach((entry) => {\n if (!entry.isIntersecting) return;\n // Race-safe: re-read the callback at fire time. A late IO firing\n // after cleanup must not invoke a stale callback.\n const cb = subscribers.get(entry.target);\n if (cb) {\n cb();\n io.unobserve(entry.target);\n subscribers.delete(entry.target);\n }\n });\n },\n { rootMargin }\n );\n observers.set(rootMargin, io);\n return io;\n}\n\nexport interface UseNearViewportResult<T extends Element = HTMLElement> {\n /** Ref to attach to the element you want to gate on visibility. */\n ref: (node: T | null) => void;\n /** Flips to `true` once the element enters within `rootMargin` of the viewport. Never flips back. */\n isNear: boolean;\n}\n\n/**\n * @param rootMargin Margin around the viewport (CSS-style string).\n * '500px' = element starts mounting 500px before scroll-in.\n * '1000px' = a full viewport's worth of lookahead.\n * '0px' = strict on-screen detection.\n */\nexport function useNearViewport<T extends Element = HTMLElement>(\n rootMargin: string = '500px'\n): UseNearViewportResult<T> {\n const [isNear, setIsNear] = useState(false);\n const elRef = useRef<T | null>(null);\n\n // Subscribe/unsubscribe on element change.\n const ref = useCallback(\n (node: T | null) => {\n const prev = elRef.current;\n\n // Unsubscribe previous, if any. Identity-check the callback so a\n // StrictMode re-mount that has already re-registered keeps its sub.\n if (prev) {\n const stillOurs = subscribers.get(prev);\n if (stillOurs) {\n subscribers.delete(prev);\n observers.get(rootMargin)?.unobserve(prev);\n }\n }\n\n elRef.current = node;\n if (!node) return;\n\n const cb = () => setIsNear(true);\n subscribers.set(node, cb);\n getObserverFor(rootMargin).observe(node);\n },\n [rootMargin]\n );\n\n // Unsubscribe on unmount. Identity check guards the StrictMode race.\n useEffect(() => {\n return () => {\n const el = elRef.current;\n if (!el) return;\n if (subscribers.get(el)) {\n subscribers.delete(el);\n observers.get(rootMargin)?.unobserve(el);\n }\n };\n }, [rootMargin]);\n\n return { ref, isNear };\n}\n","'use client'\n\nimport { useMemo } from 'react'\n\n/**\n * Hook that generates a branded placeholder image URL using the\n * host's `/api/og-placeholder` server-side image generator (or any\n * builder the caller supplies).\n *\n * THIS HOOK IS A THIN CLIENT-SIDE WRAPPER. The hub-side wrapper\n * (`hooks/use-og-placeholder.ts` in multi-platform-hub) injects its\n * canonical `buildOgPlaceholderUrl` from `lib/utils/entity-image.ts`.\n * The lib version takes the builder as an argument so the lib has no\n * hub dependency.\n *\n * @param buildUrl - Function that builds the placeholder URL from a\n * title + options object (`{ site?, aspect? }`).\n * Hub passes `buildOgPlaceholderUrl` from\n * `lib/utils/entity-image.ts`. Embedded apps can\n * wire any equivalent that hits their own placeholder\n * route.\n * @param title - Text to display on the placeholder\n * @param siteName - Site name shown below the title (optional —\n * defaults to empty)\n * @param enabled - Whether to generate the URL (default: true)\n * @param aspect - `'wide'` (1200×630 social-card; default) or `'square'`\n * (1024×1024 — used by compact chat-inline card slots\n * so `object-cover` doesn't crop the title off).\n * @returns Placeholder image URL or null if disabled / no title\n */\nexport function useOgPlaceholder(\n buildUrl: (title: string, options: { site?: string; aspect?: 'wide' | 'square' }) => string,\n title: string | undefined | null,\n siteName: string = '',\n enabled: boolean = true,\n aspect: 'wide' | 'square' = 'wide',\n): string | null {\n return useMemo(() => {\n if (!enabled || !title) return null\n const options: { site?: string; aspect?: 'wide' | 'square' } = {}\n if (siteName) options.site = siteName\n if (aspect === 'square') options.aspect = 'square'\n return buildUrl(title, options)\n }, [buildUrl, title, siteName, enabled, aspect])\n}\n","'use client'\n\n/**\n * `contentFetch` — the fetch the lib's SELF-FETCHING content surfaces use:\n * roadmap (list + vote + per-task refresh), delivery, product releases,\n * onboarding guides (catalog + detail), legal docs, and the release-detail\n * injected roadmap/delivery sections.\n *\n * It deliberately reuses the SINGLE embed-auth knob — the registered\n * `EmbedAuthAdapter` — instead of introducing a second registration:\n * - adapter registered (host opted into embedded auth, e.g. openframe-frontend\n * for its embedded chat) → route through `embedAuthedFetch`, so content GETs/\n * POSTs carry the SAME bearer/cookie + 401-refresh as the chat.\n * - no adapter (the public hub, or the embedding example whose proxy injects\n * auth server-side) → a plain, byte-for-byte unchanged `fetch`.\n *\n * So a host wires auth ONCE (the chat adapter) and content inherits it; there is\n * no content-specific fetcher to configure.\n */\n\nimport { embedAuthedFetch, hasEmbedAuthAdapter } from './embed-authed-fetch'\n\nexport const contentFetch: typeof fetch = (input, init) => {\n if (!hasEmbedAuthAdapter()) return fetch(input, init)\n // embedAuthedFetch takes a string url; coerce the broader `fetch` input shape\n // (content surfaces always pass strings, but handle URL/Request defensively).\n const url =\n typeof input === 'string' ? input : input instanceof URL ? input.href : (input as Request).url\n return embedAuthedFetch(url, init)\n}\n"]}
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
useSelfFetch
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3ZXUQQL4.js";
|
|
5
|
+
import {
|
|
6
|
+
ChevronButton
|
|
7
|
+
} from "./chunk-EFYXPR43.js";
|
|
5
8
|
import {
|
|
6
|
-
ChevronButton,
|
|
7
9
|
buildSuggestionUrl,
|
|
10
|
+
faqItemAnchor,
|
|
11
|
+
faqSectionSlug,
|
|
12
|
+
parseFaqHash,
|
|
8
13
|
scrollElementIntoView,
|
|
9
14
|
serializeJsonLd
|
|
10
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ODR6A6FC.js";
|
|
11
16
|
import {
|
|
12
17
|
PageLayout,
|
|
13
|
-
PageShell
|
|
18
|
+
PageShell
|
|
19
|
+
} from "./chunk-R2KT5GDD.js";
|
|
20
|
+
import {
|
|
14
21
|
SECTION_HEADING_CLASS
|
|
15
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-VRSXJ5QJ.js";
|
|
16
23
|
import {
|
|
17
24
|
init_next_navigation,
|
|
18
25
|
useRouter
|
|
@@ -63,7 +70,8 @@ function FaqAccordion({ items, defaultOpenIds = [] }) {
|
|
|
63
70
|
return /* @__PURE__ */ jsxs(
|
|
64
71
|
"div",
|
|
65
72
|
{
|
|
66
|
-
|
|
73
|
+
id: faqItemAnchor(item.id),
|
|
74
|
+
className: cn("group scroll-mt-24 transition-colors hover:bg-[#1E1E1E]", isOpen ? "bg-ods-bg" : "bg-transparent"),
|
|
67
75
|
children: [
|
|
68
76
|
/* @__PURE__ */ jsxs(
|
|
69
77
|
"div",
|
|
@@ -144,9 +152,6 @@ var DEFAULT_HEADING_TEXT = "Frequently Asked Questions";
|
|
|
144
152
|
function buildFaqsUrl(entityType, entityId, minResults, apiBaseUrl = "") {
|
|
145
153
|
return buildSuggestionUrl("/api/faqs", { apiBaseUrl, entityType, entityId, count: minResults });
|
|
146
154
|
}
|
|
147
|
-
function sectionSlug(section) {
|
|
148
|
-
return "faq-" + section.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
149
|
-
}
|
|
150
155
|
function groupFaqsBySection(faqs) {
|
|
151
156
|
const order = [];
|
|
152
157
|
const byName = /* @__PURE__ */ new Map();
|
|
@@ -161,7 +166,7 @@ function groupFaqsBySection(faqs) {
|
|
|
161
166
|
}
|
|
162
167
|
let group = byName.get(name);
|
|
163
168
|
if (!group) {
|
|
164
|
-
group = { section: name, slug:
|
|
169
|
+
group = { section: name, slug: faqSectionSlug(name), items: [] };
|
|
165
170
|
byName.set(name, group);
|
|
166
171
|
order.push(name);
|
|
167
172
|
}
|
|
@@ -172,6 +177,8 @@ function groupFaqsBySection(faqs) {
|
|
|
172
177
|
return groups;
|
|
173
178
|
}
|
|
174
179
|
var FAQ_NAV_HEADER_OFFSET = 96;
|
|
180
|
+
var UNCATEGORIZED_KEY = "__uncategorized__";
|
|
181
|
+
var groupKey = (g) => g.slug ?? UNCATEGORIZED_KEY;
|
|
175
182
|
function GroupedFaqList({
|
|
176
183
|
groups,
|
|
177
184
|
categoryHeadingAs
|
|
@@ -208,6 +215,31 @@ function GroupedFaqList({
|
|
|
208
215
|
}
|
|
209
216
|
return () => observer.disconnect();
|
|
210
217
|
}, [slugKey]);
|
|
218
|
+
const [hashTarget, setHashTarget] = useState2(null);
|
|
219
|
+
useEffect2(() => {
|
|
220
|
+
const refresh = () => setHashTarget(parseFaqHash(window.location.hash));
|
|
221
|
+
refresh();
|
|
222
|
+
window.addEventListener("hashchange", refresh);
|
|
223
|
+
return () => window.removeEventListener("hashchange", refresh);
|
|
224
|
+
}, []);
|
|
225
|
+
const defaultOpenByGroupKey = useMemo(() => {
|
|
226
|
+
if (hashTarget?.kind !== "item") return null;
|
|
227
|
+
const targetId = hashTarget.rawId;
|
|
228
|
+
const result = /* @__PURE__ */ new Map();
|
|
229
|
+
for (const group of groups) {
|
|
230
|
+
const hit = group.items.find((i) => String(i.id) === targetId);
|
|
231
|
+
if (hit) result.set(groupKey(group), [hit.id]);
|
|
232
|
+
}
|
|
233
|
+
return result.size > 0 ? result : null;
|
|
234
|
+
}, [groups, hashTarget]);
|
|
235
|
+
const accordionKeySuffix = hashTarget?.kind === "item" ? `item:${hashTarget.rawId}` : "default";
|
|
236
|
+
useEffect2(() => {
|
|
237
|
+
if (!hashTarget) return;
|
|
238
|
+
const elId = hashTarget.kind === "item" ? faqItemAnchor(hashTarget.rawId) : hashTarget.slug;
|
|
239
|
+
const el = document.getElementById(elId);
|
|
240
|
+
if (el) scrollElementIntoView(el, { headerOffset: FAQ_NAV_HEADER_OFFSET });
|
|
241
|
+
if (hashTarget.kind === "section") setActiveSlug(hashTarget.slug);
|
|
242
|
+
}, [hashTarget]);
|
|
211
243
|
const handleJump = useCallback2(
|
|
212
244
|
(e, slug) => {
|
|
213
245
|
e.preventDefault();
|
|
@@ -237,18 +269,28 @@ function GroupedFaqList({
|
|
|
237
269
|
group.slug
|
|
238
270
|
);
|
|
239
271
|
}) }),
|
|
240
|
-
/* @__PURE__ */ jsx2("div", { className: "space-y-10", children: groups.map((group) =>
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
272
|
+
/* @__PURE__ */ jsx2("div", { className: "space-y-10", children: groups.map((group) => {
|
|
273
|
+
const key = groupKey(group);
|
|
274
|
+
return /* @__PURE__ */ jsxs2(
|
|
275
|
+
"section",
|
|
276
|
+
{
|
|
277
|
+
id: group.slug ?? void 0,
|
|
278
|
+
className: "scroll-mt-24 space-y-4",
|
|
279
|
+
children: [
|
|
280
|
+
group.section && /* @__PURE__ */ jsx2(CategoryHeading, { className: SECTION_HEADING_CLASS, children: group.section }),
|
|
281
|
+
/* @__PURE__ */ jsx2(
|
|
282
|
+
FaqAccordion,
|
|
283
|
+
{
|
|
284
|
+
items: group.items,
|
|
285
|
+
defaultOpenIds: defaultOpenByGroupKey?.get(key)
|
|
286
|
+
},
|
|
287
|
+
`${key}:${accordionKeySuffix}`
|
|
288
|
+
)
|
|
289
|
+
]
|
|
290
|
+
},
|
|
291
|
+
key
|
|
292
|
+
);
|
|
293
|
+
}) })
|
|
252
294
|
] });
|
|
253
295
|
}
|
|
254
296
|
function FaqSkeleton() {
|
|
@@ -335,4 +377,4 @@ export {
|
|
|
335
377
|
FaqSection,
|
|
336
378
|
FaqDocumentPage
|
|
337
379
|
};
|
|
338
|
-
//# sourceMappingURL=chunk-
|
|
380
|
+
//# sourceMappingURL=chunk-TY2EB7VK.js.map
|