@ng-atomic/common 20.24.3 → 20.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, Injectable } from '@angular/core';
3
3
  import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
4
- import { Auth, authState, getRedirectResult, TwitterAuthProvider, signInWithPopup, GoogleAuthProvider, signInWithRedirect, onAuthStateChanged, signInWithEmailAndPassword, createUserWithEmailAndPassword, signInWithCustomToken, signOut } from '@angular/fire/auth';
4
+ import { Auth, authState, user, getRedirectResult, TwitterAuthProvider, signInWithPopup, GoogleAuthProvider, signInWithRedirect, onAuthStateChanged, signInWithEmailAndPassword, createUserWithEmailAndPassword, signInWithCustomToken, signOut } from '@angular/fire/auth';
5
5
  import { get } from 'lodash-es';
6
6
  import { ReplaySubject, switchMap, of, distinctUntilChanged, shareReplay, map } from 'rxjs';
7
7
 
@@ -13,10 +13,11 @@ class AuthService {
13
13
  this.redirectError$ = redirectError$;
14
14
  this.auth$ = authState(this.#auth);
15
15
  this.auth = toSignal(this.auth$);
16
- this.accessToken$ = this.auth$.pipe(switchMap(auth => auth ? auth.getIdToken() : of(null)), distinctUntilChanged(), shareReplay(1), takeUntilDestroyed());
16
+ this.#idTokenUser$ = user(this.#auth);
17
+ this.accessToken$ = this.#idTokenUser$.pipe(switchMap(auth => auth ? auth.getIdToken() : of(null)), distinctUntilChanged(), shareReplay(1), takeUntilDestroyed());
17
18
  this.accessToken = toSignal(this.accessToken$);
18
19
  this.userId$ = this.auth$.pipe(map(auth => auth?.uid ?? null), distinctUntilChanged(), shareReplay(1), takeUntilDestroyed());
19
- this.customClaims$ = this.auth$.pipe(switchMap(auth => auth ? auth.getIdTokenResult() : of(null)), map(token => token?.claims ?? {}), distinctUntilChanged(), shareReplay(1), takeUntilDestroyed());
20
+ this.customClaims$ = this.#idTokenUser$.pipe(switchMap(auth => auth ? auth.getIdTokenResult() : of(null)), map(token => token?.claims ?? {}), distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)), shareReplay(1), takeUntilDestroyed());
20
21
  if (typeof window !== 'undefined' && window.self !== window.top) {
21
22
  return;
22
23
  }
@@ -25,6 +26,7 @@ class AuthService {
25
26
  redirectError$.next(error);
26
27
  });
27
28
  }
29
+ #idTokenUser$;
28
30
  signInWithTwitter() {
29
31
  const provider = new TwitterAuthProvider();
30
32
  return signInWithPopup(this.#auth, provider);
@@ -7,16 +7,34 @@ function walkActivatedRoute(route, callback) {
7
7
  return;
8
8
  route.children.forEach(child => walkActivatedRoute(child, callback));
9
9
  }
10
- class RouterService extends Router {
10
+ class RouterService {
11
11
  constructor() {
12
- super(...arguments);
13
12
  this.router = inject(Router);
13
+ this.events = this.router.events;
14
14
  this.events$ = this.router.events;
15
15
  }
16
+ get routerState() {
17
+ return this.router.routerState;
18
+ }
19
+ get url() {
20
+ return this.router.url;
21
+ }
22
+ navigate(commands, extras) {
23
+ return this.router.navigate(commands, extras);
24
+ }
25
+ navigateByUrl(url, extras) {
26
+ return this.router.navigateByUrl(url, extras);
27
+ }
28
+ createUrlTree(commands, extras) {
29
+ return this.router.createUrlTree(commands, extras);
30
+ }
31
+ parseUrl(url) {
32
+ return this.router.parseUrl(url);
33
+ }
16
34
  back() {
17
35
  history.back();
18
36
  }
19
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: RouterService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
37
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: RouterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
20
38
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: RouterService, providedIn: 'root' }); }
21
39
  }
