import { createContext, useContext } from "react"; import type { AppContextType } from "./AppContextTypes"; export const AppContext = createContext>({ jsBridge: { customApex: {} as unknown, toast: null, refreshApex: () => {}, }, appData: { opportunityId: "", }, }); export function useAppContext() { const context = useContext(AppContext); if (!context) { throw new Error("useAppContext must be used within an AppContextProvider"); } return context as AppContextType; }