PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.9.5
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.9.5
4.9.5 4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 All 203 releases
betterdocs / react-src / admin / faq-builder / context / ScopeContext.js

ScopeContext.js in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 4.9.5, at react-src/admin/faq-builder/context/ScopeContext.js

26 lines 810 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import React, { createContext, useContext } from "react";
2
3 export const GENERAL_TAXONOMY = "betterdocs_faq_category";
4 export const PRODUCT_TAXONOMY = "betterdocs_product_faq_category";
5
6 // Default scope is the General FAQ taxonomy, so every existing FAQ Builder
7 // component keeps its current behavior even when rendered outside a provider.
8 const FAQScopeContext = createContext({
9 taxonomy: GENERAL_TAXONOMY,
10 isProduct: false,
11 });
12
13 export const FAQScopeProvider = ({ taxonomy = GENERAL_TAXONOMY, children }) => {
14 const value = {
15 taxonomy,
16 isProduct: taxonomy === PRODUCT_TAXONOMY,
17 };
18 return (
19 <FAQScopeContext.Provider value={value}>
20 {children}
21 </FAQScopeContext.Provider>
22 );
23 };
24
25 export const useFAQScope = () => useContext(FAQScopeContext);
26