@dereekb/dbx-firebase 5.0.1 → 5.2.1

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 (38) hide show
  1. package/esm2020/lib/auth/appcheck/appcheck.interceptor.mjs +80 -0
  2. package/esm2020/lib/auth/appcheck/appcheck.mjs +11 -0
  3. package/esm2020/lib/auth/appcheck/index.mjs +3 -0
  4. package/esm2020/lib/auth/index.mjs +2 -1
  5. package/esm2020/lib/auth/login/login.service.mjs +1 -1
  6. package/esm2020/lib/firebase/appcheck.mjs +2 -0
  7. package/esm2020/lib/firebase/firebase.module.mjs +102 -11
  8. package/esm2020/lib/firebase/index.mjs +2 -1
  9. package/esm2020/lib/firebase/options.mjs +3 -2
  10. package/esm2020/lib/model/loader/collection.loader.instance.mjs +1 -1
  11. package/esm2020/lib/model/store/index.mjs +2 -1
  12. package/esm2020/lib/model/store/store.collection.directive.mjs +1 -1
  13. package/esm2020/lib/model/store/store.collection.mjs +1 -1
  14. package/esm2020/lib/model/store/store.subcollection.directive.mjs +30 -0
  15. package/esm2020/lib/model/store/store.subcollection.document.mjs +21 -4
  16. package/esm2020/lib/model/store/store.subcollection.mjs +51 -9
  17. package/esm2020/lib/model/store/store.subcollection.rxjs.mjs +3 -22
  18. package/fesm2015/dereekb-dbx-firebase.mjs +296 -48
  19. package/fesm2015/dereekb-dbx-firebase.mjs.map +1 -1
  20. package/fesm2020/dereekb-dbx-firebase.mjs +288 -48
  21. package/fesm2020/dereekb-dbx-firebase.mjs.map +1 -1
  22. package/lib/auth/appcheck/appcheck.d.ts +8 -0
  23. package/lib/auth/appcheck/appcheck.interceptor.d.ts +19 -0
  24. package/lib/auth/appcheck/index.d.ts +2 -0
  25. package/lib/auth/index.d.ts +1 -0
  26. package/lib/firebase/appcheck.d.ts +21 -0
  27. package/lib/firebase/firebase.module.d.ts +20 -10
  28. package/lib/firebase/index.d.ts +1 -0
  29. package/lib/firebase/options.d.ts +7 -0
  30. package/lib/model/loader/collection.loader.instance.d.ts +8 -8
  31. package/lib/model/store/index.d.ts +1 -0
  32. package/lib/model/store/store.collection.d.ts +7 -7
  33. package/lib/model/store/store.collection.directive.d.ts +1 -1
  34. package/lib/model/store/store.subcollection.d.ts +29 -9
  35. package/lib/model/store/store.subcollection.directive.d.ts +23 -0
  36. package/lib/model/store/store.subcollection.document.d.ts +9 -8
  37. package/lib/model/store/store.subcollection.rxjs.d.ts +7 -6
  38. package/package.json +8 -7
@@ -1,34 +1,126 @@
1
+ import { urlWithoutParameters, addToSet, removeFromSet, filterMaybeValues, mapIterable, asArray, excludeValuesFromArray, containsStringAnyCase, forEachKeyValue, readableError, isMaybeSo } from '@dereekb/util';
2
+ import * as i0 from '@angular/core';
3
+ import { InjectionToken, Injectable, Inject, Optional, Component, Input, Directive, EventEmitter, Output, NgModule, Injector, forwardRef, Host } from '@angular/core';
4
+ import { getToken, initializeAppCheck, ReCaptchaV3Provider } from 'firebase/app-check';
5
+ import { switchMap, from, first, map, of, shareReplay, timeout, startWith, distinctUntilChanged, BehaviorSubject, combineLatest, tap, firstValueFrom, Subject, throttleTime, NEVER, filter, take, exhaustMap } from 'rxjs';
6
+ import * as i1 from '@angular/fire/app-check';
7
+ import { provideAppCheck } from '@angular/fire/app-check';
1
8
  import * as i4 from '@angular/material/button';
2
9
  import { MatButtonModule } from '@angular/material/button';
3
10
  import * as i2 from '@angular/material/icon';
4
11
  import { MatIconModule } from '@angular/material/icon';
5
12
  import * as i6 from '@angular/common';
6
13
  import { CommonModule } from '@angular/common';
7
- import * as i0 from '@angular/core';
8
- import { Injectable, Optional, Component, InjectionToken, Inject, Input, Directive, EventEmitter, Output, NgModule, Injector, forwardRef, Host } from '@angular/core';
9
- import { of, switchMap, shareReplay, map, timeout, startWith, distinctUntilChanged, from, BehaviorSubject, combineLatest, tap, firstValueFrom, Subject, throttleTime, NEVER, filter, take, exhaustMap, first } from 'rxjs';
10
14
  import * as i3 from '@dereekb/dbx-web';
11
15
  import { DbxRouterAnchorModule, DbxReadableErrorModule, DbxActionModule, DbxButtonModule } from '@dereekb/dbx-web';
12
16
  import * as i3$1 from '@dereekb/dbx-core';
13
17
  import { loggedInObsFromIsLoggedIn, loggedOutObsFromIsLoggedIn, authUserIdentifier, DbxInjectionContext, AbstractForwardDbxInjectionContextDirective, DBX_INJECTION_COMPONENT_DATA, DbxInjectionComponentModule, DbxAuthService, AbstractSubscriptionDirective, AbstractIfDirective, LockSetComponentStore } from '@dereekb/dbx-core';
14
18
  import { filterMaybe, isNot, SubscriptionObject, cleanupDestroyable, accumulatorFlattenPageListLoadingState, useFirst, successResult, beginLoading, loadingStateFromObs, errorResult, cleanup } from '@dereekb/rxjs';
15
- import * as i1 from '@angular/fire/auth';
19
+ import * as i1$1 from '@angular/fire/auth';
16
20
  import { authState, GoogleAuthProvider, FacebookAuthProvider, TwitterAuthProvider, GithubAuthProvider, signInWithPopup, createUserWithEmailAndPassword, signInWithEmailAndPassword, signInAnonymously, provideAuth, getAuth, connectAuthEmulator } from '@angular/fire/auth';
17
21
  import { sendPasswordResetEmail } from 'firebase/auth';
18
- import { addToSet, removeFromSet, filterMaybeValues, mapIterable, asArray, excludeValuesFromArray, containsStringAnyCase, forEachKeyValue, readableError, isMaybeSo } from '@dereekb/util';
19
- import * as i1$1 from '@dereekb/dbx-form';
22
+ import * as i1$2 from '@dereekb/dbx-form';
20
23
  import { AbstractAsyncFormlyFormDirective, usernamePasswordLoginFields, provideFormlyContext, AbstractSyncFormlyFormDirective, emailField, DbxFormIoModule, DbxFormModule, DbxFormlyModule, DbxFormActionModule, DbxFormFormlyTextFieldModule } from '@dereekb/dbx-form';
