@dereekb/dbx-firebase 9.25.16 → 10.0.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 (217) hide show
  1. package/_index.scss +1 -0
  2. package/{esm2020 → esm2022}/lib/analytics/analytics.user.events.mjs +4 -4
  3. package/{esm2020 → esm2022}/lib/analytics/analytics.user.source.mjs +4 -4
  4. package/{esm2020 → esm2022}/lib/auth/appcheck/appcheck.interceptor.mjs +4 -4
  5. package/{esm2020 → esm2022}/lib/auth/firebase.auth.module.mjs +5 -5
  6. package/{esm2020 → esm2022}/lib/auth/login/firebase.login.module.mjs +45 -45
  7. package/esm2022/lib/auth/login/login.anonymous.component.mjs +23 -0
  8. package/esm2022/lib/auth/login/login.apple.component.mjs +23 -0
  9. package/{esm2020 → esm2022}/lib/auth/login/login.button.component.mjs +14 -14
  10. package/{esm2020 → esm2022}/lib/auth/login/login.component.mjs +6 -6
  11. package/{esm2020 → esm2022}/lib/auth/login/login.context.back.component.mjs +6 -6
  12. package/esm2022/lib/auth/login/login.context.directive.mjs +29 -0
  13. package/esm2022/lib/auth/login/login.email.component.mjs +24 -0
  14. package/{esm2020 → esm2022}/lib/auth/login/login.email.content.component.mjs +4 -4
  15. package/{esm2020 → esm2022}/lib/auth/login/login.email.form.component.mjs +6 -6
  16. package/{esm2020 → esm2022}/lib/auth/login/login.email.recovery.form.component.mjs +6 -6
  17. package/esm2022/lib/auth/login/login.facebook.component.mjs +23 -0
  18. package/esm2022/lib/auth/login/login.github.component.mjs +23 -0
  19. package/esm2022/lib/auth/login/login.google.component.mjs +23 -0
  20. package/{esm2020 → esm2022}/lib/auth/login/login.list.component.mjs +6 -6
  21. package/esm2022/lib/auth/login/login.microsoft.component.mjs +23 -0
  22. package/{esm2020 → esm2022}/lib/auth/login/login.service.mjs +4 -4
  23. package/{esm2020 → esm2022}/lib/auth/login/login.terms.component.mjs +6 -6
  24. package/{esm2020 → esm2022}/lib/auth/login/login.terms.simple.component.mjs +6 -6
  25. package/esm2022/lib/auth/login/login.twitter.component.mjs +23 -0
  26. package/{esm2020 → esm2022}/lib/auth/login/register.component.mjs +6 -6
  27. package/{esm2020 → esm2022}/lib/auth/login/register.email.component.mjs +4 -4
  28. package/{esm2020 → esm2022}/lib/auth/service/firebase.auth.service.mjs +4 -4
  29. package/{esm2020 → esm2022}/lib/development/development.module.mjs +22 -22
  30. package/{esm2020 → esm2022}/lib/development/development.popup.component.mjs +6 -6
  31. package/{esm2020 → esm2022}/lib/development/development.popup.content.component.mjs +4 -4
  32. package/{esm2020 → esm2022}/lib/development/development.popup.content.form.component.mjs +6 -6
  33. package/{esm2020 → esm2022}/lib/development/development.popup.directive.mjs +4 -4
  34. package/esm2022/lib/development/development.scheduler.list.component.mjs +80 -0
  35. package/{esm2020 → esm2022}/lib/development/development.scheduler.service.mjs +4 -4
  36. package/{esm2020 → esm2022}/lib/development/development.scheduler.widget.component.mjs +6 -6
  37. package/{esm2020 → esm2022}/lib/development/development.service.mjs +4 -4
  38. package/{esm2020 → esm2022}/lib/development/development.widget.service.mjs +4 -4
  39. package/{esm2020 → esm2022}/lib/firebase/firebase.emulator.module.mjs +5 -5
  40. package/esm2022/lib/firebase/firebase.emulator.service.mjs +35 -0
  41. package/esm2022/lib/firebase/firebase.module.mjs +293 -0
  42. package/{esm2020 → esm2022}/lib/firestore/firebase.firestore.context.service.mjs +4 -4
  43. package/{esm2020 → esm2022}/lib/firestore/firebase.firestore.module.mjs +5 -5
  44. package/{esm2020 → esm2022}/lib/function/firebase.function.module.mjs +5 -5
  45. package/{esm2020 → esm2022}/lib/model/model.module.mjs +5 -5
  46. package/esm2022/lib/model/modules/model/model.history.component.mjs +48 -0
  47. package/{esm2020 → esm2022}/lib/model/modules/model/model.history.module.mjs +5 -5
  48. package/{esm2020 → esm2022}/lib/model/modules/model/model.history.popover.button.component.mjs +6 -6
  49. package/esm2022/lib/model/modules/model/model.history.popover.component.mjs +50 -0
  50. package/esm2022/lib/model/modules/model/model.tracker.service.mjs +62 -0
  51. package/esm2022/lib/model/modules/model/model.types.list.component.mjs +64 -0
  52. package/{esm2020 → esm2022}/lib/model/modules/model/model.types.module.mjs +5 -5
  53. package/{esm2020 → esm2022}/lib/model/modules/model/model.types.service.mjs +4 -4
  54. package/{esm2020 → esm2022}/lib/model/modules/model/model.types.view.directive.mjs +4 -4
  55. package/{esm2020 → esm2022}/lib/model/modules/store/model.store.module.mjs +5 -5
  56. package/{esm2020 → esm2022}/lib/model/modules/store/store.collection.change.directive.mjs +7 -7
  57. package/{esm2020 → esm2022}/lib/model/modules/store/store.collection.change.if.directive.mjs +4 -4
  58. package/{esm2020 → esm2022}/lib/model/modules/store/store.collection.directive.mjs +4 -4
  59. package/{esm2020 → esm2022}/lib/model/modules/store/store.collection.list.directive.mjs +4 -4
  60. package/{esm2020 → esm2022}/lib/model/modules/store/store.collection.mjs +4 -4
  61. package/{esm2020 → esm2022}/lib/model/modules/store/store.document.auth.directive.mjs +4 -4
  62. package/{esm2020 → esm2022}/lib/model/modules/store/store.document.crud.mjs +1 -1
  63. package/{esm2020 → esm2022}/lib/model/modules/store/store.document.directive.mjs +4 -4
  64. package/esm2022/lib/model/modules/store/store.document.mjs +167 -0
  65. package/{esm2020 → esm2022}/lib/model/modules/store/store.document.router.directive.mjs +4 -4
  66. package/{esm2020 → esm2022}/lib/model/modules/store/store.document.router.key.directive.mjs +4 -4
  67. package/{esm2020 → esm2022}/lib/model/modules/store/store.subcollection.directive.mjs +4 -4
  68. package/{esm2020 → esm2022}/lib/model/modules/store/store.subcollection.document.mjs +4 -4
  69. package/{esm2020 → esm2022}/lib/model/modules/store/store.subcollection.mjs +4 -4
  70. package/esm2022/lib/model/service/model.context.service.mjs +38 -0
  71. package/{esm2020 → esm2022}/lib/model/system/systemstate.collection.store.directive.mjs +4 -4
  72. package/{esm2020 → esm2022}/lib/model/system/systemstate.collection.store.mjs +4 -4
  73. package/{esm2020 → esm2022}/lib/model/system/systemstate.document.store.directive.mjs +4 -4
  74. package/{esm2020 → esm2022}/lib/model/system/systemstate.document.store.mjs +4 -4
  75. package/{esm2020 → esm2022}/lib/module.mjs +5 -5
  76. package/{esm2020 → esm2022}/lib/pipe/key.pipe.mjs +7 -7
  77. package/{esm2020 → esm2022}/lib/pipe/pipe.module.mjs +5 -5
  78. package/{esm2020 → esm2022}/lib/storage/firebase.storage.module.mjs +5 -5
  79. package/{esm2020 → esm2022}/lib/storage/firebase.storage.service.mjs +4 -4
  80. package/{fesm2020 → fesm2022}/dereekb-dbx-firebase.mjs +500 -490
  81. package/fesm2022/dereekb-dbx-firebase.mjs.map +1 -0
  82. package/lib/analytics/analytics.user.source.d.ts +1 -1
  83. package/lib/auth/auth.d.ts +1 -1
  84. package/lib/auth/login/_login.scss +6 -2
  85. package/lib/auth/login/login.anonymous.component.d.ts +1 -1
  86. package/lib/auth/login/login.apple.component.d.ts +1 -1
  87. package/lib/auth/login/login.button.component.d.ts +4 -4
  88. package/lib/auth/login/login.component.d.ts +1 -1
  89. package/lib/auth/login/login.context.back.component.d.ts +1 -1
  90. package/lib/auth/login/login.context.directive.d.ts +1 -1
  91. package/lib/auth/login/login.d.ts +5 -5
  92. package/lib/auth/login/login.email.component.d.ts +1 -1
  93. package/lib/auth/login/login.email.content.component.d.ts +2 -2
  94. package/lib/auth/login/login.email.form.component.d.ts +2 -2
  95. package/lib/auth/login/login.email.recovery.form.component.d.ts +1 -1
  96. package/lib/auth/login/login.facebook.component.d.ts +1 -1
  97. package/lib/auth/login/login.github.component.d.ts +1 -1
  98. package/lib/auth/login/login.google.component.d.ts +1 -1
  99. package/lib/auth/login/login.list.component.d.ts +1 -1
  100. package/lib/auth/login/login.microsoft.component.d.ts +1 -1
  101. package/lib/auth/login/login.password.d.ts +1 -1
  102. package/lib/auth/login/login.service.d.ts +1 -1
  103. package/lib/auth/login/login.terms.component.d.ts +1 -1
  104. package/lib/auth/login/login.terms.simple.component.d.ts +1 -1
  105. package/lib/auth/login/login.twitter.component.d.ts +1 -1
  106. package/lib/auth/login/register.component.d.ts +1 -1
  107. package/lib/auth/login/register.email.component.d.ts +1 -1
  108. package/lib/auth/service/firebase.auth.rxjs.d.ts +1 -1
  109. package/lib/auth/service/firebase.auth.service.d.ts +1 -1
  110. package/lib/auth/service/firebase.auth.service.delegate.d.ts +1 -1
  111. package/lib/development/development.popup.component.d.ts +1 -1
  112. package/lib/development/development.popup.content.component.d.ts +1 -1
  113. package/lib/development/development.popup.content.form.component.d.ts +1 -1
  114. package/lib/development/development.popup.directive.d.ts +1 -1
  115. package/lib/development/development.scheduler.list.component.d.ts +4 -4
  116. package/lib/development/development.scheduler.widget.component.d.ts +3 -3
  117. package/lib/model/loader/collection.change.trigger.d.ts +1 -1
  118. package/lib/model/loader/collection.change.watcher.d.ts +2 -2
  119. package/lib/model/loader/collection.loader.instance.d.ts +1 -1
  120. package/lib/model/modules/model/model.history.component.d.ts +1 -1
  121. package/lib/model/modules/model/model.history.popover.button.component.d.ts +2 -2
  122. package/lib/model/modules/model/model.history.popover.component.d.ts +1 -1
  123. package/lib/model/modules/model/model.types.list.component.d.ts +4 -4
  124. package/lib/model/modules/model/model.types.service.d.ts +3 -3
  125. package/lib/model/modules/model/model.types.view.directive.d.ts +1 -1
  126. package/lib/model/modules/store/store.collection.change.directive.d.ts +1 -1
  127. package/lib/model/modules/store/store.collection.change.if.directive.d.ts +2 -2
  128. package/lib/model/modules/store/store.collection.directive.d.ts +2 -2
  129. package/lib/model/modules/store/store.collection.list.directive.d.ts +1 -1
  130. package/lib/model/modules/store/store.document.auth.directive.d.ts +1 -1
  131. package/lib/model/modules/store/store.document.crud.d.ts +5 -9
  132. package/lib/model/modules/store/store.document.directive.d.ts +5 -5
  133. package/lib/model/modules/store/store.document.router.directive.d.ts +1 -1
  134. package/lib/model/modules/store/store.document.router.key.directive.d.ts +1 -1
  135. package/lib/model/modules/store/store.subcollection.d.ts +3 -3
  136. package/lib/model/modules/store/store.subcollection.directive.d.ts +1 -1
  137. package/lib/model/modules/store/store.subcollection.document.d.ts +1 -1
  138. package/lib/model/modules/store/store.subcollection.rxjs.d.ts +3 -3
  139. package/lib/model/service/model.context.instance.d.ts +1 -1
  140. package/lib/model/service/model.context.service.d.ts +1 -1
  141. package/lib/model/system/systemstate.collection.store.directive.d.ts +1 -1
  142. package/lib/model/system/systemstate.document.store.directive.d.ts +1 -1
  143. package/lib/storage/firebase.storage.module.d.ts +1 -1
  144. package/lib/style/_all-typography.scss +2 -2
  145. package/lib/style/_core.scss +1 -2
  146. package/lib/style/_theming.scss +1 -1
  147. package/package.json +25 -21
  148. package/esm2020/lib/auth/login/login.anonymous.component.mjs +0 -22
  149. package/esm2020/lib/auth/login/login.apple.component.mjs +0 -22
  150. package/esm2020/lib/auth/login/login.context.directive.mjs +0 -29
  151. package/esm2020/lib/auth/login/login.email.component.mjs +0 -23
  152. package/esm2020/lib/auth/login/login.facebook.component.mjs +0 -22
  153. package/esm2020/lib/auth/login/login.github.component.mjs +0 -22
  154. package/esm2020/lib/auth/login/login.google.component.mjs +0 -22
  155. package/esm2020/lib/auth/login/login.microsoft.component.mjs +0 -22
  156. package/esm2020/lib/auth/login/login.twitter.component.mjs +0 -22
  157. package/esm2020/lib/development/development.scheduler.list.component.mjs +0 -79
  158. package/esm2020/lib/firebase/firebase.emulator.service.mjs +0 -35
  159. package/esm2020/lib/firebase/firebase.module.mjs +0 -293
  160. package/esm2020/lib/model/modules/model/model.history.component.mjs +0 -48
  161. package/esm2020/lib/model/modules/model/model.history.popover.component.mjs +0 -50
  162. package/esm2020/lib/model/modules/model/model.tracker.service.mjs +0 -62
  163. package/esm2020/lib/model/modules/model/model.types.list.component.mjs +0 -63
  164. package/esm2020/lib/model/modules/store/store.document.mjs +0 -168
  165. package/esm2020/lib/model/service/model.context.service.mjs +0 -38
  166. package/fesm2015/dereekb-dbx-firebase.mjs +0 -4632
  167. package/fesm2015/dereekb-dbx-firebase.mjs.map +0 -1
  168. package/fesm2020/dereekb-dbx-firebase.mjs.map +0 -1
  169. /package/{esm2020 → esm2022}/dereekb-dbx-firebase.mjs +0 -0
  170. /package/{esm2020 → esm2022}/index.mjs +0 -0
  171. /package/{esm2020 → esm2022}/lib/analytics/index.mjs +0 -0
  172. /package/{esm2020 → esm2022}/lib/auth/appcheck/appcheck.mjs +0 -0
  173. /package/{esm2020 → esm2022}/lib/auth/appcheck/index.mjs +0 -0
  174. /package/{esm2020 → esm2022}/lib/auth/auth.mjs +0 -0
  175. /package/{esm2020 → esm2022}/lib/auth/index.mjs +0 -0
  176. /package/{esm2020 → esm2022}/lib/auth/login/index.mjs +0 -0
  177. /package/{esm2020 → esm2022}/lib/auth/login/login.context.mjs +0 -0
  178. /package/{esm2020 → esm2022}/lib/auth/login/login.mjs +0 -0
  179. /package/{esm2020 → esm2022}/lib/auth/login/login.password.mjs +0 -0
  180. /package/{esm2020 → esm2022}/lib/auth/login/login.terms.mjs +0 -0
  181. /package/{esm2020 → esm2022}/lib/auth/service/firebase.auth.rxjs.mjs +0 -0
  182. /package/{esm2020 → esm2022}/lib/auth/service/firebase.auth.service.delegate.mjs +0 -0
  183. /package/{esm2020 → esm2022}/lib/auth/service/index.mjs +0 -0
  184. /package/{esm2020 → esm2022}/lib/development/development.widget.mjs +0 -0
  185. /package/{esm2020 → esm2022}/lib/development/index.mjs +0 -0
  186. /package/{esm2020 → esm2022}/lib/firebase/appcheck.mjs +0 -0
  187. /package/{esm2020 → esm2022}/lib/firebase/emulators.mjs +0 -0
  188. /package/{esm2020 → esm2022}/lib/firebase/index.mjs +0 -0
  189. /package/{esm2020 → esm2022}/lib/firebase/options.mjs +0 -0
  190. /package/{esm2020 → esm2022}/lib/firestore/firebase.firestore.mjs +0 -0
  191. /package/{esm2020 → esm2022}/lib/firestore/index.mjs +0 -0
  192. /package/{esm2020 → esm2022}/lib/function/index.mjs +0 -0
  193. /package/{esm2020 → esm2022}/lib/index.mjs +0 -0
  194. /package/{esm2020 → esm2022}/lib/model/error.mjs +0 -0
  195. /package/{esm2020 → esm2022}/lib/model/index.mjs +0 -0
  196. /package/{esm2020 → esm2022}/lib/model/loader/collection.change.trigger.mjs +0 -0
  197. /package/{esm2020 → esm2022}/lib/model/loader/collection.change.watcher.mjs +0 -0
  198. /package/{esm2020 → esm2022}/lib/model/loader/collection.loader.instance.mjs +0 -0
  199. /package/{esm2020 → esm2022}/lib/model/loader/collection.loader.mjs +0 -0
  200. /package/{esm2020 → esm2022}/lib/model/loader/document.loader.instance.mjs +0 -0
  201. /package/{esm2020 → esm2022}/lib/model/loader/document.loader.mjs +0 -0
  202. /package/{esm2020 → esm2022}/lib/model/loader/index.mjs +0 -0
  203. /package/{esm2020 → esm2022}/lib/model/modules/index.mjs +0 -0
  204. /package/{esm2020 → esm2022}/lib/model/modules/model/index.mjs +0 -0
  205. /package/{esm2020 → esm2022}/lib/model/modules/model/model.sourceselect.history.mjs +0 -0
  206. /package/{esm2020 → esm2022}/lib/model/modules/store/index.mjs +0 -0
  207. /package/{esm2020 → esm2022}/lib/model/modules/store/store.subcollection.rxjs.mjs +0 -0
  208. /package/{esm2020 → esm2022}/lib/model/service/index.mjs +0 -0
  209. /package/{esm2020 → esm2022}/lib/model/service/model.context.instance.mjs +0 -0
  210. /package/{esm2020 → esm2022}/lib/model/service/model.context.mjs +0 -0
  211. /package/{esm2020 → esm2022}/lib/model/system/index.mjs +0 -0
  212. /package/{esm2020 → esm2022}/lib/model/system/systemstate.document.store.accessor.mjs +0 -0
  213. /package/{esm2020 → esm2022}/lib/pipe/index.mjs +0 -0
  214. /package/{esm2020 → esm2022}/lib/router/id.param.redirect.mjs +0 -0
  215. /package/{esm2020 → esm2022}/lib/router/index.mjs +0 -0
  216. /package/{esm2020 → esm2022}/lib/storage/firebase.storage.mjs +0 -0
  217. /package/{esm2020 → esm2022}/lib/storage/index.mjs +0 -0
