@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,123 @@
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 { filterMaybe, isNot, SubscriptionObject, cleanupDestroyable, accumulatorFlattenPageListLoadingState, useFirst, successResult, beginLoading, loadingStateFromObs, errorResult, cleanup } from '@dereekb/rxjs';
11
15
  import * as i3$1 from '@dereekb/dbx-core';
12
16
  import { loggedInObsFromIsLoggedIn, loggedOutObsFromIsLoggedIn, authUserIdentifier, DbxInjectionContext, AbstractForwardDbxInjectionContextDirective, DBX_INJECTION_COMPONENT_DATA, DbxInjectionComponentModule, DbxAuthService, AbstractSubscriptionDirective, AbstractIfDirective, LockSetComponentStore } from '@dereekb/dbx-core';
13
- import * as i1 from '@angular/fire/auth';
17
+ import * as i1$1 from '@angular/fire/auth';
14
18
  import { authState, GoogleAuthProvider, FacebookAuthProvider, TwitterAuthProvider, GithubAuthProvider, signInWithPopup, createUserWithEmailAndPassword, signInWithEmailAndPassword, signInAnonymously, provideAuth, getAuth, connectAuthEmulator } from '@angular/fire/auth';
15
19
  import { sendPasswordResetEmail } from 'firebase/auth';
16
- import { addToSet, removeFromSet, filterMaybeValues, mapIterable, asArray, excludeValuesFromArray, containsStringAnyCase, forEachKeyValue, readableError, isMaybeSo } from '@dereekb/util';
17
20
  import * as i3 from '@dereekb/dbx-web';