21
24
  import { initializeApp } from 'firebase/app';
22
- import * as i5 from '@angular/fire/app';
25
+ import * as i6$1 from '@angular/fire/app';
23
26
  import { FirebaseApp, provideFirebaseApp } from '@angular/fire/app';
24
- import * as i3$2 from '@angular/fire/storage';
27
+ import * as i4$1 from '@angular/fire/storage';
25
28
  import { provideStorage, getStorage, connectStorageEmulator } from '@angular/fire/storage';
26
- import * as i4$1 from '@angular/fire/functions';
29
+ import * as i5 from '@angular/fire/functions';
27
30
  import { provideFunctions, getFunctions, connectFunctionsEmulator, Functions } from '@angular/fire/functions';
28
- import * as i1$2 from '@angular/fire/firestore';
31
+ import * as i1$3 from '@angular/fire/firestore';
29
32
  import { provideFirestore, getFirestore, connectFirestoreEmulator, enableIndexedDbPersistence, Firestore } from '@angular/fire/firestore';
33
+ import { HTTP_INTERCEPTORS } from '@angular/common/http';
30
34
  import { firebaseFirestoreContextFactory, iterationQueryDocChangeWatcher, firebaseQueryItemAccumulator, documentDataWithId } from '@dereekb/firebase';
31
35
 
