@osovitny/anatoly 3.16.15 → 3.16.17

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 (69) hide show
  1. package/esm2022/lib/anatoly.module.mjs +15 -1
  2. package/esm2022/lib/core/interceptors/httpInterceptor.mjs +4 -4
  3. package/esm2022/lib/core/localization/localization.service.mjs +15 -8
  4. package/esm2022/lib/core/localization/utils.mjs +2 -2
  5. package/esm2022/lib/core/logging/globalErrorHandler.mjs +3 -3
  6. package/esm2022/lib/core/logging/logging.service.mjs +2 -2
  7. package/esm2022/lib/core/services/appcontext.service.mjs +14 -2
  8. package/esm2022/lib/core/services/dm.service.mjs +3 -3
  9. package/esm2022/lib/core/services/google-analytics.service.mjs +2 -2
  10. package/esm2022/lib/core/services/starter.service.mjs +9 -4
  11. package/esm2022/lib/iam/b2c/b2c.mjs +43 -0
  12. package/esm2022/lib/iam/b2c/consts.mjs +25 -0
  13. package/esm2022/lib/iam/b2c/index.mjs +21 -0
  14. package/esm2022/lib/iam/configs.mjs +107 -0
  15. package/esm2022/lib/iam/consts.mjs +23 -0
  16. package/esm2022/lib/iam/guards/admin.guard.mjs +47 -0
  17. package/esm2022/lib/iam/guards/authentication.guard.mjs +31 -0
  18. package/esm2022/lib/iam/guards/index.mjs +20 -0
  19. package/esm2022/lib/iam/iam-pages.module.mjs +54 -0
  20. package/esm2022/lib/iam/iam-pages.routes.mjs +45 -0
  21. package/esm2022/lib/iam/iam.module.mjs +100 -0
  22. package/esm2022/lib/iam/index.mjs +18 -0
  23. package/esm2022/lib/iam/pages/signin.page.mjs +40 -0
  24. package/esm2022/lib/iam/pages/signout.page.mjs +40 -0
  25. package/esm2022/lib/iam/pages/signup.page.mjs +39 -0
  26. package/esm2022/lib/iam/redirect.mjs +29 -0
  27. package/esm2022/lib/iam/services/auth.service.mjs +246 -0
  28. package/esm2022/lib/iam/storage.mjs +39 -0
  29. package/esm2022/lib/ui/components/base/base.component.mjs +8 -4
  30. package/esm2022/lib/ui/components/billing/buyaccess-button.component.mjs +2 -2
  31. package/esm2022/lib/ui/components/billing/subscribe-plan-button.component.mjs +3 -3
  32. package/esm2022/lib/ui/components/html-editor/base-html-editor.component.mjs +3 -3
  33. package/esm2022/lib/ui/components/spinners/loading/loading.component.mjs +7 -12
  34. package/esm2022/lib/ui/components/spinners/pagespinner/pagespinner.component.mjs +2 -2
  35. package/esm2022/lib/ui/forms/components/urlslug/urlslug.component.mjs +1 -1
  36. package/esm2022/lib/ui/pipes/filesize.pipe.mjs +2 -2
  37. package/esm2022/lib/ui/pipes/replace-text.pipe.mjs +2 -2
  38. package/esm2022/lib/ui/pipes/safeHtml.pipe.mjs +2 -2
  39. package/esm2022/lib/ui/validation/form-validation-summary.component.mjs +3 -3
  40. package/esm2022/lib/ui/validation/item-validation-summary.component.mjs +4 -4
  41. package/esm2022/lib/ui/validation/validation-summary.component.mjs +3 -3
  42. package/esm2022/public-api.mjs +5 -1
  43. package/fesm2022/osovitny-anatoly.mjs +1074 -142
  44. package/fesm2022/osovitny-anatoly.mjs.map +1 -1
  45. package/lib/anatoly.module.d.ts +4 -2
  46. package/lib/core/localization/localization.service.d.ts +8 -5
  47. package/lib/core/services/appcontext.service.d.ts +2 -0
  48. package/lib/iam/b2c/b2c.d.ts +5 -0
  49. package/lib/iam/b2c/consts.d.ts +6 -0
  50. package/lib/iam/b2c/index.d.ts +2 -0
  51. package/lib/iam/configs.d.ts +5 -0
  52. package/lib/iam/consts.d.ts +3 -0
  53. package/lib/iam/guards/admin.guard.d.ts +13 -0
  54. package/lib/iam/guards/authentication.guard.d.ts +13 -0
  55. package/lib/iam/guards/index.d.ts +2 -0
  56. package/lib/iam/iam-pages.module.d.ts +12 -0
  57. package/lib/iam/iam-pages.routes.d.ts +6 -0
  58. package/lib/iam/iam.module.d.ts +9 -0
  59. package/lib/iam/index.d.ts +1 -0
  60. package/lib/iam/pages/signin.page.d.ts +11 -0
  61. package/lib/iam/pages/signout.page.d.ts +11 -0
  62. package/lib/iam/pages/signup.page.d.ts +11 -0
  63. package/lib/iam/redirect.d.ts +3 -0
  64. package/lib/iam/services/auth.service.d.ts +37 -0
  65. package/lib/iam/storage.d.ts +8 -0
  66. package/lib/ui/components/base/base.component.d.ts +2 -1
  67. package/lib/ui/components/spinners/loading/loading.component.d.ts +3 -4
  68. package/package.json +1 -1
  69. package/public-api.d.ts +3 -0
@@ -1,12 +1,12 @@
1
1
  import js_beautify from 'js-beautify';
2
2
  import * as i0 from '@angular/core';
3
- import { Injectable, Pipe, APP_INITIALIZER, Injector, NgModule, Inject, Component, Input, EventEmitter, Output, ViewEncapsulation, Directive, ViewChild, HostBinding, HostListener, Optional, SkipSelf } from '@angular/core';
3
+ import { Injectable, EventEmitter, Output, Pipe, APP_INITIALIZER, Injector, NgModule, Inject, Component, Input, ViewEncapsulation, Directive, ViewChild, HostBinding, HostListener, Optional, SkipSelf } from '@angular/core';
4
4
  import * as i1 from '@angular/router';
5
5
  import { NavigationEnd, NavigationStart, NavigationCancel, NavigationError, RouterModule } from '@angular/router';
6
6
  import * as i1$3 from '@angular/common/http';
