@ng-atomic/common 20.24.2 → 20.45.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/ng-atomic-common-services-auth.mjs +5 -3
- package/fesm2022/ng-atomic-common-services-router.mjs +21 -3
- package/fesm2022/ng-atomic-common-services-side-app.mjs +10 -4
- package/package.json +3 -3
- package/types/ng-atomic-common-pipes-smart-field.d.ts +1 -1
- package/types/ng-atomic-common-services-router.d.ts +10 -2
- package/types/ng-atomic-common-services-side-app.d.ts +4 -2
|
@@ -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
|
|
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
|
|
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
|
|
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:
|
|
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
|
|
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
|
|
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
|
|
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:
|
|
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.
|
|
3
|
+
"version": "20.45.12",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@nx-ddd/core": "20.
|
|
7
|
-
"@nx-ddd/common": "20.
|
|
6
|
+
"@nx-ddd/core": "20.45.12",
|
|
7
|
+
"@nx-ddd/common": "20.45.12"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"tslib": "^2.3.0"
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import
|
|
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
|
|
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 {
|
|
2
|
+
import { NavigationExtras } from '@angular/router';
|
|
3
3
|
|
|
4
|
-
declare class SideAppRouter
|
|
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;
|