36
+ /**
37
+ * Enables debug token generation for AppCheck by setting FIREBASE_APPCHECK_DEBUG_TOKEN in the browser's self/window.
38
+ *
39
+ * https://firebase.google.com/docs/app-check/web/debug-provider
40
+ *
41
+ * @param enable
42
+ */
43
+ function enableAppCheckDebugTokenGeneration(enable = true) {
44
+ self.FIREBASE_APPCHECK_DEBUG_TOKEN = enable;
45
+ }
46
+
47
+ const DBX_FIREBASE_OPTIONS_TOKEN = new InjectionToken('DbxFirebaseOptions');
48
+
49
+ /**
50
+ * HTTP Interceptor that sets the X-Firebase-AppCheck for any requests to the routes configured in DbxFirebaseOptions.
51
+ */
52
+ class DbxFirebaseAppCheckHttpInterceptor {
53
+ constructor(dbxFirebaseOptions, appCheck) {
54
+ var _a, _b;
55
+ this.dbxFirebaseOptions = dbxFirebaseOptions;
56
+ this.appCheck = appCheck;
57
+ let routes = [];
58
+ if (appCheck != null) {
59
+ routes = ((_b = (_a = this.dbxFirebaseOptions.appCheck) === null || _a === void 0 ? void 0 : _a.appCheckRoutes) !== null && _b !== void 0 ? _b : ['/api/*']).map((route) => {
60
+ const wildcardIndex = route.indexOf('*');
61
+ const isWildcard = wildcardIndex === route.length - 1;
62
+ const match = isWildcard ? route.substring(0, wildcardIndex) : route;
63
+ return {
64
+ isWildcard,
65
+ match
66
+ };
67
+ });
68
+ }
69
+ this._appCheckRoutes = routes;
70
+ this._isEnabled = routes.length > 0;
71
+ }
72
+ intercept(req, next) {
73
+ let obs;
74
+ if (this._isEnabled) {
75
+ obs = this.matchesAnyRoute(req.url).pipe(switchMap((isMatch) => {
76
+ let nextEvent;
77
+ if (isMatch) {
78
+ nextEvent = from(getToken(this.appCheck).then((appCheckTokenResponse) => {
79
+ const token = appCheckTokenResponse.token;
80
+ let nextRequest = req;
81
+ if (token) {
82
+ nextRequest = req.clone({
83
+ headers: req.headers.set('X-Firebase-AppCheck', token)
84
+ });
85
+ }
86
+ return nextRequest;
87
+ })).pipe(switchMap((nextRequest) => next.handle(nextRequest)));
88
+ }
89
+ else {
90
+ nextEvent = next.handle(req);
91
+ }
92
+ return nextEvent;
93
+ }));
94
+ }
95
+ else {
96
+ obs = next.handle(req);
97
+ }
98
+ return obs;
99
+ }
100
+ matchesAnyRoute(inputUrl) {
101
+ const url = urlWithoutParameters(inputUrl);
102
+ function isEnabledRouteMatch(enabledRoute) {
103
+ if (enabledRoute.isWildcard) {
104
+ return url.startsWith(enabledRoute.match);
105
+ }
106
+ else {
107
+ return url === enabledRoute.match;
108
+ }
109
+ }
110
+ return from(this._appCheckRoutes).pipe(first((route) => isEnabledRouteMatch(route), false), map((x) => Boolean(x)));
111
+ }
112
+ }
113
+ DbxFirebaseAppCheckHttpInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseAppCheckHttpInterceptor, deps: [{ token: DBX_FIREBASE_OPTIONS_TOKEN }, { token: i1.AppCheck }], target: i0.ɵɵFactoryTarget.Injectable });
114
+ DbxFirebaseAppCheckHttpInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseAppCheckHttpInterceptor });
115
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseAppCheckHttpInterceptor, decorators: [{
116
+ type: Injectable
117
+ }], ctorParameters: function () {
118
+ return [{ type: undefined, decorators: [{
119
+ type: Inject,
120
+ args: [DBX_FIREBASE_OPTIONS_TOKEN]
121
+ }] }, { type: i1.AppCheck }];
122
+ } });
123
+
32
124
  /**
33
125
  * Derives a user state from the input firebase auth service.
34
126
  *
@@ -158,12 +250,12 @@ class DbxFirebaseAuthService {
158
250
  return this.firebaseAuth.signOut();
159
251
  }
160
252
  }
161
- DbxFirebaseAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseAuthService, deps: [{ token: i1.Auth }, { token: DbxFirebaseAuthServiceDelegate, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
253
+ DbxFirebaseAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseAuthService, deps: [{ token: i1$1.Auth }, { token: DbxFirebaseAuthServiceDelegate, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
162
254
  DbxFirebaseAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseAuthService });
163
255
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseAuthService, decorators: [{
164
256
  type: Injectable
165
257
  }], ctorParameters: function () {
166
- return [{ type: i1.Auth }, { type: DbxFirebaseAuthServiceDelegate, decorators: [{
258
+ return [{ type: i1$1.Auth }, { type: DbxFirebaseAuthServiceDelegate, decorators: [{
167
259
  type: Optional
168
260
  }] }];
169
261
  } });
@@ -701,7 +793,7 @@ class DbxFirebaseEmailFormComponent extends AbstractAsyncFormlyFormDirective {
701
793
  DbxFirebaseEmailFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseEmailFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
702
794
  DbxFirebaseEmailFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", type: DbxFirebaseEmailFormComponent, selector: "dbx-firebase-email-form", inputs: { config: "config" }, providers: [provideFormlyContext()], usesInheritance: true, ngImport: i0, template: `
703
795
  <dbx-formly></dbx-formly>
704
- `, isInline: true, components: [{ type: i1$1.DbxFormlyFormComponent, selector: "dbx-formly", exportAs: ["formly"] }] });
796
+ `, isInline: true, components: [{ type: i1$2.DbxFormlyFormComponent, selector: "dbx-formly", exportAs: ["formly"] }] });
705
797
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseEmailFormComponent, decorators: [{
706
798
  type: Component,
707
799
  args: [{
@@ -724,7 +816,7 @@ class DbxFirebaseEmailRecoveryFormComponent extends AbstractSyncFormlyFormDirect
724
816
  DbxFirebaseEmailRecoveryFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseEmailRecoveryFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
725
817
  DbxFirebaseEmailRecoveryFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", type: DbxFirebaseEmailRecoveryFormComponent, selector: "dbx-firebase-email-recovery-form", providers: [provideFormlyContext()], usesInheritance: true, ngImport: i0, template: `
726
818
  <dbx-formly></dbx-formly>
727
- `, isInline: true, components: [{ type: i1$1.DbxFormlyFormComponent, selector: "dbx-formly", exportAs: ["formly"] }] });
819
+ `, isInline: true, components: [{ type: i1$2.DbxFormlyFormComponent, selector: "dbx-formly", exportAs: ["formly"] }] });
728
820
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseEmailRecoveryFormComponent, decorators: [{
729
821
  type: Component,
730
822
  args: [{
@@ -818,7 +910,7 @@ class DbxFirebaseLoginEmailContentComponent {
818
910
  }
819
911
  }
820
912
  DbxFirebaseLoginEmailContentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseLoginEmailContentComponent, deps: [{ token: DbxFirebaseAuthService }, { token: DBX_INJECTION_COMPONENT_DATA }], target: i0.ɵɵFactoryTarget.Component });
821
- DbxFirebaseLoginEmailContentComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", type: DbxFirebaseLoginEmailContentComponent, selector: "ng-component", ngImport: i0, template: "<div class=\"dbx-firebase-login-email-content\">\n <ng-container [ngSwitch]=\"emailMode$ | async\">\n <ng-container *ngSwitchCase=\"'login'\">\n <ng-container *ngTemplateOutlet=\"loginView\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"'recover'\">\n <ng-container *ngTemplateOutlet=\"resetPassword\"></ng-container>\n </ng-container>\n </ng-container>\n</div>\n\n<!-- Login View -->\n<ng-template #loginView>\n <ng-container dbxAction [dbxActionHandler]=\"handleLoginAction\">\n <dbx-firebase-email-form [config]=\"formConfig\" dbxActionForm [dbxFormSource]=\"emailFormValue\"></dbx-firebase-email-form>\n <div class=\"dbx-firebase-login-email-forgot-prompt\" *ngIf=\"isLoginMode\">\n <dbx-link [anchor]=\"forgotAnchor\">Forgot Password?</dbx-link>\n </div>\n <div class=\"dbx-flex\">\n <dbx-button class=\"dbx-wide-button\" [text]=\"buttonText\" [raised]=\"true\" color=\"primary\" dbxActionButton></dbx-button>\n <dbx-button-spacer></dbx-button-spacer>\n <span class=\"dbx-spacer\"></span>\n <button mat-flat-button (click)=\"onCancel()\">Cancel</button>\n </div>\n <dbx-error dbxActionError></dbx-error>\n </ng-container>\n</ng-template>\n\n<!-- Reset Password View -->\n<ng-template #resetPassword>\n <ng-container dbxAction [dbxActionHandler]=\"handleRecoveryAction\">\n <dbx-firebase-email-recovery-form dbxActionForm [dbxFormSource]=\"recoveryFormValue\"></dbx-firebase-email-recovery-form>\n <p class=\"dbx-hint\">An email will be sent to the above address to help you reset your password.</p>\n <div class=\"dbx-flex\">\n <dbx-button class=\"dbx-wide-button\" text=\"Send Recovery Email\" [raised]=\"true\" color=\"primary\" dbxActionButton></dbx-button>\n <span class=\"dbx-spacer\"></span>\n <button mat-flat-button (click)=\"onCancelReset()\">Cancel Recovery</button>\n </div>\n <dbx-error dbxActionError></dbx-error>\n </ng-container>\n</ng-template>\n", components: [{ type: DbxFirebaseEmailFormComponent, selector: "dbx-firebase-email-form", inputs: ["config"] }, { type: i3.DbxAnchorLinkComponent, selector: "dbx-link", inputs: ["anchor", "ref", "href"] }, { type: i3.DbxButtonComponent, selector: "dbx-button", inputs: ["type", "raised", "stroked", "flat", "color", "customButtonColor", "customTextColor", "customSpinnerColor"] }, { type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i3.DbxReadableErrorComponent, selector: "dbx-error", inputs: ["error"] }, { type: DbxFirebaseEmailRecoveryFormComponent, selector: "dbx-firebase-email-recovery-form" }], directives: [{ type: i6.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i6.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3$1.DbxActionDirective, selector: "dbx-action,[dbxAction],dbx-action-context,[dbxActionContext]", exportAs: ["action", "dbxAction"] }, { type: i3$1.DbxActionHandlerDirective, selector: "[dbxActionHandler]", inputs: ["dbxActionHandler"] }, { type: i1$1.DbxActionFormDirective, selector: "[dbxActionForm]", inputs: ["dbxActionFormValidator", "dbxActionFormModified", "formDisabledOnWorking"] }, { type: i1$1.DbxFormSourceDirective, selector: "[dbxFormSource]", inputs: ["dbxFormSourceMode", "dbxFormSource"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$1.DbxActionButtonDirective, selector: "[dbxActionButton]" }, { type: i3.DbxButtonSpacerDirective, selector: "dbx-button-spacer,[dbxButtonSpacer]" }, { type: i3.DbxActionErrorDirective, selector: "[dbxActionError]" }], pipes: { "async": i6.AsyncPipe } });
913
+ DbxFirebaseLoginEmailContentComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", type: DbxFirebaseLoginEmailContentComponent, selector: "ng-component", ngImport: i0, template: "<div class=\"dbx-firebase-login-email-content\">\n <ng-container [ngSwitch]=\"emailMode$ | async\">\n <ng-container *ngSwitchCase=\"'login'\">\n <ng-container *ngTemplateOutlet=\"loginView\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"'recover'\">\n <ng-container *ngTemplateOutlet=\"resetPassword\"></ng-container>\n </ng-container>\n </ng-container>\n</div>\n\n<!-- Login View -->\n<ng-template #loginView>\n <ng-container dbxAction [dbxActionHandler]=\"handleLoginAction\">\n <dbx-firebase-email-form [config]=\"formConfig\" dbxActionForm [dbxFormSource]=\"emailFormValue\"></dbx-firebase-email-form>\n <div class=\"dbx-firebase-login-email-forgot-prompt\" *ngIf=\"isLoginMode\">\n <dbx-link [anchor]=\"forgotAnchor\">Forgot Password?</dbx-link>\n </div>\n <div class=\"dbx-flex\">\n <dbx-button class=\"dbx-wide-button\" [text]=\"buttonText\" [raised]=\"true\" color=\"primary\" dbxActionButton></dbx-button>\n <dbx-button-spacer></dbx-button-spacer>\n <span class=\"dbx-spacer\"></span>\n <button mat-flat-button (click)=\"onCancel()\">Cancel</button>\n </div>\n <dbx-error dbxActionError></dbx-error>\n </ng-container>\n</ng-template>\n\n<!-- Reset Password View -->\n<ng-template #resetPassword>\n <ng-container dbxAction [dbxActionHandler]=\"handleRecoveryAction\">\n <dbx-firebase-email-recovery-form dbxActionForm [dbxFormSource]=\"recoveryFormValue\"></dbx-firebase-email-recovery-form>\n <p class=\"dbx-hint\">An email will be sent to the above address to help you reset your password.</p>\n <div class=\"dbx-flex\">\n <dbx-button class=\"dbx-wide-button\" text=\"Send Recovery Email\" [raised]=\"true\" color=\"primary\" dbxActionButton></dbx-button>\n <span class=\"dbx-spacer\"></span>\n <button mat-flat-button (click)=\"onCancelReset()\">Cancel Recovery</button>\n </div>\n <dbx-error dbxActionError></dbx-error>\n </ng-container>\n</ng-template>\n", components: [{ type: DbxFirebaseEmailFormComponent, selector: "dbx-firebase-email-form", inputs: ["config"] }, { type: i3.DbxAnchorLinkComponent, selector: "dbx-link", inputs: ["anchor", "ref", "href"] }, { type: i3.DbxButtonComponent, selector: "dbx-button", inputs: ["type", "raised", "stroked", "flat", "color", "customButtonColor", "customTextColor", "customSpinnerColor"] }, { type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i3.DbxReadableErrorComponent, selector: "dbx-error", inputs: ["error"] }, { type: DbxFirebaseEmailRecoveryFormComponent, selector: "dbx-firebase-email-recovery-form" }], directives: [{ type: i6.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i6.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3$1.DbxActionDirective, selector: "dbx-action,[dbxAction],dbx-action-context,[dbxActionContext]", exportAs: ["action", "dbxAction"] }, { type: i3$1.DbxActionHandlerDirective, selector: "[dbxActionHandler]", inputs: ["dbxActionHandler"] }, { type: i1$2.DbxActionFormDirective, selector: "[dbxActionForm]", inputs: ["dbxActionFormValidator", "dbxActionFormModified", "formDisabledOnWorking"] }, { type: i1$2.DbxFormSourceDirective, selector: "[dbxFormSource]", inputs: ["dbxFormSourceMode", "dbxFormSource"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$1.DbxActionButtonDirective, selector: "[dbxActionButton]" }, { type: i3.DbxButtonSpacerDirective, selector: "dbx-button-spacer,[dbxButtonSpacer]" }, { type: i3.DbxActionErrorDirective, selector: "[dbxActionError]" }], pipes: { "async": i6.AsyncPipe } });
822
914
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseLoginEmailContentComponent, decorators: [{
823
915
  type: Component,
824
916
  args: [{ template: "<div class=\"dbx-firebase-login-email-content\">\n <ng-container [ngSwitch]=\"emailMode$ | async\">\n <ng-container *ngSwitchCase=\"'login'\">\n <ng-container *ngTemplateOutlet=\"loginView\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"'recover'\">\n <ng-container *ngTemplateOutlet=\"resetPassword\"></ng-container>\n </ng-container>\n </ng-container>\n</div>\n\n<!-- Login View -->\n<ng-template #loginView>\n <ng-container dbxAction [dbxActionHandler]=\"handleLoginAction\">\n <dbx-firebase-email-form [config]=\"formConfig\" dbxActionForm [dbxFormSource]=\"emailFormValue\"></dbx-firebase-email-form>\n <div class=\"dbx-firebase-login-email-forgot-prompt\" *ngIf=\"isLoginMode\">\n <dbx-link [anchor]=\"forgotAnchor\">Forgot Password?</dbx-link>\n </div>\n <div class=\"dbx-flex\">\n <dbx-button class=\"dbx-wide-button\" [text]=\"buttonText\" [raised]=\"true\" color=\"primary\" dbxActionButton></dbx-button>\n <dbx-button-spacer></dbx-button-spacer>\n <span class=\"dbx-spacer\"></span>\n <button mat-flat-button (click)=\"onCancel()\">Cancel</button>\n </div>\n <dbx-error dbxActionError></dbx-error>\n </ng-container>\n</ng-template>\n\n<!-- Reset Password View -->\n<ng-template #resetPassword>\n <ng-container dbxAction [dbxActionHandler]=\"handleRecoveryAction\">\n <dbx-firebase-email-recovery-form dbxActionForm [dbxFormSource]=\"recoveryFormValue\"></dbx-firebase-email-recovery-form>\n <p class=\"dbx-hint\">An email will be sent to the above address to help you reset your password.</p>\n <div class=\"dbx-flex\">\n <dbx-button class=\"dbx-wide-button\" text=\"Send Recovery Email\" [raised]=\"true\" color=\"primary\" dbxActionButton></dbx-button>\n <span class=\"dbx-spacer\"></span>\n <button mat-flat-button (click)=\"onCancelReset()\">Cancel Recovery</button>\n </div>\n <dbx-error dbxActionError></dbx-error>\n </ng-container>\n</ng-template>\n" }]
@@ -1301,7 +1393,7 @@ class DbxFirebaseParsedEmulatorsConfig {
1301
1393
  class DbxFirebaseDefaultFirestoreProviderModule {
1302
1394
  }
1303
1395
  DbxFirebaseDefaultFirestoreProviderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFirestoreProviderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1304
- DbxFirebaseDefaultFirestoreProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFirestoreProviderModule, imports: [i1$2.FirestoreModule] });
1396
+ DbxFirebaseDefaultFirestoreProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFirestoreProviderModule, imports: [i1$3.FirestoreModule] });
1305
1397
  DbxFirebaseDefaultFirestoreProviderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFirestoreProviderModule, imports: [[
1306
1398
  provideFirestore(((injector) => {
1307
1399
  const firebaseApp = injector.get(FirebaseApp);
@@ -1331,13 +1423,98 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
1331
1423
  ]
1332
1424
  }]
1333
1425
  }] });
1426
+ /**
1427
+ * Default firebase app check provider module.
1428
+ *
1429
+ * Also configures the DbxFirebaseAppCheckHttpInterceptor with HTTP_INTERCEPTORS in order for appCheck to be appended to requests to the api.
1430
+ */
1431
+ class DbxFirebaseDefaultAppCheckProviderModule {
1432
+ }
1433
+ DbxFirebaseDefaultAppCheckProviderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultAppCheckProviderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1434
+ DbxFirebaseDefaultAppCheckProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultAppCheckProviderModule, imports: [i1.AppCheckModule] });
1435
+ DbxFirebaseDefaultAppCheckProviderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultAppCheckProviderModule, providers: [
1436
+ {
1437
+ provide: HTTP_INTERCEPTORS,
1438
+ useClass: DbxFirebaseAppCheckHttpInterceptor,
1439
+ multi: true
1440
+ }
1441
+ ], imports: [[
1442
+ provideAppCheck(((injector) => {
1443
+ var _a, _b, _c;
1444
+ const firebaseApp = injector.get(FirebaseApp);
1445
+ const firebaseOptions = injector.get(DBX_FIREBASE_OPTIONS_TOKEN);
1446
+ const appCheckOptions = firebaseOptions.appCheck;
1447
+ const appCheckKnowinglyDisabled = (appCheckOptions === null || appCheckOptions === void 0 ? void 0 : appCheckOptions.disabled) === true || ((_a = firebaseOptions.emulators) === null || _a === void 0 ? void 0 : _a.useEmulators) === true;
1448
+ let appCheck;
1449
+ if (appCheckOptions && !appCheckKnowinglyDisabled) {
1450
+ // enable the debug tokens if not using emulators and allowDebugTokens is set true
1451
+ if (((_b = firebaseOptions.emulators) === null || _b === void 0 ? void 0 : _b.useEmulators) !== true && appCheckOptions.allowDebugTokens) {
1452
+ enableAppCheckDebugTokenGeneration(true);
1453
+ }
1454
+ // Only enabled outside of app-check environments. The emulators will not use appcheck.
1455
+ appCheck = initializeAppCheck(firebaseApp, {
1456
+ provider: new ReCaptchaV3Provider(appCheckOptions.reCaptchaV3),
1457
+ isTokenAutoRefreshEnabled: (_c = appCheckOptions.isTokenAutoRefreshEnabled) !== null && _c !== void 0 ? _c : true
1458
+ });
1459
+ console.debug('Enabled AppCheck.');
1460
+ }
1461
+ else {
1462
+ appCheck = undefined;
1463
+ if (!appCheckKnowinglyDisabled) {
1464
+ console.error('dbx-firebase: No appcheck configuration for the app, and not specifically disabled in config either.');
1465
+ }
1466
+ }
1467
+ return appCheck;
1468
+ }))
1469
+ ]] });
1470
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultAppCheckProviderModule, decorators: [{
1471
+ type: NgModule,
1472
+ args: [{
1473
+ imports: [
1474
+ provideAppCheck(((injector) => {
1475
+ var _a, _b, _c;
1476
+ const firebaseApp = injector.get(FirebaseApp);
1477
+ const firebaseOptions = injector.get(DBX_FIREBASE_OPTIONS_TOKEN);
1478
+ const appCheckOptions = firebaseOptions.appCheck;
1479
+ const appCheckKnowinglyDisabled = (appCheckOptions === null || appCheckOptions === void 0 ? void 0 : appCheckOptions.disabled) === true || ((_a = firebaseOptions.emulators) === null || _a === void 0 ? void 0 : _a.useEmulators) === true;
1480
+ let appCheck;
1481
+ if (appCheckOptions && !appCheckKnowinglyDisabled) {
1482
+ // enable the debug tokens if not using emulators and allowDebugTokens is set true
1483
+ if (((_b = firebaseOptions.emulators) === null || _b === void 0 ? void 0 : _b.useEmulators) !== true && appCheckOptions.allowDebugTokens) {
1484
+ enableAppCheckDebugTokenGeneration(true);
1485
+ }
1486
+ // Only enabled outside of app-check environments. The emulators will not use appcheck.
1487
+ appCheck = initializeAppCheck(firebaseApp, {
1488
+ provider: new ReCaptchaV3Provider(appCheckOptions.reCaptchaV3),
1489
+ isTokenAutoRefreshEnabled: (_c = appCheckOptions.isTokenAutoRefreshEnabled) !== null && _c !== void 0 ? _c : true
1490
+ });
1491
+ console.debug('Enabled AppCheck.');
1492
+ }
1493
+ else {
1494
+ appCheck = undefined;
1495
+ if (!appCheckKnowinglyDisabled) {
1496
+ console.error('dbx-firebase: No appcheck configuration for the app, and not specifically disabled in config either.');
1497
+ }
1498
+ }
1499
+ return appCheck;
1500
+ }))
1501
+ ],
1502
+ providers: [
1503
+ {
1504
+ provide: HTTP_INTERCEPTORS,
1505
+ useClass: DbxFirebaseAppCheckHttpInterceptor,
1506
+ multi: true
1507
+ }
1508
+ ]
1509
+ }]
1510
+ }] });
1334
1511
  /**
1335
1512
  * Default firebase auth provider module.
1336
1513
  */
