@coolms/core-angular 2.0.0-alpha.6 → 2.0.0-alpha.8
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 +61 -0
- package/LICENSE +1 -1
- package/fesm2022/coolms-core-angular.mjs +350 -189
- package/fesm2022/coolms-core-angular.mjs.map +1 -1
- package/package.json +1 -1
- package/types/coolms-core-angular.d.ts +249 -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,19 @@ 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$;
|
|
121
|
+
}
|
|
122
|
+
getDeclaredSettings(host) {
|
|
123
|
+
const query = host === void 0 ? "" : `?host=${encodeURIComponent(host)}`;
|
|
124
|
+
return this.http.get(`${this.manifest.identity.settingsUrl}/declared${query}`, { headers: { Accept: "application/json" } });
|
|
102
125
|
}
|
|
103
126
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
104
127
|
minVersion: "12.0.0",
|
|
@@ -126,6 +149,20 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
126
149
|
args: [{ providedIn: "root" }]
|
|
127
150
|
}]
|
|
128
151
|
});
|
|
152
|
+
const AUDIENCE_NOT_GRANTED = "/errors/identity/audience-not-granted";
|
|
153
|
+
const WRONG_INTERFACE = "/errors/identity/wrong-interface";
|
|
154
|
+
const AUDIENCE_REQUIRED = "/errors/identity/audience-required";
|
|
155
|
+
function audienceRefusalOf(error) {
|
|
156
|
+
if (!(error instanceof HttpErrorResponse) || 403 !== error.status) return null;
|
|
157
|
+
const body = error.error;
|
|
158
|
+
const type = body !== null && typeof body === "object" ? body.type : void 0;
|
|
159
|
+
if ("/errors/identity/audience-not-granted" === type) return "not-granted";
|
|
160
|
+
return "/errors/identity/audience-required" === type ? "required" : null;
|
|
161
|
+
}
|
|
162
|
+
function sessionEndsOn(error) {
|
|
163
|
+
if (error instanceof HttpErrorResponse && 403 === error.status) return null !== audienceRefusalOf(error);
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
129
166
|
var Login = class {
|
|
130
167
|
identifier;
|
|
131
168
|
password;
|
|
@@ -163,8 +200,13 @@ const CROSS_TAB_KEY = "coolms.elevation.changed";
|
|
|
163
200
|
const RECONCILE_MIN_INTERVAL_MS = 2e3;
|
|
164
201
|
const ELEVATION_REQUIRED_HEADER = "X-Elevation-Required";
|
|
165
202
|
const BACKGROUND_REQUEST = new HttpContextToken(() => false);
|
|
203
|
+
const ELEVATION_REQUIRED_PROBLEM_TYPE = "/errors/elevation-required";
|
|
204
|
+
const ELEVATION_CODE_REQUIRED_TYPE = "/errors/elevation/code-required";
|
|
205
|
+
const ELEVATION_RETRY_TYPES = ["/errors/elevation/wrong-password", "/errors/elevation/wrong-code"];
|
|
166
206
|
function isElevationRefusal(err) {
|
|
167
|
-
|
|
207
|
+
if (!(err instanceof HttpErrorResponse) || err.status !== 403) return false;
|
|
208
|
+
const body = err.error;
|
|
209
|
+
return typeof body === "object" && body !== null && body.type === "/errors/elevation-required" || !!err.headers.get("X-Elevation-Required");
|
|
168
210
|
}
|
|
169
211
|
var ElevationService = class ElevationService {
|
|
170
212
|
http = inject(HttpClient);
|
|
@@ -187,6 +229,20 @@ var ElevationService = class ElevationService {
|
|
|
187
229
|
return iso ? new Date(iso) : null;
|
|
188
230
|
};
|
|
189
231
|
changes$ = new Subject();
|
|
232
|
+
retriesWaiting = signal(0, ...ngDevMode ? [{ debugName: "retriesWaiting" }] : /* istanbul ignore next */ []);
|
|
233
|
+
retriesPending = this.retriesWaiting.asReadonly();
|
|
234
|
+
retriesSettled$ = new Subject();
|
|
235
|
+
holdForRetry() {
|
|
236
|
+
this.retriesWaiting.update((n) => n + 1);
|
|
237
|
+
let held = true;
|
|
238
|
+
return () => {
|
|
239
|
+
if (held) {
|
|
240
|
+
held = false;
|
|
241
|
+
this.retriesWaiting.update((n) => n - 1);
|
|
242
|
+
if (this.retriesWaiting() === 0) this.retriesSettled$.next();
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
}
|
|
190
246
|
expiryTimer = null;
|
|
191
247
|
pendingPrompt = null;
|
|
192
248
|
expiryAnnouncePending = false;
|
|
@@ -404,115 +460,274 @@ function expiredView(state) {
|
|
|
404
460
|
}
|
|
405
461
|
};
|
|
406
462
|
}
|
|
463
|
+
const NOT_AVAILABLE = "Not available right now";
|
|
464
|
+
const SOMETHING_WENT_WRONG = "Something went wrong. Try again.";
|
|
465
|
+
function sentenceOf(text) {
|
|
466
|
+
return typeof text === "string" && text.trim() !== "" ? text : null;
|
|
467
|
+
}
|
|
468
|
+
function problemOf(error) {
|
|
469
|
+
let body = error.error;
|
|
470
|
+
if (typeof body === "string") try {
|
|
471
|
+
body = JSON.parse(body);
|
|
472
|
+
} catch {
|
|
473
|
+
return null;
|
|
474
|
+
}
|
|
475
|
+
if (typeof body !== "object" || body === null) return null;
|
|
476
|
+
const prototype = Object.getPrototypeOf(body);
|
|
477
|
+
return prototype === Object.prototype || prototype === null ? body : null;
|
|
478
|
+
}
|
|
479
|
+
const FRAMEWORK_FAULT = /^\/errors\/5\d\d$/;
|
|
480
|
+
function declaredProblemOf(error) {
|
|
481
|
+
if (!(error instanceof HttpErrorResponse)) return null;
|
|
482
|
+
const problem = problemOf(error);
|
|
483
|
+
const type = problem?.["type"];
|
|
484
|
+
return typeof type === "string" && type.trim() !== "" && type !== "about:blank" && !FRAMEWORK_FAULT.test(type) ? problem : null;
|
|
485
|
+
}
|
|
486
|
+
function declaredTypeOf(error) {
|
|
487
|
+
const type = declaredProblemOf(error)?.["type"];
|
|
488
|
+
return typeof type === "string" ? type : null;
|
|
489
|
+
}
|
|
490
|
+
function isRefusal(error) {
|
|
491
|
+
return error instanceof HttpErrorResponse && error.status >= 400 && error.status <= 499;
|
|
492
|
+
}
|
|
493
|
+
function firstFieldMessageOf(error) {
|
|
494
|
+
if (!(error instanceof HttpErrorResponse) || error.status !== 422) return null;
|
|
495
|
+
const violations = problemOf(error)?.["violations"];
|
|
496
|
+
if (!Array.isArray(violations)) return null;
|
|
497
|
+
for (const one of violations) {
|
|
498
|
+
const message = typeof one === "object" && one !== null ? sentenceOf(one.message) : null;
|
|
499
|
+
if (message !== null) return message;
|
|
500
|
+
}
|
|
501
|
+
return null;
|
|
502
|
+
}
|
|
503
|
+
function refusalWords(error) {
|
|
504
|
+
const field = firstFieldMessageOf(error);
|
|
505
|
+
if (field !== null) return field;
|
|
506
|
+
const problem = declaredProblemOf(error);
|
|
507
|
+
if (problem === null) return SOMETHING_WENT_WRONG;
|
|
508
|
+
return sentenceOf(problem["detail"]) ?? "Not available right now";
|
|
509
|
+
}
|
|
510
|
+
var ErrorHandlerService = class ErrorHandlerService {
|
|
511
|
+
humanize(err) {
|
|
512
|
+
return refusalWords(err);
|
|
513
|
+
}
|
|
514
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
515
|
+
minVersion: "12.0.0",
|
|
516
|
+
version: "22.2.3",
|
|
517
|
+
ngImport: i0,
|
|
518
|
+
type: ErrorHandlerService,
|
|
519
|
+
deps: [],
|
|
520
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
521
|
+
});
|
|
522
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
523
|
+
minVersion: "12.0.0",
|
|
524
|
+
version: "22.2.3",
|
|
525
|
+
ngImport: i0,
|
|
526
|
+
type: ErrorHandlerService,
|
|
527
|
+
providedIn: "root"
|
|
528
|
+
});
|
|
529
|
+
};
|
|
530
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
531
|
+
minVersion: "12.0.0",
|
|
532
|
+
version: "22.2.3",
|
|
533
|
+
ngImport: i0,
|
|
534
|
+
type: ErrorHandlerService,
|
|
535
|
+
decorators: [{
|
|
536
|
+
type: Injectable,
|
|
537
|
+
args: [{ providedIn: "root" }]
|
|
538
|
+
}]
|
|
539
|
+
});
|
|
540
|
+
const PREFERENCES_NOTICE = new InjectionToken("coolms.preferences-notice");
|
|
541
|
+
const DATAGRID_ENTRY_PREFIX = "datagrid:";
|
|
542
|
+
function datagridEntry(gridId) {
|
|
543
|
+
return DATAGRID_ENTRY_PREFIX + gridId;
|
|
544
|
+
}
|
|
545
|
+
const NAMESPACES = /* @__PURE__ */ new Set([
|
|
546
|
+
"grids",
|
|
547
|
+
"panel",
|
|
548
|
+
"page",
|
|
549
|
+
"terminal",
|
|
550
|
+
"nav"
|
|
551
|
+
]);
|
|
552
|
+
function isObject(value) {
|
|
553
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
554
|
+
}
|
|
555
|
+
function gridPrefOf(entry) {
|
|
556
|
+
if (!isObject(entry)) return null;
|
|
557
|
+
const pref = {};
|
|
558
|
+
if (Array.isArray(entry["columns"])) pref.columns = entry["columns"];
|
|
559
|
+
if (isObject(entry["columnWidths"])) pref.columnWidths = entry["columnWidths"];
|
|
560
|
+
return pref.columns === void 0 && pref.columnWidths === void 0 ? null : pref;
|
|
561
|
+
}
|
|
407
562
|
var UserPreferencesService = class UserPreferencesService {
|
|
408
563
|
http = inject(HttpClient);
|
|
409
564
|
store = inject(Store);
|
|
410
565
|
destroyRef = inject(DestroyRef);
|
|
566
|
+
errors = inject(ErrorHandlerService);
|
|
567
|
+
notice = inject(PREFERENCES_NOTICE, { optional: true });
|
|
568
|
+
document = inject(DOCUMENT);
|
|
411
569
|
STORAGE_KEY = "coolms_ui_prefs";
|
|
412
570
|
SYNC_DELAY = 2e3;
|
|
571
|
+
RETRY_DELAYS = [
|
|
572
|
+
5e3,
|
|
573
|
+
3e4,
|
|
574
|
+
12e4
|
|
575
|
+
];
|
|
576
|
+
pending = /* @__PURE__ */ new Map();
|
|
413
577
|
syncSubject = new Subject();
|
|
578
|
+
failures = 0;
|
|
579
|
+
retryTimer = null;
|
|
414
580
|
constructor() {
|
|
415
|
-
this.syncSubject.pipe(debounceTime(this.SYNC_DELAY), takeUntilDestroyed(this.destroyRef)).subscribe((
|
|
581
|
+
this.syncSubject.pipe(debounceTime(this.SYNC_DELAY), takeUntilDestroyed(this.destroyRef)).subscribe(() => this.flush());
|
|
582
|
+
const win = this.document.defaultView;
|
|
583
|
+
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());
|
|
584
|
+
this.destroyRef.onDestroy(() => this.cancelRetry());
|
|
416
585
|
}
|
|
417
|
-
save(all) {
|
|
418
|
-
|
|
419
|
-
this.
|
|
586
|
+
save(all, ...changed) {
|
|
587
|
+
this.write(all);
|
|
588
|
+
for (const id of changed) this.pending.set(id, all[id] ?? {});
|
|
589
|
+
this.syncSubject.next();
|
|
420
590
|
}
|
|
421
|
-
|
|
591
|
+
write(all) {
|
|
592
|
+
try {
|
|
593
|
+
localStorage.setItem(this.STORAGE_KEY, JSON.stringify(all));
|
|
594
|
+
} catch {}
|
|
595
|
+
}
|
|
596
|
+
readLocal() {
|
|
422
597
|
try {
|
|
423
598
|
const raw = localStorage.getItem(this.STORAGE_KEY);
|
|
424
599
|
const all = raw ? JSON.parse(raw) : {};
|
|
425
|
-
return
|
|
600
|
+
return isObject(all) ? all : {};
|
|
426
601
|
} catch {
|
|
427
602
|
return {};
|
|
428
603
|
}
|
|
429
604
|
}
|
|
605
|
+
load() {
|
|
606
|
+
const all = this.readLocal();
|
|
607
|
+
if (this.migrate(all)) this.write(all);
|
|
608
|
+
return all;
|
|
609
|
+
}
|
|
430
610
|
migrate(all) {
|
|
431
611
|
let dirty = false;
|
|
432
612
|
if (typeof all["terminal_height"] === "number") {
|
|
433
|
-
const terminal = all["terminal"]
|
|
613
|
+
const terminal = isObject(all["terminal"]) ? all["terminal"] : {};
|
|
434
614
|
terminal["height"] = all["terminal_height"];
|
|
435
615
|
all["terminal"] = terminal;
|
|
436
616
|
delete all["terminal_height"];
|
|
437
617
|
dirty = true;
|
|
438
618
|
}
|
|
439
619
|
if (typeof all["media_view_mode"] === "string") {
|
|
440
|
-
const page = all["page"]
|
|
441
|
-
const media = page["media"]
|
|
620
|
+
const page = isObject(all["page"]) ? all["page"] : {};
|
|
621
|
+
const media = isObject(page["media"]) ? page["media"] : {};
|
|
442
622
|
media["viewMode"] = all["media_view_mode"];
|
|
443
623
|
page["media"] = media;
|
|
444
624
|
all["page"] = page;
|
|
445
625
|
delete all["media_view_mode"];
|
|
446
626
|
dirty = true;
|
|
447
627
|
}
|
|
448
|
-
if (all["media_collections_panel"]
|
|
449
|
-
const panel = all["panel"]
|
|
628
|
+
if (isObject(all["media_collections_panel"])) {
|
|
629
|
+
const panel = isObject(all["panel"]) ? all["panel"] : {};
|
|
450
630
|
panel["media_panel_left"] = all["media_collections_panel"];
|
|
451
631
|
all["panel"] = panel;
|
|
452
632
|
delete all["media_collections_panel"];
|
|
453
633
|
dirty = true;
|
|
454
634
|
}
|
|
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] = {};
|
|
635
|
+
for (const id of Object.keys(all)) if (Array.isArray(all[id])) {
|
|
636
|
+
all[id] = {};
|
|
464
637
|
dirty = true;
|
|
465
638
|
}
|
|
639
|
+
const moved = [];
|
|
640
|
+
const toEntry = (gridId, pref) => {
|
|
641
|
+
const id = datagridEntry(gridId);
|
|
642
|
+
if (isObject(pref) && !(id in all)) {
|
|
643
|
+
all[id] = pref;
|
|
644
|
+
moved.push(id);
|
|
645
|
+
}
|
|
646
|
+
};
|
|
466
647
|
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
|
-
}
|
|
648
|
+
if (NAMESPACES.has(key) || key.includes(":") || !isObject(all[key])) continue;
|
|
649
|
+
const obj = all[key];
|
|
650
|
+
if ("columns" in obj || "columnWidths" in obj) {
|
|
651
|
+
toEntry(key, obj);
|
|
652
|
+
delete all[key];
|
|
653
|
+
dirty = true;
|
|
478
654
|
}
|
|
479
655
|
}
|
|
480
|
-
if (
|
|
481
|
-
|
|
656
|
+
if ("grids" in all) {
|
|
657
|
+
const grids = all["grids"];
|
|
658
|
+
if (isObject(grids)) for (const [gridId, pref] of Object.entries(grids)) toEntry(gridId, pref);
|
|
659
|
+
delete all["grids"];
|
|
660
|
+
dirty = true;
|
|
661
|
+
}
|
|
662
|
+
if (moved.length > 0) {
|
|
663
|
+
for (const id of moved) this.pending.set(id, all[id]);
|
|
664
|
+
this.syncSubject.next();
|
|
665
|
+
}
|
|
666
|
+
return dirty;
|
|
482
667
|
}
|
|
483
668
|
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));
|
|
669
|
+
if (!isObject(uiPrefs) || Object.keys(uiPrefs).length === 0) return;
|
|
670
|
+
const all = this.readLocal();
|
|
671
|
+
const oldGrids = isObject(uiPrefs["grids"]) ? { ...uiPrefs["grids"] } : null;
|
|
672
|
+
for (const [id, value] of Object.entries(uiPrefs)) {
|
|
673
|
+
if (id === "grids" || this.pending.has(id)) continue;
|
|
674
|
+
all[id] = value;
|
|
498
675
|
}
|
|
676
|
+
if (oldGrids !== null) all["grids"] = {
|
|
677
|
+
...oldGrids,
|
|
678
|
+
...isObject(all["grids"]) ? all["grids"] : {}
|
|
679
|
+
};
|
|
680
|
+
this.migrate(all);
|
|
681
|
+
this.write(all);
|
|
499
682
|
}
|
|
500
|
-
|
|
683
|
+
flush() {
|
|
684
|
+
this.cancelRetry();
|
|
685
|
+
if (this.pending.size === 0) return;
|
|
686
|
+
const entries = Object.fromEntries(this.pending);
|
|
687
|
+
this.pending.clear();
|
|
688
|
+
this.syncToServer(entries);
|
|
689
|
+
}
|
|
690
|
+
syncToServer(entries) {
|
|
501
691
|
const url = this.store.selectSnapshot(AppConfigState.manifest)?.auth?.preferencesUrl;
|
|
502
692
|
if (!url) return;
|
|
503
|
-
this.http.patch(url, { uiPrefs:
|
|
693
|
+
this.http.patch(url, { uiPrefs: entries }, {
|
|
504
694
|
headers: { "Content-Type": "application/merge-patch+json" },
|
|
505
695
|
context: new HttpContext().set(BACKGROUND_REQUEST, true)
|
|
506
|
-
}).subscribe({
|
|
696
|
+
}).subscribe({
|
|
697
|
+
next: () => {
|
|
698
|
+
this.failures = 0;
|
|
699
|
+
},
|
|
700
|
+
error: (err) => this.refused(err, entries)
|
|
701
|
+
});
|
|
507
702
|
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
703
|
+
scheduleRetry() {
|
|
704
|
+
if (this.retryTimer !== null) return;
|
|
705
|
+
const delay = this.RETRY_DELAYS[Math.min(this.failures, this.RETRY_DELAYS.length) - 1];
|
|
706
|
+
this.retryTimer = setTimeout(() => {
|
|
707
|
+
this.retryTimer = null;
|
|
708
|
+
this.flush();
|
|
709
|
+
}, delay);
|
|
710
|
+
}
|
|
711
|
+
cancelRetry() {
|
|
712
|
+
if (this.retryTimer !== null) {
|
|
713
|
+
clearTimeout(this.retryTimer);
|
|
714
|
+
this.retryTimer = null;
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
refused(err, entries) {
|
|
718
|
+
if (err instanceof HttpErrorResponse && err.status === 422) {
|
|
719
|
+
const sentence = `Your preferences could not be saved: ${this.errors.humanize(err)}`;
|
|
720
|
+
if (this.notice) this.notice.refused(sentence);
|
|
721
|
+
else console.warn(sentence);
|
|
722
|
+
return;
|
|
515
723
|
}
|
|
724
|
+
for (const [id, value] of Object.entries(entries)) if (!this.pending.has(id)) this.pending.set(id, value);
|
|
725
|
+
this.failures++;
|
|
726
|
+
this.scheduleRetry();
|
|
727
|
+
console.warn("Preferences sync failed:", err);
|
|
728
|
+
}
|
|
729
|
+
getGridPref(gridId) {
|
|
730
|
+
return gridPrefOf(this.load()[datagridEntry(gridId)]);
|
|
516
731
|
}
|
|
517
732
|
setColumns(gridId, columns) {
|
|
518
733
|
this.updateGrid(gridId, (existing) => ({
|
|
@@ -530,19 +745,25 @@ var UserPreferencesService = class UserPreferencesService {
|
|
|
530
745
|
}));
|
|
531
746
|
}
|
|
532
747
|
resetGrid(gridId) {
|
|
748
|
+
const id = datagridEntry(gridId);
|
|
533
749
|
const all = this.load();
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
750
|
+
delete all[id];
|
|
751
|
+
this.write(all);
|
|
752
|
+
this.pending.set(id, {
|
|
753
|
+
columns: null,
|
|
754
|
+
columnWidths: null
|
|
755
|
+
});
|
|
756
|
+
this.flush();
|
|
539
757
|
}
|
|
540
758
|
updateGrid(gridId, updater) {
|
|
759
|
+
const id = datagridEntry(gridId);
|
|
541
760
|
const all = this.load();
|
|
542
|
-
const
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
761
|
+
const entry = isObject(all[id]) ? all[id] : {};
|
|
762
|
+
all[id] = {
|
|
763
|
+
...entry,
|
|
764
|
+
...updater(gridPrefOf(entry) ?? {})
|
|
765
|
+
};
|
|
766
|
+
this.save(all, id);
|
|
546
767
|
}
|
|
547
768
|
getTerminalHeight() {
|
|
548
769
|
const terminal = this.load()["terminal"];
|
|
@@ -550,10 +771,10 @@ var UserPreferencesService = class UserPreferencesService {
|
|
|
550
771
|
}
|
|
551
772
|
setTerminalHeight(height) {
|
|
552
773
|
const all = this.load();
|
|
553
|
-
const terminal = all["terminal"]
|
|
774
|
+
const terminal = isObject(all["terminal"]) ? all["terminal"] : {};
|
|
554
775
|
terminal["height"] = Math.round(height);
|
|
555
776
|
all["terminal"] = terminal;
|
|
556
|
-
this.save(all);
|
|
777
|
+
this.save(all, "terminal");
|
|
557
778
|
}
|
|
558
779
|
getPanelState(key) {
|
|
559
780
|
try {
|
|
@@ -572,13 +793,13 @@ var UserPreferencesService = class UserPreferencesService {
|
|
|
572
793
|
}
|
|
573
794
|
setPanelState(key, width, collapsed) {
|
|
574
795
|
const all = this.load();
|
|
575
|
-
const panel = all["panel"]
|
|
796
|
+
const panel = isObject(all["panel"]) ? all["panel"] : {};
|
|
576
797
|
panel[key] = {
|
|
577
798
|
width: Math.round(width),
|
|
578
799
|
collapsed
|
|
579
800
|
};
|
|
580
801
|
all["panel"] = panel;
|
|
581
|
-
this.save(all);
|
|
802
|
+
this.save(all, "panel");
|
|
582
803
|
}
|
|
583
804
|
getPageState(pageKey) {
|
|
584
805
|
try {
|
|
@@ -591,13 +812,13 @@ var UserPreferencesService = class UserPreferencesService {
|
|
|
591
812
|
}
|
|
592
813
|
setPageState(pageKey, state) {
|
|
593
814
|
const all = this.load();
|
|
594
|
-
const page = all["page"]
|
|
815
|
+
const page = isObject(all["page"]) ? all["page"] : {};
|
|
595
816
|
page[pageKey] = {
|
|
596
|
-
...page[pageKey]
|
|
817
|
+
...isObject(page[pageKey]) ? page[pageKey] : {},
|
|
597
818
|
...state
|
|
598
819
|
};
|
|
599
820
|
all["page"] = page;
|
|
600
|
-
this.save(all);
|
|
821
|
+
this.save(all, "page");
|
|
601
822
|
}
|
|
602
823
|
getMediaViewMode() {
|
|
603
824
|
return this.getPageState("media")?.viewMode ?? null;
|
|
@@ -677,10 +898,8 @@ let AuthState = class AuthState {
|
|
|
677
898
|
if (!raw) return;
|
|
678
899
|
try {
|
|
679
900
|
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);
|
|
901
|
+
if (state.accessToken || state.refreshToken) ctx.setState(state);
|
|
902
|
+
else localStorage.removeItem(STORAGE_KEY$2);
|
|
684
903
|
} catch {
|
|
685
904
|
localStorage.removeItem(STORAGE_KEY$2);
|
|
686
905
|
}
|
|
@@ -775,6 +994,7 @@ var ConsoleAccessService = class ConsoleAccessService {
|
|
|
775
994
|
static URL = "/api/v1/admin/manifest";
|
|
776
995
|
static LEGACY_URL = "/api/v1/console/manifest";
|
|
777
996
|
static REFUSED_REASON = "no-console-access";
|
|
997
|
+
static SIGN_IN_AGAIN_REASON = "sign-in-again";
|
|
778
998
|
http = inject(HttpClient);
|
|
779
999
|
store = inject(Store);
|
|
780
1000
|
answer = "unknown";
|
|
@@ -796,7 +1016,7 @@ var ConsoleAccessService = class ConsoleAccessService {
|
|
|
796
1016
|
access: "granted",
|
|
797
1017
|
response
|
|
798
1018
|
})), catchError((error) => of({
|
|
799
|
-
access: error
|
|
1019
|
+
access: accessOf(error),
|
|
800
1020
|
response: null
|
|
801
1021
|
})))).then(({ access, response }) => {
|
|
802
1022
|
if (askedFor !== this.generation) return this.ensure();
|
|
@@ -849,6 +1069,11 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
849
1069
|
}],
|
|
850
1070
|
ctorParameters: () => []
|
|
851
1071
|
});
|
|
1072
|
+
function accessOf(error) {
|
|
1073
|
+
const refusal = audienceRefusalOf(error);
|
|
1074
|
+
if ("not-granted" === refusal) return "refused";
|
|
1075
|
+
return "required" === refusal ? "sign-in-again" : "unknown";
|
|
1076
|
+
}
|
|
852
1077
|
const BACKGROUND = { context: new HttpContext().set(BACKGROUND_REQUEST, true) };
|
|
853
1078
|
var RealtimeTokenClient = class RealtimeTokenClient {
|
|
854
1079
|
static REFUSED = "no console access: no realtime connection";
|
|
@@ -861,7 +1086,7 @@ var RealtimeTokenClient = class RealtimeTokenClient {
|
|
|
861
1086
|
return m;
|
|
862
1087
|
}
|
|
863
1088
|
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)));
|
|
1089
|
+
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
1090
|
}
|
|
866
1091
|
subscriptionToken(channel) {
|
|
867
1092
|
return this.http.post(this.manifest.apiBase + "/centrifugo/subscription-token", { channel }, BACKGROUND);
|
|
@@ -903,9 +1128,14 @@ var AuthRefreshCoordinator = class AuthRefreshCoordinator {
|
|
|
903
1128
|
refresh(refreshToken, refusedAccessToken = null) {
|
|
904
1129
|
if (this.inFlight) return this.inFlight;
|
|
905
1130
|
this.inFlight = defer(() => this.refreshWithCrossTabLock(refreshToken, refusedAccessToken)).pipe(catchError((refreshErr) => {
|
|
906
|
-
|
|
1131
|
+
const isAuthFailure = refreshErr instanceof HttpErrorResponse && refreshErr.status === 401;
|
|
1132
|
+
const refusal = audienceRefusalOf(refreshErr);
|
|
1133
|
+
if (isAuthFailure || null !== refusal) {
|
|
907
1134
|
this.store.dispatch(new Logout());
|
|
908
|
-
if (this.router.navigated)
|
|
1135
|
+
if (this.router.navigated) {
|
|
1136
|
+
const reason = null === refusal ? null : "required" === refusal ? ConsoleAccessService.SIGN_IN_AGAIN_REASON : ConsoleAccessService.REFUSED_REASON;
|
|
1137
|
+
null === reason ? this.router.navigate(["/login"]) : this.router.navigate(["/login"], { queryParams: { reason } });
|
|
1138
|
+
}
|
|
909
1139
|
}
|
|
910
1140
|
return throwError(() => refreshErr);
|
|
911
1141
|
}), shareReplay(1), finalize(() => {
|
|
@@ -1103,7 +1333,8 @@ var AppInitService = class AppInitService {
|
|
|
1103
1333
|
}
|
|
1104
1334
|
async validateSession(meUrl) {
|
|
1105
1335
|
const token = this.store.selectSnapshot(AuthState.accessToken);
|
|
1106
|
-
|
|
1336
|
+
const first = await this.probe(meUrl, token);
|
|
1337
|
+
if (true === first || !sessionEndsOn(first)) return;
|
|
1107
1338
|
const refreshToken = this.store.selectSnapshot(AuthState.refreshToken);
|
|
1108
1339
|
if (!refreshToken) {
|
|
1109
1340
|
this.store.dispatch(new Logout());
|
|
@@ -1115,13 +1346,17 @@ var AppInitService = class AppInitService {
|
|
|
1115
1346
|
} catch {
|
|
1116
1347
|
return;
|
|
1117
1348
|
}
|
|
1118
|
-
|
|
1349
|
+
const again = await this.probe(meUrl, refreshedToken);
|
|
1350
|
+
if (true !== again && sessionEndsOn(again)) this.store.dispatch(new Logout());
|
|
1119
1351
|
}
|
|
1120
1352
|
probe(url, token) {
|
|
1121
1353
|
return firstValueFrom(this.http.get(url, {
|
|
1122
1354
|
context: new HttpContext().set(BYPASS_AUTH, true),
|
|
1123
1355
|
headers: token ? { Authorization: `Bearer ${token}` } : {}
|
|
1124
|
-
}).pipe(
|
|
1356
|
+
}).pipe(tap((me) => {
|
|
1357
|
+
const uiPrefs = me?.uiPrefs;
|
|
1358
|
+
if (uiPrefs !== null && typeof uiPrefs === "object" && !Array.isArray(uiPrefs)) this.prefs.loadFromServer(uiPrefs);
|
|
1359
|
+
}), map(() => true), catchError((error) => of(error))));
|
|
1125
1360
|
}
|
|
1126
1361
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1127
1362
|
minVersion: "12.0.0",
|
|
@@ -1158,7 +1393,9 @@ const authGuard = () => {
|
|
|
1158
1393
|
if (!store.selectSnapshot(AuthState.isAuthenticated)) return of(router.createUrlTree(["/login"]));
|
|
1159
1394
|
return from(consoleAccess.ensure()).pipe(switchMap((access) => {
|
|
1160
1395
|
if (!store.selectSnapshot(AuthState.isAuthenticated)) return of(router.createUrlTree(["/login"]));
|
|
1161
|
-
|
|
1396
|
+
if ("refused" !== access && "sign-in-again" !== access) return of(true);
|
|
1397
|
+
const reason = "refused" === access ? ConsoleAccessService.REFUSED_REASON : ConsoleAccessService.SIGN_IN_AGAIN_REASON;
|
|
1398
|
+
return consoleAccess.signOut().pipe(map(() => router.createUrlTree(["/login"], { queryParams: { reason } })));
|
|
1162
1399
|
}));
|
|
1163
1400
|
}));
|
|
1164
1401
|
};
|
|
@@ -1174,63 +1411,6 @@ const loginPageGuard = () => {
|
|
|
1174
1411
|
const ELEVATION_WARNING_PASSWORD_NOT_SET = "elevation.password_not_set";
|
|
1175
1412
|
const ELEVATION_WARNING_FACTOR_MISSING = "elevation.factor_missing";
|
|
1176
1413
|
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
1414
|
const READS = /* @__PURE__ */ new Set([
|
|
1235
1415
|
"GET",
|
|
1236
1416
|
"HEAD",
|
|
@@ -1250,11 +1430,12 @@ const elevationInterceptor = (req, next) => {
|
|
|
1250
1430
|
return throwError(() => err);
|
|
1251
1431
|
};
|
|
1252
1432
|
if (!elevation.canPrompt) return decline();
|
|
1433
|
+
const release = elevation.holdForRetry();
|
|
1253
1434
|
return elevation.refresh().pipe(switchMap((state) => state.elevated ? of(true) : elevation.requestElevation({
|
|
1254
1435
|
state,
|
|
1255
1436
|
refusal,
|
|
1256
1437
|
action
|
|
1257
|
-
})), catchError(() => of(false)), switchMap((granted) => granted ? next(req) : decline()));
|
|
1438
|
+
})), catchError(() => of(false)), switchMap((granted) => granted ? next(req) : decline()), finalize(release));
|
|
1258
1439
|
}));
|
|
1259
1440
|
};
|
|
1260
1441
|
function actionOf(req, apiBase = "/api/v1") {
|
|
@@ -1281,12 +1462,17 @@ var LoginComponent = class LoginComponent {
|
|
|
1281
1462
|
error = signal(null, ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
|
|
1282
1463
|
store = inject(Store);
|
|
1283
1464
|
router = inject(Router);
|
|
1284
|
-
static NO_CONSOLE_ACCESS = "This account
|
|
1465
|
+
static NO_CONSOLE_ACCESS = "This account may not enter the admin.";
|
|
1466
|
+
static SIGN_IN_AGAIN = "Please sign in again.";
|
|
1285
1467
|
constructor() {
|
|
1286
1468
|
inject(ActivatedRoute).queryParamMap.pipe(takeUntilDestroyed()).subscribe((params) => {
|
|
1287
|
-
|
|
1469
|
+
const reason = params.get("reason");
|
|
1470
|
+
if (ConsoleAccessService.REFUSED_REASON === reason) {
|
|
1288
1471
|
this.loading.set(false);
|
|
1289
1472
|
this.error.set(LoginComponent.NO_CONSOLE_ACCESS);
|
|
1473
|
+
} else if (ConsoleAccessService.SIGN_IN_AGAIN_REASON === reason) {
|
|
1474
|
+
this.loading.set(false);
|
|
1475
|
+
this.error.set(LoginComponent.SIGN_IN_AGAIN);
|
|
1290
1476
|
}
|
|
1291
1477
|
});
|
|
1292
1478
|
}
|
|
@@ -1303,6 +1489,10 @@ var LoginComponent = class LoginComponent {
|
|
|
1303
1489
|
},
|
|
1304
1490
|
error: (err) => {
|
|
1305
1491
|
this.loading.set(false);
|
|
1492
|
+
if ("not-granted" === audienceRefusalOf(err)) {
|
|
1493
|
+
this.error.set(LoginComponent.NO_CONSOLE_ACCESS);
|
|
1494
|
+
return;
|
|
1495
|
+
}
|
|
1306
1496
|
this.error.set(err?.error?.detail ?? err?.error?.message ?? err?.message ?? "Invalid credentials. Please try again.");
|
|
1307
1497
|
}
|
|
1308
1498
|
});
|
|
@@ -1504,9 +1694,9 @@ var ThemeService = class ThemeService {
|
|
|
1504
1694
|
if (this.loadOnce$) return this.loadOnce$;
|
|
1505
1695
|
this.readPlatformAccent();
|
|
1506
1696
|
this.loadOnce$ = this.api.getSettings().pipe(map$1((all) => {
|
|
1507
|
-
const
|
|
1508
|
-
this.setAccent(isAccent(
|
|
1509
|
-
return isChoice(
|
|
1697
|
+
const appearance = all["appearance"];
|
|
1698
|
+
this.setAccent(isAccent(appearance?.["accentColor"]) ? appearance["accentColor"] : null);
|
|
1699
|
+
return isChoice(appearance?.["theme"]) ? appearance["theme"] : this._choice();
|
|
1510
1700
|
}), tap$1((choice) => this.set(choice)), catchError$1(() => of(this._choice())), shareReplay$1({
|
|
1511
1701
|
bufferSize: 1,
|
|
1512
1702
|
refCount: false
|
|
@@ -1592,7 +1782,6 @@ var CmsLoaderComponent = class CmsLoaderComponent {
|
|
|
1592
1782
|
label = input("", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
1593
1783
|
overlay = input(false, ...ngDevMode ? [{ debugName: "overlay" }] : /* istanbul ignore next */ []);
|
|
1594
1784
|
inline = input(false, ...ngDevMode ? [{ debugName: "inline" }] : /* istanbul ignore next */ []);
|
|
1595
|
-
clipId = "cms-loader-" + Math.random().toString(36).slice(2, 9);
|
|
1596
1785
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1597
1786
|
minVersion: "12.0.0",
|
|
1598
1787
|
version: "22.2.3",
|
|
@@ -1637,28 +1826,14 @@ var CmsLoaderComponent = class CmsLoaderComponent {
|
|
|
1637
1826
|
[class.cms-loader--inline]="inline()"
|
|
1638
1827
|
role="status"
|
|
1639
1828
|
[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>
|
|
1829
|
+
<span class="cms-loader__spinner" aria-hidden="true"></span>
|
|
1655
1830
|
@if (label()) {
|
|
1656
1831
|
<span class="cms-loader__label">{{ label() }}</span>
|
|
1657
1832
|
}
|
|
1658
1833
|
</div>
|
|
1659
1834
|
`,
|
|
1660
1835
|
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-
|
|
1836
|
+
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
1837
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
1663
1838
|
});
|
|
1664
1839
|
};
|
|
@@ -1679,27 +1854,13 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1679
1854
|
[class.cms-loader--inline]="inline()"
|
|
1680
1855
|
role="status"
|
|
1681
1856
|
[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>
|
|
1857
|
+
<span class="cms-loader__spinner" aria-hidden="true"></span>
|
|
1697
1858
|
@if (label()) {
|
|
1698
1859
|
<span class="cms-loader__label">{{ label() }}</span>
|
|
1699
1860
|
}
|
|
1700
1861
|
</div>
|
|
1701
1862
|
`,
|
|
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-
|
|
1863
|
+
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
1864
|
}]
|
|
1704
1865
|
}],
|
|
1705
1866
|
propDecorators: {
|
|
@@ -2175,7 +2336,7 @@ function provideConsole(entries, options) {
|
|
|
2175
2336
|
provide: CONSOLE_ENTRIES,
|
|
2176
2337
|
useValue: checked
|
|
2177
2338
|
},
|
|
2178
|
-
provideStore([...options.hostStates, ...checked.flatMap((e) => e.states ?? [])]),
|
|
2339
|
+
provideStore([...options.hostStates, ...checked.flatMap((e) => e.states ?? [])], { compatibility: { strictContentSecurityPolicy: true } }),
|
|
2179
2340
|
provideAppInitializer(() => {
|
|
2180
2341
|
const registry = inject(ComponentRegistry);
|
|
2181
2342
|
for (const e of checked) for (const b of e.bindings ?? []) registry.register(b.name, b.component);
|
|
@@ -2201,6 +2362,6 @@ function shouldStamp(url) {
|
|
|
2201
2362
|
if (path.startsWith("/api/v1/auth/")) return false;
|
|
2202
2363
|
return true;
|
|
2203
2364
|
}
|
|
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 };
|
|
2365
|
+
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
2366
|
|
|
2206
2367
|
//# sourceMappingURL=coolms-core-angular.mjs.map
|