|  | 
|  | 1 | +import {CommonModule} from '@angular/common'; | 
|  | 2 | +import {NgModule, ModuleWithProviders, InjectionToken} from '@angular/core'; | 
|  | 3 | +import {FormsModule, ReactiveFormsModule} from '@angular/forms'; | 
|  | 4 | + | 
|  | 5 | +import {AuthProcessService} from './services/auth-process.service'; | 
|  | 6 | +import {FirestoreSyncService} from './services/firestore-sync.service'; | 
|  | 7 | +import {FirebaseAppConfig, FirebaseOptionsToken, FirebaseNameOrConfigToken} from 'angularfire2'; | 
|  | 8 | +import {AngularFirestoreModule} from 'angularfire2/firestore'; | 
|  | 9 | +import {defaultAuthFirebaseUIConfig, NgBootstrapAuthFirebaseUIConfig} from './interfaces/config.interface'; | 
|  | 10 | +import {AuthComponent} from './components/auth/auth.component'; | 
|  | 11 | +import {HttpClientModule} from '@angular/common/http'; | 
|  | 12 | +import {AngularFireAuthModule} from 'angularfire2/auth'; | 
|  | 13 | +import {NgbModule} from '@ng-bootstrap/ng-bootstrap'; | 
|  | 14 | + | 
|  | 15 | +// Export module's public API | 
|  | 16 | +// components | 
|  | 17 | +export {AuthComponent} from './components/auth/auth.component'; | 
|  | 18 | + | 
|  | 19 | +// services | 
|  | 20 | +export {AuthProcessService, AuthProvider} from './services/auth-process.service'; | 
|  | 21 | +export {FirestoreSyncService} from './services/firestore-sync.service'; | 
|  | 22 | + | 
|  | 23 | +// interfaces | 
|  | 24 | +export {NgBootstrapAuthFirebaseUIConfig} from './interfaces/config.interface'; | 
|  | 25 | + | 
|  | 26 | +export const NgBootstrapAuthFirebaseUIConfigToken = new InjectionToken<NgBootstrapAuthFirebaseUIConfig>('NgBootstrapAuthFirebaseUIConfig'); | 
|  | 27 | + | 
|  | 28 | +@NgModule({ | 
|  | 29 | +  imports: [ | 
|  | 30 | +    CommonModule, | 
|  | 31 | +    NgbModule.forRoot(), | 
|  | 32 | +    HttpClientModule, | 
|  | 33 | +    FormsModule, | 
|  | 34 | +    ReactiveFormsModule, | 
|  | 35 | +    AngularFireAuthModule, | 
|  | 36 | +    AngularFirestoreModule | 
|  | 37 | +  ], | 
|  | 38 | +  exports: | 
|  | 39 | +    [ | 
|  | 40 | +      AuthComponent, | 
|  | 41 | +      AngularFireAuthModule, | 
|  | 42 | +      AngularFirestoreModule | 
|  | 43 | +    ], | 
|  | 44 | +  declarations: | 
|  | 45 | +    [ | 
|  | 46 | +      AuthComponent | 
|  | 47 | +    ] | 
|  | 48 | +}) | 
|  | 49 | +export class NgbAuthFirebaseUIModule { | 
|  | 50 | +  static forRoot(configFactory: FirebaseAppConfig, | 
|  | 51 | +                 appNameFactory?: () => string, | 
|  | 52 | +                 config: NgBootstrapAuthFirebaseUIConfig = defaultAuthFirebaseUIConfig): ModuleWithProviders { | 
|  | 53 | +    return { | 
|  | 54 | +      ngModule: NgbAuthFirebaseUIModule, | 
|  | 55 | +      providers: | 
|  | 56 | +        [ | 
|  | 57 | +          { | 
|  | 58 | +            provide: FirebaseOptionsToken, | 
|  | 59 | +            useValue: configFactory | 
|  | 60 | +          }, | 
|  | 61 | +          { | 
|  | 62 | +            provide: FirebaseNameOrConfigToken, | 
|  | 63 | +            useFactory: appNameFactory | 
|  | 64 | +          }, | 
|  | 65 | +          { | 
|  | 66 | +            provide: NgBootstrapAuthFirebaseUIConfigToken, | 
|  | 67 | +            useValue: config | 
|  | 68 | +          }, | 
|  | 69 | +          AuthProcessService, | 
|  | 70 | +          FirestoreSyncService | 
|  | 71 | +        ], | 
|  | 72 | +    }; | 
|  | 73 | +  } | 
|  | 74 | +} | 
0 commit comments