1337
1514
  class DbxFirebaseDefaultAuthProviderModule {
1338
1515
  }
1339
1516
  DbxFirebaseDefaultAuthProviderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultAuthProviderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1340
- DbxFirebaseDefaultAuthProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultAuthProviderModule, imports: [i1.AuthModule] });
1517
+ DbxFirebaseDefaultAuthProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultAuthProviderModule, imports: [i1$1.AuthModule] });
1341
1518
  DbxFirebaseDefaultAuthProviderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultAuthProviderModule, imports: [[
1342
1519
  provideAuth(((injector) => {
1343
1520
  const firebaseApp = injector.get(FirebaseApp);
@@ -1371,7 +1548,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
1371
1548
  class DbxFirebaseDefaultStorageProviderModule {
1372
1549
  }
1373
1550
  DbxFirebaseDefaultStorageProviderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultStorageProviderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1374
- DbxFirebaseDefaultStorageProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultStorageProviderModule, imports: [i3$2.StorageModule] });
1551
+ DbxFirebaseDefaultStorageProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultStorageProviderModule, imports: [i4$1.StorageModule] });
1375
1552
  DbxFirebaseDefaultStorageProviderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultStorageProviderModule, imports: [[
1376
1553
  provideStorage(((injector) => {
1377
1554
  const firebaseApp = injector.get(FirebaseApp);
@@ -1405,7 +1582,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
1405
1582
  class DbxFirebaseDefaultFunctionsProviderModule {
1406
1583
  }
1407
1584
  DbxFirebaseDefaultFunctionsProviderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFunctionsProviderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1408
- DbxFirebaseDefaultFunctionsProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFunctionsProviderModule, imports: [i4$1.FunctionsModule] });
1585
+ DbxFirebaseDefaultFunctionsProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFunctionsProviderModule, imports: [i5.FunctionsModule] });
1409
1586
  DbxFirebaseDefaultFunctionsProviderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFunctionsProviderModule, imports: [[
1410
1587
  provideFunctions(((injector) => {
1411
1588
  const firebaseApp = injector.get(FirebaseApp);
@@ -1437,7 +1614,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
1437
1614
  ]
1438
1615
  }]
1439
1616
  }] });
