@tech4good/angular-schematics 17.0.3 → 18.0.0

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 (220) hide show
  1. package/README.md +8 -0
  2. package/package.json +4 -4
  3. package/src/collection.json +0 -16
  4. package/src/component/files/__name@dasherize__/__name@dasherize__.component.ts.template +22 -8
  5. package/src/component/index.js +2 -45
  6. package/src/component/index.js.map +1 -1
  7. package/src/component/schema.json +0 -5
  8. package/src/entity/files/__name@dasherize__/__name@dasherize__.mock.ts.template +12 -0
  9. package/src/entity/files/__name@dasherize__/__name@dasherize__.model.ts.template +1 -0
  10. package/src/entity/files/__name@dasherize__/__name@dasherize__.store.ts.template +41 -0
  11. package/src/entity/index.js +29 -50
  12. package/src/entity/index.js.map +1 -1
  13. package/src/init/files/.firebaserc.template +8 -0
  14. package/src/init/files/README.md.template +6 -6
  15. package/src/init/files/angular.json.template +18 -11
  16. package/src/init/files/package.json.template +28 -29
  17. package/src/init/files/src/app/admin/{waitlist/waitlist.animations.ts.template → admin-panel/admin-panel.animations.ts.template} +1 -1
  18. package/src/init/files/src/app/admin/{waitlist/waitlist.component.html.template → admin-panel/admin-panel.component.html.template} +3 -3
  19. package/src/init/files/src/app/admin/{waitlist/waitlist.component.scss.template → admin-panel/admin-panel.component.scss.template} +1 -1
  20. package/src/init/files/src/app/admin/admin-panel/admin-panel.component.spec.ts.template +25 -0
  21. package/src/init/files/src/app/admin/admin-panel/admin-panel.component.ts.template +99 -0
  22. package/src/init/files/src/app/app.component.html.template +1 -0
  23. package/src/init/files/src/app/app.component.ts.template +14 -8
  24. package/src/init/files/src/app/app.config.ts.template +63 -0
  25. package/src/init/files/src/app/app.routes.ts.template +32 -0
  26. package/src/init/files/src/app/core/analytics/log.service.ts.template +122 -89
  27. package/src/init/files/src/app/core/analytics/time-analytics.service.ts.template +9 -17
  28. package/src/init/files/src/app/core/auth/auth.guard.ts.template +25 -22
  29. package/src/init/files/src/app/core/firebase/cached-listeners.service.ts.template +291 -0
  30. package/src/init/files/src/app/core/firebase/database.service.ts.template +56 -0
  31. package/src/init/files/src/app/core/firebase/firebase.mock.service.ts.template +276 -0
  32. package/src/init/files/src/app/core/firebase/firebase.service.ts.template +265 -215
  33. package/src/init/files/src/app/core/local-storage/session.service.ts.template +3 -4
  34. package/src/init/files/src/app/core/store/app.model.ts.template +19 -0
  35. package/src/init/files/src/app/core/store/app.store.ts.template +1074 -0
  36. package/src/init/files/src/app/core/store/auth/auth.mock.ts.template +20 -0
  37. package/src/init/files/src/app/core/store/auth/auth.store.ts.template +136 -0
  38. package/src/init/files/src/app/core/store/batch-write.firebase.service.ts.template +58 -0
  39. package/src/init/files/src/app/core/store/batch-write.mock.service.ts.template +105 -0
  40. package/src/init/files/src/app/core/store/batch-write.service.ts.template +126 -0
  41. package/src/init/files/src/app/core/store/user/user.mock.ts.template +24 -0
  42. package/src/init/files/src/app/core/store/user/user.model.ts.template +1 -1
  43. package/src/init/files/src/app/core/store/user/user.store.ts.template +41 -0
  44. package/src/init/files/src/app/core/store/user-context/user-context.mock.ts.template +24 -0
  45. package/src/init/files/src/app/core/store/user-context/user-context.model.ts.template +1 -0
  46. package/src/init/files/src/app/core/store/user-context/user-context.store.ts.template +41 -0
  47. package/src/init/files/src/app/core/utils/rand.utils.ts.template +13 -0
  48. package/src/init/files/src/app/{onboarding → first-time}/consent/consent.component.html.template +8 -13
  49. package/src/init/files/src/app/first-time/consent/consent.component.ts.template +90 -0
  50. package/src/init/files/src/app/first-time/early-access/early-access.animations.ts.template +4 -0
  51. package/src/init/files/src/app/first-time/early-access/early-access.component.html.template +69 -0
  52. package/src/init/files/src/app/{onboarding/waiting/waiting.component.scss.template → first-time/early-access/early-access.component.scss.template} +1 -1
  53. package/src/init/files/src/app/first-time/early-access/early-access.component.spec.ts.template +25 -0
  54. package/src/init/files/src/app/first-time/early-access/early-access.component.ts.template +194 -0
  55. package/src/init/files/src/app/first-time/early-access/early-access.model.ts.template +7 -0
  56. package/src/init/files/src/app/{general → first-time}/landing/landing.component.html.template +1 -1
  57. package/src/init/files/src/app/first-time/landing/landing.component.ts.template +44 -0
  58. package/src/init/files/src/app/first-time/login/login.component.html.template +10 -0
  59. package/src/init/files/src/app/first-time/login/login.component.ts.template +45 -0
  60. package/src/init/files/src/app/first-time/onboarding/onboarding.animations.ts.template +4 -0
  61. package/src/init/files/src/app/first-time/onboarding/onboarding.component.html.template +2 -0
  62. package/src/init/files/src/app/first-time/onboarding/onboarding.component.scss.template +5 -0
  63. package/src/init/files/src/app/{admin/waitlist/waitlist.component.spec.ts.template → first-time/onboarding/onboarding.component.spec.ts.template} +6 -6
  64. package/src/init/files/src/app/first-time/onboarding/onboarding.component.ts.template +41 -0
  65. package/src/init/files/src/app/main/home/home.component.html.template +5 -0
  66. package/src/init/files/src/app/main/home/home.component.ts.template +51 -0
  67. package/src/init/files/src/app/shared/navbar/navbar.component.html.template +15 -0
  68. package/src/init/files/src/app/shared/navbar/navbar.component.scss.template +43 -0
  69. package/src/init/files/src/app/shared/navbar/navbar.component.spec.ts.template +25 -0
  70. package/src/init/files/src/app/shared/navbar/navbar.component.ts.template +40 -0
  71. package/src/init/files/src/app/shared/redeployment-warning/redeployment-warning.component.html.template +9 -0
  72. package/src/init/files/src/app/shared/{components/redeployment-warning → redeployment-warning}/redeployment-warning.component.ts.template +17 -6
  73. package/src/init/files/src/app/shared/{components/redeployment-warning → redeployment-warning}/redeployment-warning.service.ts.template +2 -2
  74. package/src/init/files/src/assets/images/close-x.svg +3 -0
  75. package/src/init/files/src/environments/environment.ts.template +1 -0
  76. package/src/init/files/src/index.html.template +1 -1
  77. package/src/init/files/tsconfig.json.template +0 -1
  78. package/src/container/files/__name@dasherize__/+state/__name@dasherize__.actions.ts.template +0 -26
  79. package/src/container/files/__name@dasherize__/+state/__name@dasherize__.effects.ts.template +0 -48
  80. package/src/container/files/__name@dasherize__/+state/__name@dasherize__.model.ts.template +0 -0
  81. package/src/container/files/__name@dasherize__/+state/__name@dasherize__.selectors.ts.template +0 -20
  82. package/src/container/files/__name@dasherize__/+state/__name@dasherize__.state.ts.template +0 -13
  83. package/src/container/files/__name@dasherize__/__name@dasherize__.animations.ts.template +0 -4
  84. package/src/container/files/__name@dasherize__/__name@dasherize__.component.html.template +0 -3
  85. package/src/container/files/__name@dasherize__/__name@dasherize__.component.scss.template +0 -5
  86. package/src/container/files/__name@dasherize__/__name@dasherize__.component.spec.ts.template +0 -25
  87. package/src/container/files/__name@dasherize__/__name@dasherize__.component.ts.template +0 -90
  88. package/src/container/index.d.ts +0 -2
  89. package/src/container/index.js +0 -127
  90. package/src/container/index.js.map +0 -1
  91. package/src/container/index_spec.d.ts +0 -1
  92. package/src/container/index_spec.js +0 -23
  93. package/src/container/index_spec.js.map +0 -1
  94. package/src/container/schema.json +0 -50
  95. package/src/entity/files/__name@dasherize__/__name@dasherize__.actions.ts.template +0 -249
  96. package/src/entity/files/__name@dasherize__/__name@dasherize__.effects.ts.template +0 -131
  97. package/src/entity/files/__name@dasherize__/__name@dasherize__.reducer.spec.ts.template +0 -13
  98. package/src/entity/files/__name@dasherize__/__name@dasherize__.reducer.ts.template +0 -51
  99. package/src/entity/files/__name@dasherize__/__name@dasherize__.service.ts.template +0 -50
  100. package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.actions.ts.template +0 -270
  101. package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.effects.ts.template +0 -131
  102. package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.model.ts.template +0 -3
  103. package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.reducer.spec.ts.template +0 -13
  104. package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.reducer.ts.template +0 -51
  105. package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.service.ts.template +0 -50
  106. package/src/entity-in-example/index.d.ts +0 -2
  107. package/src/entity-in-example/index.js +0 -141
  108. package/src/entity-in-example/index.js.map +0 -1
  109. package/src/entity-in-example/index_spec.d.ts +0 -1
  110. package/src/entity-in-example/index_spec.js +0 -23
  111. package/src/entity-in-example/index_spec.js.map +0 -1
  112. package/src/entity-in-example/schema.json +0 -45
  113. package/src/init/files/CHANGELOG.md.template +0 -10
  114. package/src/init/files/src/app/admin/admin-routing.module.ts.template +0 -17
  115. package/src/init/files/src/app/admin/admin.module.spec.ts.template +0 -13
  116. package/src/init/files/src/app/admin/admin.module.ts.template +0 -28
  117. package/src/init/files/src/app/admin/waitlist/+state/waitlist.actions.ts.template +0 -23
  118. package/src/init/files/src/app/admin/waitlist/+state/waitlist.effects.ts.template +0 -50
  119. package/src/init/files/src/app/admin/waitlist/+state/waitlist.model.ts.template +0 -0
  120. package/src/init/files/src/app/admin/waitlist/+state/waitlist.selectors.ts.template +0 -39
  121. package/src/init/files/src/app/admin/waitlist/+state/waitlist.state.ts.template +0 -13
  122. package/src/init/files/src/app/admin/waitlist/waitlist.component.ts.template +0 -141
  123. package/src/init/files/src/app/app-routing.module.ts.template +0 -26
  124. package/src/init/files/src/app/app.module.ts.template +0 -34
  125. package/src/init/files/src/app/core/core.module.ts.template +0 -75
  126. package/src/init/files/src/app/core/setup/firebase-setup.ts.template +0 -25
  127. package/src/init/files/src/app/core/setup/module-import-guard.ts.template +0 -5
  128. package/src/init/files/src/app/core/snackbar/snackbar.actions.ts.template +0 -24
  129. package/src/init/files/src/app/core/snackbar/snackbar.effects.ts.template +0 -41
  130. package/src/init/files/src/app/core/store/app-state/app-state.actions.ts.template +0 -249
  131. package/src/init/files/src/app/core/store/app-state/app-state.effects.ts.template +0 -131
  132. package/src/init/files/src/app/core/store/app-state/app-state.model.ts.template +0 -8
  133. package/src/init/files/src/app/core/store/app-state/app-state.reducer.spec.ts.template +0 -13
  134. package/src/init/files/src/app/core/store/app-state/app-state.reducer.ts.template +0 -51
  135. package/src/init/files/src/app/core/store/app-state/app-state.service.ts.template +0 -50
  136. package/src/init/files/src/app/core/store/app.actions.ts.template +0 -92
  137. package/src/init/files/src/app/core/store/app.effects.ts.template +0 -175
  138. package/src/init/files/src/app/core/store/app.reducer.ts.template +0 -36
  139. package/src/init/files/src/app/core/store/app.selectors.ts.template +0 -42
  140. package/src/init/files/src/app/core/store/auth/auth.actions.ts.template +0 -77
  141. package/src/init/files/src/app/core/store/auth/auth.effects.ts.template +0 -163
  142. package/src/init/files/src/app/core/store/auth/auth.reducer.spec.ts.template +0 -13
  143. package/src/init/files/src/app/core/store/auth/auth.reducer.ts.template +0 -26
  144. package/src/init/files/src/app/core/store/auth/auth.selectors.ts.template +0 -25
  145. package/src/init/files/src/app/core/store/cached-load-connections.service.ts.template +0 -405
  146. package/src/init/files/src/app/core/store/cached-selectors.service.ts.template +0 -376
  147. package/src/init/files/src/app/core/store/effects.helpers.ts.template +0 -66
  148. package/src/init/files/src/app/core/store/user/user.actions.ts.template +0 -248
  149. package/src/init/files/src/app/core/store/user/user.effects.ts.template +0 -149
  150. package/src/init/files/src/app/core/store/user/user.reducer.spec.ts.template +0 -13
  151. package/src/init/files/src/app/core/store/user/user.reducer.ts.template +0 -50
  152. package/src/init/files/src/app/core/store/user/user.service.ts.template +0 -50
  153. package/src/init/files/src/app/core/store/user-context/user-context.actions.ts.template +0 -248
  154. package/src/init/files/src/app/core/store/user-context/user-context.effects.ts.template +0 -131
  155. package/src/init/files/src/app/core/store/user-context/user-context.reducer.spec.ts.template +0 -13
  156. package/src/init/files/src/app/core/store/user-context/user-context.reducer.ts.template +0 -51
  157. package/src/init/files/src/app/core/store/user-context/user-context.service.ts.template +0 -50
  158. package/src/init/files/src/app/core/utils/string-case.utils.ts.template +0 -96
  159. package/src/init/files/src/app/general/general-routing.module.ts.template +0 -25
  160. package/src/init/files/src/app/general/general.module.spec.ts.template +0 -13
  161. package/src/init/files/src/app/general/general.module.ts.template +0 -36
  162. package/src/init/files/src/app/general/home/+state/home.actions.ts.template +0 -26
  163. package/src/init/files/src/app/general/home/+state/home.effects.ts.template +0 -48
  164. package/src/init/files/src/app/general/home/+state/home.model.ts.template +0 -0
  165. package/src/init/files/src/app/general/home/+state/home.selectors.ts.template +0 -20
  166. package/src/init/files/src/app/general/home/+state/home.state.ts.template +0 -13
  167. package/src/init/files/src/app/general/home/home.component.html.template +0 -5
  168. package/src/init/files/src/app/general/home/home.component.ts.template +0 -88
  169. package/src/init/files/src/app/general/landing/+state/landing.actions.ts.template +0 -26
  170. package/src/init/files/src/app/general/landing/+state/landing.effects.ts.template +0 -48
  171. package/src/init/files/src/app/general/landing/+state/landing.model.ts.template +0 -0
  172. package/src/init/files/src/app/general/landing/+state/landing.selectors.ts.template +0 -20
  173. package/src/init/files/src/app/general/landing/+state/landing.state.ts.template +0 -13
  174. package/src/init/files/src/app/general/landing/landing.component.ts.template +0 -98
  175. package/src/init/files/src/app/general/login/login.component.html.template +0 -11
  176. package/src/init/files/src/app/general/login/login.component.ts.template +0 -80
  177. package/src/init/files/src/app/onboarding/consent/+state/consent.actions.ts.template +0 -23
  178. package/src/init/files/src/app/onboarding/consent/+state/consent.effects.ts.template +0 -47
  179. package/src/init/files/src/app/onboarding/consent/+state/consent.model.ts.template +0 -0
  180. package/src/init/files/src/app/onboarding/consent/+state/consent.selectors.ts.template +0 -20
  181. package/src/init/files/src/app/onboarding/consent/+state/consent.state.ts.template +0 -13
  182. package/src/init/files/src/app/onboarding/consent/consent.component.ts.template +0 -151
  183. package/src/init/files/src/app/onboarding/onboarding-routing.module.ts.template +0 -19
  184. package/src/init/files/src/app/onboarding/onboarding.module.spec.ts.template +0 -13
  185. package/src/init/files/src/app/onboarding/onboarding.module.ts.template +0 -32
  186. package/src/init/files/src/app/onboarding/waiting/+state/waiting.actions.ts.template +0 -26
  187. package/src/init/files/src/app/onboarding/waiting/+state/waiting.effects.ts.template +0 -52
  188. package/src/init/files/src/app/onboarding/waiting/+state/waiting.model.ts.template +0 -9
  189. package/src/init/files/src/app/onboarding/waiting/+state/waiting.selectors.ts.template +0 -42
  190. package/src/init/files/src/app/onboarding/waiting/+state/waiting.state.ts.template +0 -13
  191. package/src/init/files/src/app/onboarding/waiting/waiting.animations.ts.template +0 -4
  192. package/src/init/files/src/app/onboarding/waiting/waiting.component.html.template +0 -57
  193. package/src/init/files/src/app/onboarding/waiting/waiting.component.spec.ts.template +0 -25
  194. package/src/init/files/src/app/onboarding/waiting/waiting.component.ts.template +0 -281
  195. package/src/init/files/src/app/shared/components/redeployment-warning/redeployment-warning.component.html.template +0 -10
  196. package/src/init/files/src/app/shared/shared.module.ts.template +0 -87
  197. package/src/init/files/src/main.ts.template +0 -12
  198. package/src/module/files/__name@dasherize__/__name@dasherize__-routing.module.ts.template +0 -15
  199. package/src/module/files/__name@dasherize__/__name@dasherize__.module.spec.ts.template +0 -13
  200. package/src/module/files/__name@dasherize__/__name@dasherize__.module.ts.template +0 -24
  201. package/src/module/index.d.ts +0 -2
  202. package/src/module/index.js +0 -97
  203. package/src/module/index.js.map +0 -1
  204. package/src/module/index_spec.d.ts +0 -1
  205. package/src/module/index_spec.js +0 -23
  206. package/src/module/index_spec.js.map +0 -1
  207. package/src/module/schema.json +0 -38
  208. /package/src/init/files/src/app/{onboarding → first-time}/consent/consent.animations.ts.template +0 -0
  209. /package/src/init/files/src/app/{onboarding → first-time}/consent/consent.component.scss.template +0 -0
  210. /package/src/init/files/src/app/{onboarding → first-time}/consent/consent.component.spec.ts.template +0 -0
  211. /package/src/init/files/src/app/{general → first-time}/landing/landing.animations.ts.template +0 -0
  212. /package/src/init/files/src/app/{general → first-time}/landing/landing.component.scss.template +0 -0
  213. /package/src/init/files/src/app/{general → first-time}/landing/landing.component.spec.ts.template +0 -0
  214. /package/src/init/files/src/app/{general → first-time}/login/login.component.scss.template +0 -0
  215. /package/src/init/files/src/app/{general → first-time}/login/login.component.spec.ts.template +0 -0
  216. /package/src/init/files/src/app/{general → main}/home/home.animations.ts.template +0 -0
  217. /package/src/init/files/src/app/{general → main}/home/home.component.scss.template +0 -0
  218. /package/src/init/files/src/app/{general → main}/home/home.component.spec.ts.template +0 -0
  219. /package/src/init/files/src/app/shared/{components/redeployment-warning → redeployment-warning}/redeployment-warning.component.scss.template +0 -0
  220. /package/src/init/files/src/app/shared/{components/redeployment-warning → redeployment-warning}/redeployment-warning.component.spec.ts.template +0 -0