7
- import { HttpResponse, HttpClientModule, HttpClient } from '@angular/common/http';
7
+ import { HttpResponse, HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
8
8
  import { tap, map } from 'rxjs/operators';
9
- import { BehaviorSubject, Subject, timer, merge, fromEvent, of, forkJoin } from 'rxjs';
9
+ import { BehaviorSubject, Subject, timer, merge, fromEvent, of, forkJoin, filter, takeUntil, map as map$1, catchError } from 'rxjs';
10
10
  import { isValid, format, formatDistance, formatDistanceToNow } from 'date-fns';
11
11
  import { utcToZonedTime } from 'date-fns-tz';
12
12
  import enUS from 'date-fns/locale/en-US';
@@ -20,6 +20,9 @@ import * as i1$2 from 'ngx-toastr';
20
20
  import { ToastrModule } from 'ngx-toastr';
21
21
  import * as i1$4 from '@angular/platform-browser';
22
22
  import { v4 } from 'uuid';
23
+ import * as i4 from '@azure/msal-angular';
24
+ import { MSAL_GUARD_CONFIG, MsalGuard, MsalInterceptor, MSAL_INTERCEPTOR_CONFIG, MSAL_INSTANCE, MsalService, MsalBroadcastService, MsalModule } from '@azure/msal-angular';
25
+ import { EventType, InteractionStatus, InteractionType, InteractionRequiredAuthError, PublicClientApplication, LogLevel } from '@azure/msal-browser';
23
26
  import * as i1$6 from '@fortawesome/angular-fontawesome';
24
27
  import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
25
28
  import * as i1$7 from '@progress/kendo-angular-pager';
@@ -350,7 +353,7 @@ class LoadingService extends BehaviorSubject {
350
353
  Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
351
354
  </file>
352
355
  */
353
- // Node
356
+ //Node
354
357
  class LoggingService {
355
358
  constructor() { }
356
359
  logError(error) {
@@ -380,11 +383,11 @@ class LoggingService {
380
383
 
381
384
  Created:
382
385
  25 March 2020
383
-
386
+
384
387
  Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
385
388
  </file>
386
389
  */
387
- // Node
390
+ //Node
388
391
  class AnatolyHttpInterceptor {
389
392
  loadingService;
390
393
  loggingService;
@@ -467,6 +470,36 @@ class AnatolyHttpInterceptor {
467
470
  type: Injectable
468
471
  }], function () { return [{ type: LoadingService }, { type: LoggingService }]; }, null); })();
469
472
 
473
+ /*
474
+ <file>
475
+ Project:
476
+ @osovitny/anatoly
477
+
478
+ Authors:
479
+ Vadim Osovitny vadim@osovitny.com
480
+ Anatoly Osovitny anatoly@osovitny.com
481
+
482
+ Created:
483
+ 26 Jun 2020
484
+
485
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
486
+ </file>
487
+ */
488
+ class Subs {
489
+ subs = [];
490
+ constructor() { }
491
+ add(...subscriptions) {
492
+ this.subs = this.subs.concat(subscriptions);
493
+ }
494
+ set sink(subscription) {
495
+ this.subs.push(subscription);
496
+ }
497
+ unsubscribe() {
498
+ this.subs.forEach((sub) => sub && sub.unsubscribe());
499
+ this.subs = [];
500
+ }
501
+ }
502
+
470
503
  /*
471
504
  <file>
472
505
  Project:
@@ -485,17 +518,21 @@ class AnatolyHttpInterceptor {
485
518
  //Node
486
519
  class LocalizationService {
487
520
  translate;
521
+ subs = new Subs();
488
522
  dateFnsLocale;
489
523
  //i10n
490
524
  supportedLanguages = ['en', 'ru', 'es'];
491
525
  defaultLanguage = 'en';
492
- //Events
493
- onLangChange = null;
526
+ //Outputs
527
+ langchange = new EventEmitter();
494
528
  constructor(translate) {
495
529
  this.translate = translate;
496
530
  this.setSupportedLanguages(this.supportedLanguages);
497
531
  this.setDefaultLanguage(this.defaultLanguage);
498
532
  }
533
+ ngOnDestroy() {
534
+ this.subs.unsubscribe();
535
+ }
499
536
  format(str, args) {
500
537
  return str.replace(/{(\d+)}/g, function (match, number) {
501
538
  return typeof args[number] != 'undefined'
@@ -510,9 +547,9 @@ class LocalizationService {
510
547
  const lang = browserLang.match(/en|ru|es/) ? browserLang : this.defaultLanguage;
511
548
  //dates
512
549
  this.dateFnsLocale = { locale: enUS };
513
- //Events
514
- this.onLangChange = this.translate.onLangChange.subscribe((event) => {
515
- console.log('Lang Changed');
550
+ this.subs.sink = this.translate.onLangChange.subscribe((event) => {
551
+ console.log('Language Changed');
552
+ this.langchange.emit(event.lang);
516
553
  });
517
554
  return lang;
518
555
  }
@@ -654,7 +691,9 @@ class LocalizationService {
654
691
  args: [{
655
692
  providedIn: 'root'
656
693
  }]
657
- }], function () { return [{ type: i1$1.TranslateService }]; }, null); })();
694
+ }], function () { return [{ type: i1$1.TranslateService }]; }, { langchange: [{
695
+ type: Output
696
+ }] }); })();
658
697
 
659
698
  /*
660
699
  <file>
@@ -877,7 +916,7 @@ class LocalizationModule {
877
916
  https://medium.com/@amcdnl/global-error-handling-with-angular2-6b992bdfb59c
878
917
  https://medium.com/angular-in-depth/expecting-the-unexpected-best-practices-for-error-handling-in-angular-21c3662ef9e4
879
918
  */
880
- // Node
919
+ //Node
881
920
  class GlobalErrorHandler {
882
921
  injector;
883
922
  constructor(injector) {
@@ -927,7 +966,7 @@ class GlobalErrorHandler {
927
966
  Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
928
967
  </file>
929
968
  */
930
- // App
969
+ //App
931
970
  class L10nUtils {
932
971
  // @dynamic
933
972
  static get localizationService() {
@@ -1490,7 +1529,7 @@ class AppContextService extends ApiServiceBase {
1490
1529
  this.clearLocalStorage();
1491
1530
  this.clearSessionStorage();
1492
1531
  }
1493
- //Properties
1532
+ //current
1494
1533
  get current() {
1495
1534
  this.updateCurrentIfExpired();
1496
1535
  return this.getCurrentFromSession();
@@ -1498,6 +1537,18 @@ class AppContextService extends ApiServiceBase {
1498
1537
  set current(value) {
1499
1538
  this.setCurrentFromSession(value);
1500
1539
  }
1540
+ //currentUser
1541
+ get currentUser() {
1542
+ let current = this.current;
1543
+ return current?.User;
1544
+ }
1545
+ set currentUser(value) {
1546
+ let current = this.current;
1547
+ if (current) {
1548
+ current.User = value;
1549
+ this.current = current;
1550
+ }
1551
+ }
1501
1552
  static ɵfac = function AppContextService_Factory(t) { return new (t || AppContextService)(i0.ɵɵinject(i1$3.HttpClient), i0.ɵɵinject(LocalStorageService), i0.ɵɵinject(SessionStorageService)); };
1502
1553
  static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AppContextService, factory: AppContextService.ɵfac });
1503
1554
  }
@@ -1516,11 +1567,11 @@ class AppContextService extends ApiServiceBase {
1516
1567
 
1517
1568
  Created:
1518
1569
  29 Nov 2020
1519
-
1570
+
1520
1571
  Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
1521
1572
  </file>
1522
1573
  */
1523
- // Node
1574
+ //Node
1524
1575
  class DigitalMarketingService {
1525
1576
  title;
1526
1577
  meta;
@@ -1588,7 +1639,7 @@ class DigitalMarketingService {
1588
1639
  Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
1589
1640
  </file>
1590
1641
  */
1591
- // Node
1642
+ //Node
1592
1643
  class GoogleAnalyticsService {
1593
1644
  router;
1594
1645
  subscription;
@@ -1852,9 +1903,14 @@ class StarterServiceBase extends ApiServiceBase {
1852
1903
  parallelTasks.push(requiredItems$);
1853
1904
  let parallelTasks$ = merge(...parallelTasks);
1854
1905
  let tasks$ = forkJoin([applicationStarting$, parallelTasks$]);
1855
- //VadimOS:
1856
- //concat is NOT wokring here, no idea why. Just executing first task
1857
- //let tasks$ = concat(applicationStarting$, parallelTasks$);
1906
+ /*
1907
+ VadimOS:
1908
+ concat is NOT wokring here, no idea why. Just executing first task
1909
+ let tasks$ = concat(applicationStarting$, parallelTasks$);
1910
+
1911
+ https://github.com/ReactiveX/rxjs/issues/2427
1912
+ https://github.com/ReactiveX/rxjs/issues/2188
1913
+ */
1858
1914
  //Log
1859
1915
  let stopwatch = new Stopwatch("ensureApplicationStarted");
1860
1916
  stopwatch.start();
@@ -2064,36 +2120,6 @@ class Guid {
2064
2120
  }
2065
2121
  }
2066
2122
 
2067
- /*
2068
- <file>
2069
- Project:
2070
- @osovitny/anatoly
2071
-
2072
- Authors:
2073
- Vadim Osovitny vadim@osovitny.com
2074
- Anatoly Osovitny anatoly@osovitny.com
2075
-
2076
- Created:
2077
- 26 Jun 2020
2078
-
2079
- Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
2080
- </file>
2081
- */
2082
- class Subs {
2083
- subs = [];
2084
- constructor() { }
2085
- add(...subscriptions) {
2086
- this.subs = this.subs.concat(subscriptions);
2087
- }
2088
- set sink(subscription) {
2089
- this.subs.push(subscription);
2090
- }
2091
- unsubscribe() {
2092
- this.subs.forEach((sub) => sub && sub.unsubscribe());
2093
- this.subs = [];
2094
- }
2095
- }
2096
-
2097
2123
  /*
2098
2124
  <file>
2099
2125
  Project:
@@ -2381,6 +2407,346 @@ class EmailsApiService extends ApiServiceBase {
2381
2407
  */
2382
2408
  //base
2383
2409
 
2410
+ /*
2411
+ <file>
2412
+ Project:
2413
+ @osovitny/anatoly
2414
+
2415
+ Authors:
2416
+ Vadim Osovitny vadim@osovitny.com
2417
+ Anatoly Osovitny anatoly@osovitny.com
2418
+
2419
+ Created:
2420
+ 20 Sep 2023
2421
+
2422
+ Description:
2423
+ Identity and Access Management
2424
+
2425
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
2426
+ </file>
2427
+ */
2428
+ let msalSettings = document.getElementById("msalSettings").getAttribute('data-msalsettings');
2429
+ let MSALConfig = JSON.parse(msalSettings);
2430
+ let MSALApiConfig = MSALConfig?.api;
2431
+ let MSALB2CConfig = MSALConfig?.b2c;
2432
+
2433
+ /*
2434
+ <file>
2435
+ Project:
2436
+ @osovitny/anatoly
2437
+
2438
+ Authors:
2439
+ Vadim Osovitny vadim@osovitny.com
2440
+ Anatoly Osovitny anatoly@osovitny.com
2441
+
2442
+ Created:
2443
+ 20 Sep 2023
2444
+
2445
+ Description:
2446
+ Identity and Access Management
2447
+
2448
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
2449
+ </file>
2450
+ */
2451
+ const MSALStorageKeys = {
2452
+ //LocalStorage
2453
+ redirectTo: 'msal.app.redirectTo'
2454
+ //SessionStorage
2455
+ };
2456
+ class MSALStorage {
2457
+ static saveRedirectState(redirectTo, calledBy) {
2458
+ localStorage.setItem(MSALStorageKeys.redirectTo, redirectTo);
2459
+ console.log(`msal.app: redirect state saved: ${redirectTo}. Called by: ${calledBy}`);
2460
+ }
2461
+ static getRedirectState(calledBy) {
2462
+ let redirectTo = localStorage.getItem(MSALStorageKeys.redirectTo);
2463
+ console.log(`msal.app: redirect state requested: ${redirectTo}. Called by: ${calledBy}`);
2464
+ return redirectTo;
2465
+ }
2466
+ static clearRedirectState(calledBy) {
2467
+ localStorage.removeItem(MSALStorageKeys.redirectTo);
2468
+ console.log(`msal.app: redirect state cleared. Called by: ${calledBy}`);
2469
+ }
2470
+ }
2471
+
2472
+ /*
2473
+ <file>
2474
+ Project:
2475
+ @osovitny/anatoly
2476
+
2477
+ Authors:
2478
+ Vadim Osovitny vadim@osovitny.com
2479
+ Anatoly Osovitny anatoly@osovitny.com
2480
+
2481
+ Created:
2482
+ 20 Sep 2023
2483
+
2484
+ Description:
2485
+ Identity and Access Management
2486
+
2487
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
2488
+ </file>
2489
+ */
2490
+ class MSALRedirect {
2491
+ static handle(router, calledBy) {
2492
+ let redirectTo = MSALStorage.getRedirectState(calledBy);
2493
+ if (redirectTo) {
2494
+ MSALStorage.clearRedirectState(calledBy);
2495
+ router.navigate([redirectTo]);
2496
+ }
2497
+ }
2498
+ }
2499
+
2500
+ class AuthService extends ApiServiceBase {
2501
+ http;
2502
+ router;
2503
+ appContext;
2504
+ msalGuardConfig;
2505
+ msalService;
2506
+ msalBroadcastService;
2507
+ msalDestroying$ = new Subject();
2508
+ initialized = false;
2509
+ constructor(http, router, appContext, msalGuardConfig, msalService, msalBroadcastService) {
2510
+ super(http);
2511
+ this.http = http;
2512
+ this.router = router;
2513
+ this.appContext = appContext;
2514
+ this.msalGuardConfig = msalGuardConfig;
2515
+ this.msalService = msalService;
2516
+ this.msalBroadcastService = msalBroadcastService;
2517
+ this.init();
2518
+ }
2519
+ ngOnDestroy() {
2520
+ this.msalDestroying$.next(undefined);
2521
+ this.msalDestroying$.complete();
2522
+ }
2523
+ init() {
2524
+ this.setDefaults();
2525
+ this.msalService.initialize().subscribe(() => {
2526
+ this.initialized = true;
2527
+ console.log(`msal.app: initMSAL started`);
2528
+ this.initMSAL();
2529
+ console.log(`msal.app: initMSAL finished`);
2530
+ });
2531
+ }
2532
+ setDefaults() {
2533
+ }
2534
+ initMSAL() {
2535
+ this.msalService.instance.enableAccountStorageEvents();
2536
+ this.msalService.handleRedirectObservable().subscribe({
2537
+ next: (result) => {
2538
+ console.log(`msal.app: handleRedirectObservable`);
2539
+ },
2540
+ error: (error) => {
2541
+ console.log(error);
2542
+ }
2543
+ });
2544
+ this.msalBroadcastService.msalSubject$
2545
+ .pipe(filter((msg) => msg.eventType === EventType.INITIALIZE_END ||
2546
+ msg.eventType === EventType.ACCOUNT_ADDED ||
2547
+ msg.eventType === EventType.ACCOUNT_REMOVED ||
2548
+ msg.eventType === EventType.LOGIN_SUCCESS ||
2549
+ msg.eventType === EventType.LOGIN_FAILURE ||
2550
+ msg.eventType === EventType.LOGOUT_SUCCESS ||
2551
+ msg.eventType === EventType.LOGOUT_FAILURE), takeUntil(this.msalDestroying$))
2552
+ .subscribe((msg) => {
2553
+ switch (msg.eventType) {
2554
+ case EventType.INITIALIZE_END:
2555
+ console.log(`msal.app: INITIALIZE_END fired`);
2556
+ break;
2557
+ case EventType.ACCOUNT_ADDED:
2558
+ case EventType.LOGIN_SUCCESS:
2559
+ let payload = msg.payload;
2560
+ if (payload) {
2561
+ this.msalService.instance.setActiveAccount(payload.account);
2562
+ }
2563
+ break;
2564
+ case EventType.ACCOUNT_REMOVED:
2565
+ if (this.msalService.instance.getAllAccounts().length === 0) {
2566
+ window.location.pathname = "/";
2567
+ }
2568
+ break;
2569
+ }
2570
+ });
2571
+ this.msalBroadcastService.inProgress$
2572
+ .pipe(filter((status) => status === InteractionStatus.Startup ||
2573
+ status === InteractionStatus.None), takeUntil(this.msalDestroying$))
2574
+ .subscribe((status) => {
2575
+ switch (status) {
2576
+ /**
2577
+ * Initial status before interaction occurs
2578
+ */
2579
+ case InteractionStatus.Startup:
2580
+ console.log(`msal.app: InteractionStatus.Startup`);
2581
+ break;
2582
+ /**
2583
+ * Status set when interaction is complete
2584
+ */
2585
+ case InteractionStatus.None:
2586
+ console.log(`msal.app: InteractionStatus.None`);
2587
+ MSALRedirect.handle(this.router, 'msalBroadcastService.inProgress$ InteractionStatus.None');
2588
+ this.checkAndSetActiveAccount();
2589
+ break;
2590
+ }
2591
+ });
2592
+ }
2593
+ getActiveAccount() {
2594
+ this.checkAndSetActiveAccount();
2595
+ return this.msalService.instance.getActiveAccount();
2596
+ }
2597
+ checkAndSetActiveAccount() {
2598
+ let activeAccount = this.msalService.instance.getActiveAccount();
2599
+ let accounts = this.msalService.instance.getAllAccounts();
2600
+ if (!activeAccount && accounts.length > 0) {
2601
+ this.msalService.instance.setActiveAccount(accounts[0]);
2602
+ }
2603
+ }
2604
+ isPopup(popup) {
2605
+ if (typeof popup === "undefined") {
2606
+ return this.msalGuardConfig.interactionType === InteractionType.Popup;
2607
+ }
2608
+ return popup;
2609
+ }
2610
+ acquireToken() {
2611
+ let request = {
2612
+ scopes: MSALApiConfig.scopes
2613
+ };
2614
+ if (this.isPopup()) {
2615
+ return this.msalService.acquireTokenPopup(request).pipe(map$1(response => {
2616
+ return response ? response.accessToken : null;
2617
+ }));
2618
+ }
2619
+ else {
2620
+ return this.msalService.acquireTokenRedirect(request).pipe(map$1(() => {
2621
+ return null;
2622
+ }));
2623
+ }
2624
+ }
2625
+ getUserEmail() {
2626
+ let currentUser = this.appContext.currentUser;
2627
+ let activeAccount = this.getActiveAccount();
2628
+ if (activeAccount) {
2629
+ return activeAccount.username;
2630
+ }
2631
+ return currentUser ? currentUser.Email : '';
2632
+ }
2633
+ getUserName() {
2634
+ let currentUser = this.appContext.currentUser;
2635
+ let activeAccount = this.getActiveAccount();
2636
+ if (activeAccount) {
2637
+ return activeAccount.name ? activeAccount.name : currentUser ? currentUser.displayNameOrFullName : '';
2638
+ }
2639
+ return currentUser ? currentUser.displayNameOrFullName : '';
2640
+ }
2641
+ /*
2642
+ VadimOS:
2643
+ WARNING to all developers! Be sure that you really need to directly call this method!
2644
+ */
2645
+ getAccessToken(requestUrl) {
2646
+ let activeAccount = this.getActiveAccount();
2647
+ let silentRequest = {
2648
+ scopes: MSALApiConfig.scopes,
2649
+ account: activeAccount
2650
+ };
2651
+ if (activeAccount) {
2652
+ return this.msalService.acquireTokenSilent(silentRequest).pipe(map$1(response => {
2653
+ return response.accessToken;
2654
+ }), catchError(error => {
2655
+ console.log("Silent token acquisition fails.");
2656
+ if (error instanceof InteractionRequiredAuthError) {
2657
+ return this.acquireToken();
2658
+ }
2659
+ return of(null);
2660
+ }));
2661
+ }
2662
+ return this.acquireToken();
2663
+ }
2664
+ login(popup) {
2665
+ let authRequest = this.msalGuardConfig.authRequest;
2666
+ if (this.isPopup(popup)) {
2667
+ if (authRequest) {
2668
+ return this.msalService.loginPopup({ ...authRequest }).pipe(map$1((response) => {
2669
+ this.msalService.instance.setActiveAccount(response.account);
2670
+ }));
2671
+ }
2672
+ else {
2673
+ return this.msalService.loginPopup().pipe(map$1((response) => {
2674
+ this.msalService.instance.setActiveAccount(response.account);
2675
+ }));
2676
+ }
2677
+ }
2678
+ else {
2679
+ if (authRequest) {
2680
+ return this.msalService.loginRedirect({ ...authRequest });
2681
+ }
2682
+ else {
2683
+ return this.msalService.loginRedirect();
2684
+ }
2685
+ }
2686
+ }
2687
+ logout(popup) {
2688
+ let activeAccount = this.getActiveAccount();
2689
+ if (!activeAccount) {
2690
+ return of(null);
2691
+ }
2692
+ if (this.isPopup(popup)) {
2693
+ return this.msalService.logoutPopup({ account: activeAccount, mainWindowRedirectUri: "/" }).pipe(map$1(() => {
2694
+ this.appContext.clearWebStorage();
2695
+ }));
2696
+ }
2697
+ else {
2698
+ return this.msalService.logoutRedirect({ account: activeAccount }).pipe(map$1(() => {
2699
+ this.appContext.clearWebStorage();
2700
+ }));
2701
+ }
2702
+ }
2703
+ isUserAuthenticated() {
2704
+ return this.msalService.instance.getActiveAccount() != null;
2705
+ }
2706
+ isUserSignedIn() {
2707
+ if (!this.isUserAuthenticated()) {
2708
+ return false;
2709
+ }
2710
+ let currentUser = this.appContext.currentUser;
2711
+ return currentUser && currentUser.UserID;
2712
+ }
2713
+ isUserAdmin() {
2714
+ if (!this.isUserSignedIn()) {
2715
+ return false;
2716
+ }
2717
+ let currentUser = this.appContext.currentUser;
2718
+ return currentUser && currentUser.isUserAdmin;
2719
+ }
2720
+ static ɵfac = function AuthService_Factory(t) { return new (t || AuthService)(i0.ɵɵinject(i1$3.HttpClient), i0.ɵɵinject(i1.Router), i0.ɵɵinject(AppContextService), i0.ɵɵinject(MSAL_GUARD_CONFIG), i0.ɵɵinject(i4.MsalService), i0.ɵɵinject(i4.MsalBroadcastService)); };
2721
+ static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AuthService, factory: AuthService.ɵfac, providedIn: 'root' });
2722
+ }
2723
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthService, [{
2724
+ type: Injectable,
2725
+ args: [{
2726
+ providedIn: 'root'
2727
+ }]
2728
+ }], function () { return [{ type: i1$3.HttpClient }, { type: i1.Router }, { type: AppContextService }, { type: undefined, decorators: [{
2729
+ type: Inject,
2730
+ args: [MSAL_GUARD_CONFIG]
2731
+ }] }, { type: i4.MsalService }, { type: i4.MsalBroadcastService }]; }, null); })();
2732
+
2733
+ /*
2734
+ <file>
2735
+ Project:
2736
+ @osovitny/anatoly
2737
+
2738
+ Authors:
2739
+ Vadim Osovitny vadim@osovitny.com
2740
+ Anatoly Osovitny anatoly@osovitny.com
2741
+
2742
+ Created:
2743
+ 27 Nov 2023
2744
+
2745
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
2746
+ </file>
2747
+ */
2748
+ //services
2749
+
2384
2750
  /*
2385
2751
  <file>
2386
2752
  Project:
@@ -2429,7 +2795,7 @@ class SignUpButtonComponent {
2429
2795
  Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
2430
2796
  </file>
2431
2797
  */
2432
- // Node
2798
+ //Node
2433
2799
  function BuyAccessButtonComponent_div_0_div_1_Template(rf, ctx) { if (rf & 1) {
2434
2800
  i0.ɵɵelementStart(0, "div");
2435
2801
  i0.ɵɵelement(1, "anatoly-signup-button", 1);
@@ -2529,11 +2895,11 @@ class BuyAccessButtonComponent {
2529
2895
 
2530
2896
  Created:
2531
2897
  1 Jun 2018
2532
-
2898
+
2533
2899
  Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
2534
2900
  </file>
2535
2901
  */
2536
- // Node
2902
+ //Node
2537
2903
  function SubscribePlanButtonComponent_div_0_div_1_Template(rf, ctx) { if (rf & 1) {
2538
2904
  i0.ɵɵelementStart(0, "div");
2539
2905
  i0.ɵɵelement(1, "anatoly-signup-button", 1);
@@ -2900,38 +3266,94 @@ class NodataComponent {
2900
3266
  Anatoly Osovitny anatoly@osovitny.com
2901
3267
 
2902
3268
  Created:
2903
- 9 May 2020
3269
+ 28 Aug 2018
2904
3270
 
2905
3271
  Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
2906
3272
  </file>
2907
3273
  */
2908
- // Node
2909
- function LoadingComponent_div_0_Template(rf, ctx) { if (rf & 1) {
2910
- i0.ɵɵelementStart(0, "div", 1);
2911
- i0.ɵɵelement(1, "span", 2);
2912
- i0.ɵɵelementEnd();
2913
- } }
2914
- class LoadingComponent {
2915
- loadingService;
2916
- // Private
3274
+ //Node
3275
+ class BaseComponent {
2917
3276
  subs = new Subs();
2918
- // Public
2919
- show = false;
2920
- constructor(loadingService) {
2921
- this.loadingService = loadingService;
3277
+ //Component Data => usually loading from API
3278
+ dataLoading = true;
3279
+ dataLoaded = false;
3280
+ dataFound = false;
3281
+ //Inputs
3282
+ classes;
3283
+ ngOnDestroy() {
3284
+ this.subs.unsubscribe();
2922
3285
  }
2923
- ngOnInit() {
2924
- this.subs.sink = this.loadingService.subscribe({
2925
- next: (data) => {
3286
+ getEntityId() {
3287
+ return this.getValueByNameInQS("id");
3288
+ }
3289
+ getValueByNameInQS(name) {
3290
+ let value = Utils.getValueByNameInQS(name);
3291
+ if (typeof value === "undefined" || value == "")
3292
+ return null;
3293
+ return value;
3294
+ }
3295
+ dataStartedLoading() {
3296
+ this.dataLoading = true;
3297
+ this.dataLoaded = false;
3298
+ this.dataFound = false;
3299
+ }
3300
+ dataLoadedAndNothingFound() {
3301
+ this.dataLoadedAndFound(false);
3302
+ }
3303
+ dataLoadedAndFound(found = true) {
3304
+ this.dataLoading = false;
3305
+ this.dataLoaded = true;
3306
+ this.dataFound = found;
3307
+ }
3308
+ static ɵfac = function BaseComponent_Factory(t) { return new (t || BaseComponent)(); };
3309
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: BaseComponent, selectors: [["ng-component"]], inputs: { classes: "classes" }, decls: 0, vars: 0, template: function BaseComponent_Template(rf, ctx) { }, encapsulation: 2 });
3310
+ }
3311
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BaseComponent, [{
3312
+ type: Component,
3313
+ args: [{
3314
+ template: ''
3315
+ }]
3316
+ }], null, { classes: [{
3317
+ type: Input
3318
+ }] }); })();
3319
+
3320
+ /*
3321
+ <file>
3322
+ Project:
3323
+ @osovitny/anatoly
3324
+
3325
+ Authors:
3326
+ Vadim Osovitny vadim@osovitny.com
3327
+ Anatoly Osovitny anatoly@osovitny.com
3328
+
3329
+ Created:
3330
+ 9 May 2020
3331
+
3332
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
3333
+ </file>
3334
+ */
3335
+ //Node
3336
+ function LoadingComponent_div_0_Template(rf, ctx) { if (rf & 1) {
3337
+ i0.ɵɵelementStart(0, "div", 1);
3338
+ i0.ɵɵelement(1, "span", 2);
3339
+ i0.ɵɵelementEnd();
3340
+ } }
3341
+ class LoadingComponent extends BaseComponent {
3342
+ loadingService;
3343
+ show = false;
3344
+ constructor(loadingService) {
3345
+ super();
3346
+ this.loadingService = loadingService;
3347
+ }
3348
+ ngOnInit() {
3349
+ this.subs.sink = this.loadingService.subscribe({
3350
+ next: (data) => {
2926
3351
  this.show = data;
2927
3352
  }
2928
3353
  });
2929
3354
  }
2930
- ngOnDestroy() {
2931
- this.subs.unsubscribe();
2932
- }
2933
3355
  static ɵfac = function LoadingComponent_Factory(t) { return new (t || LoadingComponent)(i0.ɵɵdirectiveInject(LoadingService)); };
2934
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: LoadingComponent, selectors: [["anatoly-loading"]], decls: 1, vars: 1, consts: [["id", "pnlLoading", 4, "ngIf"], ["id", "pnlLoading"], [1, "k-icon", "k-i-loading"]], template: function LoadingComponent_Template(rf, ctx) { if (rf & 1) {
3356
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: LoadingComponent, selectors: [["anatoly-loading"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 1, consts: [["id", "pnlLoading", 4, "ngIf"], ["id", "pnlLoading"], [1, "k-icon", "k-i-loading"]], template: function LoadingComponent_Template(rf, ctx) { if (rf & 1) {
2935
3357
  i0.ɵɵtemplate(0, LoadingComponent_div_0_Template, 2, 0, "div", 0);
2936
3358
  } if (rf & 2) {
2937
3359
  i0.ɵɵproperty("ngIf", ctx.show);
@@ -2969,7 +3391,7 @@ const Spinkit = {
2969
3391
  Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
2970
3392
  </file>
2971
3393
  */
2972
- // Node
3394
+ //Node
2973
3395
  function PageSpinnerComponent_div_0_div_2_Template(rf, ctx) { if (rf & 1) {
2974
3396
  i0.ɵɵelementStart(0, "div", 4);
2975
3397
  i0.ɵɵelement(1, "div", 5);
@@ -3325,63 +3747,6 @@ const DefaultEditorOptions = {
3325
3747
  imageUploadParams: { uploadType: "", uploadParentId: "" },
3326
3748
  };
3327
3749
 
3328
- /*
3329
- <file>
3330
- Project:
3331
- @osovitny/anatoly
3332
-
3333
- Authors:
3334
- Vadim Osovitny vadim@osovitny.com
3335
- Anatoly Osovitny anatoly@osovitny.com
3336
-
3337
- Created:
3338
- 28 Aug 2018
3339
-
3340
- Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
3341
- </file>
3342
- */
3343
- //Node
3344
- class BaseComponent {
3345
- subs = new Subs();
3346
- //Component Data => usually loading from API
3347
- dataLoading = true;
3348
- dataLoaded = false;
3349
- dataFound = false;
3350
- ngOnDestroy() {
3351
- this.subs.unsubscribe();
3352
- }
3353
- getEntityId() {
3354
- return this.getValueByNameInQS("id");
3355
- }
3356
- getValueByNameInQS(name) {
3357
- let value = Utils.getValueByNameInQS(name);
3358
- if (typeof value === "undefined" || value == "")
3359
- return null;
3360
- return value;
3361
- }
3362
- dataStartedLoading() {
3363
- this.dataLoading = true;
3364
- this.dataLoaded = false;
3365
- this.dataFound = false;
3366
- }
3367
- dataLoadedAndNothingFound() {
3368
- this.dataLoadedAndFound(false);
3369
- }
3370
- dataLoadedAndFound(found = true) {
3371
- this.dataLoading = false;
3372
- this.dataLoaded = true;
3373
- this.dataFound = found;
3374
- }
3375
- static ɵfac = function BaseComponent_Factory(t) { return new (t || BaseComponent)(); };
3376
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: BaseComponent, selectors: [["ng-component"]], decls: 0, vars: 0, template: function BaseComponent_Template(rf, ctx) { }, encapsulation: 2 });
3377
- }
3378
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BaseComponent, [{
3379
- type: Component,
3380
- args: [{
3381
- template: ''
3382
- }]
3383
- }], null, null); })();
3384
-
3385
3750
  /*
3386
3751
  <file>
3387
3752
  Project:
@@ -3511,7 +3876,7 @@ class BaseEditComponent extends BaseComponent {
3511
3876
  type: Input
3512
3877
  }] }); })();
3513
3878
 
3514
- // Node
3879
+ //Node
3515
3880
  class BaseHtmlEditorComponent extends BaseEditComponent {
3516
3881
  froalaEditor;
3517
3882
  // Public members
@@ -3653,7 +4018,7 @@ class NativeElementDirective {
3653
4018
  Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
3654
4019
  </file>
3655
4020
  */
3656
- // Node
4021
+ //Node
3657
4022
  class ValidationSummaryComponent extends BaseEditComponent {
3658
4023
  constructor() {
3659
4024
  super();
@@ -3770,11 +4135,11 @@ class ValidationSummaryComponent extends BaseEditComponent {
3770
4135
 
3771
4136
  Created:
3772
4137
  6 Dec 2017
3773
-
4138
+
3774
4139
  Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
3775
4140
  </file>
3776
4141
  */
3777
- // Node
4142
+ //Node
3778
4143
  function ItemValidationSummaryComponent_ul_0_li_1_Template(rf, ctx) { if (rf & 1) {
3779
4144
  i0.ɵɵelementStart(0, "li")(1, "span", 3);
3780
4145
  i0.ɵɵtext(2);
@@ -4173,7 +4538,7 @@ class BasePagedPage extends BasePage {
4173
4538
  Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
4174
4539
  </file>
4175
4540
  */
4176
- // Node
4541
+ //Node
4177
4542
  function FormValidationSummaryComponent_div_0_li_4_Template(rf, ctx) { if (rf & 1) {
4178
4543
  i0.ɵɵelementStart(0, "li")(1, "span");
4179
4544
  i0.ɵɵtext(2);
@@ -5226,7 +5591,7 @@ class TimezoneDropdownlist extends BaseEditComponent {
5226
5591
  Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
5227
5592
  </file>
5228
5593
  */
5229
- // Node
5594
+ //Node
5230
5595
  class FileSizePipe {
5231
5596
  units = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];
5232
5597
  transform(bytes = 0, precision = 0) {
@@ -5264,7 +5629,7 @@ class FileSizePipe {
5264
5629
  Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
5265
5630
  </file>
5266
5631
  */
5267
- // Node
5632
+ //Node
5268
5633
  class ReplaceTextPipe {
5269
5634
  transform(inputData, search, replacement) {
5270
5635
  if (inputData) {
@@ -5299,7 +5664,7 @@ class ReplaceTextPipe {
5299
5664
  Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
5300
5665
  </file>
5301
5666
  */
5302
- // Node
5667
+ //Node
5303
5668
  class SafeHtmlPipe {
5304
5669
  sanitized;
5305
5670
  constructor(sanitized) {
@@ -5459,6 +5824,561 @@ class AnatolyDataModule {
5459
5824
  }], null, null); })();
5460
5825
  (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(AnatolyDataModule, { imports: [CommonModule] }); })();
5461
5826
 
5827
+ /*
5828
+ <file>
5829
+ Project:
5830
+ @osovitny/anatoly
5831
+
5832
+ Authors:
5833
+ Vadim Osovitny vadim@osovitny.com
5834
+ Anatoly Osovitny anatoly@osovitny.com
5835
+
5836
+ Created:
5837
+ 20 Sep 2023
5838
+
5839
+ Description:
5840
+ Identity and Access Management
5841
+
5842
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
5843
+ </file>
5844
+ */
5845
+ //App
5846
+ class MSALB2C {
5847
+ static isEnabled() {
5848
+ if (MSALB2CConfig) {
5849
+ return true;
5850
+ }
5851
+ return false;
5852
+ }
5853
+ static getAuthorityByType(type) {
5854
+ let policy = MSALB2C.getPolicyByType(type);
5855
+ return policy?.authority;
5856
+ }
5857
+ static getPolicyByType(type) {
5858
+ let policies = MSALB2CConfig.policies;
5859
+ for (let i = 0; i < policies.length; i++) {
5860
+ let policy = policies[i];
5861
+ if (policy.type == type) {
5862
+ return policy;
5863
+ }
5864
+ }
5865
+ return null;
5866
+ }
5867
+ }
5868
+
5869
+ /*
5870
+ <file>
5871
+ Project:
5872
+ @osovitny/anatoly
5873
+
5874
+ Authors:
5875
+ Vadim Osovitny vadim@osovitny.com
5876
+ Anatoly Osovitny anatoly@osovitny.com
5877
+
5878
+ Created:
5879
+ 20 Sep 2023
5880
+
5881
+ Description:
5882
+ Identity and Access Management
5883
+
5884
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
5885
+ </file>
5886
+ */
5887
+ const PolicyType = {
5888
+ signUpSignIn: 'signUpSignIn',
5889
+ signUp: 'signUp',
5890
+ resetPassword: 'resetPassword',
5891
+ editProfile: 'editProfile'
5892
+ };
5893
+
5894
+ /*
5895
+ <file>
5896
+ Project:
5897
+ @osovitny/anatoly
5898
+
5899
+ Authors:
5900
+ Vadim Osovitny vadim@osovitny.com
5901
+ Anatoly Osovitny anatoly@osovitny.com
5902
+
5903
+ Created:
5904
+ 20 Sep 2023
5905
+
5906
+ Description:
5907
+ Identity and Access Management
5908
+
5909
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
5910
+ </file>
5911
+ */
5912
+
5913
+ /*
5914
+ <file>
5915
+ Project:
5916
+ @osovitny/anatoly
5917
+
5918
+ Authors:
5919
+ Vadim Osovitny vadim@osovitny.com
5920
+ Anatoly Osovitny anatoly@osovitny.com
5921
+
5922
+ Created:
5923
+ 2 May 2023
5924
+
5925
+ Description:
5926
+ Identity and Access Management
5927
+
5928
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
5929
+ </file>
5930
+ */
5931
+ function MSALInterceptorConfigFactory() {
5932
+ let protectedResourceMap = new Map();
5933
+ protectedResourceMap.set('https://graph.microsoft.com/v1.0/me', ['user.read']);
5934
+ return {
5935
+ interactionType: InteractionType.Redirect,
5936
+ protectedResourceMap
5937
+ };
5938
+ }
5939
+ function MSALGuardConfigFactory() {
5940
+ return {
5941
+ interactionType: InteractionType.Redirect,
5942
+ authRequest: (authService, state) => {
5943
+ let scopes = MSALApiConfig.scopes;
5944
+ let redirectTo = state.url;
5945
+ /*
5946
+ VadimOS: not working for some reason
5947
+
5948
+ let stateData = {
5949
+ redirectTo: redirectTo
5950
+ };
5951
+ let state64 = Buffer.from(JSON.stringify(stateData)).toString('base64');
5952
+ let request: RedirectRequest = {
5953
+ scopes: [...scopes],
5954
+ state: state64,
5955
+ redirectStartPage: redirectTo
5956
+ }
5957
+ */
5958
+ let request = {
5959
+ scopes: [...scopes]
5960
+ };
5961
+ MSALStorage.saveRedirectState(redirectTo, 'MSALGuardConfigFactory.authRequest');
5962
+ return request;
5963
+ }
5964
+ };
5965
+ }
5966
+ function MSALInstanceFactory() {
5967
+ let authority = MSALConfig.app.auth.authority;
5968
+ let configuration = {
5969
+ auth: {
5970
+ authority: authority,
5971
+ clientId: MSALConfig.app.auth.clientId,
5972
+ redirectUri: MSALConfig.app.auth.redirectUri,
5973
+ postLogoutRedirectUri: MSALConfig.app.auth.postLogoutRedirectUri,
5974
+ navigateToLoginRequestUrl: MSALConfig.app.auth.navigateToLoginRequestUrl
5975
+ },
5976
+ cache: {
5977
+ cacheLocation: MSALConfig.app.cache.cacheLocation,
5978
+ storeAuthStateInCookie: MSALConfig.app.cache.storeAuthStateInCookie
5979
+ },
5980
+ system: {
5981
+ allowNativeBroker: false,
5982
+ loggerOptions: {
5983
+ loggerCallback,
5984
+ logLevel: MSALConfig.app.system.loggerOptions.logLevel,
5985
+ piiLoggingEnabled: false
5986
+ }
5987
+ }
5988
+ };
5989
+ if (MSALB2C.isEnabled()) {
5990
+ configuration.auth.authority = MSALB2C.getAuthorityByType(PolicyType.signUpSignIn);
5991
+ configuration.auth.knownAuthorities = [MSALB2CConfig.authorityDomain];
5992
+ }
5993
+ return new PublicClientApplication(configuration);
5994
+ }
5995
+ function loggerCallback(logLevel, message, containsPii) {
5996
+ if (containsPii) {
5997
+ return;
5998
+ }
5999
+ switch (logLevel) {
6000
+ case LogLevel.Error:
6001
+ console.error(message);
6002
+ return;
6003
+ case LogLevel.Info:
6004
+ console.info(message);
6005
+ return;
6006
+ case LogLevel.Verbose:
6007
+ console.debug(message);
6008
+ return;
6009
+ case LogLevel.Warning:
6010
+ console.warn(message);
6011
+ return;
6012
+ }
6013
+ }
6014
+
6015
+ /*
6016
+ <file>
6017
+ Project:
6018
+ @osovitny/anatoly
6019
+
6020
+ Authors:
6021
+ Vadim Osovitny vadim@osovitny.com
6022
+ Anatoly Osovitny anatoly@osovitny.com
6023
+
6024
+ Created:
6025
+ 6 Dec 2018
6026
+
6027
+ Description:
6028
+ Identity and Access Management
6029
+
6030
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
6031
+ </file>
6032
+ */
6033
+ //Node
6034
+ class AdminGuard {
6035
+ auth;
6036
+ constructor(auth) {
6037
+ this.auth = auth;
6038
+ }
6039
+ isUserAdmin() {
6040
+ return of(this.auth.isUserAdmin());
6041
+ }
6042
+ canActivate(next, state) {
6043
+ return this.isUserAdmin();
6044
+ }
6045
+ canActivateChild(route, state) {
6046
+ if (route.component) {
6047
+ return this.isUserAdmin();
6048
+ }
6049
+ return of(true);
6050
+ }
6051
+ static ɵfac = function AdminGuard_Factory(t) { return new (t || AdminGuard)(i0.ɵɵinject(AuthService)); };
6052
+ static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AdminGuard, factory: AdminGuard.ɵfac });
6053
+ }
6054
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AdminGuard, [{
6055
+ type: Injectable
6056
+ }], function () { return [{ type: AuthService }]; }, null); })();
6057
+
6058
+ class AuthenticationGuard extends MsalGuard {
6059
+ _msalGuardConfig;
6060
+ constructor(msalGuardConfig, msalBroadcastService, authService, location, router) {
6061
+ super(msalGuardConfig, msalBroadcastService, authService, location, router);
6062
+ this._msalGuardConfig = msalGuardConfig;
6063
+ }
6064
+ setInteractionType(route) {
6065
+ let interactionType = route.data.interactionType;
6066
+ this._msalGuardConfig.interactionType = interactionType || InteractionType.Redirect;
6067
+ }
6068
+ canActivate(route, state) {
6069
+ this.setInteractionType(route);
6070
+ return super.canActivate(route, state);
6071
+ }
6072
+ static ɵfac = function AuthenticationGuard_Factory(t) { return new (t || AuthenticationGuard)(i0.ɵɵinject(MSAL_GUARD_CONFIG), i0.ɵɵinject(i4.MsalBroadcastService), i0.ɵɵinject(i4.MsalService), i0.ɵɵinject(i1$5.Location), i0.ɵɵinject(i1.Router)); };
6073
+ static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AuthenticationGuard, factory: AuthenticationGuard.ɵfac });
6074
+ }
6075
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthenticationGuard, [{
6076
+ type: Injectable
6077
+ }], function () { return [{ type: undefined, decorators: [{
6078
+ type: Inject,
6079
+ args: [MSAL_GUARD_CONFIG]
6080
+ }] }, { type: i4.MsalBroadcastService }, { type: i4.MsalService }, { type: i1$5.Location }, { type: i1.Router }]; }, null); })();
6081
+
6082
+ /*
6083
+ <file>
6084
+ Project:
6085
+ QA
6086
+
6087
+ Authors:
6088
+ Vadim Osovitny vadim@osovitny.com
6089
+
6090
+ Created:
6091
+ 6 Dec 2018
6092
+
6093
+ Description:
6094
+ Identity and Access Management
6095
+
6096
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
6097
+ </file>
6098
+ */
6099
+
6100
+ /*
6101
+ <file>
6102
+ Project:
6103
+ @osovitny/anatoly
6104
+
6105
+ Authors:
6106
+ Vadim Osovitny vadim@osovitny.com
6107
+ Anatoly Osovitny anatoly@osovitny.com
6108
+
6109
+ Created:
6110
+ 6 Dec 2018
6111
+
6112
+ Description:
6113
+ Identity and Access Management
6114
+
6115
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
6116
+ </file>
6117
+ */
6118
+ //Node
6119
+ class AnatolyIAMModule {
6120
+ static ɵfac = function AnatolyIAMModule_Factory(t) { return new (t || AnatolyIAMModule)(); };
6121
+ static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: AnatolyIAMModule });
6122
+ static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ providers: [
6123
+ {
6124
+ provide: HTTP_INTERCEPTORS,
6125
+ useClass: MsalInterceptor,
6126
+ multi: true
6127
+ },
6128
+ {
6129
+ provide: MSAL_INTERCEPTOR_CONFIG,
6130
+ useFactory: MSALInterceptorConfigFactory
6131
+ },
6132
+ {
6133
+ provide: MSAL_GUARD_CONFIG,
6134
+ useFactory: MSALGuardConfigFactory
6135
+ },
6136
+ {
6137
+ provide: MSAL_INSTANCE,
6138
+ useFactory: MSALInstanceFactory
6139
+ },
6140
+ MsalService,
6141
+ MsalBroadcastService,
6142
+ //App
6143
+ AuthService,
6144
+ AuthenticationGuard,
6145
+ AdminGuard
6146
+ ], imports: [CommonModule,
6147
+ HttpClientModule,
6148
+ MsalModule] });
6149
+ }
6150
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AnatolyIAMModule, [{
6151
+ type: NgModule,
6152
+ args: [{
6153
+ imports: [
6154
+ CommonModule,
6155
+ HttpClientModule,
6156
+ MsalModule
6157
+ ],
6158
+ exports: [],
6159
+ declarations: [],
6160
+ providers: [
6161
+ {
6162
+ provide: HTTP_INTERCEPTORS,
6163
+ useClass: MsalInterceptor,
6164
+ multi: true
6165
+ },
6166
+ {
6167
+ provide: MSAL_INTERCEPTOR_CONFIG,
6168
+ useFactory: MSALInterceptorConfigFactory
6169
+ },
6170
+ {
6171
+ provide: MSAL_GUARD_CONFIG,
6172
+ useFactory: MSALGuardConfigFactory
6173
+ },
6174
+ {
6175
+ provide: MSAL_INSTANCE,
6176
+ useFactory: MSALInstanceFactory
6177
+ },
6178
+ MsalService,
6179
+ MsalBroadcastService,
6180
+ //App
6181
+ AuthService,
6182
+ AuthenticationGuard,
6183
+ AdminGuard
6184
+ ]
6185
+ }]
6186
+ }], null, null); })();
6187
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(AnatolyIAMModule, { imports: [CommonModule,
6188
+ HttpClientModule,
6189
+ MsalModule] }); })();
6190
+
6191
+ /*
6192
+ <file>
6193
+ Project:
6194
+ @osovitny/anatoly
6195
+
6196
+ Authors:
6197
+ Vadim Osovitny vadim@osovitny.com
6198
+ Anatoly Osovitny anatoly@osovitny.com
6199
+
6200
+ Created:
6201
+ 20 Sep 2023
6202
+
6203
+ Description:
6204
+ Identity and Access Management
6205
+
6206
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
6207
+ </file>
6208
+ */
6209
+ //Node
6210
+ class SignInPage extends BasePage {
6211
+ auth;
6212
+ constructor(auth) {
6213
+ super();
6214
+ this.auth = auth;
6215
+ }
6216
+ ngOnInit() {
6217
+ this.auth.login().subscribe();
6218
+ }
6219
+ static ɵfac = function SignInPage_Factory(t) { return new (t || SignInPage)(i0.ɵɵdirectiveInject(AuthService)); };
6220
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SignInPage, selectors: [["iam-signin-page"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 0, vars: 0, template: function SignInPage_Template(rf, ctx) { }, encapsulation: 2 });
6221
+ }
6222
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SignInPage, [{
6223
+ type: Component,
6224
+ args: [{ selector: 'iam-signin-page', template: "" }]
6225
+ }], function () { return [{ type: AuthService }]; }, null); })();
6226
+
6227
+ /*
6228
+ <file>
6229
+ Project:
6230
+ @osovitny/anatoly
6231
+
6232
+ Authors:
6233
+ Vadim Osovitny vadim@osovitny.com
6234
+ Anatoly Osovitny anatoly@osovitny.com
6235
+
6236
+ Created:
6237
+ 20 Sep 2023
6238
+
6239
+ Description:
6240
+ Identity and Access Management
6241
+
6242
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
6243
+ </file>
6244
+ */
6245
+ //Node
6246
+ class SignOutPage extends BasePage {
6247
+ auth;
6248
+ constructor(auth) {
6249
+ super();
6250
+ this.auth = auth;
6251
+ }
6252
+ ngOnInit() {
6253
+ this.auth.logout();
6254
+ }
6255
+ static ɵfac = function SignOutPage_Factory(t) { return new (t || SignOutPage)(i0.ɵɵdirectiveInject(AuthService)); };
6256
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SignOutPage, selectors: [["iam-signout-page"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 0, vars: 0, template: function SignOutPage_Template(rf, ctx) { }, encapsulation: 2 });
6257
+ }
6258
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SignOutPage, [{
6259
+ type: Component,
6260
+ args: [{ selector: 'iam-signout-page', template: "" }]
6261
+ }], function () { return [{ type: AuthService }]; }, null); })();
6262
+
6263
+ /*
6264
+ <file>
6265
+ Project:
6266
+ @osovitny/anatoly
6267
+
6268
+ Authors:
6269
+ Vadim Osovitny vadim@osovitny.com
6270
+ Anatoly Osovitny anatoly@osovitny.com
6271
+
6272
+ Created:
6273
+ 20 Sep 2023
6274
+
6275
+ Description:
6276
+ Identity and Access Management
6277
+
6278
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
6279
+ </file>
6280
+ */
6281
+ //Node
6282
+ class SignUpPage extends BasePage {
6283
+ auth;
6284
+ constructor(auth) {
6285
+ super();
6286
+ this.auth = auth;
6287
+ }
6288
+ ngOnInit() {
6289
+ }
6290
+ static ɵfac = function SignUpPage_Factory(t) { return new (t || SignUpPage)(i0.ɵɵdirectiveInject(AuthService)); };
6291
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SignUpPage, selectors: [["iam-signup-page"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 0, vars: 0, template: function SignUpPage_Template(rf, ctx) { }, encapsulation: 2 });
6292
+ }
6293
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SignUpPage, [{
6294
+ type: Component,
6295
+ args: [{ selector: 'iam-signup-page', template: "" }]
6296
+ }], function () { return [{ type: AuthService }]; }, null); })();
6297
+
6298
+ /*
6299
+ <file>
6300
+ Project:
6301
+ @osovitny/anatoly
6302
+
6303
+ Authors:
6304
+ Vadim Osovitny vadim@osovitny.com
6305
+ Anatoly Osovitny anatoly@osovitny.com
6306
+
6307
+ Created:
6308
+ 2 May 2023
6309
+
6310
+ Description:
6311
+ Identity and Access Management
6312
+
6313
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
6314
+ </file>
6315
+ */
6316
+ //Node
6317
+ const routes = [
6318
+ {
6319
+ path: "signin",
6320
+ component: SignInPage
6321
+ },
6322
+ {
6323
+ path: "signup",
6324
+ component: SignUpPage
6325
+ },
6326
+ {
6327
+ path: "signout",
6328
+ component: SignOutPage
6329
+ }
6330
+ ];
6331
+ const IAMRouterModule = RouterModule.forChild(routes);
6332
+ const PAGES = [
6333
+ SignInPage,
6334
+ SignUpPage,
6335
+ SignOutPage
6336
+ ];
6337
+
6338
+ /*
6339
+ <file>
6340
+ Project:
6341
+ @osovitny/anatoly
6342
+
6343
+ Authors:
6344
+ Vadim Osovitny vadim@osovitny.com
6345
+ Anatoly Osovitny anatoly@osovitny.com
6346
+
6347
+ Created:
6348
+ 6 Dec 2018
6349
+
6350
+ Description:
6351
+ Identity and Access Management
6352
+
6353
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
6354
+ </file>
6355
+ */
6356
+ //Node
6357
+ class AnatolyIAMPagesModule {
6358
+ static ɵfac = function AnatolyIAMPagesModule_Factory(t) { return new (t || AnatolyIAMPagesModule)(); };
6359
+ static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: AnatolyIAMPagesModule });
6360
+ static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
6361
+ HttpClientModule,
6362
+ IAMRouterModule] });
6363
+ }
6364
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AnatolyIAMPagesModule, [{
6365
+ type: NgModule,
6366
+ args: [{
6367
+ imports: [
6368
+ CommonModule,
6369
+ HttpClientModule,
6370
+ IAMRouterModule
6371
+ ],
6372
+ exports: [],
6373
+ declarations: [
6374
+ ...PAGES
6375
+ ],
6376
+ providers: []
6377
+ }]
6378
+ }], null, null); })();
6379
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(AnatolyIAMPagesModule, { declarations: [SignInPage, SignUpPage, SignOutPage], imports: [CommonModule,
6380
+ HttpClientModule, i1.RouterModule] }); })();
6381
+
5462
6382
  /*
5463
6383
  <file>
5464
6384
  Project:
@@ -5768,8 +6688,12 @@ class AnatolyModule {
5768
6688
  static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
5769
6689
  AnatolyCoreModule,
5770
6690
  AnatolyDataModule,
6691
+ AnatolyIAMModule,
6692
+ AnatolyIAMPagesModule,
5771
6693
  AnatolyUIModule, AnatolyCoreModule,
5772
6694
  AnatolyDataModule,
6695
+ AnatolyIAMModule,
6696
+ AnatolyIAMPagesModule,
5773
6697
  AnatolyUIModule] });
5774
6698
  }
5775
6699
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AnatolyModule, [{
@@ -5779,11 +6703,15 @@ class AnatolyModule {
5779
6703
  CommonModule,
5780
6704
  AnatolyCoreModule,
5781
6705
  AnatolyDataModule,
6706
+ AnatolyIAMModule,
6707
+ AnatolyIAMPagesModule,
5782
6708
  AnatolyUIModule
5783
6709
  ],
5784
6710
  exports: [
5785
6711
  AnatolyCoreModule,
5786
6712
  AnatolyDataModule,
6713
+ AnatolyIAMModule,
6714
+ AnatolyIAMPagesModule,
5787
6715
  AnatolyUIModule
5788
6716
  ],
5789
6717
  providers: [],
@@ -5792,8 +6720,12 @@ class AnatolyModule {
5792
6720
  (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(AnatolyModule, { imports: [CommonModule,
5793
6721
  AnatolyCoreModule,
5794
6722
  AnatolyDataModule,
6723
+ AnatolyIAMModule,
6724
+ AnatolyIAMPagesModule,
5795
6725
  AnatolyUIModule], exports: [AnatolyCoreModule,
5796
6726
  AnatolyDataModule,
6727
+ AnatolyIAMModule,
6728
+ AnatolyIAMPagesModule,
5797
6729
  AnatolyUIModule] }); })();
5798
6730
 
5799
6731
  /*
@@ -5805,5 +6737,5 @@ class AnatolyModule {
5805
6737
  * Generated bundle index. Do not edit.
5806
6738
  */