1440
- const DBX_FIREBASE_OPTIONS_TOKEN = new InjectionToken('DbxFirebaseOptions');
1441
1617
  /**
1442
1618
  * Default provider module.
1443
1619
  */
@@ -1455,12 +1631,13 @@ class DbxFirebaseDefaultFirebaseProvidersModule {
1455
1631
  }
1456
1632
  }
1457
1633
  DbxFirebaseDefaultFirebaseProvidersModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFirebaseProvidersModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1458
- DbxFirebaseDefaultFirebaseProvidersModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFirebaseProvidersModule, imports: [i5.FirebaseAppModule, DbxFirebaseDefaultFirestoreProviderModule, DbxFirebaseDefaultAuthProviderModule, DbxFirebaseDefaultStorageProviderModule, DbxFirebaseDefaultFunctionsProviderModule] });
1634
+ DbxFirebaseDefaultFirebaseProvidersModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFirebaseProvidersModule, imports: [i6$1.FirebaseAppModule, DbxFirebaseDefaultAppCheckProviderModule, DbxFirebaseDefaultFirestoreProviderModule, DbxFirebaseDefaultAuthProviderModule, DbxFirebaseDefaultStorageProviderModule, DbxFirebaseDefaultFunctionsProviderModule] });
1459
1635
  DbxFirebaseDefaultFirebaseProvidersModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFirebaseProvidersModule, imports: [[
1460
1636
  provideFirebaseApp(((injector) => {
1461
1637
  const firebaseOptions = injector.get(DBX_FIREBASE_OPTIONS_TOKEN);
1462
1638
  return initializeApp(firebaseOptions);
1463
1639
  })),
1640
+ DbxFirebaseDefaultAppCheckProviderModule,
1464
1641
  DbxFirebaseDefaultFirestoreProviderModule,
1465
1642
  DbxFirebaseDefaultAuthProviderModule,
1466
1643
  DbxFirebaseDefaultStorageProviderModule,
@@ -1474,6 +1651,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
1474
1651
  const firebaseOptions = injector.get(DBX_FIREBASE_OPTIONS_TOKEN);
1475
1652
  return initializeApp(firebaseOptions);
1476
1653
  })),
