@arsedizioni/ars-utils 22.5.13 → 22.5.14

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,8 +1,9 @@
1
- import { QueryModel, SendToModel, LoginOAuthType, LoginResult, ApiResult, FolderTree } from '@arsedizioni/ars-utils/core';
1
+ import { QueryModel, SendToModel, ApiResult, FolderTree } from '@arsedizioni/ars-utils/core';
2
2
  import { HttpInterceptorFn } from '@angular/common/http';
3
- import * as rxjs from 'rxjs';
4
3
  import * as i0 from '@angular/core';
5
4
  import { Signal, WritableSignal } from '@angular/core';
5
+ import * as rxjs from 'rxjs';
6
+ import { Observable } from 'rxjs';
6
7
 
7
8
  declare const EvolutionMessages: {
8
9
  ERROR: string;
@@ -16,19 +17,101 @@ declare const EvolutionMessages: {
16
17
  LOGOUT: string;
17
18
  };
18
19
 
19
- interface EvolutionLoginResult extends LoginResult<EvolutionUserInfo> {
20
+ /**
21
+ * Outcome of a login, an MFA confirmation, an account switch or a session restore.
22
+ *
23
+ * Aligned with the Evolution `/session/*` API on 2026-08-25, and mirrors
24
+ * `EVO.API.Models.Requests.LoginResultModel`. It is a plain payload and no longer an envelope of
25
+ * its own: `EvolutionLoginResult extends LoginResult<EvolutionUserInfo>` inherited `success` and
26
+ * `message` from `ApiResult<boolean>`, so every answer carried two outcomes -- the transport's and
27
+ * its own -- and the caller had to know which of the two to read. The API wraps this in
28
+ * `ApiResult<T>` like every other payload, and that wrapper is the only outcome there is.
29
+ *
30
+ * `context` is absent while a login is pending an e-mailed code: nothing about the account is
31
+ * disclosed before the code has been redeemed. `GET /session/me` answers with this same shape,
32
+ * built by the same `ResolveSignInContextAsync`, so restoring a session and opening one give an
33
+ * identical context by construction.
34
+ */
35
+ interface EvolutionLoginResult {
36
+ /** The authenticated user with the licence context, or `undefined` while an MFA code is pending. */
37
+ context?: EvolutionUserInfo;
38
+ /** Whether a verification code has been e-mailed and must be confirmed through `/session/confirm`. */
39
+ requiresMfa?: boolean;
40
+ /**
41
+ * Whether the stored password has expired and must be changed before the application is usable.
42
+ *
43
+ * It replaces `context.isTemporary`, which was read for the same purpose and was always false:
44
+ * `UserInfo.IsTemporary` is `[NotMapped]` on the API, is never emitted as a claim and was never
45
+ * filled.
46
+ */
47
+ requiresPasswordChange?: boolean;
20
48
  }
49
+ /**
50
+ * The session as this library holds it, persisted so a page refresh has something to validate.
51
+ *
52
+ * Two fields went with the new contract, and both were about replaying a login nobody asked for
53
+ * again:
54
+ *
55
+ * - `remember`, the flag behind "Ricordami", which made the API issue an `evolution_remember`
56
+ * cookie it could later decrypt the stored password from. `POST /session/login` has no such
57
+ * field, the cookie is not written and nothing is replayed: a sign-in always starts from what the
58
+ * user just typed. This is why `LoginService.autoLogin` no longer exists -- it was
59
+ * a credential-less `login()` that relied on exactly that replay.
60
+ * - `oauth`, the provider the session was opened with, kept so the client could re-post the
61
+ * provider's access token on the next login. The exchange is entirely server-side now, no token
62
+ * ever reaches the browser, and once the session cookie exists a provider login is
63
+ * indistinguishable from a password one.
64
+ *
65
+ * The stored context is a hint, never evidence: the auth cookie is HttpOnly and may have expired
66
+ * while this outlived it, so `LoginService.initialize` validates it against `/session/me` before
67
+ * anyone is told there is a session.
68
+ */
21
69
  interface EvolutionLoginInfo {
22
- context: EvolutionUserInfo;
23
- oauth?: LoginOAuthType;
24
- remember?: boolean;
70
+ /** The licence context of the signed-in user, as returned by the last login, switch or restore. */
71
+ context?: EvolutionUserInfo;
25
72
  }
73
+ /**
74
+ * The `sessionStorage` key naming which account a tab is working as; its value travels on every
75
+ * request as `X-Evo-Account`.
76
+ *
77
+ * It lives here, and not on `CoreService`, so the auth interceptor can read it without importing a
78
+ * service: the interceptor is a factory precisely so that registering it does not pull the Evolution
79
+ * service graph into the eager bundle.
80
+ */
81
+ declare const EVOLUTION_ACTIVE_ACCOUNT_KEY = "evolution_account";
26
82
  interface EvolutionUserLink {
27
83
  id?: number;
28
84
  userId: number;
29
85
  userName?: string;
30
86
  key: string;
31
87
  }
88
+ /**
89
+ * The settings an account may change about itself: the dashboard it opens on and its flags.
90
+ * Mirrors `UpdateUserSettingsModel`; the account is resolved from the session, and the `userId`
91
+ * is only there for an administrator acting on somebody else.
92
+ */
93
+ interface EvolutionUpdateUserSettingsModel {
94
+ userId?: number;
95
+ dashboard?: string;
96
+ flags?: number;
97
+ }
98
+ /**
99
+ * A password change, serving both flows the API supports: the self-service one, which sends
100
+ * `oldPassword` together with the new one, and the administrator-initiated one, which names the
101
+ * account instead.
102
+ */
103
+ interface EvolutionResetPasswordModel {
104
+ userId?: number;
105
+ userEmail?: string;
106
+ password?: string;
107
+ oldPassword?: string;
108
+ recaptchaToken?: string;
109
+ }
110
+ /** A password-recovery request: the address to mail the link to, plus the reCAPTCHA that guards it. */
111
+ interface EvolutionRecoverPasswordModel {
112
+ email?: string;
113
+ recaptchaToken?: string;
114
+ }
32
115
  interface EvolutionUserModuleInfo {
33
116
  name: string;
34
117
  module: number;
@@ -47,15 +130,36 @@ interface EvolutionLicenceModuleInfo {
47
130
  availableOption3?: number;
48
131
  usedOption3?: number;
49
132
  }
133
+ /**
134
+ * The signed-in account together with its licence context, as `ResolveSignInContextAsync` builds it
135
+ * on the API and as every login, switch and restore returns it.
136
+ *
137
+ * What this interface does NOT declare is what the Evolution application computes for itself after
138
+ * a login -- `hasFormazione`, `hasRS`, `expiry`, `expiryInfo` and the rest of the derived
139
+ * module-accessibility flags. They are not sent by the API and this library does not invent model
140
+ * fields the wire never carries: a host that wants them derives them from {@link allowedModules},
141
+ * as the Evolution client does. The licence customization (logo, templates, colours) is left out
142
+ * for the same reason plus one more: it is a model of its own, and nothing here consumes it.
143
+ */
50
144
  interface EvolutionUserInfo {
51
145
  licenceId: number;
52
146
  userId: number;
147
+ /** The place (subject / site / department) the account is scoped to, when it is scoped at all. */
148
+ placeId?: number;
53
149
  companyName: string;
150
+ /** Relative path of the licence logo, when the licence carries a customization. */
151
+ companyLogo?: string;
54
152
  firstName: string;
55
153
  fullName: string;
56
154
  flags?: number;
57
155
  email: string;
58
156
  sessionId?: string;
157
+ /**
158
+ * @deprecated Always false. `UserInfo.IsTemporary` is `[NotMapped]` on the API, is never
159
+ * emitted as a claim and is never filled; an expired password is reported by
160
+ * {@link EvolutionLoginResult.requiresPasswordChange}. Kept only so a consumer still reading it
161
+ * keeps compiling.
162
+ */
59
163
  isTemporary?: boolean;
60
164
  role: number;
61
165
  scope: number;
@@ -72,7 +176,11 @@ interface EvolutionUserInfo {
72
176
  siteCostCenter?: string;
73
177
  departmentId?: number;
74
178
  departmentName?: string;
75
- expiryDate?: string;
179
+ /**
180
+ * When the licence expires. A `Date` and not a `string`: the API sends an ISO timestamp and the
181
+ * HTTP date interceptor is what turns it into a date, exactly as it does for every other model.
182
+ */
183
+ expiryDate?: Date;
76
184
  isExpired?: boolean;
77
185
  isAdministrator?: boolean;
78
186
  isPowerUser?: boolean;
@@ -80,12 +188,27 @@ interface EvolutionUserInfo {
80
188
  isUser?: boolean;
81
189
  isSupportUser?: boolean;
82
190
  isGod?: boolean;
83
- administrators: string;
191
+ /** Whether the licence has the AI assistant available at all. */
192
+ isMcpAvailable?: boolean;
193
+ /** Whether this account may use it. */
194
+ isMcpEnabled?: boolean;
195
+ /** Whether the licence also has the orchestrator; its connection details stay on the host. */
196
+ isMcpOrchestratorAvailable?: boolean;
197
+ /** The operator this account is bound to, for the applications that work by operator. */
198
+ operatorId?: number;
199
+ /** Whether the licence carries a customization (logo, mail templates, colours). */
200
+ hasCustomization?: boolean;
201
+ administrators?: string;
84
202
  availableModules: EvolutionLicenceModuleInfo[];
203
+ availableUsers: number;
204
+ usedUsers: number;
85
205
  availableEmployees: number;
86
206
  usedEmployees: number;
87
207
  availableStorage: number;
88
208
  usedStorage: number;
209
+ availableOption1?: number;
210
+ availableOption2?: number;
211
+ availableOption3?: number;
89
212
  }
90
213
  declare enum EvolutionServiceFlags {
91
214
  None = 0,
@@ -703,9 +826,30 @@ interface EvolutionComplianceActivitiesAddParams extends EvolutionComplianceActi
703
826
  /**
704
827
  * Builds the Evolution auth HTTP interceptor.
705
828
  *
706
- * Takes its two inputs — the Evolution base URI and the service flags — directly
707
- * as arguments (captured in the closure), so it never injects EvolutionService:
708
- * registering it does not pull the full Evolution service into the eager bundle.
829
+ * Attaches the credentials, the service-worker bypass and the active-account header to every
830
+ * request aimed at the Evolution API, and turns HTTP failures into broadcast messages -- no UI
831
+ * dependency here.
832
+ *
833
+ * Takes the Evolution base URI and the service flags directly as arguments, captured in the
834
+ * closure, so it never injects `EvolutionService`: registering it does not pull the whole Evolution
835
+ * service into the eager bundle. The debounce and the expiry latch live in that same closure, so
836
+ * two applications registering two interceptors never share them.
837
+ *
838
+ * ## What the statuses mean
839
+ *
840
+ * Aligned with the Evolution API on 2026-08-25. The meaning of the status codes changed with it:
841
+ * failures used to arrive as `200 OK` with `success: false`, and a dead session had to be guessed
842
+ * from a 405, a 410 or any 5xx. Now the status is the truth -- a 401 on an already-authenticated
843
+ * request means the session is gone, a 403 means the permission is missing, a 5xx means the server
844
+ * broke, and those are three different things that used to be one. `invalidateSession` is
845
+ * therefore now, and only, a 401 outside the authentication endpoints.
846
+ *
847
+ * `EvolutionServiceFlags.NotifySystemErrors` still governs one narrow case, and only that one: a
848
+ * 5xx, i.e. a failure of the server rather than of the request. Without the flag it is swallowed,
849
+ * as it always was in this library.
850
+ *
851
+ * Errors are re-thrown rather than swallowed: call sites rely on their `error` callback firing, and
852
+ * on `finalize` clearing a busy dialog.
709
853
  *
710
854
  * Register it with `withInterceptors`:
711
855
  * @example
@@ -721,11 +865,35 @@ interface EvolutionComplianceActivitiesAddParams extends EvolutionComplianceActi
721
865
  declare function evolutionAuthInterceptor(serviceUri: string, flags?: EvolutionServiceFlags): HttpInterceptorFn;
722
866
 
723
867
  /**
724
- * Authentication service for the Evolution module: login / logout / MFA,
725
- * session bootstrap, connectivity ping and the broadcast handler.
726
- * All session state lives in the private {@link CoreService}; this service
727
- * orchestrates the HTTP flows and re-publishes the parts of core that
728
- * consumers need.
868
+ * Authentication for the Evolution back end: password login, e-mailed code confirmation, account
869
+ * switch, logout and session restore. All session state lives in the private {@link CoreService};
870
+ * this service orchestrates the HTTP flows and re-publishes the parts of core that consumers need.
871
+ *
872
+ * Aligned with the Evolution API on 2026-08-25. Everything goes through `/session/*` and an
873
+ * HttpOnly cookie now: there is no bearer token, no `remember` credential the API can replay, and
874
+ * no provider token acquired by the caller -- the external-provider flow is a full-page redirect
875
+ * handled server-side, and all that reaches this service is the `/session/me` call on the way back.
876
+ *
877
+ * ## What this service no longer offers, and why
878
+ *
879
+ * - **`autoLogin`.** It was `login(undefined, undefined, true)`: a credential-less sign-in that
880
+ * worked only because the API could decrypt a stored password from an `evolution_remember`
881
+ * cookie. `POST /session/login` takes a user and a password and nothing else.
882
+ * - **`autoLogout`.** It wrapped {@link logout} in toasts and a callback, and ran the callback
883
+ * from `complete` -- that is, before the request it was waiting for had said anything. A host
884
+ * that wants a callback subscribes: `logout().subscribe(() => …)`.
885
+ * - **re-login on `LOGIN_CHANGED`.** The handler used to answer that message with a silent
886
+ * `autoLogin`, which is the same replay by another name. The message is still broadcast by hosts
887
+ * that link and unlink Evolution, and it is theirs to act on; this library no longer signs
888
+ * anybody in without being asked.
889
+ * - **the OAuth `Authorization` header, and the per-tab `X-Client-Id`.** The first is server-side
890
+ * now; the second was a random UUID that gave every tab a session cookie of its own. A tab says
891
+ * which of the accounts in the one cookie it is working as with `X-Evo-Account`, written by
892
+ * {@link CoreService.setActiveAccount}.
893
+ *
894
+ * This is a deliberately reduced subset of what the Evolution application itself does: passkeys and
895
+ * the provider redirect are not here. A library whose job is to let another application talk to
896
+ * Evolution signs in with a password; an application that offers the other ways in owns them.
729
897
  */
730
898
  declare class LoginService {
731
899
  private readonly httpClient;
@@ -733,6 +901,15 @@ declare class LoginService {
733
901
  private readonly destroyRef;
734
902
  private readonly core;
735
903
  private broadcastInitialized;
904
+ /**
905
+ * The address the pending login was started with, kept so {@link confirmIdentity} can send it
906
+ * along with the code.
907
+ *
908
+ * The API stores each verification code under the account it was issued to, so a code alone is
909
+ * not redeemable -- which is what stops a guessed code from opening whatever login happens to be
910
+ * pending.
911
+ */
912
+ private pendingLoginEmail?;
736
913
  /**
737
914
  * Gets the base URI of the Evolution back-end service.
738
915
  * @returns The configured service URI, or undefined before initialize().
@@ -748,9 +925,14 @@ declare class LoginService {
748
925
  * @returns The current {@link EvolutionLoginInfo}, or undefined.
749
926
  */
750
927
  get loginInfo(): EvolutionLoginInfo | undefined;
751
- /** `true` when the user has an active (non-temporary) session. */
928
+ /**
929
+ * Gets the signed-in account with its licence context.
930
+ * @returns The current {@link EvolutionUserInfo}, or undefined when there is no session.
931
+ */
932
+ get user(): EvolutionUserInfo | undefined;
933
+ /** `true` when this browser has a session the API has accepted. */
752
934
  get loggedIn(): Signal<boolean>;
753
- /** `true` while a login request is in flight. */
935
+ /** `true` while an authentication is in flight. */
754
936
  get loggingIn(): WritableSignal<boolean>;
755
937
  /**
756
938
  * Persists the current login info to `localStorage` (delegates to core).
@@ -769,14 +951,20 @@ declare class LoginService {
769
951
  */
770
952
  reset(): void;
771
953
  /**
772
- * Removes Evolution session data and resets the state (delegates to core).
773
- * @param clearOAuthToken - When true, also removes the stored OAuth2 access token.
954
+ * Clears every trace of the session on this device without asking the API anything
955
+ * (delegates to core). Use {@link logout} for a real sign-out.
774
956
  * @returns void
775
957
  */
776
- clear(clearOAuthToken?: boolean): void;
958
+ clear(): void;
777
959
  /**
778
- * Initialises the service with the back-end URI and optional feature flags.
779
- * Must be called once during application bootstrap before any other method.
960
+ * Initialises the service with the back-end URI and optional feature flags, and revalidates a
961
+ * session that survived a page refresh instead of assuming it is still there.
962
+ *
963
+ * Must be called once during application bootstrap, before any other method. What it used to do
964
+ * on a refresh was announce `LOGIN_COMPLETED` on the strength of a value in local storage; the
965
+ * auth cookie is HttpOnly and may have expired while that value lived on, so the claim was never
966
+ * verified and the consumer met the inevitable 401 as "your session just expired" rather than as
967
+ * a bootstrap that never got off the ground.
780
968
  * @param serviceUri - Base URL of the Evolution service.
781
969
  * @param flags - Bitmask of `EvolutionServiceFlags` (default: `None`).
782
970
  * @returns void
@@ -789,56 +977,102 @@ declare class LoginService {
789
977
  */
790
978
  private handleBroadcastMessage;
791
979
  /**
792
- * Sends a one-shot ping to the back end to verify connectivity.
980
+ * Sends a one-shot ping to the back end to verify connectivity. Errors are swallowed.
793
981
  * @returns void
794
982
  */
795
983
  ping(): void;
796
984
  /**
797
- * Performs an automatic login using the credentials already stored in the session.
798
- * @param onSuccess - Optional callback invoked after a successful login.
799
- * @returns `true` (always) — the result is handled via the subscription callbacks.
985
+ * Authenticates the user with an e-mail address and a password, the only credentials
986
+ * `POST /session/login` accepts.
987
+ *
988
+ * On success the session cookie is issued and the context stored, unless the API answers
989
+ * `requiresMfa`: the device is not a trusted one, a six-digit code has been e-mailed and nothing
990
+ * about the account is disclosed until {@link confirmIdentity} redeems it.
991
+ *
992
+ * A failure is no longer a `200 OK` carrying `success: false`. Wrong credentials come back as a
993
+ * real 4xx with the message in the envelope, so the `next` branch of the caller is never reached.
994
+ * @param email - The user's e-mail address.
995
+ * @param password - The user's password.
996
+ * @returns An observable that emits the `ApiResult<EvolutionLoginResult>`.
800
997
  */
801
- autoLogin(onSuccess?: () => void): boolean;
998
+ login(email?: string, password?: string): Observable<ApiResult<EvolutionLoginResult>>;
802
999
  /**
803
- * Performs an automatic logout, notifying the user when the session ends.
804
- * @param onSuccess - Optional callback invoked after the logout completes.
805
- * @returns void
1000
+ * Confirms a pending e-mailed code challenge, which establishes the session and marks this device
1001
+ * as trusted: the next sign-in from it will not ask for a code again.
1002
+ *
1003
+ * The address travels with the code, in the body. The API stores each code under the account it
1004
+ * was issued to, so naming the account is part of redeeming it; and a code in the body is a code
1005
+ * that stays out of the URL, where `POST /login/confirm/{code}` left it for the access logs and
1006
+ * the browser history to keep.
1007
+ * @param code - The one-time confirmation code provided to the user.
1008
+ * @param email - The address the code was sent to; defaults to the one the pending login started with.
1009
+ * @returns An observable that emits the `ApiResult<EvolutionLoginResult>`.
806
1010
  */
807
- autoLogout(onSuccess?: () => void): void;
1011
+ confirmIdentity(code: string, email?: string): Observable<ApiResult<EvolutionLoginResult>>;
808
1012
  /**
809
- * Authenticates the user against the Evolution back end (credential or OAuth2).
810
- * @param email - User e-mail (credential login only; omit for OAuth2).
811
- * @param password - User password (credential login only; omit for OAuth2).
812
- * @param remember - Whether to persist the session across browser restarts.
813
- * @param oauth - OAuth2 provider type, when using federated login.
814
- * @param oauthAccessToken - Bearer token from the OAuth2 provider.
1013
+ * Reads the current session from the server, which resolves it from the auth cookie's claims.
1014
+ * Used to restore the state after a page refresh instead of trusting what local storage holds.
1015
+ *
1016
+ * The route answers with the same `EvolutionLoginResult` a login answers with, built by the same
1017
+ * `ResolveSignInContextAsync`, so a restored session and a fresh one are identical by
1018
+ * construction.
815
1019
  * @returns An observable that emits the `ApiResult<EvolutionLoginResult>`.
816
1020
  */
817
- login(email?: string, password?: string, remember?: boolean, oauth?: LoginOAuthType, oauthAccessToken?: string | undefined): rxjs.Observable<ApiResult<EvolutionLoginResult>>;
1021
+ me(): Observable<ApiResult<EvolutionLoginResult>>;
818
1022
  /**
819
- * Finalises a successful login by updating the stored context and notifying consumers.
820
- * @param result - The login result payload from the server.
1023
+ * Asks `/session/me` whether the restored session is still alive, and announces the login when it
1024
+ * is.
1025
+ *
1026
+ * Nothing is cleared on failure, and that is deliberate: a failure here is not proof of a dead
1027
+ * session -- the API may be unreachable, the proxy may have answered 502, the device may be
1028
+ * offline -- and clearing on any of those would sign the user out with a perfectly valid cookie.
1029
+ * A genuine 401 is a different matter and the interceptor has already reported it.
821
1030
  * @returns void
822
1031
  */
823
- private completeLogin;
1032
+ private restoreSession;
824
1033
  /**
825
- * Confirms a multi-factor authentication challenge and completes the login.
826
- * @param code - The one-time MFA code entered by the user.
1034
+ * Switches this tab to another account of the same person -- same address, same stored password
1035
+ * -- without re-entering credentials.
1036
+ *
1037
+ * The account being left stays open: a switch used to close its session, because each account had
1038
+ * a cookie of its own, and they now share one cookie holding several. What changes here is only
1039
+ * which account THIS tab names on its requests, which {@link completeLogin} records.
1040
+ * @param id - The user ID to switch to.
827
1041
  * @returns An observable that emits the `ApiResult<EvolutionLoginResult>`.
828
1042
  */
829
- confirmIdentity(code: string): rxjs.Observable<ApiResult<EvolutionLoginResult>>;
1043
+ loginSwitch(id: number): Observable<ApiResult<EvolutionLoginResult>>;
830
1044
  /**
831
- * Logs the current user out of the back end and clears local session data.
832
- * @param forget - When `true`, instructs the server to discard all stored credentials.
1045
+ * Signs out: closes this browser's session on the API and clears the local state whatever the
1046
+ * answer, since there is nothing useful to do with a logout that failed.
1047
+ *
1048
+ * `forget` no longer means "drop the stored credentials" -- there are none to drop. It means
1049
+ * "stop trusting this device", that is clear the MFA cookie, so that the next sign-in from here
1050
+ * is challenged with an e-mailed code again. It also closes one session and not all of them: an
1051
+ * account may hold one per front end, and signing out of this browser must not sign the person
1052
+ * out of their phone.
1053
+ * @param forget - When `true`, the device stops being a trusted one. Defaults to `false`.
833
1054
  * @returns An observable that emits `ApiResult<unknown>`.
834
1055
  */
835
- logout(forget?: boolean): rxjs.Observable<ApiResult<unknown>>;
1056
+ logout(forget?: boolean): Observable<ApiResult<unknown>>;
836
1057
  /**
837
- * Switches the active session to a different user account while retaining credentials.
838
- * @param id - The user ID to switch to.
839
- * @returns An observable that emits the `ApiResult<EvolutionLoginResult>`.
1058
+ * Finalises a login, a code confirmation, an account switch or a session restore: stores the
1059
+ * context, raises the logged-in signal, records which account this tab is working as and
1060
+ * optionally announces `LOGIN_COMPLETED`.
1061
+ *
1062
+ * `loggedIn` is raised unconditionally. It used to be `!result.context?.isTemporary`, and
1063
+ * `isTemporary` was always false -- it is `[NotMapped]` on the API and never filled -- so the
1064
+ * condition never did anything. An expired password is reported by `requiresPasswordChange` and
1065
+ * does not mean there is no session: the cookie has been issued, and it is what the password
1066
+ * change itself travels on.
1067
+ *
1068
+ * `loggingIn` is deliberately left alone. Whoever raised it lowers it -- {@link restoreSession}
1069
+ * for a refresh, the host application for its own sign-in flow -- because lowering it here would
1070
+ * drop the host's splash the instant the response arrived, before anything was on screen.
1071
+ * @param result - The login result payload from the server.
1072
+ * @param notify - Whether to broadcast `LOGIN_COMPLETED`. Defaults to `true`.
1073
+ * @returns void
840
1074
  */
841
- loginSwitch(id: number): rxjs.Observable<ApiResult<EvolutionLoginResult>>;
1075
+ private completeLogin;
842
1076
  static ɵfac: i0.ɵɵFactoryDeclaration<LoginService, never>;
843
1077
  static ɵprov: i0.ɵɵInjectableDeclaration<LoginService>;
844
1078
  }
@@ -904,7 +1138,15 @@ declare class ComplianceService {
904
1138
  static ɵprov: i0.ɵɵInjectableDeclaration<ComplianceService>;
905
1139
  }
906
1140
 
907
- /** Account endpoints (the `Links` section): user links management. */
1141
+ /**
1142
+ * The `/account/*` endpoints: the links a user account carries, its settings, its password and the
1143
+ * licence behind it.
1144
+ *
1145
+ * Everything here acts on the account the session names, which is why none of these methods takes
1146
+ * one. The licence refresh is the exception in appearance only: the id in the route is ignored by
1147
+ * the API, which reads the account from the session -- it used to be taken at face value, with no
1148
+ * authorization at all, so any integer returned somebody else's company and expiry.
1149
+ */
908
1150
  declare class AccountService {
909
1151
  private readonly httpClient;
910
1152
  private readonly core;
@@ -920,6 +1162,34 @@ declare class AccountService {
920
1162
  * @returns An observable that emits `ApiResult<boolean>`.
921
1163
  */
922
1164
  deleteLink(item: EvolutionUserLink): rxjs.Observable<ApiResult<boolean>>;
1165
+ /**
1166
+ * Persists updated settings for the signed-in account (dashboard, flags).
1167
+ * @param params - The settings to save.
1168
+ * @returns An observable that emits `ApiResult<boolean>`.
1169
+ */
1170
+ updateSettings(params: EvolutionUpdateUserSettingsModel): rxjs.Observable<ApiResult<boolean>>;
1171
+ /**
1172
+ * Changes a password: the signed-in account's own, with `oldPassword`, or somebody else's when an
1173
+ * administrator names it.
1174
+ * @param params - The password change to apply.
1175
+ * @returns An observable that emits `ApiResult<boolean>`.
1176
+ */
1177
+ resetPassword(params: EvolutionResetPasswordModel): rxjs.Observable<ApiResult<boolean>>;
1178
+ /**
1179
+ * Starts a password recovery, which mails a reset link to the given address.
1180
+ * @param params - The address to recover, with the reCAPTCHA token that guards the route.
1181
+ * @returns An observable that emits `ApiResult<boolean>`.
1182
+ */
1183
+ recoverPassword(params: EvolutionRecoverPasswordModel): rxjs.Observable<ApiResult<boolean>>;
1184
+ /**
1185
+ * Re-reads the licence of the signed-in account: company, expiry, quotas and allowed modules.
1186
+ *
1187
+ * Does NOT update the stored context: what the caller does with a fresh licence -- refresh a
1188
+ * settings page, recompute a quota, store it -- is the caller's business, and a service that
1189
+ * quietly rewrote the session context under it would be doing more than it was asked.
1190
+ * @returns An observable that emits `ApiResult<EvolutionUserInfo>`.
1191
+ */
1192
+ refreshLicence(): rxjs.Observable<ApiResult<EvolutionUserInfo>>;
923
1193
  static ɵfac: i0.ɵɵFactoryDeclaration<AccountService, never>;
924
1194
  static ɵprov: i0.ɵɵInjectableDeclaration<AccountService>;
925
1195
  }
@@ -962,9 +1232,18 @@ declare class EvolutionService {
962
1232
  * @returns The current {@link EvolutionLoginInfo}, or undefined.
963
1233
  */
964
1234
  get loginInfo(): EvolutionLoginInfo | undefined;
965
- /** `true` when the user has an active (non-temporary) session. */
1235
+ /**
1236
+ * Gets the signed-in account with its licence context.
1237
+ * @returns The current {@link EvolutionUserInfo}, or undefined when there is no session.
1238
+ */
1239
+ get user(): EvolutionUserInfo | undefined;
1240
+ /**
1241
+ * `true` when this browser has a session the API has accepted. It starts from the stored context
1242
+ * and is confirmed -- or left to the interceptor's 401 handling -- by the `/session/me` call
1243
+ * {@link initialize} makes.
1244
+ */
966
1245
  get loggedIn(): Signal<boolean>;
967
- /** `true` while a login request is in flight. */
1246
+ /** `true` while an authentication is in flight. */
968
1247
  get loggingIn(): WritableSignal<boolean>;
969
1248
  /**
970
1249
  * Initialises the service with the back-end URI and optional feature flags.
@@ -982,5 +1261,5 @@ declare class EvolutionService {
982
1261
  static ɵprov: i0.ɵɵInjectableDeclaration<EvolutionService>;
983
1262
  }
984
1263
 
985
- export { AccountService, ComplianceService, ERPComplianceActivityState, ERPComplianceLawOrigin, ERPComplianceLawState, ERPComplianceLawsSelectionType, ERPComplianceNotificationLimit, ERPComplianceProfileFlags, ERPComplianceProfileRole, ERPComplianceRegisterNotificationType, ERPComplianceRegisterSiteImportOptions, ERPComplianceScope, ERPExportFormat, ERPExportPart, ERPExportSource, ERPExportType, ERPModule, ERPPlace, ERPPlacePermission, ERPRecurrenceFrequencyType, EvolutionComplianceActivityStates, EvolutionComplianceContextInfo, EvolutionComplianceLawChangeStates, EvolutionComplianceLawOrigins, EvolutionComplianceLawStates, EvolutionComplianceNotificationLimits, EvolutionComplianceNotifications, EvolutionComplianceObligationAuthorities, EvolutionComplianceObligationTypes, EvolutionComplianceProfileFlags, EvolutionComplianceProfileRoles, EvolutionComplianceScopes, EvolutionMessages, EvolutionRecurrenceFrequencyTypes, EvolutionService, EvolutionServiceFlags, LoginService, evolutionAuthInterceptor };
986
- export type { ComplianceRegisterUsersResultModel, EvolutionChangeContextModel, EvolutionChangeContextResultModel, EvolutionComplianceActivitiesAddParams, EvolutionComplianceActivity, EvolutionComplianceLaswExportParams, EvolutionComplianceLaw, EvolutionComplianceLawDocumentInfo, EvolutionComplianceLawReference, EvolutionComplianceLawsAddParams, EvolutionComplianceRegister, EvolutionComplianceRegisterProfile, EvolutionComplianceRegisterSite, EvolutionContextInfo, EvolutionExportModel, EvolutionLicenceModuleInfo, EvolutionLoginInfo, EvolutionLoginResult, EvolutionPermission, EvolutionPlacePermission, EvolutionPlaceable, EvolutionQueryRegisterProfilesModel, EvolutionRegisterProfileSiteInfo, EvolutionRegisterProfileUserInfo, EvolutionUserInfo, EvolutionUserLink, EvolutionUserModuleInfo };
1264
+ export { AccountService, ComplianceService, ERPComplianceActivityState, ERPComplianceLawOrigin, ERPComplianceLawState, ERPComplianceLawsSelectionType, ERPComplianceNotificationLimit, ERPComplianceProfileFlags, ERPComplianceProfileRole, ERPComplianceRegisterNotificationType, ERPComplianceRegisterSiteImportOptions, ERPComplianceScope, ERPExportFormat, ERPExportPart, ERPExportSource, ERPExportType, ERPModule, ERPPlace, ERPPlacePermission, ERPRecurrenceFrequencyType, EVOLUTION_ACTIVE_ACCOUNT_KEY, EvolutionComplianceActivityStates, EvolutionComplianceContextInfo, EvolutionComplianceLawChangeStates, EvolutionComplianceLawOrigins, EvolutionComplianceLawStates, EvolutionComplianceNotificationLimits, EvolutionComplianceNotifications, EvolutionComplianceObligationAuthorities, EvolutionComplianceObligationTypes, EvolutionComplianceProfileFlags, EvolutionComplianceProfileRoles, EvolutionComplianceScopes, EvolutionMessages, EvolutionRecurrenceFrequencyTypes, EvolutionService, EvolutionServiceFlags, LoginService, evolutionAuthInterceptor };
1265
+ export type { ComplianceRegisterUsersResultModel, EvolutionChangeContextModel, EvolutionChangeContextResultModel, EvolutionComplianceActivitiesAddParams, EvolutionComplianceActivity, EvolutionComplianceLaswExportParams, EvolutionComplianceLaw, EvolutionComplianceLawDocumentInfo, EvolutionComplianceLawReference, EvolutionComplianceLawsAddParams, EvolutionComplianceRegister, EvolutionComplianceRegisterProfile, EvolutionComplianceRegisterSite, EvolutionContextInfo, EvolutionExportModel, EvolutionLicenceModuleInfo, EvolutionLoginInfo, EvolutionLoginResult, EvolutionPermission, EvolutionPlacePermission, EvolutionPlaceable, EvolutionQueryRegisterProfilesModel, EvolutionRecoverPasswordModel, EvolutionRegisterProfileSiteInfo, EvolutionRegisterProfileUserInfo, EvolutionResetPasswordModel, EvolutionUpdateUserSettingsModel, EvolutionUserInfo, EvolutionUserLink, EvolutionUserModuleInfo };