22
40
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: RouterService, decorators: [{
@@ -1,15 +1,21 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, signal, inject } from '@angular/core';
2
+ import { inject, Injectable, signal } from '@angular/core';
3
3
  import { Router } from '@angular/router';
4
4
  import { merge } from 'lodash-es';
5
5
 
6
- class SideAppRouter extends Router {
6
+ class SideAppRouter {
7
+ constructor() {
8
+ this.router = inject(Router);
9
+ }
10
+ get url() {
11
+ return this.router.url;
12
+ }
7
13
  setSideApp(sideApp) {
8
14
  this.sideApp = sideApp;
9
15
  }
10
16
  navigate(commands, extras) {
11
17
  const _commands = extras?.relativeTo ? commands : ['', { outlets: { 'side': commands } }];
12
- return super.navigate(_commands, merge({
18
+ return this.router.navigate(_commands, merge({
13
19
  replaceUrl: true,
14
20
  }, extras)).then((res) => {
15
21
  if (extras?.expanded === true) {
@@ -21,7 +27,7 @@ class SideAppRouter extends Router {
21
27
  return res;
22
28
  });
23
29
  }
24
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: SideAppRouter, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
30
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: SideAppRouter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
25
31
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: SideAppRouter, providedIn: 'root' }); }
26
32
  }
27
33
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: SideAppRouter, decorators: [{
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@ng-atomic/common",
3
- "version": "20.24.3",
3
+ "version": "20.48.0",
4
4
  "license": "MIT",
5
5
  "peerDependencies": {
6
- "@nx-ddd/core": "20.24.3",
7
- "@nx-ddd/common": "20.24.3"
6
+ "@nx-ddd/core": "20.48.0",
7
+ "@nx-ddd/common": "20.48.0"
8
8
  },
9
9
  "dependencies": {
10
10
  "tslib": "^2.3.0"
@@ -46,7 +46,7 @@ interface MultiSelectField<T> extends BaseField {
46
46
  }
47
47
  interface FileField extends BaseField {
48
48
  type: 'file';
49
- progress?: Signal<number | null>;
49
+ progress?: number | false | null;
50
50
  }
51
51
  interface ActionField extends BaseField {
52
52
  type: 'action';
@@ -1,11 +1,19 @@
1
- import { ActivatedRoute, Router, Event } from '@angular/router';
1
+ import * as _angular_router from '@angular/router';
2
+ import { ActivatedRoute, Router, Event, NavigationExtras, UrlTree, UrlCreationOptions } from '@angular/router';
2
3
  import { Observable } from 'rxjs';
3
4
  import * as i0 from '@angular/core';
4
5
 
5
6
  declare function walkActivatedRoute(route: ActivatedRoute, callback: (route: ActivatedRoute) => boolean): void;
6
- declare class RouterService extends Router {
7
+ declare class RouterService {
7
8
  readonly router: Router;
9
+ readonly events: Observable<Event>;
8
10
  readonly events$: Observable<Event>;
11
+ get routerState(): _angular_router.RouterState;
12
+ get url(): string;
13
+ navigate(commands: readonly any[], extras?: NavigationExtras): Promise<boolean>;
14
+ navigateByUrl(url: string | UrlTree, extras?: NavigationExtras): Promise<boolean>;
15
+ createUrlTree(commands: readonly any[], extras?: UrlCreationOptions): UrlTree;
16
+ parseUrl(url: string): UrlTree;
9
17
  back(): void;
10
18
  static ɵfac: i0.ɵɵFactoryDeclaration<RouterService, never>;
11
19
  static ɵprov: i0.ɵɵInjectableDeclaration<RouterService>;
@@ -1,8 +1,10 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Router, NavigationExtras } from '@angular/router';
2
+ import { NavigationExtras } from '@angular/router';
3
3
 
4
- declare class SideAppRouter extends Router {
4
+ declare class SideAppRouter {
5
5
  protected sideApp: SideAppService;
6
+ private readonly router;
7
+ get url(): string;
6
8
  setSideApp(sideApp: SideAppService): void;
7
9
  navigate(commands: any[], extras?: NavigationExtras & {
8
10
  expanded?: boolean;