18
21
  import { DbxRouterAnchorModule, DbxReadableErrorModule, DbxActionModule, DbxButtonModule } from '@dereekb/dbx-web';
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
+ this.dbxFirebaseOptions = dbxFirebaseOptions;
55
+ this.appCheck = appCheck;
56
+ let routes = [];
57
+ if (appCheck != null) {
58
+ routes = (this.dbxFirebaseOptions.appCheck?.appCheckRoutes ?? ['/api/*']).map((route) => {
59
+ const wildcardIndex = route.indexOf('*');
60
+ const isWildcard = wildcardIndex === route.length - 1;
61
+ const match = isWildcard ? route.substring(0, wildcardIndex) : route;
62
+ return {
63
+ isWildcard,
64
+ match
65
+ };
66
+ });
67
+ }
68
+ this._appCheckRoutes = routes;
69
+ this._isEnabled = routes.length > 0;
70
+ }
71
+ intercept(req, next) {
72
+ let obs;
73
+ if (this._isEnabled) {
74
+ obs = this.matchesAnyRoute(req.url).pipe(switchMap((isMatch) => {
75
+ let nextEvent;
76
+ if (isMatch) {
77
+ nextEvent = from(getToken(this.appCheck).then((appCheckTokenResponse) => {
78
+ const token = appCheckTokenResponse.token;
79
+ let nextRequest = req;
80
+ if (token) {
81
+ nextRequest = req.clone({
82
+ headers: req.headers.set('X-Firebase-AppCheck', token)
83
+ });
84
+ }
85
+ return nextRequest;
86
+ })).pipe(switchMap((nextRequest) => next.handle(nextRequest)));
87
+ }
88
+ else {
89
+ nextEvent = next.handle(req);
90
+ }
91
+ return nextEvent;
92
+ }));
93
+ }
94
+ else {
95
+ obs = next.handle(req);
96
+ }
97
+ return obs;
98
+ }
99
+ matchesAnyRoute(inputUrl) {
100
+ const url = urlWithoutParameters(inputUrl);
101
+ function isEnabledRouteMatch(enabledRoute) {
102
+ if (enabledRoute.isWildcard) {
103
+ return url.startsWith(enabledRoute.match);
104
+ }
105
+ else {
106
+ return url === enabledRoute.match;
107
+ }
108
+ }
109
+ return from(this._appCheckRoutes).pipe(first((route) => isEnabledRouteMatch(route), false), map((x) => Boolean(x)));
110
+ }
111
+ }
112
+ 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 });
113
+ DbxFirebaseAppCheckHttpInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseAppCheckHttpInterceptor });
114
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseAppCheckHttpInterceptor, decorators: [{
115
+ type: Injectable
116
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
117
+ type: Inject,
118
+ args: [DBX_FIREBASE_OPTIONS_TOKEN]
119
+ }] }, { type: i1.AppCheck }]; } });
120
+
32
121
  /**
33
122
  * Derives a user state from the input firebase auth service.
34
123
  *
@@ -158,11 +247,11 @@ class DbxFirebaseAuthService {
158
247
  return this.firebaseAuth.signOut();
159
248
  }
160
249
  }
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 });
250
+ 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
251
  DbxFirebaseAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseAuthService });
163
252
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseAuthService, decorators: [{
164
253
  type: Injectable
165
- }], ctorParameters: function () { return [{ type: i1.Auth }, { type: DbxFirebaseAuthServiceDelegate, decorators: [{
254
+ }], ctorParameters: function () { return [{ type: i1$1.Auth }, { type: DbxFirebaseAuthServiceDelegate, decorators: [{
166
255
  type: Optional
167
256
  }] }]; } });
168
257
 
@@ -693,7 +782,7 @@ class DbxFirebaseEmailFormComponent extends AbstractAsyncFormlyFormDirective {
693
782
  DbxFirebaseEmailFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseEmailFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
694
783
  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: `
695
784
  <dbx-formly></dbx-formly>
696
- `, isInline: true, components: [{ type: i1$1.DbxFormlyFormComponent, selector: "dbx-formly", exportAs: ["formly"] }] });
785
+ `, isInline: true, components: [{ type: i1$2.DbxFormlyFormComponent, selector: "dbx-formly", exportAs: ["formly"] }] });
697
786
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseEmailFormComponent, decorators: [{
698
787
  type: Component,
699
788
  args: [{
@@ -716,7 +805,7 @@ class DbxFirebaseEmailRecoveryFormComponent extends AbstractSyncFormlyFormDirect
716
805
  DbxFirebaseEmailRecoveryFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseEmailRecoveryFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
717
806
  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: `
718
807
  <dbx-formly></dbx-formly>
719
- `, isInline: true, components: [{ type: i1$1.DbxFormlyFormComponent, selector: "dbx-formly", exportAs: ["formly"] }] });
808
+ `, isInline: true, components: [{ type: i1$2.DbxFormlyFormComponent, selector: "dbx-formly", exportAs: ["formly"] }] });
720
809
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseEmailRecoveryFormComponent, decorators: [{
721
810
  type: Component,
722
811
  args: [{
@@ -810,7 +899,7 @@ class DbxFirebaseLoginEmailContentComponent {
810
899
  }
811
900
  }
812
901
  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 });
813
- 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 } });
902
+ 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 } });
814
903
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseLoginEmailContentComponent, decorators: [{
815
904
  type: Component,
816
905
  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" }]
@@ -1291,7 +1380,7 @@ class DbxFirebaseParsedEmulatorsConfig {
1291
1380
  class DbxFirebaseDefaultFirestoreProviderModule {
1292
1381
  }
1293
1382
  DbxFirebaseDefaultFirestoreProviderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFirestoreProviderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1294
- DbxFirebaseDefaultFirestoreProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFirestoreProviderModule, imports: [i1$2.FirestoreModule] });
1383
+ DbxFirebaseDefaultFirestoreProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFirestoreProviderModule, imports: [i1$3.FirestoreModule] });
1295
1384
  DbxFirebaseDefaultFirestoreProviderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFirestoreProviderModule, imports: [[
1296
1385
  provideFirestore(((injector) => {
1297
1386
  const firebaseApp = injector.get(FirebaseApp);
@@ -1321,13 +1410,96 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
1321
1410
  ]
1322
1411
  }]
1323
1412
  }] });
1413
+ /**
1414
+ * Default firebase app check provider module.
1415
+ *
1416
+ * Also configures the DbxFirebaseAppCheckHttpInterceptor with HTTP_INTERCEPTORS in order for appCheck to be appended to requests to the api.
1417
+ */
1418
+ class DbxFirebaseDefaultAppCheckProviderModule {
1419
+ }
1420
+ DbxFirebaseDefaultAppCheckProviderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultAppCheckProviderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1421
+ DbxFirebaseDefaultAppCheckProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultAppCheckProviderModule, imports: [i1.AppCheckModule] });
1422
+ DbxFirebaseDefaultAppCheckProviderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultAppCheckProviderModule, providers: [
1423
+ {
1424
+ provide: HTTP_INTERCEPTORS,
1425
+ useClass: DbxFirebaseAppCheckHttpInterceptor,
1426
+ multi: true
1427
+ }
1428
+ ], imports: [[
1429
+ provideAppCheck(((injector) => {
1430
+ const firebaseApp = injector.get(FirebaseApp);
1431
+ const firebaseOptions = injector.get(DBX_FIREBASE_OPTIONS_TOKEN);
1432
+ const appCheckOptions = firebaseOptions.appCheck;
1433
+ const appCheckKnowinglyDisabled = appCheckOptions?.disabled === true || firebaseOptions.emulators?.useEmulators === true;
1434
+ let appCheck;
1435
+ if (appCheckOptions && !appCheckKnowinglyDisabled) {
1436
+ // enable the debug tokens if not using emulators and allowDebugTokens is set true
1437
+ if (firebaseOptions.emulators?.useEmulators !== true && appCheckOptions.allowDebugTokens) {
1438
+ enableAppCheckDebugTokenGeneration(true);
1439
+ }
1440
+ // Only enabled outside of app-check environments. The emulators will not use appcheck.
1441
+ appCheck = initializeAppCheck(firebaseApp, {
1442
+ provider: new ReCaptchaV3Provider(appCheckOptions.reCaptchaV3),
1443
+ isTokenAutoRefreshEnabled: appCheckOptions.isTokenAutoRefreshEnabled ?? true
1444
+ });
1445
+ console.debug('Enabled AppCheck.');
1446
+ }
1447
+ else {
1448
+ appCheck = undefined;
1449
+ if (!appCheckKnowinglyDisabled) {
1450
+ console.error('dbx-firebase: No appcheck configuration for the app, and not specifically disabled in config either.');
1451
+ }
1452
+ }
1453
+ return appCheck;
1454
+ }))
1455
+ ]] });
1456
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultAppCheckProviderModule, decorators: [{
1457
+ type: NgModule,
1458
+ args: [{
1459
+ imports: [
1460
+ provideAppCheck(((injector) => {
1461
+ const firebaseApp = injector.get(FirebaseApp);
1462
+ const firebaseOptions = injector.get(DBX_FIREBASE_OPTIONS_TOKEN);
1463
+ const appCheckOptions = firebaseOptions.appCheck;
1464
+ const appCheckKnowinglyDisabled = appCheckOptions?.disabled === true || firebaseOptions.emulators?.useEmulators === true;
1465
+ let appCheck;
1466
+ if (appCheckOptions && !appCheckKnowinglyDisabled) {
1467
+ // enable the debug tokens if not using emulators and allowDebugTokens is set true
1468
+ if (firebaseOptions.emulators?.useEmulators !== true && appCheckOptions.allowDebugTokens) {
1469
+ enableAppCheckDebugTokenGeneration(true);
1470
+ }
1471
+ // Only enabled outside of app-check environments. The emulators will not use appcheck.
1472
+ appCheck = initializeAppCheck(firebaseApp, {
1473
+ provider: new ReCaptchaV3Provider(appCheckOptions.reCaptchaV3),
1474
+ isTokenAutoRefreshEnabled: appCheckOptions.isTokenAutoRefreshEnabled ?? true
1475
+ });
1476
+ console.debug('Enabled AppCheck.');
1477
+ }
1478
+ else {
1479
+ appCheck = undefined;
1480
+ if (!appCheckKnowinglyDisabled) {
1481
+ console.error('dbx-firebase: No appcheck configuration for the app, and not specifically disabled in config either.');
1482
+ }
1483
+ }
1484
+ return appCheck;
1485
+ }))
1486
+ ],
1487
+ providers: [
1488
+ {
1489
+ provide: HTTP_INTERCEPTORS,
1490
+ useClass: DbxFirebaseAppCheckHttpInterceptor,
1491
+ multi: true
1492
+ }
1493
+ ]
1494
+ }]
1495
+ }] });
1324
1496
  /**
1325
1497
  * Default firebase auth provider module.
1326
1498
  */
