31 lines
952 B
TypeScript
31 lines
952 B
TypeScript
import { EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';
|
|
import { OpenPanelConfig, OPENPANEL_CONFIG } from '@core/models/openpanel.model';
|
|
import { OpenPanelService } from '@core/services/openpanel.service';
|
|
|
|
/**
|
|
* Provides the OpenPanel analytics service for your Angular application.
|
|
*
|
|
* @example
|
|
* // app.config.ts
|
|
* import { provideOpenPanel } from './openpanel/openpanel.provider';
|
|
*
|
|
* export const appConfig: ApplicationConfig = {
|
|
* providers: [
|
|
* provideRouter(routes),
|
|
* provideOpenPanel({
|
|
* clientId: 'your-client-id',
|
|
* trackScreenViews: true,
|
|
* globalProperties: {
|
|
* app_version: '1.0.0',
|
|
* environment: 'production',
|
|
* },
|
|
* }),
|
|
* ],
|
|
* };
|
|
*/
|
|
export function provideOpenPanel(config: OpenPanelConfig): EnvironmentProviders {
|
|
return makeEnvironmentProviders([
|
|
{ provide: OPENPANEL_CONFIG, useValue: config },
|
|
OpenPanelService,
|
|
]);
|
|
} |