@dereekb/dbx-firebase 9.23.16 → 9.23.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.
- package/esm2020/lib/auth/service/firebase.auth.service.mjs +15 -9
- package/esm2020/lib/firebase/emulators.mjs +1 -1
- package/esm2020/lib/firebase/firebase.emulator.service.mjs +7 -2
- package/fesm2015/dereekb-dbx-firebase.mjs +20 -10
- package/fesm2015/dereekb-dbx-firebase.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-firebase.mjs +20 -9
- package/fesm2020/dereekb-dbx-firebase.mjs.map +1 -1
- package/lib/auth/service/firebase.auth.service.d.ts +9 -3
- package/lib/firebase/emulators.d.ts +4 -0
- package/package.json +5 -5
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { Injectable, Optional, InjectionToken, Inject, Component, Input, Directive, EventEmitter, Output, NgModule, Injector, ViewChild, HostListener, ElementRef, ChangeDetectionStrategy, forwardRef, Host } from '@angular/core';
|
|
3
3
|
import * as i3 from '@dereekb/dbx-analytics';
|
|
4
4
|
import { asObservable, timeoutStartWith, filterMaybe, isNot, SubscriptionObject, lazyFrom, switchMapWhileTrue, loadingStateFromObs, cleanupDestroyable, accumulatorFlattenPageListLoadingState, useFirst, pageLoadingStateFromObs, useAsObservable, mapEachAsync, invertObservableDecision, filterItemsWithObservableDecision, distinctUntilModelKeyChange, successResult, beginLoading, errorResult, cleanup, mapLoadingState } from '@dereekb/rxjs';
|
|
5
|
-
import { switchMap, of, shareReplay, map, distinctUntilChanged, catchError, firstValueFrom, BehaviorSubject, combineLatest, first, from, tap, interval, exhaustMap, filter, take, startWith,
|
|
5
|
+
import { switchMap, of, shareReplay, map, distinctUntilChanged, EMPTY, catchError, firstValueFrom, BehaviorSubject, combineLatest, first, from, tap, interval, exhaustMap, filter, take, startWith, Subject, throttleTime, NEVER, combineLatestWith } from 'rxjs';
|
|
6
6
|
import * as i2$2 from '@dereekb/dbx-core';
|
|
7
7
|
import { loggedInObsFromIsLoggedIn, loggedOutObsFromIsLoggedIn, authUserIdentifier, DbxInjectionContext, AbstractForwardDbxInjectionContextDirective, DBX_INJECTION_COMPONENT_DATA, DbxInjectionComponentModule, DbxAuthService, AbstractSubscriptionDirective, AbstractIfDirective, DbxRouteParamReaderInstance, DbxRouteParamDefaultRedirectInstance, LockSetComponentStore } from '@dereekb/dbx-core';
|
|
8
8
|
import * as i1 from '@angular/fire/auth';
|
|
@@ -132,17 +132,23 @@ class DbxFirebaseAuthService {
|
|
|
132
132
|
this.authUserInfo$ = this.authUser$.pipe(map(authUserInfoFromAuthUser));
|
|
133
133
|
this.hasAuthUser$ = this.currentAuthUser$.pipe(map((x) => Boolean(x)), distinctUntilChanged(), shareReplay(1));
|
|
134
134
|
this.isAnonymousUser$ = this.authUser$.pipe(map((x) => x.isAnonymous), distinctUntilChanged(), shareReplay(1));
|
|
135
|
-
this.isNotAnonymousUser$ = this.isAnonymousUser$.pipe(isNot());
|
|
135
|
+
this.isNotAnonymousUser$ = this.isAnonymousUser$.pipe(isNot(), distinctUntilChanged(), shareReplay(1));
|
|
136
136
|
this.isLoggedIn$ = this.hasAuthUser$;
|
|
137
137
|
this.isNotLoggedIn$ = this.isLoggedIn$.pipe(isNot());
|
|
138
138
|
this.onLogIn$ = loggedInObsFromIsLoggedIn(this.isLoggedIn$);
|
|
139
139
|
this.onLogOut$ = loggedOutObsFromIsLoggedIn(this.isLoggedIn$);
|
|
140
|
-
this.
|
|
141
|
-
this.uid$ = this.
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
this.
|
|
140
|
+
this.currentUid$ = this.currentAuthUser$.pipe(map((x) => x?.uid), distinctUntilChanged(), shareReplay(1));
|
|
141
|
+
this.uid$ = this.currentUid$.pipe(map(authUserIdentifier), distinctUntilChanged(), shareReplay(1));
|
|
142
|
+
/**
|
|
143
|
+
* Alias for uid$
|
|
144
|
+
*/
|
|
145
|
+
this.userIdentifier$ = this.uid$;
|
|
146
|
+
this.currentIdTokenString$ = idToken(this.firebaseAuth).pipe(distinctUntilChanged(), shareReplay(1));
|
|
147
|
+
this.idTokenString$ = this.currentUid$.pipe(switchMap((x) => (x ? this.currentIdTokenString$.pipe(filterMaybe()) : EMPTY)));
|
|
148
|
+
this.currentIdTokenResult$ = this.currentAuthUser$.pipe(switchMap((x) => (x ? this.currentIdTokenString$.pipe(switchMap((y) => (y ? x.getIdTokenResult() : of(null)))) : of(null))), distinctUntilChanged(), shareReplay(1));
|
|
149
|
+
this.idTokenResult$ = this.currentIdTokenResult$.pipe(filterMaybe());
|
|
150
|
+
this.currentClaims$ = this.currentIdTokenResult$.pipe(map((x) => (x ? x.claims : null)), distinctUntilChanged(), shareReplay(1));
|
|
151
|
+
this.claims$ = this.currentClaims$.pipe(filterMaybe());
|
|
146
152
|
this.currentAuthContextInfo$ = this.currentAuthUser$.pipe(switchMap((x) => this.loadAuthContextInfoForUser(x)), shareReplay(1));
|
|
147
153
|
this.authContextInfo$ = this.currentAuthContextInfo$.pipe(filterMaybe());
|
|
148
154
|
delegate = delegate ?? DEFAULT_DBX_FIREBASE_AUTH_SERVICE_DELEGATE;
|
|
@@ -2119,9 +2125,14 @@ class DbxFirebaseEmulatorService {
|
|
|
2119
2125
|
}
|
|
2120
2126
|
get emulatorUIAnchor() {
|
|
2121
2127
|
const ui = this.emulatorsConfig.ui;
|
|
2128
|
+
let host = this.emulatorsConfig.host;
|
|
2129
|
+
// Issue where sometimes 0.0.0.0 is not configured to handle transferring traffic properly, compared to localhost. This sets 0.0.0.0 to localhost unless disallowed.
|
|
2130
|
+
if (host === '0.0.0.0' && this.emulatorsConfig.allow0000ToLocalhost !== false) {
|
|
2131
|
+
host = 'localhost';
|
|
2132
|
+
}
|
|
2122
2133
|
return ui
|
|
2123
2134
|
? {
|
|
2124
|
-
url: `http://${
|
|
2135
|
+
url: `http://${host ?? 'localhost'}:${ui.port}`,
|
|
2125
2136
|
target: '_blank'
|
|
2126
2137
|
}
|
|
2127
2138
|
: undefined;
|