@tech4good/angular-schematics 21.6.0 → 21.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/CHANGELOG.md +28 -0
- package/README.md +266 -1
- package/package.json +34 -7
- package/src/component/files/__name@dasherize__/__name@dasherize__.component.spec.ts.template +4 -5
- package/src/component/files/__name@dasherize__/__name@dasherize__.component.ts.template +1 -1
- package/src/entity/files/__name@dasherize__/__name@dasherize__.mock.ts.template +14 -6
- package/src/entity/files/__name@dasherize__/__name@dasherize__.model.ts.template +12 -6
- package/src/entity/files/__name@dasherize__/__name@dasherize__.store.ts.template +18 -10
- package/src/entity/index.js +4 -49
- package/src/entity/index.js.map +1 -1
- package/src/guard/files/__name@dasherize__.guard.spec.ts.template +0 -1
- package/src/ng-add/files/.github/workflows/angular-github-ci.yml.template +3 -0
- package/src/ng-add/files/.gitignore.template +3 -0
- package/src/ng-add/files/analytics/datasets.js.template +206 -0
- package/src/ng-add/files/analytics/entity_sources.js.template +58 -0
- package/src/ng-add/files/analytics/entity_sources.test.js.template +57 -0
- package/src/ng-add/files/analytics/lib/api_query.js.template +87 -0
- package/src/ng-add/files/analytics/lib/api_query.test.js.template +84 -0
- package/src/ng-add/files/analytics/lib/bigquery_query_compatibility.test.js.template +53 -0
- package/src/ng-add/files/analytics/lib/dataset_schema.js.template +53 -0
- package/src/ng-add/files/analytics/lib/dataset_schema.test.js.template +34 -0
- package/src/ng-add/files/analytics/lib/entity_sync.js.template +397 -0
- package/src/ng-add/files/analytics/lib/entity_sync.test.js.template +212 -0
- package/src/ng-add/files/analytics/lib/identifier_salt.js.template +57 -0
- package/src/ng-add/files/analytics/lib/identifier_salt.test.js.template +36 -0
- package/src/ng-add/files/analytics/lib/snapshot_files.js.template +46 -0
- package/src/ng-add/files/analytics/lib/snapshot_files.test.js.template +67 -0
- package/src/ng-add/files/analytics/lib/sqlite.js.template +92 -0
- package/src/ng-add/files/analytics/lib/upload_entities.js.template +81 -0
- package/src/ng-add/files/analytics/lib/upload_entities.test.js.template +86 -0
- package/src/ng-add/files/analytics/proxy.conf.json.template +7 -0
- package/src/ng-add/files/analytics/scripts/refresh_snapshot.js.template +518 -0
- package/src/ng-add/files/analytics/scripts/start.js.template +88 -0
- package/src/ng-add/files/analytics/server/server.js.template +212 -0
- package/src/ng-add/files/angular.json.template +80 -1
- package/src/ng-add/files/bigquery/queries/active_time_by_route.sql.template +27 -8
- package/src/ng-add/files/bigquery/queries/active_user_windows.sql.template +67 -0
- package/src/ng-add/files/bigquery/queries/dashboard_route_visits.sql.template +47 -0
- package/src/ng-add/files/bigquery/queries/data_quality.sql.template +323 -0
- package/src/ng-add/files/bigquery/queries/onboarding_funnel.sql.template +512 -0
- package/src/ng-add/files/bigquery/queries/onboarding_stage_observations.sql.template +134 -0
- package/src/ng-add/files/bigquery/queries/weekly_retention_cohorts.sql.template +90 -0
- package/src/ng-add/files/bigquery/scripts/export_entities.js.template +120 -0
- package/src/ng-add/files/bigquery/scripts/init_views.js.template +57 -0
- package/src/ng-add/files/bigquery/scripts/run_query.js.template +141 -0
- package/src/ng-add/files/bigquery/views/events_flat.sql.template +27 -12
- package/src/ng-add/files/bigquery/views/logs_latest.sql.template +16 -3
- package/src/ng-add/files/docs-infra/analytics-guide.md.template +270 -25
- package/src/ng-add/files/docs-infra/analytics-workbench-guide.md.template +307 -0
- package/src/ng-add/files/docs-infra/authentication-architecture.md.template +54 -24
- package/src/ng-add/files/docs-infra/email-infrastructure.md.template +43 -0
- package/src/ng-add/files/docs-infra/firestore-index-checker.md.template +87 -0
- package/src/ng-add/files/docs-infra/infrastructure-guide.md.template +108 -29
- package/src/ng-add/files/docs-infra/load-system-architecture.md.template +15 -1
- package/src/ng-add/files/docs-infra/querying-strategy.md.template +14 -0
- package/src/ng-add/files/docs-infra/stream-system-architecture.md.template +21 -7
- package/src/ng-add/files/eslint.config.js.template +22 -3
- package/src/ng-add/files/functions/package.json.template +1 -0
- package/src/ng-add/files/functions/src/email.ts.template +23 -0
- package/src/ng-add/files/jest.config.ts.template +3 -2
- package/src/ng-add/files/package.json.template +39 -16
- package/src/ng-add/files/projects/analytics/src/app/analytics-api.service.ts.template +130 -0
- package/src/ng-add/files/projects/analytics/src/app/app.component.html.template +77 -0
- package/src/ng-add/files/projects/analytics/src/app/app.component.scss.template +240 -0
- package/src/ng-add/files/projects/analytics/src/app/app.component.ts.template +96 -0
- package/src/ng-add/files/projects/analytics/src/app/app.routes.ts.template +11 -0
- package/src/ng-add/files/projects/analytics/src/app/dashboard-pages.spec.ts.template +151 -0
- package/src/ng-add/files/projects/analytics/src/app/data-quality/data-quality-page/data-quality-page.component.html.template +39 -0
- package/src/ng-add/files/projects/analytics/src/app/data-quality/data-quality-page/data-quality-page.component.scss.template +1 -0
- package/src/ng-add/files/projects/analytics/src/app/data-quality/data-quality-page/data-quality-page.component.ts.template +95 -0
- package/src/ng-add/files/projects/analytics/src/app/engagement/engagement-page/engagement-page.component.html.template +47 -0
- package/src/ng-add/files/projects/analytics/src/app/engagement/engagement-page/engagement-page.component.scss.template +1 -0
- package/src/ng-add/files/projects/analytics/src/app/engagement/engagement-page/engagement-page.component.ts.template +120 -0
- package/src/ng-add/files/projects/analytics/src/app/onboarding/onboarding-page/onboarding-page.component.html.template +40 -0
- package/src/ng-add/files/projects/analytics/src/app/onboarding/onboarding-page/onboarding-page.component.scss.template +1 -0
- package/src/ng-add/files/projects/analytics/src/app/onboarding/onboarding-page/onboarding-page.component.ts.template +98 -0
- package/src/ng-add/files/projects/analytics/src/app/overview/overview-page/overview-page.component.html.template +35 -0
- package/src/ng-add/files/projects/analytics/src/app/overview/overview-page/overview-page.component.scss.template +1 -0
- package/src/ng-add/files/projects/analytics/src/app/overview/overview-page/overview-page.component.ts.template +84 -0
- package/src/ng-add/files/projects/analytics/src/app/routes/routes-page/routes-page.component.html.template +42 -0
- package/src/ng-add/files/projects/analytics/src/app/routes/routes-page/routes-page.component.scss.template +1 -0
- package/src/ng-add/files/projects/analytics/src/app/routes/routes-page/routes-page.component.ts.template +110 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/analytics-utils.ts.template +43 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/chart-theme.ts.template +42 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/dashboard-layout.scss.template +239 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/dashboard-table/dashboard-table.component.html.template +76 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/dashboard-table/dashboard-table.component.scss.template +128 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/dashboard-table/dashboard-table.component.spec.ts.template +31 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/dashboard-table/dashboard-table.component.ts.template +153 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/funnel-chart/funnel-chart.component.html.template +16 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/funnel-chart/funnel-chart.component.scss.template +63 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/funnel-chart/funnel-chart.component.ts.template +52 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/metric-card/metric-card.component.html.template +5 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/metric-card/metric-card.component.scss.template +56 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/metric-card/metric-card.component.spec.ts.template +30 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/metric-card/metric-card.component.ts.template +15 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/quality-chart/quality-chart.component.html.template +9 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/quality-chart/quality-chart.component.scss.template +43 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/quality-chart/quality-chart.component.ts.template +62 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/route-distribution-chart/route-distribution-chart.component.html.template +9 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/route-distribution-chart/route-distribution-chart.component.scss.template +33 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/route-distribution-chart/route-distribution-chart.component.ts.template +82 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/route-traffic-chart/route-traffic-chart.component.html.template +15 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/route-traffic-chart/route-traffic-chart.component.scss.template +45 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/route-traffic-chart/route-traffic-chart.component.ts.template +55 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/status-message/status-message.component.html.template +18 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/status-message/status-message.component.scss.template +45 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/status-message/status-message.component.ts.template +15 -0
- package/src/ng-add/files/projects/analytics/src/app/vega-chart/vega-chart.component.ts.template +121 -0
- package/src/ng-add/files/projects/analytics/src/index.html.template +19 -0
- package/src/ng-add/files/projects/analytics/src/main.ts.template +16 -0
- package/src/ng-add/files/projects/analytics/src/styles.scss.template +28 -0
- package/src/ng-add/files/projects/analytics/tsconfig.app.json.template +13 -0
- package/src/ng-add/files/projects/analytics/tsconfig.spec.json.template +15 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-panel.component.spec.ts.template +4 -5
- package/src/ng-add/files/src/app/admin/admin-panel/admin-settings/admin-settings.component.spec.ts.template +4 -5
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-list.component.spec.ts.template +11 -12
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-list.component.ts.template +7 -7
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.component.spec.ts.template +8 -10
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.component.ts.template +3 -2
- package/src/ng-add/files/src/app/app.component.html.template +1 -1
- package/src/ng-add/files/src/app/app.component.scss.template +1 -1
- package/src/ng-add/files/src/app/app.component.spec.ts.template +4 -5
- package/src/ng-add/files/src/app/app.component.ts.template +1 -2
- package/src/ng-add/files/src/app/app.config.ts.template +21 -15
- package/src/ng-add/files/src/app/auth-routing.spec.ts.template +4 -5
- package/src/ng-add/files/src/app/core/analytics/time-analytics.service.spec.ts.template +46 -29
- package/src/ng-add/files/src/app/core/analytics/time-analytics.service.ts.template +27 -18
- package/src/ng-add/files/src/app/core/auth/auth.providers.spec.ts.template +112 -0
- package/src/ng-add/files/src/app/core/auth/auth.providers.ts.template +48 -0
- package/src/ng-add/files/src/app/core/auth/auth.service.ts.template +9 -23
- package/src/ng-add/files/src/app/core/auth/guards/require-admin.guard.spec.ts.template +3 -14
- package/src/ng-add/files/src/app/core/firebase/data.providers.prod.ts.template +21 -0
- package/src/ng-add/files/src/app/core/firebase/data.providers.ts.template +13 -0
- package/src/ng-add/files/src/app/core/local-storage/session.service.spec.ts.template +43 -0
- package/src/ng-add/files/src/app/core/local-storage/session.service.ts.template +7 -0
- package/src/ng-add/files/src/app/core/store/app-data.spec.ts.template +76 -0
- package/src/ng-add/files/src/app/core/store/auth/auth.mock.ts.template +19 -67
- package/src/ng-add/files/src/app/core/store/auth/auth.store.spec.ts.template +102 -12
- package/src/ng-add/files/src/app/core/store/auth/auth.store.ts.template +32 -237
- package/src/ng-add/files/src/app/core/store/user/user.mock.ts.template +17 -12
- package/src/ng-add/files/src/app/core/store/user/user.model.ts.template +6 -7
- package/src/ng-add/files/src/app/core/store/user/user.store.ts.template +14 -10
- package/src/ng-add/files/src/app/core/store/user-context/user-context.mock.ts.template +20 -8
- package/src/ng-add/files/src/app/core/store/user-context/user-context.model.ts.template +5 -6
- package/src/ng-add/files/src/app/core/store/user-context/user-context.store.ts.template +14 -10
- package/src/ng-add/files/src/app/core/store/user-private/user-private.mock.ts.template +20 -7
- package/src/ng-add/files/src/app/core/store/user-private/user-private.model.ts.template +5 -6
- package/src/ng-add/files/src/app/core/store/user-private/user-private.store.ts.template +14 -10
- package/src/ng-add/files/src/app/core/testing/app-mocks.ts.template +42 -0
- package/src/ng-add/files/src/app/first-time/consent/consent.component.html.template +2 -1
- package/src/ng-add/files/src/app/first-time/consent/consent.component.scss.template +7 -3
- package/src/ng-add/files/src/app/first-time/consent/consent.component.spec.ts.template +31 -11
- package/src/ng-add/files/src/app/first-time/consent/consent.component.ts.template +16 -1
- package/src/ng-add/files/src/app/first-time/early-access/early-access.component.spec.ts.template +15 -15
- package/src/ng-add/files/src/app/first-time/early-access/early-access.component.ts.template +11 -3
- package/src/ng-add/files/src/app/first-time/early-access/survey-form/survey-form.component.html.template +2 -1
- package/src/ng-add/files/src/app/first-time/early-access/survey-form/survey-form.component.scss.template +7 -3
- package/src/ng-add/files/src/app/first-time/early-access/survey-form/survey-form.component.spec.ts.template +20 -6
- package/src/ng-add/files/src/app/first-time/early-access/survey-form/survey-form.component.ts.template +2 -0
- package/src/ng-add/files/src/app/first-time/early-access/waitlist-view/waitlist-view.component.spec.ts.template +4 -5
- package/src/ng-add/files/src/app/first-time/email-link/email-link.component.spec.ts.template +17 -1
- package/src/ng-add/files/src/app/first-time/email-link/email-link.component.ts.template +15 -0
- package/src/ng-add/files/src/app/first-time/first-time-routing.spec.ts.template +4 -5
- package/src/ng-add/files/src/app/first-time/landing/hero/hero.component.ts.template +15 -0
- package/src/ng-add/files/src/app/first-time/landing/landing.component.spec.ts.template +2 -0
- package/src/ng-add/files/src/app/first-time/login/login.component.spec.ts.template +21 -3
- package/src/ng-add/files/src/app/first-time/login/login.component.ts.template +26 -0
- package/src/ng-add/files/src/app/first-time/onboarding/onboarding.component.spec.ts.template +4 -2
- package/src/ng-add/files/src/app/first-time/onboarding/onboarding.component.ts.template +1 -1
- package/src/ng-add/files/src/app/main/account-profile/account-profile.component.spec.ts.template +2 -2
- package/src/ng-add/files/src/app/main/account-profile/delete-guest-card/delete-guest-card.component.spec.ts.template +2 -2
- package/src/ng-add/files/src/app/main/account-profile/profile-details-card/profile-details-card.component.spec.ts.template +4 -4
- package/src/ng-add/files/src/app/main/account-profile/sign-in-methods-card/sign-in-methods-card.component.spec.ts.template +2 -2
- package/src/ng-add/files/src/app/main/home/home.component.spec.ts.template +4 -5
- package/src/ng-add/files/src/app/main/home/home.component.ts.template +1 -1
- package/src/ng-add/files/src/app/shared/guest-warning-bar/guest-warning-bar.component.spec.ts.template +4 -4
- package/src/ng-add/files/src/app/shared/navbar/navbar.component.spec.ts.template +2 -2
- package/src/ng-add/files/tsconfig.spec.json.template +3 -1
- package/src/ng-add/index.js +7 -0
- package/src/ng-add/index.js.map +1 -1
- package/src/shared/entity-registry.d.ts +8 -0
- package/src/shared/entity-registry.js +28 -0
- package/src/shared/entity-registry.js.map +1 -0
- package/.agents/skills/publish-npm/SKILL.md +0 -37
- package/.agents/skills/publish-npm/eval.yaml +0 -32
- package/.agents/skills/publish-npm/fixtures/package-v21.json.template +0 -8
- package/.husky/commit-msg +0 -1
- package/.husky/pre-commit +0 -1
- package/.t4g/agent-memory.db +0 -0
- package/src/component/index_spec.d.ts +0 -1
- package/src/component/index_spec.js +0 -68
- package/src/component/index_spec.js.map +0 -1
- package/src/entity/index_spec.d.ts +0 -1
- package/src/entity/index_spec.js +0 -153
- package/src/entity/index_spec.js.map +0 -1
- package/src/guard/index_spec.d.ts +0 -1
- package/src/guard/index_spec.js +0 -64
- package/src/guard/index_spec.js.map +0 -1
- package/src/ng-add/files/bigquery/scripts/export_entities.py.template +0 -143
- package/src/ng-add/files/bigquery/scripts/run_query.py.template +0 -167
- package/src/ng-add/files/src/app/core/firebase/cached-listeners.service.ts.template +0 -500
- package/src/ng-add/files/src/app/core/firebase/database.service.ts.template +0 -73
- package/src/ng-add/files/src/app/core/firebase/email-link-context.service.spec.ts.template +0 -59
- package/src/ng-add/files/src/app/core/firebase/email-link-context.service.ts.template +0 -147
- package/src/ng-add/files/src/app/core/firebase/firebase.mock.service.ts.template +0 -453
- package/src/ng-add/files/src/app/core/firebase/firebase.service.spec.ts.template +0 -116
- package/src/ng-add/files/src/app/core/firebase/firebase.service.ts.template +0 -639
- package/src/ng-add/files/src/app/core/firebase/simulate-load.spec.ts.template +0 -104
- package/src/ng-add/files/src/app/core/firebase/simulate-stream.spec.ts.template +0 -127
- package/src/ng-add/files/src/app/core/firebase/simulation.mock.ts.template +0 -38
- package/src/ng-add/files/src/app/core/firebase/stream-multiplexer.ts.template +0 -445
- package/src/ng-add/files/src/app/core/logging/logging.service.spec.ts.template +0 -118
- package/src/ng-add/files/src/app/core/logging/logging.service.ts.template +0 -168
- package/src/ng-add/files/src/app/core/store/app.model.ts.template +0 -21
- package/src/ng-add/files/src/app/core/store/app.store.spec.ts.template +0 -920
- package/src/ng-add/files/src/app/core/store/app.store.ts.template +0 -1320
- package/src/ng-add/files/src/app/core/store/batch-write.firebase.service.ts.template +0 -58
- package/src/ng-add/files/src/app/core/store/batch-write.mock.service.ts.template +0 -105
- package/src/ng-add/files/src/app/core/store/batch-write.service.ts.template +0 -126
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.component.html.template +0 -9
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.component.scss.template +0 -46
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.component.spec.ts.template +0 -69
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.component.ts.template +0 -39
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.service.spec.ts.template +0 -122
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.service.ts.template +0 -88
- package/src/ng-add/index_spec.d.ts +0 -1
- package/src/ng-add/index_spec.js +0 -108
- package/src/ng-add/index_spec.js.map +0 -1
|
@@ -1,41 +1,45 @@
|
|
|
1
1
|
import { inject, effect, WritableSignal } from '@angular/core';
|
|
2
2
|
import { signalStore, withState, withMethods } from '@ngrx/signals';
|
|
3
3
|
import { withEntities, removeEntity, updateEntity, setEntity, removeEntities, setEntities } from '@ngrx/signals/entities';
|
|
4
|
-
import { EntityLoadQuery, EntityStreamQuery, selectEntities, processLoadQueries, withEntitiesAndDBMethods } from '
|
|
5
|
-
import { QueryParams, QueryOptions
|
|
6
|
-
import {
|
|
4
|
+
import { EntityLoadQuery, EntityStreamQuery, selectEntities, processLoadQueries, withEntitiesAndDBMethods } from '@tech4good/platform-data';
|
|
5
|
+
import { QueryParams, QueryOptions } from '@tech4good/platform-data';
|
|
6
|
+
import { DataEntity } from '@tech4good/platform-data';
|
|
7
|
+
import { UserPrivate, userPrivateEntity } from './user-private.model';
|
|
7
8
|
|
|
9
|
+
/** Nested one-shot load descriptor; construction alone does not fetch records. */
|
|
8
10
|
export class LoadUserPrivate extends EntityLoadQuery<UserPrivate> {
|
|
9
11
|
constructor(
|
|
10
12
|
store,
|
|
11
13
|
queryParams: QueryParams,
|
|
12
14
|
queryOptions: QueryOptions,
|
|
13
|
-
loadQueries?: (entity: UserPrivate) => EntityLoadQuery<
|
|
15
|
+
loadQueries?: (entity: UserPrivate) => EntityLoadQuery<DataEntity>[],
|
|
14
16
|
) {
|
|
15
|
-
super(
|
|
17
|
+
super(userPrivateEntity.collection, store, queryParams, queryOptions, loadQueries);
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
static create(store, queryParams: QueryParams, queryOptions: QueryOptions, loadQueries?: (entity: UserPrivate) => EntityLoadQuery<
|
|
20
|
+
static create(store, queryParams: QueryParams, queryOptions: QueryOptions, loadQueries?: (entity: UserPrivate) => EntityLoadQuery<DataEntity>[]): LoadUserPrivate {
|
|
19
21
|
return new LoadUserPrivate(store, queryParams, queryOptions, loadQueries);
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
|
|
25
|
+
/** Nested live-query descriptor, scoped to the calling component by its injector. */
|
|
23
26
|
export class StreamUserPrivate extends EntityStreamQuery<UserPrivate> {
|
|
24
27
|
constructor(
|
|
25
28
|
store,
|
|
26
29
|
queryParams: QueryParams,
|
|
27
30
|
queryOptions: QueryOptions,
|
|
28
|
-
streamQueries?: (entity: UserPrivate) => EntityStreamQuery<
|
|
31
|
+
streamQueries?: (entity: UserPrivate) => EntityStreamQuery<DataEntity>[],
|
|
29
32
|
) {
|
|
30
|
-
super(
|
|
33
|
+
super(userPrivateEntity.collection, store, queryParams, queryOptions, streamQueries);
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
static create(store, queryParams: QueryParams, queryOptions: QueryOptions, streamQueries?: (entity: UserPrivate) => EntityStreamQuery<
|
|
36
|
+
static create(store, queryParams: QueryParams, queryOptions: QueryOptions, streamQueries?: (entity: UserPrivate) => EntityStreamQuery<DataEntity>[]): StreamUserPrivate {
|
|
34
37
|
return new StreamUserPrivate(store, queryParams, queryOptions, streamQueries);
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
40
|
|
|
41
|
+
/** One shared root store for this collection. The app explicitly chooses when to clear its records. */
|
|
38
42
|
export const UserPrivateStore = signalStore(
|
|
39
43
|
{ providedIn: 'root' },
|
|
40
|
-
withEntitiesAndDBMethods<UserPrivate>(
|
|
44
|
+
withEntitiesAndDBMethods<UserPrivate>(userPrivateEntity.collection),
|
|
41
45
|
);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Provider } from '@angular/core';
|
|
2
|
+
import { createMockRegistry, seedMockRegistry, MockSeedOverrides, provideMockData } from '@tech4good/platform-data/testing';
|
|
3
|
+
import { AuthSession } from '@tech4good/platform-auth';
|
|
4
|
+
import { provideMockAuth, provideMockProfiles } from '@tech4good/platform-auth/testing';
|
|
5
|
+
import { APP_ENTITY_MOCKS } from '../store/entity-mocks.generated';
|
|
6
|
+
import { APP_MOCK_SESSION } from '../store/auth/auth.mock';
|
|
7
|
+
import { provideAppAuthLifecycle, provideAppUserProfiles } from '../auth/auth.providers';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* App-owned seeds and profile policy composed with the shared mock adapters.
|
|
11
|
+
* Overrides run after default initialization (including persistence restoration),
|
|
12
|
+
* so collections: { users: [] } deliberately starts with no users. Unspecified
|
|
13
|
+
* collections retain their defaults. Custom mock stores stay injectable.
|
|
14
|
+
*/
|
|
15
|
+
export function provideAppMocks({
|
|
16
|
+
collections = {}, disableLatency, failCollections, stallCollections, persist = false, initialSession = null,
|
|
17
|
+
}: {
|
|
18
|
+
collections?: MockSeedOverrides<typeof APP_ENTITY_MOCKS>;
|
|
19
|
+
disableLatency?: boolean;
|
|
20
|
+
failCollections?: string[];
|
|
21
|
+
stallCollections?: string[];
|
|
22
|
+
persist?: boolean;
|
|
23
|
+
initialSession?: AuthSession | null;
|
|
24
|
+
} = {}): Provider[] {
|
|
25
|
+
return [
|
|
26
|
+
...provideMockData({
|
|
27
|
+
collections: () => {
|
|
28
|
+
const registry = createMockRegistry(APP_ENTITY_MOCKS);
|
|
29
|
+
seedMockRegistry<typeof APP_ENTITY_MOCKS>(registry, collections);
|
|
30
|
+
return registry;
|
|
31
|
+
},
|
|
32
|
+
disableLatency, failCollections, stallCollections,
|
|
33
|
+
persistence: { enabled: persist },
|
|
34
|
+
}),
|
|
35
|
+
...provideMockAuth({ initialSession, googleSession: APP_MOCK_SESSION, persistSession: persist }),
|
|
36
|
+
...provideMockProfiles(),
|
|
37
|
+
...provideAppUserProfiles(),
|
|
38
|
+
// The mock backend has no server-side account to delete. Shared auth signs
|
|
39
|
+
// out its mock identity after the same app-owned store cleanup sequence.
|
|
40
|
+
...provideAppAuthLifecycle(async () => {}),
|
|
41
|
+
];
|
|
42
|
+
}
|
|
@@ -174,7 +174,8 @@
|
|
|
174
174
|
</div>
|
|
175
175
|
<button type="submit" class="btn continue-btn" [disabled]="!consentForm.checked().value()">
|
|
176
176
|
Accept and Continue
|
|
177
|
-
|
|
177
|
+
<!-- Decorative arrow from the bundled Material Icons font (no remote image host) -->
|
|
178
|
+
<mat-icon aria-hidden="true">arrow_forward</mat-icon>
|
|
178
179
|
</button>
|
|
179
180
|
</form>
|
|
180
181
|
}
|
|
@@ -42,7 +42,11 @@
|
|
|
42
42
|
font-size: 1.1em;
|
|
43
43
|
padding: 10px 22px 10px;
|
|
44
44
|
transition: color 0.8s ease, border 0.8s ease;
|
|
45
|
-
|
|
45
|
+
// Arrow icon: sized to match the button text and nudged right on hover
|
|
46
|
+
>mat-icon {
|
|
47
|
+
font-size: 20px;
|
|
48
|
+
width: 20px;
|
|
49
|
+
height: 20px;
|
|
46
50
|
margin: 0 3px 0 2px;
|
|
47
51
|
transition: margin 0.2s ease;
|
|
48
52
|
}
|
|
@@ -53,11 +57,11 @@
|
|
|
53
57
|
box-shadow: none;
|
|
54
58
|
}
|
|
55
59
|
&:hover {
|
|
56
|
-
>
|
|
60
|
+
>mat-icon {
|
|
57
61
|
margin: 0 0 0 5px;
|
|
58
62
|
}
|
|
59
63
|
&[disabled] {
|
|
60
|
-
>
|
|
64
|
+
>mat-icon {
|
|
61
65
|
margin: 0 3px 0 2px;
|
|
62
66
|
}
|
|
63
67
|
}
|
|
@@ -6,20 +6,21 @@ import { Location } from '@angular/common';
|
|
|
6
6
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
7
7
|
|
|
8
8
|
import { ConsentComponent } from './consent.component';
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
|
|
9
|
+
|
|
10
|
+
import { BATCH_WRITE_SERVICE } from '@tech4good/platform-data';
|
|
11
|
+
import { BatchWriteMockService } from '@tech4good/platform-data/testing';
|
|
13
12
|
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
14
13
|
import { AuthLoggedInMockDB } from 'src/app/core/store/auth/auth.mock';
|
|
15
14
|
import { UserStore } from 'src/app/core/store/user/user.store';
|
|
16
|
-
import { AccessState } from 'src/app/core/store/user/user.model';
|
|
17
|
-
import {
|
|
15
|
+
import { AccessState, User } from 'src/app/core/store/user/user.model';
|
|
16
|
+
import { provideAppMocks } from 'src/app/core/testing/app-mocks';
|
|
18
17
|
import { USER_DB } from 'src/app/core/store/user/user.mock';
|
|
18
|
+
import { TimeAnalyticsService } from 'src/app/core/analytics/time-analytics.service';
|
|
19
19
|
|
|
20
20
|
/** Sets up the testing environment for ConsentComponent using render. */
|
|
21
|
-
async function setup(providers: Provider[] = [], seededUsers:
|
|
21
|
+
async function setup(providers: Provider[] = [], seededUsers: User[] = []) {
|
|
22
22
|
const user = userEvent.setup();
|
|
23
|
+
const analytics = { trackInteraction: jest.fn() };
|
|
23
24
|
const snackBarMock = {
|
|
24
25
|
open: jest.fn(),
|
|
25
26
|
};
|
|
@@ -39,14 +40,13 @@ async function setup(providers: Provider[] = [], seededUsers: any[] = []) {
|
|
|
39
40
|
|
|
40
41
|
const view = await render(ConsentComponent, {
|
|
41
42
|
providers: [
|
|
42
|
-
...
|
|
43
|
-
users: seededUsers,
|
|
44
|
-
}),
|
|
43
|
+
...provideAppMocks({ collections: { users: seededUsers } }),
|
|
45
44
|
{ provide: MatSnackBar, useValue: snackBarMock },
|
|
46
45
|
{ provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
|
|
47
46
|
{ provide: Router, useValue: routerMock },
|
|
48
47
|
{ provide: ActivatedRoute, useValue: activatedRouteMock },
|
|
49
48
|
{ provide: AuthStore, useClass: AuthLoggedInMockDB },
|
|
49
|
+
{ provide: TimeAnalyticsService, useValue: analytics },
|
|
50
50
|
UserStore,
|
|
51
51
|
...providers,
|
|
52
52
|
],
|
|
@@ -61,6 +61,7 @@ async function setup(providers: Provider[] = [], seededUsers: any[] = []) {
|
|
|
61
61
|
navigateSpy: routerMock.navigate,
|
|
62
62
|
snackBarMock,
|
|
63
63
|
userStore: view.fixture.debugElement.injector.get(UserStore),
|
|
64
|
+
analytics: view.fixture.debugElement.injector.get(TimeAnalyticsService),
|
|
64
65
|
};
|
|
65
66
|
}
|
|
66
67
|
|
|
@@ -79,6 +80,21 @@ describe('ConsentComponent', () => {
|
|
|
79
80
|
expect(screen.getByRole('button', { name: /Accept and Continue/i })).toBeDisabled();
|
|
80
81
|
});
|
|
81
82
|
|
|
83
|
+
it('renders the accept arrow as a bundled Material icon rather than a remote image', async () => {
|
|
84
|
+
await setup();
|
|
85
|
+
|
|
86
|
+
// The arrow is decorative, so the button's accessible name is just its label
|
|
87
|
+
const acceptButton = screen.getByRole('button', { name: 'Accept and Continue' });
|
|
88
|
+
|
|
89
|
+
// Remote icon images (like the former third-party arrow SVG) break when their host goes away.
|
|
90
|
+
expect(acceptButton.querySelector('img')).toBeNull();
|
|
91
|
+
|
|
92
|
+
const icon = acceptButton.querySelector('mat-icon');
|
|
93
|
+
expect(icon).not.toBeNull();
|
|
94
|
+
expect(icon).toHaveTextContent('arrow_forward');
|
|
95
|
+
expect(icon).toHaveAttribute('aria-hidden', 'true');
|
|
96
|
+
});
|
|
97
|
+
|
|
82
98
|
it('should enable submit button when checkbox is checked', async () => {
|
|
83
99
|
const { user } = await setup();
|
|
84
100
|
|
|
@@ -95,7 +111,7 @@ describe('ConsentComponent', () => {
|
|
|
95
111
|
USER_DB[0].accessState = AccessState.WAITING;
|
|
96
112
|
USER_DB[0].consented = false;
|
|
97
113
|
|
|
98
|
-
const { user, userStore, navigateSpy } = await setup([], [USER_DB[0]]);
|
|
114
|
+
const { user, userStore, navigateSpy, analytics } = await setup([], [USER_DB[0]]);
|
|
99
115
|
|
|
100
116
|
const updateSpy = jest.spyOn(userStore, 'update');
|
|
101
117
|
|
|
@@ -113,6 +129,10 @@ describe('ConsentComponent', () => {
|
|
|
113
129
|
await waitFor(() => {
|
|
114
130
|
expect(navigateSpy).toHaveBeenCalledWith(['/home'], { queryParams: {} });
|
|
115
131
|
});
|
|
132
|
+
expect(analytics.trackInteraction).toHaveBeenCalledWith('onboarding', 'consent_submit_result', {
|
|
133
|
+
outcome: 'success',
|
|
134
|
+
accessState: AccessState.WAITING,
|
|
135
|
+
});
|
|
116
136
|
|
|
117
137
|
updateSpy.mockRestore();
|
|
118
138
|
});
|
|
@@ -6,9 +6,11 @@ import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
|
6
6
|
import { UserStore } from 'src/app/core/store/user/user.store';
|
|
7
7
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
8
8
|
import { MatCheckbox } from '@angular/material/checkbox';
|
|
9
|
+
import { MatIcon } from '@angular/material/icon';
|
|
9
10
|
import { form, required, validate, FormField, FormRoot } from '@angular/forms/signals';
|
|
10
|
-
import { BatchWriteService, BATCH_WRITE_SERVICE } from '
|
|
11
|
+
import { BatchWriteService, BATCH_WRITE_SERVICE } from '@tech4good/platform-data';
|
|
11
12
|
import { NavbarComponent } from 'src/app/shared/navbar/navbar.component';
|
|
13
|
+
import { TimeAnalyticsService } from 'src/app/core/analytics/time-analytics.service';
|
|
12
14
|
|
|
13
15
|
export interface ConsentData {
|
|
14
16
|
checked: boolean;
|
|
@@ -22,6 +24,7 @@ export interface ConsentData {
|
|
|
22
24
|
imports: [
|
|
23
25
|
NavbarComponent,
|
|
24
26
|
MatCheckbox,
|
|
27
|
+
MatIcon,
|
|
25
28
|
RouterLink,
|
|
26
29
|
FormField,
|
|
27
30
|
FormRoot,
|
|
@@ -30,6 +33,7 @@ export interface ConsentData {
|
|
|
30
33
|
export class ConsentComponent implements OnInit {
|
|
31
34
|
readonly authStore = inject(AuthStore);
|
|
32
35
|
readonly userStore = inject(UserStore);
|
|
36
|
+
private readonly analytics = inject(TimeAnalyticsService);
|
|
33
37
|
|
|
34
38
|
// --------------- INPUTS AND OUTPUTS ------------------
|
|
35
39
|
|
|
@@ -88,11 +92,19 @@ export class ConsentComponent implements OnInit {
|
|
|
88
92
|
// --------------- STATE ACTIONS -----------------------
|
|
89
93
|
|
|
90
94
|
async submitConsent() {
|
|
95
|
+
const priorAccessState = this.currentUser()?.accessState;
|
|
96
|
+
this.analytics.trackInteraction('onboarding', 'consent_submit_attempt', {
|
|
97
|
+
accessState: priorAccessState,
|
|
98
|
+
});
|
|
91
99
|
try {
|
|
92
100
|
await this.userStore.update(this.currentUser().__id, {
|
|
93
101
|
accessState: AccessState.DONE,
|
|
94
102
|
consented: true,
|
|
95
103
|
});
|
|
104
|
+
this.analytics.trackInteraction('onboarding', 'consent_submit_result', {
|
|
105
|
+
outcome: 'success',
|
|
106
|
+
accessState: priorAccessState,
|
|
107
|
+
});
|
|
96
108
|
|
|
97
109
|
// Navigate to returnUrl or /home directly after successful submit
|
|
98
110
|
const returnUrl = this.route.snapshot.queryParamMap?.get('returnUrl');
|
|
@@ -103,6 +115,9 @@ export class ConsentComponent implements OnInit {
|
|
|
103
115
|
}
|
|
104
116
|
} catch (e) {
|
|
105
117
|
console.error(e);
|
|
118
|
+
this.analytics.trackInteraction('onboarding', 'consent_submit_result', {
|
|
119
|
+
outcome: 'error',
|
|
120
|
+
});
|
|
106
121
|
this.snackBar.open('Failed to update consent status', '', { duration: 3000 });
|
|
107
122
|
}
|
|
108
123
|
}
|
package/src/ng-add/files/src/app/first-time/early-access/early-access.component.spec.ts.template
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
+
import { DATA_FEEDBACK, dataTimestampFromDate, isDataTimestamp } from '@tech4good/platform-data';
|
|
1
2
|
import { render, screen, waitFor } from '@testing-library/angular';
|
|
2
3
|
import userEvent from '@testing-library/user-event';
|
|
3
4
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
4
5
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
5
6
|
import { Provider } from '@angular/core';
|
|
6
|
-
import { Timestamp } from '@angular/fire/firestore';
|
|
7
7
|
import { of } from 'rxjs';
|
|
8
8
|
|
|
9
9
|
import { EarlyAccessComponent } from './early-access.component';
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
|
|
10
|
+
|
|
11
|
+
import { BATCH_WRITE_SERVICE } from '@tech4good/platform-data';
|
|
12
|
+
import { BatchWriteMockService } from '@tech4good/platform-data/testing';
|
|
14
13
|
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
15
14
|
import { AuthLoggedInMockDB } from 'src/app/core/store/auth/auth.mock';
|
|
16
15
|
import { UserStore } from 'src/app/core/store/user/user.store';
|
|
17
16
|
import { UserContextStore } from 'src/app/core/store/user-context/user-context.store';
|
|
18
|
-
import { AccessState } from 'src/app/core/store/user/user.model';
|
|
19
|
-
import {
|
|
17
|
+
import { AccessState, User } from 'src/app/core/store/user/user.model';
|
|
18
|
+
import { provideAppMocks } from 'src/app/core/testing/app-mocks';
|
|
20
19
|
import { USER_DB } from 'src/app/core/store/user/user.mock';
|
|
20
|
+
import { TimeAnalyticsService } from 'src/app/core/analytics/time-analytics.service';
|
|
21
21
|
|
|
22
22
|
/** Sets up the testing environment for EarlyAccessComponent using render. */
|
|
23
|
-
async function setup(providers: Provider[] = [], seededUsers:
|
|
23
|
+
async function setup(providers: Provider[] = [], seededUsers: User[] = USER_DB) {
|
|
24
24
|
const user = userEvent.setup();
|
|
25
25
|
const snackBarMock = {
|
|
26
26
|
open: jest.fn().mockReturnValue({
|
|
@@ -37,14 +37,14 @@ async function setup(providers: Provider[] = [], seededUsers: any[] = []) {
|
|
|
37
37
|
|
|
38
38
|
const view = await render(EarlyAccessComponent, {
|
|
39
39
|
providers: [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}),
|
|
40
|
+
{ provide: DATA_FEEDBACK, useExisting: MatSnackBar },
|
|
41
|
+
...provideAppMocks({ collections: { users: seededUsers } }),
|
|
43
42
|
{ provide: MatSnackBar, useValue: snackBarMock },
|
|
44
43
|
{ provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
|
|
45
44
|
{ provide: Router, useValue: routerMock },
|
|
46
45
|
{ provide: ActivatedRoute, useValue: activatedRouteMock },
|
|
47
46
|
{ provide: AuthStore, useClass: AuthLoggedInMockDB },
|
|
47
|
+
{ provide: TimeAnalyticsService, useValue: { trackInteraction: jest.fn() } },
|
|
48
48
|
UserStore,
|
|
49
49
|
UserContextStore,
|
|
50
50
|
...providers,
|
|
@@ -123,7 +123,7 @@ describe('EarlyAccessComponent', () => {
|
|
|
123
123
|
// Verify batchWrite called
|
|
124
124
|
expect(writeSpy).toHaveBeenCalled();
|
|
125
125
|
|
|
126
|
-
// Verify
|
|
126
|
+
// Verify the write uses the shared timestamp value.
|
|
127
127
|
const batchFn = writeSpy.mock.calls[0][0] as any;
|
|
128
128
|
const dummyBatch = {
|
|
129
129
|
update: jest.fn(),
|
|
@@ -141,7 +141,7 @@ describe('EarlyAccessComponent', () => {
|
|
|
141
141
|
const updateCall = dummyBatch.update.mock.calls.find((call) => call[0].path.startsWith('users/'));
|
|
142
142
|
expect(updateCall).toBeDefined();
|
|
143
143
|
const changes = updateCall[1];
|
|
144
|
-
expect(changes.joinedWaitlistAt).
|
|
144
|
+
expect(isDataTimestamp(changes.joinedWaitlistAt)).toBe(true);
|
|
145
145
|
expect(changes.accessState).toBe(AccessState.CONSENT);
|
|
146
146
|
|
|
147
147
|
// Verify success notification shown with Undo action
|
|
@@ -155,8 +155,8 @@ describe('EarlyAccessComponent', () => {
|
|
|
155
155
|
|
|
156
156
|
it('should render waitlist card and display correct position when accessState is WAITING', async () => {
|
|
157
157
|
// Seed database with two waitlisted users to verify position calculation
|
|
158
|
-
const time1 =
|
|
159
|
-
const time2 =
|
|
158
|
+
const time1 = dataTimestampFromDate(new Date('2026-05-10T12:00:00Z'));
|
|
159
|
+
const time2 = dataTimestampFromDate(new Date('2026-05-15T12:00:00Z'));
|
|
160
160
|
|
|
161
161
|
// Mutate the auth store user to WAITING (joined at time2)
|
|
162
162
|
USER_DB[0].accessState = AccessState.WAITING;
|
|
@@ -23,8 +23,7 @@ import { WaitlistData, SurveyData } from './early-access.model';
|
|
|
23
23
|
import { User, AccessState } from 'src/app/core/store/user/user.model';
|
|
24
24
|
import { handleAccess } from './early-access.guard';
|
|
25
25
|
import { UserContext } from 'src/app/core/store/user-context/user-context.model';
|
|
26
|
-
import {
|
|
27
|
-
import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
26
|
+
import { BatchWriteService, BATCH_WRITE_SERVICE, dataTimestampNow } from '@tech4good/platform-data';
|
|
28
27
|
import { NavbarComponent } from 'src/app/shared/navbar/navbar.component';
|
|
29
28
|
import { SurveyFormComponent } from './survey-form/survey-form.component';
|
|
30
29
|
import { WaitlistViewComponent } from './waitlist-view/waitlist-view.component';
|
|
@@ -33,6 +32,7 @@ import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
|
33
32
|
import { UserStore } from 'src/app/core/store/user/user.store';
|
|
34
33
|
import { UserContextStore } from 'src/app/core/store/user-context/user-context.store';
|
|
35
34
|
import { environment } from 'src/environments/environment';
|
|
35
|
+
import { TimeAnalyticsService } from 'src/app/core/analytics/time-analytics.service';
|
|
36
36
|
|
|
37
37
|
@Component({
|
|
38
38
|
selector: 'app-early-access',
|
|
@@ -45,6 +45,7 @@ export class EarlyAccessComponent implements OnInit {
|
|
|
45
45
|
readonly authStore = inject(AuthStore);
|
|
46
46
|
readonly userStore = inject(UserStore);
|
|
47
47
|
readonly userContextStore = inject(UserContextStore);
|
|
48
|
+
private readonly analytics = inject(TimeAnalyticsService);
|
|
48
49
|
|
|
49
50
|
// --------------- INPUTS AND OUTPUTS ------------------
|
|
50
51
|
|
|
@@ -137,6 +138,7 @@ export class EarlyAccessComponent implements OnInit {
|
|
|
137
138
|
const waitlistData = this.waitlistData();
|
|
138
139
|
if (!waitlistData) return;
|
|
139
140
|
|
|
141
|
+
this.analytics.trackInteraction('onboarding', 'interest_submit_attempt');
|
|
140
142
|
try {
|
|
141
143
|
const hasWaitlist = environment.hasWaitlist;
|
|
142
144
|
const targetState = hasWaitlist ? AccessState.WAITING : AccessState.CONSENT;
|
|
@@ -147,7 +149,7 @@ export class EarlyAccessComponent implements OnInit {
|
|
|
147
149
|
waitlistData.currentUser.__id,
|
|
148
150
|
{
|
|
149
151
|
accessState: targetState,
|
|
150
|
-
joinedWaitlistAt:
|
|
152
|
+
joinedWaitlistAt: dataTimestampNow(),
|
|
151
153
|
},
|
|
152
154
|
{ batchConfig },
|
|
153
155
|
);
|
|
@@ -182,12 +184,18 @@ export class EarlyAccessComponent implements OnInit {
|
|
|
182
184
|
},
|
|
183
185
|
},
|
|
184
186
|
);
|
|
187
|
+
this.analytics.trackInteraction('onboarding', 'interest_submit_result', {
|
|
188
|
+
outcome: 'success',
|
|
189
|
+
});
|
|
185
190
|
|
|
186
191
|
if (!hasWaitlist) {
|
|
187
192
|
await this.router.navigate(['/consent'], { queryParams: this.route.snapshot.queryParams });
|
|
188
193
|
}
|
|
189
194
|
} catch (e) {
|
|
190
195
|
console.error(e);
|
|
196
|
+
this.analytics.trackInteraction('onboarding', 'interest_submit_result', {
|
|
197
|
+
outcome: 'error',
|
|
198
|
+
});
|
|
191
199
|
}
|
|
192
200
|
}
|
|
193
201
|
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
Submitting...
|
|
37
37
|
} @else {
|
|
38
38
|
Submit and Continue
|
|
39
|
-
|
|
39
|
+
<!-- Decorative arrow from the bundled Material Icons font (no remote image host) -->
|
|
40
|
+
<mat-icon aria-hidden="true">arrow_forward</mat-icon>
|
|
40
41
|
}
|
|
41
42
|
</button>
|
|
42
43
|
</form>
|
|
@@ -66,7 +66,11 @@
|
|
|
66
66
|
padding: 10px 22px 10px;
|
|
67
67
|
transition: color 0.8s ease, border 0.8s ease;
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
// Arrow icon: sized to match the button text and nudged right on hover
|
|
70
|
+
>mat-icon {
|
|
71
|
+
font-size: 20px;
|
|
72
|
+
width: 20px;
|
|
73
|
+
height: 20px;
|
|
70
74
|
margin: 0 3px 0 2px;
|
|
71
75
|
transition: margin 0.2s ease;
|
|
72
76
|
}
|
|
@@ -79,12 +83,12 @@
|
|
|
79
83
|
}
|
|
80
84
|
|
|
81
85
|
&:hover {
|
|
82
|
-
>
|
|
86
|
+
>mat-icon {
|
|
83
87
|
margin: 0 0 0 5px;
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
&[disabled] {
|
|
87
|
-
>
|
|
91
|
+
>mat-icon {
|
|
88
92
|
margin: 0 3px 0 2px;
|
|
89
93
|
}
|
|
90
94
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { render } from '@testing-library/angular';
|
|
1
|
+
import { render, screen } from '@testing-library/angular';
|
|
2
2
|
import userEvent from '@testing-library/user-event';
|
|
3
3
|
|
|
4
4
|
import { SurveyFormComponent } from './survey-form.component';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
5
|
+
import { provideAppMocks } from 'src/app/core/testing/app-mocks';
|
|
6
|
+
import { BatchWriteMockService } from '@tech4good/platform-data/testing';
|
|
7
|
+
import { BATCH_WRITE_SERVICE } from '@tech4good/platform-data';
|
|
9
8
|
|
|
10
9
|
/** Sets up the testing environment for SurveyFormComponent using render. */
|
|
11
10
|
async function setup() {
|
|
@@ -15,7 +14,7 @@ async function setup() {
|
|
|
15
14
|
const view = await render(SurveyFormComponent, {
|
|
16
15
|
imports: [],
|
|
17
16
|
providers: [
|
|
18
|
-
|
|
17
|
+
...provideAppMocks(),
|
|
19
18
|
{ provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
|
|
20
19
|
],
|
|
21
20
|
componentInputs: { loading: false },
|
|
@@ -34,4 +33,19 @@ describe('SurveyFormComponent', () => {
|
|
|
34
33
|
const { fixture } = await setup();
|
|
35
34
|
expect(fixture.componentInstance).toBeTruthy();
|
|
36
35
|
});
|
|
36
|
+
|
|
37
|
+
it('renders the submit arrow as a bundled Material icon rather than a remote image', async () => {
|
|
38
|
+
await setup();
|
|
39
|
+
|
|
40
|
+
// The arrow is decorative, so the button's accessible name is just its label
|
|
41
|
+
const submitButton = screen.getByRole('button', { name: 'Submit and Continue' });
|
|
42
|
+
|
|
43
|
+
// Remote icon images (like the former third-party arrow SVG) break when their host goes away.
|
|
44
|
+
expect(submitButton.querySelector('img')).toBeNull();
|
|
45
|
+
|
|
46
|
+
const icon = submitButton.querySelector('mat-icon');
|
|
47
|
+
expect(icon).not.toBeNull();
|
|
48
|
+
expect(icon).toHaveTextContent('arrow_forward');
|
|
49
|
+
expect(icon).toHaveAttribute('aria-hidden', 'true');
|
|
50
|
+
});
|
|
37
51
|
});
|
|
@@ -3,6 +3,7 @@ import { form, required, minLength, FormField, FormRoot } from '@angular/forms/s
|
|
|
3
3
|
import { MatFormField, MatLabel, MatHint } from '@angular/material/form-field';
|
|
4
4
|
import { MatInput } from '@angular/material/input';
|
|
5
5
|
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
|
|
6
|
+
import { MatIcon } from '@angular/material/icon';
|
|
6
7
|
import { HintVisibilityDirective } from 'src/app/shared/hint-visibility/hint-visibility.directive';
|
|
7
8
|
import { SurveyData } from '../early-access.model';
|
|
8
9
|
|
|
@@ -19,6 +20,7 @@ import { SurveyData } from '../early-access.model';
|
|
|
19
20
|
MatInput,
|
|
20
21
|
MatHint,
|
|
21
22
|
CdkTextareaAutosize,
|
|
23
|
+
MatIcon,
|
|
22
24
|
HintVisibilityDirective,
|
|
23
25
|
],
|
|
24
26
|
})
|
|
@@ -3,10 +3,9 @@ import userEvent from '@testing-library/user-event';
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
import { WaitlistViewComponent } from './waitlist-view.component';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
6
|
+
import { provideAppMocks } from 'src/app/core/testing/app-mocks';
|
|
7
|
+
import { BatchWriteMockService } from '@tech4good/platform-data/testing';
|
|
8
|
+
import { BATCH_WRITE_SERVICE } from '@tech4good/platform-data';
|
|
10
9
|
|
|
11
10
|
/** Sets up the testing environment for WaitlistViewComponent using render. */
|
|
12
11
|
async function setup() {
|
|
@@ -16,7 +15,7 @@ async function setup() {
|
|
|
16
15
|
const view = await render(WaitlistViewComponent, {
|
|
17
16
|
imports: [],
|
|
18
17
|
providers: [
|
|
19
|
-
|
|
18
|
+
...provideAppMocks(),
|
|
20
19
|
{ provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
|
|
21
20
|
],
|
|
22
21
|
componentInputs: {
|
package/src/ng-add/files/src/app/first-time/email-link/email-link.component.spec.ts.template
CHANGED
|
@@ -2,12 +2,16 @@ import { Router } from '@angular/router';
|
|
|
2
2
|
import { render, screen, waitFor } from '@testing-library/angular';
|
|
3
3
|
import { EmailLinkComponent } from './email-link.component';
|
|
4
4
|
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
5
|
+
import { TimeAnalyticsService } from 'src/app/core/analytics/time-analytics.service';
|
|
6
|
+
import { AccessState } from 'src/app/core/store/user/user.model';
|
|
7
|
+
import { createMockUser } from 'src/app/core/store/user/user.mock';
|
|
5
8
|
|
|
6
9
|
describe('EmailLinkComponent', () => {
|
|
7
10
|
it('completes automatically when the request email is stored in this browser', async () => {
|
|
8
11
|
const completeEmailSignInLink = jest.fn().mockResolvedValue({});
|
|
9
12
|
const getStoredEmailForEmailLink = jest.fn().mockReturnValue('learner@example.com');
|
|
10
13
|
const router = { navigate: jest.fn().mockResolvedValue(true) };
|
|
14
|
+
const trackInteraction = jest.fn();
|
|
11
15
|
await render(EmailLinkComponent, {
|
|
12
16
|
providers: [
|
|
13
17
|
{
|
|
@@ -15,23 +19,35 @@ describe('EmailLinkComponent', () => {
|
|
|
15
19
|
useValue: {
|
|
16
20
|
getStoredEmailForEmailLink,
|
|
17
21
|
completeEmailSignInLink,
|
|
22
|
+
user: () => createMockUser({ __id: 'user-123', accessState: AccessState.DONE }),
|
|
18
23
|
},
|
|
19
24
|
},
|
|
20
25
|
{ provide: Router, useValue: router },
|
|
26
|
+
{ provide: TimeAnalyticsService, useValue: { trackInteraction } },
|
|
21
27
|
],
|
|
22
28
|
});
|
|
23
29
|
|
|
24
30
|
await waitFor(() => expect(completeEmailSignInLink).toHaveBeenCalledWith(window.location.href, 'learner@example.com'));
|
|
25
31
|
expect(getStoredEmailForEmailLink).toHaveBeenCalledTimes(1);
|
|
26
32
|
expect(router.navigate).toHaveBeenCalledWith(['/home']);
|
|
33
|
+
expect(trackInteraction).toHaveBeenCalledWith('onboarding', 'auth_result', {
|
|
34
|
+
method: 'email_link_complete',
|
|
35
|
+
outcome: 'success',
|
|
36
|
+
authenticatedUserId: 'user-123',
|
|
37
|
+
accessState: AccessState.DONE,
|
|
38
|
+
});
|
|
27
39
|
expect(screen.queryByLabelText('Email')).not.toBeInTheDocument();
|
|
28
40
|
});
|
|
29
41
|
|
|
30
42
|
it('asks for the email when the link is opened without same-browser state', async () => {
|
|
31
43
|
await render(EmailLinkComponent, {
|
|
32
44
|
providers: [
|
|
33
|
-
{
|
|
45
|
+
{
|
|
46
|
+
provide: AuthStore,
|
|
47
|
+
useValue: { getStoredEmailForEmailLink: () => null, user: () => null },
|
|
48
|
+
},
|
|
34
49
|
{ provide: Router, useValue: { navigate: jest.fn() } },
|
|
50
|
+
{ provide: TimeAnalyticsService, useValue: { trackInteraction: jest.fn() } },
|
|
35
51
|
],
|
|
36
52
|
});
|
|
37
53
|
|