import { createContext, useContext, type ActionDispatch, type SetStateAction } from "react"; import type { DedupedSightings, NPEDACTION, NPEDSTATE, ReducedSightingType } from "../types/types"; type IntegrationsValue = { sessionStarted: boolean; sessionPaused: boolean; setSessionPaused: React.Dispatch>; setSessionStarted: React.Dispatch>; sessionList: ReducedSightingType[]; setSessionList: React.Dispatch>; savedSightings: DedupedSightings; setSavedSightings: React.Dispatch>; state: NPEDSTATE; dispatch: ActionDispatch<[action: NPEDACTION]>; }; export const IntegrationsContext = createContext(undefined); export const useIntegrationsContext = () => { const ctx = useContext(IntegrationsContext); if (!ctx) throw new Error("useNPEDContext must be used within "); return ctx; };