22 lines
919 B
TypeScript
22 lines
919 B
TypeScript
import { createContext, useContext } from 'react';
|
|
|
|
/**
|
|
* What Nearle Buddy is currently answering about.
|
|
*
|
|
* The panel names its own scope in its heading — "Across your branches" — and
|
|
* that heading is a promise about which data an answer would draw on. When an
|
|
* admin narrows to one branch, or a store user opens the console at all, the
|
|
* promise is wrong: the board beneath says R mart and the panel above still
|
|
* says every branch.
|
|
*
|
|
* So the SCOPE is published here and the panel reads it. Nothing else about
|
|
* Buddy changes — not its width, its controls, its prompts or its placement.
|
|
* A page that has no branch scope publishes nothing and the panel keeps the
|
|
* per-route wording it has always used.
|
|
*/
|
|
export const AssistantScopeContext = createContext<string | undefined>(undefined);
|
|
|
|
export function useAssistantScope(): string | undefined {
|
|
return useContext(AssistantScopeContext);
|
|
}
|