@tech4good/angular-schematics 21.3.0 → 21.5.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/.t4g/agent-memory.db +0 -0
- package/CHANGELOG.md +41 -0
- package/package.json +1 -1
- package/src/entity/index.js +42 -9
- package/src/entity/index.js.map +1 -1
- package/src/entity/index_spec.js +42 -8
- package/src/entity/index_spec.js.map +1 -1
- package/src/entity/schema.json +0 -5
- package/src/ng-add/files/.firebaserc.template +2 -1
- package/src/ng-add/files/.gitignore.template +1 -0
- package/src/ng-add/files/angular.json.template +3 -0
- package/src/ng-add/files/bigquery/queries/active_time_by_route.sql.template +34 -0
- package/src/ng-add/files/bigquery/scripts/export_entities.py.template +143 -0
- package/src/ng-add/files/bigquery/scripts/run_query.py.template +167 -0
- package/src/ng-add/files/bigquery/views/events_flat.sql.template +60 -0
- package/src/ng-add/files/bigquery/views/logs_latest.sql.template +34 -0
- package/src/ng-add/files/docs-infra/analytics-guide.md.template +170 -0
- package/src/ng-add/files/firebase.logs.json.template +5 -0
- package/src/ng-add/files/firestore.indexes.json.template +89 -0
- package/src/ng-add/files/firestore.logs.rules.spec.ts.template +100 -0
- package/src/ng-add/files/firestore.logs.rules.template +8 -0
- package/src/ng-add/files/firestore.rules.spec.ts.template +88 -1
- package/src/ng-add/files/firestore.rules.template +9 -0
- package/src/ng-add/files/jest.config.ts.template +1 -1
- package/src/ng-add/files/package.json.template +6 -3
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-list.component.spec.ts.template +3 -3
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.component.spec.ts.template +0 -1
- package/src/ng-add/files/src/app/app.component.html.template +1 -1
- package/src/ng-add/files/src/app/app.component.scss.template +9 -1
- package/src/ng-add/files/src/app/app.component.spec.ts.template +2 -2
- package/src/ng-add/files/src/app/auth-routing.spec.ts.template +1 -1
- package/src/ng-add/files/src/app/core/analytics/log.service.ts.template +27 -5
- package/src/ng-add/files/src/app/core/analytics/time-analytics.service.spec.ts.template +147 -4
- package/src/ng-add/files/src/app/core/analytics/time-analytics.service.ts.template +355 -149
- package/src/ng-add/files/src/app/core/auth/guards/require-auth-and-consent.guard.ts.template +3 -1
- package/src/ng-add/files/src/app/core/firebase/cached-listeners.service.ts.template +53 -51
- package/src/ng-add/files/src/app/core/firebase/firebase.mock.service.ts.template +6 -0
- package/src/ng-add/files/src/app/core/firebase/simulate-load.spec.ts.template +2 -2
- package/src/ng-add/files/src/app/core/firebase/simulate-stream.spec.ts.template +14 -14
- package/src/ng-add/files/src/app/core/firebase/stream-multiplexer.ts.template +50 -48
- package/src/ng-add/files/src/app/core/logging/logging.service.spec.ts.template +118 -0
- package/src/ng-add/files/src/app/core/logging/logging.service.ts.template +168 -0
- package/src/ng-add/files/src/app/core/store/app.model.ts.template +3 -1
- package/src/ng-add/files/src/app/core/store/app.store.ts.template +11 -9
- package/src/ng-add/files/src/app/core/store/auth/auth.mock.ts.template +5 -4
- package/src/ng-add/files/src/app/core/store/auth/auth.store.ts.template +13 -4
- package/src/ng-add/files/src/app/core/store/user/user.mock.ts.template +0 -4
- package/src/ng-add/files/src/app/core/store/user/user.model.ts.template +0 -1
- package/src/ng-add/files/src/app/core/store/user-private/user-private.mock.ts.template +15 -0
- package/src/ng-add/files/src/app/core/store/user-private/user-private.model.ts.template +9 -0
- package/src/ng-add/files/src/app/core/store/user-private/user-private.store.ts.template +41 -0
- package/src/ng-add/files/src/app/first-time/consent/consent.component.html.template +172 -48
- package/src/ng-add/files/src/app/first-time/consent/consent.component.scss.template +31 -0
- package/src/ng-add/files/src/app/first-time/consent/consent.component.spec.ts.template +31 -3
- package/src/ng-add/files/src/app/first-time/consent/consent.component.ts.template +12 -11
- package/src/ng-add/files/src/app/first-time/consent/consent.guard.ts.template +0 -6
- package/src/ng-add/files/src/app/first-time/early-access/early-access.component.spec.ts.template +0 -1
- package/src/ng-add/files/src/app/first-time/early-access/early-access.component.ts.template +1 -1
- package/src/ng-add/files/src/app/first-time/early-access/early-access.guard.ts.template +7 -1
- package/src/ng-add/files/src/app/first-time/first-time-routing.spec.ts.template +7 -6
- package/src/ng-add/files/src/app/first-time/landing/hero/hero.component.ts.template +3 -3
- package/src/ng-add/files/src/app/first-time/landing/landing.component.scss.template +1 -1
- package/src/ng-add/files/src/app/first-time/onboarding/onboarding.component.ts.template +3 -3
- package/src/ng-add/files/src/app/main/home/home.component.spec.ts.template +1 -1
- package/src/ng-add/files/src/app/main/home/home.component.ts.template +4 -4
- package/src/ng-add/files/src/app/shared/dev-status-bar/dev-status-bar.component.scss.template +1 -0
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.service.spec.ts.template +41 -5
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.service.ts.template +25 -2
- package/src/ng-add/files/src/environments/environment.test.ts.template +1 -1
- package/src/shared/statements-adder.d.ts +1 -0
- package/src/shared/statements-adder.js +8 -0
- package/src/shared/statements-adder.js.map +1 -1
- package/src/ng-add/files/src/app/core/firebase/query-logger.ts.template +0 -11
- package/tech4good-angular-schematics-21.0.0.tgz +0 -0
|
@@ -1,57 +1,181 @@
|
|
|
1
1
|
<app-navbar></app-navbar>
|
|
2
2
|
<main class="consent-container">
|
|
3
|
-
<h1>
|
|
3
|
+
<h1>Terms of Service, Privacy Policy, and Research Consent</h1>
|
|
4
4
|
<div class="separator"></div>
|
|
5
5
|
|
|
6
|
-
<p>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
<p>
|
|
7
|
+
{{ appName }} is a platform that {{ shortProdDesc }}. It is also an experimental platform run by
|
|
8
|
+
{{ organizationName }} for studying {{ shortResearchDesc }}.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p>
|
|
12
|
+
This document outlines the Terms of Service, Privacy Policy, and Research Consent for using
|
|
13
|
+
{{ appName }}. {{ appName }} receives your information through our website and from our partners
|
|
14
|
+
and other third parties for the purpose of delivering services, improving them, and conducting
|
|
15
|
+
research. For example, you send us information when you sign into {{ appName }} with {{ authAppName }}.
|
|
16
|
+
By using any of our Services, you agree to the collection, transfer, manipulation, storage,
|
|
17
|
+
disclosure, and other uses of your information as described in this document.
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
<h2>1. Terms of Service</h2>
|
|
21
|
+
|
|
22
|
+
<p class="substep">
|
|
23
|
+
<b>Acceptable Use</b>: You agree to use {{ appName }} solely for lawful educational, learning,
|
|
24
|
+
and platform interaction purposes. You agree not to reverse engineer, disrupt, tamper with, or
|
|
25
|
+
gain unauthorized access to any platform systems, servers, or user accounts.
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
<p class="substep">
|
|
29
|
+
<b>Disclaimer of Warranties</b>: {{ appName }} is provided on an "AS IS" and "AS AVAILABLE" basis.
|
|
30
|
+
While we strive for high service quality, {{ organizationName }} and its contributors make no express
|
|
31
|
+
or implied warranties regarding platform uptime, error-free operation, or specific learning
|
|
32
|
+
outcomes.
|
|
33
|
+
</p>
|
|
34
|
+
|
|
35
|
+
<p class="substep">
|
|
36
|
+
<b>Limitation of Liability</b>: To the maximum extent permitted by applicable law, {{ organizationName }}
|
|
37
|
+
and its creators, maintainers, or partners shall not be liable for any direct, indirect, incidental,
|
|
38
|
+
or consequential damages arising from your use of or inability to use the platform.
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
<p class="substep">
|
|
42
|
+
<b>Intellectual Property and Content</b>: All platform code, branding, graphics, and instructional
|
|
43
|
+
materials are owned by or licensed to {{ organizationName }}. User contributions and feedback are used
|
|
44
|
+
to operate and improve the platform and associated research projects.
|
|
45
|
+
</p>
|
|
46
|
+
|
|
47
|
+
<p class="substep">
|
|
48
|
+
<b>Account Termination</b>: We reserve the right to suspend or terminate user accounts that
|
|
49
|
+
violate these Terms of Service or engage in abusive, security-impacting, or unauthorized behavior.
|
|
50
|
+
</p>
|
|
51
|
+
|
|
52
|
+
<h2>2. Privacy Policy</h2>
|
|
53
|
+
|
|
54
|
+
<p class="substep">
|
|
55
|
+
<b>Basic Account Information</b>: When you create or reconfigure a {{ appName }} account, you
|
|
56
|
+
provide some personal information, such as your name and email address.
|
|
57
|
+
</p>
|
|
58
|
+
|
|
59
|
+
<p class="substep">
|
|
60
|
+
<b>Additional Information</b>: We may use your email address to send you notifications for the
|
|
61
|
+
projects you are participating in. If we do, you will be able to unsubscribe through your
|
|
62
|
+
account settings or by following the instructions contained within email notifications. If you
|
|
63
|
+
email us, we may keep your message, email address and contact information to respond to your
|
|
64
|
+
request. If you connect your {{ appName }} account to your account on another service, the other
|
|
65
|
+
service may send us your registration or profile information on that service and other
|
|
66
|
+
information that you authorize. Providing the additional information described in this section
|
|
67
|
+
is entirely optional.
|
|
68
|
+
</p>
|
|
69
|
+
|
|
70
|
+
<p class="substep">
|
|
71
|
+
<b>Service Usage Data</b>: Our Services are primarily designed to {{ usageDataProductDesc }}.
|
|
72
|
+
</p>
|
|
73
|
+
|
|
74
|
+
<p class="substep">
|
|
75
|
+
<b>Cookies & Analytics</b>: Like many websites, we use cookies and similar technologies to collect
|
|
76
|
+
additional website usage data to improve our Services and to conduct research to learn
|
|
77
|
+
{{ usageDataResearchDesc }}. A cookie is a small data file that is transferred to your
|
|
78
|
+
computer's hard disk. {{ appName }} may use both session cookies and persistent cookies to
|
|
79
|
+
better understand how you interact with our Services, to monitor aggregate usage by our users
|
|
80
|
+
and web traffic routing on our Services, and to customize and improve our Services. Most
|
|
81
|
+
Internet browsers automatically accept cookies. You can instruct your browser, by changing its
|
|
82
|
+
settings, to stop accepting cookies or to prompt you before accepting a cookie from the websites
|
|
83
|
+
you visit. However, some Services may not function properly if you disable cookies.
|
|
84
|
+
</p>
|
|
85
|
+
|
|
86
|
+
<p class="substep">
|
|
87
|
+
<b>Third-Party Sub-processors</b>: We do not sell, trade, or rent your personal information.
|
|
88
|
+
We share data only with trusted infrastructure and service providers (such as Google Cloud / Firebase
|
|
89
|
+
for hosting, database storage, and authentication) that assist us in operating the platform, subject
|
|
90
|
+
to strict confidentiality agreements.
|
|
91
|
+
</p>
|
|
92
|
+
|
|
93
|
+
<p class="substep">
|
|
94
|
+
<b>Data Retention & Erasure</b>: We retain your account data for as long as your account remains active.
|
|
95
|
+
You have the right to access, modify, or request deletion of your personal information at any time.
|
|
96
|
+
Upon receiving an account or data deletion request, we will delete or anonymize your personal data
|
|
97
|
+
within 30 days.
|
|
98
|
+
</p>
|
|
99
|
+
|
|
100
|
+
<p class="substep">
|
|
101
|
+
<b>Law and Harm</b>: Notwithstanding anything to the contrary in this Policy, we may preserve or
|
|
102
|
+
disclose your information if we believe that it is reasonably necessary to comply with a law,
|
|
103
|
+
regulation or legal request; to protect the safety of any person; to address fraud, security or
|
|
104
|
+
technical issues; or to protect {{ appName }}'s rights or property.
|
|
105
|
+
</p>
|
|
106
|
+
|
|
107
|
+
<h2>3. Research Study Information</h2>
|
|
108
|
+
|
|
109
|
+
<p>
|
|
110
|
+
This platform also incorporates research studies approved under UCSC IRB Study
|
|
111
|
+
{{ protocolNumber }} titled "{{ protocolTitle }}".
|
|
112
|
+
</p>
|
|
13
113
|
|
|
14
114
|
<p class="substep"><b>What will you do in the study</b>: {{ studyDoingDesc }}.</p>
|
|
15
|
-
|
|
16
|
-
<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>
|
|
17
|
-
|
|
18
|
-
<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>
|
|
19
|
-
|
|
20
|
-
<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>
|
|
21
|
-
|
|
22
|
-
<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>
|
|
23
|
-
|
|
24
|
-
<h2>Information Collection and Use</h2>
|
|
25
|
-
|
|
26
|
-
<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>
|
|
27
|
-
|
|
28
|
-
<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>
|
|
29
|
-
|
|
30
|
-
<p class="substep"><b>Service Usage Data</b>: Our Services are primarily designed to {{ usageDataProductDesc }}.</p>
|
|
31
|
-
|
|
32
|
-
<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>
|
|
33
|
-
|
|
34
|
-
<h2>Information Sharing and Disclosure</h2>
|
|
35
|
-
|
|
36
|
-
<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>
|
|
37
|
-
|
|
38
|
-
<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>
|
|
39
|
-
|
|
40
|
-
<h2>Modifying Your Personal Information</h2>
|
|
41
|
-
|
|
42
|
-
<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>
|
|
43
|
-
|
|
44
|
-
<h2>Changes to This Policy</h2>
|
|
45
|
-
|
|
46
|
-
<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>
|
|
47
115
|
|
|
48
|
-
<
|
|
49
|
-
<
|
|
50
|
-
|
|
116
|
+
<p class="substep">
|
|
117
|
+
<b>Risks or discomforts</b>: While researchers follow procedures to maintain your
|
|
118
|
+
confidentiality, as with any internet activity, we cannot guarantee confidentiality of
|
|
119
|
+
interception of data sent via the Internet by any third parties, so there is a risk that your
|
|
120
|
+
information could be accidentally disclosed. However, we do not see foreseeable risks even if
|
|
121
|
+
information is accidentally disclosed.
|
|
122
|
+
</p>
|
|
123
|
+
|
|
124
|
+
<p class="substep">
|
|
125
|
+
<b>Benefits and costs</b>: There are no costs to you for participation. You may benefit by using
|
|
126
|
+
the platform {{ benefitsDesc }}, but we do not guarantee that any benefits will occur.
|
|
127
|
+
</p>
|
|
128
|
+
|
|
129
|
+
<p class="substep">
|
|
130
|
+
<b>Voluntary participation</b>: All research participation is voluntary and you may choose to
|
|
131
|
+
discontinue use of the platform at any time.
|
|
132
|
+
</p>
|
|
133
|
+
|
|
134
|
+
<p class="substep">
|
|
135
|
+
<b>Rights and concerns</b>: If you have questions about this research study, please contact
|
|
136
|
+
{{ investigatorInfo }} at <a href="mailto:{{ investigatorEmail }}">{{ investigatorEmail }}</a> or
|
|
137
|
+
the faculty member supervising this research {{ facultyInfo }}. If you have any questions regarding
|
|
138
|
+
your rights as a research participant, please contact the University of California Santa Cruz, Office
|
|
139
|
+
of Research Compliance Administration at 831-459-1473 or <a href="mailto:orca@ucsc.edu">orca@ucsc.edu</a>.
|
|
140
|
+
</p>
|
|
141
|
+
|
|
142
|
+
<h2>4. Modifying Your Personal Information</h2>
|
|
143
|
+
|
|
144
|
+
<p>
|
|
145
|
+
If you are a registered user of our Services, we provide you with tools and account settings to
|
|
146
|
+
access or modify the personal information you provided to us and associated with your account.
|
|
147
|
+
</p>
|
|
148
|
+
|
|
149
|
+
<h2>5. Changes to This Policy</h2>
|
|
150
|
+
|
|
151
|
+
<p>
|
|
152
|
+
We may revise this document from time to time. The most current version will govern our use of
|
|
153
|
+
your information and terms of platform access, and will be available at
|
|
154
|
+
<a routerLink="/consent">{{ consentUrl }}</a>. If we make a change that, in our sole discretion,
|
|
155
|
+
is material, we will notify you via an email to the email address associated with your account.
|
|
156
|
+
By continuing to access or use the Services after those changes become effective, you agree to be
|
|
157
|
+
bound by the revised Terms of Service, Privacy Policy, and Research Consent.
|
|
158
|
+
</p>
|
|
159
|
+
|
|
160
|
+
@if (currentUser()?.consented) {
|
|
161
|
+
<div class="already-consented-banner">
|
|
162
|
+
<span class="check-icon">✓</span>
|
|
163
|
+
<div class="banner-title">You have already agreed to the terms and consented to participate.</div>
|
|
51
164
|
</div>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
165
|
+
} @else {
|
|
166
|
+
<form [formRoot]="consentForm">
|
|
167
|
+
<div class="agree-container">
|
|
168
|
+
<mat-checkbox [color]="'primary'" [formField]="consentForm.checked"
|
|
169
|
+
><span style="white-space: normal" class="permission-text"
|
|
170
|
+
>I have read and understood the above, agree to the Terms of Service and Privacy Policy, and
|
|
171
|
+
consent to participate in the research study.</span
|
|
172
|
+
></mat-checkbox
|
|
173
|
+
>
|
|
174
|
+
</div>
|
|
175
|
+
<button type="submit" class="btn continue-btn" [disabled]="!consentForm.checked().value()">
|
|
176
|
+
Accept and Continue
|
|
177
|
+
<img src="https://icongr.am/feather/arrow-right.svg?size=20&color=B2B6C7" />
|
|
178
|
+
</button>
|
|
179
|
+
</form>
|
|
180
|
+
}
|
|
57
181
|
</main>
|
|
@@ -74,4 +74,35 @@
|
|
|
74
74
|
cursor: pointer;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
+
|
|
78
|
+
.already-consented-banner {
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
gap: 16px;
|
|
82
|
+
margin-top: 2em;
|
|
83
|
+
padding: 20px 24px;
|
|
84
|
+
background-color: #f0faf0;
|
|
85
|
+
border: 1px solid #c3e6c3;
|
|
86
|
+
border-radius: 8px;
|
|
87
|
+
|
|
88
|
+
.check-icon {
|
|
89
|
+
flex-shrink: 0;
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
width: 28px;
|
|
94
|
+
height: 28px;
|
|
95
|
+
border-radius: 50%;
|
|
96
|
+
background-color: #4caf50;
|
|
97
|
+
color: white;
|
|
98
|
+
font-size: 16px;
|
|
99
|
+
font-weight: bold;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.banner-title {
|
|
103
|
+
font-weight: 600;
|
|
104
|
+
font-size: 1.05em;
|
|
105
|
+
color: #2e7d32;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
77
108
|
}
|
|
@@ -25,10 +25,16 @@ async function setup(providers: Provider[] = [], seededUsers: any[] = []) {
|
|
|
25
25
|
};
|
|
26
26
|
const routerMock = {
|
|
27
27
|
navigate: jest.fn().mockReturnValue(Promise.resolve(true)),
|
|
28
|
+
navigateByUrl: jest.fn().mockReturnValue(Promise.resolve(true)),
|
|
28
29
|
routerState: { snapshot: {} },
|
|
29
30
|
};
|
|
30
31
|
const activatedRouteMock = {
|
|
31
|
-
snapshot: {
|
|
32
|
+
snapshot: {
|
|
33
|
+
queryParamMap: {
|
|
34
|
+
get: jest.fn().mockReturnValue(null),
|
|
35
|
+
},
|
|
36
|
+
queryParams: {},
|
|
37
|
+
},
|
|
32
38
|
};
|
|
33
39
|
|
|
34
40
|
const view = await render(ConsentComponent, {
|
|
@@ -68,7 +74,7 @@ describe('ConsentComponent', () => {
|
|
|
68
74
|
it('should render consent title and research study information', async () => {
|
|
69
75
|
await setup();
|
|
70
76
|
|
|
71
|
-
expect(screen.getByRole('heading', { level: 1, name: /
|
|
77
|
+
expect(screen.getByRole('heading', { level: 1, name: /Terms of Service, Privacy Policy, and Research Consent/i })).toBeVisible();
|
|
72
78
|
expect(screen.getByText(/What will you do in the study/i)).toBeVisible();
|
|
73
79
|
expect(screen.getByRole('button', { name: /Accept and Continue/i })).toBeDisabled();
|
|
74
80
|
});
|
|
@@ -105,9 +111,31 @@ describe('ConsentComponent', () => {
|
|
|
105
111
|
});
|
|
106
112
|
|
|
107
113
|
await waitFor(() => {
|
|
108
|
-
expect(navigateSpy).toHaveBeenCalledWith(['/home']);
|
|
114
|
+
expect(navigateSpy).toHaveBeenCalledWith(['/home'], { queryParams: {} });
|
|
109
115
|
});
|
|
110
116
|
|
|
111
117
|
updateSpy.mockRestore();
|
|
112
118
|
});
|
|
119
|
+
|
|
120
|
+
describe('Already Consented User', () => {
|
|
121
|
+
beforeEach(() => {
|
|
122
|
+
USER_DB[0].accessState = AccessState.DONE;
|
|
123
|
+
USER_DB[0].consented = true;
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('should show the "already consented" banner instead of the form', async () => {
|
|
127
|
+
await setup([], [USER_DB[0]]);
|
|
128
|
+
|
|
129
|
+
expect(screen.getByText(/You have already agreed to the terms/i)).toBeVisible();
|
|
130
|
+
expect(screen.queryByRole('checkbox')).toBeNull();
|
|
131
|
+
expect(screen.queryByRole('button', { name: /Accept and Continue/i })).toBeNull();
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('should still display the consent page content for reading', async () => {
|
|
135
|
+
await setup([], [USER_DB[0]]);
|
|
136
|
+
|
|
137
|
+
expect(screen.getByRole('heading', { level: 1, name: /Terms of Service, Privacy Policy, and Research Consent/i })).toBeVisible();
|
|
138
|
+
expect(screen.getByText(/What will you do in the study/i)).toBeVisible();
|
|
139
|
+
});
|
|
140
|
+
});
|
|
113
141
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Component, OnInit, ChangeDetectionStrategy, input, output, inject, WritableSignal, Signal, signal, computed, effect, Inject, Injector } from '@angular/core';
|
|
2
2
|
import { Router, RouterLink, ActivatedRoute } from '@angular/router';
|
|
3
3
|
import { User, AccessState } from 'src/app/core/store/user/user.model';
|
|
4
|
-
import { handleAccess } from './consent.guard';
|
|
5
4
|
import { Location } from '@angular/common';
|
|
6
5
|
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
7
6
|
import { UserStore } from 'src/app/core/store/user/user.store';
|
|
@@ -41,6 +40,7 @@ export class ConsentComponent implements OnInit {
|
|
|
41
40
|
|
|
42
41
|
/** Constants for onboarding templates. */
|
|
43
42
|
appName = 'APP_NAME [Causeway]';
|
|
43
|
+
organizationName = 'ORGANIZATION_NAME [the Tech4Good Lab]';
|
|
44
44
|
shortProdDesc = 'PROD_DESC [provides users with opportunities to learn coding in real-world settings while contributing to non-profit causes]';
|
|
45
45
|
shortResearchDesc = 'RESEARCH_DESC [how to scale opportunities for experiential learning and support collaboration around social causes]';
|
|
46
46
|
authAppName = 'AUTH_APP_NAME [Google]';
|
|
@@ -50,7 +50,8 @@ export class ConsentComponent implements OnInit {
|
|
|
50
50
|
usageDataResearchDesc = 'USAGE_DATA_RESEARCH [how to better support experiential learning online]';
|
|
51
51
|
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]';
|
|
52
52
|
benefitsDesc = 'STUDY_BENEFITS [to learn web development and contribute to a project you care about]';
|
|
53
|
-
investigatorInfo = 'INVESTIGATOR_INFO [FirstName LastName, co-Principal Investigator
|
|
53
|
+
investigatorInfo = 'INVESTIGATOR_INFO [FirstName LastName, co-Principal Investigator]';
|
|
54
|
+
investigatorEmail = 'INVESTIGATOR_EMAIL [email@ucsc.edu]';
|
|
54
55
|
facultyInfo = 'FACULTY_INFO [David T. Lee, dlee105@ucsc.edu]';
|
|
55
56
|
|
|
56
57
|
/** Form model */
|
|
@@ -92,7 +93,14 @@ export class ConsentComponent implements OnInit {
|
|
|
92
93
|
accessState: AccessState.DONE,
|
|
93
94
|
consented: true,
|
|
94
95
|
});
|
|
95
|
-
|
|
96
|
+
|
|
97
|
+
// Navigate to returnUrl or /home directly after successful submit
|
|
98
|
+
const returnUrl = this.route.snapshot.queryParamMap?.get('returnUrl');
|
|
99
|
+
if (returnUrl) {
|
|
100
|
+
await this.router.navigateByUrl(returnUrl);
|
|
101
|
+
} else {
|
|
102
|
+
await this.router.navigate(['/home'], { queryParams: this.route.snapshot.queryParams });
|
|
103
|
+
}
|
|
96
104
|
} catch (e) {
|
|
97
105
|
console.error(e);
|
|
98
106
|
this.snackBar.open('Failed to update consent status', '', { duration: 3000 });
|
|
@@ -107,14 +115,7 @@ export class ConsentComponent implements OnInit {
|
|
|
107
115
|
private snackBar: MatSnackBar,
|
|
108
116
|
private location: Location,
|
|
109
117
|
@Inject(BATCH_WRITE_SERVICE) private batch: BatchWriteService,
|
|
110
|
-
) {
|
|
111
|
-
// Redirect users who have progressed past the consent stage
|
|
112
|
-
// (i.e. neither submitting consent nor waiting) to the main app.
|
|
113
|
-
effect(() => {
|
|
114
|
-
const user = this.currentUser();
|
|
115
|
-
handleAccess(user, this.router, this.route.snapshot, this.router.routerState.snapshot);
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
+
) {}
|
|
118
119
|
|
|
119
120
|
// --------------- LOAD AND CLEANUP --------------------
|
|
120
121
|
|
|
@@ -30,12 +30,6 @@ export function handleAccess(
|
|
|
30
30
|
return false;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
// Check 2: Does the user still need to consent?
|
|
34
|
-
if (user && user.accessState === AccessState.DONE && user.consented) {
|
|
35
|
-
router.navigate(['/home'], { queryParams: route.queryParams });
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
33
|
return true;
|
|
40
34
|
}
|
|
41
35
|
|
|
@@ -70,7 +70,7 @@ export class EarlyAccessComponent implements OnInit {
|
|
|
70
70
|
try {
|
|
71
71
|
const compareDate = user.joinedWaitlistAt || user._createdAt;
|
|
72
72
|
if (!compareDate) return '';
|
|
73
|
-
|
|
73
|
+
|
|
74
74
|
const posNum = await this.userStore.count([
|
|
75
75
|
['joinedWaitlistAt', '<=', compareDate],
|
|
76
76
|
['accessState', '==', AccessState.WAITING],
|
|
@@ -22,7 +22,13 @@ export function handleAccess(
|
|
|
22
22
|
|
|
23
23
|
const waitingStates = [AccessState.SUBMIT_INTEREST, AccessState.WAITING];
|
|
24
24
|
if (user && !waitingStates.includes(user.accessState)) {
|
|
25
|
-
|
|
25
|
+
// Fully completed onboarding → go straight to home
|
|
26
|
+
if (user.consented && user.accessState === AccessState.DONE) {
|
|
27
|
+
router.navigate(['/home'], { queryParams: route.queryParams });
|
|
28
|
+
} else {
|
|
29
|
+
// Cleared waitlist but not yet consented → consent page
|
|
30
|
+
router.navigate(['/consent'], { queryParams: route.queryParams });
|
|
31
|
+
}
|
|
26
32
|
return false;
|
|
27
33
|
}
|
|
28
34
|
|
|
@@ -87,10 +87,11 @@ describe('First-Time / Onboarding Routing', () => {
|
|
|
87
87
|
expect(router.url).toEqual('/consent');
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
-
it('should intercept navigation to /home and redirect to /consent', async () => {
|
|
90
|
+
it('should intercept navigation to /home and redirect to /consent with returnUrl', async () => {
|
|
91
91
|
await harness.navigateByUrl('/home');
|
|
92
92
|
await harness.fixture.whenStable();
|
|
93
|
-
expect(router.url).
|
|
93
|
+
expect(router.url).toContain('/consent');
|
|
94
|
+
expect(router.url).toContain('returnUrl');
|
|
94
95
|
});
|
|
95
96
|
});
|
|
96
97
|
|
|
@@ -107,17 +108,17 @@ describe('First-Time / Onboarding Routing', () => {
|
|
|
107
108
|
expect(router.url).toEqual('/home');
|
|
108
109
|
});
|
|
109
110
|
|
|
110
|
-
it('should intercept navigation to /early-access and redirect to /
|
|
111
|
-
// earlyAccessGuard
|
|
111
|
+
it('should intercept navigation to /early-access and redirect to /home (skipping /consent)', async () => {
|
|
112
|
+
// earlyAccessGuard detects consented+DONE user and redirects directly to /home
|
|
112
113
|
await harness.navigateByUrl('/early-access');
|
|
113
114
|
await harness.fixture.whenStable();
|
|
114
115
|
expect(router.url).toEqual('/home');
|
|
115
116
|
});
|
|
116
117
|
|
|
117
|
-
it('should
|
|
118
|
+
it('should allow navigation to /consent (page is always readable)', async () => {
|
|
118
119
|
await harness.navigateByUrl('/consent');
|
|
119
120
|
await harness.fixture.whenStable();
|
|
120
|
-
expect(router.url).toEqual('/
|
|
121
|
+
expect(router.url).toEqual('/consent');
|
|
121
122
|
});
|
|
122
123
|
});
|
|
123
124
|
});
|
|
@@ -11,9 +11,9 @@ import { RotatingQuotesComponent } from '../rotating-quotes/rotating-quotes.comp
|
|
|
11
11
|
})
|
|
12
12
|
export class HeroComponent {
|
|
13
13
|
readonly sentences = [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
'First generic placeholder quote.',
|
|
15
|
+
'Second generic placeholder quote.',
|
|
16
|
+
'Third generic placeholder quote.',
|
|
17
17
|
];
|
|
18
18
|
isLoading = input<boolean>(false);
|
|
19
19
|
login = output<void>();
|
|
@@ -11,12 +11,12 @@ import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch
|
|
|
11
11
|
})
|
|
12
12
|
export class OnboardingComponent implements OnInit {
|
|
13
13
|
authStore = inject(AuthStore);
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
// --------------- INPUTS AND OUTPUTS ------------------
|
|
16
16
|
|
|
17
17
|
/** The currently signed in user. */
|
|
18
18
|
currentUser: Signal<User> = this.authStore.user;
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
// --------------- LOCAL UI STATE ----------------------
|
|
21
21
|
|
|
22
22
|
// --------------- COMPUTED DATA -----------------------
|
|
@@ -32,7 +32,7 @@ export class OnboardingComponent implements OnInit {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
// --------------- LOAD AND CLEANUP --------------------
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
ngOnInit() {
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -7,7 +7,7 @@ import { FirebaseMockService } from 'src/app/core/firebase/firebase.mock.service
|
|
|
7
7
|
import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
|
|
8
8
|
import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
9
9
|
|
|
10
|
-
/** Sets up the testing environment for HomeComponent using render
|
|
10
|
+
/** Sets up the testing environment for HomeComponent using render. */
|
|
11
11
|
async function setup() {
|
|
12
12
|
const user = userEvent.setup();
|
|
13
13
|
const checkedSpy = jest.fn();
|
|
@@ -11,16 +11,16 @@ import { NavbarComponent } from 'src/app/shared/navbar/navbar.component';
|
|
|
11
11
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12
12
|
imports: [
|
|
13
13
|
NavbarComponent,
|
|
14
|
-
]
|
|
14
|
+
],
|
|
15
15
|
})
|
|
16
16
|
export class HomeComponent implements OnInit {
|
|
17
17
|
authStore = inject(AuthStore);
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
// --------------- INPUTS AND OUTPUTS ------------------
|
|
20
20
|
|
|
21
21
|
/** The currently signed in user. */
|
|
22
22
|
currentUser: Signal<User> = this.authStore.user;
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
// --------------- LOCAL UI STATE ----------------------
|
|
25
25
|
|
|
26
26
|
// --------------- COMPUTED DATA -----------------------
|
|
@@ -46,7 +46,7 @@ export class HomeComponent implements OnInit {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// --------------- LOAD AND CLEANUP --------------------
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
ngOnInit() {
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -58,14 +58,14 @@ describe('DetectRedeploymentService', () => {
|
|
|
58
58
|
it('should gracefully handle network errors without killing the polling interval', async () => {
|
|
59
59
|
// Force a network error for the first fetch
|
|
60
60
|
fetchSpy.mockRejectedValueOnce(new Error('Network error'));
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
// Start the interval
|
|
63
63
|
service.init();
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
// First tick encounters the network error, which is caught and returns null, keeping the interval alive
|
|
66
|
-
jest.advanceTimersByTime(1);
|
|
66
|
+
jest.advanceTimersByTime(1);
|
|
67
67
|
await Promise.resolve();
|
|
68
|
-
|
|
68
|
+
|
|
69
69
|
expect(fetchSpy).toHaveBeenCalledTimes(1);
|
|
70
70
|
fetchSpy.mockClear();
|
|
71
71
|
|
|
@@ -79,8 +79,44 @@ describe('DetectRedeploymentService', () => {
|
|
|
79
79
|
// The interval is still alive! Advance time to the next 2-minute mark
|
|
80
80
|
jest.advanceTimersByTime(2 * 60 * 1000);
|
|
81
81
|
await Promise.resolve();
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
// Fetch should be called again, proving the interval survived
|
|
84
84
|
expect(fetchSpy).toHaveBeenCalledTimes(1);
|
|
85
85
|
});
|
|
86
|
+
|
|
87
|
+
it('should detect redeployment immediately on startup if the DOM script hash differs from the fetched index.html', async () => {
|
|
88
|
+
// Inject a script tag into the mock DOM
|
|
89
|
+
const scriptEl = document.createElement('script');
|
|
90
|
+
scriptEl.setAttribute('src', 'main-OLDHASH.js');
|
|
91
|
+
document.body.appendChild(scriptEl);
|
|
92
|
+
|
|
93
|
+
try {
|
|
94
|
+
// Mock fetch to return a newer hash
|
|
95
|
+
fetchSpy.mockReturnValue(
|
|
96
|
+
Promise.resolve({
|
|
97
|
+
text: () => Promise.resolve('<script src="main-NEWHASH.js"></script>'),
|
|
98
|
+
}),
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
let triggered = false;
|
|
102
|
+
const triggeredPromise = new Promise<void>((resolve) => {
|
|
103
|
+
service.redeployed().subscribe({
|
|
104
|
+
next: () => {
|
|
105
|
+
triggered = true;
|
|
106
|
+
resolve();
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
service.init();
|
|
112
|
+
|
|
113
|
+
// Resolve startup fetch
|
|
114
|
+
jest.advanceTimersByTime(1);
|
|
115
|
+
await triggeredPromise;
|
|
116
|
+
|
|
117
|
+
expect(triggered).toBe(true);
|
|
118
|
+
} finally {
|
|
119
|
+
document.body.removeChild(scriptEl);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
86
122
|
});
|