import { AnalyticsContext } from '../AnalyticsContext' ; import { AnalyticsDispatcher } from '../AnalyticsDispatcher' ; export function withContext ( analyticsContext ) { return < T > ( dispatcher ) => new AnalyticsDispatcher < T > ( dispatcher . dispatch . bind ( dispatcher ) , analyticsContext instanceof AnalyticsContext ? analyticsContext : new AnalyticsContext ( analyticsContext . Scopes , analyticsContext . ExtraData , analyticsContext . MetaData , analyticsContext . Identities , analyticsContext . Filters ) ) ; }