1327
1499
  class DbxFirebaseDefaultAuthProviderModule {
1328
1500
  }
1329
1501
  DbxFirebaseDefaultAuthProviderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultAuthProviderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1330
- DbxFirebaseDefaultAuthProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultAuthProviderModule, imports: [i1.AuthModule] });
1502
+ DbxFirebaseDefaultAuthProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultAuthProviderModule, imports: [i1$1.AuthModule] });
1331
1503
  DbxFirebaseDefaultAuthProviderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultAuthProviderModule, imports: [[
1332
1504
  provideAuth(((injector) => {
1333
1505
  const firebaseApp = injector.get(FirebaseApp);
@@ -1361,7 +1533,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
1361
1533
  class DbxFirebaseDefaultStorageProviderModule {
1362
1534
  }
1363
1535
  DbxFirebaseDefaultStorageProviderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultStorageProviderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1364
- DbxFirebaseDefaultStorageProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultStorageProviderModule, imports: [i3$2.StorageModule] });
1536
+ DbxFirebaseDefaultStorageProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultStorageProviderModule, imports: [i4$1.StorageModule] });
1365
1537
  DbxFirebaseDefaultStorageProviderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultStorageProviderModule, imports: [[
1366
1538
  provideStorage(((injector) => {
1367
1539
  const firebaseApp = injector.get(FirebaseApp);
@@ -1395,7 +1567,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
1395
1567
  class DbxFirebaseDefaultFunctionsProviderModule {
1396
1568
  }
1397
1569
  DbxFirebaseDefaultFunctionsProviderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFunctionsProviderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1398
- DbxFirebaseDefaultFunctionsProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFunctionsProviderModule, imports: [i4$1.FunctionsModule] });
1570
+ DbxFirebaseDefaultFunctionsProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFunctionsProviderModule, imports: [i5.FunctionsModule] });
1399
1571
  DbxFirebaseDefaultFunctionsProviderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFunctionsProviderModule, imports: [[
1400
1572
  provideFunctions(((injector) => {
1401
1573
  const firebaseApp = injector.get(FirebaseApp);
@@ -1427,7 +1599,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
1427
1599
  ]
1428
1600
  }]
1429
1601
  }] });
