@sinequa/atomic-angular 1.0.17 → 1.0.18
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.
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Injectable, inject, HostBinding, Component, Pipe, InjectionToken, computed, ChangeDetectorRef, DestroyRef, LOCALE_ID, Inject, Optional, input, output, signal, effect, assertInInjectionContext, runInInjectionContext, EnvironmentInjector, Injector, EventEmitter, Directive, viewChild, ElementRef, afterNextRender, untracked, linkedSignal, model, TemplateRef, HostListener, Renderer2, contentChildren, contentChild, booleanAttribute, ChangeDetectionStrategy, resource, ViewContainerRef, viewChildren, numberAttribute, afterRenderEffect, afterEveryRender } from '@angular/core';
|
|
3
|
-
import { BehaviorSubject, Subscription, catchError, throwError, firstValueFrom, map, Subject, of, tap, EMPTY, filter, shareReplay, fromEvent, debounceTime,
|
|
3
|
+
import { BehaviorSubject, Subscription, catchError, throwError, firstValueFrom, map, Subject, of, tap, EMPTY, filter, shareReplay, from, fromEvent, debounceTime, switchMap } from 'rxjs';
|
|
4
4
|
import { TranslocoService, TranslocoPipe, provideTranslocoScope } from '@jsverse/transloco';
|
|
5
5
|
import { DropdownComponent, DropdownContentComponent, InputComponent, ButtonComponent, cn, FaIconComponent, EllipsisIcon, ChevronRightIcon, MenuComponent, MenuContentComponent, MenuItemComponent, CardComponent, CardHeaderComponent, CardContentComponent, BadgeComponent, DialogComponent, DialogHeaderComponent, DialogTitleComponent, DialogContentComponent, DialogFooterComponent, ListItemComponent, SwitchComponent, SelectOptionDirective, DialogService, TabsComponent, TabsListComponent, TabComponent, ChevronLeftIconComponent, ChevronsLeftIconComponent, ChevronsRightIconComponent, Separator, SheetCloseDirective, SheetService, DateRangePickerDirective, DatepickerDirective, ButtonGroup, InputGroupInput, InputGroupComponent, InputGroupAddonComponent, SearchIcon, FilterIcon, LoadingCircleIconComponent, CircleCheckIconComponent, PopoverComponent, CardFooterComponent, BookmarkIcon, PopoverContentComponent, UserIcon, TrashIcon, FolderIcon, VerticalDividerComponent, BreakpointObserverService, HorizontalDividerComponent, FlagEnglishIconComponent, FlagFrenchIconComponent, EditIcon, UndoIcon, AvatarComponent, AvatarFallbackComponent, AvatarImageComponent } from '@sinequa/ui';
|
|
6
6
|
import highlightWords from 'highlight-words';
|
|
7
7
|
import { ActivatedRoute, Router, NavigationEnd, RouterLink, RouterModule } from '@angular/router';
|
|
8
8
|
import { withDevtools } from '@angular-architects/ngrx-toolkit';
|
|
9
9
|
import { signalStore, signalStoreFeature, withState, withMethods, patchState, getState, withComputed } from '@ngrx/signals';
|
|
10
|
-
import { globalConfig, EngineType, extraColumns, sysLang, getQueryParamsFromUrl, clearSessionTokens, login, info, error, setGlobalConfig, initializeAppConfig, notify, addConcepts, queryParamsFromUrl, patchUserSettings, deleteUserSettings, fetchUserSettings, warn, buildPathsAndLevels, escapeExpr, isAuthenticated, isExpired, debug, AuditEventType, fetchSuggest, isObject, Audit, getMetadata, bisect, isNotInputEvent, fetchSponsoredLinks, fetchQuery, translateAggregationToDateOptions, aggItemRegex, parseValueAndOperatorFromItem, fetchSuggestField, fetchSimilarDocuments, logout, fetchChangePassword, fetchSendPasswordResetEmail, expiresSoon, suggestionsToTreeAggregationNodes, labels, fetchLabels, guid, getRelativeDate, createUserProfile, deleteUserProfileProperty, patchUserProfile, isJsonable, addAuditAdditionalInfo, getToken, setToken, createHeaders } from '@sinequa/atomic';
|
|
10
|
+
import { globalConfig, EngineType, extraColumns, sysLang, fetchPrincipal, getQueryParamsFromUrl, clearSessionTokens, login, info, error, setGlobalConfig, initializeAppConfig, notify, addConcepts, queryParamsFromUrl, patchUserSettings, deleteUserSettings, fetchUserSettings, warn, buildPathsAndLevels, escapeExpr, isAuthenticated, isExpired, debug, AuditEventType, fetchSuggest, isObject, Audit, getMetadata, bisect, isNotInputEvent, fetchSponsoredLinks, fetchQuery, translateAggregationToDateOptions, aggItemRegex, parseValueAndOperatorFromItem, fetchSuggestField, fetchSimilarDocuments, logout, fetchChangePassword, fetchSendPasswordResetEmail, expiresSoon, suggestionsToTreeAggregationNodes, labels, fetchLabels, guid, getRelativeDate, createUserProfile, deleteUserProfileProperty, patchUserProfile, isJsonable, addAuditAdditionalInfo, getToken, setToken, createHeaders } from '@sinequa/atomic';
|
|
11
11
|
import { HttpClient, HttpParams, httpResource, HttpResponse, HttpContextToken, HttpHeaders } from '@angular/common/http';
|
|
12
12
|
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
|
13
13
|
import { DatePipe, DATE_PIPE_DEFAULT_TIMEZONE, DATE_PIPE_DEFAULT_OPTIONS, Location, NgTemplateOutlet, NgStyle, NgClass, NgComponentOutlet } from '@angular/common';
|
|
@@ -1314,26 +1314,24 @@ const PrincipalStore = signalStore({ providedIn: 'root' }, withDevtools('Princip
|
|
|
1314
1314
|
}
|
|
1315
1315
|
})), withPrincipalFeatures());
|
|
1316
1316
|
function withPrincipalFeatures() {
|
|
1317
|
-
return signalStoreFeature(withMethods((store) => {
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
console.error('Principal fetch failed', error);
|
|
1328
|
-
patchState(store, { state: 'error' });
|
|
1329
|
-
throw error;
|
|
1330
|
-
}), map((principal) => {
|
|
1331
|
-
const { userOverrideActive = false } = globalConfig;
|
|
1332
|
-
patchState(store, { ...initialPrincipal, ...principal, userOverrideActive, state: 'loaded' });
|
|
1333
|
-
})));
|
|
1317
|
+
return signalStoreFeature(withMethods((store) => ({
|
|
1318
|
+
async initialize() {
|
|
1319
|
+
patchState(store, { state: 'loading' });
|
|
1320
|
+
try {
|
|
1321
|
+
// Use the SDK's fetchPrincipal so the principal load goes through the same auth handling
|
|
1322
|
+
// as the rest of atomic (credentials: "include" + the authMode-aware noAutoAuthentication
|
|
1323
|
+
// flag). In SSO mode it sends noAutoAuthentication=false, letting IIS/Windows authenticate.
|
|
1324
|
+
const principal = await fetchPrincipal();
|
|
1325
|
+
const { userOverrideActive = false } = globalConfig;
|
|
1326
|
+
patchState(store, { ...initialPrincipal, ...principal, userOverrideActive, state: 'loaded' });
|
|
1334
1327
|
}
|
|
1335
|
-
|
|
1336
|
-
|
|
1328
|
+
catch (error) {
|
|
1329
|
+
console.error('Principal fetch failed', error);
|
|
1330
|
+
patchState(store, { state: 'error' });
|
|
1331
|
+
throw error;
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
})));
|
|
1337
1335
|
}
|
|
1338
1336
|
|
|
1339
1337
|
/**
|
|
@@ -4587,17 +4585,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
4587
4585
|
* @deprecated This service is deprecated and should not be used directly. Please use the PrincipalStore instead.
|
|
4588
4586
|
*/
|
|
4589
4587
|
class PrincipalService {
|
|
4590
|
-
http = inject(HttpClient);
|
|
4591
|
-
API_URL = `${globalConfig.backendUrl}/api/v1`;
|
|
4592
4588
|
/**
|
|
4593
4589
|
* Retrieves the principal information from the server.
|
|
4594
4590
|
*
|
|
4595
4591
|
* @returns Observable<Principal> An observable that emits the principal information.
|
|
4596
4592
|
*
|
|
4597
4593
|
* @remarks
|
|
4598
|
-
*
|
|
4599
|
-
*
|
|
4600
|
-
* In case of an error, it logs the error to the console and returns an empty observable.
|
|
4594
|
+
* Delegates to the SDK's fetchPrincipal so the request goes through atomic's auth handling
|
|
4595
|
+
* (credentials + authMode-aware noAutoAuthentication). On error it logs and returns EMPTY.
|
|
4601
4596
|
*
|
|
4602
4597
|
* @example
|
|
4603
4598
|
* ```typescript
|
|
@@ -4607,9 +4602,7 @@ class PrincipalService {
|
|
|
4607
4602
|
* ```
|
|
4608
4603
|
*/
|
|
4609
4604
|
getPrincipal() {
|
|
4610
|
-
|
|
4611
|
-
params.append('noAuthentication', 'true');
|
|
4612
|
-
return this.http.get(this.API_URL + '/principal', { params }).pipe(catchError(error => {
|
|
4605
|
+
return from(fetchPrincipal()).pipe(catchError(error => {
|
|
4613
4606
|
console.error('PrincipalService.getPrincipal failure - error: ', error);
|
|
4614
4607
|
return EMPTY;
|
|
4615
4608
|
}));
|