/** * @license * Copyright 2025 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { DestroyRef, EnvironmentProviders, ErrorHandler } from '@angular/core'; import { Router } from '@angular/router'; import { CrashlyticsOptions } from '../public-types'; import { FirebaseApp } from '@firebase/app'; export * from '../public-types'; /** * Constructs the safe, templated route path from the router state. * Example output: '/users/:id/posts' * * @internal */ export declare function getSafeRoutePath(router: Router): string; /** * Extracts the raw path portion from a full URL by stripping query parameters, hashes, and matrix parameters. * * @internal */ export declare function getRawPath(url: string): string; /** * A custom ErrorHandler that captures uncaught errors and sends them to Firebase Crashlytics. * * @internal */ export declare class FirebaseErrorHandler implements ErrorHandler { private readonly injector; private _router?; private readonly crashlytics; constructor(app: FirebaseApp, crashlyticsOptions?: CrashlyticsOptions); handleError(error: unknown): void; } /** * Configures automatic Angular router navigation tracking for Firebase Crashlytics. * * This function subscribes to router navigation events, keeps the Crashlytics route path attribute * updated, and logs view boundary telemetry automatically. * * @example * ```typescript * import { ApplicationConfig, ErrorHandler, inject, DestroyRef } from '@angular/core'; * import { Router } from '@angular/router'; * import { FirebaseErrorHandler, setupCrashlyticsRoutes } from 'firebase/crashlytics/angular'; * * export const appConfig: ApplicationConfig = { * providers: [ * { * provide: ErrorHandler, * useFactory: () => new FirebaseErrorHandler(firebaseApp) * }, * provideEnvironmentInitializer(() => { * inject(ErrorHandler); * setupCrashlyticsRoutes({ * firebaseApp, * router: inject(Router), * destroyRef: inject(DestroyRef) * }); * }) * ] * }; * ``` * * @param firebaseApp - The {@link @firebase/app#FirebaseApp} instance to use. * @param router - The Angular {@link @angular/router#Router} instance to subscribe to. * @param destroyRef - The {@link @angular/core#DestroyRef} instance to bind teardown logic to. * @param crashlyticsOptions - Optional. {@link CrashlyticsOptions} that configure the Crashlytics instance. * * @internal */ export declare function setupCrashlyticsRoutes({ firebaseApp, router, destroyRef, crashlyticsOptions }: { firebaseApp: FirebaseApp; router: Router; destroyRef: DestroyRef; crashlyticsOptions?: CrashlyticsOptions; }): void; /** * Registers Firebase Crashlytics error handling and route tracking providers for an Angular application. * * @example * Basic usage: * ```typescript * import { ApplicationConfig } from '@angular/core'; * import { provideRouter } from '@angular/router'; * import { provideCrashlytics } from 'firebase/crashlytics/angular'; * import { app } from '../lib/firebase'; * import { routes } from './app.routes'; * * export const appConfig: ApplicationConfig = { * providers: [ * provideRouter(routes), * provideCrashlytics(() => app) * ] * }; * ``` * * @example * Providing telemetry options: * ```typescript * import { ApplicationConfig } from '@angular/core'; * import { provideRouter } from '@angular/router'; * import { provideCrashlytics } from 'firebase/crashlytics/angular'; * import { app } from '../lib/firebase'; * import { routes } from './app.routes'; * * export const appConfig: ApplicationConfig = { * providers: [ * provideRouter(routes), * provideCrashlytics(() => app, { appVersion: '1.2.3' }) * ] * }; * ``` * * @param getAppFn - A factory function that returns the {@link @firebase/app#FirebaseApp} instance to use. * @param options - Optional. {@link CrashlyticsOptions} that configure the Crashlytics instance. * @returns An {@link @angular/core#EnvironmentProviders} instance to include in `ApplicationConfig.providers`. * * @beta */ export declare function provideCrashlytics(getAppFn: () => FirebaseApp, options?: CrashlyticsOptions): EnvironmentProviders;