@@ -1,6 +1,6 @@
1
1
  :host {
2
2
  display: block;
3
- .waitlist-container {
3
+ .admin-panel-container {
4
4
  width: 100%;
5
5
 
6
6
  #waitlist-table {
@@ -0,0 +1,25 @@
1
+ import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { AdminPanelComponent } from './admin-panel.component';
4
+
5
+ describe('AdminPanelComponent', () => {
6
+ let component: AdminPanelComponent;
7
+ let fixture: ComponentFixture<AdminPanelComponent>;
8
+
9
+ beforeEach(waitForAsync(() => {
10
+ TestBed.configureTestingModule({
11
+ declarations: [AdminPanelComponent],
12
+ })
13
+ .compileComponents();
14
+ }));
15
+
16
+ beforeEach(() => {
17
+ fixture = TestBed.createComponent(AdminPanelComponent);
18
+ component = fixture.componentInstance;
19
+ fixture.detectChanges();
20
+ });
21
+
22
+ it('should create', () => {
23
+ expect(component).toBeTruthy();
24
+ });
25
+ });
@@ -0,0 +1,99 @@
1
+ import { Component, OnInit, ChangeDetectionStrategy, input, output, inject, WritableSignal, Signal, signal, computed, Inject, Injector } from '@angular/core';
2
+ import { AdminPanelAnimations } from './admin-panel.animations';
3
+ import { User, AccessState } from '../../core/store/user/user.model';
4
+ import { AuthStore } from '../../core/store/auth/auth.store';
5
+ import { UserStore } from '../../core/store/user/user.store';
6
+ import { MatSnackBar } from '@angular/material/snack-bar';
7
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
8
+ import { NgFor } from '@angular/common';
9
+ import { MatMenuTrigger, MatMenu, MatMenuItem } from '@angular/material/menu';
10
+ import { MatTable, MatColumnDef, MatHeaderCellDef, MatHeaderCell, MatCellDef, MatCell, MatHeaderRowDef, MatHeaderRow, MatRowDef, MatRow } from '@angular/material/table';
11
+ import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
12
+
13
+ // If you add other columns, update this, e.g. AccessState | string | boolean;
14
+ type UpdateValueTypes = AccessState;
15
+
16
+ @Component({
17
+ selector: 'app-admin-panel',
18
+ templateUrl: './admin-panel.component.html',
19
+ styleUrls: ['./admin-panel.component.scss'],
20
+ changeDetection: ChangeDetectionStrategy.OnPush,
21
+ animations: AdminPanelAnimations,
22
+ standalone: true,
23
+ imports: [
24
+ MatTable,
25
+ MatColumnDef,
26
+ MatHeaderCellDef,
27
+ MatHeaderCell,
28
+ MatCellDef,
29
+ MatCell,
30
+ MatMenuTrigger,
31
+ MatMenu,
32
+ NgFor,
33
+ MatMenuItem,
34
+ MatHeaderRowDef,
35
+ MatHeaderRow,
36
+ MatRowDef,
37
+ MatRow,
38
+ ],
39
+ })
40
+ export class AdminPanelComponent implements OnInit {
41
+ readonly authStore = inject(AuthStore);
42
+ readonly userStore = inject(UserStore);
43
+
44
+ // --------------- INPUTS AND OUTPUTS ------------------
45
+
46
+ // --------------- LOCAL UI STATE ----------------------
47
+
48
+ /** Access options for menu sorted alphabetically. */
49
+ accessOptions: AccessState[] = Object.keys(AccessState)
50
+ .map((k) => AccessState[k] as AccessState)
51
+ .sort((a, b) => {
52
+ if (a > b) {
53
+ return 1;
54
+ } else if (a < b) {
55
+ return -1;
56
+ } else {
57
+ return 0;
58
+ }
59
+ });
60
+
61
+ /** Columns to display in the table */
62
+ displayedColumns = ['userName', 'accessState'];
63
+
64
+ // --------------- COMPUTED DATA -----------------------
65
+
66
+ /** Get array of all waiting users. */
67
+ waitingUsers: Signal<User[]> = computed(() => this.userStore.selectEntities([], { orderBy: 'accessState' }));
68
+
69
+ // --------------- EVENT HANDLING ----------------------
70
+
71
+ /** Event stream for updating user accessState. */
72
+ async updateState(user: User, key: string, value: UpdateValueTypes) {
73
+ const data = {};
74
+ data[key] = value;
75
+
76
+ try {
77
+ await this.userStore.update(user.__id, { ...data });
78
+ this.snackBar.open(`Set ${user.name}'s ${key} to ${value}`, '', { duration: 3000 });
79
+ } catch (e) {
80
+ console.error(e);
81
+ this.snackBar.open('Failed to submit response', '', { duration: 3000 });
82
+ }
83
+ }
84
+
85
+ // --------------- OTHER -------------------------------
86
+
87
+ constructor(
88
+ private snackBar: MatSnackBar,
89
+ private injector: Injector,
90
+ @Inject(BATCH_WRITE_SERVICE) private batch: BatchWriteService,
91
+ ) {
92
+ }
93
+
94
+ // --------------- LOAD AND CLEANUP --------------------
95
+
96
+ ngOnInit() {
97
+ this.userStore.load([], {});
98
+ }
99
+ }
@@ -1,4 +1,5 @@
1
1
  <div class="content-container">
2
+ <app-navbar></app-navbar>
2
3
  <app-redeployment-warning></app-redeployment-warning>
3
4
  <router-outlet></router-outlet>
4
5
  </div>
@@ -1,22 +1,28 @@
1
- import { Component, OnInit } from '@angular/core';
2
- import { Router, NavigationEnd } from '@angular/router';
3
- import { select, Store } from '@ngrx/store';
4
- import * as fromStore from './core/store/app.reducer';
5
- import { LoadAuth } from './core/store/auth/auth.actions';
1
+ import { inject, Component, OnInit } from '@angular/core';
2
+ import { Router, NavigationEnd, RouterOutlet } from '@angular/router';
6
3
  import { RoutingStateService } from './core/router/routing-state.service';
7
4
  import { TimeAnalyticsService } from './core/analytics/time-analytics.service';
8
- import { DetectRedeploymentService } from './shared/components/redeployment-warning/redeployment-warning.service';
5
+ import { AuthStore } from './core/store/auth/auth.store';
6
+ import { DetectRedeploymentService } from './shared/redeployment-warning/redeployment-warning.service';
7
+ import { RedeploymentWarningComponent } from './shared/redeployment-warning/redeployment-warning.component';
8
+ import { NavbarComponent } from './shared/navbar/navbar.component';
9
9
 
10
10
  @Component({
11
11
  selector: 'app-root',
12
12
  templateUrl: './app.component.html',
13
13
  styleUrls: ['./app.component.scss'],
14
+ standalone: true,
15
+ imports: [
16
+ NavbarComponent,
17
+ RedeploymentWarningComponent,
18
+ RouterOutlet,
19
+ ],
14
20
  })
15
21
  export class AppComponent implements OnInit {
22
+ readonly authStore = inject(AuthStore);
16
23
  constructor(
17
24
  private router: Router,
18
25
  private routingState: RoutingStateService,
19
- private store: Store<fromStore.State>,
20
26
  private analytics: TimeAnalyticsService,
21
27
  private detectRedeployment: DetectRedeploymentService,
22
28
  ) {
@@ -24,7 +30,7 @@ export class AppComponent implements OnInit {
24
30
 
25
31
  ngOnInit() {
26
32
  // Load auth into store
27
- this.store.dispatch( new LoadAuth() );
33
+ this.authStore.loadAuth();
28
34
 
29
35
  // Setup time analytics
30
36
  this.analytics.startTimeLogging();
@@ -0,0 +1,63 @@
1
+ import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
2
+ import { provideRouter, withHashLocation, withComponentInputBinding, withPreloading, PreloadAllModules } from '@angular/router';
3
+ import { routes } from './app.routes';
4
+ import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
5
+ import { importProvidersFrom } from '@angular/core';
6
+ import { provideFirebaseApp, getApp, initializeApp } from '@angular/fire/app';
7
+ import { provideFirestore, getFirestore, enableIndexedDbPersistence } from '@angular/fire/firestore';
8
+ import { provideAuth, getAuth } from '@angular/fire/auth';
9
+ import { environment } from '../environments/environment';
10
+ import { FirebaseService } from './core/firebase/firebase.service';
11
+ import { FirebaseMockService } from './core/firebase/firebase.mock.service';
12
+ import { DATABASE_SERVICE } from './core/firebase/database.service';
13
+ import { BATCH_WRITE_SERVICE } from './core/store/batch-write.service';
14
+ import { BatchWriteMockService } from './core/store/batch-write.mock.service';
15
+ import { BatchWriteDBService } from './core/store/batch-write.firebase.service';
16
+ import { LogInDevService, LogDBService, LOG_SERVICE } from './core/analytics/log.service';
17
+ import { getFunctions, provideFunctions } from '@angular/fire/functions';
18
+ import { getPerformance, providePerformance } from '@angular/fire/performance';
19
+
20
+ const firebaseProviders = !environment.production && environment['mockDB'] ? [] : [
21
+ provideFirebaseApp(() => initializeApp(environment.firebase)),
22
+ provideFirebaseApp(() => initializeApp(environment.firebaseLogs, 'logs')),
23
+ provideFirestore(() => {
24
+ const firestore = getFirestore();
25
+ enableIndexedDbPersistence(firestore);
26
+ return firestore;
27
+ }),
28
+ provideFirestore(() => {
29
+ const firestore = getFirestore(getApp('logs'));
30
+ // connectFirestoreEmulator(firestore, 'localhost', 8080);
31
+ enableIndexedDbPersistence(firestore);
32
+ return firestore;
33
+ }),
34
+ provideAuth(() => getAuth()),
35
+ provideFunctions(() => getFunctions()),
36
+ providePerformance(() => getPerformance())
37
+ ];
38
+
39
+ export const appConfig: ApplicationConfig = {
40
+ providers: [
41
+ provideZoneChangeDetection({ eventCoalescing: true }),
42
+ provideRouter(
43
+ routes,
44
+ withHashLocation(),
45
+ withComponentInputBinding(),
46
+ withPreloading(PreloadAllModules),
47
+ ),
48
+ provideAnimationsAsync(),
49
+ ...firebaseProviders,
50
+ {
51
+ provide: LOG_SERVICE,
52
+ useClass: !environment.production ? LogInDevService : LogDBService,
53
+ },
54
+ {
55
+ provide: DATABASE_SERVICE,
56
+ useClass: !environment.production && environment['mockDB'] ? FirebaseMockService : FirebaseService,
57
+ },
58
+ {
59
+ provide: BATCH_WRITE_SERVICE,
60
+ useClass: !environment.production && environment['mockDB'] ? BatchWriteMockService : BatchWriteDBService,
61
+ },
62
+ ],
63
+ };
@@ -0,0 +1,32 @@
1
+ import { Routes } from '@angular/router';
2
+ import { AuthGuard } from './core/auth/auth.guard';
3
+ import { AdminPanelComponent } from './admin/admin-panel/admin-panel.component';
4
+ import { LandingComponent } from './first-time/landing/landing.component';
5
+ import { LoginComponent } from './first-time/login/login.component';
6
+ import { ConsentComponent } from './first-time/consent/consent.component';
7
+ import { EarlyAccessComponent } from './first-time/early-access/early-access.component';
8
+ import { OnboardingComponent } from './first-time/onboarding/onboarding.component';
9
+ import { HomeComponent } from './main/home/home.component';
10
+
11
+ export const routes: Routes = [
12
+ // Admin Routes
13
+ { path: 'admin', loadComponent: () => import('./admin/admin-panel/admin-panel.component')
14
+ .then((mod) => mod.AdminPanelComponent), canActivate: [AuthGuard] },
15
+ // First-Time User Experience Routes
16
+ { path: 'landing', loadComponent: () => import('./first-time/landing/landing.component')
17
+ .then((mod) => mod.LandingComponent), canActivate: [AuthGuard] },
18
+ { path: 'login', loadComponent: () => import('./first-time/login/login.component')
19
+ .then((mod) => mod.LoginComponent) },
20
+ { path: 'consent', loadComponent: () => import('./first-time/consent/consent.component')
21
+ .then((mod) => mod.ConsentComponent), canActivate: [AuthGuard] },
22
+ { path: 'early-access', loadComponent: () => import('./first-time/early-access/early-access.component')
23
+ .then((mod) => mod.EarlyAccessComponent), canActivate: [AuthGuard] },
24
+ { path: 'onboarding', loadComponent: () => import('./first-time/onboarding/onboarding.component')
25
+ .then((mod) => mod.OnboardingComponent), canActivate: [AuthGuard] },
26
+ // Main Routes
27
+ { path: 'home', loadComponent: () => import('./main/home/home.component')
28
+ .then((mod) => mod.HomeComponent), canActivate: [AuthGuard] },
29
+ { path: '', loadComponent: () => import('./first-time/landing/landing.component')
30
+ .then((mod) => mod.LandingComponent), canActivate: [AuthGuard] },
31
+ { path: '**', redirectTo: 'landing', pathMatch: 'full' },
32
+ ];
@@ -1,120 +1,153 @@
1
- import { Injectable } from '@angular/core';
2
- import { LoggingAngularFirestore } from '../setup/firebase-setup';
1
+ import { Injectable, InjectionToken } from '@angular/core';
3
2
  import { isDevMode } from '@angular/core';
4
- import { environment } from '../../../environments/environment';
5
-
6
- interface LogData {
7
- __userId?: string;
8
- __sessionId?: string;
9
- __deviceId?: string;
10
- route: string;
11
- startTime: number;
12
- time: Array<{
13
- total: number;
14
- type: string;
15
- }>;
3
+ import { environment } from '../../../environments/environment.prod';
4
+ import { Firestore, FirestoreInstances, setDoc, doc } from '@angular/fire/firestore';
5
+ import { TimeAtRoute } from './time-analytics.service';
6
+
7
+ interface LogData extends TimeAtRoute {
16
8
  interactions?: Array<{ 0: number; 1: string; 2: string; 3: string; }>;
17
9
  }
18
10
 
11
+ /**
12
+ * Helper function for getting a log id to make sure we don't save two logs
13
+ * of the same session at the same time
14
+ */
15
+ function getLogId(data: LogData): string {
16
+ return `${data.__sessionId}__${data.startTime}`;
17
+ }
18
+
19
+ export interface LogService {
20
+ rawLog(data: LogData): void;
21
+ rawLogOnBeaconEvent(data: LogData): void;
22
+ }
23
+
24
+ // InjectionToken that can be swapped out for
25
+ export const LOG_SERVICE = new InjectionToken<LogService>('LogService');
26
+
27
+ // When using the mock DB we don't want any Firestore dependencies, which is why we're creating a separate one
19
28
  @Injectable({
20
29
  providedIn: 'root',
21
30
  })
22
- export class LogService {
31
+ export class LogInDevService {
32
+
23
33
  /** Whether should log to the console in dev. */
24
34
  LOG_IN_DEV = true;
25
35
 
36
+ constructor() { }
37
+
38
+ rawLog(data: LogData) {
39
+ if (this.LOG_IN_DEV) {
40
+ const logId = getLogId(data);
41
+ console.log('LOGGING', logId, data);
42
+ }
43
+ }
44
+
45
+ rawLogOnBeaconEvent(data: LogData) {
46
+ if (this.LOG_IN_DEV) {
47
+ const logId = getLogId(data);
48
+ if (data !== null) {
49
+ console.log('BEACON LOGGING', logId, data);
50
+ }
51
+ }
52
+ }
53
+ }
54
+
55
+ /** Function for reformatting log for beacon. */
56
+ function reformatLogForBeacon(data: LogData, logType, logId) {
57
+ // Converts JSON objects to Firestore's REST API Document format
58
+ // from: https://stackoverflow.com/questions/62246410/how-to-convert-a-firestore-document-to-plain-json-and-vice-versa/62304377#62304377
59
+ const jsonToDocument = (value) => {
60
+ if (!value) {
61
+ return { 'nullValue': null };
62
+ } else if (!isNaN(value) && !(value && value.constructor === Array)) { // edit, checking if not an array since empty arrays pass the isNan test
63
+ if (value.toString().indexOf('.') != -1) {
64
+ return { 'doubleValue': value };
65
+ } else {
66
+ return { 'integerValue': value };
67
+ }
68
+ } else if (value === 'true' || value === 'false' || typeof value === 'boolean') {
69
+ return { 'booleanValue': value };
70
+ } else if (typeof value === 'string') { // edit: removed check for Date that was before String check (see below)
71
+ return { 'stringValue': value };
72
+ } else if (value && value.constructor === Array) {
73
+ return { 'arrayValue': { values: value.map((v) => jsonToDocument(v)) } };
74
+ } else if (typeof value === 'object') {
75
+ const obj = {};
76
+ for (const o in value) {
77
+ if (Object.prototype.hasOwnProperty.call(value, o)) {
78
+ obj[o] = jsonToDocument(value[o]);
79
+ }
80
+ }
81
+ return { 'mapValue': { fields: obj } };
82
+ }
83
+ };
84
+
85
+ if (data !== null && environment.firebaseLogs['projectId']) {
86
+ const wrappedData = {
87
+ writes: [
88
+ {
89
+ update: {
90
+ name: `projects/${environment.firebaseLogs['projectId']}/databases/(default)/documents/${logType}/${logId}`,
91
+ fields: {
92
+ ...jsonToDocument(data).mapValue.fields,
93
+ },
94
+ },
95
+ },
96
+ ],
97
+ };
98
+
99
+ // console.log('WRAPPED_DATA', wrappedData);
100
+
101
+ const preparedData = new Blob([JSON.stringify(wrappedData, null, 2)], {
102
+ type: 'application/json',
103
+ });
104
+
105
+ return preparedData;
106
+ } else {
107
+ return null;
108
+ }
109
+ }
110
+
111
+
112
+
113
+ @Injectable({
114
+ providedIn: 'root',
115
+ })
116
+ export class LogDBService {
117
+
118
+ private log: Firestore;
119
+
26
120
  constructor(
27
- private log: LoggingAngularFirestore,
121
+ private allFirestoreInstances: FirestoreInstances,
28
122
  ) {
123
+ this.log = this.allFirestoreInstances.find((x) => x.toJSON()['app'].name === 'logs');
29
124
  }
30
125
 
31
- rawLog(data: LogData, logType: string = 'logs', logId?: string) {
32
- // If no logId supplied, then create one
33
- if (!logId) {
34
- logId = this.log.createId();
35
- }
126
+ rawLog(data: LogData) {
127
+ const logId = getLogId(data);
128
+ const logType = 'logs';
36
129
 
37
130
  if (!isDevMode()) {
38
131
  // Note that we are intentionally overriding logs with same id.
39
132
  // This allows for making sure the same log doesn't get stored twice,
40
133
  // e.g. for storing things in localStorage and saving next time we load
41
134
  // the browser
42
- this.log.doc(`/${logType}/${logId}`).set(data);
43
- } else if (this.LOG_IN_DEV) {
44
- console.log('LOGGING', logId, data);
135
+ const docRef = doc(this.log, logType, logId);
136
+ setDoc(docRef, data);
45
137
  }
46
138
  }
47
139
 
48
- rawLogOnBeaconEvent(data: LogData, logType: string = 'logs', logId?: string) {
49
- // If no logId supplied, then create one
50
- if (!logId) {
51
- logId = this.log.createId();
52
- }
140
+ rawLogOnBeaconEvent(data: LogData) {
141
+ const logId = getLogId(data);
142
+ const logType = 'logs';
53
143
 
54
144
  if (data !== null) {
55
- if (!isDevMode()) {
145
+ if (!isDevMode() && environment.firebaseLogs['projectId']) {
56
146
  navigator.sendBeacon(
57
- `https://firestore.googleapis.com/v1/projects/${environment.firebaseLogs.projectId}/databases/(default)/documents:commit`,
58
- this.reformatLogForBeacon(data, logType, logId),
147
+ `https://firestore.googleapis.com/v1/projects/${environment.firebaseLogs['projectId']}/databases/(default)/documents:commit`,
148
+ reformatLogForBeacon(data, logType, logId),
59
149
  );
60
- } else if (this.LOG_IN_DEV) {
61
- console.log('BEACON LOGGING', logId, data);
62
150
  }
63
151
  }
64
152
  }
65
-
66
- reformatLogForBeacon(data: LogData, logType, logId) {
67
- // Converts JSON objects to Firestore's REST API Document format
68
- // from: https://stackoverflow.com/questions/62246410/how-to-convert-a-firestore-document-to-plain-json-and-vice-versa/62304377#62304377
69
- const jsonToDocument = (value) => {
70
- if (!value) {
71
- return { 'nullValue': null };
72
- } else if (!isNaN(value) && !(value && value.constructor === Array)) { // edit, checking if not an array since empty arrays pass the isNan test
73
- if (value.toString().indexOf('.') != -1) {
74
- return { 'doubleValue': value };
75
- } else {
76
- return { 'integerValue': value };
77
- }
78
- } else if (value === 'true' || value === 'false' || typeof value === 'boolean') {
79
- return { 'booleanValue': value };
80
- } else if (typeof value === 'string') { // edit: removed check for Date that was before String check (see below)
81
- return { 'stringValue': value };
82
- } else if (value && value.constructor === Array) {
83
- return { 'arrayValue': { values: value.map((v) => jsonToDocument(v)) } };
84
- } else if (typeof value === 'object') {
85
- const obj = {};
86
- for (const o in value) {
87
- if (Object.prototype.hasOwnProperty.call(value, o)) {
88
- obj[o] = jsonToDocument(value[o]);
89
- }
90
- }
91
- return { 'mapValue': { fields: obj } };
92
- }
93
- };
94
-
95
- if (data !== null) {
96
- const wrappedData = {
97
- writes: [
98
- {
99
- update: {
100
- name: `projects/${environment.firebaseLogs.projectId}/databases/(default)/documents/${logType}/${logId}`,
101
- fields: {
102
- ...jsonToDocument(data).mapValue.fields,
103
- },
104
- },
105
- },
106
- ],
107
- };
108
-
109
- // console.log('WRAPPED_DATA', wrappedData);
110
-
111
- const preparedData = new Blob([JSON.stringify(wrappedData, null, 2)], {
112
- type: 'application/json',
113
- });
114
-
115
- return preparedData;
116
- } else {
117
- return null;
118
- }
119
- }
120
153
  }
@@ -1,9 +1,9 @@
1
- import { Injectable } from '@angular/core';
1
+ import { Injectable, Inject } from '@angular/core';
2
2
  import { Router, NavigationEnd } from '@angular/router';
3
3
  import { Subject, Observable, ConnectableObservable, fromEvent, merge, combineLatest } from 'rxjs';
4
4
  import { startWith, withLatestFrom, tap, takeUntil, switchMap, debounceTime, mergeMap, publishReplay, filter, map, pairwise, scan } from 'rxjs/operators';
5
- import { FirebaseService } from '../firebase/firebase.service';
6
- import { LogService } from './log.service';
5
+ import { LOG_SERVICE, LogService } from './log.service';
6
+ import { DATABASE_SERVICE, DatabaseService } from '../firebase/database.service';
7
7
  import { SessionLocalStorageService } from '../local-storage/session-local-storage.service';
8
8
  import { SessionService } from '../local-storage/session.service';
9
9
 
@@ -75,24 +75,16 @@ export class TimeAnalyticsService {
75
75
  /** Interactions data at latest route. */
76
76
  private interactionsAtRoute: Interaction[] = null;
77
77
 
78
- /**
79
- * Helper function for getting a log id to make sure we don't save two logs
80
- * of the same session at the same time
81
- */
82
- private getLogId(data) {
83
- return `${data.__sessionId}__${data.startTime}`;
84
- }
85
-
86
78
  /** Helper function for saving log to DB given timeAtRoute, interactionsAtRoute. */
87
79
  private saveLogToDB(timeAtRoute: TimeAtRoute, interactionsAtRoute: Interaction[]) {
88
80
  if (timeAtRoute) {
89
81
  if (!interactionsAtRoute) {
90
- this.log.rawLog(timeAtRoute, 'logs', this.getLogId(timeAtRoute));
82
+ this.log.rawLog(timeAtRoute);
91
83
  } else {
92
84
  this.log.rawLog({
93
85
  ...timeAtRoute,
94
86
  interactions: interactionsAtRoute,
95
- }, 'logs', this.getLogId(timeAtRoute));
87
+ });
96
88
  }
97
89
  }
98
90
  }
@@ -195,8 +187,8 @@ export class TimeAnalyticsService {
195
187
 
196
188
  constructor(
197
189
  private router: Router,
198
- private db: FirebaseService,
199
- private log: LogService,
190
+ @Inject(DATABASE_SERVICE) private db: DatabaseService,
191
+ @Inject(LOG_SERVICE) private log: LogService,
200
192
  private local: SessionLocalStorageService,
201
193
  private session: SessionService,
202
194
  ) {
@@ -214,12 +206,12 @@ export class TimeAnalyticsService {
214
206
  ) {
215
207
  const interactionsAtRoute = this.local.getItemForSession(this.IX_KEY);
216
208
  if (!interactionsAtRoute) {
217
- this.log.rawLogOnBeaconEvent(timeAtRoute, 'logs', this.getLogId(timeAtRoute));
209
+ this.log.rawLogOnBeaconEvent(timeAtRoute);
218
210
  } else {
219
211
  this.log.rawLogOnBeaconEvent({
220
212
  ...timeAtRoute,
221
213
  interactions: interactionsAtRoute,
222
- }, 'logs', this.getLogId(timeAtRoute));
214
+ });
223
215
  }
224
216
  }
225
217
  }
@@ -1,28 +1,31 @@
1
- import { Injectable } from '@angular/core';
1
+ import { Inject, inject, Injectable } from '@angular/core';
2
2
  import { ActivatedRouteSnapshot, RouterStateSnapshot, Router } from '@angular/router';
3
- import { of, Observable, forkJoin } from 'rxjs';
4
- import { combineLatest, tap, filter, switchMap, map, take, pluck, withLatestFrom } from 'rxjs/operators';
5
- import { select, Store } from '@ngrx/store';
6
3
  import { User, AccessState } from '../store/user/user.model';
7
- import * as fromStore from '../store/app.reducer';
8
- import * as fromAuth from '../store/auth/auth.reducer';
9
- import { FirebaseService } from '../firebase/firebase.service';
10
- import { AuthSelectorsService } from '../store/auth/auth.selectors';
4
+ import { AuthStore } from '../store/auth/auth.store';
5
+ import { filter, switchMap, take } from 'rxjs/operators';
6
+ import { of, Observable } from 'rxjs';
7
+ import { toObservable } from '@angular/core/rxjs-interop';
8
+ import { DATABASE_SERVICE, DatabaseService } from '../firebase/database.service';
11
9
 
12
10
  @Injectable({
13
11
  providedIn: 'root',
14
12
  })
15
13
  export class AuthGuard {
14
+ readonly authStore = inject(AuthStore);
15
+ user$: Observable<User>;
16
+
16
17
  constructor(
17
- private db: FirebaseService,
18
- private store: Store<fromStore.State>,
19
18
  private router: Router,
20
- private authSelector: AuthSelectorsService,
21
- ) { }
19
+ @Inject(DATABASE_SERVICE) private db: DatabaseService,
20
+ ) {
21
+ this.user$ = toObservable(this.authStore.user).pipe(
22
+ filter((user) => user !== null),
23
+ );
24
+ }
22
25
 
23
26
  canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
24
27
  return this.db.afUser().pipe(
25
- switchMap((afUser) => afUser ? this.authSelector.selectAuthUser() : of(null)),
28
+ switchMap((afUser) => afUser ? this.user$.pipe(take(1)) : of(null)),
26
29
  switchMap((dbUser) => {
27
30
  // The overall approach is that we have a sequence of things we need to check (signed in, consent, waiting, walkthrough).
28
31
  // - For each, we want to make sure people not past that stage can't see past it,
@@ -53,24 +56,24 @@ export class AuthGuard {
53
56
 
54
57
 
55
58
  // Then handle whether users have consented. If not, go to consent, otherwise skip past consent.
56
- if ((!dbUser.consented || dbUser.accessState === AccessState.CONSENT) && state.url !== '/onboarding/consent') {
57
- this.router.navigate(['/onboarding/consent'], { queryParams: next.queryParams });
59
+ if ((!dbUser.consented || dbUser.accessState === AccessState.CONSENT) && state.url !== '/consent') {
60
+ this.router.navigate(['/consent'], { queryParams: next.queryParams });
58
61
  return of(false);
59
- } else if ((!dbUser.consented || dbUser.accessState === AccessState.CONSENT) && state.url === '/onboarding/consent') {
62
+ } else if ((!dbUser.consented || dbUser.accessState === AccessState.CONSENT) && state.url === '/consent') {
60
63
  return of(true);
61
- } else if (dbUser.consented && dbUser.accessState !== AccessState.CONSENT && state.url === '/onboarding/consent') {
62
- this.router.navigate(['/onboarding/waiting'], { queryParams: next.queryParams });
64
+ } else if (dbUser.consented && dbUser.accessState !== AccessState.CONSENT && state.url === '/consent') {
65
+ this.router.navigate(['/early-access'], { queryParams: next.queryParams });
63
66
  return of(false);
64
67
  }
65
68
 
66
69
  // Then handle whether users are past waitlist. If not, go to waiting, otherwise skip past waiting.
67
70
  const waitingStates = [AccessState.SUBMIT_INTEREST, AccessState.SUBMIT_DETAILED, AccessState.WAITING];
68
- if (waitingStates.includes(dbUser.accessState) && state.url !== '/onboarding/waiting') {
69
- this.router.navigate(['/onboarding/waiting'], { queryParams: next.queryParams });
71
+ if (waitingStates.includes(dbUser.accessState) && state.url !== '/early-access') {
72
+ this.router.navigate(['/early-access'], { queryParams: next.queryParams });
70
73
  return of(false);
71
- } else if (waitingStates.includes(dbUser.accessState) && state.url === '/onboarding/waiting') {
74
+ } else if (waitingStates.includes(dbUser.accessState) && state.url === '/early-access') {
72
75
  return of(true);
73
- } else if (!waitingStates.includes(dbUser.accessState) && state.url === '/onboarding/waiting') {
76
+ } else if (!waitingStates.includes(dbUser.accessState) && state.url === '/early-access') {
74
77
  this.router.navigate(['/home'], { queryParams: next.queryParams });
75
78
  return of(false);
76
79
  }