@zambon-dev/shared 1.0.1 → 1.1.0

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.
@@ -0,0 +1,5 @@
1
+ export { BrandComponent } from './brand/brand.component';
2
+ export { EnvironmentBadgeComponent } from './environment-badge/environment-badge.component';
3
+ export { NotificationsComponent } from './notifications/notifications.component';
4
+ export { TopBarComponent } from './top-bar.component';
5
+ export { UserProfileComponent } from './user-profile/user-profile.component';
@@ -0,0 +1,21 @@
1
+ import { ElementRef, OnInit } from '@angular/core';
2
+ import { Observable } from 'rxjs';
3
+ import { INotification } from '../../../models';
4
+ import * as i0 from "@angular/core";
5
+ export declare class NotificationsComponent implements OnInit {
6
+ dropdown: ElementRef<HTMLDivElement>;
7
+ private notificationsService;
8
+ private router;
9
+ protected notifications$: Observable<INotification[]>;
10
+ protected showDropdown: boolean;
11
+ protected unreadCount$: Observable<number>;
12
+ /** Whether the notifications feature is enabled; when false the bell is not rendered. */
13
+ get isEnabled(): boolean;
14
+ ngOnInit(): void;
15
+ onDropdownClick(): void;
16
+ onMarkAllAsRead(): void;
17
+ onNotificationClick(notification: INotification): void;
18
+ private documentClick;
19
+ static ɵfac: i0.ɵɵFactoryDeclaration<NotificationsComponent, never>;
20
+ static ɵcmp: i0.ɵɵComponentDeclaration<NotificationsComponent, "shared-notifications", never, {}, {}, never, never, true, never>;
21
+ }
@@ -0,0 +1,9 @@
1
+ import { EventEmitter } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export declare class TopBarComponent {
4
+ /** Emitted when the logout button is clicked. */
5
+ logout: EventEmitter<void>;
6
+ onLogoutClick(): void;
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<TopBarComponent, never>;
8
+ static ɵcmp: i0.ɵɵComponentDeclaration<TopBarComponent, "shared-top-bar", never, {}, { "logout": "logout"; }, never, never, true, never>;
9
+ }
@@ -0,0 +1,15 @@
1
+ import { OnInit } from '@angular/core';
2
+ import { ICurrentUserInfo } from '../../../models';
3
+ import * as i0 from "@angular/core";
4
+ export declare class UserProfileComponent implements OnInit {
5
+ private authenticationService;
6
+ protected user: ICurrentUserInfo | null;
7
+ /** Up to two uppercase initials derived from the user's name, used when no picture is set. */
8
+ protected get initials(): string;
9
+ protected get name(): string;
10
+ protected get pictureUrl(): string | undefined;
11
+ protected get position(): string;
12
+ ngOnInit(): void;
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<UserProfileComponent, never>;
14
+ static ɵcmp: i0.ɵɵComponentDeclaration<UserProfileComponent, "shared-user-profile", never, {}, {}, never, never, true, never>;
15
+ }
@@ -1,4 +1,8 @@
1
1
  export interface ICurrentUserInfo {
2
2
  costCenterName: string;
3
3
  name: string;
4
+ /** Optional avatar image URL. Falls back to initials when absent. */
5
+ pictureUrl?: string;
6
+ /** Optional job position/title shown under the user name. Line is hidden when absent. */
7
+ position?: string;
4
8
  }
@@ -1,4 +1,5 @@
1
1
  export * from './auth-response';
2
2
  export * from './current-user-info';
3
+ export * from './notification';
3
4
  export * from './operations-history';
4
5
  export * from './services-history';
@@ -0,0 +1,12 @@
1
+ export interface INotification {
2
+ /** Short heading for the notification. */
3
+ title: string;
4
+ /** Longer descriptive text. */
5
+ description: string;
6
+ /** Icon class shown next to the notification (e.g. a Font Awesome class like `fa-solid fa-envelope`). */
7
+ icon: string;
8
+ /** Optional call-to-action URL. When present, clicking the notification navigates to it. */
9
+ callToActionUrl?: string;
10
+ /** Whether the notification has been read. */
11
+ isRead: boolean;
12
+ }
@@ -1,3 +1,4 @@
1
1
  export { AuthenticationService } from './authentication.service';
2
+ export { NotificationsService } from './notifications.service';
2
3
  export { OperationsHistoryService } from './operations-history.service';
3
4
  export { ServicesHistoryService } from './services-history.service';