1654
+ DbxFirebaseDefaultAppCheckProviderModule,
1477
1655
  DbxFirebaseDefaultFirestoreProviderModule,
1478
1656
  DbxFirebaseDefaultAuthProviderModule,
1479
1657
  DbxFirebaseDefaultStorageProviderModule,
@@ -2153,7 +2331,7 @@ function setParentStoreEffect(store) {
2153
2331
  return input.pipe(map((parentStore) => {
2154
2332
  let result;
2155
2333
  if (parentStore) {
2156
- result = store.setParent(parentStore.currentDocument$);
2334
+ result = store._setParent(parentStore.currentDocument$);
2157
2335
  }
2158
2336
  else {
2159
2337
  result = undefined;
@@ -2168,56 +2346,82 @@ function setParentStoreEffect(store) {
2168
2346
  }));
2169
2347
  });
2170
2348
  }
2171
- function setParentEffect(store) {
2172
- return store.effect((input) => {
2173
- return input.pipe(switchMap((parent) => {
2174
- store._setParentDocument(parent);
2175
- if (parent) {
2176
- return store.collectionFactory$.pipe(tap((collectionFactory) => {
2177
- const collection = collectionFactory(parent);
2178
- store.setFirestoreCollection(collection);
2179
- }));
2180
- }
2181
- else {
2182
- // clear the current collection
2183
- store.setFirestoreCollection(undefined);
2184
- // do nothing until a parent is returned.
2185
- return NEVER;
2186
- }
2187
- }));
2188
- });
2189
- }
2190
2349
 
2191
2350
  /**
2192
2351
  * Abstract DbxFirebaseCollectionStore that has a parent document from which is derives it's FiresbaseCollection from.
2193
2352
  */
2194
2353
  class AbstractDbxFirebaseCollectionWithParentStore extends AbstractDbxFirebaseCollectionStore {
2195
- constructor() {
2196
- super(...arguments);
2354
+ constructor(state, defaultSourceMode) {
2355
+ super(state);
2197
2356
  // MARK: Effects
2198
- this.setParent = setParentEffect(this);
2199
2357
  this.setParentStore = setParentStoreEffect(this);
2358
+ this.setSourceMode = this.effect((input) => {
2359
+ return input.pipe(distinctUntilChanged(), switchMap((inputMode) => {
2360
+ var _a;
2361
+ const mode = (_a = inputMode === null || inputMode === void 0 ? void 0 : inputMode.toLowerCase()) !== null && _a !== void 0 ? _a : 'parent'; // default to parent mode
2362
+ if (mode === 'group') {
2363
+ return this.currentCollectionGroup$.pipe(tap((collectionGroup) => {
2364
+ this.setFirestoreCollection(collectionGroup);
2365
+ }));
2366
+ }
2367
+ else {
2368
+ // parent document collection
2369
+ return this.currentParent$.pipe(switchMap((parent) => {
2370
+ if (parent) {
2371
+ return this.collectionFactory$.pipe(tap((collectionFactory) => {
2372
+ const collection = collectionFactory(parent);
2373
+ this.setFirestoreCollection(collection);
2374
+ }));
2375
+ }
2376
+ else {
2377
+ this.setFirestoreCollection(undefined);
2378
+ return NEVER;
2379
+ }
2380
+ }));
2381
+ }
2382
+ }));
2383
+ });
2200
2384
  // MARK: Accessors
2201
2385
  this.currentParent$ = this.state$.pipe(map((x) => x.parent), distinctUntilChanged(), shareReplay(1));
2202
2386
  this.parent$ = this.currentParent$.pipe(filterMaybe());
2203
2387
  this.currentCollectionFactory$ = this.state$.pipe(map((x) => x.collectionFactory), distinctUntilChanged(), shareReplay(1));
2204
2388
  this.collectionFactory$ = this.currentCollectionFactory$.pipe(filterMaybe());
2389
+ this.currentCollectionGroup$ = this.state$.pipe(map((x) => x.collectionGroup), distinctUntilChanged(), shareReplay(1));
2390
+ this.collectionGroup$ = this.currentCollectionGroup$.pipe(filterMaybe());
2205
2391
  // MARK: State Changes
2206
2392
  /**
2207
2393
  * Sets the collection factory function to use.
2208
2394
  */
2209
2395
  this.setCollectionFactory = this.updater((state, collectionFactory) => (Object.assign(Object.assign({}, state), { collectionFactory })));
2396
+ /**
2397
+ * Sets the collection group to use.
2398
+ */
2399
+ this.setCollectionGroup = this.updater((state, collectionGroup) => (Object.assign(Object.assign({}, state), { collectionGroup })));
2210
2400
  /**
2211
2401
  * Sets the parent on the current state.
2212
2402
  */
2213
2403
  this._setParentDocument = this.updater((state, parent) => (Object.assign(Object.assign({}, state), { parent })));
2404
+ this._setParent = this._setParentDocument;
2405
+ this.setSourceMode(defaultSourceMode || 'parent');
2214
2406
  }
2215
2407
  }
2216
- AbstractDbxFirebaseCollectionWithParentStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AbstractDbxFirebaseCollectionWithParentStore, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
2408
+ AbstractDbxFirebaseCollectionWithParentStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AbstractDbxFirebaseCollectionWithParentStore, deps: [{ token: null, optional: true }, { token: null, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
2217
2409
  AbstractDbxFirebaseCollectionWithParentStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AbstractDbxFirebaseCollectionWithParentStore });
2218
2410
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AbstractDbxFirebaseCollectionWithParentStore, decorators: [{
2219
2411
  type: Injectable
2220
- }] });
2412
+ }], ctorParameters: function () {
2413
+ return [{ type: undefined, decorators: [{
2414
+ type: Inject,
2415
+ args: [null]
2416
+ }, {
2417
+ type: Optional
2418
+ }] }, { type: undefined, decorators: [{
2419
+ type: Inject,
2420
+ args: [null]
2421
+ }, {
2422
+ type: Optional
2423
+ }] }];
2424
+ } });
2221
2425
 