1430
- const DBX_FIREBASE_OPTIONS_TOKEN = new InjectionToken('DbxFirebaseOptions');
1431
1602
  /**
1432
1603
  * Default provider module.
1433
1604
  */
@@ -1445,12 +1616,13 @@ class DbxFirebaseDefaultFirebaseProvidersModule {
1445
1616
  }
1446
1617
  }
1447
1618
  DbxFirebaseDefaultFirebaseProvidersModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFirebaseProvidersModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1448
- DbxFirebaseDefaultFirebaseProvidersModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFirebaseProvidersModule, imports: [i5.FirebaseAppModule, DbxFirebaseDefaultFirestoreProviderModule, DbxFirebaseDefaultAuthProviderModule, DbxFirebaseDefaultStorageProviderModule, DbxFirebaseDefaultFunctionsProviderModule] });
1619
+ 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] });
1449
1620
  DbxFirebaseDefaultFirebaseProvidersModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseDefaultFirebaseProvidersModule, imports: [[
1450
1621
  provideFirebaseApp(((injector) => {
1451
1622
  const firebaseOptions = injector.get(DBX_FIREBASE_OPTIONS_TOKEN);
1452
1623
  return initializeApp(firebaseOptions);
1453
1624
  })),
1625
+ DbxFirebaseDefaultAppCheckProviderModule,
1454
1626
  DbxFirebaseDefaultFirestoreProviderModule,
1455
1627
  DbxFirebaseDefaultAuthProviderModule,
1456
1628
  DbxFirebaseDefaultStorageProviderModule,
@@ -1464,6 +1636,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
1464
1636
  const firebaseOptions = injector.get(DBX_FIREBASE_OPTIONS_TOKEN);
1465
1637
  return initializeApp(firebaseOptions);
1466
1638
  })),
1639
+ DbxFirebaseDefaultAppCheckProviderModule,
1467
1640
  DbxFirebaseDefaultFirestoreProviderModule,
1468
1641
  DbxFirebaseDefaultAuthProviderModule,
1469
1642
  DbxFirebaseDefaultStorageProviderModule,
