@sinequa/atomic-angular 1.5.2 → 1.5.5

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
  }
@@ -3155,8 +3163,9 @@ declare class AppService {
3155
3163
  *
3156
3164
  * @remarks
3157
3165
  * This method constructs an HTTP GET request to fetch the application configuration
3158
- * using the `app` parameter from the global configuration. If the request fails,
3159
- * it logs the error to the console and returns an empty observable.
3166
+ * using the `app` parameter from the global configuration. If the request fails, it logs the
3167
+ * error and re-throws a normalized `Error` carrying the server's `errorMessage` when available
3168
+ * (e.g. "app not found: '...'"), so callers can surface the reason on the error page.
3160
3169
  *
3161
3170
  * @example
3162
3171
  * ```typescript
@@ -4626,29 +4635,68 @@ type Theme = (typeof THEMES)[number];
4626
4635
  declare function withThemes(app: ApplicationRef, themes: Theme[]): ApplicationRef;
4627
4636
 
4628
4637
  /**
4629
- * Signs in the user by checking the global configuration for authentication method and acting accordingly.
4638
+ * Signs the user in according to the resolved {@link globalConfig.authMode}.
4639
+ *
4640
+ * The mode is expected to be resolved beforehand (by `initializeAppConfig`, awaited in
4641
+ * `bootstrapApp`). This function clears any existing session, then:
4642
+ * - `credentials` → redirect to the login form;
4643
+ * - `sso` → reload the page so the browser/proxy performs the handshake;
4644
+ * - `oauth` / `saml` → delegate to `login()`, which redirects to the provider;
4645
+ * - `bearer` → delegate to `login()`;
4646
+ * - `unknown` → `login()` tries SSO silently then resolves to credentials; on failure the login
4647
+ * form is shown.
4630
4648
  *
4631
- * This function first clears any existing session tokens to ensure a clean authentication state. It then checks the
4632
- * global configuration to determine whether to use credentials-based authentication or Single Sign-On (SSO). If
4633
- * credentials are used, it redirects the user to the login page. If SSO is enabled, it reloads the page to trigger
4634
- * the SSO login process. If neither method is specified, it attempts a standard login and handles any errors that
4635
- * may occur during the process.
4636
- * @returns A promise resolving to a boolean indicating the success of the sign-in operation.
4649
+ * @returns A promise resolving to a boolean indicating whether the user is authenticated.
4637
4650
  */
4638
4651
  declare function signIn(): Promise<boolean>;
4639
4652
 
4640
4653
  /**
4641
4654
  * Bootstraps the application by ensuring the user is authenticated and initializing the application.
4642
4655
  *
4643
- * This function first attempts to sign in the user using the provided `Router`. If authentication is successful,
4644
- * it proceeds to initialize the application and create routes using the `applicationService`. Any errors during
4645
- * authentication or initialization are logged to the console, but the returned promise always resolves.
4656
+ * This function first attempts to sign in the user via `signIn()`. If authentication is successful,
4657
+ * it initializes the application (stores and, optionally, dynamic routes) through `ApplicationService`
4658
+ * and waits for the initialization to complete before resolving. Any errors during authentication or
4659
+ * initialization are logged to the console, but the returned promise never rejects.
4646
4660
  *
4647
- * @param Router - The application's router instance used for navigation and authentication.
4648
- * @param applicationService - The service responsible for initializing the application and creating routes.
4649
- * @returns A promise that resolves when the application is ready to be initialized, regardless of success or failure.
4661
+ * Note: this function relies on Angular's injection context, so it must be called within one
4662
+ * (e.g. from `provideAppInitializer`).
4663
+ *
4664
+ * @param options - Configuration options for the bootstrap process.
4665
+ * @param options.createRoutes - Whether to create routes during initialization. Defaults to `true`.
4666
+ * @returns A promise that resolves to `true` when the application has been fully initialized,
4667
+ * or `false` when the user is not authenticated or an error occurred.
4650
4668
  */
4651
- declare function withBootstrapApp(applicationService: ApplicationService, { createRoutes }: {
4669
+ declare function bootstrapApp({ createRoutes }?: {
4670
+ createRoutes?: boolean | undefined;
4671
+ }): Promise<boolean>;
4672
+ /**
4673
+ * Bootstraps the application by ensuring the user is authenticated and initializing the application.
4674
+ *
4675
+ * @deprecated Use {@link bootstrapApp} instead, and let it inject `ApplicationService` itself.
4676
+ *
4677
+ * Migration — in your `app.config.ts`, replace:
4678
+ * ```ts
4679
+ * // ❌ Deprecated: eagerly injecting ApplicationService in the factory constructs it (and its
4680
+ * // dependent stores/services) BEFORE bootstrapApp resolves the config, so services that build
4681
+ * // their API URL from `globalConfig.backendUrl` capture `undefined` (→ `/undefined/api/v1/...`).
4682
+ * provideAppInitializer(() => withBootstrapApp(inject(ApplicationService), { createRoutes: true })),
4683
+ * ```
4684
+ * with:
4685
+ * ```ts
4686
+ * // ✅ bootstrapApp injects ApplicationService internally, AFTER initializeAppConfig() has set
4687
+ * // `backendUrl` and resolved the auth mode.
4688
+ * provideAppInitializer(() => bootstrapApp({ createRoutes: true })),
4689
+ * ```
4690
+ * (Remove the now-unused `inject` / `ApplicationService` imports.)
4691
+ *
4692
+ * @param applicationService - Ignored; kept for backward compatibility. `ApplicationService` is
4693
+ * provided in root and injected internally by {@link bootstrapApp}, so the instance is the same.
4694
+ * Passing `inject(ApplicationService)` here is discouraged — see the migration note above.
4695
+ * @param options - Configuration options for the bootstrap process.
4696
+ * @param options.createRoutes - Whether to create routes during initialization. Defaults to `true`.
4697
+ * @returns A promise that resolves when the bootstrap process is complete, regardless of success or failure.
4698
+ */
4699
+ declare function withBootstrapApp(_applicationService: ApplicationService, { createRoutes }?: {
4652
4700
  createRoutes?: boolean | undefined;
4653
4701
  }): Promise<void>;
4654
4702
 
@@ -8144,13 +8192,19 @@ declare class AlertsComponent {
8144
8192
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<AlertsComponent, "Alerts", never, {}, {}, never, never, true, never>;
8145
8193
  }
8146
8194
 
8147
- type AuthView = "signin" | "changepassword" | "login" | "forgotpassword";
8195
+ type AuthView = "signin" | "changepassword" | "login" | "forgotpassword" | "signedout";
8148
8196
  declare class AuthPageComponent {
8149
8197
  mode: _angular_core.InputSignal<AuthView | undefined>;
8150
8198
  view: _angular_core.WritableSignal<AuthView>;
8151
8199
  readonly username: _angular_core.WritableSignal<string>;
8152
8200
  readonly alert: _angular_core.WritableSignal<string | undefined>;
8153
8201
  private readonly route;
8202
+ /**
8203
+ * Default view derived from the route. The `/logout` route renders the "signed out" confirmation
8204
+ * (NOT the sign-in form): in external-auth modes the form would auto-restart the handshake and
8205
+ * re-authenticate the user, defeating the logout. Everything else defaults to the sign-in form.
8206
+ */
8207
+ private routeView;
8154
8208
  constructor();
8155
8209
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthPageComponent, never>;
8156
8210
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<AuthPageComponent, "auth-page, AuthPage, authpage", never, { "mode": { "alias": "mode"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
@@ -8215,9 +8269,13 @@ declare class SignInComponent {
8215
8269
  } & Record<string, any>>;
8216
8270
  /**
8217
8271
  * True when authentication is handled outside the credentials form — i.e. by the
8218
- * browser/proxy (`useSSO`) or by an auto-configured OAuth/SAML provider. In those
8219
- * modes this screen shows a loader instead of a login form and initiates the
8220
- * handshake automatically by calling `handleLogin()`.
8272
+ * browser/proxy (`sso`) or by an auto-configured OAuth/SAML provider. In those modes
8273
+ * this screen shows a loader instead of a login form and initiates the handshake
8274
+ * automatically by calling `handleLogin()`.
8275
+ *
8276
+ * Note: the ambiguous `unknown` mode is intentionally excluded — it is resolved upstream
8277
+ * (in `login()`/`signIn()`) to either `sso` or `credentials` before this screen renders,
8278
+ * so reaching here in `unknown` should still show the form, never a dead-end loader.
8221
8279
  */
8222
8280
  readonly externalAuth: boolean;
8223
8281
  class: _angular_core.InputSignal<string | undefined>;
@@ -8276,6 +8334,29 @@ declare class SignInComponent {
8276
8334
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<SignInComponent, "signIn, signin, sign-in", never, { "class": { "alias": "class"; "required": false; "isSignal": true; }; "username": { "alias": "username"; "required": false; "isSignal": true; }; "password": { "alias": "password"; "required": false; "isSignal": true; }; }, { "forgotPassword": "forgotPassword"; "username": "usernameChange"; "password": "passwordChange"; }, never, never, true, never>;
8277
8335
  }
8278
8336
 
8337
+ /**
8338
+ * Post-logout confirmation shown on the `/logout` route.
8339
+ *
8340
+ * Rendering this view (instead of the sign-in form) is essential for the external-auth modes
8341
+ * (`sso` / `oauth` / `saml`): the sign-in form auto-initiates the handshake when
8342
+ * `authMode` is external, so showing it on `/logout` would immediately re-authenticate the user
8343
+ * (a spinner that loops back in). This view gives a clear "signed out" state and a single explicit
8344
+ * action to sign in again.
8345
+ */
8346
+ declare class SignedOutComponent {
8347
+ private readonly router;
8348
+ /**
8349
+ * Navigate to the login screen, which then drives the normal sign-in handshake.
8350
+ *
8351
+ * A `returnUrl` is required: in the external-auth modes the sign-in screen only navigates away
8352
+ * once the handshake completes IF a `returnUrl` is present (otherwise it stays on the loader).
8353
+ * We send the user back to the app root after signing in again.
8354
+ */
8355
+ signInAgain(): void;
8356
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<SignedOutComponent, never>;
8357
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SignedOutComponent, "signed-out, SignedOut, signedout", never, {}, {}, never, never, true, never>;
8358
+ }
8359
+
8279
8360
  declare class BookmarkButtonComponent {
8280
8361
  variant: _angular_core.InputSignal<"default" | "link" | "primary" | "secondary" | "outline" | "accent" | "tertiary" | "ghost" | "light-accent" | "destructive" | "icon" | "ai" | "none" | null | undefined>;
8281
8362
  size: _angular_core.InputSignal<"icon" | "xs" | "sm" | "md" | "lg" | null | undefined>;
@@ -14439,8 +14520,12 @@ declare const authInterceptorFn: HttpInterceptorFn;
14439
14520
  declare const bodyInterceptorFn: (request: HttpRequest<unknown>, next: HttpHandlerFn) => rxjs.Observable<_angular_common_http.HttpEvent<unknown>>;
14440
14521
 
14441
14522
  /**
14442
- * Interceptor function that handles HTTP 401 errors by refreshing authentication
14443
- * and retrying the original request. For 403 errors, logs out the user.
14523
+ * Interceptor function that handles HTTP 401 errors by refreshing authentication and retrying the
14524
+ * original request once. For 403 errors, the error is propagated as a permanent auth failure.
14525
+ *
14526
+ * The retry happens ONLY when `signIn()` reports the user is authenticated, and AT MOST once per
14527
+ * request. Without these two guards a persistent 401 (credentials required, or an endpoint that
14528
+ * keeps rejecting even after a successful CSRF handshake) would retry endlessly.
14444
14529
  *
14445
14530
  * @param request - The HTTP request object.
14446
14531
  * @param next - The HTTP handler function.
@@ -14922,5 +15007,5 @@ type AppFeatures = {
14922
15007
  */
14923
15008
  declare const APP_FEATURES: InjectionToken<AppFeatures>;
14924
15009
 
14925
- export { AGGREGATIONS_NAMES, AGGREGATIONS_NAMES_PRESET_DEFAULT, APP_FEATURES, AdvancedFiltersComponent, AdvancedSearch, AdvancedSearchComponent, AggregationComponent, AggregationDateComponent, AggregationDateRangeDialogComponent, AggregationListComponent, AggregationPanelComponent, 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, SidebarNavComponent, 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, injectRouteNavigation, 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 };
15010
+ export { AGGREGATIONS_NAMES, AGGREGATIONS_NAMES_PRESET_DEFAULT, APP_FEATURES, AdvancedFiltersComponent, AdvancedSearch, AdvancedSearchComponent, AggregationComponent, AggregationDateComponent, AggregationDateRangeDialogComponent, AggregationListComponent, AggregationPanelComponent, 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, SidebarNavComponent, SignInComponent, SignedOutComponent, 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, injectRouteNavigation, 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 };
14926
15011
  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, NavRouteTab, 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.5.2",
3
+ "version": "1.5.5",
4
4
  "peerDependencies": {
5
5
  "@angular/core": "^20.0.0"
6
6
  },