@cccteam/ccc-lib 0.0.10 → 0.0.12

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.
Files changed (96) hide show
  1. package/fesm2022/cccteam-ccc-lib-src-auth-authentication-guard.mjs +44 -0
  2. package/fesm2022/cccteam-ccc-lib-src-auth-authentication-guard.mjs.map +1 -0
  3. package/fesm2022/cccteam-ccc-lib-src-auth-authorization-guard.mjs +24 -0
  4. package/fesm2022/cccteam-ccc-lib-src-auth-authorization-guard.mjs.map +1 -0
  5. package/fesm2022/cccteam-ccc-lib-src-auth-forms.mjs +118 -0
  6. package/fesm2022/cccteam-ccc-lib-src-auth-forms.mjs.map +1 -0
  7. package/fesm2022/cccteam-ccc-lib-src-auth-has-permission.mjs +51 -0
  8. package/fesm2022/cccteam-ccc-lib-src-auth-has-permission.mjs.map +1 -0
  9. package/fesm2022/cccteam-ccc-lib-src-auth-service.mjs +56 -0
  10. package/fesm2022/cccteam-ccc-lib-src-auth-service.mjs.map +1 -0
  11. package/fesm2022/cccteam-ccc-lib-src-auth-state.mjs +109 -0
  12. package/fesm2022/cccteam-ccc-lib-src-auth-state.mjs.map +1 -0
  13. package/fesm2022/cccteam-ccc-lib-src-types.mjs +137 -0
  14. package/fesm2022/cccteam-ccc-lib-src-types.mjs.map +1 -0
  15. package/fesm2022/cccteam-ccc-lib-src-ui-alert.mjs +48 -0
  16. package/fesm2022/cccteam-ccc-lib-src-ui-alert.mjs.map +1 -0
  17. package/fesm2022/cccteam-ccc-lib-src-ui-core-state.mjs +100 -0
  18. package/fesm2022/cccteam-ccc-lib-src-ui-core-state.mjs.map +1 -0
  19. package/fesm2022/cccteam-ccc-lib-src-ui-interceptor.mjs +48 -0
  20. package/fesm2022/cccteam-ccc-lib-src-ui-interceptor.mjs.map +1 -0
  21. package/fesm2022/cccteam-ccc-lib-src-ui-notification-service.mjs +57 -0
  22. package/fesm2022/cccteam-ccc-lib-src-ui-notification-service.mjs.map +1 -0
  23. package/{esm2022/lib/ui/components/sidenav/sidenav.component.mjs → fesm2022/cccteam-ccc-lib-src-ui-sidenav.mjs} +20 -13
  24. package/fesm2022/cccteam-ccc-lib-src-ui-sidenav.mjs.map +1 -0
  25. package/fesm2022/cccteam-ccc-lib-src-util-request-options.mjs +19 -0
  26. package/fesm2022/cccteam-ccc-lib-src-util-request-options.mjs.map +1 -0
  27. package/fesm2022/cccteam-ccc-lib.mjs +13 -729
  28. package/fesm2022/cccteam-ccc-lib.mjs.map +1 -1
  29. package/package.json +55 -5
  30. package/public-api.d.ts +13 -19
  31. package/src/auth-authentication-guard/index.d.ts +5 -0
  32. package/src/auth-authentication-guard/public-api.d.ts +1 -0
  33. package/src/auth-authorization-guard/index.d.ts +5 -0
  34. package/src/auth-authorization-guard/public-api.d.ts +1 -0
  35. package/{lib/auth/forms → src/auth-forms}/ccc-field/ccc-field.component.d.ts +1 -1
  36. package/src/auth-forms/index.d.ts +5 -0
  37. package/src/auth-forms/public-api.d.ts +2 -0
  38. package/{lib/auth/directives → src/auth-has-permission}/has-permission.directive.d.ts +1 -1
  39. package/src/auth-has-permission/index.d.ts +5 -0
  40. package/src/auth-has-permission/public-api.d.ts +1 -0
  41. package/{lib/auth/services → src/auth-service}/auth.service.d.ts +1 -1
  42. package/src/auth-service/index.d.ts +5 -0
  43. package/src/auth-service/public-api.d.ts +1 -0
  44. package/{lib/auth/state → src/auth-state}/auth.state.d.ts +1 -2
  45. package/src/auth-state/index.d.ts +5 -0
  46. package/src/auth-state/public-api.d.ts +1 -0
  47. package/{lib/auth/state → src/types}/auth.actions.d.ts +1 -1
  48. package/{lib/ui/state → src/types}/core.actions.d.ts +1 -1
  49. package/src/types/index.d.ts +5 -0
  50. package/src/types/public-api.d.ts +6 -0
  51. package/{lib/types/base → src/types}/tokens.d.ts +1 -1
  52. package/{lib/ui/components/alert → src/ui-alert}/alert.component.d.ts +2 -2
  53. package/src/ui-alert/index.d.ts +5 -0
  54. package/src/ui-alert/public-api.d.ts +1 -0
  55. package/{lib/ui/state → src/ui-core-state}/core.state.d.ts +1 -2
  56. package/src/ui-core-state/index.d.ts +5 -0
  57. package/src/ui-core-state/public-api.d.ts +1 -0
  58. package/src/ui-interceptor/index.d.ts +5 -0
  59. package/src/ui-interceptor/public-api.d.ts +1 -0
  60. package/src/ui-notification-service/index.d.ts +5 -0
  61. package/{lib/ui/services → src/ui-notification-service}/notification.service.d.ts +1 -1
  62. package/src/ui-notification-service/public-api.d.ts +1 -0
  63. package/src/ui-sidenav/index.d.ts +5 -0
  64. package/src/ui-sidenav/public-api.d.ts +1 -0
  65. package/{lib/ui/components/sidenav → src/ui-sidenav}/sidenav.component.d.ts +1 -1
  66. package/src/util-request-options/index.d.ts +5 -0
  67. package/src/util-request-options/public-api.d.ts +1 -0
  68. package/cccteam-ccc-lib-0.0.10.tgz +0 -0
  69. package/esm2022/cccteam-ccc-lib.mjs +0 -5
  70. package/esm2022/lib/auth/directives/has-permission.directive.mjs +0 -44
  71. package/esm2022/lib/auth/forms/ccc-field/ccc-field.component.mjs +0 -77
  72. package/esm2022/lib/auth/forms/form-helpers.mjs +0 -34
  73. package/esm2022/lib/auth/guards/authentication.guard.mjs +0 -38
  74. package/esm2022/lib/auth/guards/authorization.guard.mjs +0 -17
  75. package/esm2022/lib/auth/services/auth.service.mjs +0 -49
  76. package/esm2022/lib/auth/services/request-options.mjs +0 -12
  77. package/esm2022/lib/auth/state/auth.actions.mjs +0 -64
  78. package/esm2022/lib/auth/state/auth.state.mjs +0 -105
  79. package/esm2022/lib/types/base/tokens.mjs +0 -7
  80. package/esm2022/lib/types/notification-message.mjs +0 -7
  81. package/esm2022/lib/types/permissions.mjs +0 -3
  82. package/esm2022/lib/types/session-info.mjs +0 -2
  83. package/esm2022/lib/ui/components/alert/alert.component.mjs +0 -41
  84. package/esm2022/lib/ui/interceptor/api.interceptor.mjs +0 -43
  85. package/esm2022/lib/ui/services/notification.service.mjs +0 -50
  86. package/esm2022/lib/ui/state/core.actions.mjs +0 -49
  87. package/esm2022/lib/ui/state/core.state.mjs +0 -95
  88. package/esm2022/public-api.mjs +0 -34
  89. /package/{lib/auth/guards → src/auth-authentication-guard}/authentication.guard.d.ts +0 -0
  90. /package/{lib/auth/guards → src/auth-authorization-guard}/authorization.guard.d.ts +0 -0
  91. /package/{lib/auth/forms → src/auth-forms}/form-helpers.d.ts +0 -0
  92. /package/{lib → src}/types/notification-message.d.ts +0 -0
  93. /package/{lib → src}/types/permissions.d.ts +0 -0
  94. /package/{lib → src}/types/session-info.d.ts +0 -0
  95. /package/{lib/ui/interceptor → src/ui-interceptor}/api.interceptor.d.ts +0 -0
  96. /package/{lib/auth/services → src/util-request-options}/request-options.d.ts +0 -0