@@ -0,0 +1,33 @@
1
+ import { Observable } from 'rxjs';
2
+ import { INotification } from '../models';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Streams top-bar notifications from a SignalR hub.
6
+ *
7
+ * The hub is configured via `AppConfig.notificationsEnabled` and `AppConfig.notificationsUrl`.
8
+ * When enabled, {@link start} opens a connection (authenticated with the current JWT) and
9
+ * listens for the server to push the notification list via the `ReceiveNotifications` client
10
+ * method. Consuming apps do not interact with this service directly — the top bar drives it.
11
+ */
12
+ export declare class NotificationsService {
13
+ private authService;
14
+ private config;
15
+ private connection?;
16
+ private notifications$;
17
+ /** Whether the notifications feature is enabled (toggled on and given a hub URL). */
18
+ get isEnabled(): boolean;
19
+ /** Emits the current list of notifications. */
20
+ getNotifications(): Observable<INotification[]>;
21
+ /** Emits the number of unread notifications. */
22
+ getUnreadCount(): Observable<number>;
23
+ /** Marks every notification as read and notifies the hub. */
24
+ markAllAsRead(): void;
25
+ /** Marks a single notification as read (optimistically; the server reconciles on the next push). */
26
+ markAsRead(notification: INotification): void;
27
+ /** Opens the SignalR connection and starts receiving notifications. Idempotent and a no-op when disabled. */
28
+ start(): void;
29
+ /** Closes the SignalR connection. */
30
+ stop(): Promise<void>;
31
+ static ɵfac: i0.ɵɵFactoryDeclaration<NotificationsService, never>;
32
+ static ɵprov: i0.ɵɵInjectableDeclaration<NotificationsService>;
33
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zambon-dev/shared",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "Shared Angular services, utilities, and styles for Zambon applications.",
5
5
  "keywords": [
6
6
  "angular",
@@ -27,9 +27,11 @@
27
27
  "@angular/forms": "^19.1.0",
28
28
  "@angular/router": "^19.1.0",
29
29
  "@auth0/angular-jwt": "^5.2.0",
30
+ "@microsoft/signalr": "^10.0.0",
30
31
  "@zambon-dev/framework": "^1.0.0",
31
32
  "@zambon-dev/library": "^1.0.0",
32
- "@ngx-translate/core": "^16.0.4"
33
+ "@ngx-translate/core": "^16.0.4",
34
+ "ngx-translate-multi-http-loader": "^19.0.2"
33
35
  },
34
36
  "publishConfig": {
35
37
  "access": "public"
@@ -38,9 +40,35 @@
38
40
  "**/*.scss"
39
41
  ],
40
42
  "style": "styles/common.scss",
41
- "module": "fesm2022/zambon-dev-shared.mjs",
42
- "typings": "index.d.ts",
43
43
  "exports": {
44
+ "./styles": {
45
+ "sass": "./styles/common.scss",
46
+ "style": "./styles/common.scss",
47
+ "default": "./styles/common.scss"
48
+ },
49
+ "./styles/common": {
50
+ "sass": "./styles/common.scss",
51
+ "style": "./styles/common.scss",
52
+ "default": "./styles/common.scss"
53
+ },
54
+ "./styles/common.scss": {
55
+ "sass": "./styles/common.scss",
56
+ "style": "./styles/common.scss",
57
+ "default": "./styles/common.scss"
58
+ },
59
+ "./styles/variables": {
60
+ "sass": "./styles/variables.scss",
61
+ "style": "./styles/variables.scss",
62
+ "default": "./styles/variables.scss"
63
+ },
64
+ "./styles/variables.scss": {
65
+ "sass": "./styles/variables.scss",
66
+ "style": "./styles/variables.scss",
67
+ "default": "./styles/variables.scss"
68
+ },
69
+ "./i18n/*": {
70
+ "default": "./i18n/*"
71
+ },
44
72
  "./package.json": {
45
73
  "default": "./package.json"
46
74
  },
@@ -49,6 +77,8 @@
49
77
  "default": "./fesm2022/zambon-dev-shared.mjs"
50
78
  }
51
79
  },
80
+ "module": "fesm2022/zambon-dev-shared.mjs",
81
+ "typings": "index.d.ts",
52
82
  "dependencies": {
53
83
  "tslib": "^2.3.0"
54
84
  }
@@ -2,6 +2,7 @@
2
2
  @tailwind components;
3
3
  @tailwind utilities;
4
4
 
5
+ @import 'variables';
5
6
  @import 'components/button';
6
7
  @import 'components/card';
7
8
  @import 'components/dropdown-static';
@@ -0,0 +1,9 @@
1
+ :root {
2
+ --sidebar-animation-duration: 600ms;
3
+ --sidebar-collapsed-width: 70px;
4
+ --sidebar-expanded-width: 220px;
5
+ --sidebar-icon-collapsed-margin: 10px;
6
+ --sidebar-item-height: 2.75rem;
7
+ --sidebar-logo-height: 50px;
8
+ --sidebar-picture-size: 50px;
9
+ }