@sinequa/atomic-angular 1.0.15 → 1.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -224,8 +224,16 @@ declare class DocumentLocatorComponent implements OnDestroy {
224
224
  }
225
225
 
226
226
  declare class ErrorComponent {
227
+ private readonly route;
227
228
  router: Router;
228
- reload(): void;
229
+ /**
230
+ * Human-readable error detail shown on the page, taken from the `message` query param.
231
+ * Callers navigating here can pass it, e.g. on an auth failure:
232
+ * `router.navigate(["error"], { queryParams: { message: err.message } })`.
233
+ */
234
+ readonly message: string | undefined;
235
+ /** Navigate home and re-bootstrap the application (fresh authentication attempt). */
236
+ goHome(): void;
229
237
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ErrorComponent, never>;
230
238
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<ErrorComponent, "error-component, ErrorComponent", never, {}, {}, never, never, true, never>;
231
239
  }
@@ -2759,8 +2767,9 @@ declare class AppService {
2759
2767
  *
2760
2768
  * @remarks
2761
2769
  * This method constructs an HTTP GET request to fetch the application configuration
2762
- * using the `app` parameter from the global configuration. If the request fails,
2763
- * it logs the error to the console and returns an empty observable.
2770
+ * using the `app` parameter from the global configuration. If the request fails, it logs the
2771
+ * error and re-throws a normalized `Error` carrying the server's `errorMessage` when available
2772
+ * (e.g. "app not found: '...'"), so callers can surface the reason on the error page.
2764
2773
  *
2765
2774
  * @example
2766
2775
  * ```typescript
@@ -4229,29 +4238,68 @@ type Theme = (typeof THEMES)[number];
4229
4238
  declare function withThemes(app: ApplicationRef, themes: Theme[]): ApplicationRef;
4230
4239
 
4231
4240
  /**
4232
- * Signs in the user by checking the global configuration for authentication method and acting accordingly.
4241
+ * Signs the user in according to the resolved {@link globalConfig.authMode}.
4233
4242
  *
4234
- * This function first clears any existing session tokens to ensure a clean authentication state. It then checks the
4235
- * global configuration to determine whether to use credentials-based authentication or Single Sign-On (SSO). If
4236
- * credentials are used, it redirects the user to the login page. If SSO is enabled, it reloads the page to trigger
4237
- * the SSO login process. If neither method is specified, it attempts a standard login and handles any errors that
4238
- * may occur during the process.
4239
- * @returns A promise resolving to a boolean indicating the success of the sign-in operation.
4243
+ * The mode is expected to be resolved beforehand (by `initializeAppConfig`, awaited in
4244
+ * `bootstrapApp`). This function clears any existing session, then:
4245
+ * - `credentials` redirect to the login form;
4246
+ * - `sso` reload the page so the browser/proxy performs the handshake;
4247
+ * - `oauth` / `saml` → delegate to `login()`, which redirects to the provider;
4248
+ * - `bearer` delegate to `login()`;
4249
+ * - `unknown` → `login()` tries SSO silently then resolves to credentials; on failure the login
4250
+ * form is shown.
4251
+ *
4252
+ * @returns A promise resolving to a boolean indicating whether the user is authenticated.
4240
4253
  */
4241
4254
  declare function signIn(): Promise<boolean>;
4242
4255
 
4243
4256
  /**
4244
4257
  * Bootstraps the application by ensuring the user is authenticated and initializing the application.
4245
4258
  *
4246
- * This function first attempts to sign in the user using the provided `Router`. If authentication is successful,
4247
- * it proceeds to initialize the application and create routes using the `applicationService`. Any errors during
4248
- * authentication or initialization are logged to the console, but the returned promise always resolves.
4259
+ * This function first attempts to sign in the user via `signIn()`. If authentication is successful,
4260
+ * it initializes the application (stores and, optionally, dynamic routes) through `ApplicationService`
4261
+ * and waits for the initialization to complete before resolving. Any errors during authentication or
4262
+ * initialization are logged to the console, but the returned promise never rejects.
4263
+ *
4264
+ * Note: this function relies on Angular's injection context, so it must be called within one
4265
+ * (e.g. from `provideAppInitializer`).
4266
+ *
4267
+ * @param options - Configuration options for the bootstrap process.
4268
+ * @param options.createRoutes - Whether to create routes during initialization. Defaults to `true`.
4269
+ * @returns A promise that resolves to `true` when the application has been fully initialized,
4270
+ * or `false` when the user is not authenticated or an error occurred.
4271
+ */
4272
+ declare function bootstrapApp({ createRoutes }?: {
4273
+ createRoutes?: boolean | undefined;
4274
+ }): Promise<boolean>;
4275
+ /**
4276
+ * Bootstraps the application by ensuring the user is authenticated and initializing the application.
4277
+ *
4278
+ * @deprecated Use {@link bootstrapApp} instead, and let it inject `ApplicationService` itself.
4249
4279
  *
4250
- * @param Router - The application's router instance used for navigation and authentication.
4251
- * @param applicationService - The service responsible for initializing the application and creating routes.
4252
- * @returns A promise that resolves when the application is ready to be initialized, regardless of success or failure.
4280
+ * Migration in your `app.config.ts`, replace:
4281
+ * ```ts
4282
+ * // Deprecated: eagerly injecting ApplicationService in the factory constructs it (and its
4283
+ * // dependent stores/services) BEFORE bootstrapApp resolves the config, so services that build
4284
+ * // their API URL from `globalConfig.backendUrl` capture `undefined` (→ `/undefined/api/v1/...`).
4285
+ * provideAppInitializer(() => withBootstrapApp(inject(ApplicationService), { createRoutes: true })),
4286
+ * ```
4287
+ * with:
4288
+ * ```ts
4289
+ * // ✅ bootstrapApp injects ApplicationService internally, AFTER initializeAppConfig() has set
4290
+ * // `backendUrl` and resolved the auth mode.
4291
+ * provideAppInitializer(() => bootstrapApp({ createRoutes: true })),
4292
+ * ```
4293
+ * (Remove the now-unused `inject` / `ApplicationService` imports.)
4294
+ *
4295
+ * @param applicationService - Ignored; kept for backward compatibility. `ApplicationService` is
4296
+ * provided in root and injected internally by {@link bootstrapApp}, so the instance is the same.
4297
+ * Passing `inject(ApplicationService)` here is discouraged — see the migration note above.
4298
+ * @param options - Configuration options for the bootstrap process.
4299
+ * @param options.createRoutes - Whether to create routes during initialization. Defaults to `true`.
4300
+ * @returns A promise that resolves when the bootstrap process is complete, regardless of success or failure.
4253
4301
  */
4254
- declare function withBootstrapApp(applicationService: ApplicationService, { createRoutes }: {
4302
+ declare function withBootstrapApp(_applicationService: ApplicationService, { createRoutes }?: {
4255
4303
  createRoutes?: boolean | undefined;
4256
4304
  }): Promise<void>;
4257
4305
 
@@ -8721,6 +8769,7 @@ declare class SignInComponent {
8721
8769
  domain: string;
8722
8770
  };
8723
8771
  userOverrideActive: boolean;
8772
+ authMode: _sinequa_atomic.AuthMode;
8724
8773
  useCredentials: boolean;
8725
8774
  useSSO: boolean;
8726
8775
  useSAML: boolean;
@@ -8729,9 +8778,13 @@ declare class SignInComponent {
8729
8778
  } & Record<string, any>>;
8730
8779
  /**
8731
8780
  * True when authentication is handled outside the credentials form — i.e. by the
8732
- * browser/proxy (`useSSO`) or by an auto-configured OAuth/SAML provider. In those
8733
- * modes this screen shows a loader instead of a login form and initiates the
8734
- * handshake automatically by calling `handleLogin()`.
8781
+ * browser/proxy (`sso`) or by an auto-configured OAuth/SAML provider. In those modes
8782
+ * this screen shows a loader instead of a login form and initiates the handshake
8783
+ * automatically by calling `handleLogin()`.
8784
+ *
8785
+ * Note: the ambiguous `unknown` mode is intentionally excluded — it is resolved upstream
8786
+ * (in `login()`/`signIn()`) to either `sso` or `credentials` before this screen renders,
8787
+ * so reaching here in `unknown` should still show the form, never a dead-end loader.
8735
8788
  */
8736
8789
  readonly externalAuth: boolean;
8737
8790
  class: _angular_core.InputSignal<string | undefined>;
@@ -14586,8 +14639,12 @@ declare const authInterceptorFn: HttpInterceptorFn;
14586
14639
  declare const bodyInterceptorFn: (request: HttpRequest<unknown>, next: HttpHandlerFn) => rxjs.Observable<_angular_common_http.HttpEvent<unknown>>;
14587
14640
 
14588
14641
  /**
14589
- * Interceptor function that handles HTTP 401 errors by refreshing authentication
14590
- * and retrying the original request. For 403 errors, logs out the user.
14642
+ * Interceptor function that handles HTTP 401 errors by refreshing authentication and retrying the
14643
+ * original request once. For 403 errors, the error is propagated as a permanent auth failure.
14644
+ *
14645
+ * The retry happens ONLY when `signIn()` reports the user is authenticated, and AT MOST once per
14646
+ * request. Without these two guards a persistent 401 (credentials required, or an endpoint that
14647
+ * keeps rejecting even after a successful CSRF handshake) would retry endlessly.
14591
14648
  *
14592
14649
  * @param request - The HTTP request object.
14593
14650
  * @param next - The HTTP handler function.
@@ -15069,5 +15126,5 @@ type AppFeatures = {
15069
15126
  */
15070
15127
  declare const APP_FEATURES: InjectionToken<AppFeatures>;
15071
15128
 
15072
- export { AGGREGATIONS_NAMES, AGGREGATIONS_NAMES_PRESET_DEFAULT, APP_FEATURES, AdvancedFiltersComponent, AdvancedSearch, AdvancedSearchComponent, AggregationComponent, AggregationDateComponent, AggregationDateRangeDialogComponent, AggregationListComponent, AggregationTreeComponent, AggregationsService, AggregationsStore, Alert, AlertDialog, AlertsComponent, AppService, AppStore, ApplicationService, ApplicationStore, ArticleEntities, ArticleExtracts, ArticleLabels, ArticleSimilarDocuments, AsideFiltersComponent, AuditFeedbackType, AuditService, AuthGuard, AuthPageComponent, AutocompleteService, BOOKMARKS_CONFIG, BOOKMARKS_OPTIONS, BackdropComponent, BackdropService, BookmarkButtonComponent, BookmarksComponent, COLLECTIONS_CONFIG, COLLECTIONS_OPTIONS, COMPONENTS_FOR_DOCUMENT_TYPE, ChangePasswordComponent, ChildMarkerDirective, CollectionsComponent, CollectionsDialog, DRAWER_COMPONENT, DRAWER_STACK_MAX_COUNT, DateComponent, DeleteCollectionDialog, DidYouMeanComponent, DocumentLocatorComponent, DrawerAdvancedFiltersComponent, DrawerComponent, DrawerNavbarComponent, DrawerPreviewComponent, DrawerService, DrawerStackComponent, DrawerStackService, DropdownInputComponent, DropdownListComponent, ErrorComponent, ExportDialog, ExportService, FILTERS_BREAKPOINT, FILTER_DATE_ALLOW_CUSTOM_RANGE, FeedbackDialogComponent, FileSizePipe, FilterButtonComponent, FiltersBarComponent, HIGHLIGHTS, HighlightWordPipe, InfinityScrollDirective, InlineWorker, JsonMethodPluginService, KeyboardNavigatorDirective, LabelService, LabelsEditDialog, LoadingComponent, MetadataComponent, MissingTermsComponent, MoreButtonComponent, MoreComponent, MultiSelectLabelsComponent, MultiSelectionToolbarComponent, NON_SEARCHABLE_COLUMNS, NON_SEARCHABLE_DEFAULTS, NavbarTabsComponent, NavigationService, NoResultComponent, OpenArticleOnCtrlEnterDirective, OperatorPipe, OverflowItemDirective, OverflowManagerDirective, OverflowStopDirective, OverrideUserDialogComponent, PREVIEW_CONFIG, PagerComponent, PreviewNavigator, PreviewService, PrincipalService, PrincipalStore, QueryParamsStore, QueryService, RECENT_SEARCHES_CONFIG, RECENT_SEARCHES_OPTIONS, ROUTE_COMPONENTS, RecentSearchesComponent, ResetUserSettingsDialogComponent, SAVED_SEARCHES_CONFIG, SAVED_SEARCHES_OPTIONS, SavedSearchDialog, SavedSearchesComponent, SavedSearchesService, SearchFeedbackComponent, SearchInputFooter, SearchService, SelectArticleDirective, SelectArticleOnClickDirective, SelectionHistoryService, SelectionService, SelectionStore, ShowBookmarkDirective, SignInComponent, SortSelectorComponent, SourceComponent, SourceIconPipe, SponsoredResultsComponent, SyslangPipe, THEMES, TextChunkService, ThemeProviderDirective, ThemeSelectorComponent, ThemeStore, ThemeToggleComponent, TranslocoDateImpurePipe, UserProfileDialog, UserProfileFormComponent, UserProfileService, UserSettingsStore, applyThemeToNativeElement, auditInterceptorFn, authInterceptorFn, bodyInterceptorFn, buildQuery, debouncedSignal, errorInterceptorFn, getCurrentPath, getCurrentQueryName, getQueryNameFromRoute, processCssVars, queryNameResolver, signIn, themeColorNameToCssVariable, themeColorsToCssVariables, toastInterceptorFn, withAggregationsFeatures, withAlertsFeatures, withAppFeatures, withApplicationFeatures, withAssistantFeatures, withBasketsFeatures, withBookmarkFeatures, withBootstrapApp, withExtractsFeatures, withFetch, withMultiSelectionFeatures, withPrincipalFeatures, withQueryParamsFeatures, withRecentSearchesFeatures, withSavedSearchesFeatures, withSelectionFeatures, withThemeBodyHook, withThemes, withThemesFeatures, withUserSettingsFeatures };
15129
+ export { AGGREGATIONS_NAMES, AGGREGATIONS_NAMES_PRESET_DEFAULT, APP_FEATURES, AdvancedFiltersComponent, AdvancedSearch, AdvancedSearchComponent, AggregationComponent, AggregationDateComponent, AggregationDateRangeDialogComponent, AggregationListComponent, AggregationTreeComponent, AggregationsService, AggregationsStore, Alert, AlertDialog, AlertsComponent, AppService, AppStore, ApplicationService, ApplicationStore, ArticleEntities, ArticleExtracts, ArticleLabels, ArticleSimilarDocuments, AsideFiltersComponent, AuditFeedbackType, AuditService, AuthGuard, AuthPageComponent, AutocompleteService, BOOKMARKS_CONFIG, BOOKMARKS_OPTIONS, BackdropComponent, BackdropService, BookmarkButtonComponent, BookmarksComponent, COLLECTIONS_CONFIG, COLLECTIONS_OPTIONS, COMPONENTS_FOR_DOCUMENT_TYPE, ChangePasswordComponent, ChildMarkerDirective, CollectionsComponent, CollectionsDialog, DRAWER_COMPONENT, DRAWER_STACK_MAX_COUNT, DateComponent, DeleteCollectionDialog, DidYouMeanComponent, DocumentLocatorComponent, DrawerAdvancedFiltersComponent, DrawerComponent, DrawerNavbarComponent, DrawerPreviewComponent, DrawerService, DrawerStackComponent, DrawerStackService, DropdownInputComponent, DropdownListComponent, ErrorComponent, ExportDialog, ExportService, FILTERS_BREAKPOINT, FILTER_DATE_ALLOW_CUSTOM_RANGE, FeedbackDialogComponent, FileSizePipe, FilterButtonComponent, FiltersBarComponent, HIGHLIGHTS, HighlightWordPipe, InfinityScrollDirective, InlineWorker, JsonMethodPluginService, KeyboardNavigatorDirective, LabelService, LabelsEditDialog, LoadingComponent, MetadataComponent, MissingTermsComponent, MoreButtonComponent, MoreComponent, MultiSelectLabelsComponent, MultiSelectionToolbarComponent, NON_SEARCHABLE_COLUMNS, NON_SEARCHABLE_DEFAULTS, NavbarTabsComponent, NavigationService, NoResultComponent, OpenArticleOnCtrlEnterDirective, OperatorPipe, OverflowItemDirective, OverflowManagerDirective, OverflowStopDirective, OverrideUserDialogComponent, PREVIEW_CONFIG, PagerComponent, PreviewNavigator, PreviewService, PrincipalService, PrincipalStore, QueryParamsStore, QueryService, RECENT_SEARCHES_CONFIG, RECENT_SEARCHES_OPTIONS, ROUTE_COMPONENTS, RecentSearchesComponent, ResetUserSettingsDialogComponent, SAVED_SEARCHES_CONFIG, SAVED_SEARCHES_OPTIONS, SavedSearchDialog, SavedSearchesComponent, SavedSearchesService, SearchFeedbackComponent, SearchInputFooter, SearchService, SelectArticleDirective, SelectArticleOnClickDirective, SelectionHistoryService, SelectionService, SelectionStore, ShowBookmarkDirective, SignInComponent, SortSelectorComponent, SourceComponent, SourceIconPipe, SponsoredResultsComponent, SyslangPipe, THEMES, TextChunkService, ThemeProviderDirective, ThemeSelectorComponent, ThemeStore, ThemeToggleComponent, TranslocoDateImpurePipe, UserProfileDialog, UserProfileFormComponent, UserProfileService, UserSettingsStore, applyThemeToNativeElement, auditInterceptorFn, authInterceptorFn, bodyInterceptorFn, bootstrapApp, buildQuery, debouncedSignal, errorInterceptorFn, getCurrentPath, getCurrentQueryName, getQueryNameFromRoute, processCssVars, queryNameResolver, signIn, themeColorNameToCssVariable, themeColorsToCssVariables, toastInterceptorFn, withAggregationsFeatures, withAlertsFeatures, withAppFeatures, withApplicationFeatures, withAssistantFeatures, withBasketsFeatures, withBookmarkFeatures, withBootstrapApp, withExtractsFeatures, withFetch, withMultiSelectionFeatures, withPrincipalFeatures, withQueryParamsFeatures, withRecentSearchesFeatures, withSavedSearchesFeatures, withSelectionFeatures, withThemeBodyHook, withThemes, withThemesFeatures, withUserSettingsFeatures };
15073
15130
  export type { AgentUserSettings, AggEx, AggregationEx, AggregationListEx, AggregationListItem, AggregationTitle, AggregationTreeEx, AggregationsState, AppCJson, AppFeatures, ApplicationState, ArticleMetadata, AssistantDetails, Autocomplete, Basket, Bookmark, BookmarksConfig, CAggregation, CAggregationItem, CCAppState, CCWebServiceLabels, CConverter, CFilter, CFilterEx, CFilterItem, CJ, CJson, CJsonMint, CSources, CollectionsConfig, ComponentMapping, CssVars, DateRange, DocumentOffsets, DocumentPages, DocumentTypeMap, DropdownItem, ExportQueryOptions, Extract, FilterDropdown, KeyboardNavigationOnSelectionHandlers, KeyboardNavigatorOptions, LabelsConfig, MultiSelectionState, MultiSelectionToolbarVariants, PageConfiguration, PreviewEvents, PreviewHighlight, PreviewHighlightName, PreviewHighlights, PrincipalState, SearchItem, SearchOptions, SearchesConfig, SelectionHistoryEvent, SelectionState, SelectionStrategy, SideCJson, SortingChoice, Theme, ThemeBodyHookParameters, ThemeScope, ThemeStoreState, UserSettingsState };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sinequa/atomic-angular",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "peerDependencies": {
5
5
  "@angular/core": "^20.0.0"
6
6
  },