@@ -1,730 +1,16 @@
1
- import * as i0 from '@angular/core';
2
- import { InjectionToken, Injectable, Inject, inject, TemplateRef, ViewContainerRef, Directive, Input, input, signal, computed, Component, EventEmitter, Output, DestroyRef, NgZone } from '@angular/core';
3
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
4
- import { Action, Selector, State, Store } from '@ngxs/store';
5
- import { map, tap, Subject, combineLatest, catchError, of, throwError, finalize } from 'rxjs';
6
- import { __decorate } from 'tslib';
7
- import { patch } from '@ngxs/store/operators';
8
- import { cloneDeep, isEqual } from 'lodash-es';
9
- import * as i1 from '@angular/common/http';
10
- import { HttpContextToken, HttpContext } from '@angular/common/http';
11
- import * as i1$1 from '@angular/material/form-field';
12
- import { MatFormFieldModule } from '@angular/material/form-field';
13
- import * as i2 from '@angular/material/input';
14
- import { MatInputModule } from '@angular/material/input';
15
- import { switchMap, map as map$1, catchError as catchError$1 } from 'rxjs/operators';
16
- import * as i2$2 from '@angular/router';
17
- import { Router, RouterModule } from '@angular/router';
18
- import * as i3 from '@angular/common';
19
- import { CommonModule } from '@angular/common';
20
- import * as i2$1 from '@angular/material/button';
21
- import { MatButtonModule } from '@angular/material/button';
22
- import * as i1$2 from '@angular/material/icon';
23
- import { MatIconModule } from '@angular/material/icon';
24
- import { MatExpansionModule } from '@angular/material/expansion';
25
- import { MatSidenavModule } from '@angular/material/sidenav';
26
-
27
- const BASE_URL = new InjectionToken('BASE_URL');
28
- const API_URL = new InjectionToken('API_URL');
29
- const PERMISSION_REQUIRED = new InjectionToken('PERMISSION_REQUIRED');
30
- const AVAILABLE_PERMISSIONS = new InjectionToken('AVAILABLE_PERMISSIONS');
31
- const AVAILABLE_DOMAINS = new InjectionToken('AVAILABLE_DOMAINS');
32
-
33
- /* eslint-disable @typescript-eslint/no-namespace */
34
- // no-namespace rule is disabled because action hygiene prevents import pollution
35
- var ApiInterceptorAction;
36
- (function (ApiInterceptorAction) {
37
- class BeginActivity {
38
- process;
39
- static type = '[ApiInterceptor] Add Loading Activity';
40
- constructor(process) {
41
- this.process = process;
42
- }
43
- }
44
- ApiInterceptorAction.BeginActivity = BeginActivity;
45
- class EndActivity {
46
- process;
47
- static type = '[ApiInterceptor] Remove Loading Activity';
48
- constructor(process) {
49
- this.process = process;
50
- }
51
- }
52
- ApiInterceptorAction.EndActivity = EndActivity;
53
- class PublishError {
54
- message;
55
- static type = '[ApiInterceptor] Publish Error';
56
- constructor(message) {
57
- this.message = message;
58
- }
59
- }
60
- ApiInterceptorAction.PublishError = PublishError;
61
- class SetRedirectUrl {
62
- redirectUrl;
63
- static type = '[ApiInterceptor] Set Redirect Url';
64
- constructor(redirectUrl) {
65
- this.redirectUrl = redirectUrl;
66
- }
67
- }
68
- ApiInterceptorAction.SetRedirectUrl = SetRedirectUrl;
69
- })(ApiInterceptorAction || (ApiInterceptorAction = {}));
70
- var HeaderAction;
71
- (function (HeaderAction) {
72
- class ToggleSidenav {
73
- static type = '[Header] Toggle Sidenav';
74
- }
75
- HeaderAction.ToggleSidenav = ToggleSidenav;
76
- class Logout {
77
- static type = '[Header] User Logout';
78
- }
79
- HeaderAction.Logout = Logout;
80
- })(HeaderAction || (HeaderAction = {}));
81
-
82
- const CUSTOM_HTTP_REQUEST_OPTIONS = new HttpContextToken(() => ({
83
- suppressGlobalError: false,
84
- }));
85
- function errorOptions(suppressGlobalError) {
86
- return {
87
- context: new HttpContext().set(CUSTOM_HTTP_REQUEST_OPTIONS, {
88
- suppressGlobalError: suppressGlobalError ?? false,
89
- }),
90
- };
91
- }
92
-
93
- const routes = {
94
- login: (rootUrl) => `${rootUrl}/user/login`,
95
- session: (rootUrl) => `${rootUrl}/user/session`,
96
- };
97
- class AuthService {
98
- http;
99
- apiUrl;
100
- constructor(http, apiUrl) {
101
- this.http = http;
102
- this.apiUrl = apiUrl;
103
- }
104
- /**
105
- * Logs a user out.
106
- *
107
- * @returns Observable with a boolean indicating whether they were logged out.
108
- */
109
- logout() {
110
- return this.http.delete(routes.session(this.apiUrl), errorOptions(false)).pipe(map(() => true));
111
- }
112
- /**
113
- * Checks a user's session with the server.
114
- *
115
- * @returns Observable with the user session info
116
- */
117
- checkUserSession() {
118
- return this.http.get(routes.session(this.apiUrl), errorOptions(false));
119
- }
120
- loginRoute() {
121
- return routes.login(this.apiUrl);
122
- }
123
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: AuthService, deps: [{ token: i1.HttpClient }, { token: API_URL }], target: i0.ɵɵFactoryTarget.Injectable });
124
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: AuthService, providedIn: 'root' });
125
- }
126
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: AuthService, decorators: [{
127
- type: Injectable,
128
- args: [{
129
- providedIn: 'root',
130
- }]
131
- }], ctorParameters: () => [{ type: i1.HttpClient }, { type: undefined, decorators: [{
132
- type: Inject,
133
- args: [API_URL]
134
- }] }] });
135
-
136
- /* eslint-disable @typescript-eslint/no-namespace */
137
- // no-namespace rule is disabled because action hygiene prevents import pollution
138
- var AuthenticationGuardAction;
139
- (function (AuthenticationGuardAction) {
140
- class SetRedirectUrl {
141
- redirectUrl;
142
- static type = '[AuthenticationGuard] Set Redirect Url And Navigate To Login Page';
143
- constructor(redirectUrl) {
144
- this.redirectUrl = redirectUrl;
145
- }
146
- }
147
- AuthenticationGuardAction.SetRedirectUrl = SetRedirectUrl;
148
- class CheckUserSession {
149
- static type = '[AuthenticationGuard] Check User Session';
150
- }
151
- AuthenticationGuardAction.CheckUserSession = CheckUserSession;
152
- })(AuthenticationGuardAction || (AuthenticationGuardAction = {}));
153
- var LoginAction;
154
- (function (LoginAction) {
155
- class Logout {
156
- static type = '[Login] Auto Logout';
157
- }
158
- LoginAction.Logout = Logout;
159
- class SetRedirectUrl {
160
- redirectUrl;
161
- static type = '[Login] Set Redirect Url';
162
- constructor(redirectUrl) {
163
- this.redirectUrl = redirectUrl;
164
- }
165
- }
166
- LoginAction.SetRedirectUrl = SetRedirectUrl;
167
- class PublishError {
168
- message;
169
- static type = '[Login] Publish Error';
170
- constructor(message) {
171
- this.message = message;
172
- }
173
- }
174
- LoginAction.PublishError = PublishError;
175
- })(LoginAction || (LoginAction = {}));
176
- var AppAction;
177
- (function (AppAction) {
178
- class CheckUserSession {
179
- static type = '[App] Check User Session';
180
- }
181
- AppAction.CheckUserSession = CheckUserSession;
182
- class SetRedirectUrl {
183
- redirectUrl;
184
- static type = '[App] Set Redirect Url';
185
- constructor(redirectUrl) {
186
- this.redirectUrl = redirectUrl;
187
- }
188
- }
189
- AppAction.SetRedirectUrl = SetRedirectUrl;
190
- class SetNavIdentifier {
191
- identifier;
192
- static type = '[App] Set Nav Identifier';
193
- constructor(identifier) {
194
- this.identifier = identifier;
195
- }
196
- }
197
- AppAction.SetNavIdentifier = SetNavIdentifier;
198
- })(AppAction || (AppAction = {}));
199
-
200
- var AuthState_1;
201
- const initState$1 = {
202
- authenticated: false,
203
- redirectUrl: '',
204
- sessionInfo: null,
205
- };
206
- let AuthState = class AuthState {
207
- static { AuthState_1 = this; }
208
- authService = inject(AuthService);
209
- static permissionFn;
210
- constructor() {
211
- AuthState_1.initializePermissionFn();
212
- }
213
- static initializePermissionFn() {
214
- if (!AuthState_1.permissionFn) {
215
- AuthState_1.permissionFn = inject(PERMISSION_REQUIRED);
216
- }
217
- }
218
- static hasPermission(state) {
219
- return (scope) => {
220
- if (!scope)
221
- return true;
222
- const resourcePermissions = state?.sessionInfo?.permissions?.[scope.domain]?.[scope.resource];
223
- return Array.isArray(resourcePermissions) && resourcePermissions.includes(scope.permission);
224
- };
225
- }
226
- static requiresPermission(resource, permission) {
227
- if (!AuthState_1.permissionFn) {
228
- throw new Error(`AuthState has not been initialized. Ensure AuthState is provided in your module or instantiated at least once.`);
229
- }
230
- return AuthState_1.permissionFn(resource, permission);
231
- }
232
- static isAuthenticated(state) {
233
- return state?.authenticated;
234
- }
235
- static redirectUrl(state) {
236
- return state?.redirectUrl;
237
- }
238
- checkUserSession(ctx) {
239
- return this.authService.checkUserSession().pipe(tap((result) => ctx.setState(patch({
240
- authenticated: !!result?.authenticated,
241
- sessionInfo: result,
242
- }))));
243
- }
244
- logout(ctx) {
245
- const localStateCopy = cloneDeep(initState$1);
246
- localStateCopy.redirectUrl = ctx.getState().redirectUrl;
247
- return this.authService.logout().pipe(tap(() => {
248
- ctx.setState(localStateCopy);
249
- }));
250
- }
251
- setRedirectUrl(ctx, action) {
252
- ctx.setState(patch({
253
- redirectUrl: action.redirectUrl,
254
- }));
255
- return ctx.getState();
256
- }
257
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: AuthState, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
258
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: AuthState });
259
- };
260
- __decorate([
261
- Action([AppAction.CheckUserSession, AuthenticationGuardAction.CheckUserSession])
262
- ], AuthState.prototype, "checkUserSession", null);
263
- __decorate([
264
- Action([LoginAction.Logout])
265
- ], AuthState.prototype, "logout", null);
266
- __decorate([
267
- Action([
268
- AppAction.SetRedirectUrl,
269
- LoginAction.SetRedirectUrl,
270
- AuthenticationGuardAction.SetRedirectUrl,
271
- ApiInterceptorAction.SetRedirectUrl,
272
- ])
273
- ], AuthState.prototype, "setRedirectUrl", null);
274
- __decorate([
275
- Selector()
276
- ], AuthState, "hasPermission", null);
277
- __decorate([
278
- Selector()
279
- ], AuthState, "isAuthenticated", null);
280
- __decorate([
281
- Selector()
282
- ], AuthState, "redirectUrl", null);
283
- AuthState = AuthState_1 = __decorate([
284
- State({
285
- name: 'authState',
286
- defaults: initState$1,
287
- })
288
- ], AuthState);
289
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: AuthState, decorators: [{
290
- type: Injectable
291
- }], ctorParameters: () => [], propDecorators: { checkUserSession: [], logout: [], setRedirectUrl: [] } });
292
-
293
- class HasPermissionDirective {
294
- templateRef = inject((TemplateRef));
295
- viewContainer = inject(ViewContainerRef);
296
- store = inject(Store);
297
- scope = new Subject();
298
- set cccHasPermission(scope) {
299
- this.scope.next(scope);
300
- }
301
- constructor() {
302
- combineLatest({
303
- permissionFn: this.store.select(AuthState.hasPermission),
304
- scope: this.scope.asObservable(),
305
- })
306
- .pipe(takeUntilDestroyed(), map(({ permissionFn, scope }) => (scope !== undefined ? permissionFn(scope) : true)), catchError(() => of(false)))
307
- .subscribe((result) => {
308
- if (result) {
309
- if (!this.viewContainer.get(0)) {
310
- this.viewContainer.createEmbeddedView(this.templateRef);
311
- }
312
- }
313
- else {
314
- this.viewContainer.clear();
315
- }
316
- });
317
- }
318
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: HasPermissionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
319
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: HasPermissionDirective, isStandalone: true, selector: "[cccHasPermission]", inputs: { cccHasPermission: "cccHasPermission" }, ngImport: i0 });
320
- }
321
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: HasPermissionDirective, decorators: [{
322
- type: Directive,
323
- args: [{
324
- selector: '[cccHasPermission]',
325
- standalone: true,
326
- }]
327
- }], ctorParameters: () => [], propDecorators: { cccHasPermission: [{
328
- type: Input
329
- }] } });
330
-
331
- const ReadPermission = 'Read';
332
- const UpdatePermission = 'Update';
333
-
334
- var InputMode;
335
- (function (InputMode) {
336
- InputMode["Read"] = "read";
337
- InputMode["Edit"] = "edit";
338
- })(InputMode || (InputMode = {}));
339
- class CccInputFieldComponent {
340
- store = inject(Store);
341
- className = input();
342
- mode = input.required();
343
- resource = input.required();
344
- domain = input.required();
345
- value = input.required();
346
- name = input.required();
347
- inputMode = InputMode;
348
- canEdit = signal(false);
349
- canEditSelector = false;
350
- canRead = signal(false);
351
- canReadSelector = false;
352
- ngOnInit() {
353
- this.canEditSelector = this.store.selectSnapshot(AuthState.hasPermission)({
354
- resource: this.resource(),
355
- permission: ReadPermission,
356
- domain: this.domain(),
357
- });
358
- this.canReadSelector = this.store.selectSnapshot(AuthState.hasPermission)({
359
- resource: this.resource(),
360
- permission: UpdatePermission,
361
- domain: this.domain(),
362
- });
363
- this.canRead = computed(() => {
364
- const res = this.resource();
365
- if (!res) {
366
- return false;
367
- }
368
- if (AuthState.requiresPermission(this.resource(), ReadPermission)) {
369
- return this.canReadSelector;
370
- }
371
- return false;
372
- });
373
- this.canEdit = computed(() => {
374
- const res = this.resource();
375
- if (!res) {
376
- return false;
377
- }
378
- if (AuthState.requiresPermission(this.resource(), UpdatePermission)) {
379
- return this.canEditSelector;
380
- }
381
- return false;
382
- });
383
- }
384
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: CccInputFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
385
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.7", type: CccInputFieldComponent, isStandalone: true, selector: "ccc-input-field", inputs: { className: { classPropertyName: "className", publicName: "className", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: true, transformFunction: null }, resource: { classPropertyName: "resource", publicName: "resource", isSignal: true, isRequired: true, transformFunction: null }, domain: { classPropertyName: "domain", publicName: "domain", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
386
- <mat-form-field [class]="className()">
387
- <mat-label>{{ name() }}</mat-label>
388
- <input matInput [disabled]="mode() === inputMode.Edit && canEdit()" [value]="value()" />
389
- </mat-form-field>
390
- `, isInline: true, styles: [""], dependencies: [{ kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }] });
391
- }
392
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: CccInputFieldComponent, decorators: [{
393
- type: Component,
394
- args: [{ selector: 'ccc-input-field', standalone: true, imports: [MatFormFieldModule, MatInputModule], template: `
395
- <mat-form-field [class]="className()">
396
- <mat-label>{{ name() }}</mat-label>
397
- <input matInput [disabled]="mode() === inputMode.Edit && canEdit()" [value]="value()" />
398
- </mat-form-field>
399
- ` }]
400
- }] });
401
-
402
- /**
403
- * Accepts a FormGroup and compares it to an object to return the dirty form values
404
- * as a sparse object
405
- * @param form - FormGroup
406
- * @param compareData - object to compare form values against
407
- * @returns Partial<T>
408
- * @example sparseFormData<UserCreate>(this.userForm, initUser)
409
- */
410
- function sparseFormData(form, compareData) {
411
- const sparseFormData = {};
412
- for (const [key, control] of Object.entries(form.controls)) {
413
- const controlValue = control.value;
414
- const compareValue = compareData[key];
415
- if (!isEqual(controlValue, compareValue)) {
416
- sparseFormData[key] = controlValue;
417
- }
418
- }
419
- return sparseFormData;
420
- }
421
- /**
422
- * Accepts a FormArray and removes empty strings
423
- * @param formArray - FormArray
424
- * @returns FormArray
425
- */
426
- function cleanStringFormArray(formArray) {
427
- for (let i = formArray.controls.length - 1; i >= 0; i--) {
428
- if (formArray.at(i).value === '') {
429
- formArray.removeAt(i);
430
- }
431
- }
432
- return formArray;
433
- }
434
-
435
- const AuthenticationGuard = (route, routerState) => {
436
- const store = inject(Store);
437
- const authService = inject(AuthService);
438
- const baseUrl = inject(BASE_URL);
439
- const authenticate = () => {
440
- const url = routerState.url;
441
- const absoluteUrl = baseUrl + (!url.toString().startsWith('/') ? '/' + url : url);
442
- const encodedUrl = encodeURIComponent(absoluteUrl);
443
- window.location.href = `${authService.loginRoute()}?returnUrl=${encodedUrl}`;
444
- };
445
- return store.select(AuthState.isAuthenticated).pipe(switchMap((authenticated) => {
446
- if (authenticated) {
447
- return of(authenticated);
448
- }
449
- // Handle uninitialized state (ie Browser reload)
450
- return store.dispatch(AuthenticationGuardAction.CheckUserSession).pipe(switchMap(() => {
451
- return store.select(AuthState.isAuthenticated);
452
- }));
453
- }), map$1((authenticated) => {
454
- if (authenticated) {
455
- return true;
456
- }
457
- authenticate();
458
- return false;
459
- }), catchError$1(() => {
460
- authenticate();
461
- return of(false);
462
- }));
463
- };
464
-
465
- const AuthorizationGuard = (route) => {
466
- const store = inject(Store);
467
- const router = inject(Router);
468
- return store.select(AuthState.hasPermission).pipe(map((permissionFn) => permissionFn(route.data['scope'])), map((hasPermission) => {
469
- if (hasPermission) {
470
- return true;
471
- }
472
- router.navigate(['/']);
473
- return false;
474
- }));
475
- };
476
-
477
- var AlertLevel;
478
- (function (AlertLevel) {
479
- AlertLevel["ERROR"] = "warn";
480
- AlertLevel["INFO"] = "accent";
481
- AlertLevel["SUCCESS"] = "success";
482
- })(AlertLevel || (AlertLevel = {}));
483
-
484
- class NotificationService {
485
- notificationId = 0;
486
- _notifications = signal([]);
487
- notifications = this._notifications.asReadonly();
488
- /**
489
- * Adds a new global notification.
490
- * @param notification The notification message to add.
491
- * @returns The unique ID assigned to the notification.
492
- */
493
- addGlobalNotification(notification) {
494
- const newNotification = {
495
- ...notification,
496
- id: this.notificationId++,
497
- };
498
- this._notifications.update((current) => [...current, newNotification]);
499
- return newNotification.id;
500
- }
501
- /**
502
- * Dismisses a global notification by its ID.
503
- * @param notificationId The ID of the notification to dismiss.
504
- */
505
- dismissGlobalNotificationById(notificationId) {
506
- this._notifications.update((current) => current.filter((notification) => notification.id !== notificationId));
507
- }
508
- /**
509
- * Dismisses a specific global notification.
510
- * @param notification The notification to dismiss.
511
- */
512
- dismissGlobalNotification(notification) {
513
- this.dismissGlobalNotificationById(notification.id);
514
- }
515
- /**
516
- * Updates an existing notification.
517
- * @param updatedNotification The notification with updated information.
518
- */
519
- updateNotification(updatedNotification) {
520
- this._notifications.update((current) => current.map((notification) => notification.id === updatedNotification.id ? { ...notification, ...updatedNotification } : notification));
521
- }
522
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: NotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
523
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: NotificationService, providedIn: 'root' });
524
- }
525
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: NotificationService, decorators: [{
526
- type: Injectable,
527
- args: [{
528
- providedIn: 'root',
529
- }]
530
- }] });
531
-
532
- class AlertComponent {
533
- error;
534
- dismiss = new EventEmitter();
535
- errors = inject(NotificationService);
536
- ngOnInit() {
537
- if (this.error.duration === undefined) {
538
- this.error.duration = 30000;
539
- }
540
- setTimeout(() => {
541
- this.dismissAlert();
542
- }, this.error.duration);
543
- }
544
- dismissAlert() {
545
- if (this.error.id !== undefined) {
546
- this.errors.dismissGlobalNotification(this.error);
547
- }
548
- }
549
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: AlertComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
550
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.7", type: AlertComponent, isStandalone: true, selector: "ccc-alert", inputs: { error: "error" }, outputs: { dismiss: "dismiss" }, ngImport: i0, template: "<div class=\"alert\" [ngClass]=\"error.level\">\n <div class=\"message\">\n <span>{{ error.message }}</span>\n </div>\n <div class=\"alert-end\">\n @if (error.link) {\n <span [routerLink]=\"error.link\" class=\"link\">View</span>\n }\n <button (click)=\"dismissAlert()\" mat-icon-button aria-label=\"Close Alert\">\n <mat-icon>close</mat-icon>\n </button>\n </div>\n</div>\n", styles: [".alert{margin:auto;border:1px solid;max-width:450px;border-radius:5px;background-color:#d3d3d3;display:flex;flex-direction:row;align-items:center;justify-content:space-between}.message{padding-left:15px;max-width:400px;display:flex;justify-content:space-between}.alert-end{display:flex;flex-direction:row;align-items:center;gap:5px}.link{cursor:pointer}.link:hover{text-decoration:underline}.warn{border-color:red;background-color:#fff5f4}.accent{border-color:#dfb51d;background-color:#fff8e0}.success{border-color:#4caf50;background-color:#f0fff0}\n"], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i2$2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }] });
551
- }
552
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: AlertComponent, decorators: [{
553
- type: Component,
554
- args: [{ selector: 'ccc-alert', standalone: true, imports: [MatIconModule, MatButtonModule, CommonModule, RouterModule], template: "<div class=\"alert\" [ngClass]=\"error.level\">\n <div class=\"message\">\n <span>{{ error.message }}</span>\n </div>\n <div class=\"alert-end\">\n @if (error.link) {\n <span [routerLink]=\"error.link\" class=\"link\">View</span>\n }\n <button (click)=\"dismissAlert()\" mat-icon-button aria-label=\"Close Alert\">\n <mat-icon>close</mat-icon>\n </button>\n </div>\n</div>\n", styles: [".alert{margin:auto;border:1px solid;max-width:450px;border-radius:5px;background-color:#d3d3d3;display:flex;flex-direction:row;align-items:center;justify-content:space-between}.message{padding-left:15px;max-width:400px;display:flex;justify-content:space-between}.alert-end{display:flex;flex-direction:row;align-items:center;gap:5px}.link{cursor:pointer}.link:hover{text-decoration:underline}.warn{border-color:red;background-color:#fff5f4}.accent{border-color:#dfb51d;background-color:#fff8e0}.success{border-color:#4caf50;background-color:#f0fff0}\n"] }]
555
- }], propDecorators: { error: [{
556
- type: Input,
557
- args: [{ required: true }]
558
- }], dismiss: [{
559
- type: Output
560
- }] } });
561
-
562
- const initState = {
563
- loading: [],
564
- sidenavOpened: true,
565
- currentSidenavIdentifier: '',
566
- };
567
- let CoreState = class CoreState {
568
- notifications = inject(NotificationService);
569
- static sidenavOpened(state) {
570
- return state?.sidenavOpened;
571
- }
572
- static isLoading(state) {
573
- return state.loading.length > 0;
574
- }
575
- static currentSidenavIdentifier(state) {
576
- return state.currentSidenavIdentifier;
577
- }
578
- setNavIdentifier(ctx, action) {
579
- ctx.setState(patch({
580
- currentSidenavIdentifier: action.identifier,
581
- }));
582
- }
583
- publishError(ctx, action) {
584
- this.notifications.addGlobalNotification(action.message);
585
- }
586
- beginActivity(ctx, action) {
587
- const state = ctx.getState();
588
- ctx.patchState({
589
- loading: [action.process, ...state.loading],
590
- });
591
- return ctx.getState();
592
- }
593
- endActivity(ctx, action) {
594
- const loading = ctx.getState().loading;
595
- // There can be multiple activities running with the same process signature
596
- const index = loading.findIndex((activity) => activity === action.process);
597
- if (index !== -1) {
598
- const newLoading = [...loading.slice(0, index), ...loading.slice(index + 1)];
599
- ctx.patchState({
600
- loading: newLoading,
601
- });
602
- return ctx.getState();
603
- }
604
- return null;
605
- }
606
- toggleSidenav(ctx) {
607
- ctx.setState(patch({
608
- sidenavOpened: !ctx.getState().sidenavOpened,
609
- }));
610
- }
611
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: CoreState, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
612
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: CoreState });
613
- };
614
- __decorate([
615
- Action([AppAction.SetNavIdentifier])
616
- ], CoreState.prototype, "setNavIdentifier", null);
617
- __decorate([
618
- Action([ApiInterceptorAction.PublishError, LoginAction.PublishError])
619
- ], CoreState.prototype, "publishError", null);
620
- __decorate([
621
- Action([ApiInterceptorAction.BeginActivity])
622
- ], CoreState.prototype, "beginActivity", null);
623
- __decorate([
624
- Action([ApiInterceptorAction.EndActivity])
625
- ], CoreState.prototype, "endActivity", null);
626
- __decorate([
627
- Action([HeaderAction.ToggleSidenav])
628
- ], CoreState.prototype, "toggleSidenav", null);
629
- __decorate([
630
- Selector()
631
- ], CoreState, "sidenavOpened", null);
632
- __decorate([
633
- Selector()
634
- ], CoreState, "isLoading", null);
635
- __decorate([
636
- Selector()
637
- ], CoreState, "currentSidenavIdentifier", null);
638
- CoreState = __decorate([
639
- State({
640
- name: 'coreState',
641
- defaults: initState,
642
- })
643
- ], CoreState);
644
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: CoreState, decorators: [{
645
- type: Injectable
646
- }], propDecorators: { setNavIdentifier: [], publishError: [], beginActivity: [], endActivity: [], toggleSidenav: [] } });
647
-
648
- class SidenavComponent {
649
- store = inject(Store);
650
- destroyRef = inject(DestroyRef);
651
- navGroups;
652
- currentNav = [];
653
- ngOnInit() {
654
- this.store
655
- .select(CoreState.currentSidenavIdentifier)
656
- .pipe(tap((identifier) => {
657
- this.currentNav = this.updateNavItems(identifier);
658
- }), takeUntilDestroyed(this.destroyRef))
659
- .subscribe();
660
- }
661
- /**
662
- * Updates the currentNav based on the identifier
663
- * @param identifier
664
- * @returns NavItem[]
665
- * @memberof SidenavComponent
666
- */
667
- updateNavItems(identifier) {
668
- if (!this.navGroups) {
669
- return [];
670
- }
671
- if (!this.navGroups[identifier]) {
672
- // pick the first one if the identifier is not found so we don't break the UI
673
- identifier = Object.keys(this.navGroups)[0];
674
- }
675
- return this.navGroups[identifier];
676
- }
677
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: SidenavComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
678
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.7", type: SidenavComponent, isStandalone: true, selector: "ccc-sidenav", inputs: { navGroups: "navGroups" }, ngImport: i0, template: "<div class=\"nav-container\">\n <nav>\n @for (navItem of currentNav; track navItem.label) {\n <ng-container *ngTemplateOutlet=\"typeRendererTemplate; context: { navItem: navItem }\"></ng-container>\n }\n </nav>\n</div>\n<ng-template #typeRendererTemplate let-navItem=\"navItem\">\n @switch (navItem.type) {\n @case ('header') {\n <ng-container [ngTemplateOutlet]=\"headerTemplate\" [ngTemplateOutletContext]=\"{ navItem: navItem }\"></ng-container>\n }\n @case ('link') {\n <ng-container [ngTemplateOutlet]=\"linkTemplate\" [ngTemplateOutletContext]=\"{ navItem: navItem }\"></ng-container>\n }\n @case ('expandable') {\n <ng-container\n [ngTemplateOutlet]=\"expandableTemplate\"\n [ngTemplateOutletContext]=\"{ navItem: navItem }\"></ng-container>\n }\n }\n</ng-template>\n<ng-template #headerTemplate let-navItem=\"navItem\">\n <div class=\"link-header\">{{ navItem.label }}</div>\n</ng-template>\n<ng-template #linkTemplate let-navItem=\"navItem\">\n <a [routerLink]=\"navItem.routerLink\" *cccHasPermission=\"navItem.permission\">\n <div class=\"nav-item\" routerLinkActive=\"active-link\">\n <div class=\"link-button\">\n <div class=\"icon\">\n <mat-icon class=\"material-icons-outlined\" [inline]=\"true\">\n {{ navItem.icon }}\n </mat-icon>\n </div>\n <div class=\"text\">\n {{ navItem.label | titlecase }}\n </div>\n </div>\n </div>\n </a>\n</ng-template>\n<ng-template #expandableTemplate let-navItem=\"navItem\">\n <div class=\"nav-item\" aria-hidden=\"true\" (click)=\"navItem.isExpanded = !navItem.isExpanded\">\n <div class=\"link-button\">\n <div class=\"icon\">\n <mat-icon class=\"material-icons-outlined\" [inline]=\"true\">\n {{ navItem.isExpanded ? 'expand_less' : 'expand_more' }}\n </mat-icon>\n </div>\n <div class=\"text\">{{ navItem.label }}</div>\n </div>\n </div>\n @if (navItem.isExpanded) {\n <div class=\"expandable-links\">\n @for (navItemChild of navItem.children; track navItemChild) {\n <ng-container *ngTemplateOutlet=\"typeRendererTemplate; context: { navItem: navItemChild }\"> </ng-container>\n }\n </div>\n }\n</ng-template>\n", styles: [".nav-container{padding:0;height:100%}nav{max-width:100%;margin:0 10px}.nav-item{width:100%;height:48px;font-size:18px;display:flex;flex-direction:column;justify-content:center;color:#003b49;padding:0 15px;position:relative}.nav-item:hover{background-color:#0000000a;transition:background-color .1s ease}.nav-item:active{background-color:#0000001a;transition:background-color .1s ease}.link-header{color:#003b49;text-transform:uppercase;font-weight:700;font-size:12px;margin:20px 0 0 5px}.link-button{display:flex;flex-direction:row;width:100%}.link-button .icon{min-width:20px;margin-right:10px;display:flex;flex-direction:column;justify-content:center}.link-button .text{margin-right:10px;text-align:left;display:flex;flex-direction:row;justify-content:left;text-decoration:capitalize}.expandable-links{display:flex;flex-direction:column;width:100%;padding-left:30px}a:active,a:link,a:visited{color:#003b49!important}a{text-decoration:none}.active-link:before{content:\"\";position:absolute;left:3px;width:5px;height:38px;background-color:#003b49}.active-link{background-color:#0000000a;position:relative}\n"], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i2$2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i2$2.RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i3.TitleCasePipe, name: "titlecase" }, { kind: "ngmodule", type: MatExpansionModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: MatSidenavModule }, { kind: "directive", type: HasPermissionDirective, selector: "[cccHasPermission]", inputs: ["cccHasPermission"] }] });
679
- }
680
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: SidenavComponent, decorators: [{
681
- type: Component,
682
- args: [{ selector: 'ccc-sidenav', standalone: true, imports: [
683
- MatIconModule,
684
- RouterModule,
685
- CommonModule,
686
- MatExpansionModule,
687
- MatButtonModule,
688
- MatSidenavModule,
689
- HasPermissionDirective,
690
- ], template: "<div class=\"nav-container\">\n <nav>\n @for (navItem of currentNav; track navItem.label) {\n <ng-container *ngTemplateOutlet=\"typeRendererTemplate; context: { navItem: navItem }\"></ng-container>\n }\n </nav>\n</div>\n<ng-template #typeRendererTemplate let-navItem=\"navItem\">\n @switch (navItem.type) {\n @case ('header') {\n <ng-container [ngTemplateOutlet]=\"headerTemplate\" [ngTemplateOutletContext]=\"{ navItem: navItem }\"></ng-container>\n }\n @case ('link') {\n <ng-container [ngTemplateOutlet]=\"linkTemplate\" [ngTemplateOutletContext]=\"{ navItem: navItem }\"></ng-container>\n }\n @case ('expandable') {\n <ng-container\n [ngTemplateOutlet]=\"expandableTemplate\"\n [ngTemplateOutletContext]=\"{ navItem: navItem }\"></ng-container>\n }\n }\n</ng-template>\n<ng-template #headerTemplate let-navItem=\"navItem\">\n <div class=\"link-header\">{{ navItem.label }}</div>\n</ng-template>\n<ng-template #linkTemplate let-navItem=\"navItem\">\n <a [routerLink]=\"navItem.routerLink\" *cccHasPermission=\"navItem.permission\">\n <div class=\"nav-item\" routerLinkActive=\"active-link\">\n <div class=\"link-button\">\n <div class=\"icon\">\n <mat-icon class=\"material-icons-outlined\" [inline]=\"true\">\n {{ navItem.icon }}\n </mat-icon>\n </div>\n <div class=\"text\">\n {{ navItem.label | titlecase }}\n </div>\n </div>\n </div>\n </a>\n</ng-template>\n<ng-template #expandableTemplate let-navItem=\"navItem\">\n <div class=\"nav-item\" aria-hidden=\"true\" (click)=\"navItem.isExpanded = !navItem.isExpanded\">\n <div class=\"link-button\">\n <div class=\"icon\">\n <mat-icon class=\"material-icons-outlined\" [inline]=\"true\">\n {{ navItem.isExpanded ? 'expand_less' : 'expand_more' }}\n </mat-icon>\n </div>\n <div class=\"text\">{{ navItem.label }}</div>\n </div>\n </div>\n @if (navItem.isExpanded) {\n <div class=\"expandable-links\">\n @for (navItemChild of navItem.children; track navItemChild) {\n <ng-container *ngTemplateOutlet=\"typeRendererTemplate; context: { navItem: navItemChild }\"> </ng-container>\n }\n </div>\n }\n</ng-template>\n", styles: [".nav-container{padding:0;height:100%}nav{max-width:100%;margin:0 10px}.nav-item{width:100%;height:48px;font-size:18px;display:flex;flex-direction:column;justify-content:center;color:#003b49;padding:0 15px;position:relative}.nav-item:hover{background-color:#0000000a;transition:background-color .1s ease}.nav-item:active{background-color:#0000001a;transition:background-color .1s ease}.link-header{color:#003b49;text-transform:uppercase;font-weight:700;font-size:12px;margin:20px 0 0 5px}.link-button{display:flex;flex-direction:row;width:100%}.link-button .icon{min-width:20px;margin-right:10px;display:flex;flex-direction:column;justify-content:center}.link-button .text{margin-right:10px;text-align:left;display:flex;flex-direction:row;justify-content:left;text-decoration:capitalize}.expandable-links{display:flex;flex-direction:column;width:100%;padding-left:30px}a:active,a:link,a:visited{color:#003b49!important}a{text-decoration:none}.active-link:before{content:\"\";position:absolute;left:3px;width:5px;height:38px;background-color:#003b49}.active-link{background-color:#0000000a;position:relative}\n"] }]
691
- }], propDecorators: { navGroups: [{
692
- type: Input
693
- }] } });
694
-
695
- class ApiInterceptor {
696
- store = inject(Store);
697
- router = inject(Router);
698
- ngZone = inject(NgZone);
699
- baseUrl = inject(BASE_URL);
700
- intercept(request, next) {
701
- this.store.dispatch(new ApiInterceptorAction.BeginActivity(request.method + ' ' + request.url));
702
- return next.handle(request).pipe(catchError((error) => {
703
- if (error.status === 401) {
704
- this.ngZone.run(() => {
705
- this.store.dispatch(new ApiInterceptorAction.SetRedirectUrl(this.baseUrl + this.router.url));
706
- this.router.navigate(['/login']);
707
- });
708
- }
709
- if (!request.context.get(CUSTOM_HTTP_REQUEST_OPTIONS).suppressGlobalError) {
710
- const message = error.error?.message ?? error.message ?? error.error;
711
- this.store.dispatch(new ApiInterceptorAction.PublishError({
712
- message: message,
713
- level: AlertLevel.ERROR,
714
- link: '',
715
- }));
716
- }
717
- return throwError(() => error);
718
- }), finalize(() => {
719
- this.store.dispatch(new ApiInterceptorAction.EndActivity(request.method + ' ' + request.url));
720
- }));
721
- }
722
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: ApiInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
723
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: ApiInterceptor });
724
- }
725
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: ApiInterceptor, decorators: [{
726
- type: Injectable
727
- }] });
1
+ export * from '@cccteam/ccc-lib/src/auth-has-permission';
2
+ export * from '@cccteam/ccc-lib/src/auth-forms';
3
+ export * from '@cccteam/ccc-lib/src/auth-authentication-guard';
4
+ export * from '@cccteam/ccc-lib/src/auth-authorization-guard';
5
+ export * from '@cccteam/ccc-lib/src/auth-service';
6
+ export * from '@cccteam/ccc-lib/src/util-request-options';
7
+ export * from '@cccteam/ccc-lib/src/auth-state';
8
+ export * from '@cccteam/ccc-lib/src/types';
9
+ export * from '@cccteam/ccc-lib/src/ui-alert';
10
+ export * from '@cccteam/ccc-lib/src/ui-sidenav';
11
+ export * from '@cccteam/ccc-lib/src/ui-interceptor';
12
+ export * from '@cccteam/ccc-lib/src/ui-notification-service';
13
+ export * from '@cccteam/ccc-lib/src/ui-core-state';
728
14
 
729
15
  /*
730
16
  * Public API Surface of ccc-lib
@@ -734,6 +20,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
734
20
  /**
735
21
  * Generated bundle index. Do not edit.
736
22
  */
737
-
738
- export { API_URL, AVAILABLE_DOMAINS, AVAILABLE_PERMISSIONS, AlertComponent, AlertLevel, ApiInterceptor, ApiInterceptorAction, AppAction, AuthService, AuthState, AuthenticationGuard, AuthenticationGuardAction, AuthorizationGuard, BASE_URL, CUSTOM_HTTP_REQUEST_OPTIONS, CccInputFieldComponent, CoreState, HasPermissionDirective, HeaderAction, InputMode, LoginAction, NotificationService, PERMISSION_REQUIRED, ReadPermission, SidenavComponent, UpdatePermission, cleanStringFormArray, errorOptions, initState$1 as initState, sparseFormData };
739
23
  //# sourceMappingURL=cccteam-ccc-lib.mjs.map