5807
6739
 
5808
- export { AddressComponent, Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyHttpInterceptor, AnatolyModule, AnatolyUIModule, ApiServiceBase, ApiUrl, AppContextService, AppCoreSettings, AppName, AppVersion, BaseComponent, BaseDialog, BaseEditComponent, BaseGoService, BaseHtmlEditorComponent, BaseList, BasePage, BasePagedPage, Browser, BuyAccessButtonComponent, CardBodyComponent, CardComponent, CardFooterComponent, CardHeaderComponent, CheckIconComponent, CompanyComponent, ContactUsDialog, ContactUsForm, Convert, Copy2ClipboardComponent, CoreApiService, DOM, DatapagerComponent, DefaultEditorOptions, DigitalMarketingService, EmailsApiService, FileSizePipe, FormValidationSummaryComponent, FormsHtmlEditorComponent, GlobalErrorHandler, GoogleAnalyticsService, GridEditServiceBase, GridReadServiceBase, Guid, HoveringDirective, HtmlEditorComponent, IdleService, InjectorInstance, ItemValidationSummaryComponent, L10NUrl, LoadingComponent, LoadingService, LocalStorageService, LocalizationInjectorInstance, LocalizationModule, LocalizationService, LocalizationSettingsModule, LocalizePipe, LoggingService, NativeElementDirective, NodataComponent, NotificationService, PageSpinnerComponent, ReplaceTextPipe, SafeHtmlPipe, SessionStorageService, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, StarterServiceBase, Stopwatch, Subs, SubscribePlanButtonComponent, TimezoneDropdownlist, UrlSlugComponent, Utils, ValidationSummaryComponent, XmlFormatter, localizationInitializerFactory, throwIfAlreadyLoaded, translateLoaderFactory };
6740
+ export { AddressComponent, Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyHttpInterceptor, AnatolyIAMModule, AnatolyIAMPagesModule, AnatolyModule, AnatolyUIModule, ApiServiceBase, ApiUrl, AppContextService, AppCoreSettings, AppName, AppVersion, AuthService, BaseComponent, BaseDialog, BaseEditComponent, BaseGoService, BaseHtmlEditorComponent, BaseList, BasePage, BasePagedPage, Browser, BuyAccessButtonComponent, CardBodyComponent, CardComponent, CardFooterComponent, CardHeaderComponent, CheckIconComponent, CompanyComponent, ContactUsDialog, ContactUsForm, Convert, Copy2ClipboardComponent, CoreApiService, DOM, DatapagerComponent, DefaultEditorOptions, DigitalMarketingService, EmailsApiService, FileSizePipe, FormValidationSummaryComponent, FormsHtmlEditorComponent, GlobalErrorHandler, GoogleAnalyticsService, GridEditServiceBase, GridReadServiceBase, Guid, HoveringDirective, HtmlEditorComponent, IdleService, InjectorInstance, ItemValidationSummaryComponent, L10NUrl, LoadingComponent, LoadingService, LocalStorageService, LocalizationInjectorInstance, LocalizationModule, LocalizationService, LocalizationSettingsModule, LocalizePipe, LoggingService, NativeElementDirective, NodataComponent, NotificationService, PageSpinnerComponent, ReplaceTextPipe, SafeHtmlPipe, SessionStorageService, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, StarterServiceBase, Stopwatch, Subs, SubscribePlanButtonComponent, TimezoneDropdownlist, UrlSlugComponent, Utils, ValidationSummaryComponent, XmlFormatter, localizationInitializerFactory, throwIfAlreadyLoaded, translateLoaderFactory };
5809
6741
  //# sourceMappingURL=osovitny-anatoly.mjs.map