2222
2426
  /**
2223
2427
  * Abstract DbxFirebaseDocumentStore that has a parent document from which is derives it's FiresbaseCollection from.
@@ -2226,8 +2430,25 @@ class AbstractDbxFirebaseDocumentWithParentStore extends AbstractDbxFirebaseDocu
2226
2430
  constructor() {
2227
2431
  super(...arguments);
2228
2432
  // MARK: Effects
2229
- this.setParent = setParentEffect(this);
2230
2433
  this.setParentStore = setParentStoreEffect(this);
2434
+ this.setParent = this.effect((input) => {
2435
+ return input.pipe(switchMap((parent) => {
2436
+ this._setParentDocument(parent);
2437
+ if (parent) {
2438
+ return this.collectionFactory$.pipe(tap((collectionFactory) => {
2439
+ const collection = collectionFactory(parent);
2440
+ this.setFirestoreCollection(collection);
2441
+ }));
2442
+ }
2443
+ else {
2444
+ // clear the current collection
2445
+ this.setFirestoreCollection(undefined);
2446
+ // do nothing until a parent is returned.
2447
+ return NEVER;
2448
+ }
2449
+ }));
2450
+ });
2451
+ this._setParent = this.setParent;
2231
2452
  // MARK: Accessors
2232
2453
  this.currentParent$ = this.state$.pipe(map((x) => x.parent), distinctUntilChanged(), shareReplay(1));
2233
2454
  this.parent$ = this.currentParent$.pipe(filterMaybe());
@@ -2250,6 +2471,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
2250
2471
  type: Injectable
2251
2472
  }] });
2252
2473
 
2474
+ /**
2475
+ * Abstract directive that contains a DbxFirebaseCollectionWithParentStore and provides an interface for communicating with other directives.
2476
+ */
2477
+ class DbxFirebaseCollectionWithParentStoreDirective extends DbxFirebaseCollectionStoreDirective {
2478
+ // MARK: Inputs
2479
+ set sourceMode(sourceMode) {
2480
+ this.store.setSourceMode(sourceMode);
2481
+ }
2482
+ }
2483
+ DbxFirebaseCollectionWithParentStoreDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseCollectionWithParentStoreDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2484
+ DbxFirebaseCollectionWithParentStoreDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.2", type: DbxFirebaseCollectionWithParentStoreDirective, inputs: { sourceMode: "sourceMode" }, usesInheritance: true, ngImport: i0 });
2485
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseCollectionWithParentStoreDirective, decorators: [{
2486
+ type: Directive
2487
+ }], propDecorators: { sourceMode: [{
2488
+ type: Input
2489
+ }] } });
2490
+ function provideDbxFirebaseCollectionWithParentStoreDirective(sourceType, storeType) {
2491
+ const providers = [
2492
+ ...provideDbxFirebaseCollectionStoreDirective(sourceType, storeType),
2493
+ {
2494
+ provide: DbxFirebaseCollectionWithParentStoreDirective,
2495
+ useExisting: forwardRef(() => sourceType)
2496
+ }
2497
+ ];
2498
+ return providers;
2499
+ }
2500
+
2253
2501
  class DbxFirebaseModelModule {
2254
2502
  }
2255
2503
  DbxFirebaseModelModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseModelModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
@@ -2278,5 +2526,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
2278
2526
  * Generated bundle index. Do not edit.
2279
2527
  */
2280
2528
 
