@coolms/core-angular 2.0.0-alpha.6 → 2.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +54 -0
- package/LICENSE +1 -1
- package/fesm2022/coolms-core-angular.mjs +330 -188
- package/fesm2022/coolms-core-angular.mjs.map +1 -1
- package/package.json +1 -1
- package/types/coolms-core-angular.d.ts +219 -120
|
@@ -2,17 +2,21 @@ import * as i0 from "@angular/core";
|
|
|
2
2
|
import { ChangeDetectionStrategy, Component, DestroyRef, Injectable, InjectionToken, Injector, computed, effect, inject, input, makeEnvironmentProviders, provideAppInitializer, signal, untracked } from "@angular/core";
|
|
3
3
|
import { HttpClient, HttpContext, HttpContextToken, HttpErrorResponse, HttpParams } from "@angular/common/http";
|
|
4
4
|
import { Action, Actions, Selector, State, Store, ofActionDispatched, provideStore } from "@ngxs/store";
|
|
5
|
+
import { ReplaySubject, Subject, catchError, debounceTime, defer, filter, finalize, firstValueFrom, from, fromEvent, map, merge, of, shareReplay, switchMap, take, tap, throwError } from "rxjs";
|
|
5
6
|
import { __decorate } from "tslib";
|
|
6
|
-
import { ReplaySubject, Subject, catchError, debounceTime, defer, finalize, firstValueFrom, from, map, of, shareReplay, switchMap, take, tap, throwError } from "rxjs";
|
|
7
7
|
import { catchError as catchError$1, map as map$1, shareReplay as shareReplay$1, switchMap as switchMap$1, tap as tap$1 } from "rxjs/operators";
|
|
8
|
+
import { DOCUMENT, Location, NgIf } from "@angular/common";
|
|
8
9
|
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
9
10
|
import { ActivatedRoute, Router } from "@angular/router";
|
|
10
|
-
import { Location, NgIf } from "@angular/common";
|
|
11
11
|
import * as i1 from "@angular/forms";
|
|
12
12
|
import { FormsModule } from "@angular/forms";
|
|
13
13
|
function resolvePattern(pattern, params) {
|
|
14
14
|
return Object.entries(params).reduce((url, [key, value]) => url.replace(`{${key}}`, encodeURIComponent(value)), pattern);
|
|
15
15
|
}
|
|
16
|
+
const AUTH_AUDIENCE = new InjectionToken("coolms.auth.audience", {
|
|
17
|
+
providedIn: "root",
|
|
18
|
+
factory: () => null
|
|
19
|
+
});
|
|
16
20
|
var SetAppConfig = class {
|
|
17
21
|
config;
|
|
18
22
|
static type = "[AppConfig] Set";
|
|
@@ -77,16 +81,23 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
77
81
|
var IdentityApiClient = class IdentityApiClient {
|
|
78
82
|
http = inject(HttpClient);
|
|
79
83
|
store = inject(Store);
|
|
84
|
+
audience = inject(AUTH_AUDIENCE);
|
|
85
|
+
settingsRead$;
|
|
80
86
|
get manifest() {
|
|
81
87
|
const m = this.store.selectSnapshot(AppConfigState.manifest);
|
|
82
88
|
if (!m) throw new Error("ApiManifest not loaded — call AppInitService.load() first");
|
|
83
89
|
return m;
|
|
84
90
|
}
|
|
85
91
|
login(identifier, password) {
|
|
86
|
-
|
|
92
|
+
const body = this.audience === null ? {
|
|
87
93
|
identifier,
|
|
88
94
|
password
|
|
89
|
-
}
|
|
95
|
+
} : {
|
|
96
|
+
identifier,
|
|
97
|
+
password,
|
|
98
|
+
audience: this.audience
|
|
99
|
+
};
|
|
100
|
+
return this.http.post(this.manifest.auth.login, body);
|
|
90
101
|
}
|
|
91
102
|
refresh(refreshToken) {
|
|
92
103
|
return this.http.post(this.manifest.auth.refresh, { refreshToken });
|
|
@@ -98,7 +109,15 @@ var IdentityApiClient = class IdentityApiClient {
|
|
|
98
109
|
return this.http.get(this.manifest.auth.me);
|
|
99
110
|
}
|
|
100
111
|
getSettings() {
|
|
101
|
-
|
|
112
|
+
if (this.settingsRead$) return this.settingsRead$;
|
|
113
|
+
const read$ = this.http.get(this.manifest.identity.settingsUrl, { headers: { Accept: "application/json" } }).pipe(finalize(() => {
|
|
114
|
+
if (this.settingsRead$ === read$) this.settingsRead$ = void 0;
|
|
115
|
+
}), shareReplay({
|
|
116
|
+
bufferSize: 1,
|
|
117
|
+
refCount: true
|
|
118
|
+
}));
|
|
119
|
+
this.settingsRead$ = read$;
|
|
120
|
+
return read$;
|
|
102
121
|
}
|
|
103
122
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
104
123
|
minVersion: "12.0.0",
|
|
@@ -126,6 +145,20 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
126
145
|
args: [{ providedIn: "root" }]
|
|
127
146
|
}]
|
|
128
147
|
});
|
|
148
|
+
const AUDIENCE_NOT_GRANTED = "/errors/identity/audience-not-granted";
|
|
149
|
+
const WRONG_INTERFACE = "/errors/identity/wrong-interface";
|
|
150
|
+
const AUDIENCE_REQUIRED = "/errors/identity/audience-required";
|
|
151
|
+
function audienceRefusalOf(error) {
|
|
152
|
+
if (!(error instanceof HttpErrorResponse) || 403 !== error.status) return null;
|
|
153
|
+
const body = error.error;
|
|
154
|
+
const type = body !== null && typeof body === "object" ? body.type : void 0;
|
|
155
|
+
if ("/errors/identity/audience-not-granted" === type) return "not-granted";
|
|
156
|
+
return "/errors/identity/audience-required" === type ? "required" : null;
|
|
157
|
+
}
|
|
158
|
+
function sessionEndsOn(error) {
|
|
159
|
+
if (error instanceof HttpErrorResponse && 403 === error.status) return null !== audienceRefusalOf(error);
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
129
162
|
var Login = class {
|
|
130
163
|
identifier;
|
|
131
164
|
password;
|
|
@@ -163,8 +196,13 @@ const CROSS_TAB_KEY = "coolms.elevation.changed";
|
|
|
163
196
|
const RECONCILE_MIN_INTERVAL_MS = 2e3;
|
|
164
197
|
const ELEVATION_REQUIRED_HEADER = "X-Elevation-Required";
|
|
165
198
|
const BACKGROUND_REQUEST = new HttpContextToken(() => false);
|
|
199
|
+
const ELEVATION_REQUIRED_PROBLEM_TYPE = "/errors/elevation-required";
|
|
200
|
+
const ELEVATION_CODE_REQUIRED_TYPE = "/errors/elevation/code-required";
|
|
201
|
+
const ELEVATION_RETRY_TYPES = ["/errors/elevation/wrong-password", "/errors/elevation/wrong-code"];
|
|
166
202
|
function isElevationRefusal(err) {
|
|
167
|
-
|
|
203
|
+
if (!(err instanceof HttpErrorResponse) || err.status !== 403) return false;
|
|
204
|
+
const body = err.error;
|
|
205
|
+
return typeof body === "object" && body !== null && body.type === "/errors/elevation-required" || !!err.headers.get("X-Elevation-Required");
|
|
168
206
|
}
|
|
169
207
|
var ElevationService = class ElevationService {
|
|
170
208
|
http = inject(HttpClient);
|
|
@@ -404,115 +442,274 @@ function expiredView(state) {
|
|
|
404
442
|
}
|
|
405
443
|
};
|
|
406
444
|
}
|
|
445
|
+
const NOT_AVAILABLE = "Not available right now";
|
|
446
|
+
const SOMETHING_WENT_WRONG = "Something went wrong. Try again.";
|
|
447
|
+
function sentenceOf(text) {
|
|
448
|
+
return typeof text === "string" && text.trim() !== "" ? text : null;
|
|
449
|
+
}
|
|
450
|
+
function problemOf(error) {
|
|
451
|
+
let body = error.error;
|
|
452
|
+
if (typeof body === "string") try {
|
|
453
|
+
body = JSON.parse(body);
|
|
454
|
+
} catch {
|
|
455
|
+
return null;
|
|
456
|
+
}
|
|
457
|
+
if (typeof body !== "object" || body === null) return null;
|
|
458
|
+
const prototype = Object.getPrototypeOf(body);
|
|
459
|
+
return prototype === Object.prototype || prototype === null ? body : null;
|
|
460
|
+
}
|
|
461
|
+
const FRAMEWORK_FAULT = /^\/errors\/5\d\d$/;
|
|
462
|
+
function declaredProblemOf(error) {
|
|
463
|
+
if (!(error instanceof HttpErrorResponse)) return null;
|
|
464
|
+
const problem = problemOf(error);
|
|
465
|
+
const type = problem?.["type"];
|
|
466
|
+
return typeof type === "string" && type.trim() !== "" && type !== "about:blank" && !FRAMEWORK_FAULT.test(type) ? problem : null;
|
|
467
|
+
}
|
|
468
|
+
function declaredTypeOf(error) {
|
|
469
|
+
const type = declaredProblemOf(error)?.["type"];
|
|
470
|
+
return typeof type === "string" ? type : null;
|
|
471
|
+
}
|
|
472
|
+
function isRefusal(error) {
|
|
473
|
+
return error instanceof HttpErrorResponse && error.status >= 400 && error.status <= 499;
|
|
474
|
+
}
|
|
475
|
+
function firstFieldMessageOf(error) {
|
|
476
|
+
if (!(error instanceof HttpErrorResponse) || error.status !== 422) return null;
|
|
477
|
+
const violations = problemOf(error)?.["violations"];
|
|
478
|
+
if (!Array.isArray(violations)) return null;
|
|
479
|
+
for (const one of violations) {
|
|
480
|
+
const message = typeof one === "object" && one !== null ? sentenceOf(one.message) : null;
|
|
481
|
+
if (message !== null) return message;
|
|
482
|
+
}
|
|
483
|
+
return null;
|
|
484
|
+
}
|
|
485
|
+
function refusalWords(error) {
|
|
486
|
+
const field = firstFieldMessageOf(error);
|
|
487
|
+
if (field !== null) return field;
|
|
488
|
+
const problem = declaredProblemOf(error);
|
|
489
|
+
if (problem === null) return SOMETHING_WENT_WRONG;
|
|
490
|
+
return sentenceOf(problem["detail"]) ?? "Not available right now";
|
|
491
|
+
}
|
|
492
|
+
var ErrorHandlerService = class ErrorHandlerService {
|
|
493
|
+
humanize(err) {
|
|
494
|
+
return refusalWords(err);
|
|
495
|
+
}
|
|
496
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
497
|
+
minVersion: "12.0.0",
|
|
498
|
+
version: "22.2.3",
|
|
499
|
+
ngImport: i0,
|
|
500
|
+
type: ErrorHandlerService,
|
|
501
|
+
deps: [],
|
|
502
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
503
|
+
});
|
|
504
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
505
|
+
minVersion: "12.0.0",
|
|
506
|
+
version: "22.2.3",
|
|
507
|
+
ngImport: i0,
|
|
508
|
+
type: ErrorHandlerService,
|
|
509
|
+
providedIn: "root"
|
|
510
|
+
});
|
|
511
|
+
};
|
|
512
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
513
|
+
minVersion: "12.0.0",
|
|
514
|
+
version: "22.2.3",
|
|
515
|
+
ngImport: i0,
|
|
516
|
+
type: ErrorHandlerService,
|
|
517
|
+
decorators: [{
|
|
518
|
+
type: Injectable,
|
|
519
|
+
args: [{ providedIn: "root" }]
|
|
520
|
+
}]
|
|
521
|
+
});
|
|
522
|
+
const PREFERENCES_NOTICE = new InjectionToken("coolms.preferences-notice");
|
|
523
|
+
const DATAGRID_ENTRY_PREFIX = "datagrid:";
|
|
524
|
+
function datagridEntry(gridId) {
|
|
525
|
+
return DATAGRID_ENTRY_PREFIX + gridId;
|
|
526
|
+
}
|
|
527
|
+
const NAMESPACES = /* @__PURE__ */ new Set([
|
|
528
|
+
"grids",
|
|
529
|
+
"panel",
|
|
530
|
+
"page",
|
|
531
|
+
"terminal",
|
|
532
|
+
"nav"
|
|
533
|
+
]);
|
|
534
|
+
function isObject(value) {
|
|
535
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
536
|
+
}
|
|
537
|
+
function gridPrefOf(entry) {
|
|
538
|
+
if (!isObject(entry)) return null;
|
|
539
|
+
const pref = {};
|
|
540
|
+
if (Array.isArray(entry["columns"])) pref.columns = entry["columns"];
|
|
541
|
+
if (isObject(entry["columnWidths"])) pref.columnWidths = entry["columnWidths"];
|
|
542
|
+
return pref.columns === void 0 && pref.columnWidths === void 0 ? null : pref;
|
|
543
|
+
}
|
|
407
544
|
var UserPreferencesService = class UserPreferencesService {
|
|
408
545
|
http = inject(HttpClient);
|
|
409
546
|
store = inject(Store);
|
|
410
547
|
destroyRef = inject(DestroyRef);
|
|
548
|
+
errors = inject(ErrorHandlerService);
|
|
549
|
+
notice = inject(PREFERENCES_NOTICE, { optional: true });
|
|
550
|
+
document = inject(DOCUMENT);
|
|
411
551
|
STORAGE_KEY = "coolms_ui_prefs";
|
|
412
552
|
SYNC_DELAY = 2e3;
|
|
553
|
+
RETRY_DELAYS = [
|
|
554
|
+
5e3,
|
|
555
|
+
3e4,
|
|
556
|
+
12e4
|
|
557
|
+
];
|
|
558
|
+
pending = /* @__PURE__ */ new Map();
|
|
413
559
|
syncSubject = new Subject();
|
|
560
|
+
failures = 0;
|
|
561
|
+
retryTimer = null;
|
|
414
562
|
constructor() {
|
|
415
|
-
this.syncSubject.pipe(debounceTime(this.SYNC_DELAY), takeUntilDestroyed(this.destroyRef)).subscribe((
|
|
563
|
+
this.syncSubject.pipe(debounceTime(this.SYNC_DELAY), takeUntilDestroyed(this.destroyRef)).subscribe(() => this.flush());
|
|
564
|
+
const win = this.document.defaultView;
|
|
565
|
+
if (win) merge(fromEvent(win, "online"), fromEvent(this.document, "visibilitychange").pipe(filter(() => this.document.visibilityState === "visible"))).pipe(filter(() => this.retryTimer !== null), takeUntilDestroyed(this.destroyRef)).subscribe(() => this.flush());
|
|
566
|
+
this.destroyRef.onDestroy(() => this.cancelRetry());
|
|
416
567
|
}
|
|
417
|
-
save(all) {
|
|
418
|
-
|
|
419
|
-
this.
|
|
568
|
+
save(all, ...changed) {
|
|
569
|
+
this.write(all);
|
|
570
|
+
for (const id of changed) this.pending.set(id, all[id] ?? {});
|
|
571
|
+
this.syncSubject.next();
|
|
420
572
|
}
|
|
421
|
-
|
|
573
|
+
write(all) {
|
|
574
|
+
try {
|
|
575
|
+
localStorage.setItem(this.STORAGE_KEY, JSON.stringify(all));
|
|
576
|
+
} catch {}
|
|
577
|
+
}
|
|
578
|
+
readLocal() {
|
|
422
579
|
try {
|
|
423
580
|
const raw = localStorage.getItem(this.STORAGE_KEY);
|
|
424
581
|
const all = raw ? JSON.parse(raw) : {};
|
|
425
|
-
return
|
|
582
|
+
return isObject(all) ? all : {};
|
|
426
583
|
} catch {
|
|
427
584
|
return {};
|
|
428
585
|
}
|
|
429
586
|
}
|
|
587
|
+
load() {
|
|
588
|
+
const all = this.readLocal();
|
|
589
|
+
if (this.migrate(all)) this.write(all);
|
|
590
|
+
return all;
|
|
591
|
+
}
|
|
430
592
|
migrate(all) {
|
|
431
593
|
let dirty = false;
|
|
432
594
|
if (typeof all["terminal_height"] === "number") {
|
|
433
|
-
const terminal = all["terminal"]
|
|
595
|
+
const terminal = isObject(all["terminal"]) ? all["terminal"] : {};
|
|
434
596
|
terminal["height"] = all["terminal_height"];
|
|
435
597
|
all["terminal"] = terminal;
|
|
436
598
|
delete all["terminal_height"];
|
|
437
599
|
dirty = true;
|
|
438
600
|
}
|
|
439
601
|
if (typeof all["media_view_mode"] === "string") {
|
|
440
|
-
const page = all["page"]
|
|
441
|
-
const media = page["media"]
|
|
602
|
+
const page = isObject(all["page"]) ? all["page"] : {};
|
|
603
|
+
const media = isObject(page["media"]) ? page["media"] : {};
|
|
442
604
|
media["viewMode"] = all["media_view_mode"];
|
|
443
605
|
page["media"] = media;
|
|
444
606
|
all["page"] = page;
|
|
445
607
|
delete all["media_view_mode"];
|
|
446
608
|
dirty = true;
|
|
447
609
|
}
|
|
448
|
-
if (all["media_collections_panel"]
|
|
449
|
-
const panel = all["panel"]
|
|
610
|
+
if (isObject(all["media_collections_panel"])) {
|
|
611
|
+
const panel = isObject(all["panel"]) ? all["panel"] : {};
|
|
450
612
|
panel["media_panel_left"] = all["media_collections_panel"];
|
|
451
613
|
all["panel"] = panel;
|
|
452
614
|
delete all["media_collections_panel"];
|
|
453
615
|
dirty = true;
|
|
454
616
|
}
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
"panel",
|
|
458
|
-
"page",
|
|
459
|
-
"terminal",
|
|
460
|
-
"nav"
|
|
461
|
-
]);
|
|
462
|
-
for (const ns of NAMESPACES) if (Array.isArray(all[ns])) {
|
|
463
|
-
all[ns] = {};
|
|
617
|
+
for (const id of Object.keys(all)) if (Array.isArray(all[id])) {
|
|
618
|
+
all[id] = {};
|
|
464
619
|
dirty = true;
|
|
465
620
|
}
|
|
621
|
+
const moved = [];
|
|
622
|
+
const toEntry = (gridId, pref) => {
|
|
623
|
+
const id = datagridEntry(gridId);
|
|
624
|
+
if (isObject(pref) && !(id in all)) {
|
|
625
|
+
all[id] = pref;
|
|
626
|
+
moved.push(id);
|
|
627
|
+
}
|
|
628
|
+
};
|
|
466
629
|
for (const key of Object.keys(all)) {
|
|
467
|
-
if (NAMESPACES.has(key)) continue;
|
|
468
|
-
const
|
|
469
|
-
if (
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
grids[key] = obj;
|
|
474
|
-
all["grids"] = grids;
|
|
475
|
-
delete all[key];
|
|
476
|
-
dirty = true;
|
|
477
|
-
}
|
|
630
|
+
if (NAMESPACES.has(key) || key.includes(":") || !isObject(all[key])) continue;
|
|
631
|
+
const obj = all[key];
|
|
632
|
+
if ("columns" in obj || "columnWidths" in obj) {
|
|
633
|
+
toEntry(key, obj);
|
|
634
|
+
delete all[key];
|
|
635
|
+
dirty = true;
|
|
478
636
|
}
|
|
479
637
|
}
|
|
480
|
-
if (
|
|
481
|
-
|
|
638
|
+
if ("grids" in all) {
|
|
639
|
+
const grids = all["grids"];
|
|
640
|
+
if (isObject(grids)) for (const [gridId, pref] of Object.entries(grids)) toEntry(gridId, pref);
|
|
641
|
+
delete all["grids"];
|
|
642
|
+
dirty = true;
|
|
643
|
+
}
|
|
644
|
+
if (moved.length > 0) {
|
|
645
|
+
for (const id of moved) this.pending.set(id, all[id]);
|
|
646
|
+
this.syncSubject.next();
|
|
647
|
+
}
|
|
648
|
+
return dirty;
|
|
482
649
|
}
|
|
483
650
|
loadFromServer(uiPrefs) {
|
|
484
|
-
if (Object.keys(uiPrefs).length === 0) return;
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
const merged = {
|
|
491
|
-
...uiPrefs,
|
|
492
|
-
...local
|
|
493
|
-
};
|
|
494
|
-
localStorage.setItem(this.STORAGE_KEY, JSON.stringify(merged));
|
|
495
|
-
}
|
|
496
|
-
} catch {
|
|
497
|
-
localStorage.setItem(this.STORAGE_KEY, JSON.stringify(uiPrefs));
|
|
651
|
+
if (!isObject(uiPrefs) || Object.keys(uiPrefs).length === 0) return;
|
|
652
|
+
const all = this.readLocal();
|
|
653
|
+
const oldGrids = isObject(uiPrefs["grids"]) ? { ...uiPrefs["grids"] } : null;
|
|
654
|
+
for (const [id, value] of Object.entries(uiPrefs)) {
|
|
655
|
+
if (id === "grids" || this.pending.has(id)) continue;
|
|
656
|
+
all[id] = value;
|
|
498
657
|
}
|
|
658
|
+
if (oldGrids !== null) all["grids"] = {
|
|
659
|
+
...oldGrids,
|
|
660
|
+
...isObject(all["grids"]) ? all["grids"] : {}
|
|
661
|
+
};
|
|
662
|
+
this.migrate(all);
|
|
663
|
+
this.write(all);
|
|
664
|
+
}
|
|
665
|
+
flush() {
|
|
666
|
+
this.cancelRetry();
|
|
667
|
+
if (this.pending.size === 0) return;
|
|
668
|
+
const entries = Object.fromEntries(this.pending);
|
|
669
|
+
this.pending.clear();
|
|
670
|
+
this.syncToServer(entries);
|
|
499
671
|
}
|
|
500
|
-
syncToServer(
|
|
672
|
+
syncToServer(entries) {
|
|
501
673
|
const url = this.store.selectSnapshot(AppConfigState.manifest)?.auth?.preferencesUrl;
|
|
502
674
|
if (!url) return;
|
|
503
|
-
this.http.patch(url, { uiPrefs:
|
|
675
|
+
this.http.patch(url, { uiPrefs: entries }, {
|
|
504
676
|
headers: { "Content-Type": "application/merge-patch+json" },
|
|
505
677
|
context: new HttpContext().set(BACKGROUND_REQUEST, true)
|
|
506
|
-
}).subscribe({
|
|
678
|
+
}).subscribe({
|
|
679
|
+
next: () => {
|
|
680
|
+
this.failures = 0;
|
|
681
|
+
},
|
|
682
|
+
error: (err) => this.refused(err, entries)
|
|
683
|
+
});
|
|
507
684
|
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
685
|
+
scheduleRetry() {
|
|
686
|
+
if (this.retryTimer !== null) return;
|
|
687
|
+
const delay = this.RETRY_DELAYS[Math.min(this.failures, this.RETRY_DELAYS.length) - 1];
|
|
688
|
+
this.retryTimer = setTimeout(() => {
|
|
689
|
+
this.retryTimer = null;
|
|
690
|
+
this.flush();
|
|
691
|
+
}, delay);
|
|
692
|
+
}
|
|
693
|
+
cancelRetry() {
|
|
694
|
+
if (this.retryTimer !== null) {
|
|
695
|
+
clearTimeout(this.retryTimer);
|
|
696
|
+
this.retryTimer = null;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
refused(err, entries) {
|
|
700
|
+
if (err instanceof HttpErrorResponse && err.status === 422) {
|
|
701
|
+
const sentence = `Your preferences could not be saved: ${this.errors.humanize(err)}`;
|
|
702
|
+
if (this.notice) this.notice.refused(sentence);
|
|
703
|
+
else console.warn(sentence);
|
|
704
|
+
return;
|
|
515
705
|
}
|
|
706
|
+
for (const [id, value] of Object.entries(entries)) if (!this.pending.has(id)) this.pending.set(id, value);
|
|
707
|
+
this.failures++;
|
|
708
|
+
this.scheduleRetry();
|
|
709
|
+
console.warn("Preferences sync failed:", err);
|
|
710
|
+
}
|
|
711
|
+
getGridPref(gridId) {
|
|
712
|
+
return gridPrefOf(this.load()[datagridEntry(gridId)]);
|
|
516
713
|
}
|
|
517
714
|
setColumns(gridId, columns) {
|
|
518
715
|
this.updateGrid(gridId, (existing) => ({
|
|
@@ -530,19 +727,25 @@ var UserPreferencesService = class UserPreferencesService {
|
|
|
530
727
|
}));
|
|
531
728
|
}
|
|
532
729
|
resetGrid(gridId) {
|
|
730
|
+
const id = datagridEntry(gridId);
|
|
533
731
|
const all = this.load();
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
732
|
+
delete all[id];
|
|
733
|
+
this.write(all);
|
|
734
|
+
this.pending.set(id, {
|
|
735
|
+
columns: null,
|
|
736
|
+
columnWidths: null
|
|
737
|
+
});
|
|
738
|
+
this.flush();
|
|
539
739
|
}
|
|
540
740
|
updateGrid(gridId, updater) {
|
|
741
|
+
const id = datagridEntry(gridId);
|
|
541
742
|
const all = this.load();
|
|
542
|
-
const
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
743
|
+
const entry = isObject(all[id]) ? all[id] : {};
|
|
744
|
+
all[id] = {
|
|
745
|
+
...entry,
|
|
746
|
+
...updater(gridPrefOf(entry) ?? {})
|
|
747
|
+
};
|
|
748
|
+
this.save(all, id);
|
|
546
749
|
}
|
|
547
750
|
getTerminalHeight() {
|
|
548
751
|
const terminal = this.load()["terminal"];
|
|
@@ -550,10 +753,10 @@ var UserPreferencesService = class UserPreferencesService {
|
|
|
550
753
|
}
|
|
551
754
|
setTerminalHeight(height) {
|
|
552
755
|
const all = this.load();
|
|
553
|
-
const terminal = all["terminal"]
|
|
756
|
+
const terminal = isObject(all["terminal"]) ? all["terminal"] : {};
|
|
554
757
|
terminal["height"] = Math.round(height);
|
|
555
758
|
all["terminal"] = terminal;
|
|
556
|
-
this.save(all);
|
|
759
|
+
this.save(all, "terminal");
|
|
557
760
|
}
|
|
558
761
|
getPanelState(key) {
|
|
559
762
|
try {
|
|
@@ -572,13 +775,13 @@ var UserPreferencesService = class UserPreferencesService {
|
|
|
572
775
|
}
|
|
573
776
|
setPanelState(key, width, collapsed) {
|
|
574
777
|
const all = this.load();
|
|
575
|
-
const panel = all["panel"]
|
|
778
|
+
const panel = isObject(all["panel"]) ? all["panel"] : {};
|
|
576
779
|
panel[key] = {
|
|
577
780
|
width: Math.round(width),
|
|
578
781
|
collapsed
|
|
579
782
|
};
|
|
580
783
|
all["panel"] = panel;
|
|
581
|
-
this.save(all);
|
|
784
|
+
this.save(all, "panel");
|
|
582
785
|
}
|
|
583
786
|
getPageState(pageKey) {
|
|
584
787
|
try {
|
|
@@ -591,13 +794,13 @@ var UserPreferencesService = class UserPreferencesService {
|
|
|
591
794
|
}
|
|
592
795
|
setPageState(pageKey, state) {
|
|
593
796
|
const all = this.load();
|
|
594
|
-
const page = all["page"]
|
|
797
|
+
const page = isObject(all["page"]) ? all["page"] : {};
|
|
595
798
|
page[pageKey] = {
|
|
596
|
-
...page[pageKey]
|
|
799
|
+
...isObject(page[pageKey]) ? page[pageKey] : {},
|
|
597
800
|
...state
|
|
598
801
|
};
|
|
599
802
|
all["page"] = page;
|
|
600
|
-
this.save(all);
|
|
803
|
+
this.save(all, "page");
|
|
601
804
|
}
|
|
602
805
|
getMediaViewMode() {
|
|
603
806
|
return this.getPageState("media")?.viewMode ?? null;
|
|
@@ -677,10 +880,8 @@ let AuthState = class AuthState {
|
|
|
677
880
|
if (!raw) return;
|
|
678
881
|
try {
|
|
679
882
|
const state = JSON.parse(raw);
|
|
680
|
-
if (state.accessToken || state.refreshToken)
|
|
681
|
-
|
|
682
|
-
if (state.user?.uiPrefs) this.prefs.loadFromServer(state.user.uiPrefs);
|
|
683
|
-
} else localStorage.removeItem(STORAGE_KEY$2);
|
|
883
|
+
if (state.accessToken || state.refreshToken) ctx.setState(state);
|
|
884
|
+
else localStorage.removeItem(STORAGE_KEY$2);
|
|
684
885
|
} catch {
|
|
685
886
|
localStorage.removeItem(STORAGE_KEY$2);
|
|
686
887
|
}
|
|
@@ -775,6 +976,7 @@ var ConsoleAccessService = class ConsoleAccessService {
|
|
|
775
976
|
static URL = "/api/v1/admin/manifest";
|
|
776
977
|
static LEGACY_URL = "/api/v1/console/manifest";
|
|
777
978
|
static REFUSED_REASON = "no-console-access";
|
|
979
|
+
static SIGN_IN_AGAIN_REASON = "sign-in-again";
|
|
778
980
|
http = inject(HttpClient);
|
|
779
981
|
store = inject(Store);
|
|
780
982
|
answer = "unknown";
|
|
@@ -796,7 +998,7 @@ var ConsoleAccessService = class ConsoleAccessService {
|
|
|
796
998
|
access: "granted",
|
|
797
999
|
response
|
|
798
1000
|
})), catchError((error) => of({
|
|
799
|
-
access: error
|
|
1001
|
+
access: accessOf(error),
|
|
800
1002
|
response: null
|
|
801
1003
|
})))).then(({ access, response }) => {
|
|
802
1004
|
if (askedFor !== this.generation) return this.ensure();
|
|
@@ -849,6 +1051,11 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
849
1051
|
}],
|
|
850
1052
|
ctorParameters: () => []
|
|
851
1053
|
});
|
|
1054
|
+
function accessOf(error) {
|
|
1055
|
+
const refusal = audienceRefusalOf(error);
|
|
1056
|
+
if ("not-granted" === refusal) return "refused";
|
|
1057
|
+
return "required" === refusal ? "sign-in-again" : "unknown";
|
|
1058
|
+
}
|
|
852
1059
|
const BACKGROUND = { context: new HttpContext().set(BACKGROUND_REQUEST, true) };
|
|
853
1060
|
var RealtimeTokenClient = class RealtimeTokenClient {
|
|
854
1061
|
static REFUSED = "no console access: no realtime connection";
|
|
@@ -861,7 +1068,7 @@ var RealtimeTokenClient = class RealtimeTokenClient {
|
|
|
861
1068
|
return m;
|
|
862
1069
|
}
|
|
863
1070
|
connectionToken() {
|
|
864
|
-
return defer(() => this.injector.get(ConsoleAccessService).ensure()).pipe(switchMap((access) => "refused" === access ? throwError(() => new Error(RealtimeTokenClient.REFUSED)) : this.http.post(this.manifest.apiBase + "/centrifugo/connection-token", {}, BACKGROUND)));
|
|
1071
|
+
return defer(() => this.injector.get(ConsoleAccessService).ensure()).pipe(switchMap((access) => "refused" === access || "sign-in-again" === access ? throwError(() => new Error(RealtimeTokenClient.REFUSED)) : this.http.post(this.manifest.apiBase + "/centrifugo/connection-token", {}, BACKGROUND)));
|
|
865
1072
|
}
|
|
866
1073
|
subscriptionToken(channel) {
|
|
867
1074
|
return this.http.post(this.manifest.apiBase + "/centrifugo/subscription-token", { channel }, BACKGROUND);
|
|
@@ -903,9 +1110,14 @@ var AuthRefreshCoordinator = class AuthRefreshCoordinator {
|
|
|
903
1110
|
refresh(refreshToken, refusedAccessToken = null) {
|
|
904
1111
|
if (this.inFlight) return this.inFlight;
|
|
905
1112
|
this.inFlight = defer(() => this.refreshWithCrossTabLock(refreshToken, refusedAccessToken)).pipe(catchError((refreshErr) => {
|
|
906
|
-
|
|
1113
|
+
const isAuthFailure = refreshErr instanceof HttpErrorResponse && refreshErr.status === 401;
|
|
1114
|
+
const refusal = audienceRefusalOf(refreshErr);
|
|
1115
|
+
if (isAuthFailure || null !== refusal) {
|
|
907
1116
|
this.store.dispatch(new Logout());
|
|
908
|
-
if (this.router.navigated)
|
|
1117
|
+
if (this.router.navigated) {
|
|
1118
|
+
const reason = null === refusal ? null : "required" === refusal ? ConsoleAccessService.SIGN_IN_AGAIN_REASON : ConsoleAccessService.REFUSED_REASON;
|
|
1119
|
+
null === reason ? this.router.navigate(["/login"]) : this.router.navigate(["/login"], { queryParams: { reason } });
|
|
1120
|
+
}
|
|
909
1121
|
}
|
|
910
1122
|
return throwError(() => refreshErr);
|
|
911
1123
|
}), shareReplay(1), finalize(() => {
|
|
@@ -1103,7 +1315,8 @@ var AppInitService = class AppInitService {
|
|
|
1103
1315
|
}
|
|
1104
1316
|
async validateSession(meUrl) {
|
|
1105
1317
|
const token = this.store.selectSnapshot(AuthState.accessToken);
|
|
1106
|
-
|
|
1318
|
+
const first = await this.probe(meUrl, token);
|
|
1319
|
+
if (true === first || !sessionEndsOn(first)) return;
|
|
1107
1320
|
const refreshToken = this.store.selectSnapshot(AuthState.refreshToken);
|
|
1108
1321
|
if (!refreshToken) {
|
|
1109
1322
|
this.store.dispatch(new Logout());
|
|
@@ -1115,13 +1328,17 @@ var AppInitService = class AppInitService {
|
|
|
1115
1328
|
} catch {
|
|
1116
1329
|
return;
|
|
1117
1330
|
}
|
|
1118
|
-
|
|
1331
|
+
const again = await this.probe(meUrl, refreshedToken);
|
|
1332
|
+
if (true !== again && sessionEndsOn(again)) this.store.dispatch(new Logout());
|
|
1119
1333
|
}
|
|
1120
1334
|
probe(url, token) {
|
|
1121
1335
|
return firstValueFrom(this.http.get(url, {
|
|
1122
1336
|
context: new HttpContext().set(BYPASS_AUTH, true),
|
|
1123
1337
|
headers: token ? { Authorization: `Bearer ${token}` } : {}
|
|
1124
|
-
}).pipe(
|
|
1338
|
+
}).pipe(tap((me) => {
|
|
1339
|
+
const uiPrefs = me?.uiPrefs;
|
|
1340
|
+
if (uiPrefs !== null && typeof uiPrefs === "object" && !Array.isArray(uiPrefs)) this.prefs.loadFromServer(uiPrefs);
|
|
1341
|
+
}), map(() => true), catchError((error) => of(error))));
|
|
1125
1342
|
}
|
|
1126
1343
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1127
1344
|
minVersion: "12.0.0",
|
|
@@ -1158,7 +1375,9 @@ const authGuard = () => {
|
|
|
1158
1375
|
if (!store.selectSnapshot(AuthState.isAuthenticated)) return of(router.createUrlTree(["/login"]));
|
|
1159
1376
|
return from(consoleAccess.ensure()).pipe(switchMap((access) => {
|
|
1160
1377
|
if (!store.selectSnapshot(AuthState.isAuthenticated)) return of(router.createUrlTree(["/login"]));
|
|
1161
|
-
|
|
1378
|
+
if ("refused" !== access && "sign-in-again" !== access) return of(true);
|
|
1379
|
+
const reason = "refused" === access ? ConsoleAccessService.REFUSED_REASON : ConsoleAccessService.SIGN_IN_AGAIN_REASON;
|
|
1380
|
+
return consoleAccess.signOut().pipe(map(() => router.createUrlTree(["/login"], { queryParams: { reason } })));
|
|
1162
1381
|
}));
|
|
1163
1382
|
}));
|
|
1164
1383
|
};
|
|
@@ -1174,63 +1393,6 @@ const loginPageGuard = () => {
|
|
|
1174
1393
|
const ELEVATION_WARNING_PASSWORD_NOT_SET = "elevation.password_not_set";
|
|
1175
1394
|
const ELEVATION_WARNING_FACTOR_MISSING = "elevation.factor_missing";
|
|
1176
1395
|
const ELEVATION_WARNING_MFA_OFF = "elevation.mfa_off";
|
|
1177
|
-
const FRAMEWORK_REFUSAL = /^\s*access denied\.?\s*$/i;
|
|
1178
|
-
var ErrorHandlerService = class ErrorHandlerService {
|
|
1179
|
-
humanize(err) {
|
|
1180
|
-
if (!(err instanceof HttpErrorResponse)) return err instanceof Error ? err.message : "An unexpected error occurred.";
|
|
1181
|
-
const elevationRefusal = isElevationRefusal(err);
|
|
1182
|
-
const body = err.error;
|
|
1183
|
-
if (body && typeof body === "object") {
|
|
1184
|
-
const detail = body["detail"] ?? body["hydra:description"] ?? body["message"];
|
|
1185
|
-
if (typeof detail === "string" && detail.trim() && !FRAMEWORK_REFUSAL.test(detail)) return detail.trim();
|
|
1186
|
-
if (Array.isArray(body["violations"])) {
|
|
1187
|
-
const msgs = body["violations"].map((v) => v.message).filter(Boolean);
|
|
1188
|
-
if (msgs.length) return msgs.join(" ");
|
|
1189
|
-
}
|
|
1190
|
-
}
|
|
1191
|
-
return elevationRefusal ? "This needs an elevated session." : this.statusMessage(err.status);
|
|
1192
|
-
}
|
|
1193
|
-
statusMessage(status) {
|
|
1194
|
-
switch (status) {
|
|
1195
|
-
case 0: return "Network error. Check your connection.";
|
|
1196
|
-
case 400: return "Invalid request.";
|
|
1197
|
-
case 401: return "Session expired. Please sign in again.";
|
|
1198
|
-
case 403: return "You don't have access to this.";
|
|
1199
|
-
case 404: return "Resource not found.";
|
|
1200
|
-
case 409: return "Conflict — resource already exists.";
|
|
1201
|
-
case 422: return "Validation failed.";
|
|
1202
|
-
case 429: return "Too many requests. Please wait a moment.";
|
|
1203
|
-
case 500: return "Server error. Please try again later.";
|
|
1204
|
-
case 503: return "Service unavailable. Please try again later.";
|
|
1205
|
-
default: return `Unexpected error (${status}).`;
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1209
|
-
minVersion: "12.0.0",
|
|
1210
|
-
version: "22.2.3",
|
|
1211
|
-
ngImport: i0,
|
|
1212
|
-
type: ErrorHandlerService,
|
|
1213
|
-
deps: [],
|
|
1214
|
-
target: i0.ɵɵFactoryTarget.Injectable
|
|
1215
|
-
});
|
|
1216
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
1217
|
-
minVersion: "12.0.0",
|
|
1218
|
-
version: "22.2.3",
|
|
1219
|
-
ngImport: i0,
|
|
1220
|
-
type: ErrorHandlerService,
|
|
1221
|
-
providedIn: "root"
|
|
1222
|
-
});
|
|
1223
|
-
};
|
|
1224
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
1225
|
-
minVersion: "12.0.0",
|
|
1226
|
-
version: "22.2.3",
|
|
1227
|
-
ngImport: i0,
|
|
1228
|
-
type: ErrorHandlerService,
|
|
1229
|
-
decorators: [{
|
|
1230
|
-
type: Injectable,
|
|
1231
|
-
args: [{ providedIn: "root" }]
|
|
1232
|
-
}]
|
|
1233
|
-
});
|
|
1234
1396
|
const READS = /* @__PURE__ */ new Set([
|
|
1235
1397
|
"GET",
|
|
1236
1398
|
"HEAD",
|
|
@@ -1281,12 +1443,17 @@ var LoginComponent = class LoginComponent {
|
|
|
1281
1443
|
error = signal(null, ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
|
|
1282
1444
|
store = inject(Store);
|
|
1283
1445
|
router = inject(Router);
|
|
1284
|
-
static NO_CONSOLE_ACCESS = "This account
|
|
1446
|
+
static NO_CONSOLE_ACCESS = "This account may not enter the admin.";
|
|
1447
|
+
static SIGN_IN_AGAIN = "Please sign in again.";
|
|
1285
1448
|
constructor() {
|
|
1286
1449
|
inject(ActivatedRoute).queryParamMap.pipe(takeUntilDestroyed()).subscribe((params) => {
|
|
1287
|
-
|
|
1450
|
+
const reason = params.get("reason");
|
|
1451
|
+
if (ConsoleAccessService.REFUSED_REASON === reason) {
|
|
1288
1452
|
this.loading.set(false);
|
|
1289
1453
|
this.error.set(LoginComponent.NO_CONSOLE_ACCESS);
|
|
1454
|
+
} else if (ConsoleAccessService.SIGN_IN_AGAIN_REASON === reason) {
|
|
1455
|
+
this.loading.set(false);
|
|
1456
|
+
this.error.set(LoginComponent.SIGN_IN_AGAIN);
|
|
1290
1457
|
}
|
|
1291
1458
|
});
|
|
1292
1459
|
}
|
|
@@ -1303,6 +1470,10 @@ var LoginComponent = class LoginComponent {
|
|
|
1303
1470
|
},
|
|
1304
1471
|
error: (err) => {
|
|
1305
1472
|
this.loading.set(false);
|
|
1473
|
+
if ("not-granted" === audienceRefusalOf(err)) {
|
|
1474
|
+
this.error.set(LoginComponent.NO_CONSOLE_ACCESS);
|
|
1475
|
+
return;
|
|
1476
|
+
}
|
|
1306
1477
|
this.error.set(err?.error?.detail ?? err?.error?.message ?? err?.message ?? "Invalid credentials. Please try again.");
|
|
1307
1478
|
}
|
|
1308
1479
|
});
|
|
@@ -1504,9 +1675,9 @@ var ThemeService = class ThemeService {
|
|
|
1504
1675
|
if (this.loadOnce$) return this.loadOnce$;
|
|
1505
1676
|
this.readPlatformAccent();
|
|
1506
1677
|
this.loadOnce$ = this.api.getSettings().pipe(map$1((all) => {
|
|
1507
|
-
const
|
|
1508
|
-
this.setAccent(isAccent(
|
|
1509
|
-
return isChoice(
|
|
1678
|
+
const appearance = all["appearance"];
|
|
1679
|
+
this.setAccent(isAccent(appearance?.["accentColor"]) ? appearance["accentColor"] : null);
|
|
1680
|
+
return isChoice(appearance?.["theme"]) ? appearance["theme"] : this._choice();
|
|
1510
1681
|
}), tap$1((choice) => this.set(choice)), catchError$1(() => of(this._choice())), shareReplay$1({
|
|
1511
1682
|
bufferSize: 1,
|
|
1512
1683
|
refCount: false
|
|
@@ -1592,7 +1763,6 @@ var CmsLoaderComponent = class CmsLoaderComponent {
|
|
|
1592
1763
|
label = input("", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
1593
1764
|
overlay = input(false, ...ngDevMode ? [{ debugName: "overlay" }] : /* istanbul ignore next */ []);
|
|
1594
1765
|
inline = input(false, ...ngDevMode ? [{ debugName: "inline" }] : /* istanbul ignore next */ []);
|
|
1595
|
-
clipId = "cms-loader-" + Math.random().toString(36).slice(2, 9);
|
|
1596
1766
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1597
1767
|
minVersion: "12.0.0",
|
|
1598
1768
|
version: "22.2.3",
|
|
@@ -1637,28 +1807,14 @@ var CmsLoaderComponent = class CmsLoaderComponent {
|
|
|
1637
1807
|
[class.cms-loader--inline]="inline()"
|
|
1638
1808
|
role="status"
|
|
1639
1809
|
[attr.aria-label]="label() || 'Loading'">
|
|
1640
|
-
<
|
|
1641
|
-
<defs>
|
|
1642
|
-
<clipPath [attr.id]="clipId">
|
|
1643
|
-
<rect class="cms-loader__wipe" x="0" y="0" width="24" height="34" />
|
|
1644
|
-
</clipPath>
|
|
1645
|
-
</defs>
|
|
1646
|
-
<!-- Ghost beneath: the mark stays legible as a SHAPE while the
|
|
1647
|
-
wipe crosses it, so the loader never looks broken mid-cycle. -->
|
|
1648
|
-
<rect class="cms-loader__ghost" x="8" y="2" width="8" height="30" rx="4" />
|
|
1649
|
-
<circle class="cms-loader__ghost" cx="12" cy="42" r="4" />
|
|
1650
|
-
|
|
1651
|
-
<rect class="cms-loader__stem" x="8" y="2" width="8" height="30" rx="4"
|
|
1652
|
-
[attr.clip-path]="'url(#' + clipId + ')'" />
|
|
1653
|
-
<circle class="cms-loader__dot" cx="12" cy="42" r="4" />
|
|
1654
|
-
</svg>
|
|
1810
|
+
<span class="cms-loader__spinner" aria-hidden="true"></span>
|
|
1655
1811
|
@if (label()) {
|
|
1656
1812
|
<span class="cms-loader__label">{{ label() }}</span>
|
|
1657
1813
|
}
|
|
1658
1814
|
</div>
|
|
1659
1815
|
`,
|
|
1660
1816
|
isInline: true,
|
|
1661
|
-
styles: [".cms-loader{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:24px;color:var(--cms-text-muted)}.cms-loader--overlay{position:absolute;inset:0;z-index:5;background:var(--cms-surface)}.cms-loader--inline{flex-direction:row;gap:8px;padding:0}.cms-
|
|
1817
|
+
styles: [".cms-loader{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:24px;color:var(--cms-text-muted)}.cms-loader--overlay{position:absolute;inset:0;z-index:5;background:var(--cms-surface)}.cms-loader--inline{flex-direction:row;gap:8px;padding:0}.cms-loader__spinner{box-sizing:border-box;width:var(--cms-loader-size, var(--cms-spinner-size-page, 32px));height:var(--cms-loader-size, var(--cms-spinner-size-page, 32px));border:var(--cms-spinner-stroke, 2px) solid var(--cms-spinner-track, var(--cms-border));border-top-color:var(--cms-spinner-color, var(--cms-accent-text));border-radius:50%;flex-shrink:0;animation:cms-loader-turn var(--cms-spinner-duration, .8s) linear infinite}.cms-loader--inline .cms-loader__spinner{width:var(--cms-loader-size, var(--cms-spinner-size-inline, 16px));height:var(--cms-loader-size, var(--cms-spinner-size-inline, 16px))}@keyframes cms-loader-turn{to{transform:rotate(360deg)}}.cms-loader__label{font-size:.8125rem}@media(prefers-reduced-motion:reduce){.cms-loader__spinner{animation:cms-loader-breathe 2s ease-in-out infinite}}@keyframes cms-loader-breathe{0%,to{opacity:.35}50%{opacity:1}}\n"],
|
|
1662
1818
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
1663
1819
|
});
|
|
1664
1820
|
};
|
|
@@ -1679,27 +1835,13 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1679
1835
|
[class.cms-loader--inline]="inline()"
|
|
1680
1836
|
role="status"
|
|
1681
1837
|
[attr.aria-label]="label() || 'Loading'">
|
|
1682
|
-
<
|
|
1683
|
-
<defs>
|
|
1684
|
-
<clipPath [attr.id]="clipId">
|
|
1685
|
-
<rect class="cms-loader__wipe" x="0" y="0" width="24" height="34" />
|
|
1686
|
-
</clipPath>
|
|
1687
|
-
</defs>
|
|
1688
|
-
<!-- Ghost beneath: the mark stays legible as a SHAPE while the
|
|
1689
|
-
wipe crosses it, so the loader never looks broken mid-cycle. -->
|
|
1690
|
-
<rect class="cms-loader__ghost" x="8" y="2" width="8" height="30" rx="4" />
|
|
1691
|
-
<circle class="cms-loader__ghost" cx="12" cy="42" r="4" />
|
|
1692
|
-
|
|
1693
|
-
<rect class="cms-loader__stem" x="8" y="2" width="8" height="30" rx="4"
|
|
1694
|
-
[attr.clip-path]="'url(#' + clipId + ')'" />
|
|
1695
|
-
<circle class="cms-loader__dot" cx="12" cy="42" r="4" />
|
|
1696
|
-
</svg>
|
|
1838
|
+
<span class="cms-loader__spinner" aria-hidden="true"></span>
|
|
1697
1839
|
@if (label()) {
|
|
1698
1840
|
<span class="cms-loader__label">{{ label() }}</span>
|
|
1699
1841
|
}
|
|
1700
1842
|
</div>
|
|
1701
1843
|
`,
|
|
1702
|
-
styles: [".cms-loader{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:24px;color:var(--cms-text-muted)}.cms-loader--overlay{position:absolute;inset:0;z-index:5;background:var(--cms-surface)}.cms-loader--inline{flex-direction:row;gap:8px;padding:0}.cms-
|
|
1844
|
+
styles: [".cms-loader{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:24px;color:var(--cms-text-muted)}.cms-loader--overlay{position:absolute;inset:0;z-index:5;background:var(--cms-surface)}.cms-loader--inline{flex-direction:row;gap:8px;padding:0}.cms-loader__spinner{box-sizing:border-box;width:var(--cms-loader-size, var(--cms-spinner-size-page, 32px));height:var(--cms-loader-size, var(--cms-spinner-size-page, 32px));border:var(--cms-spinner-stroke, 2px) solid var(--cms-spinner-track, var(--cms-border));border-top-color:var(--cms-spinner-color, var(--cms-accent-text));border-radius:50%;flex-shrink:0;animation:cms-loader-turn var(--cms-spinner-duration, .8s) linear infinite}.cms-loader--inline .cms-loader__spinner{width:var(--cms-loader-size, var(--cms-spinner-size-inline, 16px));height:var(--cms-loader-size, var(--cms-spinner-size-inline, 16px))}@keyframes cms-loader-turn{to{transform:rotate(360deg)}}.cms-loader__label{font-size:.8125rem}@media(prefers-reduced-motion:reduce){.cms-loader__spinner{animation:cms-loader-breathe 2s ease-in-out infinite}}@keyframes cms-loader-breathe{0%,to{opacity:.35}50%{opacity:1}}\n"]
|
|
1703
1845
|
}]
|
|
1704
1846
|
}],
|
|
1705
1847
|
propDecorators: {
|
|
@@ -2175,7 +2317,7 @@ function provideConsole(entries, options) {
|
|
|
2175
2317
|
provide: CONSOLE_ENTRIES,
|
|
2176
2318
|
useValue: checked
|
|
2177
2319
|
},
|
|
2178
|
-
provideStore([...options.hostStates, ...checked.flatMap((e) => e.states ?? [])]),
|
|
2320
|
+
provideStore([...options.hostStates, ...checked.flatMap((e) => e.states ?? [])], { compatibility: { strictContentSecurityPolicy: true } }),
|
|
2179
2321
|
provideAppInitializer(() => {
|
|
2180
2322
|
const registry = inject(ComponentRegistry);
|
|
2181
2323
|
for (const e of checked) for (const b of e.bindings ?? []) registry.register(b.name, b.component);
|
|
@@ -2201,6 +2343,6 @@ function shouldStamp(url) {
|
|
|
2201
2343
|
if (path.startsWith("/api/v1/auth/")) return false;
|
|
2202
2344
|
return true;
|
|
2203
2345
|
}
|
|
2204
|
-
export { AppConfigState, AppInitService, AuthRefreshCoordinator, AuthState, BACKGROUND_REQUEST, BYPASS_AUTH, BYPASS_ELEVATION, CONSOLE_CONTRACT, CONSOLE_ENTRIES, CURRENT_SECTION, CmsLoaderComponent, ComponentRegistry, ConfigService, ConsoleAccessService, ConsoleActivation, ConsoleAssemblyError, ConsolePanelHost, CrossTabAuthSyncService, ELEVATION_ACTION, ELEVATION_NOTICE, ELEVATION_PROMPT, ELEVATION_REQUIRED_HEADER, ELEVATION_WARNING_FACTOR_MISSING, ELEVATION_WARNING_MFA_OFF, ELEVATION_WARNING_PASSWORD_NOT_SET, ElevationService, EntitySearchService, ErrorHandlerService, IdentityApiClient, Login, LoginComponent, Logout, NaviGraphService, PatchCurrentUser, RealtimeTokenClient, RestoreSession, SetAppConfig, SetTokens, SidebarStateService, ThemeService, UserPreferencesService, actionOf, assembleConsole, authGuard, authInterceptor, consoleChildren, consoleEntry, consoleModuleInstalled, elevationInterceptor, installedConsoleModules, isElevationRefusal, isPortProvision, loginPageGuard, naviAccessOf, provideConsole, resolvePattern, satisfiesRange, sectionInterceptor };
|
|
2346
|
+
export { AUDIENCE_NOT_GRANTED, AUDIENCE_REQUIRED, AUTH_AUDIENCE, AppConfigState, AppInitService, AuthRefreshCoordinator, AuthState, BACKGROUND_REQUEST, BYPASS_AUTH, BYPASS_ELEVATION, CONSOLE_CONTRACT, CONSOLE_ENTRIES, CURRENT_SECTION, CmsLoaderComponent, ComponentRegistry, ConfigService, ConsoleAccessService, ConsoleActivation, ConsoleAssemblyError, ConsolePanelHost, CrossTabAuthSyncService, DATAGRID_ENTRY_PREFIX, ELEVATION_ACTION, ELEVATION_CODE_REQUIRED_TYPE, ELEVATION_NOTICE, ELEVATION_PROMPT, ELEVATION_REQUIRED_HEADER, ELEVATION_REQUIRED_PROBLEM_TYPE, ELEVATION_RETRY_TYPES, ELEVATION_WARNING_FACTOR_MISSING, ELEVATION_WARNING_MFA_OFF, ELEVATION_WARNING_PASSWORD_NOT_SET, ElevationService, EntitySearchService, ErrorHandlerService, IdentityApiClient, Login, LoginComponent, Logout, NOT_AVAILABLE, NaviGraphService, PREFERENCES_NOTICE, PatchCurrentUser, RealtimeTokenClient, RestoreSession, SOMETHING_WENT_WRONG, SetAppConfig, SetTokens, SidebarStateService, ThemeService, UserPreferencesService, WRONG_INTERFACE, actionOf, assembleConsole, audienceRefusalOf, authGuard, authInterceptor, consoleChildren, consoleEntry, consoleModuleInstalled, datagridEntry, declaredProblemOf, declaredTypeOf, elevationInterceptor, installedConsoleModules, isElevationRefusal, isPortProvision, isRefusal, loginPageGuard, naviAccessOf, problemOf, provideConsole, refusalWords, resolvePattern, satisfiesRange, sectionInterceptor, sentenceOf, sessionEndsOn };
|
|
2205
2347
|
|
|
2206
2348
|
//# sourceMappingURL=coolms-core-angular.mjs.map
|