@@ -2134,7 +2307,7 @@ function setParentStoreEffect(store) {
2134
2307
  return input.pipe(map((parentStore) => {
2135
2308
  let result;
2136
2309
  if (parentStore) {
2137
- result = store.setParent(parentStore.currentDocument$);
2310
+ result = store._setParent(parentStore.currentDocument$);
2138
2311
  }
2139
2312
  else {
2140
2313
  result = undefined;
@@ -2149,56 +2322,79 @@ function setParentStoreEffect(store) {
2149
2322
  }));
2150
2323
  });
2151
2324
  }
2152
- function setParentEffect(store) {
2153
- return store.effect((input) => {
2154
- return input.pipe(switchMap((parent) => {
2155
- store._setParentDocument(parent);
2156
- if (parent) {
2157
- return store.collectionFactory$.pipe(tap((collectionFactory) => {
2158
- const collection = collectionFactory(parent);
2159
- store.setFirestoreCollection(collection);
2160
- }));
2161
- }
2162
- else {
2163
- // clear the current collection
2164
- store.setFirestoreCollection(undefined);
2165
- // do nothing until a parent is returned.
2166
- return NEVER;
2167
- }
2168
- }));
2169
- });
2170
- }
2171
2325
 
2172
2326
  /**
2173
2327
  * Abstract DbxFirebaseCollectionStore that has a parent document from which is derives it's FiresbaseCollection from.
2174
2328
  */
2175
2329
  class AbstractDbxFirebaseCollectionWithParentStore extends AbstractDbxFirebaseCollectionStore {
2176
- constructor() {
2177
- super(...arguments);
2330
+ constructor(state, defaultSourceMode) {
2331
+ super(state);
2178
2332
  // MARK: Effects
2179
- this.setParent = setParentEffect(this);
2180
2333
  this.setParentStore = setParentStoreEffect(this);
2334
+ this.setSourceMode = this.effect((input) => {
2335
+ return input.pipe(distinctUntilChanged(), switchMap((inputMode) => {
2336
+ const mode = inputMode?.toLowerCase() ?? 'parent'; // default to parent mode
2337
+ if (mode === 'group') {
2338
+ return this.currentCollectionGroup$.pipe(tap((collectionGroup) => {
2339
+ this.setFirestoreCollection(collectionGroup);
2340
+ }));
2341
+ }
2342
+ else {
2343
+ // parent document collection
2344
+ return this.currentParent$.pipe(switchMap((parent) => {
2345
+ if (parent) {
2346
+ return this.collectionFactory$.pipe(tap((collectionFactory) => {
2347
+ const collection = collectionFactory(parent);
2348
+ this.setFirestoreCollection(collection);
2349
+ }));
2350
+ }
2351
+ else {
2352
+ this.setFirestoreCollection(undefined);
2353
+ return NEVER;
2354
+ }
2355
+ }));
2356
+ }
2357
+ }));
2358
+ });
2181
2359
  // MARK: Accessors
2182
2360
  this.currentParent$ = this.state$.pipe(map((x) => x.parent), distinctUntilChanged(), shareReplay(1));
2183
2361
  this.parent$ = this.currentParent$.pipe(filterMaybe());
2184
2362
  this.currentCollectionFactory$ = this.state$.pipe(map((x) => x.collectionFactory), distinctUntilChanged(), shareReplay(1));
2185
2363
  this.collectionFactory$ = this.currentCollectionFactory$.pipe(filterMaybe());
2364
+ this.currentCollectionGroup$ = this.state$.pipe(map((x) => x.collectionGroup), distinctUntilChanged(), shareReplay(1));
2365
+ this.collectionGroup$ = this.currentCollectionGroup$.pipe(filterMaybe());
2186
2366
  // MARK: State Changes
2187
2367
  /**
2188
2368
  * Sets the collection factory function to use.
2189
2369
  */
2190
2370
  this.setCollectionFactory = this.updater((state, collectionFactory) => ({ ...state, collectionFactory }));
2371
+ /**
2372
+ * Sets the collection group to use.
2373
+ */
2374
+ this.setCollectionGroup = this.updater((state, collectionGroup) => ({ ...state, collectionGroup }));
2191
2375
  /**
2192
2376
  * Sets the parent on the current state.
2193
2377
  */
2194
2378
  this._setParentDocument = this.updater((state, parent) => ({ ...state, parent }));
2379
+ this._setParent = this._setParentDocument;
2380
+ this.setSourceMode(defaultSourceMode || 'parent');
2195
2381
  }
2196
2382
  }
2197
- AbstractDbxFirebaseCollectionWithParentStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AbstractDbxFirebaseCollectionWithParentStore, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
2383
+ 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 });
2198
2384
  AbstractDbxFirebaseCollectionWithParentStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AbstractDbxFirebaseCollectionWithParentStore });