2281
- export { AbstractConfiguredDbxFirebaseLoginButtonDirective, AbstractDbxFirebaseCollectionStore, AbstractDbxFirebaseCollectionWithParentStore, AbstractDbxFirebaseDocumentStore, AbstractDbxFirebaseDocumentWithParentStore, DBX_FIREBASE_MODEL_DOES_NOT_EXIST_ERROR, DBX_FIREBASE_OPTIONS_TOKEN, DBX_FIREBASE_ROUTER_SYNC_DEFAULT_ID_PARAM_KEY, DBX_FIRESTORE_CONTEXT_TOKEN, DEFAULT_CONFIGURED_DBX_FIREBASE_LOGIN_BUTTON_TEMPLATE, DEFAULT_DBX_FIREBASE_AUTH_SERVICE_DELEGATE, DEFAULT_FIREBASE_AUTH_LOGIN_PASSWORD_CONFIG, DEFAULT_FIREBASE_AUTH_LOGIN_PASSWORD_CONFIG_TOKEN, DEFAULT_FIREBASE_AUTH_LOGIN_PROVIDERS_TOKEN, DEFAULT_FIREBASE_AUTH_LOGIN_TERMS_COMPONENT_CLASS_TOKEN, DEFAULT_FIREBASE_LOGIN_METHOD_CATEGORY, DbxFirebaseAuthLoginService, DbxFirebaseAuthModule, DbxFirebaseAuthService, DbxFirebaseAuthServiceDelegate, DbxFirebaseCollectionChangeDirective, DbxFirebaseCollectionHasChangeDirective, DbxFirebaseCollectionListDirective, DbxFirebaseCollectionLoaderInstance, DbxFirebaseCollectionStoreDirective, DbxFirebaseDefaultAuthProviderModule, DbxFirebaseDefaultFirebaseProvidersModule, DbxFirebaseDefaultFirestoreProviderModule, DbxFirebaseDefaultFunctionsProviderModule, DbxFirebaseDefaultStorageProviderModule, DbxFirebaseDocumentAuthIdDirective, DbxFirebaseDocumentStoreDirective, DbxFirebaseDocumentStoreRouteIdDirective, DbxFirebaseEmailFormComponent, DbxFirebaseEmailRecoveryFormComponent, DbxFirebaseEmulatorModule, DbxFirebaseFirestoreCollectionModule, DbxFirebaseFunctionsModule, DbxFirebaseLoginAnonymousComponent, DbxFirebaseLoginAppleComponent, DbxFirebaseLoginButtonComponent, DbxFirebaseLoginButtonContainerComponent, DbxFirebaseLoginComponent, DbxFirebaseLoginContext, DbxFirebaseLoginContextBackButtonComponent, DbxFirebaseLoginContextDirective, DbxFirebaseLoginEmailComponent, DbxFirebaseLoginEmailContentComponent, DbxFirebaseLoginFacebookComponent, DbxFirebaseLoginGitHubComponent, DbxFirebaseLoginGoogleComponent, DbxFirebaseLoginListComponent, DbxFirebaseLoginMicrosoftComponent, DbxFirebaseLoginModule, DbxFirebaseLoginModuleRootConfig, DbxFirebaseLoginTermsComponent, DbxFirebaseLoginTermsSimpleComponent, DbxFirebaseLoginTwitterComponent, DbxFirebaseModelModule, DbxFirebaseModelStoreModule, DbxFirebaseModule, DbxFirebaseParsedEmulatorsConfig, DbxFirebaseRegisterComponent, DbxFirebaseRegisterEmailComponent, DbxFirestoreContextService, FIREBASE_AUTH_NETWORK_REQUEST_ERROR, FIREBASE_AUTH_USER_NOT_FOUND_ERROR, OAUTH_FIREBASE_LOGIN_METHOD_CATEGORY, authUserInfoFromAuthUser, authUserStateFromFirebaseAuthService, dbxFirebaseCollectionLoaderInstance, dbxFirebaseCollectionLoaderInstanceWithCollection, defaultFirebaseAuthLoginProvidersFactory, firebaseAuthErrorToReadableError, modelDoesNotExistError, provideDbxFirebaseCollectionStoreDirective, provideDbxFirebaseDocumentStoreDirective, readValueFromIdToken, setParentEffect, setParentStoreEffect };
2529
+ export { AbstractConfiguredDbxFirebaseLoginButtonDirective, AbstractDbxFirebaseCollectionStore, AbstractDbxFirebaseCollectionWithParentStore, AbstractDbxFirebaseDocumentStore, AbstractDbxFirebaseDocumentWithParentStore, DBX_FIREBASE_MODEL_DOES_NOT_EXIST_ERROR, DBX_FIREBASE_OPTIONS_TOKEN, DBX_FIREBASE_ROUTER_SYNC_DEFAULT_ID_PARAM_KEY, DBX_FIRESTORE_CONTEXT_TOKEN, DEFAULT_CONFIGURED_DBX_FIREBASE_LOGIN_BUTTON_TEMPLATE, DEFAULT_DBX_FIREBASE_AUTH_SERVICE_DELEGATE, DEFAULT_FIREBASE_AUTH_LOGIN_PASSWORD_CONFIG, DEFAULT_FIREBASE_AUTH_LOGIN_PASSWORD_CONFIG_TOKEN, DEFAULT_FIREBASE_AUTH_LOGIN_PROVIDERS_TOKEN, DEFAULT_FIREBASE_AUTH_LOGIN_TERMS_COMPONENT_CLASS_TOKEN, DEFAULT_FIREBASE_LOGIN_METHOD_CATEGORY, DbxFirebaseAppCheckHttpInterceptor, DbxFirebaseAuthLoginService, DbxFirebaseAuthModule, DbxFirebaseAuthService, DbxFirebaseAuthServiceDelegate, DbxFirebaseCollectionChangeDirective, DbxFirebaseCollectionHasChangeDirective, DbxFirebaseCollectionListDirective, DbxFirebaseCollectionLoaderInstance, DbxFirebaseCollectionStoreDirective, DbxFirebaseCollectionWithParentStoreDirective, DbxFirebaseDefaultAppCheckProviderModule, DbxFirebaseDefaultAuthProviderModule, DbxFirebaseDefaultFirebaseProvidersModule, DbxFirebaseDefaultFirestoreProviderModule, DbxFirebaseDefaultFunctionsProviderModule, DbxFirebaseDefaultStorageProviderModule, DbxFirebaseDocumentAuthIdDirective, DbxFirebaseDocumentStoreDirective, DbxFirebaseDocumentStoreRouteIdDirective, DbxFirebaseEmailFormComponent, DbxFirebaseEmailRecoveryFormComponent, DbxFirebaseEmulatorModule, DbxFirebaseFirestoreCollectionModule, DbxFirebaseFunctionsModule, DbxFirebaseLoginAnonymousComponent, DbxFirebaseLoginAppleComponent, DbxFirebaseLoginButtonComponent, DbxFirebaseLoginButtonContainerComponent, DbxFirebaseLoginComponent, DbxFirebaseLoginContext, DbxFirebaseLoginContextBackButtonComponent, DbxFirebaseLoginContextDirective, DbxFirebaseLoginEmailComponent, DbxFirebaseLoginEmailContentComponent, DbxFirebaseLoginFacebookComponent, DbxFirebaseLoginGitHubComponent, DbxFirebaseLoginGoogleComponent, DbxFirebaseLoginListComponent, DbxFirebaseLoginMicrosoftComponent, DbxFirebaseLoginModule, DbxFirebaseLoginModuleRootConfig, DbxFirebaseLoginTermsComponent, DbxFirebaseLoginTermsSimpleComponent, DbxFirebaseLoginTwitterComponent, DbxFirebaseModelModule, DbxFirebaseModelStoreModule, DbxFirebaseModule, DbxFirebaseParsedEmulatorsConfig, DbxFirebaseRegisterComponent, DbxFirebaseRegisterEmailComponent, DbxFirestoreContextService, FIREBASE_AUTH_NETWORK_REQUEST_ERROR, FIREBASE_AUTH_USER_NOT_FOUND_ERROR, OAUTH_FIREBASE_LOGIN_METHOD_CATEGORY, authUserInfoFromAuthUser, authUserStateFromFirebaseAuthService, dbxFirebaseCollectionLoaderInstance, dbxFirebaseCollectionLoaderInstanceWithCollection, defaultFirebaseAuthLoginProvidersFactory, enableAppCheckDebugTokenGeneration, firebaseAuthErrorToReadableError, modelDoesNotExistError, provideDbxFirebaseCollectionStoreDirective, provideDbxFirebaseCollectionWithParentStoreDirective, provideDbxFirebaseDocumentStoreDirective, readValueFromIdToken, setParentStoreEffect };
2282
2530
  //# sourceMappingURL=dereekb-dbx-firebase.mjs.map