diff --git a/packages/geo/src/lib/directions/directions-sources/directions-source.interface.ts b/packages/geo/src/lib/directions/directions-sources/directions-source.interface.ts index 86be78d1c..086f2b1c9 100644 --- a/packages/geo/src/lib/directions/directions-sources/directions-source.interface.ts +++ b/packages/geo/src/lib/directions/directions-sources/directions-source.interface.ts @@ -1,3 +1,5 @@ +import { Provider } from '@angular/core'; + export interface DirectionsSourceOptions extends BaseDirectionsSourceOptions { osrm?: OsrmDirectionsSourceOptions; logo?: string; @@ -21,3 +23,12 @@ export interface BaseDirectionsSourceOptionsProfileAuthorization { url: string; property: string; } + +export interface DirectionSourceFeature { + kind: KindT; + providers: Provider[]; +} + +export enum DirectionSourceKind { + OSRM = 0 +} diff --git a/packages/geo/src/lib/directions/directions-sources/directions-source.provider.ts b/packages/geo/src/lib/directions/directions-sources/directions-source.provider.ts index 903aaf10a..fb1dfaa1b 100644 --- a/packages/geo/src/lib/directions/directions-sources/directions-source.provider.ts +++ b/packages/geo/src/lib/directions/directions-sources/directions-source.provider.ts @@ -3,6 +3,10 @@ import { HttpClient } from '@angular/common/http'; import { ConfigService } from '@igo2/core/config'; import { DirectionsSource } from './directions-source'; +import { + DirectionSourceFeature, + DirectionSourceKind +} from './directions-source.interface'; import { OsrmDirectionsSource } from './osrm-directions-source'; export function osrmDirectionsSourcesFactory( @@ -20,3 +24,10 @@ export function provideOsrmDirectionsSource() { deps: [HttpClient, ConfigService] }; } + +export function withOsrmSource(): DirectionSourceFeature { + return { + kind: DirectionSourceKind.OSRM, + providers: [provideOsrmDirectionsSource()] + }; +} diff --git a/packages/geo/src/lib/directions/directions.module.ts b/packages/geo/src/lib/directions/directions.module.ts index 292603dda..baa7aba7d 100644 --- a/packages/geo/src/lib/directions/directions.module.ts +++ b/packages/geo/src/lib/directions/directions.module.ts @@ -1,15 +1,12 @@ import { ModuleWithProviders, NgModule } from '@angular/core'; -import { IgoSearchModule } from '../search/search.module'; import { DirectionsButtonsComponent } from './directions-buttons/directions-buttons.component'; import { DirectionsInputsComponent } from './directions-inputs/directions-inputs.component'; import { DirectionsResultsComponent } from './directions-results/directions-results.component'; import { DirectionsComponent } from './directions.component'; -import { provideDirectionsSourceService } from './shared/directions-source.service'; @NgModule({ imports: [ - IgoSearchModule.forRoot(), DirectionsComponent, DirectionsInputsComponent, DirectionsButtonsComponent, @@ -20,8 +17,7 @@ import { provideDirectionsSourceService } from './shared/directions-source.servi DirectionsInputsComponent, DirectionsButtonsComponent, DirectionsResultsComponent - ], - providers: [provideDirectionsSourceService()] + ] }) export class IgoDirectionsModule { /** diff --git a/packages/geo/src/lib/directions/directions.provider.ts b/packages/geo/src/lib/directions/directions.provider.ts new file mode 100644 index 000000000..a793d6d73 --- /dev/null +++ b/packages/geo/src/lib/directions/directions.provider.ts @@ -0,0 +1,26 @@ +import { Provider } from '@angular/core'; + +import { + DirectionSourceFeature, + DirectionSourceKind +} from './directions-sources'; +import { DirectionsService } from './shared'; +import { provideDirectionsSourceService } from './shared/directions-source.service'; + +export function provideDirection( + ...sources: DirectionSourceFeature[] +): Provider[] { + const providers: Provider[] = [ + { + provide: DirectionsService, + useClass: DirectionsService + }, + provideDirectionsSourceService() + ]; + + for (const source of sources) { + providers.push(...source.providers); + } + + return providers; +} diff --git a/packages/geo/src/lib/directions/index.ts b/packages/geo/src/lib/directions/index.ts index 32e01b457..4b17db929 100644 --- a/packages/geo/src/lib/directions/index.ts +++ b/packages/geo/src/lib/directions/index.ts @@ -1,5 +1,6 @@ export * from './shared'; export * from './directions.component'; +export * from './directions.provider'; export * from './directions-sources'; export * from './directions-inputs'; export * from './directions-buttons'; diff --git a/packages/geo/src/lib/directions/shared/directions.service.ts b/packages/geo/src/lib/directions/shared/directions.service.ts index 48f747bf1..cf24d3d2c 100644 --- a/packages/geo/src/lib/directions/shared/directions.service.ts +++ b/packages/geo/src/lib/directions/shared/directions.service.ts @@ -26,9 +26,7 @@ import { formatInstruction } from './directions.utils'; -@Injectable({ - providedIn: 'root' -}) +@Injectable() export class DirectionsService { constructor( private directionsSourceService: DirectionsSourceService, diff --git a/packages/geo/src/lib/query/shared/index.ts b/packages/geo/src/lib/query/shared/index.ts index 2dbb3b534..829dbbf8a 100644 --- a/packages/geo/src/lib/query/shared/index.ts +++ b/packages/geo/src/lib/query/shared/index.ts @@ -4,3 +4,4 @@ export * from './query.enums'; export * from './query.interfaces'; export * from './query.utils'; export * from './query-search-source'; +export * from './query-search-source.providers'; diff --git a/packages/geo/src/lib/search/search.module.ts b/packages/geo/src/lib/search/search.module.ts index e63cbf7f4..6e3c6d755 100644 --- a/packages/geo/src/lib/search/search.module.ts +++ b/packages/geo/src/lib/search/search.module.ts @@ -40,6 +40,9 @@ export const SEARCH_DIRECTIVES = [ ] }) export class IgoSearchModule { + /** + * @deprecated import the provideSearch() directly and add the source in the provider property + */ static forRoot(): ModuleWithProviders { return { ngModule: IgoSearchModule, diff --git a/packages/geo/src/lib/search/shared/index.ts b/packages/geo/src/lib/search/shared/index.ts index 0a4a692c8..16404f0d9 100644 --- a/packages/geo/src/lib/search/shared/index.ts +++ b/packages/geo/src/lib/search/shared/index.ts @@ -1,4 +1,5 @@ export * from './search.enums'; +export * from './search.provider'; export * from './search.interfaces'; export * from './search-pointer-summary.directive'; export * from './search.service'; diff --git a/packages/geo/src/lib/search/shared/search.provider.ts b/packages/geo/src/lib/search/shared/search.provider.ts new file mode 100644 index 000000000..2f017229b --- /dev/null +++ b/packages/geo/src/lib/search/shared/search.provider.ts @@ -0,0 +1,36 @@ +import { Provider } from '@angular/core'; + +import { provideSearchSourceService } from './search-source-service.providers'; +import { SearchService } from './search.service'; +import { + SearchSourceFeature, + SearchSourceKind +} from './sources/source.interfaces'; + +interface ISearchProviderOptions { + /** Share the search term with analytics tracking */ + analytics?: boolean; +} + +export function provideSearch( + sources: SearchSourceFeature[], + options?: ISearchProviderOptions +): Provider[] { + const providers: Provider[] = [ + options?.analytics && { + provide: 'searchAnalytics', + useValue: options.analytics + }, + { + provide: SearchService, + useClass: SearchService + }, + provideSearchSourceService() + ].filter(Boolean); + + for (const source of sources) { + providers.push(...source.providers); + } + + return providers; +} diff --git a/packages/geo/src/lib/search/shared/search.service.ts b/packages/geo/src/lib/search/shared/search.service.ts index 4d06f4927..67760265d 100644 --- a/packages/geo/src/lib/search/shared/search.service.ts +++ b/packages/geo/src/lib/search/shared/search.service.ts @@ -1,5 +1,13 @@ -import { Injectable } from '@angular/core'; +import { + Inject, + Injectable, + Optional, + WritableSignal, + effect, + signal +} from '@angular/core'; +import { AnalyticsService } from '@igo2/core/analytics'; import { StorageService } from '@igo2/core/storage'; import { MapService } from '../../map/shared/map.service'; @@ -24,15 +32,32 @@ import { * keeps internal state of the researches it performed * and the results they yielded. */ -@Injectable({ - providedIn: 'root' -}) +@Injectable() export class SearchService { + searchTerm: WritableSignal = signal(null); + constructor( private searchSourceService: SearchSourceService, private mapService: MapService, - private storageService: StorageService - ) {} + private storageService: StorageService, + private analyticsService: AnalyticsService, + @Inject('searchAnalytics') + @Optional() + analytics: boolean + ) { + if (analytics) { + this.handleAnalytics(); + } + } + + private handleAnalytics(): void { + effect(() => { + const term = this.searchTerm(); + if (term != null) { + this.analyticsService.trackSearch(term, null); + } + }); + } /** * Perform a research by text @@ -44,6 +69,8 @@ export class SearchService { return []; } + this.searchTerm.set(term); + const proj = this.mapService.getMap()?.projection || 'EPSG:3857'; const response = stringToLonLat(term, proj, { forceNA: options.forceNA diff --git a/packages/geo/src/lib/search/shared/sources/cadastre.providers.ts b/packages/geo/src/lib/search/shared/sources/cadastre.providers.ts index b64f602b0..91b06ddd8 100644 --- a/packages/geo/src/lib/search/shared/sources/cadastre.providers.ts +++ b/packages/geo/src/lib/search/shared/sources/cadastre.providers.ts @@ -6,6 +6,7 @@ import { StorageService } from '@igo2/core/storage'; import { CadastreSearchSource } from './cadastre'; import { SearchSource } from './source'; +import { SearchSourceFeature, SearchSourceKind } from './source.interfaces'; /** * Cadastre search source factory @@ -36,3 +37,10 @@ export function provideCadastreSearchSource() { deps: [HttpClient, LanguageService, StorageService, ConfigService] }; } + +export function withCadastreSource(): SearchSourceFeature { + return { + kind: SearchSourceKind.Cadastre, + providers: [provideCadastreSearchSource()] + }; +} diff --git a/packages/geo/src/lib/search/shared/sources/coordinates.providers.ts b/packages/geo/src/lib/search/shared/sources/coordinates.providers.ts index b031868f0..2852fd795 100644 --- a/packages/geo/src/lib/search/shared/sources/coordinates.providers.ts +++ b/packages/geo/src/lib/search/shared/sources/coordinates.providers.ts @@ -9,6 +9,7 @@ import { CoordinatesSearchResultFormatter } from './coordinates'; import { SearchSource } from './source'; +import { SearchSourceFeature, SearchSourceKind } from './source.interfaces'; /** * Coordinate search result formatter factory @@ -60,3 +61,13 @@ export function provideCoordinatesReverseSearchSource() { deps: [ConfigService, LanguageService, StorageService, ProjectionService] }; } + +export function withCoordinatesReverseSource(): SearchSourceFeature { + return { + kind: SearchSourceKind.CoordinatesReverse, + providers: [ + provideCoordinatesReverseSearchSource(), + provideDefaultCoordinatesSearchResultFormatter() + ] + }; +} diff --git a/packages/geo/src/lib/search/shared/sources/icherche.providers.ts b/packages/geo/src/lib/search/shared/sources/icherche.providers.ts index 2ab2805e2..7fe9eed82 100644 --- a/packages/geo/src/lib/search/shared/sources/icherche.providers.ts +++ b/packages/geo/src/lib/search/shared/sources/icherche.providers.ts @@ -1,5 +1,5 @@ import { HttpClient } from '@angular/common/http'; -import { Injector } from '@angular/core'; +import { Injector, Provider } from '@angular/core'; import { ConfigService } from '@igo2/core/config'; import { LanguageService } from '@igo2/core/language'; @@ -11,6 +11,7 @@ import { IChercheSearchSource } from './icherche'; import { SearchSource } from './source'; +import { SearchSourceFeature, SearchSourceKind } from './source.interfaces'; /** * ICherche search result formatter factory @@ -25,7 +26,7 @@ export function defaultIChercheSearchResultFormatterFactory( /** * Function that returns a provider for the ICherche search result formatter */ -export function provideDefaultIChercheSearchResultFormatter() { +export function provideDefaultIChercheSearchResultFormatter(): Provider { return { provide: IChercheSearchResultFormatter, useFactory: defaultIChercheSearchResultFormatterFactory, @@ -58,7 +59,7 @@ export function ichercheSearchSourceFactory( /** * Function that returns a provider for the ICherche search source */ -export function provideIChercheSearchSource() { +export function provideIChercheSearchSource(): Provider { return { provide: SearchSource, useFactory: ichercheSearchSourceFactory, @@ -74,6 +75,16 @@ export function provideIChercheSearchSource() { }; } +export function withIChercheSource(): SearchSourceFeature { + return { + kind: SearchSourceKind.ICherche, + providers: [ + provideIChercheSearchSource(), + provideDefaultIChercheSearchResultFormatter() + ] + }; +} + /** * IChercheReverse search source factory * @ignore @@ -105,3 +116,13 @@ export function provideIChercheReverseSearchSource() { deps: [HttpClient, LanguageService, StorageService, ConfigService, Injector] }; } + +export function withIChercheReverseSource(): SearchSourceFeature { + return { + kind: SearchSourceKind.IChercheReverse, + providers: [ + provideIChercheReverseSearchSource(), + provideDefaultIChercheSearchResultFormatter() + ] + }; +} diff --git a/packages/geo/src/lib/search/shared/sources/icherche.ts b/packages/geo/src/lib/search/shared/sources/icherche.ts index da713019d..6c9d830fe 100644 --- a/packages/geo/src/lib/search/shared/sources/icherche.ts +++ b/packages/geo/src/lib/search/shared/sources/icherche.ts @@ -629,7 +629,7 @@ export class IChercheSearchSource extends SearchSource implements TextSearch { const hashtags = term.match(/(#[A-Za-z]+)/g) || []; let keep = false; keep = hashtags.some((hashtag) => { - const hashtagKey = hashtag.substring(1); + const hashtagKey = String(hashtag).substring(1); return this.hashtagsLieuxToKeep.some( (h) => h diff --git a/packages/geo/src/lib/search/shared/sources/ilayer.providers.ts b/packages/geo/src/lib/search/shared/sources/ilayer.providers.ts index 863699a3f..87ad082ba 100644 --- a/packages/geo/src/lib/search/shared/sources/ilayer.providers.ts +++ b/packages/geo/src/lib/search/shared/sources/ilayer.providers.ts @@ -6,6 +6,7 @@ import { StorageService } from '@igo2/core/storage'; import { ILayerSearchResultFormatter, ILayerSearchSource } from './ilayer'; import { SearchSource } from './source'; +import { SearchSourceFeature, SearchSourceKind } from './source.interfaces'; /** * ILayer search result formatter factory @@ -65,3 +66,13 @@ export function provideILayerSearchSource() { ] }; } + +export function withILayerSource(): SearchSourceFeature { + return { + kind: SearchSourceKind.ILayer, + providers: [ + provideILayerSearchSource(), + provideILayerSearchResultFormatter() + ] + }; +} diff --git a/packages/geo/src/lib/search/shared/sources/nominatim.providers.ts b/packages/geo/src/lib/search/shared/sources/nominatim.providers.ts index 947c9acfb..9466a53fd 100644 --- a/packages/geo/src/lib/search/shared/sources/nominatim.providers.ts +++ b/packages/geo/src/lib/search/shared/sources/nominatim.providers.ts @@ -5,6 +5,7 @@ import { StorageService } from '@igo2/core/storage'; import { NominatimSearchSource } from './nominatim'; import { SearchSource } from './source'; +import { SearchSourceFeature, SearchSourceKind } from './source.interfaces'; /** * Nominatim search source factory @@ -33,3 +34,10 @@ export function provideNominatimSearchSource() { deps: [HttpClient, ConfigService, StorageService] }; } + +export function withNominatimSource(): SearchSourceFeature { + return { + kind: SearchSourceKind.Nominatim, + providers: [provideNominatimSearchSource()] + }; +} diff --git a/packages/geo/src/lib/search/shared/sources/source.interfaces.ts b/packages/geo/src/lib/search/shared/sources/source.interfaces.ts index c818707b4..df52c243b 100644 --- a/packages/geo/src/lib/search/shared/sources/source.interfaces.ts +++ b/packages/geo/src/lib/search/shared/sources/source.interfaces.ts @@ -1,3 +1,5 @@ +import { Provider } from '@angular/core'; + export interface SearchSourceOptions { title?: string; searchUrl?: string; @@ -52,3 +54,20 @@ export interface ReverseSearchOptions { zoom?: number; params?: { [key: string]: string }; } + +export interface SearchSourceFeature { + kind: KindT; + providers: Provider[]; +} + +export enum SearchSourceKind { + ICherche = 0, + IChercheReverse = 1, + Cadastre = 2, + CoordinatesReverse = 3, + ILayer = 4, + Nominatim = 5, + StoredQueries = 6, + StoredQueriesReverse = 7, + Workspace = 8 +} diff --git a/packages/geo/src/lib/search/shared/sources/storedqueries.providers.ts b/packages/geo/src/lib/search/shared/sources/storedqueries.providers.ts index 44755a90f..5a1540331 100644 --- a/packages/geo/src/lib/search/shared/sources/storedqueries.providers.ts +++ b/packages/geo/src/lib/search/shared/sources/storedqueries.providers.ts @@ -5,6 +5,7 @@ import { LanguageService } from '@igo2/core/language'; import { StorageService } from '@igo2/core/storage'; import { SearchSource } from './source'; +import { SearchSourceFeature, SearchSourceKind } from './source.interfaces'; import { StoredQueriesReverseSearchSource, StoredQueriesSearchSource @@ -40,6 +41,13 @@ export function provideStoredQueriesSearchSource() { }; } +export function withStoredQueriesSource(): SearchSourceFeature { + return { + kind: SearchSourceKind.StoredQueries, + providers: [provideStoredQueriesSearchSource()] + }; +} + /** * StoredQueriesReverse search source factory * @ignore @@ -70,3 +78,10 @@ export function provideStoredQueriesReverseSearchSource() { deps: [HttpClient, LanguageService, StorageService, ConfigService] }; } + +export function withStoredQueriesReverseSource(): SearchSourceFeature { + return { + kind: SearchSourceKind.StoredQueriesReverse, + providers: [provideStoredQueriesReverseSearchSource()] + }; +} diff --git a/packages/geo/src/lib/search/shared/sources/workspace.providers.ts b/packages/geo/src/lib/search/shared/sources/workspace.providers.ts index 066f55a8f..ad4cf92b3 100644 --- a/packages/geo/src/lib/search/shared/sources/workspace.providers.ts +++ b/packages/geo/src/lib/search/shared/sources/workspace.providers.ts @@ -3,6 +3,7 @@ import { LanguageService } from '@igo2/core/language'; import { StorageService } from '@igo2/core/storage'; import { SearchSource } from './source'; +import { SearchSourceFeature, SearchSourceKind } from './source.interfaces'; import { WorkspaceSearchSource } from './workspace'; /** @@ -32,3 +33,10 @@ export function provideWorkspaceSearchSource() { deps: [LanguageService, StorageService, ConfigService] }; } + +export function withWorkspaceSource(): SearchSourceFeature { + return { + kind: SearchSourceKind.Workspace, + providers: [provideWorkspaceSearchSource()] + }; +} diff --git a/packages/integration/src/lib/analytics/analytics-listener.service.ts b/packages/integration/src/lib/analytics/analytics-listener.service.ts index 6608fb6ce..3303911cc 100644 --- a/packages/integration/src/lib/analytics/analytics-listener.service.ts +++ b/packages/integration/src/lib/analytics/analytics-listener.service.ts @@ -15,7 +15,6 @@ import { skip } from 'rxjs/operators'; import { ContextState } from '../context/context.state'; import { MapState } from '../map/map.state'; -import { SearchState } from '../search/search.state'; import { ToolState } from '../tool/tool.state'; /** @@ -33,7 +32,6 @@ export class AnalyticsListenerService { private analyticsService: AnalyticsService, private authService: AuthService, private contextState: ContextState, - private searchState: SearchState, private toolState: ToolState, private mapState: MapState ) {} @@ -42,7 +40,6 @@ export class AnalyticsListenerService { this.listenUser(); this.listenContext(); this.listenTool(); - this.listenSearch(); this.listenLayer(); } @@ -81,19 +78,6 @@ export class AnalyticsListenerService { }); } - listenSearch() { - this.searchState.searchTerm$ - .pipe(skip(1)) - .subscribe((searchTerm: string) => { - if (searchTerm !== undefined && searchTerm !== null) { - this.analyticsService.trackSearch( - searchTerm, - this.searchState.store.count - ); - } - }); - } - /** * Listener for adding layers to the map */ diff --git a/packages/integration/src/lib/search/search.state.ts b/packages/integration/src/lib/search/search.state.ts index 3151e3cbf..894a22d04 100644 --- a/packages/integration/src/lib/search/search.state.ts +++ b/packages/integration/src/lib/search/search.state.ts @@ -36,9 +36,7 @@ export interface SearchFeatureMotion { /** * Service that holds the state of the search module */ -@Injectable({ - providedIn: 'root' -}) +@Injectable() export class SearchState { public searchLayerStores: FeatureStore[] = []; public searchOverlayStyle: CommonVectorStyleOptions = {}; diff --git a/packages/integration/src/lib/workspace/shared/edition-actions.service.ts b/packages/integration/src/lib/workspace/shared/edition-actions.service.ts index 8f8d9af0b..6873cb226 100644 --- a/packages/integration/src/lib/workspace/shared/edition-actions.service.ts +++ b/packages/integration/src/lib/workspace/shared/edition-actions.service.ts @@ -1,4 +1,4 @@ -import { Inject, Injectable, OnDestroy } from '@angular/core'; +import { Inject, Injectable, OnDestroy, Optional } from '@angular/core'; import { Action } from '@igo2/common/action'; import { Widget } from '@igo2/common/widget'; @@ -36,7 +36,9 @@ export class EditionActionsService implements OnDestroy { } constructor( - @Inject(OgcFilterWidget) private ogcFilterWidget: Widget, + @Optional() + @Inject(OgcFilterWidget) + private ogcFilterWidget: Widget, private storageState: StorageState, public languageService: LanguageService, private mediaService: MediaService, diff --git a/packages/integration/src/lib/workspace/shared/wfs-actions.service.ts b/packages/integration/src/lib/workspace/shared/wfs-actions.service.ts index df7c32138..977c4160c 100644 --- a/packages/integration/src/lib/workspace/shared/wfs-actions.service.ts +++ b/packages/integration/src/lib/workspace/shared/wfs-actions.service.ts @@ -1,4 +1,4 @@ -import { Inject, Injectable, OnDestroy } from '@angular/core'; +import { Inject, Injectable, OnDestroy, Optional } from '@angular/core'; import { Action } from '@igo2/common/action'; import { Widget } from '@igo2/common/widget'; @@ -40,7 +40,9 @@ export class WfsActionsService implements OnDestroy { } constructor( - @Inject(OgcFilterWidget) private ogcFilterWidget: Widget, + @Optional() + @Inject(OgcFilterWidget) + private ogcFilterWidget: Widget, private storageState: StorageState, public languageService: LanguageService, private mediaService: MediaService, diff --git a/projects/demo/src/app/geo/directions/directions.component.ts b/projects/demo/src/app/geo/directions/directions.component.ts index 3ed2f7308..93b2ff0ac 100644 --- a/projects/demo/src/app/geo/directions/directions.component.ts +++ b/projects/demo/src/app/geo/directions/directions.component.ts @@ -15,7 +15,9 @@ import { StopsFeatureStore, StopsStore, TileLayer, - TileLayerOptions + TileLayerOptions, + provideDirection, + withOsrmSource } from '@igo2/geo'; import { BehaviorSubject, Subject } from 'rxjs'; @@ -35,7 +37,8 @@ import { ExampleViewerComponent } from '../../components/example/example-viewer/ MAP_DIRECTIVES, IgoDirectionsModule, IgoSearchModule - ] + ], + providers: [provideDirection(withOsrmSource())] }) export class AppDirectionsComponent { public map: IgoMap = new IgoMap({ diff --git a/projects/demo/src/app/geo/search/search.component.ts b/projects/demo/src/app/geo/search/search.component.ts index 3e2f7065c..29e0eae37 100644 --- a/projects/demo/src/app/geo/search/search.component.ts +++ b/projects/demo/src/app/geo/search/search.component.ts @@ -33,12 +33,10 @@ import { Research, SEARCH_RESULTS_DIRECTIVES, SearchResult, - SearchService, ZoomButtonComponent, - provideDefaultCoordinatesSearchResultFormatter, - provideDefaultIChercheSearchResultFormatter, - provideILayerSearchResultFormatter, - provideSearchSourceService + provideSearch, + withIChercheSource, + withWorkspaceSource } from '@igo2/geo'; import { SearchState } from '@igo2/integration'; @@ -70,11 +68,10 @@ import { ExampleViewerComponent } from '../../components/example/example-viewer/ FeatureDetailsComponent ], providers: [ - SearchService, - provideSearchSourceService(), - provideDefaultIChercheSearchResultFormatter(), - provideDefaultCoordinatesSearchResultFormatter(), - provideILayerSearchResultFormatter() + provideSearch([withIChercheSource(), withWorkspaceSource()], { + analytics: true + }), + SearchState ] }) export class AppSearchComponent implements OnInit, OnDestroy { diff --git a/projects/demo/src/main.ts b/projects/demo/src/main.ts index 6c651a70e..cd7ad2320 100644 --- a/projects/demo/src/main.ts +++ b/projects/demo/src/main.ts @@ -27,13 +27,6 @@ import { provideIcon } from '@igo2/common/icon'; import { IgoCoreModule } from '@igo2/core'; import { provideConfig } from '@igo2/core/config'; import { provideTranslation } from '@igo2/core/language'; -import { - IgoDirectionsModule, - IgoGeoWorkspaceModule, - provideIChercheSearchSource, - provideOsrmDirectionsSource, - provideWorkspaceSearchSource -} from '@igo2/geo'; import { AppComponent } from './app/app.component'; import { routes } from './app/app.routing'; @@ -60,9 +53,7 @@ bootstrapApplication(AppComponent, { MatIconModule, MatListModule, MatSidenavModule, - MatToolbarModule, - IgoGeoWorkspaceModule, - IgoDirectionsModule + MatToolbarModule ), provideHttpClient(withJsonpSupport()), provideRouter(routes, withPreloading(PreloadAllModules)), @@ -72,9 +63,6 @@ bootstrapApplication(AppComponent, { }), provideTranslation(), provideAuthentification(), - provideOsrmDirectionsSource(), - provideIChercheSearchSource(), - provideWorkspaceSearchSource(), provideIcon(), { provide: MAT_FORM_FIELD_DEFAULT_OPTIONS,