@@ -1,4632 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Injectable, Optional, InjectionToken, Inject, Component, Input, Directive, EventEmitter, Output, NgModule, Injector, ViewChild, HostListener, ElementRef, ChangeDetectionStrategy, forwardRef, Host, Pipe } from '@angular/core';
3
- import { asObservable, timeoutStartWith, filterMaybe, isNot, SubscriptionObject, lazyFrom, switchMapWhileTrue, loadingStateFromObs, cleanupDestroyable, accumulatorFlattenPageListLoadingState, useFirst, pageLoadingStateFromObs, useAsObservable, mapEachAsync, invertObservableDecision, filterItemsWithObservableDecision, distinctUntilModelKeyChange, successResult, beginLoading, errorResult, cleanup, mapLoadingState } from '@dereekb/rxjs';
4
- import { switchMap, of, shareReplay, map, distinctUntilChanged, EMPTY, catchError, firstValueFrom, BehaviorSubject, combineLatest, first, from, tap, interval, exhaustMap, filter, take, startWith, Subject, throttleTime, NEVER, combineLatestWith } from 'rxjs';
5
- import { __awaiter, __decorate, __param, __metadata } from 'tslib';
6
- import * as i2$2 from '@dereekb/dbx-core';
7
- import { loggedInObsFromIsLoggedIn, loggedOutObsFromIsLoggedIn, authUserIdentifier, DbxInjectionContext, AbstractForwardDbxInjectionContextDirective, DBX_INJECTION_COMPONENT_DATA, DbxInjectionComponentModule, DbxAuthService, AbstractSubscriptionDirective, AbstractIfDirective, DbxRouteParamReaderInstance, DbxRouteParamDefaultRedirectInstance, LockSetComponentStore } from '@dereekb/dbx-core';
8
- import * as i1 from '@angular/fire/auth';
9
- import { authState, idToken, GoogleAuthProvider, FacebookAuthProvider, TwitterAuthProvider, GithubAuthProvider, signInWithPopup, createUserWithEmailAndPassword, signInWithEmailAndPassword, signInAnonymously, reauthenticateWithPopup, provideAuth, getAuth, connectAuthEmulator } from '@angular/fire/auth';
10
- import { AUTH_ADMIN_ROLE, cachedGetter, urlWithoutParameters, addToSet, removeFromSet, filterMaybeValues, mapIterable, asArray, excludeValuesFromArray, containsStringAnyCase, addToSetCopy, iterableToArray, runAsyncTasksForValues, forEachKeyValue, invertDecision, readableError, isMaybeSo, firstValue } from '@dereekb/util';
11
- import { safeFormatToISO8601DateString, msToSeconds } from '@dereekb/date';
12
- import { sendPasswordResetEmail } from 'firebase/auth';
13
- import * as i3 from '@dereekb/dbx-analytics';
14
- import { getToken, initializeAppCheck, ReCaptchaV3Provider } from 'firebase/app-check';
15
- import * as i1$1 from '@angular/fire/app-check';
16
- import { provideAppCheck } from '@angular/fire/app-check';
17
- import * as i3$1 from '@angular/material/button';
18
- import { MatButtonModule } from '@angular/material/button';
19
- import * as i2$1 from '@angular/material/icon';
20
- import { MatIconModule } from '@angular/material/icon';
21
- import * as i2 from '@angular/common';
22
- import { CommonModule } from '@angular/common';
23
- import * as i1$2 from '@dereekb/dbx-web';
24
- import { DbxRouterAnchorModule, DbxReadableErrorModule, DbxActionModule, DbxButtonModule, AbstractDbxSelectionListWrapperDirective, provideDbxListViewWrapper, DEFAULT_LIST_WRAPPER_DIRECTIVE_TEMPLATE, AbstractDbxSelectionListViewDirective, provideDbxListView, DEFAULT_DBX_SELECTION_VALUE_LIST_DIRECTIVE_TEMPLATE, AbstractDbxValueListViewItemComponent, DBX_VALUE_LIST_VIEW_ITEM, TwoColumnsContextStore, AbstractPopupDirective, DbxWidgetModule, DbxTextModule, DbxBlockLayoutModule, DbxTwoColumnLayoutModule, DbxPopupInteractionModule, DbxListLayoutModule, allDbxModelViewTrackerEventModelKeys, AbstractPopoverDirective, AbstractPopoverRefDirective, DbxModelInfoModule, DbxRouterListModule, DbxPopoverInteractionModule } from '@dereekb/dbx-web';
25
- import * as i1$4 from '@dereekb/firebase';
26
- import { firebaseAuthErrorToReadableError, ScheduledFunctionDevelopmentFunctionTypeEnum, clientFirebaseFirestoreContextFactory, SystemStateFirestoreCollections, FIREBASE_DEVELOPMENT_FUNCTIONS_MAP_KEY, FirebaseDevelopmentFunctions, iterationQueryDocChangeWatcher, firebaseQuerySnapshotAccumulator, firebaseQueryItemAccumulator, firestoreModelKeysFromDocuments, firestoreModelIdsFromDocuments, documentReferencesFromDocuments, getDocumentSnapshots, getDataFromDocumentSnapshots, latestSnapshotsFromDocuments, dataFromDocumentSnapshots, loadDocumentsForKeys, loadDocumentsForDocumentReferences, loadDocumentsForIds, asFirestoreModelKeyCollectionType, buildFirebaseCollectionTypeModelTypeMap, FirestoreAccessorStreamMode, firestoreModelIdsFromKey, firestoreModelKeyPartPairs, firestoreModelKeyPairObject, flatFirestoreModelKey, twoWayFlatFirestoreModelKey, documentDataWithIdAndKey, inferKeyFromTwoWayFlatFirestoreModelKey, firestoreModelKeyParentKey, clientFirebaseStorageContextFactory } from '@dereekb/firebase';
27
- import * as i1$3 from '@dereekb/dbx-form';
28
- import { AbstractAsyncFormlyFormDirective, usernamePasswordLoginFields, provideFormlyContext, AbstractSyncFormlyFormDirective, emailField, DbxFormIoModule, DbxFormModule, DbxFormlyModule, DbxFormActionModule, DbxFormFormlyTextFieldModule, AbstractConfigAsyncFormlyFormDirective, pickableItemChipField, filterPickableItemFieldValuesByLabel } from '@dereekb/dbx-form';
29
- import { initializeApp } from 'firebase/app';
30
- import * as i6 from '@angular/fire/app';
31
- import { FirebaseApp, provideFirebaseApp } from '@angular/fire/app';
32
- import * as i4 from '@angular/fire/storage';
33
- import { provideStorage, getStorage, connectStorageEmulator, Storage } from '@angular/fire/storage';
34
- import * as i5 from '@angular/fire/functions';
35
- import { provideFunctions, getFunctions, connectFunctionsEmulator, Functions } from '@angular/fire/functions';
36
- import * as i1$5 from '@angular/fire/firestore';
37
- import { provideFirestore, getFirestore, connectFirestoreEmulator, enableMultiTabIndexedDbPersistence, enableIndexedDbPersistence, Firestore } from '@angular/fire/firestore';
38
- import { HTTP_INTERCEPTORS } from '@angular/common/http';
39
- import * as i2$3 from '@angular/material/snack-bar';
40
-
41
- function authUserInfoFromAuthUser(user) {
42
- return {
43
- displayName: user === null || user === void 0 ? void 0 : user.displayName,
44
- email: user.email,
45
- phoneNumber: user.phoneNumber,
46
- photoURL: user.photoURL,
47
- uid: user.uid,
48
- creationTime: safeFormatToISO8601DateString(user.metadata.creationTime),
49
- lastSignInTime: safeFormatToISO8601DateString(user.metadata.lastSignInTime)
50
- };
51
- }
52
- function firebaseAuthTokenFromUser(user) {
53
- return {
54
- email: user.email,
55
- emailVerified: user.emailVerified,
56
- phoneNumber: user.phoneNumber,
57
- creationTime: safeFormatToISO8601DateString(user.metadata.creationTime),
58
- lastSignInTime: safeFormatToISO8601DateString(user.metadata.lastSignInTime)
59
- };
60
- }
61
-
62
- /**
63
- * Creates a AuthUserStateObsFunction that derives a user state from the input firebase auth service, and the optional stateForLoggedInUser input
64
- *
65
- * @param stateForLoggedInUser Optional function that returns an observable for the user's state if they are logged in and not an anonymous user.
66
- * @returns
67
- */
68
- function authUserStateFromFirebaseAuthServiceFunction(stateForLoggedInUser = () => of('user')) {
69
- return (dbxFirebaseAuthService) => {
70
- return dbxFirebaseAuthService.hasAuthUser$.pipe(switchMap((hasUser) => {
71
- let obs;
72
- if (hasUser) {
73
- obs = dbxFirebaseAuthService.isAnonymousUser$.pipe(switchMap((isAnon) => (isAnon ? of('anon') : stateForLoggedInUser(dbxFirebaseAuthService))));
74
- }
75
- else {
76
- obs = of('none');
77
- }
78
- return obs;
79
- }), shareReplay(1));
80
- };
81
- }
82
- function stateFromTokenForLoggedInUserFunction(stateFromToken, defaultState = 'user') {
83
- return (dbxFirebaseAuthService) => {
84
- return readValueFromIdToken(dbxFirebaseAuthService, stateFromToken, defaultState);
85
- };
86
- }
87
- /**
88
- * Convenience function to read a value from an IdTokenResult off of the current user.
89
- *
90
- * @param dbxFirebaseAuthService
91
- * @param readValueFromIdToken
92
- * @param defaultValue
93
- * @returns
94
- */
95
- function readValueFromIdToken(dbxFirebaseAuthService, readValueFromIdToken, defaultValue) {
96
- return dbxFirebaseAuthService.currentAuthUserInfo$.pipe(switchMap((x) => {
97
- if (x) {
98
- return dbxFirebaseAuthService.idTokenResult$.pipe(switchMap((x) => asObservable(readValueFromIdToken(x))));
99
- }
100
- else {
101
- return of(defaultValue);
102
- }
103
- }));
104
- }
105
-
106
- // MARK: Delegate
107
- class DbxFirebaseAuthServiceDelegate {
108
- constructor() {
109
- this.fullControlOfAuthUserState = false;
110
- }
111
- }
112
- const DEFAULT_DBX_FIREBASE_AUTH_SERVICE_DELEGATE = {
113
- authUserStateObs: authUserStateFromFirebaseAuthServiceFunction(),
114
- authRolesObs(dbxFirebaseAuthService) {
115
- return dbxFirebaseAuthService.authUserState$.pipe(map((x) => (x === 'user' ? new Set(['user']) : new Set())));
116
- },
117
- isOnboarded(dbxFirebaseAuthService) {
118
- return dbxFirebaseAuthService.authUserState$.pipe(map((x) => x === 'user'));
119
- },
120
- isAdminInAuthRoleSet(authRoleSet) {
121
- return authRoleSet.has(AUTH_ADMIN_ROLE);
122
- }
123
- };
124
- // MARK: Service
125
- class DbxFirebaseAuthService {
126
- constructor(firebaseAuth, delegate) {
127
- this.firebaseAuth = firebaseAuth;
128
- this._authState$ = authState(this.firebaseAuth);
129
- this.currentAuthUser$ = this._authState$.pipe(timeoutStartWith(null, 1000), distinctUntilChanged(), shareReplay(1));
130
- this.currentAuthUserInfo$ = this.currentAuthUser$.pipe(map((x) => (x ? authUserInfoFromAuthUser(x) : undefined)));
131
- this.authUser$ = this.currentAuthUser$.pipe(filterMaybe());
132
- this.authUserInfo$ = this.authUser$.pipe(map(authUserInfoFromAuthUser));
133
- this.hasAuthUser$ = this.currentAuthUser$.pipe(map((x) => Boolean(x)), distinctUntilChanged(), shareReplay(1));
134
- this.isAnonymousUser$ = this.authUser$.pipe(map((x) => x.isAnonymous), distinctUntilChanged(), shareReplay(1));
135
- this.isNotAnonymousUser$ = this.isAnonymousUser$.pipe(isNot(), distinctUntilChanged(), shareReplay(1));
136
- this.isLoggedIn$ = this.hasAuthUser$;
137
- this.isNotLoggedIn$ = this.isLoggedIn$.pipe(isNot());
138
- this.onLogIn$ = loggedInObsFromIsLoggedIn(this.isLoggedIn$);
139
- this.onLogOut$ = loggedOutObsFromIsLoggedIn(this.isLoggedIn$);
140
- this.currentUid$ = this.currentAuthUser$.pipe(map((x) => x === null || x === void 0 ? void 0 : x.uid), distinctUntilChanged(), shareReplay(1));
141
- this.uid$ = this.currentUid$.pipe(map(authUserIdentifier), distinctUntilChanged(), shareReplay(1));
142
- /**
143
- * Alias for uid$
144
- */
145
- this.userIdentifier$ = this.uid$;
146
- this.currentIdTokenString$ = idToken(this.firebaseAuth).pipe(distinctUntilChanged(), shareReplay(1));
147
- this.idTokenString$ = this.currentUid$.pipe(switchMap((x) => (x ? this.currentIdTokenString$.pipe(filterMaybe()) : EMPTY)));
148
- this.currentIdTokenResult$ = this.currentAuthUser$.pipe(switchMap((x) => (x ? this.currentIdTokenString$.pipe(switchMap((y) => (y ? x.getIdTokenResult() : of(null)))) : of(null))), distinctUntilChanged(), shareReplay(1));
149
- this.idTokenResult$ = this.currentIdTokenResult$.pipe(filterMaybe());
150
- this.currentClaims$ = this.currentIdTokenResult$.pipe(map((x) => (x ? x.claims : null)), distinctUntilChanged(), shareReplay(1));
151
- this.claims$ = this.currentClaims$.pipe(filterMaybe());
152
- this.currentAuthContextInfo$ = this.currentAuthUser$.pipe(switchMap((x) => this.loadAuthContextInfoForUser(x)), shareReplay(1));
153
- this.authContextInfo$ = this.currentAuthContextInfo$.pipe(filterMaybe());
154
- delegate = delegate !== null && delegate !== void 0 ? delegate : DEFAULT_DBX_FIREBASE_AUTH_SERVICE_DELEGATE;
155
- const delegateAuthUserStateObs = delegate.authUserStateObs(this).pipe(catchError(() => of('error')), distinctUntilChanged(), shareReplay(1));
156
- if (delegate.fullControlOfAuthUserState) {
157
- this.authUserState$ = delegateAuthUserStateObs;
158
- }
159
- else {
160
- this.authUserState$ = this._authState$.pipe(distinctUntilChanged(), switchMap((x) => {
161
- if (x != null) {
162
- return delegateAuthUserStateObs;
163
- }
164
- else {
165
- return of('none');
166
- }
167
- }));
168
- }
169
- this.authRoles$ = delegate.authRolesObs(this);
170
- this.isOnboarded$ = delegate.isOnboarded(this);
171
- this._authRoleClaimsService = delegate.authRoleClaimsService;
172
- this.isAdminInAuthRoleSet = delegate.isAdminInAuthRoleSet;
173
- }
174
- refreshToken() {
175
- return __awaiter(this, void 0, void 0, function* () {
176
- const user = this.firebaseAuth.currentUser;
177
- if (!user) {
178
- throw new Error('no user to refresh the token for.');
179
- }
180
- return user.getIdTokenResult(true);
181
- });
182
- }
183
- rolesForClaims(claims) {
184
- let result;
185
- if (this._authRoleClaimsService) {
186
- return this._authRoleClaimsService.toRoles(claims);
187
- }
188
- else {
189
- console.warn('DbxFirebaseAuthService: rolesForClaims called with no authRoleClaimsService provided. An empty set is returned.');
190
- result = new Set();
191
- }
192
- return result;
193
- }
194
- getAuthContextInfo() {
195
- return firstValueFrom(this.authUser$).then((user) => this.loadAuthContextInfoForUser(user));
196
- }
197
- loadAuthContextInfoForUser(user) {
198
- return __awaiter(this, void 0, void 0, function* () {
199
- let result;
200
- if (user) {
201
- const jwtToken = yield user.getIdTokenResult();
202
- result = new DbxFirebaseAuthContextInfo(this, user, jwtToken);
203
- }
204
- return result;
205
- });
206
- }
207
- logInWithGoogle() {
208
- return this.logInWithPopup(new GoogleAuthProvider());
209
- }
210
- logInWithFacebook() {
211
- return this.logInWithPopup(new FacebookAuthProvider());
212
- }
213
- logInWithTwitter() {
214
- return this.logInWithPopup(new TwitterAuthProvider());
215
- }
216
- logInWithGithub() {
217
- return this.logInWithPopup(new GithubAuthProvider());
218
- }
219
- logInWithApple() {
220
- throw new Error('todo');
221
- }
222
- logInWithMicrosoft() {
223
- // return this.logInWithPopup(new MicrosoftAuthProvider());
224
- throw new Error('todo');
225
- }
226
- logInWithPhone() {
227
- throw new Error('todo');
228
- // return signInWithPhoneNumber(this.firebaseAuth, )
229
- }
230
- logInWithPopup(provider, resolver) {
231
- return signInWithPopup(this.firebaseAuth, provider, resolver);
232
- }
233
- registerWithEmailAndPassword(email, password) {
234
- return createUserWithEmailAndPassword(this.firebaseAuth, email, password);
235
- }
236
- sendPasswordResetEmail(email) {
237
- return sendPasswordResetEmail(this.firebaseAuth, email);
238
- }
239
- logInWithEmailAndPassword(email, password) {
240
- return signInWithEmailAndPassword(this.firebaseAuth, email, password);
241
- }
242
- logInAsAnonymous() {
243
- return signInAnonymously(this.firebaseAuth);
244
- }
245
- logOut() {
246
- return this.firebaseAuth.signOut();
247
- }
248
- reauthenticateWithPopup(provider, resolver) {
249
- return firstValueFrom(this.currentAuthUser$.pipe(switchMap((x) => {
250
- if (x) {
251
- return reauthenticateWithPopup(x, provider, resolver);
252
- }
253
- else {
254
- throw new Error('User is not logged in currently.');
255
- }
256
- })));
257
- }
258
- }
259
- DbxFirebaseAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseAuthService, deps: [{ token: i1.Auth }, { token: DbxFirebaseAuthServiceDelegate, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
260
- DbxFirebaseAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseAuthService });
261
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseAuthService, decorators: [{
262
- type: Injectable
263
- }], ctorParameters: function () {
264
- return [{ type: i1.Auth }, { type: DbxFirebaseAuthServiceDelegate, decorators: [{
265
- type: Optional
266
- }] }];
267
- } });
268
- /**
269
- * FirebaseAuthContextInfo implementation from DbxFirebaseAuthService.
270
- */
271
- class DbxFirebaseAuthContextInfo {
272
- constructor(service, user, jwtToken) {
273
- this.service = service;
274
- this.user = user;
275
- this.jwtToken = jwtToken;
276
- this._token = cachedGetter(() => firebaseAuthTokenFromUser(this.user));
277
- this._roles = cachedGetter(() => this.service.rolesForClaims(this.getClaims()));
278
- this._isAdmin = cachedGetter(() => this.service.isAdminInAuthRoleSet(this._roles()));
279
- }
280
- get uid() {
281
- return this.user.uid;
282
- }
283
- isAdmin() {
284
- return this._isAdmin();
285
- }
286
- getClaims() {
287
- return this.jwtToken.claims;
288
- }
289
- getAuthRoles() {
290
- return this._roles();
291
- }
292
- get token() {
293
- return this._token();
294
- }
295
- }
296
-
297
- function readDbxAnalyticsUserPropertiesFromAuthUserInfo(user) {
298
- var _a, _b;
299
- const properties = {
300
- name: (_a = user.displayName) !== null && _a !== void 0 ? _a : '',
301
- email: (_b = user.email) !== null && _b !== void 0 ? _b : ''
302
- };
303
- return properties;
304
- }
305
- const DEFAULT_DBX_FIREBASE_ANALYTICS_USER_PROPERTIES_FACTORY = (authUserInfo) => of(readDbxAnalyticsUserPropertiesFromAuthUserInfo(authUserInfo));
306
- /**
307
- * DbxAnalyticsUserSource implementation that uses the DbxFirebaseAuthService.
308
- */
309
- class DbxFirebaseAnalyticsUserSource {
310
- constructor(dbxFirebaseAuthService) {
311
- this.dbxFirebaseAuthService = dbxFirebaseAuthService;
312
- this._userPropertiesFactory = new BehaviorSubject(DEFAULT_DBX_FIREBASE_ANALYTICS_USER_PROPERTIES_FACTORY);
313
- this.analyticsUser$ = combineLatest([this._userPropertiesFactory, this.dbxFirebaseAuthService.currentAuthUserInfo$]).pipe(switchMap(([userPropertiesFactory, x]) => {
314
- let analyticsUser;
315
- if (x != null) {
316
- analyticsUser = userPropertiesFactory(x).pipe(map((properties) => ({
317
- user: x.uid,
318
- properties
319
- })));
320
- }
321
- else {
322
- analyticsUser = of(null);
323
- }
324
- return analyticsUser;
325
- }), shareReplay(1));
326
- }
327
- get userPropertiesFactory() {
328
- return this._userPropertiesFactory.value;
329
- }
330
- set userPropertiesFactory(userPropertiesFactory) {
331
- this._userPropertiesFactory.next(userPropertiesFactory);
332
- }
333
- }
334
- DbxFirebaseAnalyticsUserSource.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseAnalyticsUserSource, deps: [{ token: DbxFirebaseAuthService }], target: i0.ɵɵFactoryTarget.Injectable });
335
- DbxFirebaseAnalyticsUserSource.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseAnalyticsUserSource, providedIn: 'root' });
336
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseAnalyticsUserSource, decorators: [{
337
- type: Injectable,
338
- args: [{
339
- providedIn: 'root'
340
- }]
341
- }], ctorParameters: function () { return [{ type: DbxFirebaseAuthService }]; } });
342
-
343
- /**
344
- * Service that listens for DbxFirebaseAuthService changes and emits them a user events.
345
- */
346
- class DbxFirebaseAnalyticsUserEventsListener {
347
- constructor(dbxFirebaseAuthService, dbxFirebaseAnalyticsUserSource, dbxAnalyticsService) {
348
- this.dbxFirebaseAuthService = dbxFirebaseAuthService;
349
- this.dbxFirebaseAnalyticsUserSource = dbxFirebaseAnalyticsUserSource;
350
- this.dbxAnalyticsService = dbxAnalyticsService;
351
- this._loginSub = new SubscriptionObject();
352
- this._logoutSub = new SubscriptionObject();
353
- }
354
- init() {
355
- this._loginSub.subscription = this.dbxFirebaseAuthService.onLogIn$.subscribe(() => {
356
- this.dbxFirebaseAnalyticsUserSource.analyticsUser$.pipe(filterMaybe(), first()).subscribe((analyticsUser) => {
357
- this.dbxAnalyticsService.sendUserLoginEvent(analyticsUser);
358
- });
359
- });
360
- this._logoutSub.subscription = this.dbxFirebaseAuthService.onLogOut$.subscribe(() => {
361
- this.dbxAnalyticsService.sendUserLogoutEvent();
362
- });
363
- }
364
- destroy() {
365
- this._loginSub.destroy();
366
- this._logoutSub.destroy();
367
- }
368
- }
369
- DbxFirebaseAnalyticsUserEventsListener.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseAnalyticsUserEventsListener, deps: [{ token: DbxFirebaseAuthService }, { token: DbxFirebaseAnalyticsUserSource }, { token: i3.DbxAnalyticsService }], target: i0.ɵɵFactoryTarget.Injectable });
370
- DbxFirebaseAnalyticsUserEventsListener.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseAnalyticsUserEventsListener, providedIn: 'root' });
371
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseAnalyticsUserEventsListener, decorators: [{
372
- type: Injectable,
373
- args: [{
374
- providedIn: 'root'
375
- }]
376
- }], ctorParameters: function () { return [{ type: DbxFirebaseAuthService }, { type: DbxFirebaseAnalyticsUserSource }, { type: i3.DbxAnalyticsService }]; } });
377
-
378
- /**
379
- * Enables debug token generation for AppCheck by setting FIREBASE_APPCHECK_DEBUG_TOKEN in the browser's self/window.
380
- *
381
- * https://firebase.google.com/docs/app-check/web/debug-provider
382
- *
383
- * @param enable
384
- */
385
- function enableAppCheckDebugTokenGeneration(enable = true) {
386
- self.FIREBASE_APPCHECK_DEBUG_TOKEN = enable;
387
- }
388
-
389
- const DBX_FIREBASE_OPTIONS_TOKEN = new InjectionToken('DbxFirebaseOptions');
390
-
391
- /**
392
- * HTTP Interceptor that sets the X-Firebase-AppCheck for any requests to the routes configured in DbxFirebaseOptions.
393
- */
394
- class DbxFirebaseAppCheckHttpInterceptor {
395
- constructor(dbxFirebaseOptions, appCheck) {
396
- var _a, _b;
397
- this.dbxFirebaseOptions = dbxFirebaseOptions;
398
- this.appCheck = appCheck;
399
- let routes = [];
400
- if (appCheck != null) {
401
- routes = ((_b = (_a = this.dbxFirebaseOptions.appCheck) === null || _a === void 0 ? void 0 : _a.appCheckRoutes) !== null && _b !== void 0 ? _b : ['/api/*']).map((route) => {
402
- const wildcardIndex = route.indexOf('*');
403
- const isWildcard = wildcardIndex === route.length - 1;
404
- const match = isWildcard ? route.substring(0, wildcardIndex) : route;
405
- return {
406
- isWildcard,
407
- match
408
- };
409
- });
410
- }
411
- this._appCheckRoutes = routes;
412
- this._isEnabled = routes.length > 0;
413
- }
414
- intercept(req, next) {
415
- let obs;
416
- if (this._isEnabled) {
417
- obs = this.matchesAnyRoute(req.url).pipe(switchMap((isMatch) => {
418
- let nextEvent;
419
- if (isMatch) {
420
- nextEvent = from(getToken(this.appCheck).then((appCheckTokenResponse) => {
421
- const token = appCheckTokenResponse.token;
422
- let nextRequest = req;
423
- if (token) {
424
- nextRequest = req.clone({
425
- headers: req.headers.set('X-Firebase-AppCheck', token)
426
- });
427
- }
428
- return nextRequest;
429
- })).pipe(switchMap((nextRequest) => next.handle(nextRequest)));
430
- }
431
- else {
432
- nextEvent = next.handle(req);
433
- }
434
- return nextEvent;
435
- }));
436
- }
437
- else {
438
- obs = next.handle(req);
439
- }
440
- return obs;
441
- }
442
- matchesAnyRoute(inputUrl) {
443
- const url = urlWithoutParameters(inputUrl);
444
- function isEnabledRouteMatch(enabledRoute) {
445
- if (enabledRoute.isWildcard) {
446
- return url.startsWith(enabledRoute.match);
447
- }
448
- else {
449
- return url === enabledRoute.match;
450
- }
451
- }
452
- return from(this._appCheckRoutes).pipe(first((route) => isEnabledRouteMatch(route), false), map((x) => Boolean(x)));
453
- }
454
- }
455
- DbxFirebaseAppCheckHttpInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseAppCheckHttpInterceptor, deps: [{ token: DBX_FIREBASE_OPTIONS_TOKEN }, { token: i1$1.AppCheck }], target: i0.ɵɵFactoryTarget.Injectable });
456
- DbxFirebaseAppCheckHttpInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseAppCheckHttpInterceptor });
457
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseAppCheckHttpInterceptor, decorators: [{
458
- type: Injectable
459
- }], ctorParameters: function () {
460
- return [{ type: undefined, decorators: [{
461
- type: Inject,
462
- args: [DBX_FIREBASE_OPTIONS_TOKEN]
463
- }] }, { type: i1$1.AppCheck }];
464
- } });
465
-
466
- class DbxFirebaseLoginTermsConfig {
467
- }
468
-
469
- class DbxFirebaseLoginTermsSimpleComponent {
470
- constructor(dbxFirebaseLoginTermsConfig) {
471
- this.dbxFirebaseLoginTermsConfig = dbxFirebaseLoginTermsConfig;
472
- this.tosAnchor = {
473
- url: this.dbxFirebaseLoginTermsConfig.tosUrl,
474
- target: '_blank'
475
- };
476
- this.privacyAnchor = {
477
- url: this.dbxFirebaseLoginTermsConfig.privacyUrl,
478
- target: '_blank'
479
- };
480
- }
481
- }
482
- DbxFirebaseLoginTermsSimpleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginTermsSimpleComponent, deps: [{ token: DbxFirebaseLoginTermsConfig }], target: i0.ɵɵFactoryTarget.Component });
483
- DbxFirebaseLoginTermsSimpleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseLoginTermsSimpleComponent, selector: "ng-component", ngImport: i0, template: `
484
- <div class="dbx-firebase-login-terms-view">
485
- <dbx-link [anchor]="tosAnchor">Terms</dbx-link>
486
- <span class="dbx-link-spacer"></span>
487
- <dbx-link [anchor]="privacyAnchor">Privacy</dbx-link>
488
- </div>
489
- `, isInline: true, dependencies: [{ kind: "component", type: i1$2.DbxAnchorLinkComponent, selector: "dbx-link", inputs: ["anchor", "ref", "href"] }] });
490
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginTermsSimpleComponent, decorators: [{
491
- type: Component,
492
- args: [{
493
- template: `
494
- <div class="dbx-firebase-login-terms-view">
495
- <dbx-link [anchor]="tosAnchor">Terms</dbx-link>
496
- <span class="dbx-link-spacer"></span>
497
- <dbx-link [anchor]="privacyAnchor">Privacy</dbx-link>
498
- </div>
499
- `
500
- }]
501
- }], ctorParameters: function () { return [{ type: DbxFirebaseLoginTermsConfig }]; } });
502
-
503
- const DEFAULT_FIREBASE_AUTH_LOGIN_PASSWORD_CONFIG = {
504
- minLength: 6
505
- };
506
-
507
- /**
508
- * Default providers to inject.
509
- */
510
- const DEFAULT_FIREBASE_AUTH_LOGIN_PROVIDERS_TOKEN = new InjectionToken('DefaultDbxFirebaseAuthLoginProviders');
511
- const DEFAULT_FIREBASE_AUTH_LOGIN_TERMS_COMPONENT_CLASS_TOKEN = new InjectionToken('DefaultDbxFirebaseAuthLoginTermsComponentClass');
512
- const DEFAULT_FIREBASE_AUTH_LOGIN_PASSWORD_CONFIG_TOKEN = new InjectionToken('DefaultDbxFirebaseAuthLoginPasswordConfig');
513
- /**
514
- * Service used for registering components used for logging in.
515
- *
516
- * Default providers can be configured by the DEFAULT_FIREBASE_AUTH_LOGIN_PROVIDERS_TOKEN injectable value.
517
- */
518
- class DbxFirebaseAuthLoginService {
519
- constructor(defaultProviders, passwordConfig, termsComponentClass = DbxFirebaseLoginTermsSimpleComponent) {
520
- this.termsComponentClass = termsComponentClass;
521
- this._enableAll = false;
522
- this._providers = new Map();
523
- this._assets = new Map();
524
- this._enabled = new Set();
525
- if (defaultProviders) {
526
- defaultProviders.forEach((x) => this.register(x, false));
527
- }
528
- this._passwordConfig = passwordConfig !== null && passwordConfig !== void 0 ? passwordConfig : DEFAULT_FIREBASE_AUTH_LOGIN_PASSWORD_CONFIG;
529
- }
530
- /**
531
- * Used to register a provider. If a provider is already registered, this will override it by default.
532
- *
533
- * @param provider
534
- * @param override
535
- */
536
- register(provider, override = true) {
537
- if (override || !this._providers.has(provider.loginMethodType)) {
538
- this._providers.set(provider.loginMethodType, provider);
539
- if (provider.assets) {
540
- this.updateAssetsForProvider(provider.loginMethodType, provider.assets);
541
- }
542
- return true;
543
- }
544
- else {
545
- return false;
546
- }
547
- }
548
- /**
549
- * Updates the assets for a provider type.
550
- *
551
- * @param type
552
- * @param assets
553
- */
554
- updateAssetsForProvider(type, assets) {
555
- const current = this._assets.get(type);
556
- const update = Object.assign(Object.assign({}, current), assets);
557
- this._assets.set(type, update);
558
- }
559
- // MARK: Enable/Disable
560
- /**
561
- * Enables all providers and any providers that will be registered.
562
- */
563
- setEnableAll(enableAll = true) {
564
- this._enableAll = enableAll;
565
- }
566
- clearEnabled() {
567
- this._enabled = new Set();
568
- }
569
- /**
570
- * Enables all of the specified types.
571
- *
572
- * @param types
573
- */
574
- enable(types) {
575
- addToSet(this._enabled, types);
576
- }
577
- disable(types) {
578
- removeFromSet(this._enabled, types);
579
- }
580
- // MARK: Get
581
- getRegisteredTypes() {
582
- return Array.from(this._providers.keys());
583
- }
584
- getEnabledTypes() {
585
- return this._enableAll ? this.getRegisteredTypes() : Array.from(this._enabled);
586
- }
587
- getLoginProvider(type) {
588
- return this._providers.get(type);
589
- }
590
- getLoginProviders(types) {
591
- return filterMaybeValues(mapIterable(types !== null && types !== void 0 ? types : [], (x) => this._providers.get(x)));
592
- }
593
- getRegisterProvider(type) {
594
- return this._providers.get(type);
595
- }
596
- getRegisterProviders(types) {
597
- return filterMaybeValues(mapIterable(types !== null && types !== void 0 ? types : [], (x) => this._providers.get(x))).filter((x) => x.registrationComponentClass !== false);
598
- }
599
- getProviderAssets(type) {
600
- return this._assets.get(type);
601
- }
602
- getPasswordConfig() {
603
- return this._passwordConfig;
604
- }
605
- setPasswordConfig(passwordConfig) {
606
- this._passwordConfig = passwordConfig;
607
- }
608
- }
609
- DbxFirebaseAuthLoginService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseAuthLoginService, deps: [{ token: DEFAULT_FIREBASE_AUTH_LOGIN_PROVIDERS_TOKEN, optional: true }, { token: DEFAULT_FIREBASE_AUTH_LOGIN_PASSWORD_CONFIG_TOKEN, optional: true }, { token: DEFAULT_FIREBASE_AUTH_LOGIN_TERMS_COMPONENT_CLASS_TOKEN, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
610
- DbxFirebaseAuthLoginService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseAuthLoginService, providedIn: 'root' });
611
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseAuthLoginService, decorators: [{
612
- type: Injectable,
613
- args: [{
614
- providedIn: 'root'
615
- }]
616
- }], ctorParameters: function () {
617
- return [{ type: undefined, decorators: [{
618
- type: Optional
619
- }, {
620
- type: Inject,
621
- args: [DEFAULT_FIREBASE_AUTH_LOGIN_PROVIDERS_TOKEN]
622
- }] }, { type: undefined, decorators: [{
623
- type: Optional
624
- }, {
625
- type: Inject,
626
- args: [DEFAULT_FIREBASE_AUTH_LOGIN_PASSWORD_CONFIG_TOKEN]
627
- }] }, { type: i0.Type, decorators: [{
628
- type: Optional
629
- }, {
630
- type: Inject,
631
- args: [DEFAULT_FIREBASE_AUTH_LOGIN_TERMS_COMPONENT_CLASS_TOKEN]
632
- }] }];
633
- } });
634
-
635
- /**
636
- * Injection token for a DbxInjectionContext for DbxFirebaseLoginContext.
637
- */
638
- class DbxFirebaseLoginContext extends DbxInjectionContext {
639
- }
640
-
641
- /**
642
- * Login button and action.
643
- */
644
- class DbxFirebaseLoginButtonComponent {
645
- constructor() {
646
- this.handleAction = () => {
647
- const loginPromise = this.config.handleLogin();
648
- return from(loginPromise);
649
- };
650
- this.onActionSuccess = () => {
651
- // todo: show checkmark on success?
652
- };
653
- }
654
- get iconUrl() {
655
- var _a;
656
- return (_a = this.config) === null || _a === void 0 ? void 0 : _a.iconUrl;
657
- }
658
- get icon() {
659
- var _a;
660
- return (_a = this.config) === null || _a === void 0 ? void 0 : _a.icon;
661
- }
662
- get text() {
663
- var _a;
664
- return (_a = this.config) === null || _a === void 0 ? void 0 : _a.text;
665
- }
666
- get buttonColor() {
667
- var _a, _b;
668
- return (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.buttonColor) !== null && _b !== void 0 ? _b : 'transparent';
669
- }
670
- get buttonTextColor() {
671
- var _a;
672
- return (_a = this.config) === null || _a === void 0 ? void 0 : _a.buttonTextColor;
673
- }
674
- }
675
- DbxFirebaseLoginButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
676
- DbxFirebaseLoginButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseLoginButtonComponent, selector: "dbx-firebase-login-button", inputs: { config: "config" }, host: { classAttribute: "dbx-firebase-login-button" }, ngImport: i0, template: `
677
- <ng-container dbxAction [dbxActionHandler]="handleAction" dbxActionValue [dbxActionSuccessHandler]="onActionSuccess">
678
- <dbx-button dbxActionButton [customTextColor]="buttonTextColor" [customButtonColor]="buttonColor" [raised]="true">
679
- <div class="dbx-firebase-login-button-content">
680
- <span class="dbx-firebase-login-button-icon dbx-icon-spacer">
681
- <img *ngIf="iconUrl" [src]="iconUrl" />
682
- <mat-icon *ngIf="icon">{{ icon }}</mat-icon>
683
- </span>
684
- <span class="dbx-firebase-login-button-text">{{ text }}</span>
685
- </div>
686
- </dbx-button>
687
- </ng-container>
688
- `, isInline: true, dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i2$2.DbxActionDirective, selector: "dbx-action,[dbxAction],dbx-action-context,[dbxActionContext]", exportAs: ["action", "dbxAction"] }, { kind: "directive", type: i2$2.DbxActionHandlerDirective, selector: "[dbxActionHandler]", inputs: ["dbxActionHandler"] }, { kind: "directive", type: i2$2.DbxActionValueDirective, selector: "[dbxActionValue]", inputs: ["dbxActionValue"] }, { kind: "directive", type: i2$2.DbxActionSuccessHandlerDirective, selector: "[dbxActionSuccessHandler]", inputs: ["dbxActionSuccessHandler"] }, { kind: "directive", type: i2$2.DbxActionButtonDirective, selector: "[dbxActionButton]" }, { kind: "component", type: i1$2.DbxButtonComponent, selector: "dbx-button", inputs: ["type", "raised", "stroked", "flat", "iconOnly", "color", "customButtonColor", "customTextColor", "customSpinnerColor"] }] });
689
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginButtonComponent, decorators: [{
690
- type: Component,
691
- args: [{
692
- selector: 'dbx-firebase-login-button',
693
- template: `
694
- <ng-container dbxAction [dbxActionHandler]="handleAction" dbxActionValue [dbxActionSuccessHandler]="onActionSuccess">
695
- <dbx-button dbxActionButton [customTextColor]="buttonTextColor" [customButtonColor]="buttonColor" [raised]="true">
696
- <div class="dbx-firebase-login-button-content">
697
- <span class="dbx-firebase-login-button-icon dbx-icon-spacer">
698
- <img *ngIf="iconUrl" [src]="iconUrl" />
699
- <mat-icon *ngIf="icon">{{ icon }}</mat-icon>
700
- </span>
701
- <span class="dbx-firebase-login-button-text">{{ text }}</span>
702
- </div>
703
- </dbx-button>
704
- </ng-container>
705
- `,
706
- host: {
707
- class: 'dbx-firebase-login-button'
708
- }
709
- }]
710
- }], propDecorators: { config: [{
711
- type: Input
712
- }] } });
713
- class DbxFirebaseLoginButtonContainerComponent {
714
- }
715
- DbxFirebaseLoginButtonContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginButtonContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
716
- DbxFirebaseLoginButtonContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseLoginButtonContainerComponent, selector: "dbx-firebase-login-button-container", ngImport: i0, template: `
717
- <div class="dbx-firebase-login-button-container">
718
- <ng-content></ng-content>
719
- </div>
720
- `, isInline: true });
721
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginButtonContainerComponent, decorators: [{
722
- type: Component,
723
- args: [{
724
- selector: 'dbx-firebase-login-button-container',
725
- template: `
726
- <div class="dbx-firebase-login-button-container">
727
- <ng-content></ng-content>
728
- </div>
729
- `
730
- }]
731
- }] });
732
- const DEFAULT_CONFIGURED_DBX_FIREBASE_LOGIN_BUTTON_TEMPLATE = `
733
- <dbx-firebase-login-button-container>
734
- <dbx-firebase-login-button [config]="config"></dbx-firebase-login-button>
735
- </dbx-firebase-login-button-container>
736
- `;
737
- class AbstractConfiguredDbxFirebaseLoginButtonDirective {
738
- constructor(dbxFirebaseAuthService, dbxFirebaseAuthLoginService, dbxFirebaseLoginContext) {
739
- this.dbxFirebaseAuthService = dbxFirebaseAuthService;
740
- this.dbxFirebaseAuthLoginService = dbxFirebaseAuthLoginService;
741
- this.dbxFirebaseLoginContext = dbxFirebaseLoginContext;
742
- }
743
- ngOnInit() {
744
- var _a;
745
- const assets = this.assetConfig;
746
- this._config = {
747
- text: (_a = assets.loginText) !== null && _a !== void 0 ? _a : `<loginText not configured>`,
748
- icon: assets.loginIcon,
749
- iconUrl: assets.logoUrl,
750
- buttonColor: assets.backgroundColor,
751
- buttonTextColor: assets.textColor,
752
- handleLogin: () => this.handleLogin()
753
- };
754
- }
755
- get providerConfig() {
756
- return this.dbxFirebaseAuthLoginService.getLoginProvider(this.loginProvider);
757
- }
758
- get assetConfig() {
759
- var _a;
760
- return (_a = this.dbxFirebaseAuthLoginService.getProviderAssets(this.loginProvider)) !== null && _a !== void 0 ? _a : {};
761
- }
762
- get config() {
763
- return this._config;
764
- }
765
- }
766
- AbstractConfiguredDbxFirebaseLoginButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AbstractConfiguredDbxFirebaseLoginButtonDirective, deps: [{ token: DbxFirebaseAuthService }, { token: DbxFirebaseAuthLoginService }, { token: DbxFirebaseLoginContext }], target: i0.ɵɵFactoryTarget.Directive });
767
- AbstractConfiguredDbxFirebaseLoginButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: AbstractConfiguredDbxFirebaseLoginButtonDirective, ngImport: i0 });
768
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AbstractConfiguredDbxFirebaseLoginButtonDirective, decorators: [{
769
- type: Directive
770
- }], ctorParameters: function () { return [{ type: DbxFirebaseAuthService }, { type: DbxFirebaseAuthLoginService }, { type: DbxFirebaseLoginContext }]; } });
771
-
772
- class DbxFirebaseLoginAppleComponent extends AbstractConfiguredDbxFirebaseLoginButtonDirective {
773
- constructor() {
774
- super(...arguments);
775
- this.loginProvider = 'apple';
776
- }
777
- handleLogin() {
778
- return this.dbxFirebaseAuthService.logInWithApple();
779
- }
780
- }
781
- DbxFirebaseLoginAppleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginAppleComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
782
- DbxFirebaseLoginAppleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseLoginAppleComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "\n <dbx-firebase-login-button-container>\n <dbx-firebase-login-button [config]=\"config\"></dbx-firebase-login-button>\n </dbx-firebase-login-button-container>\n", isInline: true, dependencies: [{ kind: "component", type: DbxFirebaseLoginButtonComponent, selector: "dbx-firebase-login-button", inputs: ["config"] }, { kind: "component", type: DbxFirebaseLoginButtonContainerComponent, selector: "dbx-firebase-login-button-container" }] });
783
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginAppleComponent, decorators: [{
784
- type: Component,
785
- args: [{
786
- template: DEFAULT_CONFIGURED_DBX_FIREBASE_LOGIN_BUTTON_TEMPLATE
787
- }]
788
- }] });
789
-
790
- const DEFAULT_FIREBASE_LOGIN_METHOD_CATEGORY = 'default';
791
- const OAUTH_FIREBASE_LOGIN_METHOD_CATEGORY = 'oauth';
792
-
793
- class DbxFirebaseLoginAnonymousComponent extends AbstractConfiguredDbxFirebaseLoginButtonDirective {
794
- constructor() {
795
- super(...arguments);
796
- this.loginProvider = 'anonymous';
797
- }
798
- handleLogin() {
799
- return this.dbxFirebaseAuthService.logInAsAnonymous();
800
- }
801
- }
802
- DbxFirebaseLoginAnonymousComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginAnonymousComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
803
- DbxFirebaseLoginAnonymousComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseLoginAnonymousComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "\n <dbx-firebase-login-button-container>\n <dbx-firebase-login-button [config]=\"config\"></dbx-firebase-login-button>\n </dbx-firebase-login-button-container>\n", isInline: true, dependencies: [{ kind: "component", type: DbxFirebaseLoginButtonComponent, selector: "dbx-firebase-login-button", inputs: ["config"] }, { kind: "component", type: DbxFirebaseLoginButtonContainerComponent, selector: "dbx-firebase-login-button-container" }] });
804
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginAnonymousComponent, decorators: [{
805
- type: Component,
806
- args: [{
807
- template: DEFAULT_CONFIGURED_DBX_FIREBASE_LOGIN_BUTTON_TEMPLATE
808
- }]
809
- }] });
810
-
811
- /**
812
- * DbxFirebaseLoginContext implementation.
813
- */
814
- class DbxFirebaseLoginContextDirective extends AbstractForwardDbxInjectionContextDirective {
815
- }
816
- DbxFirebaseLoginContextDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginContextDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
817
- DbxFirebaseLoginContextDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseLoginContextDirective, selector: "[dbxFirebaseLoginContext]", providers: [
818
- {
819
- provide: DbxFirebaseLoginContext,
820
- useExisting: DbxFirebaseLoginContextDirective
821
- }
822
- ], usesInheritance: true, ngImport: i0 });
823
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginContextDirective, decorators: [{
824
- type: Directive,
825
- args: [{
826
- selector: '[dbxFirebaseLoginContext]',
827
- providers: [
828
- {
829
- provide: DbxFirebaseLoginContext,
830
- useExisting: DbxFirebaseLoginContextDirective
831
- }
832
- ]
833
- }]
834
- }] });
835
-
836
- /**
837
- * Pre-configured login component that displays all configured login types.
838
- */
839
- class DbxFirebaseLoginListComponent {
840
- constructor(dbxFirebaseAuthLoginService) {
841
- this.dbxFirebaseAuthLoginService = dbxFirebaseAuthLoginService;
842
- this._loginMode = new BehaviorSubject('login');
843
- this._inputProviderCategories = new BehaviorSubject(undefined);
844
- this._omitProviderTypes = new BehaviorSubject(undefined);
845
- this._inputProviderTypes = new BehaviorSubject(undefined);
846
- this.providerTypes$ = combineLatest([this._inputProviderTypes, this._omitProviderTypes]).pipe(map(([providerTypes, omitProviderTypes]) => {
847
- const baseTypes = providerTypes ? asArray(providerTypes) : this.dbxFirebaseAuthLoginService.getEnabledTypes();
848
- const types = omitProviderTypes ? excludeValuesFromArray(baseTypes, asArray(omitProviderTypes)) : baseTypes;
849
- return types;
850
- }), shareReplay(1));
851
- this.providers$ = combineLatest([this.providerTypes$, this._inputProviderCategories]).pipe(map(([x, inputProviderCategories]) => {
852
- const providerCategories = asArray(inputProviderCategories);
853
- let providers = this.dbxFirebaseAuthLoginService.getLoginProviders(x);
854
- if (providerCategories.length) {
855
- const categories = new Set(providerCategories);
856
- providers = providers.filter((x) => { var _a; return containsStringAnyCase(categories, (_a = x.category) !== null && _a !== void 0 ? _a : ''); });
857
- }
858
- return providers;
859
- }));
860
- this.providerInjectionConfigs$ = combineLatest([this._loginMode, this.providers$]).pipe(map(([mode, providers]) => {
861
- const mapFn = mode === 'register' ? (x) => { var _a; return ({ componentClass: (_a = x.registrationComponentClass) !== null && _a !== void 0 ? _a : x.componentClass }); } : (x) => ({ componentClass: x.componentClass });
862
- return providers.map(mapFn);
863
- }));
864
- }
865
- ngOnDestroy() {
866
- this._loginMode.complete();
867
- this._inputProviderCategories.complete();
868
- this._omitProviderTypes.complete();
869
- this._inputProviderTypes.complete();
870
- }
871
- set loginMode(loginMode) {
872
- this._loginMode.next(loginMode);
873
- }
874
- set providerTypes(providerTypes) {
875
- this._inputProviderTypes.next(providerTypes);
876
- }
877
- set omitProviderTypes(providerTypes) {
878
- this._omitProviderTypes.next(providerTypes);
879
- }
880
- set providerCategories(providerCategories) {
881
- this._inputProviderCategories.next(providerCategories);
882
- }
883
- }
884
- DbxFirebaseLoginListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginListComponent, deps: [{ token: DbxFirebaseAuthLoginService }], target: i0.ɵɵFactoryTarget.Component });
885
- DbxFirebaseLoginListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseLoginListComponent, selector: "dbx-firebase-login-list", inputs: { loginMode: "loginMode", providerTypes: "providerTypes", omitProviderTypes: "omitProviderTypes", providerCategories: "providerCategories" }, host: { classAttribute: "dbx-firebase-login-list" }, ngImport: i0, template: `
886
- <div class="dbx-firebase-login-item" *ngFor="let config of providerInjectionConfigs$ | async">
887
- <dbx-injection [config]="config"></dbx-injection>
888
- </div>
889
- `, isInline: true, dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i2$2.DbxInjectionComponent, selector: "dbx-injection, [dbxInjection], [dbx-injection]", inputs: ["config", "template"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }] });
890
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginListComponent, decorators: [{
891
- type: Component,
892
- args: [{
893
- selector: 'dbx-firebase-login-list',
894
- template: `
895
- <div class="dbx-firebase-login-item" *ngFor="let config of providerInjectionConfigs$ | async">
896
- <dbx-injection [config]="config"></dbx-injection>
897
- </div>
898
- `,
899
- host: {
900
- class: 'dbx-firebase-login-list'
901
- }
902
- }]
903
- }], ctorParameters: function () { return [{ type: DbxFirebaseAuthLoginService }]; }, propDecorators: { loginMode: [{
904
- type: Input
905
- }], providerTypes: [{
906
- type: Input
907
- }], omitProviderTypes: [{
908
- type: Input
909
- }], providerCategories: [{
910
- type: Input
911
- }] } });
912
-
913
- /**
914
- * Pre-configured login component that displays all configured login types.
915
- */
916
- class DbxFirebaseLoginComponent {
917
- constructor() {
918
- this.loginMode = 'login';
919
- }
920
- }
921
- DbxFirebaseLoginComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
922
- DbxFirebaseLoginComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseLoginComponent, selector: "dbx-firebase-login", inputs: { loginMode: "loginMode", providerTypes: "providerTypes", omitProviderTypes: "omitProviderTypes", providerCategories: "providerCategories" }, host: { properties: { "class": "{ \"dbx-firebase-register\": loginMode === \"register\" }" }, classAttribute: "d-block dbx-firebase-login" }, ngImport: i0, template: `
923
- <ng-container *dbxInjectionContext dbxFirebaseLoginContext>
924
- <dbx-firebase-login-list [providerTypes]="providerTypes" [omitProviderTypes]="omitProviderTypes" [providerCategories]="providerCategories" [loginMode]="loginMode"></dbx-firebase-login-list>
925
- </ng-container>
926
- `, isInline: true, dependencies: [{ kind: "directive", type: i2$2.DbxInjectionContextDirective, selector: "[dbxInjectionContext]", inputs: ["config"] }, { kind: "directive", type: DbxFirebaseLoginContextDirective, selector: "[dbxFirebaseLoginContext]" }, { kind: "component", type: DbxFirebaseLoginListComponent, selector: "dbx-firebase-login-list", inputs: ["loginMode", "providerTypes", "omitProviderTypes", "providerCategories"] }] });
927
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginComponent, decorators: [{
928
- type: Component,
929
- args: [{
930
- selector: 'dbx-firebase-login',
931
- template: `
932
- <ng-container *dbxInjectionContext dbxFirebaseLoginContext>
933
- <dbx-firebase-login-list [providerTypes]="providerTypes" [omitProviderTypes]="omitProviderTypes" [providerCategories]="providerCategories" [loginMode]="loginMode"></dbx-firebase-login-list>
934
- </ng-container>
935
- `,
936
- host: {
937
- class: 'd-block dbx-firebase-login',
938
- '[class]': '{ "dbx-firebase-register": loginMode === "register" }'
939
- }
940
- }]
941
- }], propDecorators: { loginMode: [{
942
- type: Input
943
- }], providerTypes: [{
944
- type: Input
945
- }], omitProviderTypes: [{
946
- type: Input
947
- }], providerCategories: [{
948
- type: Input
949
- }] } });
950
-
951
- class DbxFirebaseEmailFormComponent extends AbstractAsyncFormlyFormDirective {
952
- constructor() {
953
- super(...arguments);
954
- this._config = new BehaviorSubject({ loginMode: 'login' });
955
- this.fields$ = this._config.pipe(map(({ loginMode = 'login', passwordConfig }) => {
956
- const fields = usernamePasswordLoginFields({ username: 'email', password: passwordConfig, verifyPassword: loginMode === 'register' });
957
- return fields;
958
- }));
959
- }
960
- set config(config) {
961
- this._config.next(config);
962
- }
963
- ngOnDestroy() {
964
- super.ngOnDestroy();
965
- this._config.complete();
966
- }
967
- }
968
- DbxFirebaseEmailFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseEmailFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
969
- DbxFirebaseEmailFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseEmailFormComponent, selector: "dbx-firebase-email-form", inputs: { config: "config" }, providers: [provideFormlyContext()], usesInheritance: true, ngImport: i0, template: `
970
- <dbx-formly></dbx-formly>
971
- `, isInline: true, dependencies: [{ kind: "component", type: i1$3.DbxFormlyFormComponent, selector: "dbx-formly", exportAs: ["formly"] }] });
972
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseEmailFormComponent, decorators: [{
973
- type: Component,
974
- args: [{
975
- template: `
976
- <dbx-formly></dbx-formly>
977
- `,
978
- selector: 'dbx-firebase-email-form',
979
- providers: [provideFormlyContext()]
980
- }]
981
- }], propDecorators: { config: [{
982
- type: Input
983
- }] } });
984
-
985
- class DbxFirebaseEmailRecoveryFormComponent extends AbstractSyncFormlyFormDirective {
986
- constructor() {
987
- super(...arguments);
988
- this.fields = [emailField({ required: true })];
989
- }
990
- }
991
- DbxFirebaseEmailRecoveryFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseEmailRecoveryFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
992
- DbxFirebaseEmailRecoveryFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseEmailRecoveryFormComponent, selector: "dbx-firebase-email-recovery-form", providers: [provideFormlyContext()], usesInheritance: true, ngImport: i0, template: `
993
- <dbx-formly></dbx-formly>
994
- `, isInline: true, dependencies: [{ kind: "component", type: i1$3.DbxFormlyFormComponent, selector: "dbx-formly", exportAs: ["formly"] }] });
995
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseEmailRecoveryFormComponent, decorators: [{
996
- type: Component,
997
- args: [{
998
- template: `
999
- <dbx-formly></dbx-formly>
1000
- `,
1001
- selector: 'dbx-firebase-email-recovery-form',
1002
- providers: [provideFormlyContext()]
1003
- }]
1004
- }] });
1005
-
1006
- class DbxFirebaseLoginEmailContentComponent {
1007
- constructor(dbxFirebaseAuthService, config) {
1008
- this.dbxFirebaseAuthService = dbxFirebaseAuthService;
1009
- this.config = config;
1010
- this.formConfig = {
1011
- loginMode: this.config.loginMode,
1012
- passwordConfig: this.config.passwordConfig
1013
- };
1014
- this._emailMode = new BehaviorSubject('login');
1015
- this.emailMode$ = this._emailMode.asObservable();
1016
- this.forgotAnchor = {
1017
- onClick: () => {
1018
- this.openRecovery();
1019
- }
1020
- };
1021
- this.doneOrCancelled = new EventEmitter();
1022
- this.handleLoginAction = (value) => {
1023
- this.emailFormValue = value;
1024
- this.recoveryFormValue = { email: value.username }; // cache value for recovery
1025
- let result;
1026
- if (this.loginMode === 'register') {
1027
- result = this.dbxFirebaseAuthService.registerWithEmailAndPassword(value.username, value.password);
1028
- }
1029
- else {
1030
- result = this.dbxFirebaseAuthService.logInWithEmailAndPassword(value.username, value.password).catch((error) => {
1031
- throw firebaseAuthErrorToReadableError(error);
1032
- });
1033
- }
1034
- return from(result).pipe(tap(() => {
1035
- this.doneOrCancelled.next(true);
1036
- }));
1037
- };
1038
- this.handleRecoveryAction = (value, context) => {
1039
- this.recoveryFormValue = value;
1040
- this.emailFormValue = { username: value.email, password: '' };
1041
- context.startWorkingWithPromise(this.dbxFirebaseAuthService.sendPasswordResetEmail(value.email));
1042
- };
1043
- // MARK: Recovering
1044
- this.handleRecoverySuccess = (x) => {
1045
- this._emailMode.next('recoversent');
1046
- };
1047
- }
1048
- static openEmailLoginContext(dbxFirebaseLoginContext, config) {
1049
- return dbxFirebaseLoginContext.showContext({
1050
- config: {
1051
- componentClass: DbxFirebaseLoginEmailContentComponent,
1052
- data: config
1053
- },
1054
- use: (instance) => firstValueFrom(instance.doneOrCancelled)
1055
- });
1056
- }
1057
- ngOnDestroy() {
1058
- this._emailMode.complete();
1059
- }
1060
- get loginMode() {
1061
- return this.config.loginMode;
1062
- }
1063
- get isLoginMode() {
1064
- return this.loginMode === 'login';
1065
- }
1066
- get isRegisterMode() {
1067
- return this.loginMode === 'register';
1068
- }
1069
- get buttonText() {
1070
- return this.config.loginMode === 'register' ? 'Register' : 'Log In';
1071
- }
1072
- // MARK: Recovery
1073
- openRecovery() {
1074
- this._emailMode.next('recover');
1075
- }
1076
- clickedRecoveryAcknowledged() {
1077
- this._emailMode.next('login');
1078
- }
1079
- // MARK: Cancel
1080
- onCancel() {
1081
- this.doneOrCancelled.next(false);
1082
- }
1083
- onCancelReset() {
1084
- this.doneOrCancelled.next(false);
1085
- }
1086
- }
1087
- DbxFirebaseLoginEmailContentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginEmailContentComponent, deps: [{ token: DbxFirebaseAuthService }, { token: DBX_INJECTION_COMPONENT_DATA }], target: i0.ɵɵFactoryTarget.Component });
1088
- DbxFirebaseLoginEmailContentComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", 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 *ngSwitchCase=\"'recoversent'\">\n <ng-container *ngTemplateOutlet=\"resetPasswordSent\"></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-button-wide\" [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 <div class=\"dbx-firebase-login-email-content-recovery\" dbxAction [dbxActionHandler]=\"handleRecoveryAction\" [dbxActionSuccessHandler]=\"handleRecoverySuccess\">\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-button-wide\" 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 </div>\n</ng-template>\n\n<!-- Reset Password Sent -->\n<ng-template #resetPasswordSent>\n <div class=\"dbx-firebase-login-email-content-recovery-sent\">\n <p class=\"dbx-hint\">A recovery email was sent to the specified address. Please check your email for next steps.</p>\n <button mat-raised-button (click)=\"clickedRecoveryAcknowledged()\">Ok</button>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "component", type: i3$1.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"] }, { kind: "component", type: i1$2.DbxAnchorLinkComponent, selector: "dbx-link", inputs: ["anchor", "ref", "href"] }, { kind: "directive", type: i1$3.DbxFormSourceDirective, selector: "[dbxFormSource]", inputs: ["dbxFormSourceMode", "dbxFormSource"] }, { kind: "directive", type: i1$3.DbxActionFormDirective, selector: "[dbxActionForm]", inputs: ["dbxActionFormValidator", "dbxActionFormModified", "dbxActionFormMapValue", "formDisabledOnWorking"] }, { kind: "component", type: i1$2.DbxReadableErrorComponent, selector: "dbx-error", inputs: ["error"] }, { kind: "directive", type: i1$2.DbxActionErrorDirective, selector: "[dbxActionError]" }, { kind: "directive", type: i2$2.DbxActionDirective, selector: "dbx-action,[dbxAction],dbx-action-context,[dbxActionContext]", exportAs: ["action", "dbxAction"] }, { kind: "directive", type: i2$2.DbxActionHandlerDirective, selector: "[dbxActionHandler]", inputs: ["dbxActionHandler"] }, { kind: "directive", type: i2$2.DbxActionSuccessHandlerDirective, selector: "[dbxActionSuccessHandler]", inputs: ["dbxActionSuccessHandler"] }, { kind: "directive", type: i2$2.DbxActionButtonDirective, selector: "[dbxActionButton]" }, { kind: "component", type: i1$2.DbxButtonComponent, selector: "dbx-button", inputs: ["type", "raised", "stroked", "flat", "iconOnly", "color", "customButtonColor", "customTextColor", "customSpinnerColor"] }, { kind: "directive", type: i1$2.DbxButtonSpacerDirective, selector: "dbx-button-spacer,[dbxButtonSpacer]" }, { kind: "component", type: DbxFirebaseEmailFormComponent, selector: "dbx-firebase-email-form", inputs: ["config"] }, { kind: "component", type: DbxFirebaseEmailRecoveryFormComponent, selector: "dbx-firebase-email-recovery-form" }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }] });
1089
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginEmailContentComponent, decorators: [{
1090
- type: Component,
1091
- 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 *ngSwitchCase=\"'recoversent'\">\n <ng-container *ngTemplateOutlet=\"resetPasswordSent\"></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-button-wide\" [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 <div class=\"dbx-firebase-login-email-content-recovery\" dbxAction [dbxActionHandler]=\"handleRecoveryAction\" [dbxActionSuccessHandler]=\"handleRecoverySuccess\">\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-button-wide\" 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 </div>\n</ng-template>\n\n<!-- Reset Password Sent -->\n<ng-template #resetPasswordSent>\n <div class=\"dbx-firebase-login-email-content-recovery-sent\">\n <p class=\"dbx-hint\">A recovery email was sent to the specified address. Please check your email for next steps.</p>\n <button mat-raised-button (click)=\"clickedRecoveryAcknowledged()\">Ok</button>\n </div>\n</ng-template>\n" }]
1092
- }], ctorParameters: function () {
1093
- return [{ type: DbxFirebaseAuthService }, { type: undefined, decorators: [{
1094
- type: Inject,
1095
- args: [DBX_INJECTION_COMPONENT_DATA]
1096
- }] }];
1097
- } });
1098
-
1099
- class DbxFirebaseLoginEmailComponent extends AbstractConfiguredDbxFirebaseLoginButtonDirective {
1100
- constructor() {
1101
- super(...arguments);
1102
- this.loginProvider = 'email';
1103
- }
1104
- handleLogin() {
1105
- return DbxFirebaseLoginEmailContentComponent.openEmailLoginContext(this.dbxFirebaseLoginContext, { loginMode: 'login', passwordConfig: this.dbxFirebaseAuthLoginService.getPasswordConfig() });
1106
- }
1107
- }
1108
- DbxFirebaseLoginEmailComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginEmailComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1109
- DbxFirebaseLoginEmailComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseLoginEmailComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "\n <dbx-firebase-login-button-container>\n <dbx-firebase-login-button [config]=\"config\"></dbx-firebase-login-button>\n </dbx-firebase-login-button-container>\n", isInline: true, dependencies: [{ kind: "component", type: DbxFirebaseLoginButtonComponent, selector: "dbx-firebase-login-button", inputs: ["config"] }, { kind: "component", type: DbxFirebaseLoginButtonContainerComponent, selector: "dbx-firebase-login-button-container" }] });
1110
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginEmailComponent, decorators: [{
1111
- type: Component,
1112
- args: [{
1113
- template: DEFAULT_CONFIGURED_DBX_FIREBASE_LOGIN_BUTTON_TEMPLATE
1114
- }]
1115
- }] });
1116
-
1117
- class DbxFirebaseLoginFacebookComponent extends AbstractConfiguredDbxFirebaseLoginButtonDirective {
1118
- constructor() {
1119
- super(...arguments);
1120
- this.loginProvider = 'facebook';
1121
- }
1122
- handleLogin() {
1123
- return this.dbxFirebaseAuthService.logInWithFacebook();
1124
- }
1125
- }
1126
- DbxFirebaseLoginFacebookComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginFacebookComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1127
- DbxFirebaseLoginFacebookComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseLoginFacebookComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "\n <dbx-firebase-login-button-container>\n <dbx-firebase-login-button [config]=\"config\"></dbx-firebase-login-button>\n </dbx-firebase-login-button-container>\n", isInline: true, dependencies: [{ kind: "component", type: DbxFirebaseLoginButtonComponent, selector: "dbx-firebase-login-button", inputs: ["config"] }, { kind: "component", type: DbxFirebaseLoginButtonContainerComponent, selector: "dbx-firebase-login-button-container" }] });
1128
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginFacebookComponent, decorators: [{
1129
- type: Component,
1130
- args: [{
1131
- template: DEFAULT_CONFIGURED_DBX_FIREBASE_LOGIN_BUTTON_TEMPLATE
1132
- }]
1133
- }] });
1134
-
1135
- class DbxFirebaseLoginGoogleComponent extends AbstractConfiguredDbxFirebaseLoginButtonDirective {
1136
- constructor() {
1137
- super(...arguments);
1138
- this.loginProvider = 'google';
1139
- }
1140
- handleLogin() {
1141
- return this.dbxFirebaseAuthService.logInWithGoogle();
1142
- }
1143
- }
1144
- DbxFirebaseLoginGoogleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginGoogleComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1145
- DbxFirebaseLoginGoogleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseLoginGoogleComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "\n <dbx-firebase-login-button-container>\n <dbx-firebase-login-button [config]=\"config\"></dbx-firebase-login-button>\n </dbx-firebase-login-button-container>\n", isInline: true, dependencies: [{ kind: "component", type: DbxFirebaseLoginButtonComponent, selector: "dbx-firebase-login-button", inputs: ["config"] }, { kind: "component", type: DbxFirebaseLoginButtonContainerComponent, selector: "dbx-firebase-login-button-container" }] });
1146
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginGoogleComponent, decorators: [{
1147
- type: Component,
1148
- args: [{
1149
- template: DEFAULT_CONFIGURED_DBX_FIREBASE_LOGIN_BUTTON_TEMPLATE
1150
- }]
1151
- }] });
1152
-
1153
- /**
1154
- * Pre-configured register component that displays all configured login types and their registration components.
1155
- */
1156
- class DbxFirebaseRegisterComponent {
1157
- }
1158
- DbxFirebaseRegisterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseRegisterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1159
- DbxFirebaseRegisterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseRegisterComponent, selector: "dbx-firebase-register", inputs: { providerTypes: "providerTypes", omitProviderTypes: "omitProviderTypes", providerCategories: "providerCategories" }, ngImport: i0, template: `
1160
- <dbx-firebase-login loginMode="register" [providerTypes]="providerTypes" [omitProviderTypes]="omitProviderTypes" [providerCategories]="providerCategories"></dbx-firebase-login>
1161
- `, isInline: true, dependencies: [{ kind: "component", type: DbxFirebaseLoginComponent, selector: "dbx-firebase-login", inputs: ["loginMode", "providerTypes", "omitProviderTypes", "providerCategories"] }] });
1162
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseRegisterComponent, decorators: [{
1163
- type: Component,
1164
- args: [{
1165
- selector: 'dbx-firebase-register',
1166
- template: `
1167
- <dbx-firebase-login loginMode="register" [providerTypes]="providerTypes" [omitProviderTypes]="omitProviderTypes" [providerCategories]="providerCategories"></dbx-firebase-login>
1168
- `
1169
- }]
1170
- }], propDecorators: { providerTypes: [{
1171
- type: Input
1172
- }], omitProviderTypes: [{
1173
- type: Input
1174
- }], providerCategories: [{
1175
- type: Input
1176
- }] } });
1177
-
1178
- class DbxFirebaseLoginGitHubComponent extends AbstractConfiguredDbxFirebaseLoginButtonDirective {
1179
- constructor() {
1180
- super(...arguments);
1181
- this.loginProvider = 'github';
1182
- }
1183
- handleLogin() {
1184
- return this.dbxFirebaseAuthService.logInWithGithub();
1185
- }
1186
- }
1187
- DbxFirebaseLoginGitHubComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginGitHubComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1188
- DbxFirebaseLoginGitHubComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseLoginGitHubComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "\n <dbx-firebase-login-button-container>\n <dbx-firebase-login-button [config]=\"config\"></dbx-firebase-login-button>\n </dbx-firebase-login-button-container>\n", isInline: true, dependencies: [{ kind: "component", type: DbxFirebaseLoginButtonComponent, selector: "dbx-firebase-login-button", inputs: ["config"] }, { kind: "component", type: DbxFirebaseLoginButtonContainerComponent, selector: "dbx-firebase-login-button-container" }] });
1189
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginGitHubComponent, decorators: [{
1190
- type: Component,
1191
- args: [{
1192
- template: DEFAULT_CONFIGURED_DBX_FIREBASE_LOGIN_BUTTON_TEMPLATE
1193
- }]
1194
- }] });
1195
-
1196
- class DbxFirebaseLoginTwitterComponent extends AbstractConfiguredDbxFirebaseLoginButtonDirective {
1197
- constructor() {
1198
- super(...arguments);
1199
- this.loginProvider = 'twitter';
1200
- }
1201
- handleLogin() {
1202
- return this.dbxFirebaseAuthService.logInWithTwitter();
1203
- }
1204
- }
1205
- DbxFirebaseLoginTwitterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginTwitterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1206
- DbxFirebaseLoginTwitterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseLoginTwitterComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "\n <dbx-firebase-login-button-container>\n <dbx-firebase-login-button [config]=\"config\"></dbx-firebase-login-button>\n </dbx-firebase-login-button-container>\n", isInline: true, dependencies: [{ kind: "component", type: DbxFirebaseLoginButtonComponent, selector: "dbx-firebase-login-button", inputs: ["config"] }, { kind: "component", type: DbxFirebaseLoginButtonContainerComponent, selector: "dbx-firebase-login-button-container" }] });
1207
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginTwitterComponent, decorators: [{
1208
- type: Component,
1209
- args: [{
1210
- template: DEFAULT_CONFIGURED_DBX_FIREBASE_LOGIN_BUTTON_TEMPLATE
1211
- }]
1212
- }] });
1213
-
1214
- class DbxFirebaseLoginMicrosoftComponent extends AbstractConfiguredDbxFirebaseLoginButtonDirective {
1215
- constructor() {
1216
- super(...arguments);
1217
- this.loginProvider = 'microsoft';
1218
- }
1219
- handleLogin() {
1220
- return this.dbxFirebaseAuthService.logInWithMicrosoft();
1221
- }
1222
- }
1223
- DbxFirebaseLoginMicrosoftComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginMicrosoftComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1224
- DbxFirebaseLoginMicrosoftComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseLoginMicrosoftComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "\n <dbx-firebase-login-button-container>\n <dbx-firebase-login-button [config]=\"config\"></dbx-firebase-login-button>\n </dbx-firebase-login-button-container>\n", isInline: true, dependencies: [{ kind: "component", type: DbxFirebaseLoginButtonComponent, selector: "dbx-firebase-login-button", inputs: ["config"] }, { kind: "component", type: DbxFirebaseLoginButtonContainerComponent, selector: "dbx-firebase-login-button-container" }] });
1225
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginMicrosoftComponent, decorators: [{
1226
- type: Component,
1227
- args: [{
1228
- template: DEFAULT_CONFIGURED_DBX_FIREBASE_LOGIN_BUTTON_TEMPLATE
1229
- }]
1230
- }] });
1231
-
1232
- class DbxFirebaseRegisterEmailComponent extends AbstractConfiguredDbxFirebaseLoginButtonDirective {
1233
- constructor() {
1234
- super(...arguments);
1235
- this.loginProvider = 'email';
1236
- }
1237
- handleLogin() {
1238
- return DbxFirebaseLoginEmailContentComponent.openEmailLoginContext(this.dbxFirebaseLoginContext, { loginMode: 'register', passwordConfig: this.dbxFirebaseAuthLoginService.getPasswordConfig() });
1239
- }
1240
- }
1241
- DbxFirebaseRegisterEmailComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseRegisterEmailComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1242
- DbxFirebaseRegisterEmailComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseRegisterEmailComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<dbx-firebase-login-button-container>\n <dbx-firebase-login-button [config]=\"config\"></dbx-firebase-login-button>\n</dbx-firebase-login-button-container>\n", dependencies: [{ kind: "component", type: DbxFirebaseLoginButtonComponent, selector: "dbx-firebase-login-button", inputs: ["config"] }, { kind: "component", type: DbxFirebaseLoginButtonContainerComponent, selector: "dbx-firebase-login-button-container" }] });
1243
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseRegisterEmailComponent, decorators: [{
1244
- type: Component,
1245
- args: [{ template: "<dbx-firebase-login-button-container>\n <dbx-firebase-login-button [config]=\"config\"></dbx-firebase-login-button>\n</dbx-firebase-login-button-container>\n" }]
1246
- }] });
1247
-
1248
- class DbxFirebaseLoginTermsComponent {
1249
- constructor(dbxFirebaseAuthLoginService) {
1250
- this.dbxFirebaseAuthLoginService = dbxFirebaseAuthLoginService;
1251
- this.config = {
1252
- componentClass: this.dbxFirebaseAuthLoginService.termsComponentClass
1253
- };
1254
- }
1255
- }
1256
- DbxFirebaseLoginTermsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginTermsComponent, deps: [{ token: DbxFirebaseAuthLoginService }], target: i0.ɵɵFactoryTarget.Component });
1257
- DbxFirebaseLoginTermsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseLoginTermsComponent, selector: "dbx-firebase-login-terms", host: { classAttribute: "dbx-firebase-login-terms d-block" }, ngImport: i0, template: `
1258
- <dbx-injection [config]="config"></dbx-injection>
1259
- `, isInline: true, dependencies: [{ kind: "component", type: i2$2.DbxInjectionComponent, selector: "dbx-injection, [dbxInjection], [dbx-injection]", inputs: ["config", "template"] }] });
1260
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginTermsComponent, decorators: [{
1261
- type: Component,
1262
- args: [{
1263
- selector: 'dbx-firebase-login-terms',
1264
- template: `
1265
- <dbx-injection [config]="config"></dbx-injection>
1266
- `,
1267
- host: {
1268
- class: 'dbx-firebase-login-terms d-block'
1269
- }
1270
- }]
1271
- }], ctorParameters: function () { return [{ type: DbxFirebaseAuthLoginService }]; } });
1272
-
1273
- class DbxFirebaseLoginContextBackButtonComponent {
1274
- constructor() {
1275
- this.cancelLogin = new EventEmitter();
1276
- this.anchor = {
1277
- onClick: () => this.cancelLogin.emit()
1278
- };
1279
- }
1280
- }
1281
- DbxFirebaseLoginContextBackButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginContextBackButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1282
- DbxFirebaseLoginContextBackButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseLoginContextBackButtonComponent, selector: "dbx-firebase-login-context-back-button", outputs: { cancelLogin: "cancelLogin" }, ngImport: i0, template: `
1283
- <dbx-link [anchor]="anchor">Choose other login method.</dbx-link>
1284
- `, isInline: true, dependencies: [{ kind: "component", type: i1$2.DbxAnchorLinkComponent, selector: "dbx-link", inputs: ["anchor", "ref", "href"] }] });
1285
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginContextBackButtonComponent, decorators: [{
1286
- type: Component,
1287
- args: [{
1288
- selector: 'dbx-firebase-login-context-back-button',
1289
- template: `
1290
- <dbx-link [anchor]="anchor">Choose other login method.</dbx-link>
1291
- `
1292
- }]
1293
- }], propDecorators: { cancelLogin: [{
1294
- type: Output
1295
- }] } });
1296
-
1297
- class DbxFirebaseLoginModuleRootConfig extends DbxFirebaseLoginTermsConfig {
1298
- }
1299
- function defaultFirebaseAuthLoginProvidersFactory() {
1300
- // NOTE: Asset URLS are from Firebase.
1301
- // https://firebase.google.com/docs/auth/web/firebaseui
1302
- const baseFirebaseJSUrl = `https://www.gstatic.com/firebasejs/ui/2.0.0/images/auth`;
1303
- // NOTE: Colors are from https://brandcolors.net/
1304
- return [
1305
- {
1306
- category: DEFAULT_FIREBASE_LOGIN_METHOD_CATEGORY,
1307
- loginMethodType: 'email',
1308
- componentClass: DbxFirebaseLoginEmailComponent,
1309
- registrationComponentClass: DbxFirebaseRegisterEmailComponent,
1310
- assets: {
1311
- logoUrl: `${baseFirebaseJSUrl}/mail.svg`,
1312
- loginText: 'Continue with Email',
1313
- backgroundColor: '#ea4335',
1314
- textColor: '#FFF'
1315
- }
1316
- },
1317
- {
1318
- category: OAUTH_FIREBASE_LOGIN_METHOD_CATEGORY,
1319
- loginMethodType: 'google',
1320
- componentClass: DbxFirebaseLoginGoogleComponent,
1321
- assets: {
1322
- logoUrl: `${baseFirebaseJSUrl}/google.svg`,
1323
- loginText: 'Continue with Google',
1324
- backgroundColor: '#FFF',
1325
- textColor: '#757575'
1326
- }
1327
- },
1328
- {
1329
- category: OAUTH_FIREBASE_LOGIN_METHOD_CATEGORY,
1330
- loginMethodType: 'facebook',
1331
- componentClass: DbxFirebaseLoginFacebookComponent,
1332
- assets: {
1333
- logoUrl: `${baseFirebaseJSUrl}/facebook.svg`,
1334
- loginText: 'Continue with Facebook',
1335
- backgroundColor: '#4267B2',
1336
- textColor: '#FFF'
1337
- }
1338
- },
1339
- {
1340
- category: OAUTH_FIREBASE_LOGIN_METHOD_CATEGORY,
1341
- loginMethodType: 'twitter',
1342
- componentClass: DbxFirebaseLoginTwitterComponent,
1343
- assets: {
1344
- logoUrl: `${baseFirebaseJSUrl}/twitter.svg`,
1345
- loginText: 'Continue with Twitter',
1346
- backgroundColor: '#1da1f2',
1347
- textColor: '#FFF'
1348
- }
1349
- },
1350
- {
1351
- category: OAUTH_FIREBASE_LOGIN_METHOD_CATEGORY,
1352
- loginMethodType: 'github',
1353
- componentClass: DbxFirebaseLoginGitHubComponent,
1354
- assets: {
1355
- logoUrl: `${baseFirebaseJSUrl}/github.svg`,
1356
- loginText: 'Continue with Github',
1357
- backgroundColor: '#333',
1358
- textColor: '#FFF'
1359
- }
1360
- },
1361
- /*{
1362
- category: OAUTH_FIREBASE_LOGIN_METHOD_CATEGORY,
1363
- loginMethodType: 'apple' as KnownFirebaseLoginMethodType,
1364
- componentClass: DbxFirebaseLoginGitHubComponent,
1365
- assets: {
1366
- logoUrl: `${baseFirebaseJSUrl}/apple.svg`,
1367
- loginText: 'Continue with Apple',
1368
- backgroundColor: '#333',
1369
- textColor: '#FFF'
1370
- }
1371
- }, {
1372
- category: OAUTH_FIREBASE_LOGIN_METHOD_CATEGORY,
1373
- loginMethodType: 'microsoft' as KnownFirebaseLoginMethodType,
1374
- componentClass: DbxFirebaseLoginGitHubComponent,
1375
- assets: {
1376
- logoUrl: `${baseFirebaseJSUrl}/microsoft.svg`,
1377
- loginText: 'Continue with Microsoft',
1378
- backgroundColor: '#ea3e23',
1379
- textColor: '#FFF'
1380
- }
1381
- },*/ {
1382
- category: DEFAULT_FIREBASE_LOGIN_METHOD_CATEGORY,
1383
- loginMethodType: 'anonymous',
1384
- componentClass: DbxFirebaseLoginAnonymousComponent,
1385
- assets: {
1386
- loginIcon: 'account_circle',
1387
- loginText: 'Continue as Guest',
1388
- backgroundColor: '#000',
1389
- textColor: '#FFF'
1390
- }
1391
- }
1392
- ];
1393
- }
1394
- /**
1395
- * Contains components related to logging in.
1396
- */
1397
- class DbxFirebaseLoginModule {
1398
- constructor(config, dbxFirebaseAuthLoginService) {
1399
- if (config.enabledLoginMethods === true) {
1400
- dbxFirebaseAuthLoginService.setEnableAll();
1401
- }
1402
- else {
1403
- dbxFirebaseAuthLoginService.enable(config.enabledLoginMethods); // enable the types in the service.
1404
- }
1405
- }
1406
- static forRoot(config) {
1407
- return {
1408
- ngModule: DbxFirebaseLoginModule,
1409
- providers: [
1410
- {
1411
- provide: DEFAULT_FIREBASE_AUTH_LOGIN_PROVIDERS_TOKEN,
1412
- useFactory: defaultFirebaseAuthLoginProvidersFactory
1413
- },
1414
- {
1415
- provide: DEFAULT_FIREBASE_AUTH_LOGIN_TERMS_COMPONENT_CLASS_TOKEN,
1416
- useValue: config.termsComponentClass
1417
- },
1418
- {
1419
- provide: DEFAULT_FIREBASE_AUTH_LOGIN_PASSWORD_CONFIG_TOKEN,
1420
- useValue: config.passwordConfig
1421
- },
1422
- {
1423
- provide: DbxFirebaseLoginModuleRootConfig,
1424
- useValue: config
1425
- },
1426
- {
1427
- provide: DbxFirebaseLoginTermsConfig,
1428
- useValue: config
1429
- }
1430
- ]
1431
- };
1432
- }
1433
- }
1434
- DbxFirebaseLoginModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginModule, deps: [{ token: DbxFirebaseLoginModuleRootConfig }, { token: DbxFirebaseAuthLoginService }], target: i0.ɵɵFactoryTarget.NgModule });
1435
- DbxFirebaseLoginModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginModule, declarations: [DbxFirebaseLoginComponent,
1436
- DbxFirebaseLoginContextDirective,
1437
- DbxFirebaseLoginContextBackButtonComponent,
1438
- DbxFirebaseRegisterComponent,
1439
- DbxFirebaseLoginListComponent,
1440
- DbxFirebaseLoginButtonComponent,
1441
- DbxFirebaseLoginButtonContainerComponent,
1442
- DbxFirebaseLoginEmailComponent,
1443
- DbxFirebaseLoginEmailContentComponent,
1444
- DbxFirebaseEmailFormComponent,
1445
- DbxFirebaseEmailRecoveryFormComponent,
1446
- DbxFirebaseRegisterEmailComponent,
1447
- DbxFirebaseLoginGoogleComponent,
1448
- DbxFirebaseLoginGitHubComponent,
1449
- DbxFirebaseLoginTwitterComponent,
1450
- DbxFirebaseLoginAppleComponent,
1451
- DbxFirebaseLoginMicrosoftComponent,
1452
- DbxFirebaseLoginFacebookComponent,
1453
- DbxFirebaseLoginAnonymousComponent,
1454
- DbxFirebaseLoginTermsComponent,
1455
- DbxFirebaseLoginTermsSimpleComponent], imports: [CommonModule, MatIconModule, MatButtonModule, DbxRouterAnchorModule, DbxFormIoModule, DbxFormModule, DbxFormlyModule, DbxFormActionModule, DbxFormFormlyTextFieldModule, DbxReadableErrorModule, DbxActionModule, DbxButtonModule, DbxInjectionComponentModule], exports: [DbxFirebaseLoginComponent,
1456
- DbxFirebaseLoginContextDirective,
1457
- DbxFirebaseLoginContextBackButtonComponent,
1458
- DbxFirebaseRegisterComponent,
1459
- DbxFirebaseLoginListComponent,
1460
- DbxFirebaseLoginButtonComponent,
1461
- DbxFirebaseLoginButtonContainerComponent,
1462
- DbxFirebaseLoginEmailComponent,
1463
- DbxFirebaseLoginEmailContentComponent,
1464
- DbxFirebaseEmailFormComponent,
1465
- DbxFirebaseEmailRecoveryFormComponent,
1466
- DbxFirebaseRegisterEmailComponent,
1467
- DbxFirebaseLoginGoogleComponent,
1468
- DbxFirebaseLoginGitHubComponent,
1469
- DbxFirebaseLoginTwitterComponent,
1470
- DbxFirebaseLoginAppleComponent,
1471
- DbxFirebaseLoginMicrosoftComponent,
1472
- DbxFirebaseLoginFacebookComponent,
1473
- DbxFirebaseLoginAnonymousComponent,
1474
- DbxFirebaseLoginTermsComponent,
1475
- DbxFirebaseLoginTermsSimpleComponent] });
1476
- DbxFirebaseLoginModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginModule, imports: [CommonModule, MatIconModule, MatButtonModule, DbxRouterAnchorModule, DbxFormIoModule, DbxFormModule, DbxFormlyModule, DbxFormActionModule, DbxFormFormlyTextFieldModule, DbxReadableErrorModule, DbxActionModule, DbxButtonModule, DbxInjectionComponentModule] });
1477
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseLoginModule, decorators: [{
1478
- type: NgModule,
1479
- args: [{
1480
- imports: [CommonModule, MatIconModule, MatButtonModule, DbxRouterAnchorModule, DbxFormIoModule, DbxFormModule, DbxFormlyModule, DbxFormActionModule, DbxFormFormlyTextFieldModule, DbxReadableErrorModule, DbxActionModule, DbxButtonModule, DbxInjectionComponentModule],
1481
- declarations: [
1482
- DbxFirebaseLoginComponent,
1483
- DbxFirebaseLoginContextDirective,
1484
- DbxFirebaseLoginContextBackButtonComponent,
1485
- DbxFirebaseRegisterComponent,
1486
- DbxFirebaseLoginListComponent,
1487
- DbxFirebaseLoginButtonComponent,
1488
- DbxFirebaseLoginButtonContainerComponent,
1489
- DbxFirebaseLoginEmailComponent,
1490
- DbxFirebaseLoginEmailContentComponent,
1491
- DbxFirebaseEmailFormComponent,
1492
- DbxFirebaseEmailRecoveryFormComponent,
1493
- DbxFirebaseRegisterEmailComponent,
1494
- DbxFirebaseLoginGoogleComponent,
1495
- DbxFirebaseLoginGitHubComponent,
1496
- DbxFirebaseLoginTwitterComponent,
1497
- DbxFirebaseLoginAppleComponent,
1498
- DbxFirebaseLoginMicrosoftComponent,
1499
- DbxFirebaseLoginFacebookComponent,
1500
- DbxFirebaseLoginAnonymousComponent,
1501
- DbxFirebaseLoginTermsComponent,
1502
- DbxFirebaseLoginTermsSimpleComponent
1503
- ],
1504
- exports: [
1505
- DbxFirebaseLoginComponent,
1506
- DbxFirebaseLoginContextDirective,
1507
- DbxFirebaseLoginContextBackButtonComponent,
1508
- DbxFirebaseRegisterComponent,
1509
- DbxFirebaseLoginListComponent,
1510
- DbxFirebaseLoginButtonComponent,
1511
- DbxFirebaseLoginButtonContainerComponent,
1512
- DbxFirebaseLoginEmailComponent,
1513
- DbxFirebaseLoginEmailContentComponent,
1514
- DbxFirebaseEmailFormComponent,
1515
- DbxFirebaseEmailRecoveryFormComponent,
1516
- DbxFirebaseRegisterEmailComponent,
1517
- DbxFirebaseLoginGoogleComponent,
1518
- DbxFirebaseLoginGitHubComponent,
1519
- DbxFirebaseLoginTwitterComponent,
1520
- DbxFirebaseLoginAppleComponent,
1521
- DbxFirebaseLoginMicrosoftComponent,
1522
- DbxFirebaseLoginFacebookComponent,
1523
- DbxFirebaseLoginAnonymousComponent,
1524
- DbxFirebaseLoginTermsComponent,
1525
- DbxFirebaseLoginTermsSimpleComponent
1526
- ],
1527
- providers: []
1528
- }]
1529
- }], ctorParameters: function () { return [{ type: DbxFirebaseLoginModuleRootConfig }, { type: DbxFirebaseAuthLoginService }]; } });
1530
-
1531
- function authRolesObsWithClaimsService(config) {
1532
- const { addAuthUserStateToRoles: addAuthUserState, claimsService } = config;
1533
- return (dbxFirebaseAuthService) => {
1534
- let obs = dbxFirebaseAuthService.idTokenResult$.pipe(map((x) => claimsService.toRoles(x.claims)));
1535
- if (addAuthUserState) {
1536
- obs = obs.pipe(switchMap((authRoleSet) => dbxFirebaseAuthService.authUserState$.pipe(map((userState) => addToSetCopy(authRoleSet, [userState])))));
1537
- }
1538
- return obs;
1539
- };
1540
- }
1541
- function defaultDbxFirebaseAuthServiceDelegateWithClaimsService(config) {
1542
- var _a, _b;
1543
- if (filterMaybeValues([config.stateForLoggedInUser, config.stateForLoggedInUserToken, config.authUserStateObs]).length > 1) {
1544
- throw new Error('Cannot specify a combination of "stateForLoggedInUserToken", "stateForLoggedInUser" and "authUserStateObs". Must specify one at max.');
1545
- }
1546
- const authUserStateObs = (_a = config.authUserStateObs) !== null && _a !== void 0 ? _a : authUserStateFromFirebaseAuthServiceFunction(config.stateForLoggedInUserToken ? stateFromTokenForLoggedInUserFunction(config.stateForLoggedInUserToken) : config.stateForLoggedInUser);
1547
- return {
1548
- authUserStateObs,
1549
- isAdminInAuthRoleSet: (_b = config.isAdminInAuthRoleSet) !== null && _b !== void 0 ? _b : DEFAULT_DBX_FIREBASE_AUTH_SERVICE_DELEGATE.isAdminInAuthRoleSet,
1550
- authRolesObs: authRolesObsWithClaimsService(config),
1551
- isOnboarded: DEFAULT_DBX_FIREBASE_AUTH_SERVICE_DELEGATE.isOnboarded,
1552
- authRoleClaimsService: config.claimsService
1553
- };
1554
- }
1555
-
1556
- class DbxFirebaseAuthModule {
1557
- static forRoot(config) {
1558
- const providers = [
1559
- DbxFirebaseAuthService,
1560
- {
1561
- provide: DbxAuthService,
1562
- useExisting: DbxFirebaseAuthService
1563
- }
1564
- ];
1565
- if (config.delegateFactory) {
1566
- providers.push({
1567
- provide: DbxFirebaseAuthServiceDelegate,
1568
- useFactory: config.delegateFactory,
1569
- deps: [Injector]
1570
- });
1571
- }
1572
- return {
1573
- ngModule: DbxFirebaseAuthModule,
1574
- providers
1575
- };
1576
- }
1577
- }
1578
- DbxFirebaseAuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1579
- DbxFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseAuthModule });
1580
- DbxFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseAuthModule });
1581
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseAuthModule, decorators: [{
1582
- type: NgModule,
1583
- args: [{}]
1584
- }] });
1585
-
1586
- /**
1587
- * Default providers to inject.
1588
- */
1589
- const DEFAULT_FIREBASE_DEVELOPMENT_WIDGET_PROVIDERS_TOKEN = new InjectionToken('DefaultDbxFirebaseDevelopmentWidgetEntries');
1590
- /**
1591
- * Service used for registering widgets used for development.
1592
- *
1593
- * Default providers can be configured by the DEFAULT_FIREBASE_AUTH_LOGIN_PROVIDERS_TOKEN injectable value.
1594
- */
1595
- class DbxFirebaseDevelopmentWidgetService {
1596
- constructor(defaultEntries, dbxWidgetService) {
1597
- this.dbxWidgetService = dbxWidgetService;
1598
- this._entries = new Map();
1599
- if (defaultEntries) {
1600
- defaultEntries.forEach((x) => this.register(x, false));
1601
- }
1602
- }
1603
- /**
1604
- * Used to register a provider. If a provider is already registered, this will override it by default.
1605
- *
1606
- * @param provider
1607
- * @param override
1608
- */
1609
- register(provider, override = true) {
1610
- const type = provider.widget.type;
1611
- if (override || !this._entries.has(type)) {
1612
- this._entries.set(type, provider);
1613
- this.dbxWidgetService.register(provider.widget, override);
1614
- return true;
1615
- }
1616
- else {
1617
- return false;
1618
- }
1619
- }
1620
- getEntryWidgetIdentifiers() {
1621
- return Array.from(this._entries.keys());
1622
- }
1623
- getEntries() {
1624
- return iterableToArray(this._entries.values());
1625
- }
1626
- }
1627
- DbxFirebaseDevelopmentWidgetService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentWidgetService, deps: [{ token: DEFAULT_FIREBASE_DEVELOPMENT_WIDGET_PROVIDERS_TOKEN, optional: true }, { token: i1$2.DbxWidgetService }], target: i0.ɵɵFactoryTarget.Injectable });
1628
- DbxFirebaseDevelopmentWidgetService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentWidgetService, providedIn: 'root' });
1629
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentWidgetService, decorators: [{
1630
- type: Injectable,
1631
- args: [{
1632
- providedIn: 'root'
1633
- }]
1634
- }], ctorParameters: function () {
1635
- return [{ type: undefined, decorators: [{
1636
- type: Optional
1637
- }, {
1638
- type: Inject,
1639
- args: [DEFAULT_FIREBASE_DEVELOPMENT_WIDGET_PROVIDERS_TOKEN]
1640
- }] }, { type: i1$2.DbxWidgetService }];
1641
- } });
1642
-
1643
- /**
1644
- * Whether or not the scheduler should be enabled.
1645
- */
1646
- const DEFAULT_FIREBASE_DEVELOPMENT_SCHEDULER_ENABLED_TOKEN = new InjectionToken('DefaultDbxFirebaseDevelopmentSchedulerEnabled');
1647
- /**
1648
- * Service used for hitting the scheduler in the development environment using the
1649
- */
1650
- class DbxFirebaseDevelopmentSchedulerService {
1651
- constructor(_startEnabled, dbxAuthService, firebaseDevelopmentFunctions) {
1652
- this._startEnabled = _startEnabled;
1653
- this.dbxAuthService = dbxAuthService;
1654
- this.firebaseDevelopmentFunctions = firebaseDevelopmentFunctions;
1655
- this._sub = new SubscriptionObject();
1656
- this._enabled = new BehaviorSubject(this._startEnabled !== false);
1657
- this._timerInterval = new BehaviorSubject(60 * 1000);
1658
- this._error = new BehaviorSubject(false);
1659
- this.enabled$ = this._enabled.asObservable();
1660
- this.running$ = combineLatest([this._enabled, this.dbxAuthService.authUserState$.pipe(map((x) => x === 'user'))]).pipe(map(([enabled, userReady]) => enabled && userReady), distinctUntilChanged(), shareReplay(1));
1661
- this.timerInterval$ = this._timerInterval.asObservable();
1662
- this.error$ = this._error.pipe(distinctUntilChanged());
1663
- this.schedulerList$ = lazyFrom(() => {
1664
- return this.firebaseDevelopmentFunctions
1665
- .scheduledFunction({ type: ScheduledFunctionDevelopmentFunctionTypeEnum.LIST })
1666
- .then((result) => {
1667
- const list = result;
1668
- return list.list;
1669
- })
1670
- .catch((e) => {
1671
- console.error('Failed to retrieve development schedule list from server.', e);
1672
- throw e;
1673
- });
1674
- });
1675
- }
1676
- init() {
1677
- this._sub.subscription = this.running$
1678
- .pipe(switchMapWhileTrue(() => {
1679
- console.log('DbxFirebaseDevelopmentSchedulerService enabled.');
1680
- return combineLatest([this._timerInterval, this.schedulerList$]).pipe(switchMap(([timerInterval, schedulerList]) => {
1681
- const executionOrder = schedulerList.map((x) => x.name);
1682
- return interval(timerInterval).pipe(exhaustMap(() => {
1683
- console.log('Running scheduled tasks in order... ', executionOrder);
1684
- return runAsyncTasksForValues(executionOrder, (taskName) => this.runScheduledFunction(taskName), { sequential: true, retriesAllowed: false })
1685
- .then(() => true)
1686
- .catch((e) => {
1687
- console.log('Failed running scheduled task: ', e);
1688
- this._error.next(true);
1689
- return false;
1690
- });
1691
- }), tap((success) => {
1692
- if (success) {
1693
- console.log('Successfully finished running all scheduled tasks.');
1694
- this._error.next(false);
1695
- }
1696
- }));
1697
- }));
1698
- }))
1699
- .subscribe();
1700
- }
1701
- runScheduledFunction(taskName) {
1702
- return this.firebaseDevelopmentFunctions.scheduledFunction({
1703
- run: taskName,
1704
- type: ScheduledFunctionDevelopmentFunctionTypeEnum.RUN
1705
- });
1706
- }
1707
- setTimer(timerInterval) {
1708
- this._timerInterval.next(timerInterval);
1709
- }
1710
- }
1711
- DbxFirebaseDevelopmentSchedulerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentSchedulerService, deps: [{ token: DEFAULT_FIREBASE_DEVELOPMENT_SCHEDULER_ENABLED_TOKEN, optional: true }, { token: i2$2.DbxAuthService }, { token: i1$4.FirebaseDevelopmentFunctions }], target: i0.ɵɵFactoryTarget.Injectable });
1712
- DbxFirebaseDevelopmentSchedulerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentSchedulerService, providedIn: 'root' });
1713
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentSchedulerService, decorators: [{
1714
- type: Injectable,
1715
- args: [{
1716
- providedIn: 'root'
1717
- }]
1718
- }], ctorParameters: function () {
1719
- return [{ type: undefined, decorators: [{
1720
- type: Optional
1721
- }, {
1722
- type: Inject,
1723
- args: [DEFAULT_FIREBASE_DEVELOPMENT_SCHEDULER_ENABLED_TOKEN]
1724
- }] }, { type: i2$2.DbxAuthService }, { type: i1$4.FirebaseDevelopmentFunctions }];
1725
- } });
1726
-
1727
- class DbxFirebaseDevelopmentSchedulerListComponent extends AbstractDbxSelectionListWrapperDirective {
1728
- constructor() {
1729
- super({
1730
- componentClass: DbxFirebaseDevelopmentSchedulerListViewComponent,
1731
- defaultSelectionMode: 'view'
1732
- });
1733
- }
1734
- }
1735
- DbxFirebaseDevelopmentSchedulerListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentSchedulerListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1736
- DbxFirebaseDevelopmentSchedulerListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseDevelopmentSchedulerListComponent, selector: "dbx-firebase-development-scheduler-list", providers: provideDbxListViewWrapper(DbxFirebaseDevelopmentSchedulerListComponent), usesInheritance: true, ngImport: i0, template: "\n<dbx-list [state$]=\"state$\" [config]=\"config$ | async\" [disabled]=\"disabled\" [selectionMode]=\"selectionMode\">\n <ng-content top select=\"[top]\"></ng-content>\n <ng-content bottom select=\"[bottom]\"></ng-content>\n <ng-content empty select=\"[empty]\"></ng-content>\n <ng-content emptyLoading select=\"[emptyLoading]\"></ng-content>\n</dbx-list>\n", isInline: true, dependencies: [{ kind: "component", type: i1$2.DbxListComponent, selector: "dbx-list", inputs: ["padded", "state$", "config", "disabled", "selectionMode"], outputs: ["contentScrolled"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }] });
1737
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentSchedulerListComponent, decorators: [{
1738
- type: Component,
1739
- args: [{
1740
- selector: 'dbx-firebase-development-scheduler-list',
1741
- template: DEFAULT_LIST_WRAPPER_DIRECTIVE_TEMPLATE,
1742
- providers: provideDbxListViewWrapper(DbxFirebaseDevelopmentSchedulerListComponent)
1743
- }]
1744
- }], ctorParameters: function () { return []; } });
1745
- class DbxFirebaseDevelopmentSchedulerListViewComponent extends AbstractDbxSelectionListViewDirective {
1746
- constructor() {
1747
- super(...arguments);
1748
- this.config = {
1749
- componentClass: DbxFirebaseDevelopmentSchedulerListViewItemComponent,
1750
- mapValuesToItemValues: (x) => of(x.map((y) => (Object.assign(Object.assign({}, y), { icon: y.icon, itemValue: y }))))
1751
- };
1752
- }
1753
- }
1754
- DbxFirebaseDevelopmentSchedulerListViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentSchedulerListViewComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1755
- DbxFirebaseDevelopmentSchedulerListViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseDevelopmentSchedulerListViewComponent, selector: "ng-component", providers: provideDbxListView(DbxFirebaseDevelopmentSchedulerListViewComponent), usesInheritance: true, ngImport: i0, template: "<dbx-selection-list-view [config]=\"config\"></dbx-selection-list-view>", isInline: true, dependencies: [{ kind: "component", type: i1$2.DbxSelectionValueListViewComponent, selector: "dbx-selection-list-view" }] });
1756
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentSchedulerListViewComponent, decorators: [{
1757
- type: Component,
1758
- args: [{
1759
- template: DEFAULT_DBX_SELECTION_VALUE_LIST_DIRECTIVE_TEMPLATE,
1760
- providers: provideDbxListView(DbxFirebaseDevelopmentSchedulerListViewComponent)
1761
- }]
1762
- }] });
1763
- class DbxFirebaseDevelopmentSchedulerListViewItemComponent extends AbstractDbxValueListViewItemComponent {
1764
- constructor(item, dbxFirebaseDevelopmentSchedulerService) {
1765
- super(item);
1766
- this.dbxFirebaseDevelopmentSchedulerService = dbxFirebaseDevelopmentSchedulerService;
1767
- this.handleRun = (value, context) => {
1768
- context.startWorkingWithObservable(from(this.dbxFirebaseDevelopmentSchedulerService.runScheduledFunction(this.name)));
1769
- };
1770
- }
1771
- get name() {
1772
- return this.itemValue.name;
1773
- }
1774
- }
1775
- DbxFirebaseDevelopmentSchedulerListViewItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentSchedulerListViewItemComponent, deps: [{ token: DBX_VALUE_LIST_VIEW_ITEM }, { token: DbxFirebaseDevelopmentSchedulerService }], target: i0.ɵɵFactoryTarget.Component });
1776
- DbxFirebaseDevelopmentSchedulerListViewItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseDevelopmentSchedulerListViewItemComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
1777
- <div dbxAction dbxActionValue fastTrigger [dbxActionHandler]="handleRun">
1778
- <dbx-button dbxActionButton [text]="'Run ' + name"></dbx-button>
1779
- <dbx-success *dbxActionHasSuccess="3000" dbxActionSuccess>Success</dbx-success>
1780
- </div>
1781
- `, isInline: true, dependencies: [{ kind: "component", type: i1$2.DbxSuccessComponent, selector: "dbx-success" }, { kind: "directive", type: i2$2.DbxActionDirective, selector: "dbx-action,[dbxAction],dbx-action-context,[dbxActionContext]", exportAs: ["action", "dbxAction"] }, { kind: "directive", type: i2$2.DbxActionHandlerDirective, selector: "[dbxActionHandler]", inputs: ["dbxActionHandler"] }, { kind: "directive", type: i2$2.DbxActionValueDirective, selector: "[dbxActionValue]", inputs: ["dbxActionValue"] }, { kind: "directive", type: i2$2.DbxActionHasSuccessDirective, selector: "[dbxActionHasSuccess]", inputs: ["dbxActionHasSuccess"] }, { kind: "directive", type: i2$2.DbxActionButtonDirective, selector: "[dbxActionButton]" }, { kind: "component", type: i1$2.DbxButtonComponent, selector: "dbx-button", inputs: ["type", "raised", "stroked", "flat", "iconOnly", "color", "customButtonColor", "customTextColor", "customSpinnerColor"] }] });
1782
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentSchedulerListViewItemComponent, decorators: [{
1783
- type: Component,
1784
- args: [{
1785
- template: `
1786
- <div dbxAction dbxActionValue fastTrigger [dbxActionHandler]="handleRun">
1787
- <dbx-button dbxActionButton [text]="'Run ' + name"></dbx-button>
1788
- <dbx-success *dbxActionHasSuccess="3000" dbxActionSuccess>Success</dbx-success>
1789
- </div>
1790
- `
1791
- }]
1792
- }], ctorParameters: function () {
1793
- return [{ type: undefined, decorators: [{
1794
- type: Inject,
1795
- args: [DBX_VALUE_LIST_VIEW_ITEM]
1796
- }] }, { type: DbxFirebaseDevelopmentSchedulerService }];
1797
- } });
1798
-
1799
- const DEVELOPMENT_FIREBASE_SERVER_SCHEDULER_WIDGET_KEY = 'DEVELOPMENT_FIREBASE_SERVER_SCHEDULER_WIDGET';
1800
- function developmentFirebaseServerSchedulerWidgetEntry() {
1801
- return {
1802
- label: 'Run Scheduled Task',
1803
- widget: {
1804
- type: DEVELOPMENT_FIREBASE_SERVER_SCHEDULER_WIDGET_KEY,
1805
- componentClass: DbxFirebaseDevelopmentSchedulerWidgetComponent
1806
- }
1807
- };
1808
- }
1809
- class DbxFirebaseDevelopmentSchedulerWidgetComponent {
1810
- constructor(dbxFirebaseDevelopmentSchedulerService) {
1811
- this.dbxFirebaseDevelopmentSchedulerService = dbxFirebaseDevelopmentSchedulerService;
1812
- this.entries$ = this.dbxFirebaseDevelopmentSchedulerService.schedulerList$;
1813
- this.state$ = loadingStateFromObs(this.entries$);
1814
- }
1815
- }
1816
- DbxFirebaseDevelopmentSchedulerWidgetComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentSchedulerWidgetComponent, deps: [{ token: DbxFirebaseDevelopmentSchedulerService }], target: i0.ɵɵFactoryTarget.Component });
1817
- DbxFirebaseDevelopmentSchedulerWidgetComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseDevelopmentSchedulerWidgetComponent, selector: "ng-component", ngImport: i0, template: `
1818
- <div>
1819
- <dbx-firebase-development-scheduler-list [state$]="state$"></dbx-firebase-development-scheduler-list>
1820
- </div>
1821
- `, isInline: true, dependencies: [{ kind: "component", type: DbxFirebaseDevelopmentSchedulerListComponent, selector: "dbx-firebase-development-scheduler-list" }] });
1822
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentSchedulerWidgetComponent, decorators: [{
1823
- type: Component,
1824
- args: [{
1825
- template: `
1826
- <div>
1827
- <dbx-firebase-development-scheduler-list [state$]="state$"></dbx-firebase-development-scheduler-list>
1828
- </div>
1829
- `
1830
- }]
1831
- }], ctorParameters: function () { return [{ type: DbxFirebaseDevelopmentSchedulerService }]; } });
1832
-
1833
- class DbxFirebaseParsedEmulatorsConfig {
1834
- }
1835
-
1836
- // TODO: remove "as any" typescript casting - https://github.com/angular/angularfire/issues/3086
1837
- /**
1838
- * Default firebase firestore provider module.
1839
- */
1840
- class DbxFirebaseDefaultFirestoreProviderModule {
1841
- }
1842
- DbxFirebaseDefaultFirestoreProviderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultFirestoreProviderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1843
- DbxFirebaseDefaultFirestoreProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultFirestoreProviderModule, imports: [i1$5.FirestoreModule] });
1844
- DbxFirebaseDefaultFirestoreProviderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultFirestoreProviderModule, imports: [provideFirestore(((injector) => {
1845
- const firebaseApp = injector.get(FirebaseApp);
1846
- const firebaseOptions = injector.get(DBX_FIREBASE_OPTIONS_TOKEN);
1847
- const firestore = getFirestore(firebaseApp);
1848
- const emulators = injector.get(DbxFirebaseParsedEmulatorsConfig, undefined);
1849
- if ((emulators === null || emulators === void 0 ? void 0 : emulators.useEmulators) && (emulators === null || emulators === void 0 ? void 0 : emulators.firestore)) {
1850
- connectFirestoreEmulator(firestore, emulators.firestore.host, emulators.firestore.port, {});
1851
- }
1852
- if (firebaseOptions.enableMultiTabIndexedDbPersistence !== false) {
1853
- enableMultiTabIndexedDbPersistence(firestore);
1854
- }
1855
- else if (firebaseOptions.enableIndexedDbPersistence !== false) {
1856
- enableIndexedDbPersistence(firestore);
1857
- }
1858
- return firestore;
1859
- }))] });
1860
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultFirestoreProviderModule, decorators: [{
1861
- type: NgModule,
1862
- args: [{
1863
- imports: [
1864
- provideFirestore(((injector) => {
1865
- const firebaseApp = injector.get(FirebaseApp);
1866
- const firebaseOptions = injector.get(DBX_FIREBASE_OPTIONS_TOKEN);
1867
- const firestore = getFirestore(firebaseApp);
1868
- const emulators = injector.get(DbxFirebaseParsedEmulatorsConfig, undefined);
1869
- if ((emulators === null || emulators === void 0 ? void 0 : emulators.useEmulators) && (emulators === null || emulators === void 0 ? void 0 : emulators.firestore)) {
1870
- connectFirestoreEmulator(firestore, emulators.firestore.host, emulators.firestore.port, {});
1871
- }
1872
- if (firebaseOptions.enableMultiTabIndexedDbPersistence !== false) {
1873
- enableMultiTabIndexedDbPersistence(firestore);
1874
- }
1875
- else if (firebaseOptions.enableIndexedDbPersistence !== false) {
1876
- enableIndexedDbPersistence(firestore);
1877
- }
1878
- return firestore;
1879
- }))
1880
- ]
1881
- }]
1882
- }] });
1883
- /**
1884
- * Default firebase app check provider module.
1885
- *
1886
- * Also configures the DbxFirebaseAppCheckHttpInterceptor with HTTP_INTERCEPTORS in order for appCheck to be appended to requests to the api.
1887
- */
1888
- class DbxFirebaseDefaultAppCheckProviderModule {
1889
- }
1890
- DbxFirebaseDefaultAppCheckProviderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultAppCheckProviderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1891
- DbxFirebaseDefaultAppCheckProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultAppCheckProviderModule, imports: [i1$1.AppCheckModule] });
1892
- DbxFirebaseDefaultAppCheckProviderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultAppCheckProviderModule, providers: [
1893
- {
1894
- provide: HTTP_INTERCEPTORS,
1895
- useClass: DbxFirebaseAppCheckHttpInterceptor,
1896
- multi: true
1897
- }
1898
- ], imports: [provideAppCheck((injector) => {
1899
- var _a, _b, _c;
1900
- const firebaseApp = injector.get(FirebaseApp);
1901
- const firebaseOptions = injector.get(DBX_FIREBASE_OPTIONS_TOKEN);
1902
- const appCheckOptions = firebaseOptions.appCheck;
1903
- const appCheckKnowinglyDisabled = (appCheckOptions === null || appCheckOptions === void 0 ? void 0 : appCheckOptions.disabled) === true || ((_a = firebaseOptions.emulators) === null || _a === void 0 ? void 0 : _a.useEmulators) === true;
1904
- let appCheck;
1905
- if (appCheckOptions && !appCheckKnowinglyDisabled) {
1906
- // enable the debug tokens if not using emulators and allowDebugTokens is set true
1907
- if (((_b = firebaseOptions.emulators) === null || _b === void 0 ? void 0 : _b.useEmulators) !== true && appCheckOptions.allowDebugTokens) {
1908
- enableAppCheckDebugTokenGeneration(true);
1909
- }
1910
- // Only enabled outside of app-check environments. The emulators will not use appcheck.
1911
- appCheck = initializeAppCheck(firebaseApp, {
1912
- provider: new ReCaptchaV3Provider(appCheckOptions.reCaptchaV3),
1913
- isTokenAutoRefreshEnabled: (_c = appCheckOptions.isTokenAutoRefreshEnabled) !== null && _c !== void 0 ? _c : true
1914
- });
1915
- console.log('Enabled AppCheck.');
1916
- }
1917
- else {
1918
- appCheck = undefined;
1919
- if (!appCheckKnowinglyDisabled) {
1920
- console.error('dbx-firebase: No appcheck configuration for the app, and not specifically disabled in config either.');
1921
- }
1922
- }
1923
- return appCheck;
1924
- })] });
1925
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultAppCheckProviderModule, decorators: [{
1926
- type: NgModule,
1927
- args: [{
1928
- imports: [
1929
- provideAppCheck((injector) => {
1930
- var _a, _b, _c;
1931
- const firebaseApp = injector.get(FirebaseApp);
1932
- const firebaseOptions = injector.get(DBX_FIREBASE_OPTIONS_TOKEN);
1933
- const appCheckOptions = firebaseOptions.appCheck;
1934
- const appCheckKnowinglyDisabled = (appCheckOptions === null || appCheckOptions === void 0 ? void 0 : appCheckOptions.disabled) === true || ((_a = firebaseOptions.emulators) === null || _a === void 0 ? void 0 : _a.useEmulators) === true;
1935
- let appCheck;
1936
- if (appCheckOptions && !appCheckKnowinglyDisabled) {
1937
- // enable the debug tokens if not using emulators and allowDebugTokens is set true
1938
- if (((_b = firebaseOptions.emulators) === null || _b === void 0 ? void 0 : _b.useEmulators) !== true && appCheckOptions.allowDebugTokens) {
1939
- enableAppCheckDebugTokenGeneration(true);
1940
- }
1941
- // Only enabled outside of app-check environments. The emulators will not use appcheck.
1942
- appCheck = initializeAppCheck(firebaseApp, {
1943
- provider: new ReCaptchaV3Provider(appCheckOptions.reCaptchaV3),
1944
- isTokenAutoRefreshEnabled: (_c = appCheckOptions.isTokenAutoRefreshEnabled) !== null && _c !== void 0 ? _c : true
1945
- });
1946
- console.log('Enabled AppCheck.');
1947
- }
1948
- else {
1949
- appCheck = undefined;
1950
- if (!appCheckKnowinglyDisabled) {
1951
- console.error('dbx-firebase: No appcheck configuration for the app, and not specifically disabled in config either.');
1952
- }
1953
- }
1954
- return appCheck;
1955
- })
1956
- ],
1957
- providers: [
1958
- {
1959
- provide: HTTP_INTERCEPTORS,
1960
- useClass: DbxFirebaseAppCheckHttpInterceptor,
1961
- multi: true
1962
- }
1963
- ]
1964
- }]
1965
- }] });
1966
- /**
1967
- * Default firebase auth provider module.
1968
- */
1969
- class DbxFirebaseDefaultAuthProviderModule {
1970
- }
1971
- DbxFirebaseDefaultAuthProviderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultAuthProviderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1972
- DbxFirebaseDefaultAuthProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultAuthProviderModule, imports: [i1.AuthModule] });
1973
- DbxFirebaseDefaultAuthProviderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultAuthProviderModule, imports: [provideAuth((injector) => {
1974
- const firebaseApp = injector.get(FirebaseApp);
1975
- const auth = getAuth(firebaseApp);
1976
- const emulators = injector.get(DbxFirebaseParsedEmulatorsConfig, undefined);
1977
- if ((emulators === null || emulators === void 0 ? void 0 : emulators.useEmulators) && (emulators === null || emulators === void 0 ? void 0 : emulators.auth)) {
1978
- connectAuthEmulator(auth, `http://${emulators.auth.host}:${emulators.auth.port}`);
1979
- }
1980
- return auth;
1981
- })] });
1982
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultAuthProviderModule, decorators: [{
1983
- type: NgModule,
1984
- args: [{
1985
- imports: [
1986
- provideAuth((injector) => {
1987
- const firebaseApp = injector.get(FirebaseApp);
1988
- const auth = getAuth(firebaseApp);
1989
- const emulators = injector.get(DbxFirebaseParsedEmulatorsConfig, undefined);
1990
- if ((emulators === null || emulators === void 0 ? void 0 : emulators.useEmulators) && (emulators === null || emulators === void 0 ? void 0 : emulators.auth)) {
1991
- connectAuthEmulator(auth, `http://${emulators.auth.host}:${emulators.auth.port}`);
1992
- }
1993
- return auth;
1994
- })
1995
- ]
1996
- }]
1997
- }] });
1998
- /**
1999
- * Default firebase storage provider module.
2000
- */
2001
- class DbxFirebaseDefaultStorageProviderModule {
2002
- }
2003
- DbxFirebaseDefaultStorageProviderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultStorageProviderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2004
- DbxFirebaseDefaultStorageProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultStorageProviderModule, imports: [i4.StorageModule] });
2005
- DbxFirebaseDefaultStorageProviderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultStorageProviderModule, imports: [provideStorage((injector) => {
2006
- const firebaseApp = injector.get(FirebaseApp);
2007
- const storage = getStorage(firebaseApp);
2008
- const emulators = injector.get(DbxFirebaseParsedEmulatorsConfig, undefined);
2009
- if ((emulators === null || emulators === void 0 ? void 0 : emulators.useEmulators) && (emulators === null || emulators === void 0 ? void 0 : emulators.storage)) {
2010
- connectStorageEmulator(storage, emulators.storage.host, emulators.storage.port, {});
2011
- }
2012
- return storage;
2013
- })] });
2014
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultStorageProviderModule, decorators: [{
2015
- type: NgModule,
2016
- args: [{
2017
- imports: [
2018
- provideStorage((injector) => {
2019
- const firebaseApp = injector.get(FirebaseApp);
2020
- const storage = getStorage(firebaseApp);
2021
- const emulators = injector.get(DbxFirebaseParsedEmulatorsConfig, undefined);
2022
- if ((emulators === null || emulators === void 0 ? void 0 : emulators.useEmulators) && (emulators === null || emulators === void 0 ? void 0 : emulators.storage)) {
2023
- connectStorageEmulator(storage, emulators.storage.host, emulators.storage.port, {});
2024
- }
2025
- return storage;
2026
- })
2027
- ]
2028
- }]
2029
- }] });
2030
- /**
2031
- * Default firebase functions provider module.
2032
- */
2033
- class DbxFirebaseDefaultFunctionsProviderModule {
2034
- }
2035
- DbxFirebaseDefaultFunctionsProviderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultFunctionsProviderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2036
- DbxFirebaseDefaultFunctionsProviderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultFunctionsProviderModule, imports: [i5.FunctionsModule] });
2037
- DbxFirebaseDefaultFunctionsProviderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultFunctionsProviderModule, imports: [provideFunctions((injector) => {
2038
- const firebaseApp = injector.get(FirebaseApp);
2039
- const firebaseOptions = injector.get(DBX_FIREBASE_OPTIONS_TOKEN);
2040
- const { functionsRegionOrCustomDomain } = firebaseOptions;
2041
- const functions = getFunctions(firebaseApp, functionsRegionOrCustomDomain);
2042
- const emulators = injector.get(DbxFirebaseParsedEmulatorsConfig, undefined);
2043
- if ((emulators === null || emulators === void 0 ? void 0 : emulators.useEmulators) && (emulators === null || emulators === void 0 ? void 0 : emulators.functions)) {
2044
- connectFunctionsEmulator(functions, emulators.functions.host, emulators.functions.port);
2045
- }
2046
- return functions;
2047
- })] });
2048
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultFunctionsProviderModule, decorators: [{
2049
- type: NgModule,
2050
- args: [{
2051
- imports: [
2052
- provideFunctions((injector) => {
2053
- const firebaseApp = injector.get(FirebaseApp);
2054
- const firebaseOptions = injector.get(DBX_FIREBASE_OPTIONS_TOKEN);
2055
- const { functionsRegionOrCustomDomain } = firebaseOptions;
2056
- const functions = getFunctions(firebaseApp, functionsRegionOrCustomDomain);
2057
- const emulators = injector.get(DbxFirebaseParsedEmulatorsConfig, undefined);
2058
- if ((emulators === null || emulators === void 0 ? void 0 : emulators.useEmulators) && (emulators === null || emulators === void 0 ? void 0 : emulators.functions)) {
2059
- connectFunctionsEmulator(functions, emulators.functions.host, emulators.functions.port);
2060
- }
2061
- return functions;
2062
- })
2063
- ]
2064
- }]
2065
- }] });
2066
- /**
2067
- * Default provider module.
2068
- */
2069
- class DbxFirebaseDefaultFirebaseProvidersModule {
2070
- static forRoot(firebaseOptions) {
2071
- return {
2072
- ngModule: DbxFirebaseDefaultFirebaseProvidersModule,
2073
- providers: [
2074
- {
2075
- provide: DBX_FIREBASE_OPTIONS_TOKEN,
2076
- useValue: firebaseOptions
2077
- }
2078
- ]
2079
- };
2080
- }
2081
- }
2082
- DbxFirebaseDefaultFirebaseProvidersModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultFirebaseProvidersModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2083
- DbxFirebaseDefaultFirebaseProvidersModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultFirebaseProvidersModule, imports: [i6.FirebaseAppModule, DbxFirebaseDefaultAppCheckProviderModule, DbxFirebaseDefaultFirestoreProviderModule, DbxFirebaseDefaultAuthProviderModule, DbxFirebaseDefaultStorageProviderModule, DbxFirebaseDefaultFunctionsProviderModule] });
2084
- DbxFirebaseDefaultFirebaseProvidersModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultFirebaseProvidersModule, imports: [provideFirebaseApp((injector) => {
2085
- const firebaseOptions = injector.get(DBX_FIREBASE_OPTIONS_TOKEN);
2086
- return initializeApp(firebaseOptions);
2087
- }),
2088
- DbxFirebaseDefaultAppCheckProviderModule,
2089
- DbxFirebaseDefaultFirestoreProviderModule,
2090
- DbxFirebaseDefaultAuthProviderModule,
2091
- DbxFirebaseDefaultStorageProviderModule,
2092
- DbxFirebaseDefaultFunctionsProviderModule] });
2093
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDefaultFirebaseProvidersModule, decorators: [{
2094
- type: NgModule,
2095
- args: [{
2096
- imports: [
2097
- provideFirebaseApp((injector) => {
2098
- const firebaseOptions = injector.get(DBX_FIREBASE_OPTIONS_TOKEN);
2099
- return initializeApp(firebaseOptions);
2100
- }),
2101
- DbxFirebaseDefaultAppCheckProviderModule,
2102
- DbxFirebaseDefaultFirestoreProviderModule,
2103
- DbxFirebaseDefaultAuthProviderModule,
2104
- DbxFirebaseDefaultStorageProviderModule,
2105
- DbxFirebaseDefaultFunctionsProviderModule
2106
- ]
2107
- }]
2108
- }] });
2109
-
2110
- /**
2111
- * Used to configure the DbxFirebaseEmulatorsConfig provider.
2112
- */
2113
- class DbxFirebaseEmulatorModule {
2114
- static forRoot(config) {
2115
- var _a;
2116
- const defaultHost = (_a = config.host) !== null && _a !== void 0 ? _a : 'localhost';
2117
- function emulatorConfig(emulator) {
2118
- var _a;
2119
- return emulator ? { host: (_a = emulator.host) !== null && _a !== void 0 ? _a : defaultHost, port: emulator.port } : undefined;
2120
- }
2121
- const finalConfig = {
2122
- useEmulators: config.useEmulators !== false,
2123
- ui: emulatorConfig(config.ui),
2124
- auth: emulatorConfig(config.auth),
2125
- firestore: emulatorConfig(config.firestore),
2126
- storage: emulatorConfig(config.storage),
2127
- functions: emulatorConfig(config.functions),
2128
- database: emulatorConfig(config.database)
2129
- };
2130
- return {
2131
- ngModule: DbxFirebaseEmulatorModule,
2132
- providers: [
2133
- {
2134
- provide: DbxFirebaseParsedEmulatorsConfig,
2135
- useValue: finalConfig
2136
- }
2137
- ]
2138
- };
2139
- }
2140
- }
2141
- DbxFirebaseEmulatorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseEmulatorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2142
- DbxFirebaseEmulatorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseEmulatorModule });
2143
- DbxFirebaseEmulatorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseEmulatorModule });
2144
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseEmulatorModule, decorators: [{
2145
- type: NgModule
2146
- }] });
2147
-
2148
- class DbxFirebaseEmulatorService {
2149
- constructor(emulatorsConfig) {
2150
- this.emulatorsConfig = emulatorsConfig;
2151
- }
2152
- get useEmulators() {
2153
- return this.emulatorsConfig.useEmulators || false;
2154
- }
2155
- get emulatorUIAnchor() {
2156
- const ui = this.emulatorsConfig.ui;
2157
- let host = this.emulatorsConfig.host;
2158
- // Issue where sometimes 0.0.0.0 is not configured to handle transferring traffic properly, compared to localhost. This sets 0.0.0.0 to localhost unless disallowed.
2159
- if (host === '0.0.0.0' && this.emulatorsConfig.allow0000ToLocalhost !== false) {
2160
- host = 'localhost';
2161
- }
2162
- return ui
2163
- ? {
2164
- url: `http://${host !== null && host !== void 0 ? host : 'localhost'}:${ui.port}`,
2165
- target: '_blank'
2166
- }
2167
- : undefined;
2168
- }
2169
- }
2170
- DbxFirebaseEmulatorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseEmulatorService, deps: [{ token: DbxFirebaseParsedEmulatorsConfig }], target: i0.ɵɵFactoryTarget.Injectable });
2171
- DbxFirebaseEmulatorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseEmulatorService, providedIn: 'root' });
2172
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseEmulatorService, decorators: [{
2173
- type: Injectable,
2174
- args: [{
2175
- providedIn: 'root'
2176
- }]
2177
- }], ctorParameters: function () { return [{ type: DbxFirebaseParsedEmulatorsConfig }]; } });
2178
-
2179
- const DISPLAY_FOR_DEVELOPMENT_POPUP_STRING_VALUE = (values) => {
2180
- const displayValues = values.map((x) => { var _a; return (Object.assign(Object.assign({}, x), { label: ((_a = x.meta) === null || _a === void 0 ? void 0 : _a.label) || x.value })); });
2181
- const obs = of(displayValues);
2182
- return obs;
2183
- };
2184
- class DbxFirebaseDevelopmentPopupContentFormComponent extends AbstractConfigAsyncFormlyFormDirective {
2185
- constructor() {
2186
- super(...arguments);
2187
- this.fields$ = this.config$.pipe(map((config) => {
2188
- return [
2189
- pickableItemChipField({
2190
- key: 'specifier',
2191
- filterLabel: 'Tools',
2192
- description: 'Pick a tool to get started.',
2193
- filterValues: filterPickableItemFieldValuesByLabel,
2194
- loadValues: () => of(config.entries.map((y) => ({ value: y.widget.type, meta: y }))),
2195
- displayForValue: DISPLAY_FOR_DEVELOPMENT_POPUP_STRING_VALUE,
2196
- asArrayValue: false
2197
- })
2198
- ];
2199
- }));
2200
- }
2201
- }
2202
- DbxFirebaseDevelopmentPopupContentFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentPopupContentFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2203
- DbxFirebaseDevelopmentPopupContentFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseDevelopmentPopupContentFormComponent, selector: "dbx-firebase-development-popup-content-form", providers: [provideFormlyContext()], usesInheritance: true, ngImport: i0, template: `
2204
- <dbx-formly></dbx-formly>
2205
- `, isInline: true, dependencies: [{ kind: "component", type: i1$3.DbxFormlyFormComponent, selector: "dbx-formly", exportAs: ["formly"] }] });
2206
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentPopupContentFormComponent, decorators: [{
2207
- type: Component,
2208
- args: [{
2209
- template: `
2210
- <dbx-formly></dbx-formly>
2211
- `,
2212
- selector: 'dbx-firebase-development-popup-content-form',
2213
- providers: [provideFormlyContext()]
2214
- }]
2215
- }] });
2216
-
2217
- class DbxFirebaseDevelopmentPopupContentComponent {
2218
- constructor(twoColumnsContextStore, dbxAuthService, dbxFirebaseDevelopmentWidgetService, dbxFirebaseDevelopmentSchedulerService, dbxFirebaseEmulatorService) {
2219
- var _a;
2220
- this.twoColumnsContextStore = twoColumnsContextStore;
2221
- this.dbxAuthService = dbxAuthService;
2222
- this.dbxFirebaseDevelopmentWidgetService = dbxFirebaseDevelopmentWidgetService;
2223
- this.dbxFirebaseDevelopmentSchedulerService = dbxFirebaseDevelopmentSchedulerService;
2224
- this.dbxFirebaseEmulatorService = dbxFirebaseEmulatorService;
2225
- this._backSub = new SubscriptionObject();
2226
- this.showEmulatorButton = this.dbxFirebaseEmulatorService.useEmulators === true;
2227
- this.emulatorUIAnchor = (_a = this.dbxFirebaseEmulatorService.emulatorUIAnchor) !== null && _a !== void 0 ? _a : {};
2228
- this.entries = this.dbxFirebaseDevelopmentWidgetService.getEntries();
2229
- this._activeEntrySelector = new BehaviorSubject(DEVELOPMENT_FIREBASE_SERVER_SCHEDULER_WIDGET_KEY);
2230
- this.isLoggedIn$ = this.dbxAuthService.isLoggedIn$;
2231
- this.entries$ = this.isLoggedIn$.pipe(distinctUntilChanged(), map((isLoggedIn) => this.entries), shareReplay(1));
2232
- this.formConfig$ = this.entries$.pipe(map((entries) => ({ entries })));
2233
- this.activeEntrySelector$ = this._activeEntrySelector.pipe(distinctUntilChanged());
2234
- this.currentActiveEntry$ = combineLatest([this.entries$, this.activeEntrySelector$]).pipe(map(([entries, selector]) => (selector ? entries.find((e) => e.widget.type === selector) : undefined)), shareReplay(1));
2235
- this.showRight$ = this.currentActiveEntry$.pipe(map((x) => x != null));
2236
- this.activeEntry$ = this.currentActiveEntry$.pipe(filterMaybe(), distinctUntilChanged(), shareReplay(1));
2237
- this.rightTitle$ = this.activeEntry$.pipe(map((x) => x.label));
2238
- this.widgetConfig$ = this.activeEntry$.pipe(map((x) => ({ data: undefined, type: x.widget.type })), shareReplay(1));
2239
- this.schedulerRunning$ = this.dbxFirebaseDevelopmentSchedulerService.running$;
2240
- this.schedulerInterval$ = this.dbxFirebaseDevelopmentSchedulerService.timerInterval$.pipe(map((x) => msToSeconds(x)), shareReplay(1));
2241
- this.schedulerError$ = this.dbxFirebaseDevelopmentSchedulerService.error$.pipe(map((x) => (x ? 'Error Occured' : 'Ok')), shareReplay(1));
2242
- this.formData$ = this._activeEntrySelector.pipe(distinctUntilChanged(), map((specifier) => ({ specifier })));
2243
- this.handleFormUpdate = (value, context) => {
2244
- this._activeEntrySelector.next(value.specifier);
2245
- context.success();
2246
- };
2247
- this.isFormModified = (value) => {
2248
- return this._activeEntrySelector.pipe(map((currentSelector) => value.specifier !== currentSelector), first());
2249
- };
2250
- }
2251
- ngOnInit() {
2252
- this.twoColumnsContextStore.setShowRight(this.showRight$);
2253
- this._backSub.subscription = this.twoColumnsContextStore.back$.subscribe(() => {
2254
- this.clearSelection();
2255
- });
2256
- }
2257
- ngOnDestroy() {
2258
- this._activeEntrySelector.complete();
2259
- }
2260
- clearSelection() {
2261
- this._activeEntrySelector.next(undefined);
2262
- }
2263
- }
2264
- DbxFirebaseDevelopmentPopupContentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentPopupContentComponent, deps: [{ token: i1$2.TwoColumnsContextStore }, { token: i2$2.DbxAuthService }, { token: DbxFirebaseDevelopmentWidgetService }, { token: DbxFirebaseDevelopmentSchedulerService }, { token: DbxFirebaseEmulatorService }], target: i0.ɵɵFactoryTarget.Component });
2265
- DbxFirebaseDevelopmentPopupContentComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseDevelopmentPopupContentComponent, selector: "dbx-firebase-development-popup-content", providers: [TwoColumnsContextStore], ngImport: i0, template: "<dbx-two-column class=\"dbx-firebase-development-popup-content\" [dbxTwoColumnFullLeft]=\"true\">\n <dbx-two-block left>\n <div>\n <h4>Info</h4>\n <p>Scheduler (Running): {{ schedulerRunning$ | async }} : {{ schedulerInterval$ | async }}s : {{ schedulerError$ | async }}</p>\n <div>\n <dbx-anchor [anchor]=\"emulatorUIAnchor\" *ngIf=\"showEmulatorButton\">\n <button mat-flat-button color=\"accent\">Emulator Enabled</button>\n </dbx-anchor>\n </div>\n </div>\n <div>\n <h4>Tools</h4>\n <div dbxAction dbxActionEnforceModified dbxActionAutoTrigger instantTrigger [dbxActionHandler]=\"handleFormUpdate\">\n <dbx-firebase-development-popup-content-form dbxActionForm [dbxFormSource]=\"formData$\" dbxFormSourceMode=\"always\" [dbxActionFormModified]=\"isFormModified\" [config]=\"formConfig$ | async\"></dbx-firebase-development-popup-content-form>\n </div>\n </div>\n </dbx-two-block>\n <dbx-two-column-right right [header]=\"(rightTitle$ | async) || ''\">\n <dbx-widget-view [config]=\"widgetConfig$ | async\"></dbx-widget-view>\n </dbx-two-column-right>\n</dbx-two-column>\n", styles: [".dbx-firebase-development-popup-content{height:400px;overflow:hidden}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1$2.DbxWidgetViewComponent, selector: "dbx-widget-view", inputs: ["config"] }, { kind: "component", type: i1$2.DbxTwoBlocksComponent, selector: "dbx-two-block", inputs: ["fixedTop"] }, { kind: "component", type: i1$2.DbxTwoColumnComponent, selector: "dbx-two-column", inputs: ["reverseSizing", "inSectionPage"], exportAs: ["columns"] }, { kind: "component", type: i1$2.DbxTwoColumnRightComponent, selector: "dbx-two-column-right", inputs: ["header", "block", "showBack", "minRightWidth"] }, { kind: "directive", type: i1$2.DbxTwoColumnFullLeftDirective, selector: "[dbxTwoColumnFullLeft]", inputs: ["dbxTwoColumnFullLeft"] }, { kind: "component", type: i3$1.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"] }, { kind: "component", type: i1$2.DbxAnchorComponent, selector: "dbx-anchor, [dbx-anchor]", inputs: ["block"] }, { kind: "directive", type: i1$3.DbxFormSourceDirective, selector: "[dbxFormSource]", inputs: ["dbxFormSourceMode", "dbxFormSource"] }, { kind: "directive", type: i1$3.DbxActionFormDirective, selector: "[dbxActionForm]", inputs: ["dbxActionFormValidator", "dbxActionFormModified", "dbxActionFormMapValue", "formDisabledOnWorking"] }, { kind: "directive", type: i2$2.DbxActionDirective, selector: "dbx-action,[dbxAction],dbx-action-context,[dbxActionContext]", exportAs: ["action", "dbxAction"] }, { kind: "directive", type: i2$2.DbxActionHandlerDirective, selector: "[dbxActionHandler]", inputs: ["dbxActionHandler"] }, { kind: "directive", type: i2$2.DbxActionEnforceModifiedDirective, selector: "[dbxActionEnforceModified]", inputs: ["dbxActionEnforceModified"] }, { kind: "directive", type: i2$2.DbxActionAutoTriggerDirective, selector: "dbxActionAutoTrigger, [dbxActionAutoTrigger]", inputs: ["dbxActionAutoTrigger", "triggerDebounce", "triggerThrottle", "triggerErrorThrottle", "fastTrigger", "instantTrigger", "triggerLimit"] }, { kind: "component", type: DbxFirebaseDevelopmentPopupContentFormComponent, selector: "dbx-firebase-development-popup-content-form" }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }] });
2266
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentPopupContentComponent, decorators: [{
2267
- type: Component,
2268
- args: [{ selector: 'dbx-firebase-development-popup-content', providers: [TwoColumnsContextStore], template: "<dbx-two-column class=\"dbx-firebase-development-popup-content\" [dbxTwoColumnFullLeft]=\"true\">\n <dbx-two-block left>\n <div>\n <h4>Info</h4>\n <p>Scheduler (Running): {{ schedulerRunning$ | async }} : {{ schedulerInterval$ | async }}s : {{ schedulerError$ | async }}</p>\n <div>\n <dbx-anchor [anchor]=\"emulatorUIAnchor\" *ngIf=\"showEmulatorButton\">\n <button mat-flat-button color=\"accent\">Emulator Enabled</button>\n </dbx-anchor>\n </div>\n </div>\n <div>\n <h4>Tools</h4>\n <div dbxAction dbxActionEnforceModified dbxActionAutoTrigger instantTrigger [dbxActionHandler]=\"handleFormUpdate\">\n <dbx-firebase-development-popup-content-form dbxActionForm [dbxFormSource]=\"formData$\" dbxFormSourceMode=\"always\" [dbxActionFormModified]=\"isFormModified\" [config]=\"formConfig$ | async\"></dbx-firebase-development-popup-content-form>\n </div>\n </div>\n </dbx-two-block>\n <dbx-two-column-right right [header]=\"(rightTitle$ | async) || ''\">\n <dbx-widget-view [config]=\"widgetConfig$ | async\"></dbx-widget-view>\n </dbx-two-column-right>\n</dbx-two-column>\n", styles: [".dbx-firebase-development-popup-content{height:400px;overflow:hidden}\n"] }]
2269
- }], ctorParameters: function () { return [{ type: i1$2.TwoColumnsContextStore }, { type: i2$2.DbxAuthService }, { type: DbxFirebaseDevelopmentWidgetService }, { type: DbxFirebaseDevelopmentSchedulerService }, { type: DbxFirebaseEmulatorService }]; } });
2270
-
2271
- const DEFAULT_FIREBASE_DEVELOPMENT_POPUP_KEY = 'devpopup';
2272
- class DbxFirebaseDevelopmentPopupComponent extends AbstractPopupDirective {
2273
- constructor(popup, popupService) {
2274
- super(popup);
2275
- this.popupService = popupService;
2276
- this.header = 'Development Tools';
2277
- this.reopen = () => {
2278
- DbxFirebaseDevelopmentPopupComponent.openPopup(this.popupService, this.popup.key);
2279
- };
2280
- }
2281
- static openPopup(popupService, popupKey) {
2282
- return popupService.open({
2283
- key: popupKey !== null && popupKey !== void 0 ? popupKey : DEFAULT_FIREBASE_DEVELOPMENT_POPUP_KEY,
2284
- componentClass: DbxFirebaseDevelopmentPopupComponent,
2285
- closeOnTransition: false,
2286
- isDraggable: true,
2287
- position: 'center'
2288
- });
2289
- }
2290
- }
2291
- DbxFirebaseDevelopmentPopupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentPopupComponent, deps: [{ token: i1$2.DbxPopupComponent }, { token: i1$2.DbxPopupService }], target: i0.ɵɵFactoryTarget.Component });
2292
- DbxFirebaseDevelopmentPopupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseDevelopmentPopupComponent, selector: "ng-component", viewQueries: [{ propertyName: "content", first: true, predicate: DbxFirebaseDevelopmentPopupContentComponent, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: `
2293
- <dbx-popup-content>
2294
- <dbx-popup-controls [header]="header" controls></dbx-popup-controls>
2295
- <dbx-firebase-development-popup-content (shouldClose)="closePopup()"></dbx-firebase-development-popup-content>
2296
- </dbx-popup-content>
2297
- `, isInline: true, dependencies: [{ kind: "component", type: i1$2.DbxPopupContentComponent, selector: "dbx-popup-content" }, { kind: "component", type: i1$2.DbxPopupControlsComponent, selector: "dbx-popup-controls", inputs: ["header"] }, { kind: "component", type: DbxFirebaseDevelopmentPopupContentComponent, selector: "dbx-firebase-development-popup-content" }] });
2298
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentPopupComponent, decorators: [{
2299
- type: Component,
2300
- args: [{
2301
- template: `
2302
- <dbx-popup-content>
2303
- <dbx-popup-controls [header]="header" controls></dbx-popup-controls>
2304
- <dbx-firebase-development-popup-content (shouldClose)="closePopup()"></dbx-firebase-development-popup-content>
2305
- </dbx-popup-content>
2306
- `
2307
- }]
2308
- }], ctorParameters: function () { return [{ type: i1$2.DbxPopupComponent }, { type: i1$2.DbxPopupService }]; }, propDecorators: { content: [{
2309
- type: ViewChild,
2310
- args: [DbxFirebaseDevelopmentPopupContentComponent, { static: true }]
2311
- }] } });
2312
-
2313
- /**
2314
- * Enabled state
2315
- */
2316
- const DEFAULT_FIREBASE_DEVELOPMENT_ENABLED_TOKEN = new InjectionToken('DefaultDbxFirebaseDevelopmentEnabled');
2317
- /**
2318
- * Service used for registering widgets used for development.
2319
- *
2320
- * Default providers can be configured by the DEFAULT_FIREBASE_AUTH_LOGIN_PROVIDERS_TOKEN injectable value.
2321
- */
2322
- class DbxFirebaseDevelopmentService {
2323
- constructor(enabled) {
2324
- this.enabled = enabled;
2325
- }
2326
- }
2327
- DbxFirebaseDevelopmentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentService, deps: [{ token: DEFAULT_FIREBASE_DEVELOPMENT_ENABLED_TOKEN, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
2328
- DbxFirebaseDevelopmentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentService, providedIn: 'root' });
2329
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentService, decorators: [{
2330
- type: Injectable,
2331
- args: [{
2332
- providedIn: 'root'
2333
- }]
2334
- }], ctorParameters: function () {
2335
- return [{ type: undefined, decorators: [{
2336
- type: Optional
2337
- }, {
2338
- type: Inject,
2339
- args: [DEFAULT_FIREBASE_DEVELOPMENT_ENABLED_TOKEN]
2340
- }] }];
2341
- } });
2342
-
2343
- /**
2344
- * Directive for controlling and displaying
2345
- */
2346
- class DbxFirebaseDevelopmentDirective {
2347
- constructor(popupService, matSnackBar, dbxFirebaseDevelopmentService) {
2348
- this.popupService = popupService;
2349
- this.matSnackBar = matSnackBar;
2350
- this.dbxFirebaseDevelopmentService = dbxFirebaseDevelopmentService;
2351
- }
2352
- get enabled() {
2353
- return this.dbxFirebaseDevelopmentService.enabled;
2354
- }
2355
- handleKeyboardEvent(event) {
2356
- if (this.enabled && event.shiftKey && event.altKey && event.code === 'KeyD') {
2357
- this.togglePopup();
2358
- event.preventDefault();
2359
- }
2360
- }
2361
- togglePopup() {
2362
- if (this.ref) {
2363
- this.closePopup();
2364
- }
2365
- else {
2366
- this.openPopup();
2367
- }
2368
- }
2369
- openPopup() {
2370
- if (!this.ref) {
2371
- const ref = DbxFirebaseDevelopmentPopupComponent.openPopup(this.popupService);
2372
- ref.afterClosed$.subscribe(() => {
2373
- if (this.ref === ref) {
2374
- this.ref = undefined;
2375
- }
2376
- });
2377
- this.ref = ref;
2378
- }
2379
- }
2380
- closePopup() {
2381
- if (this.ref != null) {
2382
- this.ref.close();
2383
- }
2384
- }
2385
- ngAfterViewInit() {
2386
- if (this.enabled) {
2387
- this.matSnackBar
2388
- .open('Dev Tools: alt/option + shift + D', 'Open', {
2389
- horizontalPosition: 'center',
2390
- verticalPosition: 'bottom',
2391
- duration: 8 * 1000
2392
- })
2393
- .onAction()
2394
- .subscribe(() => {
2395
- this.openPopup();
2396
- });
2397
- }
2398
- }
2399
- ngOnDestroy() {
2400
- this.closePopup();
2401
- }
2402
- }
2403
- DbxFirebaseDevelopmentDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentDirective, deps: [{ token: i1$2.DbxPopupService }, { token: i2$3.MatSnackBar }, { token: DbxFirebaseDevelopmentService }], target: i0.ɵɵFactoryTarget.Directive });
2404
- DbxFirebaseDevelopmentDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseDevelopmentDirective, selector: "[dbxFirebaseDevelopment]", host: { listeners: { "window:keydown": "handleKeyboardEvent($event)" } }, ngImport: i0 });
2405
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentDirective, decorators: [{
2406
- type: Directive,
2407
- args: [{
2408
- selector: '[dbxFirebaseDevelopment]'
2409
- }]
2410
- }], ctorParameters: function () { return [{ type: i1$2.DbxPopupService }, { type: i2$3.MatSnackBar }, { type: DbxFirebaseDevelopmentService }]; }, propDecorators: { handleKeyboardEvent: [{
2411
- type: HostListener,
2412
- args: ['window:keydown', ['$event']]
2413
- }] } });
2414
-
2415
- class DbxFirebaseDevelopmentModuleRootConfig {
2416
- }
2417
- /**
2418
- * Contains components related to logging in.
2419
- */
2420
- class DbxFirebaseDevelopmentModule {
2421
- constructor(dbxFirebaseDevelopmentSchedulerService) {
2422
- this.dbxFirebaseDevelopmentSchedulerService = dbxFirebaseDevelopmentSchedulerService;
2423
- dbxFirebaseDevelopmentSchedulerService.init();
2424
- }
2425
- static forRoot(config) {
2426
- let entries = config.entries;
2427
- if (config.addDevelopmentSchedulerWidget !== false) {
2428
- entries = [developmentFirebaseServerSchedulerWidgetEntry(), ...config.entries];
2429
- }
2430
- return {
2431
- ngModule: DbxFirebaseDevelopmentModule,
2432
- providers: [
2433
- {
2434
- provide: DEFAULT_FIREBASE_DEVELOPMENT_WIDGET_PROVIDERS_TOKEN,
2435
- useValue: entries
2436
- },
2437
- {
2438
- provide: DEFAULT_FIREBASE_DEVELOPMENT_ENABLED_TOKEN,
2439
- useValue: config.enabled
2440
- },
2441
- {
2442
- provide: DbxFirebaseDevelopmentModuleRootConfig,
2443
- useValue: config
2444
- }
2445
- ]
2446
- };
2447
- }
2448
- }
2449
- DbxFirebaseDevelopmentModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentModule, deps: [{ token: DbxFirebaseDevelopmentSchedulerService }], target: i0.ɵɵFactoryTarget.NgModule });
2450
- DbxFirebaseDevelopmentModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentModule, declarations: [
2451
- //
2452
- DbxFirebaseDevelopmentPopupContentFormComponent,
2453
- DbxFirebaseDevelopmentDirective,
2454
- DbxFirebaseDevelopmentPopupComponent,
2455
- DbxFirebaseDevelopmentPopupContentComponent,
2456
- DbxFirebaseDevelopmentSchedulerWidgetComponent,
2457
- DbxFirebaseDevelopmentSchedulerListComponent,
2458
- DbxFirebaseDevelopmentSchedulerListViewComponent,
2459
- DbxFirebaseDevelopmentSchedulerListViewItemComponent
2460
- ], imports: [CommonModule, MatIconModule, DbxWidgetModule, DbxTextModule, DbxBlockLayoutModule, DbxTwoColumnLayoutModule, MatButtonModule, DbxRouterAnchorModule, DbxPopupInteractionModule, DbxFormIoModule, DbxFormModule, DbxFormlyModule, DbxFormActionModule, DbxFormFormlyTextFieldModule, DbxReadableErrorModule, DbxActionModule, DbxButtonModule, DbxInjectionComponentModule, DbxListLayoutModule], exports: [
2461
- //
2462
- DbxFirebaseDevelopmentDirective,
2463
- DbxFirebaseDevelopmentPopupComponent,
2464
- DbxFirebaseDevelopmentPopupContentComponent,
2465
- DbxFirebaseDevelopmentSchedulerWidgetComponent,
2466
- DbxFirebaseDevelopmentSchedulerListComponent,
2467
- DbxFirebaseDevelopmentSchedulerListViewComponent,
2468
- DbxFirebaseDevelopmentSchedulerListViewItemComponent
2469
- ] });
2470
- DbxFirebaseDevelopmentModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentModule, imports: [CommonModule, MatIconModule, DbxWidgetModule, DbxTextModule, DbxBlockLayoutModule, DbxTwoColumnLayoutModule, MatButtonModule, DbxRouterAnchorModule, DbxPopupInteractionModule, DbxFormIoModule, DbxFormModule, DbxFormlyModule, DbxFormActionModule, DbxFormFormlyTextFieldModule, DbxReadableErrorModule, DbxActionModule, DbxButtonModule, DbxInjectionComponentModule, DbxListLayoutModule] });
2471
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDevelopmentModule, decorators: [{
2472
- type: NgModule,
2473
- args: [{
2474
- imports: [CommonModule, MatIconModule, DbxWidgetModule, DbxTextModule, DbxBlockLayoutModule, DbxTwoColumnLayoutModule, MatButtonModule, DbxRouterAnchorModule, DbxPopupInteractionModule, DbxFormIoModule, DbxFormModule, DbxFormlyModule, DbxFormActionModule, DbxFormFormlyTextFieldModule, DbxReadableErrorModule, DbxActionModule, DbxButtonModule, DbxInjectionComponentModule, DbxListLayoutModule],
2475
- declarations: [
2476
- //
2477
- DbxFirebaseDevelopmentPopupContentFormComponent,
2478
- DbxFirebaseDevelopmentDirective,
2479
- DbxFirebaseDevelopmentPopupComponent,
2480
- DbxFirebaseDevelopmentPopupContentComponent,
2481
- DbxFirebaseDevelopmentSchedulerWidgetComponent,
2482
- DbxFirebaseDevelopmentSchedulerListComponent,
2483
- DbxFirebaseDevelopmentSchedulerListViewComponent,
2484
- DbxFirebaseDevelopmentSchedulerListViewItemComponent
2485
- ],
2486
- exports: [
2487
- //
2488
- DbxFirebaseDevelopmentDirective,
2489
- DbxFirebaseDevelopmentPopupComponent,
2490
- DbxFirebaseDevelopmentPopupContentComponent,
2491
- DbxFirebaseDevelopmentSchedulerWidgetComponent,
2492
- DbxFirebaseDevelopmentSchedulerListComponent,
2493
- DbxFirebaseDevelopmentSchedulerListViewComponent,
2494
- DbxFirebaseDevelopmentSchedulerListViewItemComponent
2495
- ]
2496
- }]
2497
- }], ctorParameters: function () { return [{ type: DbxFirebaseDevelopmentSchedulerService }]; } });
2498
-
2499
- /**
2500
- * Token to access the FirestoreContext value.
2501
- */
2502
- const DBX_FIRESTORE_CONTEXT_TOKEN = new InjectionToken('DBX_FIRESTORE_CONTEXT_TOKEN');
2503
-
2504
- function provideSystemStateFirestoreCollections(appCollection) {
2505
- if (!appCollection.systemStateCollection) {
2506
- throw new Error(`SystemStateFirestoreCollections could not be provided using the app's app collection. Set provideSystemStateFirestoreCollections to false in DbxFirebaseFirestoreCollectionModuleConfig to prevent auto-initialization, or update your aoo's collection class to implement SystemStateFirestoreCollections.`);
2507
- }
2508
- return appCollection;
2509
- }
2510
- /**
2511
- * Used to initialize the FirestoreCollection for a DbxFirebase app.
2512
- */
2513
- class DbxFirebaseFirestoreCollectionModule {
2514
- static forRoot(config) {
2515
- const providers = [
2516
- {
2517
- provide: DBX_FIRESTORE_CONTEXT_TOKEN,
2518
- useFactory: clientFirebaseFirestoreContextFactory,
2519
- deps: [Firestore]
2520
- },
2521
- {
2522
- provide: config.appCollectionClass,
2523
- useFactory: config.collectionFactory,
2524
- deps: [DBX_FIRESTORE_CONTEXT_TOKEN]
2525
- }
2526
- ];
2527
- if (config.provideSystemStateFirestoreCollections !== false) {
2528
- providers.push({
2529
- /**
2530
- * Provide SystemStateFirestoreCollections via the app collections class and using SystemStateFirestoreCollections.
2531
- */
2532
- provide: SystemStateFirestoreCollections,
2533
- useFactory: provideSystemStateFirestoreCollections,
2534
- deps: [config.appCollectionClass]
2535
- });
2536
- }
2537
- return {
2538
- ngModule: DbxFirebaseFirestoreCollectionModule,
2539
- providers
2540
- };
2541
- }
2542
- }
2543
- DbxFirebaseFirestoreCollectionModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseFirestoreCollectionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2544
- DbxFirebaseFirestoreCollectionModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseFirestoreCollectionModule });
2545
- DbxFirebaseFirestoreCollectionModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseFirestoreCollectionModule });
2546
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseFirestoreCollectionModule, decorators: [{
2547
- type: NgModule
2548
- }] });
2549
-
2550
- /**
2551
- * Service that provides access to the app's FirestoreContext.
2552
- */
2553
- class DbxFirestoreContextService {
2554
- constructor(firestoreContext) {
2555
- this.firestoreContext = firestoreContext;
2556
- }
2557
- }
2558
- DbxFirestoreContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirestoreContextService, deps: [{ token: DBX_FIRESTORE_CONTEXT_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable });
2559
- DbxFirestoreContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirestoreContextService, providedIn: 'root' });
2560
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirestoreContextService, decorators: [{
2561
- type: Injectable,
2562
- args: [{
2563
- providedIn: 'root'
2564
- }]
2565
- }], ctorParameters: function () {
2566
- return [{ type: undefined, decorators: [{
2567
- type: Inject,
2568
- args: [DBX_FIRESTORE_CONTEXT_TOKEN]
2569
- }] }];
2570
- } });
2571
-
2572
- /**
2573
- * Used to initialize the LazyFirebaseFunctions type for a DbxFirebase app.
2574
- *
2575
- * Handles the key different, automatically injecting FirebaseDevelopmentFunctions with this existing value.
2576
- */
2577
- class DbxFirebaseFunctionsModule {
2578
- static forRoot(config) {
2579
- var _a;
2580
- const providers = [
2581
- {
2582
- provide: config.functionsGetterToken,
2583
- useFactory: config.functionsGetterFactory,
2584
- deps: [Functions]
2585
- }
2586
- ];
2587
- if (config.functionsConfigMap) {
2588
- forEachKeyValue(config.functionsConfigMap, {
2589
- forEach: ([key, entry]) => {
2590
- const provide = entry[0];
2591
- providers.push({
2592
- provide,
2593
- useFactory: (lazyFunctions) => {
2594
- const getter = lazyFunctions[key];
2595
- if (!getter) {
2596
- throw new Error(`Could not create provider for firebase function getter "${provide}" as the getter was unavailable.`);
2597
- }
2598
- else {
2599
- return getter();
2600
- }
2601
- },
2602
- deps: [config.functionsGetterToken]
2603
- });
2604
- }
2605
- });
2606
- // Add a provider for FirebaseDevelopmentFunctions if developmentFunctions is provided.
2607
- const developmentFunctionsKey = (_a = config.developmentFunctionsKey) !== null && _a !== void 0 ? _a : FIREBASE_DEVELOPMENT_FUNCTIONS_MAP_KEY;
2608
- if (developmentFunctionsKey) {
2609
- const developmentFunctionsConfig = config.functionsConfigMap[developmentFunctionsKey];
2610
- if (developmentFunctionsConfig != null) {
2611
- providers.push({
2612
- provide: FirebaseDevelopmentFunctions,
2613
- useExisting: developmentFunctionsConfig[0]
2614
- });
2615
- }
2616
- }
2617
- }
2618
- return {
2619
- ngModule: DbxFirebaseFunctionsModule,
2620
- providers
2621
- };
2622
- }
2623
- }
2624
- DbxFirebaseFunctionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseFunctionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2625
- DbxFirebaseFunctionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseFunctionsModule });
2626
- DbxFirebaseFunctionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseFunctionsModule });
2627
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseFunctionsModule, decorators: [{
2628
- type: NgModule
2629
- }] });
2630
-
2631
- /**
2632
- * DbxFirebaseCollectionChangeWatcher instance
2633
- */
2634
- class DbxFirebaseCollectionChangeWatcherInstance {
2635
- constructor(store, _initialMode = 'off') {
2636
- this.store = store;
2637
- this._initialMode = _initialMode;
2638
- this._mode = new BehaviorSubject(this._initialMode);
2639
- this._sub = new SubscriptionObject();
2640
- this.mode$ = this._mode.pipe(distinctUntilChanged());
2641
- this.event$ = this.store.queryChangeWatcher$.pipe(switchMap((x) => x.event$.pipe(filter((x) => x.type !== 'none'), // do not share 'none' events.
2642
- take(1), // only need one event to mark as change is available.
2643
- startWith({
2644
- time: new Date(),
2645
- type: 'none'
2646
- }))), shareReplay(1));
2647
- this.hasChangeAvailable$ = this.event$.pipe(map((x) => x.type !== 'none'), shareReplay(1));
2648
- this.triggered$ = combineLatest([this.mode$, this.hasChangeAvailable$]).pipe(map(([mode, hasChange]) => mode === 'auto' && hasChange));
2649
- this.trigger$ = this.triggered$.pipe(filter((triggered) => triggered), map(() => undefined));
2650
- }
2651
- destroy() {
2652
- this._sub.destroy();
2653
- this._mode.complete();
2654
- }
2655
- get mode() {
2656
- return this._mode.value;
2657
- }
2658
- set mode(mode) {
2659
- this._mode.next(mode);
2660
- }
2661
- }
2662
- function dbxFirebaseCollectionChangeWatcher(store, mode) {
2663
- return new DbxFirebaseCollectionChangeWatcherInstance(store, mode);
2664
- }
2665
-
2666
- /**
2667
- * Restarts the store.
2668
- *
2669
- * @param instance
2670
- * @returns
2671
- */
2672
- const DEFAULT_FIREBASE_COLLECTION_CHANGE_TRIGGER_FUNCTION = (instance) => instance.watcher.store.restart();
2673
- class DbxFirebaseCollectionChangeTriggerInstance {
2674
- constructor(config) {
2675
- var _a;
2676
- this.config = config;
2677
- this._triggerFunction = new BehaviorSubject(undefined);
2678
- this._sub = new SubscriptionObject();
2679
- this.watcher = config.watcher;
2680
- this.triggerFunction = (_a = config.triggerFunction) !== null && _a !== void 0 ? _a : DEFAULT_FIREBASE_COLLECTION_CHANGE_TRIGGER_FUNCTION;
2681
- }
2682
- init() {
2683
- this._sub.subscription = this._triggerFunction
2684
- .pipe(switchMap((triggerFunction) => {
2685
- if (triggerFunction) {
2686
- return this.watcher.triggered$.pipe(filter((triggered) => triggered), exhaustMap(() => asObservable(triggerFunction(this))));
2687
- }
2688
- else {
2689
- return EMPTY;
2690
- }
2691
- }))
2692
- .subscribe();
2693
- }
2694
- destroy() {
2695
- var _a;
2696
- this._triggerFunction.complete();
2697
- if (this.config.destroyWatcherOnDestroy === true) {
2698
- (_a = this.watcher) === null || _a === void 0 ? void 0 : _a.destroy();
2699
- }
2700
- }
2701
- get triggerFunction() {
2702
- return this._triggerFunction.value;
2703
- }
2704
- set triggerFunction(triggerFunction) {
2705
- this._triggerFunction.next(triggerFunction);
2706
- }
2707
- }
2708
- /**
2709
- * Creates a new DbxFirebaseCollectionChangeWatcher, set the modes to "auto", and creates a new DbxFirebaseCollectionChangeTriggerInstance.
2710
- *
2711
- * If no trigger function is provided it will default to resetting the store.
2712
- *
2713
- * NOTE: Don't forget to initialize the DbxFirebaseCollectionChangeTriggerInstance and handle other lifecycle changes.
2714
- *
2715
- * @param store
2716
- * @param triggerFunction
2717
- * @returns
2718
- */
2719
- function dbxFirebaseCollectionChangeTriggerForStore(store, triggerFunction) {
2720
- return dbxFirebaseCollectionChangeTrigger({
2721
- watcher: dbxFirebaseCollectionChangeWatcher(store, 'auto'),
2722
- destroyWatcherOnDestroy: true,
2723
- triggerFunction: triggerFunction !== null && triggerFunction !== void 0 ? triggerFunction : (() => {
2724
- store.restart();
2725
- })
2726
- });
2727
- }
2728
- function dbxFirebaseCollectionChangeTriggerForWatcher(watcher, triggerFunction) {
2729
- return dbxFirebaseCollectionChangeTrigger({
2730
- watcher,
2731
- destroyWatcherOnDestroy: false,
2732
- triggerFunction
2733
- });
2734
- }
2735
- function dbxFirebaseCollectionChangeTrigger(config) {
2736
- return new DbxFirebaseCollectionChangeTriggerInstance(config);
2737
- }
2738
-
2739
- /**
2740
- * DbxFirebaseModelLoader implementation within an instance.
2741
- */
2742
- class DbxFirebaseCollectionLoaderInstance {
2743
- constructor(_initConfig) {
2744
- var _a, _b, _c, _d;
2745
- this._initConfig = _initConfig;
2746
- this._collection = new BehaviorSubject((_a = this._initConfig) === null || _a === void 0 ? void 0 : _a.collection);
2747
- this._maxPages = new BehaviorSubject((_b = this._initConfig) === null || _b === void 0 ? void 0 : _b.maxPages);
2748
- this._itemsPerPage = new BehaviorSubject((_c = this._initConfig) === null || _c === void 0 ? void 0 : _c.itemsPerPage);
2749
- this._constraints = new BehaviorSubject((_d = this._initConfig) === null || _d === void 0 ? void 0 : _d.constraints);
2750
- this._restart = new Subject();
2751
- this._maxPagesSub = new SubscriptionObject();
2752
- this.collection$ = this._collection.pipe(distinctUntilChanged());
2753
- this.constraints$ = this._constraints.pipe(distinctUntilChanged());
2754
- this.iteratorFilter$ = combineLatest([this._itemsPerPage.pipe(distinctUntilChanged()), this.constraints$]).pipe(map(([limit, constraints]) => ({ limit, constraints, maxPageLoadLimit: this.maxPages })), shareReplay(1));
2755
- this.firestoreIteration$ = this.collection$.pipe(switchMap((collection) => {
2756
- if (collection) {
2757
- return combineLatest([this.iteratorFilter$, this._restart.pipe(startWith(undefined))]).pipe(throttleTime(100, undefined, { trailing: true }), // prevent rapid changes and executing filters too quickly.
2758
- map(([iteratorFilter]) => collection.firestoreIteration(iteratorFilter)), cleanupDestroyable(), // cleanup the iteration
2759
- shareReplay(1));
2760
- }
2761
- else {
2762
- return NEVER; // don't emit anything until collection is provided.
2763
- }
2764
- }), cleanupDestroyable(), // cleanup the iteration
2765
- shareReplay(1));
2766
- this.queryChangeWatcher$ = this.firestoreIteration$.pipe(map((instance) => iterationQueryDocChangeWatcher({ instance })), shareReplay(1));
2767
- this.snapshotAccumulator$ = this.firestoreIteration$.pipe(map((x) => firebaseQuerySnapshotAccumulator(x)), cleanupDestroyable(), shareReplay(1));
2768
- this.snapshotAccumulatorDocumentRefs$ = this.snapshotAccumulator$.pipe(switchMap((x) => x.allItems$.pipe(map((y) => y.map((z) => z.map((zz) => zz.ref))))), shareReplay(1));
2769
- this.snapshotAccumulatorDocuments$ = combineLatest([this.collection$.pipe(filterMaybe()), this.snapshotAccumulatorDocumentRefs$]).pipe(map(([collection, documentRefs]) => {
2770
- const accessor = collection.documentAccessor();
2771
- return documentRefs.map((y) => y.map((z) => accessor.loadDocument(z)));
2772
- }), shareReplay(1));
2773
- this.accumulator$ = this.firestoreIteration$.pipe(map((x) => firebaseQueryItemAccumulator(x)), cleanupDestroyable(), shareReplay(1));
2774
- /**
2775
- * Passthrough for currentAllItems$ from the accumulator.
2776
- */
2777
- this.currentAccumulatorItems$ = this.accumulator$.pipe(switchMap((x) => x.currentAllItems$), shareReplay(1));
2778
- /**
2779
- * Passthrough for allItems$ from the accumulator.
2780
- */
2781
- this.accumulatorItems$ = this.accumulator$.pipe(switchMap((x) => x.allItems$), shareReplay(1));
2782
- this.hasDocuments$ = this.firestoreIteration$.pipe(switchMap((x) => x.firstState$.pipe(map((x) => { var _a; return Boolean((_a = x.value) === null || _a === void 0 ? void 0 : _a.length); }))), shareReplay(1));
2783
- this.allDocumentRefs$ = this.snapshotAccumulatorDocumentRefs$.pipe(map((x) => x.flat()), shareReplay(1));
2784
- this.allDocuments$ = this.snapshotAccumulatorDocuments$.pipe(map((x) => x.flat()), shareReplay(1));
2785
- this.allDocumentData$ = this.accumulatorItems$.pipe(map((x) => x.flat()), shareReplay(1));
2786
- this.pageLoadingState$ = this.accumulator$.pipe(switchMap((x) => accumulatorFlattenPageListLoadingState(x)), shareReplay(1));
2787
- }
2788
- init() {
2789
- // When max pages changes, update the iteration's max page limit.
2790
- this._maxPagesSub.subscription = this._maxPages
2791
- .pipe(distinctUntilChanged(), filterMaybe(), // do not pass null/undefined values
2792
- switchMap((maxPageLoadLimit) => this.firestoreIteration$.pipe(tap((iteration) => {
2793
- iteration.maxPageLoadLimit = maxPageLoadLimit;
2794
- }))))
2795
- .subscribe();
2796
- }
2797
- destroy() {
2798
- this._maxPages.complete();
2799
- this._collection.complete();
2800
- this._constraints.complete();
2801
- this._itemsPerPage.complete();
2802
- this._restart.complete();
2803
- this._maxPagesSub.destroy();
2804
- }
2805
- // MARK: Inputs
2806
- get maxPages() {
2807
- return this._maxPages.value;
2808
- }
2809
- set maxPages(maxPages) {
2810
- if (this.maxPages != maxPages) {
2811
- this._maxPages.next(maxPages);
2812
- }
2813
- }
2814
- get itemsPerPage() {
2815
- return this._itemsPerPage.value;
2816
- }
2817
- set itemsPerPage(itemsPerPage) {
2818
- if (this.itemsPerPage != itemsPerPage) {
2819
- this._itemsPerPage.next(itemsPerPage);
2820
- }
2821
- }
2822
- get constraints() {
2823
- return this._constraints.value;
2824
- }
2825
- set constraints(constraints) {
2826
- this._constraints.next(constraints);
2827
- }
2828
- get collection() {
2829
- return this._collection.value;
2830
- }
2831
- set collection(collection) {
2832
- this._collection.next(collection);
2833
- }
2834
- // MARK: DbxFirebaseCollectionLoader
2835
- next() {
2836
- useFirst(this.firestoreIteration$, (x) => x.next());
2837
- }
2838
- restart() {
2839
- this._restart.next();
2840
- }
2841
- setConstraints(constraints) {
2842
- this.constraints = constraints;
2843
- }
2844
- setCollection(firestoreCollection) {
2845
- this.collection = firestoreCollection;
2846
- }
2847
- }
2848
- function dbxFirebaseCollectionLoaderInstance(config) {
2849
- return new DbxFirebaseCollectionLoaderInstance(config);
2850
- }
2851
- function dbxFirebaseCollectionLoaderInstanceWithCollection(collection) {
2852
- return new DbxFirebaseCollectionLoaderInstance({ collection });
2853
- }
2854
-
2855
- /**
2856
- * DbxLimitedFirebaseDocumentLoader implementation within an instance.
2857
- */
2858
- class DbxLimitedFirebaseDocumentLoaderInstance {
2859
- constructor(_initConfig) {
2860
- this._initConfig = _initConfig;
2861
- this.accessor = this._initConfig.accessor;
2862
- this._documents = new BehaviorSubject(undefined);
2863
- this._restart = new Subject();
2864
- this._sub = new SubscriptionObject();
2865
- this.documents$ = this._documents.pipe(filterMaybe(), distinctUntilChanged());
2866
- this.keys$ = this.documents$.pipe(map(firestoreModelKeysFromDocuments));
2867
- this.ids$ = this.documents$.pipe(map(firestoreModelIdsFromDocuments));
2868
- this.refs$ = this.documents$.pipe(map(documentReferencesFromDocuments));
2869
- this.snapshots$ = this.documents$.pipe(switchMap((docs) => this._restart.pipe(startWith(null), exhaustMap(() => getDocumentSnapshots(docs)))), shareReplay(1));
2870
- this.data$ = this.snapshots$.pipe(map((snapshots) => getDataFromDocumentSnapshots(snapshots, true)), shareReplay(1));
2871
- /**
2872
- * Snapshot stream of the documents
2873
- */
2874
- this.snapshotsStream$ = this.documents$.pipe(switchMap((docs) => latestSnapshotsFromDocuments(docs)), shareReplay(1));
2875
- /**
2876
- * Data streamd of the documents.
2877
- */
2878
- this.dataStream$ = this.snapshotsStream$.pipe(dataFromDocumentSnapshots(), shareReplay(1));
2879
- this.pageLoadingState$ = pageLoadingStateFromObs(this.data$, false);
2880
- this.pageLoadingStateStream$ = pageLoadingStateFromObs(this.dataStream$, false);
2881
- }
2882
- destroy() {
2883
- this._documents.complete();
2884
- this._restart.complete();
2885
- this._sub.destroy();
2886
- }
2887
- restart() {
2888
- this._restart.next();
2889
- }
2890
- setKeys(keys) {
2891
- this.setDocuments(asObservable(keys).pipe(map((x) => loadDocumentsForKeys(this.accessor, asArray(x)))));
2892
- }
2893
- setRefs(refs) {
2894
- this.setDocuments(asObservable(refs).pipe(map((x) => loadDocumentsForDocumentReferences(this.accessor, asArray(x)))));
2895
- }
2896
- setDocuments(docs) {
2897
- this._sub.subscription = useAsObservable(docs, (x) => this._documents.next(asArray(x)));
2898
- }
2899
- }
2900
- function dbxLimitedFirebaseDocumentLoaderInstance(config) {
2901
- return new DbxLimitedFirebaseDocumentLoaderInstance(config);
2902
- }
2903
- function dbxLimitedFirebaseDocumentLoaderInstanceWithAccessor(accessor) {
2904
- return new DbxLimitedFirebaseDocumentLoaderInstance({ accessor });
2905
- }
2906
- // MARK: Full DbxFirebaseDocumentLoaderInstance
2907
- class DbxFirebaseDocumentLoaderInstance extends DbxLimitedFirebaseDocumentLoaderInstance {
2908
- setIds(ids) {
2909
- this.setDocuments(asObservable(ids).pipe(map((x) => loadDocumentsForIds(this.accessor, asArray(x)))));
2910
- }
2911
- }
2912
- function dbxFirebaseDocumentLoaderInstance(config) {
2913
- return new DbxFirebaseDocumentLoaderInstance(config);
2914
- }
2915
- function dbxFirebaseDocumentLoaderInstanceWithAccessor(accessor) {
2916
- return new DbxFirebaseDocumentLoaderInstance({ accessor });
2917
- }
2918
-
2919
- function dbxFirebaseInContextFirebaseModelServiceInstanceFactory(context$) {
2920
- return (type, keyObs) => {
2921
- const key$ = asObservable(keyObs);
2922
- const modelServiceObs = context$.pipe(map((x) => x(type)), switchMap((service) => key$.pipe(map((key) => service(key)))));
2923
- return new DbxFirebaseInContextFirebaseModelServiceInstance(modelServiceObs);
2924
- };
2925
- }
2926
- /**
2927
- * Wraps an InModelContextFirebaseModelService observable and provides different piped observables.
2928
- */
2929
- class DbxFirebaseInContextFirebaseModelServiceInstance {
2930
- constructor(modelService$) {
2931
- this.modelService$ = modelService$;
2932
- this.key$ = this.modelService$.pipe(map((x) => x.model.key));
2933
- // MARK: Model
2934
- this.modelType$ = this.modelService$.pipe(map((x) => x.model.modelType), distinctUntilChanged());
2935
- this.model$ = this.modelService$.pipe(map((x) => x.model), distinctUntilChanged((a, b) => a.key === b.key), shareReplay(1));
2936
- this.snapshotData$ = this.model$.pipe(switchMap((x) => x.snapshotData()), shareReplay(1));
2937
- // MARK: Roles
2938
- this.roleReader$ = this.modelService$.pipe(switchMap((x) => x.roleReader()), shareReplay(1));
2939
- this.roleMap$ = this.roleReader$.pipe(map((x) => x.roleMap), shareReplay(1));
2940
- this.hasNoAccess$ = this.roleReader$.pipe(map((x) => x.hasNoAccess()), shareReplay(1));
2941
- }
2942
- snapshotStream(mode) {
2943
- return this.model$.pipe(switchMap((x) => x.snapshotStream(mode)), shareReplay(1));
2944
- }
2945
- snapshotDataStream(mode, options) {
2946
- return this.model$.pipe(switchMap((x) => x.snapshotDataStream(mode)), shareReplay(1));
2947
- }
2948
- truthMap(input) {
2949
- return this.roleReader$.pipe(map((x) => x.truthMap(input)), shareReplay(1));
2950
- }
2951
- hasAnyRoles(roles) {
2952
- return this.hasRoles('any', roles);
2953
- }
2954
- hasAllRoles(roles) {
2955
- return this.hasRoles('all', roles);
2956
- }
2957
- hasRoles(setIncludes, roles) {
2958
- return this.roleReader$.pipe(map((x) => x.hasRoles(setIncludes, roles)), distinctUntilChanged(), shareReplay(1));
2959
- }
2960
- containsAnyRoles(roles) {
2961
- return this.containsRoles('any', roles);
2962
- }
2963
- containsAllRoles(roles) {
2964
- return this.containsRoles('all', roles);
2965
- }
2966
- containsRoles(setIncludes, roles) {
2967
- return this.roleReader$.pipe(map((x) => x.containsRoles(setIncludes, roles)), distinctUntilChanged(), shareReplay(1));
2968
- }
2969
- }
2970
-
2971
- /**
2972
- * Used for retrieving contexts for a specific model type/identity.
2973
- */
2974
- class DbxFirebaseModelContextService {
2975
- }
2976
- function dbxFirebaseModelContextServiceInfoInstanceFactory(config) {
2977
- const { modelService, entityMap$ } = config;
2978
- return (keyObs) => {
2979
- const key$ = asObservable(keyObs);
2980
- return key$.pipe(asFirestoreModelKeyCollectionType(), switchMap((pair) => {
2981
- return entityMap$.pipe(map((entityMap) => {
2982
- const modelType = entityMap.get(pair.collectionType);
2983
- if (!modelType) {
2984
- const message = `dbxFirebaseModelContextServiceInfoInstanceFactory Error: Failed to retrieve model type for collection type "${pair.collectionType}"`;
2985
- console.error(message);
2986
- throw new Error(message);
2987
- }
2988
- return modelService(modelType, pair.key);
2989
- }));
2990
- }));
2991
- };
2992
- }
2993
- /**
2994
- * Operator function that builds a FirestoreModelIdentityTypeMap from the input context and shares the replay.
2995
- *
2996
- * Since the output won't change with different contexts, the map is built once and then shared.
2997
- *
2998
- * @returns
2999
- */
3000
- function firebaseContextServiceEntityMap() {
3001
- return (obs) => {
3002
- return obs.pipe(map((x) => buildFirebaseCollectionTypeModelTypeMap(x)), first(), shareReplay(1));
3003
- };
3004
- }
3005
-
3006
- /**
3007
- * Configuration provided in the root module for configuring entries.
3008
- */
3009
- class DbxFirebaseModelTypesServiceConfig {
3010
- }
3011
- /**
3012
- * Provides model type information about models registered within Firebase.
3013
- *
3014
- * Automatically configures the DbxModelTypesService.
3015
- */
3016
- class DbxFirebaseModelTypesService {
3017
- constructor(dbxFirebaseModelContextService, dbxModelTypesService, config) {
3018
- this.dbxFirebaseModelContextService = dbxFirebaseModelContextService;
3019
- this.dbxModelTypesService = dbxModelTypesService;
3020
- if (config) {
3021
- this.register(config.entries);
3022
- }
3023
- }
3024
- getDisplayInfo(typeInfo, data) {
3025
- let displayInfo;
3026
- if (data != null) {
3027
- displayInfo = typeInfo.displayInfoFactory(data);
3028
- displayInfo.icon = displayInfo.icon || typeInfo.icon; // set default icon
3029
- }
3030
- else {
3031
- displayInfo = this.getDefaultDisplayInfo(typeInfo);
3032
- }
3033
- return displayInfo;
3034
- }
3035
- getDefaultDisplayInfo(typeInfo) {
3036
- var _a;
3037
- // TODO: Make configurable
3038
- return {
3039
- title: (_a = typeInfo.label) !== null && _a !== void 0 ? _a : '',
3040
- icon: 'warning'
3041
- };
3042
- }
3043
- // MARK: Register
3044
- register(entries) {
3045
- const typeConfigs = asArray(entries).map((x) => (Object.assign(Object.assign({}, x), { modelType: x.identity.modelType })));
3046
- this.dbxModelTypesService.addTypeConfigs(typeConfigs);
3047
- }
3048
- // MARK: Retrieval
3049
- currentInfoForType(type) {
3050
- return this.dbxModelTypesService.typesMap$.pipe(map((x) => x[type]));
3051
- }
3052
- infoForType(type) {
3053
- return this.currentInfoForType(type).pipe(map((x) => {
3054
- if (!x) {
3055
- console.error(`DbxFirebaseModelTypesService: contained no info for type "${type}". Ensure the correct type was entered, and that the type is registered with the DbxFirebaseModelTypesService.`);
3056
- throw x;
3057
- }
3058
- return x;
3059
- }));
3060
- }
3061
- instanceForKey(key$) {
3062
- return new DbxFirebaseModelTypesServiceInstance(this.dbxFirebaseModelContextService.modelInfoInstance(key$), this);
3063
- }
3064
- instancePairsForKeys(keys) {
3065
- return dbxFirebaseModelTypesServiceInstancePairForKeysFactory(this)(keys);
3066
- }
3067
- }
3068
- DbxFirebaseModelTypesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelTypesService, deps: [{ token: DbxFirebaseModelContextService }, { token: i1$2.DbxModelTypesService }, { token: DbxFirebaseModelTypesServiceConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
3069
- DbxFirebaseModelTypesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelTypesService, providedIn: 'root' });
3070
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelTypesService, decorators: [{
3071
- type: Injectable,
3072
- args: [{
3073
- providedIn: 'root'
3074
- }]
3075
- }], ctorParameters: function () {
3076
- return [{ type: DbxFirebaseModelContextService }, { type: i1$2.DbxModelTypesService }, { type: DbxFirebaseModelTypesServiceConfig, decorators: [{
3077
- type: Optional
3078
- }] }];
3079
- } });
3080
- function dbxFirebaseModelTypesServiceInstancePairForKeysFactory(service) {
3081
- return (keys) => {
3082
- const instances = asArray(keys).map((x) => service.instanceForKey(x).instancePair$);
3083
- return instances.length ? combineLatest(instances) : of([]);
3084
- };
3085
- }
3086
- /**
3087
- * DbxFirebaseModelTypesService instance
3088
- */
3089
- class DbxFirebaseModelTypesServiceInstance {
3090
- constructor(modelInfoInstance$, dbxFirebaseModelTypesService) {
3091
- this.modelInfoInstance$ = modelInfoInstance$;
3092
- this.dbxFirebaseModelTypesService = dbxFirebaseModelTypesService;
3093
- this.key$ = this.modelInfoInstance$.pipe(switchMap((x) => x.key$));
3094
- this.modelType$ = this.modelInfoInstance$.pipe(switchMap((x) => x.modelType$));
3095
- this.snapshotData$ = this.modelInfoInstance$.pipe(switchMap((x) => x.snapshotData$));
3096
- this.typeInfo$ = this.modelType$.pipe(switchMap((x) => this.dbxFirebaseModelTypesService.infoForType(x)), distinctUntilChanged(), shareReplay(1));
3097
- this.identity$ = this.typeInfo$.pipe(map((x) => x.identity), distinctUntilChanged());
3098
- this.segueRef$ = combineLatest([this.key$, this.typeInfo$]).pipe(map(([key, info]) => (info.sref ? info.sref(key) : undefined)), shareReplay(1));
3099
- this.displayInfo$ = combineLatest([this.typeInfo$, this.snapshotData$]).pipe(map(([typeInfo, data]) => this.dbxFirebaseModelTypesService.getDisplayInfo(typeInfo, data)), shareReplay(1));
3100
- this.clickableSegueRef$ = combineLatest([this.segueRef$, this.displayInfo$]).pipe(map(([segueRef, displayInfo]) => {
3101
- let ref = undefined;
3102
- if (segueRef) {
3103
- ref = Object.assign(Object.assign({}, segueRef), { title: displayInfo.title, icon: displayInfo.icon });
3104
- }
3105
- return ref;
3106
- }), shareReplay(1));
3107
- this.instancePair$ = combineLatest([this.clickableSegueRef$, this.displayInfo$, this.key$]).pipe(map(([segueRef, displayInfo, key]) => ({ segueRef, displayInfo, key, instance: this })), shareReplay(1));
3108
- }
3109
- }
3110
-
3111
- class DbxFirebaseModelTrackerService {
3112
- constructor(dbxModelTrackerService, dbxFirebaseModelTypesService) {
3113
- this.dbxModelTrackerService = dbxModelTrackerService;
3114
- this.dbxFirebaseModelTypesService = dbxFirebaseModelTypesService;
3115
- this.historyKeys$ = this.dbxModelTrackerService.newEvent$.pipe(startWith(null), switchMap(() => this.loadHistoryKeys()), shareReplay(1));
3116
- this.historyPairs$ = this.dbxModelTrackerService.newEvent$.pipe(startWith(null), switchMap(() => this.loadHistoryPairs()), // TODO: Improve efficiency of this to only load/remove items for new keys
3117
- shareReplay(1));
3118
- this.filterItemHistoryPairs$ = this.historyPairs$.pipe(mapEachAsync((instancePair) => instancePair.instance.identity$.pipe(map((identity) => ({ instancePair, identity }))), { onlyFirst: true }), shareReplay(1));
3119
- }
3120
- /**
3121
- * Filters from historyPairs$ using the input filter configuration, if it is provided.
3122
- *
3123
- * @param filter
3124
- * @returns
3125
- */
3126
- filterHistoryPairs(filter) {
3127
- if (filter && ((filter === null || filter === void 0 ? void 0 : filter.identity) || (filter === null || filter === void 0 ? void 0 : filter.filterItem))) {
3128
- const { invertFilter = false, identity, filterItem } = filter;
3129
- const allowedIdentities = new Set(asArray(identity));
3130
- const baseIsAllowedIdentityFn = identity ? (x) => allowedIdentities.has(x) : () => true;
3131
- const isAllowedIdentityFn = invertDecision(baseIsAllowedIdentityFn, invertFilter);
3132
- const baseFilterItemFn = filterItem ? invertObservableDecision(filterItem, invertFilter) : () => of(true);
3133
- const filterItemFn = (x) => {
3134
- if (isAllowedIdentityFn(x.identity)) {
3135
- return baseFilterItemFn(x);
3136
- }
3137
- else {
3138
- return of(false);
3139
- }
3140
- };
3141
- return this.filterItemHistoryPairs$.pipe(filterItemsWithObservableDecision(filterItemFn), map((x) => x.map((y) => y.instancePair)), shareReplay(1));
3142
- }
3143
- else {
3144
- return this.historyPairs$;
3145
- }
3146
- }
3147
- loadHistoryKeys() {
3148
- return this.dbxModelTrackerService.getAllViewEvents().pipe(map(allDbxModelViewTrackerEventModelKeys));
3149
- }
3150
- loadHistoryPairs() {
3151
- const historyKeys$ = this.loadHistoryKeys();
3152
- return historyKeys$.pipe(switchMap((x) => this.dbxFirebaseModelTypesService.instancePairsForKeys(x)));
3153
- }
3154
- }
3155
- DbxFirebaseModelTrackerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelTrackerService, deps: [{ token: i1$2.DbxModelTrackerService }, { token: DbxFirebaseModelTypesService }], target: i0.ɵɵFactoryTarget.Injectable });
3156
- DbxFirebaseModelTrackerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelTrackerService, providedIn: 'root' });
3157
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelTrackerService, decorators: [{
3158
- type: Injectable,
3159
- args: [{
3160
- providedIn: 'root'
3161
- }]
3162
- }], ctorParameters: function () { return [{ type: i1$2.DbxModelTrackerService }, { type: DbxFirebaseModelTypesService }]; } });
3163
-
3164
- /**
3165
- * Renders an item as configured from the DbxFirebaseModelTypesServiceInstancePair.
3166
- */
3167
- class DbxFirebaseModelTypeInstanceComponent extends AbstractDbxSelectionListWrapperDirective {
3168
- constructor() {
3169
- super({
3170
- componentClass: DbxFirebaseModelTypeInstanceViewComponent,
3171
- defaultSelectionMode: 'view'
3172
- });
3173
- }
3174
- }
3175
- DbxFirebaseModelTypeInstanceComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelTypeInstanceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3176
- DbxFirebaseModelTypeInstanceComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseModelTypeInstanceComponent, selector: "dbx-firebase-model-type-instance-list", providers: provideDbxListViewWrapper(DbxFirebaseModelTypeInstanceComponent), usesInheritance: true, ngImport: i0, template: "\n<dbx-list [state$]=\"state$\" [config]=\"config$ | async\" [disabled]=\"disabled\" [selectionMode]=\"selectionMode\">\n <ng-content top select=\"[top]\"></ng-content>\n <ng-content bottom select=\"[bottom]\"></ng-content>\n <ng-content empty select=\"[empty]\"></ng-content>\n <ng-content emptyLoading select=\"[emptyLoading]\"></ng-content>\n</dbx-list>\n", isInline: true, dependencies: [{ kind: "component", type: i1$2.DbxListComponent, selector: "dbx-list", inputs: ["padded", "state$", "config", "disabled", "selectionMode"], outputs: ["contentScrolled"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }] });
3177
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelTypeInstanceComponent, decorators: [{
3178
- type: Component,
3179
- args: [{
3180
- selector: 'dbx-firebase-model-type-instance-list',
3181
- template: DEFAULT_LIST_WRAPPER_DIRECTIVE_TEMPLATE,
3182
- providers: provideDbxListViewWrapper(DbxFirebaseModelTypeInstanceComponent)
3183
- }]
3184
- }], ctorParameters: function () { return []; } });
3185
- class DbxFirebaseModelTypeInstanceViewComponent extends AbstractDbxSelectionListViewDirective {
3186
- constructor() {
3187
- super(...arguments);
3188
- this.config = {
3189
- componentClass: DbxFirebaseModelTypeInstanceViewItemComponent,
3190
- mapValuesToItemValues: (x) => of(x.map((y) => { var _a; return ({ itemValue: y, icon: (_a = y.displayInfo.icon) !== null && _a !== void 0 ? _a : y.icon, anchor: y.segueRef }); }))
3191
- };
3192
- }
3193
- }
3194
- DbxFirebaseModelTypeInstanceViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelTypeInstanceViewComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3195
- DbxFirebaseModelTypeInstanceViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseModelTypeInstanceViewComponent, selector: "ng-component", providers: provideDbxListView(DbxFirebaseModelTypeInstanceViewComponent), usesInheritance: true, ngImport: i0, template: "<dbx-selection-list-view [config]=\"config\"></dbx-selection-list-view>", isInline: true, dependencies: [{ kind: "component", type: i1$2.DbxSelectionValueListViewComponent, selector: "dbx-selection-list-view" }] });
3196
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelTypeInstanceViewComponent, decorators: [{
3197
- type: Component,
3198
- args: [{
3199
- template: DEFAULT_DBX_SELECTION_VALUE_LIST_DIRECTIVE_TEMPLATE,
3200
- providers: provideDbxListView(DbxFirebaseModelTypeInstanceViewComponent)
3201
- }]
3202
- }] });
3203
- class DbxFirebaseModelTypeInstanceViewItemComponent extends AbstractDbxValueListViewItemComponent {
3204
- get title() {
3205
- return this.itemValue.displayInfo.title;
3206
- }
3207
- }
3208
- DbxFirebaseModelTypeInstanceViewItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelTypeInstanceViewItemComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3209
- DbxFirebaseModelTypeInstanceViewItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseModelTypeInstanceViewItemComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
3210
- <span>{{ title }}</span>
3211
- `, isInline: true });
3212
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelTypeInstanceViewItemComponent, decorators: [{
3213
- type: Component,
3214
- args: [{
3215
- template: `
3216
- <span>{{ title }}</span>
3217
- `
3218
- }]
3219
- }] });
3220
-
3221
- class DbxFirebaseModelHistoryComponent {
3222
- constructor(dbxFirebaseModelTrackerService) {
3223
- this.dbxFirebaseModelTrackerService = dbxFirebaseModelTrackerService;
3224
- this._historyFilter = new BehaviorSubject(undefined);
3225
- this.historyFilter$ = this._historyFilter.asObservable();
3226
- this.historyPairs$ = this.historyFilter$.pipe(switchMap((x) => this.dbxFirebaseModelTrackerService.filterHistoryPairs(x)), shareReplay(1));
3227
- this.state$ = loadingStateFromObs(this.historyPairs$);
3228
- }
3229
- get historyFilter() {
3230
- return this._historyFilter.value;
3231
- }
3232
- set historyFilter(historyFilter) {
3233
- this._historyFilter.next(historyFilter);
3234
- }
3235
- ngOnDestroy() {
3236
- this._historyFilter.complete();
3237
- }
3238
- }
3239
- DbxFirebaseModelHistoryComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelHistoryComponent, deps: [{ token: DbxFirebaseModelTrackerService }], target: i0.ɵɵFactoryTarget.Component });
3240
- DbxFirebaseModelHistoryComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseModelHistoryComponent, selector: "dbx-firebase-model-history", inputs: { anchorForItem: "anchorForItem", historyFilter: "historyFilter" }, ngImport: i0, template: `
3241
- <dbx-firebase-model-type-instance-list [state$]="state$" [dbxListItemModifier] [dbxListItemAnchorModifier]="anchorForItem">
3242
- <ng-content empty select="[empty]"></ng-content>
3243
- </dbx-firebase-model-type-instance-list>
3244
- `, isInline: true, dependencies: [{ kind: "directive", type: i1$2.DbxListItemAnchorModifierDirective, selector: "[dbxListItemAnchorModifier]", inputs: ["dbxListItemAnchorModifier"] }, { kind: "directive", type: i1$2.DbxValueListItemModifierDirective, selector: "[dbxListItemModifier]", inputs: ["dbxListItemModifier"] }, { kind: "component", type: DbxFirebaseModelTypeInstanceComponent, selector: "dbx-firebase-model-type-instance-list" }] });
3245
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelHistoryComponent, decorators: [{
3246
- type: Component,
3247
- args: [{
3248
- selector: 'dbx-firebase-model-history',
3249
- template: `
3250
- <dbx-firebase-model-type-instance-list [state$]="state$" [dbxListItemModifier] [dbxListItemAnchorModifier]="anchorForItem">
3251
- <ng-content empty select="[empty]"></ng-content>
3252
- </dbx-firebase-model-type-instance-list>
3253
- `
3254
- }]
3255
- }], ctorParameters: function () { return [{ type: DbxFirebaseModelTrackerService }]; }, propDecorators: { anchorForItem: [{
3256
- type: Input
3257
- }], historyFilter: [{
3258
- type: Input
3259
- }] } });
3260
-
3261
- const DEFAULT_FIREBASE_HISTORY_COMPONENT_POPOVER_KEY = 'history';
3262
- class DbxFirebaseModelHistoryPopoverComponent extends AbstractPopoverDirective {
3263
- constructor(popover) {
3264
- super(popover);
3265
- }
3266
- static openPopover(popupService, { origin, header, icon, emptyText, historyFilter, anchorForItem }, popoverKey) {
3267
- return popupService.open({
3268
- key: popoverKey !== null && popoverKey !== void 0 ? popoverKey : DEFAULT_FIREBASE_HISTORY_COMPONENT_POPOVER_KEY,
3269
- origin,
3270
- componentClass: DbxFirebaseModelHistoryPopoverComponent,
3271
- data: {
3272
- header,
3273
- icon,
3274
- emptyText,
3275
- historyFilter,
3276
- anchorForItem
3277
- }
3278
- });
3279
- }
3280
- get params() {
3281
- return this.popover.data;
3282
- }
3283
- get icon() {
3284
- var _a;
3285
- return (_a = this.params.icon) !== null && _a !== void 0 ? _a : 'history';
3286
- }
3287
- get header() {
3288
- var _a;
3289
- return (_a = this.params.header) !== null && _a !== void 0 ? _a : 'History';
3290
- }
3291
- get emptyText() {
3292
- var _a;
3293
- return (_a = this.params.header) !== null && _a !== void 0 ? _a : 'History is empty.';
3294
- }
3295
- get historyFilter() {
3296
- return this.params.historyFilter;
3297
- }
3298
- get anchorForItem() {
3299
- return this.params.anchorForItem;
3300
- }
3301
- }
3302
- DbxFirebaseModelHistoryPopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelHistoryPopoverComponent, deps: [{ token: i1$2.DbxPopoverComponent }], target: i0.ɵɵFactoryTarget.Component });
3303
- DbxFirebaseModelHistoryPopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseModelHistoryPopoverComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<dbx-popover-content>\n <!-- Header -->\n <dbx-popover-header [icon]=\"icon\" [header]=\"header\"></dbx-popover-header>\n <!-- Content -->\n <dbx-popover-scroll-content>\n <dbx-firebase-model-history [historyFilter]=\"historyFilter\" [anchorForItem]=\"anchorForItem\">\n <dbx-list-empty-content empty>\n <p>{{ emptyText }}</p>\n </dbx-list-empty-content>\n </dbx-firebase-model-history>\n </dbx-popover-scroll-content>\n</dbx-popover-content>\n", dependencies: [{ kind: "component", type: i1$2.DbxPopoverContentComponent, selector: "dbx-popover-content" }, { kind: "component", type: i1$2.DbxPopoverHeaderComponent, selector: "dbx-popover-header", inputs: ["header", "icon"] }, { kind: "component", type: i1$2.DbxPopoverScrollContentComponent, selector: "dbx-popover-scroll-content" }, { kind: "component", type: i1$2.DbxListEmptyContentComponent, selector: "dbx-list-empty-content" }, { kind: "component", type: DbxFirebaseModelHistoryComponent, selector: "dbx-firebase-model-history", inputs: ["anchorForItem", "historyFilter"] }] });
3304
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelHistoryPopoverComponent, decorators: [{
3305
- type: Component,
3306
- args: [{ template: "<dbx-popover-content>\n <!-- Header -->\n <dbx-popover-header [icon]=\"icon\" [header]=\"header\"></dbx-popover-header>\n <!-- Content -->\n <dbx-popover-scroll-content>\n <dbx-firebase-model-history [historyFilter]=\"historyFilter\" [anchorForItem]=\"anchorForItem\">\n <dbx-list-empty-content empty>\n <p>{{ emptyText }}</p>\n </dbx-list-empty-content>\n </dbx-firebase-model-history>\n </dbx-popover-scroll-content>\n</dbx-popover-content>\n" }]
3307
- }], ctorParameters: function () { return [{ type: i1$2.DbxPopoverComponent }]; } });
3308
-
3309
- class DbxFirebaseModelHistoryPopoverButtonComponent extends AbstractPopoverRefDirective {
3310
- constructor(dbxPopoverService) {
3311
- super();
3312
- this.dbxPopoverService = dbxPopoverService;
3313
- }
3314
- _makePopoverRef(origin) {
3315
- const config = this.config;
3316
- if (!origin) {
3317
- throw new Error('Missing origin.');
3318
- }
3319
- return DbxFirebaseModelHistoryPopoverComponent.openPopover(this.dbxPopoverService, Object.assign({ origin }, config));
3320
- }
3321
- showHistoryPopover() {
3322
- const origin = this.buttonElement.nativeElement;
3323
- this.showPopover(origin);
3324
- }
3325
- }
3326
- DbxFirebaseModelHistoryPopoverButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelHistoryPopoverButtonComponent, deps: [{ token: i1$2.DbxPopoverService }], target: i0.ɵɵFactoryTarget.Component });
3327
- DbxFirebaseModelHistoryPopoverButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseModelHistoryPopoverButtonComponent, selector: "dbx-firebase-model-history-popover-button", inputs: { config: "config" }, viewQueries: [{ propertyName: "buttonElement", first: true, predicate: ["button"], descendants: true, read: ElementRef }], usesInheritance: true, ngImport: i0, template: `
3328
- <dbx-icon-button #button (buttonClick)="showHistoryPopover()" icon="history"></dbx-icon-button>
3329
- `, isInline: true, dependencies: [{ kind: "component", type: i1$2.DbxIconButtonComponent, selector: "dbx-icon-button" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3330
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelHistoryPopoverButtonComponent, decorators: [{
3331
- type: Component,
3332
- args: [{
3333
- selector: 'dbx-firebase-model-history-popover-button',
3334
- template: `
3335
- <dbx-icon-button #button (buttonClick)="showHistoryPopover()" icon="history"></dbx-icon-button>
3336
- `,
3337
- changeDetection: ChangeDetectionStrategy.OnPush
3338
- }]
3339
- }], ctorParameters: function () { return [{ type: i1$2.DbxPopoverService }]; }, propDecorators: { buttonElement: [{
3340
- type: ViewChild,
3341
- args: ['button', { read: ElementRef, static: false }]
3342
- }], config: [{
3343
- type: Input
3344
- }] } });
3345
-
3346
- /**
3347
- * Abstract directive that contains a DbxFirebaseDocumentStore and provides an interface for communicating with other directives.
3348
- */
3349
- class DbxFirebaseDocumentStoreDirective {
3350
- constructor(store) {
3351
- this.store = store;
3352
- this.exists$ = this.store.exists$;
3353
- this.document$ = this.store.document$;
3354
- this.documentLoadingState$ = this.store.documentLoadingState$;
3355
- this.id$ = this.store.id$;
3356
- this.key$ = this.store.key$;
3357
- this.ref$ = this.store.ref$;
3358
- this.snapshot$ = this.store.snapshot$;
3359
- this.snapshotLoadingState$ = this.store.snapshotLoadingState$;
3360
- this.modelIdentity$ = this.store.modelIdentity$;
3361
- this.data$ = this.store.data$;
3362
- this.loadingState$ = this.store.dataLoadingState$;
3363
- }
3364
- // MARK: Inputs
3365
- set documentId(documentId) {
3366
- this.store.setId(documentId);
3367
- }
3368
- set key(key) {
3369
- this.store.setKey(key);
3370
- }
3371
- set ref(ref) {
3372
- this.store.setRef(ref);
3373
- }
3374
- set streamMode(streamMode) {
3375
- this.store.setStreamMode(streamMode);
3376
- }
3377
- }
3378
- DbxFirebaseDocumentStoreDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDocumentStoreDirective, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
3379
- DbxFirebaseDocumentStoreDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseDocumentStoreDirective, inputs: { documentId: "documentId", key: "key", ref: "ref", streamMode: "streamMode" }, ngImport: i0 });
3380
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDocumentStoreDirective, decorators: [{
3381
- type: Directive
3382
- }], ctorParameters: function () { return [{ type: undefined }]; }, propDecorators: { documentId: [{
3383
- type: Input
3384
- }], key: [{
3385
- type: Input
3386
- }], ref: [{
3387
- type: Input
3388
- }], streamMode: [{
3389
- type: Input
3390
- }] } });
3391
- function provideDbxFirebaseDocumentStoreDirective(sourceType, storeType) {
3392
- const providers = [
3393
- {
3394
- provide: DbxFirebaseDocumentStoreDirective,
3395
- useExisting: forwardRef(() => sourceType)
3396
- }
3397
- ];
3398
- if (storeType) {
3399
- providers.push(storeType);
3400
- }
3401
- return providers;
3402
- }
3403
-
3404
- /**
3405
- * Used with a DbxFirebaseDocumentStoreDirective to emit model viewed events.
3406
- */
3407
- class DbxfirebaseModelViewedEventDirective extends AbstractSubscriptionDirective {
3408
- constructor(dbxFirebaseDocumentStoreDirective, dbxModelObjectStateService, dbxFirebaseModelTypesService, ngZone) {
3409
- super();
3410
- this.dbxFirebaseDocumentStoreDirective = dbxFirebaseDocumentStoreDirective;
3411
- this.dbxModelObjectStateService = dbxModelObjectStateService;
3412
- this.dbxFirebaseModelTypesService = dbxFirebaseModelTypesService;
3413
- this.ngZone = ngZone;
3414
- }
3415
- ngOnInit() {
3416
- this.sub = this.dbxFirebaseDocumentStoreDirective.data$
3417
- .pipe(
3418
- //
3419
- distinctUntilModelKeyChange(), combineLatestWith(this.dbxFirebaseDocumentStoreDirective.modelIdentity$.pipe(switchMap((x) => this.dbxFirebaseModelTypesService.infoForType(x.modelType)), first()), this.dbxFirebaseDocumentStoreDirective.key$), map(([data, typeInfo, key]) => {
3420
- const displayInfo = this.dbxFirebaseModelTypesService.getDisplayInfo(typeInfo, data);
3421
- const pair = {
3422
- key,
3423
- type: typeInfo.modelType,
3424
- name: displayInfo.title
3425
- };
3426
- return pair;
3427
- }))
3428
- .subscribe((modelKeyTypeNamePair) => {
3429
- this.ngZone.run(() => this.dbxModelObjectStateService.emitModelViewEvent({ modelKeyTypeNamePair, context: this.context || undefined }));
3430
- });
3431
- }
3432
- }
3433
- DbxfirebaseModelViewedEventDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxfirebaseModelViewedEventDirective, deps: [{ token: DbxFirebaseDocumentStoreDirective }, { token: i1$2.DbxModelObjectStateService }, { token: DbxFirebaseModelTypesService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
3434
- DbxfirebaseModelViewedEventDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: DbxfirebaseModelViewedEventDirective, selector: "[dbxFirebaseModelViewedEvent]", inputs: { context: ["dbxFirebaseModelViewedEvent", "context"] }, usesInheritance: true, ngImport: i0 });
3435
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxfirebaseModelViewedEventDirective, decorators: [{
3436
- type: Directive,
3437
- args: [{
3438
- selector: '[dbxFirebaseModelViewedEvent]'
3439
- }]
3440
- }], ctorParameters: function () { return [{ type: DbxFirebaseDocumentStoreDirective }, { type: i1$2.DbxModelObjectStateService }, { type: DbxFirebaseModelTypesService }, { type: i0.NgZone }]; }, propDecorators: { context: [{
3441
- type: Input,
3442
- args: ['dbxFirebaseModelViewedEvent']
3443
- }] } });
3444
-
3445
- const declarations$3 = [DbxfirebaseModelViewedEventDirective, DbxFirebaseModelTypeInstanceComponent, DbxFirebaseModelTypeInstanceViewComponent, DbxFirebaseModelTypeInstanceViewItemComponent];
3446
- class DbxFirebaseModelTypesModule {
3447
- }
3448
- DbxFirebaseModelTypesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelTypesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3449
- DbxFirebaseModelTypesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelTypesModule, declarations: [DbxfirebaseModelViewedEventDirective, DbxFirebaseModelTypeInstanceComponent, DbxFirebaseModelTypeInstanceViewComponent, DbxFirebaseModelTypeInstanceViewItemComponent], imports: [CommonModule, DbxModelInfoModule, DbxListLayoutModule], exports: [DbxfirebaseModelViewedEventDirective, DbxFirebaseModelTypeInstanceComponent, DbxFirebaseModelTypeInstanceViewComponent, DbxFirebaseModelTypeInstanceViewItemComponent] });
3450
- DbxFirebaseModelTypesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelTypesModule, imports: [CommonModule, DbxModelInfoModule, DbxListLayoutModule] });
3451
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelTypesModule, decorators: [{
3452
- type: NgModule,
3453
- args: [{
3454
- imports: [CommonModule, DbxModelInfoModule, DbxListLayoutModule],
3455
- declarations: declarations$3,
3456
- exports: declarations$3
3457
- }]
3458
- }] });
3459
-
3460
- const declarations$2 = [DbxFirebaseModelHistoryComponent, DbxFirebaseModelHistoryPopoverButtonComponent, DbxFirebaseModelHistoryPopoverComponent];
3461
- class DbxFirebaseModelHistoryModule {
3462
- }
3463
- DbxFirebaseModelHistoryModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelHistoryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3464
- DbxFirebaseModelHistoryModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelHistoryModule, declarations: [DbxFirebaseModelHistoryComponent, DbxFirebaseModelHistoryPopoverButtonComponent, DbxFirebaseModelHistoryPopoverComponent], imports: [CommonModule, DbxButtonModule, DbxRouterListModule, DbxPopoverInteractionModule, DbxModelInfoModule, DbxListLayoutModule, DbxFirebaseModelTypesModule], exports: [DbxFirebaseModelHistoryComponent, DbxFirebaseModelHistoryPopoverButtonComponent, DbxFirebaseModelHistoryPopoverComponent] });
3465
- DbxFirebaseModelHistoryModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelHistoryModule, imports: [CommonModule, DbxButtonModule, DbxRouterListModule, DbxPopoverInteractionModule, DbxModelInfoModule, DbxListLayoutModule, DbxFirebaseModelTypesModule] });
3466
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelHistoryModule, decorators: [{
3467
- type: NgModule,
3468
- args: [{
3469
- imports: [CommonModule, DbxButtonModule, DbxRouterListModule, DbxPopoverInteractionModule, DbxModelInfoModule, DbxListLayoutModule, DbxFirebaseModelTypesModule],
3470
- declarations: declarations$2,
3471
- exports: declarations$2
3472
- }]
3473
- }] });
3474
-
3475
- /**
3476
- * Configures a SourceSelectLoadSource using the DbxFirebaseModelTrackerService to load models of a specific identity.
3477
- *
3478
- * @param config
3479
- * @returns
3480
- */
3481
- function dbxFirebaseSourceSelectLoadSource(config) {
3482
- const { label = 'History', identity, mapToMeta, filterItem, dbxFirebaseModelTrackerService } = config;
3483
- const historyValuesObs = dbxFirebaseModelTrackerService.filterHistoryPairs({ identity, filterItem });
3484
- const metaObs = historyValuesObs.pipe(mapEachAsync(mapToMeta));
3485
- const meta = loadingStateFromObs(metaObs);
3486
- return {
3487
- label,
3488
- meta
3489
- };
3490
- }
3491
-
3492
- /**
3493
- * Abstract directive that contains a DbxFirebaseCollectionStore and provides an interface for communicating with other directives.
3494
- */
3495
- class DbxFirebaseCollectionStoreDirective {
3496
- constructor(store) {
3497
- this.store = store;
3498
- this.pageLoadingState$ = this.store.pageLoadingState$;
3499
- }
3500
- // MARK: Inputs
3501
- set maxPages(maxPages) {
3502
- this.store.setMaxPages(maxPages);
3503
- }
3504
- set itemsPerPage(itemsPerPage) {
3505
- this.store.setItemsPerPage(itemsPerPage);
3506
- }
3507
- set constraints(constraints) {
3508
- this.store.setConstraints(constraints);
3509
- }
3510
- next() {
3511
- this.store.next();
3512
- }
3513
- restart() {
3514
- this.store.restart();
3515
- }
3516
- setConstraints(constraints) {
3517
- this.store.setConstraints(constraints);
3518
- }
3519
- }
3520
- DbxFirebaseCollectionStoreDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseCollectionStoreDirective, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
3521
- DbxFirebaseCollectionStoreDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseCollectionStoreDirective, inputs: { maxPages: "maxPages", itemsPerPage: "itemsPerPage", constraints: "constraints" }, ngImport: i0 });
3522
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseCollectionStoreDirective, decorators: [{
3523
- type: Directive
3524
- }], ctorParameters: function () { return [{ type: undefined }]; }, propDecorators: { maxPages: [{
3525
- type: Input
3526
- }], itemsPerPage: [{
3527
- type: Input
3528
- }], constraints: [{
3529
- type: Input
3530
- }] } });
3531
- function provideDbxFirebaseCollectionStoreDirective(sourceType, storeType) {
3532
- const providers = [
3533
- {
3534
- provide: DbxFirebaseCollectionStoreDirective,
3535
- useExisting: forwardRef(() => sourceType)
3536
- }
3537
- ];
3538
- if (storeType) {
3539
- providers.push(storeType);
3540
- }
3541
- return providers;
3542
- }
3543
-
3544
- /**
3545
- * Used to watch query doc changes and respond to them accordingly.
3546
- */
3547
- class DbxFirebaseCollectionChangeDirective {
3548
- constructor(dbxFirebaseCollectionStoreDirective) {
3549
- this.dbxFirebaseCollectionStoreDirective = dbxFirebaseCollectionStoreDirective;
3550
- this._watcher = dbxFirebaseCollectionChangeWatcher(this.dbxFirebaseCollectionStoreDirective.store);
3551
- this._trigger = dbxFirebaseCollectionChangeTriggerForWatcher(this._watcher, () => this.restart());
3552
- this.mode$ = this._watcher.mode$;
3553
- this.event$ = this._watcher.event$;
3554
- this.hasChangeAvailable$ = this._watcher.hasChangeAvailable$;
3555
- this.triggered$ = this._watcher.triggered$;
3556
- this.trigger$ = this._watcher.trigger$;
3557
- }
3558
- get store() {
3559
- return this._watcher.store;
3560
- }
3561
- ngOnInit() {
3562
- this._trigger.init();
3563
- }
3564
- ngOnDestroy() {
3565
- this._watcher.destroy();
3566
- this._trigger.destroy();
3567
- }
3568
- get mode() {
3569
- return this._watcher.mode;
3570
- }
3571
- set mode(mode) {
3572
- this._watcher.mode = mode || 'off';
3573
- }
3574
- restart() {
3575
- this.dbxFirebaseCollectionStoreDirective.store.restart();
3576
- }
3577
- }
3578
- DbxFirebaseCollectionChangeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseCollectionChangeDirective, deps: [{ token: DbxFirebaseCollectionStoreDirective }], target: i0.ɵɵFactoryTarget.Directive });
3579
- DbxFirebaseCollectionChangeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseCollectionChangeDirective, selector: "[dbxFirebaseCollectionChange]", inputs: { mode: ["dbxFirebaseCollectionChange", "mode"] }, ngImport: i0 });
3580
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseCollectionChangeDirective, decorators: [{
3581
- type: Directive,
3582
- args: [{
3583
- selector: '[dbxFirebaseCollectionChange]'
3584
- }]
3585
- }], ctorParameters: function () { return [{ type: DbxFirebaseCollectionStoreDirective }]; }, propDecorators: { mode: [{
3586
- type: Input,
3587
- args: ['dbxFirebaseCollectionChange']
3588
- }] } });
3589
-
3590
- /**
3591
- * Structural directive that displays the content when the target change is detected.
3592
- *
3593
- * Can specify which changes to appear on.
3594
- */
3595
- class DbxFirebaseCollectionHasChangeDirective extends AbstractIfDirective {
3596
- constructor(templateRef, viewContainer, directive) {
3597
- super(templateRef, viewContainer);
3598
- this.directive = directive;
3599
- this._mode = new BehaviorSubject('addedAndRemoved');
3600
- this.show$ = combineLatest([this._mode, this.directive.event$]).pipe(map(([mode, event]) => {
3601
- let show = false;
3602
- if (event.type !== 'none') {
3603
- switch (mode) {
3604
- case 'all':
3605
- show = true;
3606
- break;
3607
- case 'addedAndRemoved':
3608
- show = event.type === 'addedAndRemoved' || event.type === 'added' || event.type === 'removed';
3609
- break;
3610
- default:
3611
- show = event.type === mode;
3612
- break;
3613
- }
3614
- }
3615
- return show;
3616
- }), shareReplay(1));
3617
- }
3618
- get mode() {
3619
- return this._mode.value;
3620
- }
3621
- set mode(mode) {
3622
- this._mode.next(mode || 'addedAndRemoved');
3623
- }
3624
- ngOnDestroy() {
3625
- super.ngOnDestroy();
3626
- this._mode.complete();
3627
- }
3628
- }
3629
- DbxFirebaseCollectionHasChangeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseCollectionHasChangeDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: DbxFirebaseCollectionChangeDirective }], target: i0.ɵɵFactoryTarget.Directive });
3630
- DbxFirebaseCollectionHasChangeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseCollectionHasChangeDirective, selector: "[dbxFirebaseCollectionHasChange]", inputs: { mode: ["dbxFirebaseCollectionHasChange", "mode"] }, usesInheritance: true, ngImport: i0 });
3631
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseCollectionHasChangeDirective, decorators: [{
3632
- type: Directive,
3633
- args: [{
3634
- selector: '[dbxFirebaseCollectionHasChange]'
3635
- }]
3636
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: DbxFirebaseCollectionChangeDirective }]; }, propDecorators: { mode: [{
3637
- type: Input,
3638
- args: ['dbxFirebaseCollectionHasChange']
3639
- }] } });
3640
-
3641
- /**
3642
- * Directive that connects a host DbxListView to a DbxFirebaseCollectionStoreDirective to pass data for rendering items from a collection and query parameters.
3643
- */
3644
- class DbxFirebaseCollectionListDirective extends AbstractSubscriptionDirective {
3645
- constructor(dbxFirebaseCollectionStoreDirective, dbxListViewWrapper) {
3646
- super();
3647
- this.dbxFirebaseCollectionStoreDirective = dbxFirebaseCollectionStoreDirective;
3648
- this.dbxListViewWrapper = dbxListViewWrapper;
3649
- this.dbxListViewWrapper.state$ = this.dbxFirebaseCollectionStoreDirective.pageLoadingState$;
3650
- }
3651
- ngOnInit() {
3652
- var _a;
3653
- this.sub = (_a = this.dbxListViewWrapper.loadMore) === null || _a === void 0 ? void 0 : _a.subscribe(() => {
3654
- this.dbxFirebaseCollectionStoreDirective.next();
3655
- });
3656
- }
3657
- }
3658
- DbxFirebaseCollectionListDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseCollectionListDirective, deps: [{ token: DbxFirebaseCollectionStoreDirective }, { token: i1$2.DbxListViewWrapper, host: true }], target: i0.ɵɵFactoryTarget.Directive });
3659
- DbxFirebaseCollectionListDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseCollectionListDirective, selector: "[dbxFirebaseCollectionList]", usesInheritance: true, ngImport: i0 });
3660
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseCollectionListDirective, decorators: [{
3661
- type: Directive,
3662
- args: [{
3663
- selector: '[dbxFirebaseCollectionList]'
3664
- }]
3665
- }], ctorParameters: function () {
3666
- return [{ type: DbxFirebaseCollectionStoreDirective }, { type: i1$2.DbxListViewWrapper, decorators: [{
3667
- type: Host
3668
- }] }];
3669
- } });
3670
-
3671
- /**
3672
- * Utility directive for a host DbxFirebaseDocumentStoreDirective that sets the document's ID to match the ID of the current user.
3673
- *
3674
- * This is useful for cases where each document is keyed by the user (I.E. implements UserRelatedById).
3675
- */
3676
- class DbxFirebaseDocumentAuthIdDirective extends AbstractSubscriptionDirective {
3677
- constructor(dbxFirebaseAuthService, dbxFirebaseDocumentStoreDirective) {
3678
- super();
3679
- this.dbxFirebaseAuthService = dbxFirebaseAuthService;
3680
- this.dbxFirebaseDocumentStoreDirective = dbxFirebaseDocumentStoreDirective;
3681
- }
3682
- ngOnInit() {
3683
- this.sub = this.dbxFirebaseDocumentStoreDirective.store.setId(this.dbxFirebaseAuthService.userIdentifier$);
3684
- }
3685
- }
3686
- DbxFirebaseDocumentAuthIdDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDocumentAuthIdDirective, deps: [{ token: DbxFirebaseAuthService }, { token: DbxFirebaseDocumentStoreDirective, host: true }], target: i0.ɵɵFactoryTarget.Directive });
3687
- DbxFirebaseDocumentAuthIdDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseDocumentAuthIdDirective, selector: "[dbxFirebaseDocumentAuthId]", usesInheritance: true, ngImport: i0 });
3688
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDocumentAuthIdDirective, decorators: [{
3689
- type: Directive,
3690
- args: [{
3691
- selector: '[dbxFirebaseDocumentAuthId]'
3692
- }]
3693
- }], ctorParameters: function () {
3694
- return [{ type: DbxFirebaseAuthService }, { type: DbxFirebaseDocumentStoreDirective, decorators: [{
3695
- type: Host
3696
- }] }];
3697
- } });
3698
-
3699
- const DBX_FIREBASE_ID_ROUTER_PARAM_DEFAULT_ID_PARAM_KEY = 'id';
3700
- const DBX_FIREBASE_ID_ROUTER_PARAM_DEFAULT_KEY_PARAM_KEY = 'key';
3701
- const DBX_FIREBASE_ID_ROUTER_PARAM_DEFAULT_USE_PARAM_VALUE = '0';
3702
- /**
3703
- * DbxFirebaseIdRouteParamRedirect instance
3704
- */
3705
- class DbxFirebaseIdRouteParamRedirectInstance {
3706
- constructor(dbxRouterService, defaultParamKey = DBX_FIREBASE_ID_ROUTER_PARAM_DEFAULT_ID_PARAM_KEY) {
3707
- this.dbxRouterService = dbxRouterService;
3708
- this.defaultParamKey = defaultParamKey;
3709
- this._paramReader = new DbxRouteParamReaderInstance(this.dbxRouterService, this.defaultParamKey);
3710
- this._paramRedirect = new DbxRouteParamDefaultRedirectInstance(this._paramReader);
3711
- this._useDefaultParamDecider = new BehaviorSubject(DBX_FIREBASE_ID_ROUTER_PARAM_DEFAULT_USE_PARAM_VALUE);
3712
- this._useDefaultParam$ = this._useDefaultParamDecider.pipe(map((x) => {
3713
- let result;
3714
- if (typeof x === 'string') {
3715
- result = (value) => of(value === x);
3716
- }
3717
- else {
3718
- result = x;
3719
- }
3720
- return result;
3721
- }), shareReplay(1));
3722
- this.paramValue$ = this._paramReader.paramValue$;
3723
- this.defaultValue$ = this._paramReader.defaultValue$;
3724
- this.value$ = this._paramReader.value$;
3725
- this.idFromParams$ = this.paramValue$;
3726
- this.id$ = this.value$;
3727
- }
3728
- init() {
3729
- this._paramRedirect.setUseDefaultFilter((value) => {
3730
- return this._useDefaultParam$.pipe(switchMap((x) => x(value)));
3731
- });
3732
- this._paramRedirect.init();
3733
- }
3734
- destroy() {
3735
- this._paramReader.destroy();
3736
- this._paramRedirect.destroy();
3737
- this._useDefaultParamDecider.complete();
3738
- }
3739
- get paramKey() {
3740
- return this._paramReader.paramKey;
3741
- }
3742
- set paramKey(paramKey) {
3743
- this._paramReader.paramKey = paramKey || this.defaultParamKey;
3744
- }
3745
- setDefaultValue(defaultValue) {
3746
- this._paramReader.setDefaultValue(defaultValue);
3747
- }
3748
- setRedirectEnabled(redirect) {
3749
- this._paramRedirect.enabled = redirect !== false;
3750
- }
3751
- setDecider(decider) {
3752
- this._useDefaultParamDecider.next(decider);
3753
- }
3754
- setParamValue(value) {
3755
- this._paramReader.setParamValue(value);
3756
- }
3757
- }
3758
- function dbxFirebaseIdRouteParamRedirect(dbxRouterService, defaultParamKey) {
3759
- return new DbxFirebaseIdRouteParamRedirectInstance(dbxRouterService, defaultParamKey);
3760
- }
3761
- function dbxFirebaseKeyRouteParamRedirect(dbxRouterService, defaultParamKey = DBX_FIREBASE_ID_ROUTER_PARAM_DEFAULT_KEY_PARAM_KEY) {
3762
- return new DbxFirebaseIdRouteParamRedirectInstance(dbxRouterService, defaultParamKey);
3763
- }
3764
-
3765
- /**
3766
- * Used for synchronizing the document store id to the param of the route.
3767
- */
3768
- class DbxFirebaseDocumentStoreRouteIdDirective extends AbstractSubscriptionDirective {
3769
- constructor(dbxFirebaseDocumentStoreDirective, dbxRouterService) {
3770
- super();
3771
- this.dbxFirebaseDocumentStoreDirective = dbxFirebaseDocumentStoreDirective;
3772
- this.dbxRouterService = dbxRouterService;
3773
- this._redirectInstance = dbxFirebaseIdRouteParamRedirect(this.dbxRouterService);
3774
- this.idFromParams$ = this._redirectInstance.paramValue$;
3775
- this.id$ = this._redirectInstance.value$;
3776
- }
3777
- ngOnInit() {
3778
- this.sub = this.dbxFirebaseDocumentStoreDirective.store.setId(this.idFromParams$); // use from the params, as the params should get updated eventually to the id$ value
3779
- this._redirectInstance.init();
3780
- }
3781
- ngOnDestroy() {
3782
- super.ngOnDestroy();
3783
- this._redirectInstance.destroy();
3784
- }
3785
- // MARK: Input
3786
- get idParam() {
3787
- return this._redirectInstance.paramKey;
3788
- }
3789
- set idParam(idParam) {
3790
- this._redirectInstance.paramKey = idParam;
3791
- }
3792
- set dbxFirebaseDocumentStoreRouteIdDefault(defaultValue) {
3793
- this._redirectInstance.setDefaultValue(defaultValue);
3794
- }
3795
- /**
3796
- * Whether or not to enable the redirection. Is enabled by default.
3797
- */
3798
- set dbxFirebaseDocumentStoreRouteIdDefaultRedirect(redirect) {
3799
- this._redirectInstance.setRedirectEnabled(redirect !== false); // true by default
3800
- }
3801
- set dbxFirebaseDocumentStoreRouteIdDefaultDecision(decider) {
3802
- this._redirectInstance.setDecider(decider);
3803
- }
3804
- }
3805
- DbxFirebaseDocumentStoreRouteIdDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDocumentStoreRouteIdDirective, deps: [{ token: DbxFirebaseDocumentStoreDirective, host: true }, { token: i2$2.DbxRouterService }], target: i0.ɵɵFactoryTarget.Directive });
3806
- DbxFirebaseDocumentStoreRouteIdDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseDocumentStoreRouteIdDirective, selector: "[dbxFirebaseDocumentStoreRouteId]", inputs: { idParam: ["dbxFirebaseDocumentStoreRouteId", "idParam"], dbxFirebaseDocumentStoreRouteIdDefault: "dbxFirebaseDocumentStoreRouteIdDefault", dbxFirebaseDocumentStoreRouteIdDefaultRedirect: "dbxFirebaseDocumentStoreRouteIdDefaultRedirect", dbxFirebaseDocumentStoreRouteIdDefaultDecision: "dbxFirebaseDocumentStoreRouteIdDefaultDecision" }, usesInheritance: true, ngImport: i0 });
3807
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDocumentStoreRouteIdDirective, decorators: [{
3808
- type: Directive,
3809
- args: [{
3810
- selector: '[dbxFirebaseDocumentStoreRouteId]'
3811
- }]
3812
- }], ctorParameters: function () {
3813
- return [{ type: DbxFirebaseDocumentStoreDirective, decorators: [{
3814
- type: Host
3815
- }] }, { type: i2$2.DbxRouterService }];
3816
- }, propDecorators: { idParam: [{
3817
- type: Input,
3818
- args: ['dbxFirebaseDocumentStoreRouteId']
3819
- }], dbxFirebaseDocumentStoreRouteIdDefault: [{
3820
- type: Input
3821
- }], dbxFirebaseDocumentStoreRouteIdDefaultRedirect: [{
3822
- type: Input
3823
- }], dbxFirebaseDocumentStoreRouteIdDefaultDecision: [{
3824
- type: Input
3825
- }] } });
3826
-
3827
- /**
3828
- * Used for synchronizing the document store key to the param of the route. The param is interpreted as a TwoWayFlatFirestoreModelKey.
3829
- */
3830
- class DbxFirebaseDocumentStoreRouteKeyDirective extends AbstractSubscriptionDirective {
3831
- constructor(dbxFirebaseDocumentStoreDirective, dbxRouterService) {
3832
- super();
3833
- this.dbxFirebaseDocumentStoreDirective = dbxFirebaseDocumentStoreDirective;
3834
- this.dbxRouterService = dbxRouterService;
3835
- this._redirectInstance = dbxFirebaseKeyRouteParamRedirect(this.dbxRouterService);
3836
- this.keyFromParams$ = this._redirectInstance.paramValue$;
3837
- this.key$ = this._redirectInstance.value$;
3838
- }
3839
- ngOnInit() {
3840
- this.sub = this.dbxFirebaseDocumentStoreDirective.store.setFlatKey(this.keyFromParams$); // use from the params, as the params should get updated eventually to the key$ value
3841
- this._redirectInstance.init();
3842
- }
3843
- ngOnDestroy() {
3844
- super.ngOnDestroy();
3845
- this._redirectInstance.destroy();
3846
- }
3847
- // MARK: Input
3848
- get keyParam() {
3849
- return this._redirectInstance.paramKey;
3850
- }
3851
- set keyParam(keyParam) {
3852
- this._redirectInstance.paramKey = keyParam;
3853
- }
3854
- set dbxFirebaseDocumentStoreRouteKeyDefault(defaultValue) {
3855
- this._redirectInstance.setDefaultValue(defaultValue);
3856
- }
3857
- /**
3858
- * Whether or not to enable the redirection. Is enabled by default.
3859
- */
3860
- set dbxFirebaseDocumentStoreRouteKeyDefaultRedirect(redirect) {
3861
- this._redirectInstance.setRedirectEnabled(redirect !== false); // true by default
3862
- }
3863
- set dbxFirebaseDocumentStoreRouteKeyDefaultDecision(decider) {
3864
- this._redirectInstance.setDecider(decider);
3865
- }
3866
- }
3867
- DbxFirebaseDocumentStoreRouteKeyDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDocumentStoreRouteKeyDirective, deps: [{ token: DbxFirebaseDocumentStoreDirective, host: true }, { token: i2$2.DbxRouterService }], target: i0.ɵɵFactoryTarget.Directive });
3868
- DbxFirebaseDocumentStoreRouteKeyDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseDocumentStoreRouteKeyDirective, selector: "[dbxFirebaseDocumentStoreRouteKey]", inputs: { keyParam: ["dbxFirebaseDocumentStoreRouteKey", "keyParam"], dbxFirebaseDocumentStoreRouteKeyDefault: "dbxFirebaseDocumentStoreRouteKeyDefault", dbxFirebaseDocumentStoreRouteKeyDefaultRedirect: "dbxFirebaseDocumentStoreRouteKeyDefaultRedirect", dbxFirebaseDocumentStoreRouteKeyDefaultDecision: "dbxFirebaseDocumentStoreRouteKeyDefaultDecision" }, usesInheritance: true, ngImport: i0 });
3869
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseDocumentStoreRouteKeyDirective, decorators: [{
3870
- type: Directive,
3871
- args: [{
3872
- selector: '[dbxFirebaseDocumentStoreRouteKey]'
3873
- }]
3874
- }], ctorParameters: function () {
3875
- return [{ type: DbxFirebaseDocumentStoreDirective, decorators: [{
3876
- type: Host
3877
- }] }, { type: i2$2.DbxRouterService }];
3878
- }, propDecorators: { keyParam: [{
3879
- type: Input,
3880
- args: ['dbxFirebaseDocumentStoreRouteKey']
3881
- }], dbxFirebaseDocumentStoreRouteKeyDefault: [{
3882
- type: Input
3883
- }], dbxFirebaseDocumentStoreRouteKeyDefaultRedirect: [{
3884
- type: Input
3885
- }], dbxFirebaseDocumentStoreRouteKeyDefaultDecision: [{
3886
- type: Input
3887
- }] } });
3888
-
3889
- const declarations$1 = [DbxFirebaseDocumentStoreRouteKeyDirective, DbxFirebaseCollectionListDirective, DbxFirebaseCollectionChangeDirective, DbxFirebaseCollectionHasChangeDirective, DbxFirebaseDocumentStoreRouteIdDirective, DbxFirebaseDocumentAuthIdDirective];
3890
- class DbxFirebaseModelStoreModule {
3891
- }
3892
- DbxFirebaseModelStoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelStoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3893
- DbxFirebaseModelStoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelStoreModule, declarations: [DbxFirebaseDocumentStoreRouteKeyDirective, DbxFirebaseCollectionListDirective, DbxFirebaseCollectionChangeDirective, DbxFirebaseCollectionHasChangeDirective, DbxFirebaseDocumentStoreRouteIdDirective, DbxFirebaseDocumentAuthIdDirective], exports: [DbxFirebaseDocumentStoreRouteKeyDirective, DbxFirebaseCollectionListDirective, DbxFirebaseCollectionChangeDirective, DbxFirebaseCollectionHasChangeDirective, DbxFirebaseDocumentStoreRouteIdDirective, DbxFirebaseDocumentAuthIdDirective] });
3894
- DbxFirebaseModelStoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelStoreModule });
3895
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelStoreModule, decorators: [{
3896
- type: NgModule,
3897
- args: [{
3898
- imports: [],
3899
- declarations: declarations$1,
3900
- exports: declarations$1
3901
- }]
3902
- }] });
3903
-
3904
- class AbstractDbxFirebaseCollectionStore extends LockSetComponentStore {
3905
- constructor() {
3906
- super(...arguments);
3907
- // MARK: Effects
3908
- this.setMaxPages = this.effect((input) => {
3909
- return input.pipe(switchMap((maxPages) => this.loader$.pipe(tap((x) => (x.maxPages = maxPages)))));
3910
- });
3911
- this.setItemsPerPage = this.effect((input) => {
3912
- return input.pipe(switchMap((itemsPerPage) => this.loader$.pipe(tap((x) => (x.itemsPerPage = itemsPerPage)))));
3913
- });
3914
- this.setConstraints = this.effect((input) => {
3915
- return input.pipe(switchMap((constraints) => this.loader$.pipe(tap((x) => x.setConstraints(constraints)))));
3916
- });
3917
- this.next = this.effect((input) => {
3918
- return input.pipe(exhaustMap(() => this.loader$.pipe(first(), tap((x) => x.next()))));
3919
- });
3920
- this.restart = this.effect((input) => {
3921
- return input.pipe(exhaustMap(() => this.loader$.pipe(first(), tap((x) => x.restart()))));
3922
- });
3923
- // MARK: Accessors
3924
- this.currentFirestoreCollection$ = this.state$.pipe(map((x) => x.firestoreCollection), distinctUntilChanged(), shareReplay(1));
3925
- this.firestoreCollection$ = this.currentFirestoreCollection$.pipe(filterMaybe());
3926
- this.loader$ = this.currentFirestoreCollection$.pipe(switchMap((collection) => this.state$.pipe(first(), map((x) => dbxFirebaseCollectionLoaderInstance({
3927
- collection,
3928
- maxPages: x.maxPages,
3929
- itemsPerPage: x.itemsPerPage,
3930
- constraints: x.constraints
3931
- })))), cleanupDestroyable(), distinctUntilChanged(), shareReplay(1));
3932
- this.constraints$ = this.loader$.pipe(switchMap((x) => x.constraints$));
3933
- this.firestoreIteration$ = this.loader$.pipe(switchMap((x) => x.firestoreIteration$));
3934
- this.queryChangeWatcher$ = this.loader$.pipe(switchMap((x) => x.queryChangeWatcher$));
3935
- this.accumulator$ = this.loader$.pipe(switchMap((x) => x.accumulator$));
3936
- this.pageLoadingState$ = this.loader$.pipe(switchMap((x) => x.pageLoadingState$));
3937
- this.hasDocuments$ = this.loader$.pipe(switchMap((x) => x.hasDocuments$));
3938
- this.allDocumentRefs$ = this.loader$.pipe(switchMap((x) => x.allDocumentRefs$));
3939
- this.allDocuments$ = this.loader$.pipe(switchMap((x) => x.allDocuments$));
3940
- this.allDocumentData$ = this.loader$.pipe(switchMap((x) => x.allDocumentData$));
3941
- this.setFirestoreCollection = this.updater((state, firestoreCollection) => (Object.assign(Object.assign({}, state), { firestoreCollection })));
3942
- }
3943
- }
3944
- AbstractDbxFirebaseCollectionStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AbstractDbxFirebaseCollectionStore, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
3945
- AbstractDbxFirebaseCollectionStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AbstractDbxFirebaseCollectionStore });
3946
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AbstractDbxFirebaseCollectionStore, decorators: [{
3947
- type: Injectable
3948
- }] });
3949
-
3950
- const DBX_FIREBASE_MODEL_DOES_NOT_EXIST_ERROR = 'DOES_NOT_EXIST';
3951
- function modelDoesNotExistError() {
3952
- return readableError(DBX_FIREBASE_MODEL_DOES_NOT_EXIST_ERROR, 'The document does not exist.');
3953
- }
3954
-
3955
- class AbstractDbxFirebaseDocumentStore extends LockSetComponentStore {
3956
- constructor() {
3957
- super(...arguments);
3958
- // MARK: Effects
3959
- // MARK: Accessors
3960
- this.currentFirestoreCollectionLike$ = this.state$.pipe(map((x) => { var _a; return (_a = x.firestoreCollection) !== null && _a !== void 0 ? _a : x.firestoreCollectionLike; }), distinctUntilChanged(), shareReplay(1));
3961
- this.currentFirestoreCollection$ = this.state$.pipe(map((x) => x.firestoreCollection), distinctUntilChanged(), shareReplay(1));
3962
- this.firestoreCollectionLike$ = this.currentFirestoreCollectionLike$.pipe(filterMaybe());
3963
- this.firestoreCollection$ = this.currentFirestoreCollection$.pipe(filterMaybe());
3964
- this.currentInputId$ = this.state$.pipe(map((x) => x.id), distinctUntilChanged(), shareReplay(1));
3965
- this.inputId$ = this.currentInputId$.pipe(filterMaybe(), distinctUntilChanged(), shareReplay(1));
3966
- this.currentInputKey$ = this.state$.pipe(map((x) => x.key), distinctUntilChanged(), shareReplay(1));
3967
- this.inputKey$ = this.currentInputKey$.pipe(filterMaybe(), distinctUntilChanged(), shareReplay(1));
3968
- this.currentInputRef$ = this.state$.pipe(map((x) => x.ref), distinctUntilChanged(), shareReplay(1));
3969
- this.inputRef$ = this.currentInputRef$.pipe(filterMaybe(), distinctUntilChanged(), shareReplay(1));
3970
- this.streamMode$ = this.state$.pipe(map((x) => { var _a; return (_a = x.streamMode) !== null && _a !== void 0 ? _a : FirestoreAccessorStreamMode.STREAM; }), distinctUntilChanged(), shareReplay(1));
3971
- this.currentDocument$ = combineLatest([this.currentInputId$, this.currentInputKey$, this.currentInputRef$]).pipe(switchMap(([id, key, ref]) => {
3972
- let document;
3973
- if (ref) {
3974
- document = this.firestoreCollectionLike$.pipe(map((x) => x.documentAccessor().loadDocument(ref)));
3975
- }
3976
- else if (key) {
3977
- document = this.firestoreCollectionLike$.pipe(map((x) => x.documentAccessor().loadDocumentForKey(key)));
3978
- }
3979
- else if (id) {
3980
- document = this.firestoreCollection$.pipe(map((x) => x.documentAccessor().loadDocumentForId(id)));
3981
- }
3982
- else {
3983
- document = of(undefined);
3984
- }
3985
- return document;
3986
- }), distinctUntilChanged(), shareReplay(1));
3987
- /**
3988
- * Whether or not an id/ref/key has been input and currentDocument is not null.
3989
- */
3990
- this.hasRef$ = this.currentDocument$.pipe(map((x) => (x === null || x === void 0 ? void 0 : x.documentRef) != null), distinctUntilChanged(), shareReplay(1));
3991
- this.document$ = this.currentDocument$.pipe(filterMaybe(), distinctUntilChanged(), shareReplay(1));
3992
- this.documentLoadingState$ = this.currentDocument$.pipe(map((x) => (x ? successResult(x) : beginLoading())), shareReplay(1));
3993
- this.id$ = this.document$.pipe(map((x) => x.id), shareReplay(1));
3994
- this.key$ = this.document$.pipe(map((x) => x.key), shareReplay(1));
3995
- this.keyModelIds$ = this.key$.pipe(map(firestoreModelIdsFromKey), shareReplay(1));
3996
- this.keyPairs$ = this.key$.pipe(map(firestoreModelKeyPartPairs), filterMaybe(), shareReplay(1));
3997
- this.keyPairObject$ = this.key$.pipe(map(firestoreModelKeyPairObject), filterMaybe(), shareReplay(1));
3998
- this.ref$ = this.document$.pipe(map((x) => x.documentRef), shareReplay(1));
3999
- this.flatKey$ = this.key$.pipe(map((x) => flatFirestoreModelKey(x)), shareReplay(1));
4000
- this.twoWayFlatKey$ = this.key$.pipe(map((x) => twoWayFlatFirestoreModelKey(x)), shareReplay(1));
4001
- this.snapshot$ = combineLatest([this.document$, this.streamMode$]).pipe(switchMap(([x, mode]) => x.snapshotStream(mode)), shareReplay(1));
4002
- this.snapshotLoadingState$ = this.currentDocument$.pipe(switchMap(() => loadingStateFromObs(this.snapshot$)), shareReplay(1));
4003
- this.currentData$ = this.snapshot$.pipe(map((x) => documentDataWithIdAndKey(x)), shareReplay(1));
4004
- this.data$ = this.currentDocument$.pipe(switchMap(() => this.currentData$.pipe(filterMaybe())), shareReplay(1));
4005
- this.dataLoadingState$ = this.snapshotLoadingState$.pipe(map((x) => {
4006
- let result;
4007
- if (x.value) {
4008
- const data = documentDataWithIdAndKey(x.value);
4009
- if (data) {
4010
- result = successResult(data);
4011
- }
4012
- else {
4013
- result = errorResult(modelDoesNotExistError());
4014
- }
4015
- }
4016
- else {
4017
- result = Object.assign(Object.assign({}, x), { value: undefined });
4018
- }
4019
- return result;
4020
- }), shareReplay(1));
4021
- /**
4022
- * Returns false while hasRef$ is false, and then returns exists$.
4023
- */
4024
- this.currentExists$ = this.hasRef$.pipe(switchMap((hasRef) => {
4025
- if (hasRef) {
4026
- return this.exists$;
4027
- }
4028
- else {
4029
- return of(false);
4030
- }
4031
- }), shareReplay(1));
4032
- this.exists$ = this.currentData$.pipe(map((x) => isMaybeSo(x)), shareReplay(1));
4033
- this.doesNotExist$ = this.exists$.pipe(map((x) => !x), shareReplay(1));
4034
- this.modelIdentity$ = this.document$.pipe(map((x) => x.modelIdentity), shareReplay(1));
4035
- // MARK: State Changes
4036
- this.setId = this.updater((state, id) => (id ? Object.assign(Object.assign({}, state), { id, key: undefined, ref: undefined }) : Object.assign(Object.assign({}, state), { id })));
4037
- this.setKey = this.updater((state, key) => (key ? Object.assign(Object.assign({}, state), { key, id: undefined, ref: undefined }) : Object.assign(Object.assign({}, state), { key })));
4038
- this.setFlatKey = this.updater((state, key) => (key ? Object.assign(Object.assign({}, state), { key: inferKeyFromTwoWayFlatFirestoreModelKey(key), id: undefined, ref: undefined }) : Object.assign(Object.assign({}, state), { key })));
4039
- this.setRef = this.updater((state, ref) => (ref ? Object.assign(Object.assign({}, state), { key: undefined, id: undefined, ref }) : Object.assign(Object.assign({}, state), { ref })));
4040
- this.setStreamMode = this.updater((state, streamMode) => (Object.assign(Object.assign({}, state), { streamMode })));
4041
- this.clearRefs = this.updater((state) => (Object.assign(Object.assign({}, state), { id: undefined, key: undefined, ref: undefined })));
4042
- this.setFirestoreCollection = this.updater((state, firestoreCollection) => (Object.assign(Object.assign({}, state), { firestoreCollection })));
4043
- this.setFirestoreCollectionLike = this.updater((state, firestoreCollectionLike) => (Object.assign(Object.assign({}, state), { firestoreCollectionLike })));
4044
- }
4045
- }
4046
- AbstractDbxFirebaseDocumentStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AbstractDbxFirebaseDocumentStore, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
4047
- AbstractDbxFirebaseDocumentStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AbstractDbxFirebaseDocumentStore });
4048
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AbstractDbxFirebaseDocumentStore, decorators: [{
4049
- type: Injectable
4050
- }] });
4051
- function injectSingleItemIdIntoState(state) {
4052
- var _a;
4053
- const id = (_a = state === null || state === void 0 ? void 0 : state.firestoreCollection) === null || _a === void 0 ? void 0 : _a.singleItemIdentifier;
4054
- if (state && id != null) {
4055
- return Object.assign(Object.assign({}, state), { id });
4056
- }
4057
- else {
4058
- return state;
4059
- }
4060
- }
4061
- /**
4062
- * AbstractDbxFirebaseDocumentWithParentStore extension for use with RootSingleItemFirestoreCollection.
4063
- */
4064
- let AbstractRootSingleItemDbxFirebaseDocument = class AbstractRootSingleItemDbxFirebaseDocument extends AbstractDbxFirebaseDocumentStore {
4065
- constructor(initialState) {
4066
- super(injectSingleItemIdIntoState(initialState));
4067
- /**
4068
- * Sets the SingleItemFirestoreCollection to use.
4069
- */
4070
- this.setFirestoreCollection = this.updater((state, firestoreCollection) => {
4071
- if (firestoreCollection != null) {
4072
- const id = firestoreCollection.singleItemIdentifier;
4073
- if (id != null) {
4074
- return Object.assign(Object.assign({}, state), { firestoreCollection, id });
4075
- }
4076
- else {
4077
- throw new Error('AbstractRootSingleItemDbxFirebaseDocument only accepts RootSingleItemFirestoreCollection values with a singleItemIdentifier set for setFirestoreCollection.');
4078
- }
4079
- }
4080
- else {
4081
- return Object.assign(Object.assign({}, state), { firestoreCollection: null });
4082
- }
4083
- });
4084
- /**
4085
- * Does nothing on a AbstractRootSingleItemDbxFirebaseDocument.
4086
- *
4087
- * Ref is set with the FirestoreCollection
4088
- */
4089
- this.setId = this.updater((state, id) => state);
4090
- /**
4091
- * Does nothing on a AbstractRootSingleItemDbxFirebaseDocument.
4092
- *
4093
- * Ref is set with the FirestoreCollection
4094
- */
4095
- this.setKey = this.updater((state, key) => state);
4096
- /**
4097
- * Does nothing on a AbstractRootSingleItemDbxFirebaseDocument.
4098
- *
4099
- * Ref is set with the FirestoreCollection
4100
- */
4101
- this.setRef = this.updater((state, ref) => state);
4102
- this.clearRefs = this.updater((state) => state);
4103
- }
4104
- };
4105
- AbstractRootSingleItemDbxFirebaseDocument = __decorate([
4106
- __param(0, Inject(null)),
4107
- __param(0, Optional()),
4108
- __metadata("design:paramtypes", [Object])
4109
- ], AbstractRootSingleItemDbxFirebaseDocument);
4110
-
4111
- /**
4112
- * Creates a function for a store that DbxFirebaseDocumentStore captures the ModelFirebaseCreateFunction result and sets the key of the created value.
4113
- *
4114
- * @param store
4115
- * @param fn
4116
- * @returns
4117
- */
4118
- function firebaseDocumentStoreCreateFunction(store, fn) {
4119
- return (params) => loadingStateFromObs(lazyFrom(() => fn(params).then((result) => {
4120
- const modelKeys = result.modelKeys;
4121
- const firstKey = firstValue(modelKeys);
4122
- if (firstKey) {
4123
- store.setKey(firstKey);
4124
- }
4125
- return result;
4126
- })));
4127
- }
4128
- /**
4129
- * Creates a DbxfirebaseDocumentStoreCrudFunction from the input ModelFirebaseCrudFunction.
4130
- *
4131
- * @param fn
4132
- * @returns
4133
- */
4134
- function firebaseDocumentStoreCrudFunction(fn) {
4135
- return (params) => loadingStateFromObs(from(fn(params)).pipe(shareReplay(1)));
4136
- }
4137
- // MARK: Read
4138
- /**
4139
- * Creates a DbxfirebaseDocumentStoreCrudFunction for read.
4140
- *
4141
- * The store's current key is always injected into the params of the request.
4142
- *
4143
- * For functions that do not require the store's current key, use firebaseDocumentStoreCrudFunction() instead.
4144
- *
4145
- * @param store
4146
- * @param fn
4147
- * @returns
4148
- */
4149
- function firebaseDocumentStoreReadFunction(store, fn) {
4150
- return firebaseDocumentStoreUpdateFunction(store, fn);
4151
- }
4152
- // MARK: Update
4153
- /**
4154
- * Creates a DbxFirebaseDocumentStoreFunction for update.
4155
- *
4156
- * The store's current key is always injected into the params of the request.
4157
- *
4158
- * @param store
4159
- * @param fn
4160
- * @returns
4161
- */
4162
- function firebaseDocumentStoreUpdateFunction(store, fn) {
4163
- return (params) => loadingStateFromObs(store.key$.pipe(first(), exhaustMap((key) => fn(Object.assign(Object.assign({}, params), { key // inject key into the parameters.
4164
- }))), shareReplay(1)));
4165
- }
4166
- // MARK: Delete
4167
- /**
4168
- * Creates a DbxFirebaseDocumentStoreFunction for delete.
4169
- *
4170
- * The store's current key is always injected into the params of the request.
4171
- *
4172
- * @param store
4173
- * @param fn
4174
- * @returns
4175
- */
4176
- function firebaseDocumentStoreDeleteFunction(store, fn) {
4177
- return (params) => loadingStateFromObs(store.key$.pipe(first(), exhaustMap((key) => fn(Object.assign(Object.assign({}, params), { key // inject key into the parameters.
4178
- })).then((result) => {
4179
- store.clearRefs();
4180
- return result;
4181
- })), shareReplay(1)));
4182
- }
4183
-
4184
- function setParentStoreEffect(store) {
4185
- return store.effect((input) => {
4186
- return input.pipe(map((parentStore) => {
4187
- let result;
4188
- if (parentStore) {
4189
- result = store._setParent(parentStore.currentDocument$);
4190
- }
4191
- else {
4192
- result = undefined;
4193
- }
4194
- // set as the parent lock set too
4195
- store.setParentLockSet(parentStore);
4196
- return result;
4197
- }), cleanup((sub) => {
4198
- if (sub) {
4199
- sub.unsubscribe();
4200
- }
4201
- }));
4202
- });
4203
- }
4204
-
4205
- /**
4206
- * Abstract DbxFirebaseCollectionStore that has a parent document from which is derives it's FiresbaseCollection from.
4207
- */
4208
- class AbstractDbxFirebaseCollectionWithParentStore extends AbstractDbxFirebaseCollectionStore {
4209
- constructor(state, defaultSourceMode) {
4210
- super(state);
4211
- // MARK: Effects
4212
- this.setParentStore = setParentStoreEffect(this);
4213
- this.setSourceMode = this.effect((input) => {
4214
- return input.pipe(distinctUntilChanged(), switchMap((inputMode) => {
4215
- var _a;
4216
- const mode = (_a = inputMode === null || inputMode === void 0 ? void 0 : inputMode.toLowerCase()) !== null && _a !== void 0 ? _a : 'parent'; // default to parent mode
4217
- if (mode === 'group') {
4218
- return this.currentCollectionGroup$.pipe(tap((collectionGroup) => {
4219
- this.setFirestoreCollection(collectionGroup);
4220
- }));
4221
- }
4222
- else {
4223
- // parent document collection
4224
- return this.currentParent$.pipe(switchMap((parent) => {
4225
- if (parent) {
4226
- return this.collectionFactory$.pipe(tap((collectionFactory) => {
4227
- const collection = collectionFactory(parent);
4228
- this.setFirestoreCollection(collection);
4229
- }));
4230
- }
4231
- else {
4232
- this.setFirestoreCollection(undefined);
4233
- return NEVER;
4234
- }
4235
- }));
4236
- }
4237
- }));
4238
- });
4239
- // MARK: Accessors
4240
- this.currentParent$ = this.state$.pipe(map((x) => x.parent), distinctUntilChanged(), shareReplay(1));
4241
- this.parent$ = this.currentParent$.pipe(filterMaybe());
4242
- this.currentCollectionFactory$ = this.state$.pipe(map((x) => x.collectionFactory), distinctUntilChanged(), shareReplay(1));
4243
- this.collectionFactory$ = this.currentCollectionFactory$.pipe(filterMaybe());
4244
- this.currentCollectionGroup$ = this.state$.pipe(map((x) => x.collectionGroup), distinctUntilChanged(), shareReplay(1));
4245
- this.collectionGroup$ = this.currentCollectionGroup$.pipe(filterMaybe());
4246
- // MARK: State Changes
4247
- /**
4248
- * Sets the collection factory function to use.
4249
- */
4250
- this.setCollectionFactory = this.updater((state, collectionFactory) => (Object.assign(Object.assign({}, state), { collectionFactory })));
4251
- /**
4252
- * Sets the collection group to use.
4253
- */
4254
- this.setCollectionGroup = this.updater((state, collectionGroup) => (Object.assign(Object.assign({}, state), { collectionGroup })));
4255
- /**
4256
- * Sets the parent on the current state.
4257
- */
4258
- this._setParentDocument = this.updater((state, parent) => (Object.assign(Object.assign({}, state), { parent })));
4259
- this._setParent = this._setParentDocument;
4260
- this.setSourceMode(defaultSourceMode || 'parent');
4261
- }
4262
- }
4263
- AbstractDbxFirebaseCollectionWithParentStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AbstractDbxFirebaseCollectionWithParentStore, deps: [{ token: null, optional: true }, { token: null, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
4264
- AbstractDbxFirebaseCollectionWithParentStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AbstractDbxFirebaseCollectionWithParentStore });
4265
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AbstractDbxFirebaseCollectionWithParentStore, decorators: [{
4266
- type: Injectable
4267
- }], ctorParameters: function () {
4268
- return [{ type: undefined, decorators: [{
4269
- type: Inject,
4270
- args: [null]
4271
- }, {
4272
- type: Optional
4273
- }] }, { type: undefined, decorators: [{
4274
- type: Inject,
4275
- args: [null]
4276
- }, {
4277
- type: Optional
4278
- }] }];
4279
- } });
4280
-
4281
- /**
4282
- * Abstract DbxFirebaseDocumentStore that has a parent document from which is derives it's FiresbaseCollection from.
4283
- */
4284
- class AbstractDbxFirebaseDocumentWithParentStore extends AbstractDbxFirebaseDocumentStore {
4285
- constructor() {
4286
- super(...arguments);
4287
- // MARK: Effects
4288
- this.setParentStore = setParentStoreEffect(this);
4289
- this.setParent = this.effect((input) => {
4290
- return input.pipe(switchMap((parent) => {
4291
- this._setParentDocument(parent);
4292
- if (parent) {
4293
- return this.collectionFactory$.pipe(tap((collectionFactory) => {
4294
- const collection = collectionFactory(parent);
4295
- this.setFirestoreCollection(collection);
4296
- }));
4297
- }
4298
- else {
4299
- // clear the current collection
4300
- this.setFirestoreCollection(undefined);
4301
- // do nothing until a parent is returned.
4302
- return NEVER;
4303
- }
4304
- }));
4305
- });
4306
- this._setParent = this.setParent;
4307
- // MARK: Accessors
4308
- /**
4309
- * Returns the parent model key given the current key value.
4310
- */
4311
- this.keyParentKey$ = this.key$.pipe(map((x) => firestoreModelKeyParentKey(x, 1)), distinctUntilChanged(), shareReplay(1));
4312
- this.currentParent$ = this.state$.pipe(map((x) => x.parent), distinctUntilChanged(), shareReplay(1));
4313
- this.currentParentKey$ = this.state$.pipe(map((x) => { var _a; return (_a = x.parent) === null || _a === void 0 ? void 0 : _a.key; }), distinctUntilChanged(), shareReplay(1));
4314
- this.parent$ = this.currentParent$.pipe(filterMaybe());
4315
- this.parentKey$ = this.currentParentKey$.pipe(filterMaybe());
4316
- this.currentCollectionFactory$ = this.state$.pipe(map((x) => x.collectionFactory), distinctUntilChanged(), shareReplay(1));
4317
- this.collectionFactory$ = this.currentCollectionFactory$.pipe(filterMaybe());
4318
- // MARK: State Changes
4319
- /**
4320
- * Sets the collection factory function to use.
4321
- */
4322
- this.setCollectionFactory = this.updater((state, collectionFactory) => (Object.assign(Object.assign({}, state), { collectionFactory })));
4323
- /**
4324
- * Sets the parent on the current state.
4325
- */
4326
- this._setParentDocument = this.updater((state, parent) => (Object.assign(Object.assign({}, state), { parent })));
4327
- }
4328
- }
4329
- AbstractDbxFirebaseDocumentWithParentStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AbstractDbxFirebaseDocumentWithParentStore, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
4330
- AbstractDbxFirebaseDocumentWithParentStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AbstractDbxFirebaseDocumentWithParentStore });
4331
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AbstractDbxFirebaseDocumentWithParentStore, decorators: [{
4332
- type: Injectable
4333
- }] });
4334
- /**
4335
- * AbstractDbxFirebaseDocumentWithParentStore extension for use with SingleItemFirestoreCollection.
4336
- */
4337
- class AbstractSingleItemDbxFirebaseDocument extends AbstractDbxFirebaseDocumentWithParentStore {
4338
- constructor() {
4339
- super(...arguments);
4340
- /**
4341
- * Sets the SingleItemFirestoreCollection to use.
4342
- */
4343
- this.setFirestoreCollection = this.updater((state, firestoreCollection) => {
4344
- if (firestoreCollection != null) {
4345
- const id = firestoreCollection.singleItemIdentifier;
4346
- if (id != null) {
4347
- return Object.assign(Object.assign({}, state), { firestoreCollection, id });
4348
- }
4349
- else {
4350
- throw new Error('AbstractSingleItemDbxFirebaseDocument only accepts SingleItemFirestoreCollection values with a singleItemIdentifier set for setFirestoreCollection.');
4351
- }
4352
- }
4353
- else {
4354
- return Object.assign(Object.assign({}, state), { firestoreCollection: null });
4355
- }
4356
- });
4357
- /**
4358
- * Does nothing on a AbstractSingleItemDbxFirebaseDocument.
4359
- *
4360
- * Ref is set with the FirestoreCollection
4361
- */
4362
- this.setId = this.updater((state, id) => state);
4363
- /**
4364
- * Does nothing on a AbstractSingleItemDbxFirebaseDocument.
4365
- *
4366
- * Ref is set with the FirestoreCollection
4367
- */
4368
- this.setKey = this.updater((state, key) => state);
4369
- /**
4370
- * Does nothing on a AbstractSingleItemDbxFirebaseDocument.
4371
- *
4372
- * Ref is set with the FirestoreCollection
4373
- */
4374
- this.setRef = this.updater((state, ref) => state);
4375
- this.clearRefs = this.updater((state) => state);
4376
- }
4377
- }
4378
-
4379
- /**
4380
- * Abstract directive that contains a DbxFirebaseCollectionWithParentStore and provides an interface for communicating with other directives.
4381
- */
4382
- class DbxFirebaseCollectionWithParentStoreDirective extends DbxFirebaseCollectionStoreDirective {
4383
- // MARK: Inputs
4384
- set sourceMode(sourceMode) {
4385
- this.store.setSourceMode(sourceMode);
4386
- }
4387
- }
4388
- DbxFirebaseCollectionWithParentStoreDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseCollectionWithParentStoreDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
4389
- DbxFirebaseCollectionWithParentStoreDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseCollectionWithParentStoreDirective, inputs: { sourceMode: "sourceMode" }, usesInheritance: true, ngImport: i0 });
4390
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseCollectionWithParentStoreDirective, decorators: [{
4391
- type: Directive
4392
- }], propDecorators: { sourceMode: [{
4393
- type: Input
4394
- }] } });
4395
- function provideDbxFirebaseCollectionWithParentStoreDirective(sourceType, storeType) {
4396
- const providers = [
4397
- ...provideDbxFirebaseCollectionStoreDirective(sourceType, storeType),
4398
- {
4399
- provide: DbxFirebaseCollectionWithParentStoreDirective,
4400
- useExisting: forwardRef(() => sourceType)
4401
- }
4402
- ];
4403
- return providers;
4404
- }
4405
-
4406
- class SystemStateCollectionStore extends AbstractDbxFirebaseCollectionStore {
4407
- constructor(collections) {
4408
- super({ firestoreCollection: collections.systemStateCollection });
4409
- this.collections = collections;
4410
- }
4411
- }
4412
- SystemStateCollectionStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: SystemStateCollectionStore, deps: [{ token: i1$4.SystemStateFirestoreCollections }], target: i0.ɵɵFactoryTarget.Injectable });
4413
- SystemStateCollectionStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: SystemStateCollectionStore });
4414
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: SystemStateCollectionStore, decorators: [{
4415
- type: Injectable
4416
- }], ctorParameters: function () { return [{ type: i1$4.SystemStateFirestoreCollections }]; } });
4417
-
4418
- class DbxFirebaseSystemStateCollectionStoreDirective extends DbxFirebaseCollectionStoreDirective {
4419
- constructor(store) {
4420
- super(store);
4421
- }
4422
- }
4423
- DbxFirebaseSystemStateCollectionStoreDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseSystemStateCollectionStoreDirective, deps: [{ token: SystemStateCollectionStore }], target: i0.ɵɵFactoryTarget.Directive });
4424
- DbxFirebaseSystemStateCollectionStoreDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseSystemStateCollectionStoreDirective, selector: "[dbxFirebaseSystemStateCollection]", providers: provideDbxFirebaseCollectionStoreDirective(DbxFirebaseSystemStateCollectionStoreDirective, SystemStateCollectionStore), usesInheritance: true, ngImport: i0 });
4425
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseSystemStateCollectionStoreDirective, decorators: [{
4426
- type: Directive,
4427
- args: [{
4428
- selector: '[dbxFirebaseSystemStateCollection]',
4429
- providers: provideDbxFirebaseCollectionStoreDirective(DbxFirebaseSystemStateCollectionStoreDirective, SystemStateCollectionStore)
4430
- }]
4431
- }], ctorParameters: function () { return [{ type: SystemStateCollectionStore }]; } });
4432
-
4433
- /**
4434
- * Abstract class used for accessing a SystemStateDocumentStore's data.
4435
- */
4436
- class AbstractSystemStateDocumentStoreAccessor {
4437
- constructor(systemStateDocumentStore, type) {
4438
- this.systemStateDocumentStore = systemStateDocumentStore;
4439
- this.type = type;
4440
- this.documentData$ = this.systemStateDocumentStore.data$;
4441
- this.data$ = this.documentData$.pipe(map((x) => x.data), shareReplay(1));
4442
- this.dataState$ = this.systemStateDocumentStore.dataLoadingState$.pipe(mapLoadingState({ mapValue: (x) => x.data }), shareReplay(1));
4443
- this.exists$ = this.systemStateDocumentStore.exists$;
4444
- this.doesNotExist$ = this.systemStateDocumentStore.doesNotExist$;
4445
- systemStateDocumentStore.setId(type);
4446
- }
4447
- }
4448
-
4449
- class SystemStateDocumentStore extends AbstractDbxFirebaseDocumentStore {
4450
- constructor(collections) {
4451
- super({ firestoreCollection: collections.systemStateCollection });
4452
- this.collections = collections;
4453
- }
4454
- }
4455
- SystemStateDocumentStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: SystemStateDocumentStore, deps: [{ token: i1$4.SystemStateFirestoreCollections }], target: i0.ɵɵFactoryTarget.Injectable });
4456
- SystemStateDocumentStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: SystemStateDocumentStore });
4457
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: SystemStateDocumentStore, decorators: [{
4458
- type: Injectable
4459
- }], ctorParameters: function () { return [{ type: i1$4.SystemStateFirestoreCollections }]; } });
4460
-
4461
- class DbxFirebaseSystemStateDocumentStoreDirective extends DbxFirebaseDocumentStoreDirective {
4462
- constructor(store) {
4463
- super(store);
4464
- }
4465
- }
4466
- DbxFirebaseSystemStateDocumentStoreDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseSystemStateDocumentStoreDirective, deps: [{ token: SystemStateDocumentStore }], target: i0.ɵɵFactoryTarget.Directive });
4467
- DbxFirebaseSystemStateDocumentStoreDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: DbxFirebaseSystemStateDocumentStoreDirective, selector: "[dbxFirebaseSystemStateDocument]", providers: provideDbxFirebaseDocumentStoreDirective(DbxFirebaseSystemStateDocumentStoreDirective, SystemStateDocumentStore), usesInheritance: true, ngImport: i0 });
4468
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseSystemStateDocumentStoreDirective, decorators: [{
4469
- type: Directive,
4470
- args: [{
4471
- selector: '[dbxFirebaseSystemStateDocument]',
4472
- providers: provideDbxFirebaseDocumentStoreDirective(DbxFirebaseSystemStateDocumentStoreDirective, SystemStateDocumentStore)
4473
- }]
4474
- }], ctorParameters: function () { return [{ type: SystemStateDocumentStore }]; } });
4475
-
4476
- class DbxFirebaseModelModule {
4477
- }
4478
- DbxFirebaseModelModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4479
- DbxFirebaseModelModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelModule, exports: [DbxFirebaseModelStoreModule, DbxFirebaseModelHistoryModule, DbxFirebaseModelTypesModule] });
4480
- DbxFirebaseModelModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelModule, imports: [DbxFirebaseModelStoreModule, DbxFirebaseModelHistoryModule, DbxFirebaseModelTypesModule] });
4481
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModelModule, decorators: [{
4482
- type: NgModule,
4483
- args: [{
4484
- exports: [DbxFirebaseModelStoreModule, DbxFirebaseModelHistoryModule, DbxFirebaseModelTypesModule]
4485
- }]
4486
- }] });
4487
-
4488
- class FlatFirestoreModelKeyPipe {
4489
- transform(input) {
4490
- if (input != null) {
4491
- return flatFirestoreModelKey(input);
4492
- }
4493
- else {
4494
- return '';
4495
- }
4496
- }
4497
- }
4498
- FlatFirestoreModelKeyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: FlatFirestoreModelKeyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
4499
- FlatFirestoreModelKeyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: FlatFirestoreModelKeyPipe, name: "flatFirestoreModelKey" });
4500
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: FlatFirestoreModelKeyPipe, decorators: [{
4501
- type: Pipe,
4502
- args: [{ name: 'flatFirestoreModelKey' }]
4503
- }] });
4504
- class TwoWayFlatFirestoreModelKeyPipe {
4505
- transform(input) {
4506
- if (input != null) {
4507
- return twoWayFlatFirestoreModelKey(input);
4508
- }
4509
- else {
4510
- return '';
4511
- }
4512
- }
4513
- }
4514
- TwoWayFlatFirestoreModelKeyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TwoWayFlatFirestoreModelKeyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
4515
- TwoWayFlatFirestoreModelKeyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: TwoWayFlatFirestoreModelKeyPipe, name: "twoWayFlatFirestoreModelKey" });
4516
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TwoWayFlatFirestoreModelKeyPipe, decorators: [{
4517
- type: Pipe,
4518
- args: [{ name: 'twoWayFlatFirestoreModelKey' }]
4519
- }] });
4520
-
4521
- const declarations = [FlatFirestoreModelKeyPipe, TwoWayFlatFirestoreModelKeyPipe];
4522
- class DbxFirebasePipeModule {
4523
- }
4524
- DbxFirebasePipeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebasePipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4525
- DbxFirebasePipeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebasePipeModule, declarations: [FlatFirestoreModelKeyPipe, TwoWayFlatFirestoreModelKeyPipe], exports: [FlatFirestoreModelKeyPipe, TwoWayFlatFirestoreModelKeyPipe] });
4526
- DbxFirebasePipeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebasePipeModule });
4527
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebasePipeModule, decorators: [{
4528
- type: NgModule,
4529
- args: [{
4530
- declarations,
4531
- exports: declarations
4532
- }]
4533
- }] });
4534
-
4535
- /**
4536
- * Token to access the FirebaseStorageContextConfig value.
4537
- */
4538
- const DBX_FIREBASE_STORAGE_CONTEXT_CONFIG_TOKEN = new InjectionToken('DBX_FIREBASE_STORAGE_CONTEXT_CONFIG_TOKEN');
4539
- /**
4540
- * Token to access the FirebaseStorageContext value.
4541
- */
4542
- const DBX_FIREBASE_STORAGE_CONTEXT_TOKEN = new InjectionToken('DBX_FIREBASE_STORAGE_CONTEXT_TOKEN');
4543
-
4544
- /**
4545
- * Service that provides access to the app's FirebaseStorageContext.
4546
- */
4547
- class DbxFirebaseStorageService {
4548
- constructor(storageContext) {
4549
- this.storageContext = storageContext;
4550
- }
4551
- defaultBucket() {
4552
- return this.storageContext.defaultBucket();
4553
- }
4554
- file(path) {
4555
- return this.storageContext.file(path);
4556
- }
4557
- folder(path) {
4558
- return this.storageContext.folder(path);
4559
- }
4560
- }
4561
- DbxFirebaseStorageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseStorageService, deps: [{ token: DBX_FIREBASE_STORAGE_CONTEXT_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable });
4562
- DbxFirebaseStorageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseStorageService, providedIn: 'root' });
4563
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseStorageService, decorators: [{
4564
- type: Injectable,
4565
- args: [{
4566
- providedIn: 'root'
4567
- }]
4568
- }], ctorParameters: function () {
4569
- return [{ type: undefined, decorators: [{
4570
- type: Inject,
4571
- args: [DBX_FIREBASE_STORAGE_CONTEXT_TOKEN]
4572
- }] }];
4573
- } });
4574
-
4575
- function dbxFirebaseStorageModuleContextConfigFactory(base) {
4576
- return (app, injector) => {
4577
- var _a;
4578
- return {
4579
- defaultBucketId: (base === null || base === void 0 ? void 0 : base.defaultBucketId) || app.options.storageBucket,
4580
- forceBucket: (_a = base === null || base === void 0 ? void 0 : base.forceBucket) !== null && _a !== void 0 ? _a : false
4581
- };
4582
- };
4583
- }
4584
- class DbxFirebaseStorageModule {
4585
- static forRoot(config) {
4586
- var _a;
4587
- const configFactory = (_a = config === null || config === void 0 ? void 0 : config.contextConfigFactory) !== null && _a !== void 0 ? _a : dbxFirebaseStorageModuleContextConfigFactory(config === null || config === void 0 ? void 0 : config.contextConfig);
4588
- const providers = [
4589
- {
4590
- provide: DBX_FIREBASE_STORAGE_CONTEXT_CONFIG_TOKEN,
4591
- useFactory: configFactory,
4592
- deps: [FirebaseApp, Injector]
4593
- },
4594
- {
4595
- provide: DBX_FIREBASE_STORAGE_CONTEXT_TOKEN,
4596
- useFactory: clientFirebaseStorageContextFactory,
4597
- deps: [Storage, DBX_FIREBASE_STORAGE_CONTEXT_CONFIG_TOKEN]
4598
- },
4599
- DbxFirebaseStorageService
4600
- ];
4601
- return {
4602
- ngModule: DbxFirebaseStorageModule,
4603
- providers
4604
- };
4605
- }
4606
- }
4607
- DbxFirebaseStorageModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseStorageModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4608
- DbxFirebaseStorageModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseStorageModule });
4609
- DbxFirebaseStorageModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseStorageModule });
4610
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseStorageModule, decorators: [{
4611
- type: NgModule,
4612
- args: [{}]
4613
- }] });
4614
-
4615
- class DbxFirebaseModule {
4616
- }
4617
- DbxFirebaseModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4618
- DbxFirebaseModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModule, exports: [DbxFirebaseModelModule] });
4619
- DbxFirebaseModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModule, imports: [DbxFirebaseModelModule] });
4620
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxFirebaseModule, decorators: [{
4621
- type: NgModule,
4622
- args: [{
4623
- exports: [DbxFirebaseModelModule]
4624
- }]
4625
- }] });
4626
-
4627
- /**
4628
- * Generated bundle index. Do not edit.
4629
- */
4630
-
4631
- export { AbstractConfiguredDbxFirebaseLoginButtonDirective, AbstractDbxFirebaseCollectionStore, AbstractDbxFirebaseCollectionWithParentStore, AbstractDbxFirebaseDocumentStore, AbstractDbxFirebaseDocumentWithParentStore, AbstractRootSingleItemDbxFirebaseDocument, AbstractSingleItemDbxFirebaseDocument, AbstractSystemStateDocumentStoreAccessor, DBX_FIREBASE_ID_ROUTER_PARAM_DEFAULT_ID_PARAM_KEY, DBX_FIREBASE_ID_ROUTER_PARAM_DEFAULT_KEY_PARAM_KEY, DBX_FIREBASE_ID_ROUTER_PARAM_DEFAULT_USE_PARAM_VALUE, DBX_FIREBASE_MODEL_DOES_NOT_EXIST_ERROR, DBX_FIREBASE_OPTIONS_TOKEN, DBX_FIREBASE_STORAGE_CONTEXT_CONFIG_TOKEN, DBX_FIREBASE_STORAGE_CONTEXT_TOKEN, DBX_FIRESTORE_CONTEXT_TOKEN, DEFAULT_CONFIGURED_DBX_FIREBASE_LOGIN_BUTTON_TEMPLATE, DEFAULT_DBX_FIREBASE_ANALYTICS_USER_PROPERTIES_FACTORY, 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_COLLECTION_CHANGE_TRIGGER_FUNCTION, DEFAULT_FIREBASE_DEVELOPMENT_ENABLED_TOKEN, DEFAULT_FIREBASE_DEVELOPMENT_POPUP_KEY, DEFAULT_FIREBASE_DEVELOPMENT_SCHEDULER_ENABLED_TOKEN, DEFAULT_FIREBASE_DEVELOPMENT_WIDGET_PROVIDERS_TOKEN, DEFAULT_FIREBASE_HISTORY_COMPONENT_POPOVER_KEY, DEFAULT_FIREBASE_LOGIN_METHOD_CATEGORY, DEVELOPMENT_FIREBASE_SERVER_SCHEDULER_WIDGET_KEY, DbxFirebaseAnalyticsUserEventsListener, DbxFirebaseAnalyticsUserSource, DbxFirebaseAppCheckHttpInterceptor, DbxFirebaseAuthContextInfo, DbxFirebaseAuthLoginService, DbxFirebaseAuthModule, DbxFirebaseAuthService, DbxFirebaseAuthServiceDelegate, DbxFirebaseCollectionChangeDirective, DbxFirebaseCollectionChangeTriggerInstance, DbxFirebaseCollectionChangeWatcherInstance, DbxFirebaseCollectionHasChangeDirective, DbxFirebaseCollectionListDirective, DbxFirebaseCollectionLoaderInstance, DbxFirebaseCollectionStoreDirective, DbxFirebaseCollectionWithParentStoreDirective, DbxFirebaseDefaultAppCheckProviderModule, DbxFirebaseDefaultAuthProviderModule, DbxFirebaseDefaultFirebaseProvidersModule, DbxFirebaseDefaultFirestoreProviderModule, DbxFirebaseDefaultFunctionsProviderModule, DbxFirebaseDefaultStorageProviderModule, DbxFirebaseDevelopmentDirective, DbxFirebaseDevelopmentModule, DbxFirebaseDevelopmentModuleRootConfig, DbxFirebaseDevelopmentPopupComponent, DbxFirebaseDevelopmentPopupContentComponent, DbxFirebaseDevelopmentPopupContentFormComponent, DbxFirebaseDevelopmentSchedulerListComponent, DbxFirebaseDevelopmentSchedulerListViewComponent, DbxFirebaseDevelopmentSchedulerListViewItemComponent, DbxFirebaseDevelopmentSchedulerService, DbxFirebaseDevelopmentSchedulerWidgetComponent, DbxFirebaseDevelopmentService, DbxFirebaseDevelopmentWidgetService, DbxFirebaseDocumentAuthIdDirective, DbxFirebaseDocumentLoaderInstance, DbxFirebaseDocumentStoreDirective, DbxFirebaseDocumentStoreRouteIdDirective, DbxFirebaseDocumentStoreRouteKeyDirective, DbxFirebaseEmailFormComponent, DbxFirebaseEmailRecoveryFormComponent, DbxFirebaseEmulatorModule, DbxFirebaseEmulatorService, DbxFirebaseFirestoreCollectionModule, DbxFirebaseFunctionsModule, DbxFirebaseIdRouteParamRedirectInstance, DbxFirebaseInContextFirebaseModelServiceInstance, DbxFirebaseLoginAnonymousComponent, DbxFirebaseLoginAppleComponent, DbxFirebaseLoginButtonComponent, DbxFirebaseLoginButtonContainerComponent, DbxFirebaseLoginComponent, DbxFirebaseLoginContext, DbxFirebaseLoginContextBackButtonComponent, DbxFirebaseLoginContextDirective, DbxFirebaseLoginEmailComponent, DbxFirebaseLoginEmailContentComponent, DbxFirebaseLoginFacebookComponent, DbxFirebaseLoginGitHubComponent, DbxFirebaseLoginGoogleComponent, DbxFirebaseLoginListComponent, DbxFirebaseLoginMicrosoftComponent, DbxFirebaseLoginModule, DbxFirebaseLoginModuleRootConfig, DbxFirebaseLoginTermsComponent, DbxFirebaseLoginTermsSimpleComponent, DbxFirebaseLoginTwitterComponent, DbxFirebaseModelContextService, DbxFirebaseModelHistoryComponent, DbxFirebaseModelHistoryModule, DbxFirebaseModelHistoryPopoverButtonComponent, DbxFirebaseModelHistoryPopoverComponent, DbxFirebaseModelModule, DbxFirebaseModelStoreModule, DbxFirebaseModelTrackerService, DbxFirebaseModelTypeInstanceComponent, DbxFirebaseModelTypeInstanceViewComponent, DbxFirebaseModelTypeInstanceViewItemComponent, DbxFirebaseModelTypesModule, DbxFirebaseModelTypesService, DbxFirebaseModelTypesServiceConfig, DbxFirebaseModelTypesServiceInstance, DbxFirebaseModule, DbxFirebaseParsedEmulatorsConfig, DbxFirebasePipeModule, DbxFirebaseRegisterComponent, DbxFirebaseRegisterEmailComponent, DbxFirebaseStorageModule, DbxFirebaseStorageService, DbxFirebaseSystemStateCollectionStoreDirective, DbxFirebaseSystemStateDocumentStoreDirective, DbxFirestoreContextService, DbxLimitedFirebaseDocumentLoaderInstance, DbxfirebaseModelViewedEventDirective, FlatFirestoreModelKeyPipe, OAUTH_FIREBASE_LOGIN_METHOD_CATEGORY, SystemStateCollectionStore, SystemStateDocumentStore, TwoWayFlatFirestoreModelKeyPipe, authRolesObsWithClaimsService, authUserInfoFromAuthUser, authUserStateFromFirebaseAuthServiceFunction, dbxFirebaseCollectionChangeTrigger, dbxFirebaseCollectionChangeTriggerForStore, dbxFirebaseCollectionChangeTriggerForWatcher, dbxFirebaseCollectionChangeWatcher, dbxFirebaseCollectionLoaderInstance, dbxFirebaseCollectionLoaderInstanceWithCollection, dbxFirebaseDocumentLoaderInstance, dbxFirebaseDocumentLoaderInstanceWithAccessor, dbxFirebaseIdRouteParamRedirect, dbxFirebaseInContextFirebaseModelServiceInstanceFactory, dbxFirebaseKeyRouteParamRedirect, dbxFirebaseModelContextServiceInfoInstanceFactory, dbxFirebaseModelTypesServiceInstancePairForKeysFactory, dbxFirebaseSourceSelectLoadSource, dbxFirebaseStorageModuleContextConfigFactory, dbxLimitedFirebaseDocumentLoaderInstance, dbxLimitedFirebaseDocumentLoaderInstanceWithAccessor, defaultDbxFirebaseAuthServiceDelegateWithClaimsService, defaultFirebaseAuthLoginProvidersFactory, developmentFirebaseServerSchedulerWidgetEntry, enableAppCheckDebugTokenGeneration, firebaseAuthTokenFromUser, firebaseContextServiceEntityMap, firebaseDocumentStoreCreateFunction, firebaseDocumentStoreCrudFunction, firebaseDocumentStoreDeleteFunction, firebaseDocumentStoreReadFunction, firebaseDocumentStoreUpdateFunction, modelDoesNotExistError, provideDbxFirebaseCollectionStoreDirective, provideDbxFirebaseCollectionWithParentStoreDirective, provideDbxFirebaseDocumentStoreDirective, provideSystemStateFirestoreCollections, readDbxAnalyticsUserPropertiesFromAuthUserInfo, readValueFromIdToken, setParentStoreEffect, stateFromTokenForLoggedInUserFunction };
4632
- //# sourceMappingURL=dereekb-dbx-firebase.mjs.map