2199
2385
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AbstractDbxFirebaseCollectionWithParentStore, decorators: [{
2200
2386
  type: Injectable
2201
- }] });
2387
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2388
+ type: Inject,
2389
+ args: [null]
2390
+ }, {
2391
+ type: Optional
2392
+ }] }, { type: undefined, decorators: [{
2393
+ type: Inject,
2394
+ args: [null]
2395
+ }, {
2396
+ type: Optional
2397
+ }] }]; } });
2202
2398
 
2203
2399
  /**
2204
2400
  * Abstract DbxFirebaseDocumentStore that has a parent document from which is derives it's FiresbaseCollection from.
@@ -2207,8 +2403,25 @@ class AbstractDbxFirebaseDocumentWithParentStore extends AbstractDbxFirebaseDocu
2207
2403
  constructor() {
2208
2404
  super(...arguments);
2209
2405
  // MARK: Effects
2210
- this.setParent = setParentEffect(this);
2211
2406
  this.setParentStore = setParentStoreEffect(this);
2407
+ this.setParent = this.effect((input) => {
2408
+ return input.pipe(switchMap((parent) => {
2409
+ this._setParentDocument(parent);
2410
+ if (parent) {
2411
+ return this.collectionFactory$.pipe(tap((collectionFactory) => {
2412
+ const collection = collectionFactory(parent);
2413
+ this.setFirestoreCollection(collection);
2414
+ }));
2415
+ }
2416
+ else {
2417
+ // clear the current collection
2418
+ this.setFirestoreCollection(undefined);
2419
+ // do nothing until a parent is returned.
2420
+ return NEVER;
2421
+ }
2422
+ }));
2423
+ });
2424
+ this._setParent = this.setParent;
2212
2425
  // MARK: Accessors
2213
2426
  this.currentParent$ = this.state$.pipe(map((x) => x.parent), distinctUntilChanged(), shareReplay(1));
2214
2427
  this.parent$ = this.currentParent$.pipe(filterMaybe());
@@ -2231,6 +2444,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
2231
2444
  type: Injectable
2232
2445
  }] });
2233
2446
 
2447
+ /**
2448
+ * Abstract directive that contains a DbxFirebaseCollectionWithParentStore and provides an interface for communicating with other directives.
2449
+ */
2450
+ class DbxFirebaseCollectionWithParentStoreDirective extends DbxFirebaseCollectionStoreDirective {
2451
+ // MARK: Inputs
2452
+ set sourceMode(sourceMode) {
2453
+ this.store.setSourceMode(sourceMode);
2454
+ }
2455
+ }
2456
+ DbxFirebaseCollectionWithParentStoreDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseCollectionWithParentStoreDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2457
+ DbxFirebaseCollectionWithParentStoreDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.2", type: DbxFirebaseCollectionWithParentStoreDirective, inputs: { sourceMode: "sourceMode" }, usesInheritance: true, ngImport: i0 });
2458
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseCollectionWithParentStoreDirective, decorators: [{
2459
+ type: Directive
2460
+ }], propDecorators: { sourceMode: [{
2461
+ type: Input
2462
+ }] } });
2463
+ function provideDbxFirebaseCollectionWithParentStoreDirective(sourceType, storeType) {
2464
+ const providers = [
2465
+ ...provideDbxFirebaseCollectionStoreDirective(sourceType, storeType),
2466
+ {
2467
+ provide: DbxFirebaseCollectionWithParentStoreDirective,
2468
+ useExisting: forwardRef(() => sourceType)
2469
+ }
2470
+ ];
2471
+ return providers;
2472
+ }
2473
+
2234
2474
  class DbxFirebaseModelModule {
2235
2475
  }
2236
2476
  DbxFirebaseModelModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxFirebaseModelModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
@@ -2259,5 +2499,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
2259
2499
  * Generated bundle index. Do not edit.
2260
2500
  */
2261
2501
 
2262
- 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 };
2502
+ 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 };
2263
2503
  //# sourceMappingURL=dereekb-dbx-firebase.mjs.map