@tech4good/angular-schematics 13.5.0 → 13.7.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.
- package/package.json +1 -1
- package/src/component/files/__name@dasherize__/__name@dasherize__.component.ts.template +8 -8
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.actions.ts.template +3 -2
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.effects.ts.template +6 -5
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.selectors.ts.template +2 -2
- package/src/container/files/__name@dasherize__/__name@dasherize__.component.ts.template +25 -14
- package/src/container/index.js +13 -2
- package/src/container/index.js.map +1 -1
- package/src/entity/files/__name@dasherize__/__name@dasherize__.actions.ts.template +9 -30
- package/src/entity/files/__name@dasherize__/__name@dasherize__.effects.ts.template +23 -24
- package/src/init/files/.github/workflows/angular-github-ci.yml.template +1 -2
- package/src/init/files/package.json.template +3 -1
- package/src/init/files/src/app/admin/admin-routing.module.ts.template +17 -0
- package/src/init/files/src/app/admin/admin.module.spec.ts.template +13 -0
- package/src/init/files/src/app/admin/admin.module.ts.template +28 -0
- package/src/init/files/src/app/admin/waitlist/+state/waitlist.actions.ts.template +23 -0
- package/src/init/files/src/app/admin/waitlist/+state/waitlist.effects.ts.template +50 -0
- package/src/init/files/src/app/admin/waitlist/+state/waitlist.selectors.ts.template +39 -0
- package/src/init/files/src/app/admin/waitlist/+state/waitlist.state.ts.template +13 -0
- package/src/init/files/src/app/admin/waitlist/waitlist.animations.ts.template +4 -0
- package/src/init/files/src/app/admin/waitlist/waitlist.component.html.template +30 -0
- package/src/init/files/src/app/admin/waitlist/waitlist.component.scss.template +14 -0
- package/src/init/files/src/app/admin/waitlist/waitlist.component.spec.ts.template +25 -0
- package/src/init/files/src/app/admin/waitlist/waitlist.component.ts.template +136 -0
- package/src/init/files/src/app/app-routing.module.ts.template +13 -5
- package/src/init/files/src/app/app.component.html.template +1 -0
- package/src/init/files/src/app/app.component.scss.template +7 -0
- package/src/init/files/src/app/app.component.ts.template +5 -0
- package/src/init/files/src/app/core/analytics/log.service.ts.template +89 -4
- package/src/init/files/src/app/core/analytics/time-analytics.service.ts.template +204 -69
- package/src/init/files/src/app/core/auth/auth.guard.ts.template +85 -0
- package/src/init/files/src/app/core/core.module.ts.template +4 -0
- package/src/init/files/src/app/core/firebase/firebase.service.ts.template +4 -4
- package/src/init/files/src/app/core/local-storage/local-storage.service.ts.template +47 -0
- package/src/init/files/src/app/core/local-storage/session-local-storage.service.ts.template +67 -0
- package/src/init/files/src/app/core/local-storage/session.service.ts.template +48 -0
- package/src/init/files/src/app/core/store/app-state/app-state.actions.ts.template +270 -0
- package/src/init/files/src/app/core/store/app-state/app-state.effects.ts.template +131 -0
- package/src/init/files/src/app/core/store/app-state/app-state.model.ts.template +8 -0
- package/src/init/files/src/app/core/store/app-state/app-state.reducer.spec.ts.template +13 -0
- package/src/init/files/src/app/core/store/app-state/app-state.reducer.ts.template +51 -0
- package/src/init/files/src/app/core/store/app-state/app-state.service.ts.template +50 -0
- package/src/init/files/src/app/core/store/app.effects.ts.template +10 -2
- package/src/init/files/src/app/core/store/app.reducer.ts.template +6 -0
- package/src/init/files/src/app/core/store/app.selectors.ts.template +12 -0
- package/src/init/files/src/app/core/store/auth/auth.actions.ts.template +3 -1
- package/src/init/files/src/app/core/store/auth/auth.effects.ts.template +27 -31
- package/src/init/files/src/app/core/store/auth/auth.reducer.ts.template +1 -1
- package/src/init/files/src/app/core/store/auth/auth.selectors.ts.template +5 -1
- package/src/init/files/src/app/core/store/cached-load-connections.service.ts.template +9 -8
- package/src/init/files/src/app/core/store/user/user.model.ts.template +14 -0
- package/src/init/files/src/app/core/store/user-context/user-context.actions.ts.template +270 -0
- package/src/init/files/src/app/core/store/user-context/user-context.effects.ts.template +131 -0
- package/src/init/files/src/app/core/store/user-context/user-context.model.ts.template +13 -0
- package/src/init/files/src/app/core/store/user-context/user-context.reducer.spec.ts.template +13 -0
- package/src/init/files/src/app/core/store/user-context/user-context.reducer.ts.template +51 -0
- package/src/init/files/src/app/core/store/user-context/user-context.service.ts.template +50 -0
- package/src/init/files/src/app/general/general-routing.module.ts.template +6 -2
- package/src/init/files/src/app/general/general.module.ts.template +8 -2
- package/src/init/files/src/app/general/home/+state/home.actions.ts.template +26 -0
- package/src/init/files/src/app/general/home/+state/home.effects.ts.template +48 -0
- package/src/init/files/src/app/general/home/+state/home.model.ts.template +0 -0
- package/src/init/files/src/app/general/home/+state/home.selectors.ts.template +20 -0
- package/src/init/files/src/app/general/home/+state/home.state.ts.template +13 -0
- package/src/init/files/src/app/general/home/home.animations.ts.template +4 -0
- package/src/init/files/src/app/general/home/home.component.html.template +5 -0
- package/src/init/files/src/app/general/home/home.component.scss.template +5 -0
- package/src/init/files/src/app/general/{e404/e404.component.spec.ts.template → home/home.component.spec.ts.template} +6 -6
- package/src/init/files/src/app/general/home/home.component.ts.template +88 -0
- package/src/init/files/src/app/general/landing/+state/landing.actions.ts.template +26 -0
- package/src/init/files/src/app/general/landing/+state/landing.effects.ts.template +48 -0
- package/src/init/files/src/app/general/landing/+state/landing.model.ts.template +0 -0
- package/src/init/files/src/app/general/landing/+state/landing.selectors.ts.template +20 -0
- package/src/init/files/src/app/general/landing/+state/landing.state.ts.template +13 -0
- package/src/init/files/src/app/general/landing/landing.animations.ts.template +4 -0
- package/src/init/files/src/app/general/landing/landing.component.html.template +3 -0
- package/src/init/files/src/app/general/landing/landing.component.scss.template +13 -0
- package/src/init/files/src/app/general/landing/landing.component.spec.ts.template +25 -0
- package/src/init/files/src/app/general/landing/landing.component.ts.template +98 -0
- package/src/init/files/src/app/general/login/login.component.html.template +5 -5
- package/src/init/files/src/app/general/login/login.component.ts.template +12 -4
- package/src/init/files/src/app/onboarding/consent/+state/consent.actions.ts.template +23 -0
- package/src/init/files/src/app/onboarding/consent/+state/consent.effects.ts.template +47 -0
- package/src/init/files/src/app/onboarding/consent/+state/consent.model.ts.template +0 -0
- package/src/init/files/src/app/onboarding/consent/+state/consent.selectors.ts.template +20 -0
- package/src/init/files/src/app/onboarding/consent/+state/consent.state.ts.template +13 -0
- package/src/init/files/src/app/onboarding/consent/consent.animations.ts.template +4 -0
- package/src/init/files/src/app/onboarding/consent/consent.component.html.template +61 -0
- package/src/init/files/src/app/onboarding/consent/consent.component.scss.template +77 -0
- package/src/init/files/src/app/onboarding/consent/consent.component.spec.ts.template +25 -0
- package/src/init/files/src/app/onboarding/consent/consent.component.ts.template +152 -0
- package/src/init/files/src/app/onboarding/onboarding-routing.module.ts.template +19 -0
- package/src/init/files/src/app/onboarding/onboarding.module.spec.ts.template +13 -0
- package/src/init/files/src/app/onboarding/onboarding.module.ts.template +32 -0
- package/src/init/files/src/app/onboarding/waiting/+state/waiting.actions.ts.template +26 -0
- package/src/init/files/src/app/onboarding/waiting/+state/waiting.effects.ts.template +52 -0
- package/src/init/files/src/app/onboarding/waiting/+state/waiting.model.ts.template +9 -0
- package/src/init/files/src/app/onboarding/waiting/+state/waiting.selectors.ts.template +42 -0
- package/src/init/files/src/app/onboarding/waiting/+state/waiting.state.ts.template +13 -0
- package/src/init/files/src/app/onboarding/waiting/waiting.animations.ts.template +4 -0
- package/src/init/files/src/app/onboarding/waiting/waiting.component.html.template +57 -0
- package/src/init/files/src/app/onboarding/waiting/waiting.component.scss.template +99 -0
- package/src/init/files/src/app/onboarding/waiting/waiting.component.spec.ts.template +25 -0
- package/src/init/files/src/app/onboarding/waiting/waiting.component.ts.template +279 -0
- package/src/init/files/src/app/shared/components/redeployment-warning/redeployment-warning.component.html.template +10 -0
- package/src/init/files/src/app/shared/components/redeployment-warning/redeployment-warning.component.scss.template +46 -0
- package/src/init/files/src/app/shared/components/redeployment-warning/redeployment-warning.component.spec.ts.template +24 -0
- package/src/init/files/src/app/shared/components/redeployment-warning/redeployment-warning.component.ts.template +29 -0
- package/src/init/files/src/app/shared/components/redeployment-warning/redeployment-warning.service.ts.template +63 -0
- package/src/init/files/src/app/shared/shared.module.ts.template +6 -0
- package/src/init/files/src/index.html.template +0 -3
- package/src/module/files/__name@dasherize__/__name@dasherize__-routing.module.ts.template +2 -0
- package/src/init/files/src/app/general/e404/e404.component.html.template +0 -1
- package/src/init/files/src/app/general/e404/e404.component.ts.template +0 -28
- /package/src/init/files/src/app/{general/e404/e404.component.scss.template → admin/waitlist/+state/waitlist.model.ts.template} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component, OnInit, OnDestroy, ChangeDetectionStrategy } from '@angular/core';
|
|
2
2
|
import { Observable, Subject } from 'rxjs';
|
|
3
|
-
import { takeUntil } from 'rxjs/operators';
|
|
3
|
+
import { takeUntil, filter } from 'rxjs/operators';
|
|
4
4
|
import { select, Store } from '@ngrx/store';
|
|
5
5
|
import * as fromStore from '../../core/store/app.reducer';
|
|
6
6
|
import * as fromAuth from '../../core/store/auth/auth.reducer';
|
|
@@ -17,7 +17,10 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
17
17
|
// --------------- ROUTE PARAMS & CURRENT USER ---------
|
|
18
18
|
|
|
19
19
|
/** The currently signed in user. */
|
|
20
|
-
currentUser$: Observable<User> = this.store.pipe(
|
|
20
|
+
currentUser$: Observable<User> = this.store.pipe(
|
|
21
|
+
select(fromAuth.selectUser),
|
|
22
|
+
filter((user) => user !== null),
|
|
23
|
+
);
|
|
21
24
|
|
|
22
25
|
// --------------- LOCAL UI STATE ----------------------
|
|
23
26
|
|
|
@@ -50,14 +53,19 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
50
53
|
this.login$.pipe(
|
|
51
54
|
takeUntil(this.unsubscribe$),
|
|
52
55
|
).subscribe(() => {
|
|
53
|
-
this.store.dispatch(new Login({
|
|
56
|
+
this.store.dispatch(new Login({
|
|
57
|
+
provider: 'google.com',
|
|
58
|
+
doNotRoute: true,
|
|
59
|
+
}));
|
|
54
60
|
});
|
|
55
61
|
|
|
56
62
|
/** Handle logout events. */
|
|
57
63
|
this.logout$.pipe(
|
|
58
64
|
takeUntil(this.unsubscribe$),
|
|
59
65
|
).subscribe(() => {
|
|
60
|
-
this.store.dispatch(new Logout(
|
|
66
|
+
this.store.dispatch(new Logout({
|
|
67
|
+
doNotRoute: true,
|
|
68
|
+
}));
|
|
61
69
|
});
|
|
62
70
|
}
|
|
63
71
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Action } from '@ngrx/store';
|
|
2
|
+
|
|
3
|
+
export enum ConsentActionTypes {
|
|
4
|
+
LOAD_DATA = '[Consent] load data',
|
|
5
|
+
CLEANUP = '[Consent] cleanup',
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** Action for loading required DB data. */
|
|
9
|
+
export class LoadData implements Action {
|
|
10
|
+
readonly type = ConsentActionTypes.LOAD_DATA;
|
|
11
|
+
|
|
12
|
+
constructor(public correlationId: string) { }
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Action for cleaning up loading subscriptions. */
|
|
16
|
+
export class Cleanup implements Action {
|
|
17
|
+
readonly type = ConsentActionTypes.CLEANUP;
|
|
18
|
+
constructor(public correlationId: string) { }
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type ConsentActions =
|
|
22
|
+
LoadData |
|
|
23
|
+
Cleanup;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { Action } from '@ngrx/store';
|
|
3
|
+
import { Actions, createEffect, ofType } from '@ngrx/effects';
|
|
4
|
+
|
|
5
|
+
import { of, Observable } from 'rxjs';
|
|
6
|
+
import { mergeMap, tap, map } from 'rxjs/operators';
|
|
7
|
+
|
|
8
|
+
import { select, Store } from '@ngrx/store';
|
|
9
|
+
import * as fromStore from '../../../core/store/app.reducer';
|
|
10
|
+
import { FirebaseService } from '../../../core/firebase/firebase.service';
|
|
11
|
+
import { EffectsHelpers } from '../../../core/store/effects.helpers';
|
|
12
|
+
import { ConsentState } from './consent.state';
|
|
13
|
+
|
|
14
|
+
import { ActionFlow, RouterNavigate, LoadAction, Unsubscribe } from '../../../core/store/app.actions';
|
|
15
|
+
import { ConsentActionTypes, Cleanup, LoadData } from './consent.actions';
|
|
16
|
+
|
|
17
|
+
@Injectable()
|
|
18
|
+
export class ConsentEffects {
|
|
19
|
+
/** Load data from Firebase. */
|
|
20
|
+
loadData$: Observable<Action> = createEffect(
|
|
21
|
+
() => this.actions$.pipe(
|
|
22
|
+
ofType<LoadData>(ConsentActionTypes.LOAD_DATA),
|
|
23
|
+
mergeMap((action: LoadData) => {
|
|
24
|
+
const loadId = action.correlationId;
|
|
25
|
+
|
|
26
|
+
return [
|
|
27
|
+
];
|
|
28
|
+
}),
|
|
29
|
+
),
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
/** Unsubscribe connections from Firebase. */
|
|
33
|
+
cleanup$: Observable<Action> = createEffect(
|
|
34
|
+
() => this.actions$.pipe(
|
|
35
|
+
ofType<Cleanup>(ConsentActionTypes.CLEANUP),
|
|
36
|
+
map((action: Cleanup) => new Unsubscribe(action.correlationId)),
|
|
37
|
+
),
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
constructor(
|
|
41
|
+
private actions$: Actions,
|
|
42
|
+
private store: Store<fromStore.State>,
|
|
43
|
+
private state: ConsentState,
|
|
44
|
+
private db: FirebaseService,
|
|
45
|
+
private eh: EffectsHelpers,
|
|
46
|
+
) {}
|
|
47
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { Store, select } from '@ngrx/store';
|
|
3
|
+
import * as fromStore from '../../../core/store/app.reducer';
|
|
4
|
+
import { EntitySelectorService } from '../../../core/store/app.selectors';
|
|
5
|
+
|
|
6
|
+
import { Observable, of, combineLatest } from 'rxjs';
|
|
7
|
+
import { bufferTime, distinctUntilChanged, shareReplay, mergeMap, filter, switchMap, map } from 'rxjs/operators';
|
|
8
|
+
|
|
9
|
+
@Injectable({
|
|
10
|
+
providedIn: 'root',
|
|
11
|
+
})
|
|
12
|
+
export class ConsentSelectors {
|
|
13
|
+
constructor(
|
|
14
|
+
private slRx: EntitySelectorService,
|
|
15
|
+
) { }
|
|
16
|
+
|
|
17
|
+
cleanup(cId: string) {
|
|
18
|
+
this.slRx.release(cId);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<main class="guide">
|
|
2
|
+
<h1>Research Consent and Privacy Policy</h1>
|
|
3
|
+
<div class="separator"></div>
|
|
4
|
+
|
|
5
|
+
<p>{{ appName }} is a platform that {{ shortProdDesc }}. It is also an experimental platform run by the <a href="https://tech4good.soe.ucsc.edu" target="_blank">Tech4Good Lab</a> for studying {{ shortResearchDesc }}.</p>
|
|
6
|
+
|
|
7
|
+
<p>This Research Consent and Privacy Policy describes how and when {{ appName }} collects, uses and shares your information when you use our Services. {{ appName }} receives your information through our website and from our partners and other third parties for the purpose of delivering services, improving them, and conducting research. For example, you send us information when you sign into {{ appName }} with {{ authAppName }}. When using any of our Services you consent to the collection, transfer, manipulation, storage, disclosure and other uses of your information as described in this Research Consent and Privacy Policy.</p>
|
|
8
|
+
|
|
9
|
+
<p>This Research Consent and Privacy Policy also describes the research studies you will be participating in, IRB approved under UCSC Study {{ protocolNumber }} titled "{{ protocolTitle }}".</p>
|
|
10
|
+
|
|
11
|
+
<h2>Research Study Information</h2>
|
|
12
|
+
|
|
13
|
+
<p class="substep"><b>What will you do in the study</b>: {{ studyDoingDesc }}.</p>
|
|
14
|
+
|
|
15
|
+
<p class="substep"><b>Risks or discomforts</b>: While researchers follow procedures to maintain your confidentiality, as with any internet activity, we cannot guarantee confidentiality of interception of data sent via the Internet by any third parties, so there is a risk that your information could be accidentally disclosed. However, we do not see foreseeable risks even if information is accidentally disclosed.</p>
|
|
16
|
+
|
|
17
|
+
<p class="substep"><b>Benefits and costs</b>: There are no costs to you for participation. You may benefit by using the platform {{ benefitsDesc }}, but we do not guarantee that any benefits will occur.</p>
|
|
18
|
+
|
|
19
|
+
<p class="substep"><b>Voluntary participation</b>: All participation is voluntary and you may choose to discontinue use of the platform at any time.</p>
|
|
20
|
+
|
|
21
|
+
<p class="substep"><b>Rights and concerns</b>: If you have questions about this research study, please contact {{ investigatorInfo }} or the faculty member supervising this research {{ facultyInfo }}. If you have any questions regarding your rights as a research participant, please contact the University of California Santa Cruz, Office of Research Compliance Administration at 831-459-1473 or orca@ucsc.edu.</p>
|
|
22
|
+
|
|
23
|
+
<h2>Information Collection and Use</h2>
|
|
24
|
+
|
|
25
|
+
<p class="substep"><b>Basic Account Information</b>: When you create or reconfigure a {{ appName }} account, you provide some personal information, such as your name and email address.</p>
|
|
26
|
+
|
|
27
|
+
<p class="substep"><b>Additional Information</b>: We may use your email address to send you notifications for the projects you are participating in. If we do, you will be able to unsubscribe through your account settings or by following the instructions contained within email notifications. If you email us, we may keep your message, email address and contact information to respond to your request. If you connect your {{ appName }} account to your account on another service, the other service may send us your registration or profile information on that service and other information that you authorize. Providing the additional information described in this section is entirely optional.</p>
|
|
28
|
+
|
|
29
|
+
<p class="substep"><b>Service Usage Data</b>: Our Services are primarily designed to {{ usageDataProductDesc }}.</p>
|
|
30
|
+
|
|
31
|
+
<p class="substep"><b>Cookies</b>: Like many websites, we use cookies and similar technologies to collect additional website usage data to improve our Services and to conduct research to learn {{ usageDataResearchDesc }}. A cookie is a small data file that is transferred to your computer's hard disk. {{ appName }} may use both session cookies and persistent cookies to better understand how you interact with our Services, to monitor aggregate usage by our users and web traffic routing on our Services, and to customize and improve our Services. Most Internet browsers automatically accept cookies. You can instruct your browser, by changing its settings, to stop accepting cookies or to prompt you before accepting a cookie from the websites you visit. However, some Services may not function properly if you disable cookies.</p>
|
|
32
|
+
|
|
33
|
+
<h2>Information Sharing and Disclosure</h2>
|
|
34
|
+
|
|
35
|
+
<p class="substep"><b>Transfer of information</b>: We do not sell, trade, or otherwise transfer to outside parties your personally identifiable information. This does not include trusted third parties who assist us in operating our website, conducting research, or servicing you, so long as those parties agree to keep this information confidential. Additionally, parties given access to research data will also be IRB approved.</p>
|
|
36
|
+
|
|
37
|
+
<p class="substep"><b>Law and Harm</b>: Notwithstanding anything to the contrary in this Policy, we may preserve or disclose your information if we believe that it is reasonably necessary to comply with a law, regulation or legal request; to protect the safety of any person; to address fraud, security or technical issues; or to protect {{ appName }}'s rights or property. However, nothing in this Privacy Policy is intended to limit any legal defenses or objections that you may have to a third party’s, including a government’s, request to disclose your information.</p>
|
|
38
|
+
|
|
39
|
+
<h2>Modifying Your Personal Information</h2>
|
|
40
|
+
|
|
41
|
+
<p>If you are a registered user of our Services, we provide you with tools and account settings to access or modify the personal information you provided to us and associated with your account.</p>
|
|
42
|
+
|
|
43
|
+
<h2>Changes to This Policy</h2>
|
|
44
|
+
|
|
45
|
+
<p>We may revise this Privacy Policy from time to time. The most current version of the policy will govern our use of your information and will be at <a routerLink="/consent">{{ consentUrl }}</a>. If we make a change to this policy that, in our sole discretion, is material, we will notify you via an email to the email address associated with your account. By continuing to access or use the Services after those changes become effective, you agree to be bound by the revised Privacy Policy.</p>
|
|
46
|
+
|
|
47
|
+
<ng-container *ngIf="{ loading: loading$ | async } as state">
|
|
48
|
+
<form #checkForm="ngForm" (ngSubmit)="submit$.next()" *ngIf="!state.loading">
|
|
49
|
+
<div class="agree-container">
|
|
50
|
+
<mat-checkbox [color]="'primary'" [(ngModel)]="checked" name="checked" required><span style="white-space:normal;" class="permission-text">I have read and understood the above, agree to the terms of use, and consent to participate in the research study.</span></mat-checkbox>
|
|
51
|
+
</div>
|
|
52
|
+
<button type="submit" class="btn continue-btn" [disabled]="!checkForm.form.valid">
|
|
53
|
+
Accept and Continue
|
|
54
|
+
<img src="https://icongr.am/feather/arrow-right.svg?size=20&color=B2B6C7">
|
|
55
|
+
</button>
|
|
56
|
+
</form>
|
|
57
|
+
<div class="loading-container" *ngIf="state.loading">
|
|
58
|
+
Submitting... <mat-spinner [diameter]="20" [strokeWidth]="2"></mat-spinner>
|
|
59
|
+
</div>
|
|
60
|
+
</ng-container>
|
|
61
|
+
</main>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
.guide {
|
|
2
|
+
align-items: stretch;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
padding: 50px 100px;
|
|
6
|
+
overflow-y: auto;
|
|
7
|
+
color: #303030;
|
|
8
|
+
|
|
9
|
+
.agree-container {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: flex-start;
|
|
12
|
+
margin-bottom: 10px;
|
|
13
|
+
input {
|
|
14
|
+
width: auto;
|
|
15
|
+
height: auto;
|
|
16
|
+
margin: 0 10px 0 0;
|
|
17
|
+
}
|
|
18
|
+
.permission-text {
|
|
19
|
+
margin-left: 10px;
|
|
20
|
+
display: inline-block;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
.loading-container {
|
|
24
|
+
display: flex;
|
|
25
|
+
margin-top: 100px;
|
|
26
|
+
margin-bottom: 25px;
|
|
27
|
+
|
|
28
|
+
mat-spinner {
|
|
29
|
+
margin-left: 10px;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
.continue-btn {
|
|
33
|
+
margin: 18px 15px 15px 0;
|
|
34
|
+
border: 1px solid #8c9fff;
|
|
35
|
+
background-color: #6e84f8;
|
|
36
|
+
color: #f1f3ff;
|
|
37
|
+
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
|
|
38
|
+
border-radius: 6px;
|
|
39
|
+
font-weight: 200;
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
font-size: 1.1em;
|
|
43
|
+
padding: 10px 22px 10px;
|
|
44
|
+
transition: color 0.8s ease, border 0.8s ease;
|
|
45
|
+
>img {
|
|
46
|
+
margin: 0 3px 0 2px;
|
|
47
|
+
transition: margin 0.2s ease;
|
|
48
|
+
}
|
|
49
|
+
&[disabled] {
|
|
50
|
+
background-color: white;
|
|
51
|
+
border: 1px solid #d8d8d8;
|
|
52
|
+
color: #b2b6c7;
|
|
53
|
+
box-shadow: none;
|
|
54
|
+
}
|
|
55
|
+
&:hover {
|
|
56
|
+
>img {
|
|
57
|
+
margin: 0 0 0 5px;
|
|
58
|
+
}
|
|
59
|
+
&[disabled] {
|
|
60
|
+
>img {
|
|
61
|
+
margin: 0 3px 0 2px;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
&:focus {
|
|
66
|
+
outline: 0;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
form {
|
|
71
|
+
margin-top: 2em;
|
|
72
|
+
|
|
73
|
+
button {
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { ConsentComponent } from './consent.component';
|
|
4
|
+
|
|
5
|
+
describe('ConsentComponent', () => {
|
|
6
|
+
let component: ConsentComponent;
|
|
7
|
+
let fixture: ComponentFixture<ConsentComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(waitForAsync(() => {
|
|
10
|
+
TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ConsentComponent],
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(ConsentComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { Component, OnInit, OnDestroy, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
+
import { ConsentAnimations } from './consent.animations';
|
|
3
|
+
import { ParamMap, ActivatedRoute } from '@angular/router';
|
|
4
|
+
import { Store, select } from '@ngrx/store';
|
|
5
|
+
import * as fromStore from '../../core/store/app.reducer';
|
|
6
|
+
import * as fromAuth from '../../core/store/auth/auth.reducer';
|
|
7
|
+
import { FirebaseService } from '../../core/firebase/firebase.service';
|
|
8
|
+
import { Observable, Subject, BehaviorSubject, combineLatest } from 'rxjs';
|
|
9
|
+
import { withLatestFrom, filter, take, takeUntil } from 'rxjs/operators';
|
|
10
|
+
|
|
11
|
+
import { ConsentState } from './+state/consent.state';
|
|
12
|
+
import { ConsentSelectors } from './+state/consent.selectors';
|
|
13
|
+
|
|
14
|
+
import { LoadData, Cleanup } from './+state/consent.actions';
|
|
15
|
+
import { ActionFlow, RouterNavigate } from '../../core/store/app.actions';
|
|
16
|
+
import { ShowSnackbar } from '../../core/snackbar/snackbar.actions';
|
|
17
|
+
|
|
18
|
+
import { User, AccessState } from '../../core/store/user/user.model';
|
|
19
|
+
import { UpdateUser, UserActionTypes } from '../../core/store/user/user.actions';
|
|
20
|
+
import { Location, PlatformLocation } from '@angular/common';
|
|
21
|
+
|
|
22
|
+
@Component({
|
|
23
|
+
selector: 'app-consent',
|
|
24
|
+
templateUrl: './consent.component.html',
|
|
25
|
+
styleUrls: ['./consent.component.scss'],
|
|
26
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
27
|
+
animations: ConsentAnimations,
|
|
28
|
+
})
|
|
29
|
+
export class ConsentComponent implements OnInit, OnDestroy {
|
|
30
|
+
// --------------- ROUTE PARAMS & CURRENT USER ---------
|
|
31
|
+
|
|
32
|
+
/** The currently signed in user. */
|
|
33
|
+
currentUser$: Observable<User> = this.store.pipe(
|
|
34
|
+
select(fromAuth.selectUser),
|
|
35
|
+
filter((user) => user !== null),
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
// --------------- LOCAL AND GLOBAL STATE --------------
|
|
39
|
+
|
|
40
|
+
/** String constants. */
|
|
41
|
+
appName = 'APP_NAME [Causeway]';
|
|
42
|
+
shortProdDesc = 'PROD_DESC [provides users with opportunities to learn coding in real-world settings while contributing to non-profit causes]';
|
|
43
|
+
shortResearchDesc = 'RESEARCH_DESC [how to scale opportunities for experiential learning and support collaboration around social causes]';
|
|
44
|
+
authAppName = 'AUTH_APP_NAME [Google]';
|
|
45
|
+
protocolNumber = 'PROTOCOL_NO [HS-FY2022-254]';
|
|
46
|
+
protocolTitle = 'PROTOCOL_TITLE [Scaling Experiential Learning of Web Development]';
|
|
47
|
+
usageDataProductDesc = 'USAGE_DATA_PROD [help users learn and contribute to projects they are participating in. When you participate in a project, your task information, status, and code will be shared with the project team]';
|
|
48
|
+
usageDataResearchDesc = 'USAGE_DATA_RESEARCH [how to better support experiential learning online]';
|
|
49
|
+
studyDoingDesc = 'STUDY_DOING [When you participate in our study, you will use our platform to learn web development and contribute code to a platform. You will also fill out a survey on your experience, and optionally, participate in a follow-up interview]';
|
|
50
|
+
benefitsDesc = 'STUDY_BENEFITS [to learn web development and contribute to a project you care about]';
|
|
51
|
+
investigatorInfo = 'INVESTIGATOR_INFO [FirstName LastName, co-Principal Investigator, email@ucsc.edu]';
|
|
52
|
+
facultyInfo = 'FACULTY_INFO [David T. Lee, dlee105@ucsc.edu]';
|
|
53
|
+
|
|
54
|
+
/** Checkbox state used in form. */
|
|
55
|
+
checked: boolean;
|
|
56
|
+
|
|
57
|
+
/** Consent url. */
|
|
58
|
+
consentUrl;
|
|
59
|
+
|
|
60
|
+
// --------------- DB ENTITY DATA ----------------------
|
|
61
|
+
|
|
62
|
+
/** Container id for selectors and loading. */
|
|
63
|
+
containerId: string = this.db.createId();
|
|
64
|
+
|
|
65
|
+
// --------------- DATA BINDING ------------------------
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
// --------------- EVENT BINDING -----------------------
|
|
69
|
+
|
|
70
|
+
/** Event stream for submission events. */
|
|
71
|
+
submit$: Subject<void> = new Subject<void>();
|
|
72
|
+
|
|
73
|
+
// --------------- HELPER FUNCTIONS AND OTHER ----------
|
|
74
|
+
|
|
75
|
+
/** Loading indicator. */
|
|
76
|
+
loading$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
|
77
|
+
|
|
78
|
+
/** Unsubscribe observable for subscriptions. */
|
|
79
|
+
unsubscribe$: Subject<void> = new Subject();
|
|
80
|
+
|
|
81
|
+
constructor(
|
|
82
|
+
private state: ConsentState,
|
|
83
|
+
private route: ActivatedRoute,
|
|
84
|
+
private selectors: ConsentSelectors,
|
|
85
|
+
private store: Store<fromStore.State>,
|
|
86
|
+
private db: FirebaseService,
|
|
87
|
+
private platform: PlatformLocation,
|
|
88
|
+
private location: Location,
|
|
89
|
+
) {
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
ngOnInit() {
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
94
|
+
this.consentUrl = (this.platform as any).location.origin + '/' + this.location.prepareExternalUrl('consent');
|
|
95
|
+
|
|
96
|
+
// --------------- EVENT HANDLING ----------------------
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
// Handle submitting the form
|
|
100
|
+
this.submit$.pipe(
|
|
101
|
+
withLatestFrom(this.currentUser$),
|
|
102
|
+
takeUntil(this.unsubscribe$),
|
|
103
|
+
).subscribe(([_, currentUser]) => {
|
|
104
|
+
const actionSets = [{
|
|
105
|
+
action: new UpdateUser(currentUser.__id, {
|
|
106
|
+
accessState: AccessState.SUBMIT_INTEREST,
|
|
107
|
+
consented: true,
|
|
108
|
+
}, this.containerId),
|
|
109
|
+
responseActionTypes: {
|
|
110
|
+
success: UserActionTypes.UPDATE_SUCCESS,
|
|
111
|
+
failure: UserActionTypes.UPDATE_FAIL,
|
|
112
|
+
},
|
|
113
|
+
}];
|
|
114
|
+
|
|
115
|
+
this.store.dispatch(
|
|
116
|
+
new ActionFlow({
|
|
117
|
+
actionSets,
|
|
118
|
+
loading$: this.loading$,
|
|
119
|
+
successActionFn: (actionSetResponses) => {
|
|
120
|
+
return [
|
|
121
|
+
new RouterNavigate(['/onboarding/waiting']),
|
|
122
|
+
];
|
|
123
|
+
},
|
|
124
|
+
failActionFn: (actionSetResponses) => {
|
|
125
|
+
return [
|
|
126
|
+
new ShowSnackbar({
|
|
127
|
+
message: 'Failed to update consent status',
|
|
128
|
+
config: { duration: 3000 },
|
|
129
|
+
}),
|
|
130
|
+
];
|
|
131
|
+
},
|
|
132
|
+
}),
|
|
133
|
+
);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
// --------------- LOAD DATA ---------------------------
|
|
138
|
+
|
|
139
|
+
// Once everything is set up, load the data for the role.
|
|
140
|
+
this.store.dispatch( new LoadData(this.containerId) );
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
ngOnDestroy() {
|
|
144
|
+
// Unsubscribe subscriptions.
|
|
145
|
+
this.unsubscribe$.next();
|
|
146
|
+
this.unsubscribe$.complete();
|
|
147
|
+
|
|
148
|
+
// Unsubscribe from firebase connection from load and free up memoized selector values.
|
|
149
|
+
this.store.dispatch( new Cleanup(this.containerId) );
|
|
150
|
+
this.selectors.cleanup(this.containerId);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { Routes, RouterModule } from '@angular/router';
|
|
3
|
+
import { AuthGuard } from '../core/auth/auth.guard';
|
|
4
|
+
|
|
5
|
+
// Containers
|
|
6
|
+
import { WaitingComponent } from './waiting/waiting.component';
|
|
7
|
+
import { ConsentComponent } from './consent/consent.component';
|
|
8
|
+
|
|
9
|
+
const routes: Routes = [
|
|
10
|
+
{ path: '', redirectTo: '/landing', pathMatch: 'full' },
|
|
11
|
+
{ path: 'waiting', component: WaitingComponent, canActivate: [AuthGuard] },
|
|
12
|
+
{ path: 'consent', component: ConsentComponent, canActivate: [AuthGuard] },
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
@NgModule({
|
|
16
|
+
imports: [RouterModule.forChild(routes)],
|
|
17
|
+
exports: [RouterModule],
|
|
18
|
+
})
|
|
19
|
+
export class OnboardingRoutingModule { }
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OnboardingModule } from './onboarding.module';
|
|
2
|
+
|
|
3
|
+
describe('OnboardingModule', () => {
|
|
4
|
+
let onboardingModule: OnboardingModule;
|
|
5
|
+
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
onboardingModule = new OnboardingModule();
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('should create an instance', () => {
|
|
11
|
+
expect(onboardingModule).toBeTruthy();
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { EffectsModule } from '@ngrx/effects';
|
|
4
|
+
import { SharedModule } from '../shared/shared.module';
|
|
5
|
+
import { OnboardingRoutingModule } from './onboarding-routing.module';
|
|
6
|
+
|
|
7
|
+
// Containers
|
|
8
|
+
import { WaitingComponent } from './waiting/waiting.component';
|
|
9
|
+
import { WaitingEffects } from './waiting/+state/waiting.effects';
|
|
10
|
+
import { ConsentComponent } from './consent/consent.component';
|
|
11
|
+
import { ConsentEffects } from './consent/+state/consent.effects';
|
|
12
|
+
|
|
13
|
+
// Components
|
|
14
|
+
|
|
15
|
+
@NgModule({
|
|
16
|
+
imports: [
|
|
17
|
+
CommonModule,
|
|
18
|
+
SharedModule,
|
|
19
|
+
OnboardingRoutingModule,
|
|
20
|
+
EffectsModule.forFeature([
|
|
21
|
+
WaitingEffects,
|
|
22
|
+
ConsentEffects,
|
|
23
|
+
]),
|
|
24
|
+
],
|
|
25
|
+
declarations: [
|
|
26
|
+
// Containers
|
|
27
|
+
WaitingComponent,
|
|
28
|
+
ConsentComponent,
|
|
29
|
+
// Components
|
|
30
|
+
],
|
|
31
|
+
})
|
|
32
|
+
export class OnboardingModule { }
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Action } from '@ngrx/store';
|
|
2
|
+
import { User } from '../../../core/store/user/user.model';
|
|
3
|
+
|
|
4
|
+
export enum WaitingActionTypes {
|
|
5
|
+
LOAD_DATA = '[Waiting] load data',
|
|
6
|
+
CLEANUP = '[Waiting] cleanup',
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Action for loading required DB data. */
|
|
10
|
+
export class LoadData implements Action {
|
|
11
|
+
readonly type = WaitingActionTypes.LOAD_DATA;
|
|
12
|
+
|
|
13
|
+
constructor(public payload: {
|
|
14
|
+
currentUser: User,
|
|
15
|
+
}, public correlationId: string) { }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Action for cleaning up loading subscriptions. */
|
|
19
|
+
export class Cleanup implements Action {
|
|
20
|
+
readonly type = WaitingActionTypes.CLEANUP;
|
|
21
|
+
constructor(public correlationId: string) { }
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type WaitingActions =
|
|
25
|
+
LoadData |
|
|
26
|
+
Cleanup;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { Action } from '@ngrx/store';
|
|
3
|
+
import { Actions, createEffect, ofType } from '@ngrx/effects';
|
|
4
|
+
|
|
5
|
+
import { of, Observable } from 'rxjs';
|
|
6
|
+
import { mergeMap, tap, map } from 'rxjs/operators';
|
|
7
|
+
|
|
8
|
+
import { select, Store } from '@ngrx/store';
|
|
9
|
+
import * as fromStore from '../../../core/store/app.reducer';
|
|
10
|
+
import { FirebaseService } from '../../../core/firebase/firebase.service';
|
|
11
|
+
import { EffectsHelpers } from '../../../core/store/effects.helpers';
|
|
12
|
+
import { WaitingState } from './waiting.state';
|
|
13
|
+
|
|
14
|
+
import { ActionFlow, RouterNavigate, LoadAction, Unsubscribe } from '../../../core/store/app.actions';
|
|
15
|
+
import { WaitingActionTypes, Cleanup, LoadData } from './waiting.actions';
|
|
16
|
+
import { StreamUserContext } from '../../../core/store/user-context/user-context.actions';
|
|
17
|
+
import { StreamAppState } from '../../../core/store/app-state/app-state.actions';
|
|
18
|
+
|
|
19
|
+
@Injectable()
|
|
20
|
+
export class WaitingEffects {
|
|
21
|
+
/** Load data from Firebase. */
|
|
22
|
+
loadData$: Observable<Action> = createEffect(
|
|
23
|
+
() => this.actions$.pipe(
|
|
24
|
+
ofType<LoadData>(WaitingActionTypes.LOAD_DATA),
|
|
25
|
+
mergeMap((action: LoadData) => {
|
|
26
|
+
const loadId = action.correlationId;
|
|
27
|
+
const currentUser = action.payload.currentUser;
|
|
28
|
+
|
|
29
|
+
return [
|
|
30
|
+
new StreamUserContext([['__userId', '==', currentUser.__id]], {}, loadId),
|
|
31
|
+
new StreamAppState([['__id', '==', 'app']], {}, loadId),
|
|
32
|
+
];
|
|
33
|
+
}),
|
|
34
|
+
),
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
/** Unsubscribe connections from Firebase. */
|
|
38
|
+
cleanup$: Observable<Action> = createEffect(
|
|
39
|
+
() => this.actions$.pipe(
|
|
40
|
+
ofType<Cleanup>(WaitingActionTypes.CLEANUP),
|
|
41
|
+
map((action: Cleanup) => new Unsubscribe(action.correlationId)),
|
|
42
|
+
),
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
constructor(
|
|
46
|
+
private actions$: Actions,
|
|
47
|
+
private store: Store<fromStore.State>,
|
|
48
|
+
private state: WaitingState,
|
|
49
|
+
private db: FirebaseService,
|
|
50
|
+
private eh: EffectsHelpers,
|
|
51
|
+
) {}
|
|
52
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { User } from '../../../core/store/user/user.model';
|
|
2
|
+
import { UserContext } from '../../../core/store/user-context/user-context.model';
|
|
3
|
+
import { AppState } from '../../../core/store/app-state/app-state.model';
|
|
4
|
+
|
|
5
|
+
export interface WaitlistData {
|
|
6
|
+
currentUser: User;
|
|
7
|
+
userContext: UserContext;
|
|
8
|
+
appState: AppState;
|
|
9
|
+
}
|