@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
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.chart-card {
|
|
2
|
+
border: 1px solid #e0e4de;
|
|
3
|
+
border-radius: 16px;
|
|
4
|
+
background: rgba(255, 255, 255, 0.86);
|
|
5
|
+
box-shadow: 0 8px 26px rgba(38, 53, 45, 0.035);
|
|
6
|
+
min-width: 0;
|
|
7
|
+
padding: 22px 22px 15px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.card-heading {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: flex-start;
|
|
13
|
+
justify-content: space-between;
|
|
14
|
+
gap: 16px;
|
|
15
|
+
min-height: 57px;
|
|
16
|
+
margin-bottom: 10px;
|
|
17
|
+
|
|
18
|
+
h2 {
|
|
19
|
+
margin: 0;
|
|
20
|
+
color: #28382f;
|
|
21
|
+
font-size: 14px;
|
|
22
|
+
font-weight: 750;
|
|
23
|
+
letter-spacing: -0.01em;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
p {
|
|
27
|
+
max-width: 620px;
|
|
28
|
+
margin: 5px 0 0;
|
|
29
|
+
color: #89928c;
|
|
30
|
+
font-size: 10.5px;
|
|
31
|
+
line-height: 1.5;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
|
2
|
+
import { VisualizationSpec } from 'vega-embed';
|
|
3
|
+
import { VegaChartComponent } from '../../vega-chart/vega-chart.component';
|
|
4
|
+
import { baseSpec, palette } from '../chart-theme';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'analytics-route-distribution-chart',
|
|
8
|
+
imports: [VegaChartComponent],
|
|
9
|
+
templateUrl: './route-distribution-chart.component.html',
|
|
10
|
+
styleUrl: './route-distribution-chart.component.scss',
|
|
11
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12
|
+
})
|
|
13
|
+
export class RouteDistributionChartComponent {
|
|
14
|
+
readonly rows = input.required<Record<string, unknown>[]>();
|
|
15
|
+
|
|
16
|
+
readonly spec = computed(() => {
|
|
17
|
+
const routeRows = this.rows();
|
|
18
|
+
return {
|
|
19
|
+
...baseSpec(),
|
|
20
|
+
height: Math.max(240, Math.min(routeRows.length, 14) * 28),
|
|
21
|
+
data: { values: routeRows.slice(0, 14) },
|
|
22
|
+
encoding: {
|
|
23
|
+
y: {
|
|
24
|
+
field: 'route',
|
|
25
|
+
type: 'nominal',
|
|
26
|
+
sort: { field: 'median_active_seconds', order: 'descending' },
|
|
27
|
+
axis: { title: null, labelLimit: 210 },
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
layer: [
|
|
31
|
+
{
|
|
32
|
+
mark: {
|
|
33
|
+
type: 'rule',
|
|
34
|
+
strokeWidth: 7,
|
|
35
|
+
strokeCap: 'round',
|
|
36
|
+
color: palette.mint,
|
|
37
|
+
},
|
|
38
|
+
encoding: {
|
|
39
|
+
x: {
|
|
40
|
+
field: 'q1_active_seconds',
|
|
41
|
+
type: 'quantitative',
|
|
42
|
+
axis: { title: 'Active seconds' },
|
|
43
|
+
},
|
|
44
|
+
x2: { field: 'q3_active_seconds' },
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
mark: {
|
|
49
|
+
type: 'tick',
|
|
50
|
+
thickness: 3,
|
|
51
|
+
size: 18,
|
|
52
|
+
color: palette.forest,
|
|
53
|
+
},
|
|
54
|
+
encoding: {
|
|
55
|
+
x: { field: 'median_active_seconds', type: 'quantitative' },
|
|
56
|
+
tooltip: [
|
|
57
|
+
{ field: 'route', type: 'nominal', title: 'Route' },
|
|
58
|
+
{
|
|
59
|
+
field: 'q1_active_seconds',
|
|
60
|
+
type: 'quantitative',
|
|
61
|
+
title: '25th percentile',
|
|
62
|
+
format: '.1f',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
field: 'median_active_seconds',
|
|
66
|
+
type: 'quantitative',
|
|
67
|
+
title: 'Median',
|
|
68
|
+
format: '.1f',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
field: 'q3_active_seconds',
|
|
72
|
+
type: 'quantitative',
|
|
73
|
+
title: '75th percentile',
|
|
74
|
+
format: '.1f',
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
} as VisualizationSpec;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<article class="chart-card">
|
|
2
|
+
<div class="card-heading">
|
|
3
|
+
<div>
|
|
4
|
+
<h2>Traffic and typical attention</h2>
|
|
5
|
+
<p>Bars are recorded visits with positive active time; dots are median active time. Select a route to link the statistics below.</p>
|
|
6
|
+
</div>
|
|
7
|
+
<span class="interactive-badge">Interactive</span>
|
|
8
|
+
</div>
|
|
9
|
+
<analytics-vega-chart
|
|
10
|
+
[spec]="spec()"
|
|
11
|
+
ariaLabel="Layered chart of visits and median active time by normalized route"
|
|
12
|
+
[signalNames]="['route_pick']"
|
|
13
|
+
(selectionChange)="selectionChange.emit($event)"
|
|
14
|
+
/>
|
|
15
|
+
</article>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.chart-card {
|
|
2
|
+
border: 1px solid #e0e4de;
|
|
3
|
+
border-radius: 16px;
|
|
4
|
+
background: rgba(255, 255, 255, 0.86);
|
|
5
|
+
box-shadow: 0 8px 26px rgba(38, 53, 45, 0.035);
|
|
6
|
+
min-width: 0;
|
|
7
|
+
padding: 22px 22px 15px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.card-heading {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: flex-start;
|
|
13
|
+
justify-content: space-between;
|
|
14
|
+
gap: 16px;
|
|
15
|
+
min-height: 57px;
|
|
16
|
+
margin-bottom: 10px;
|
|
17
|
+
|
|
18
|
+
h2 {
|
|
19
|
+
margin: 0;
|
|
20
|
+
color: #28382f;
|
|
21
|
+
font-size: 14px;
|
|
22
|
+
font-weight: 750;
|
|
23
|
+
letter-spacing: -0.01em;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
p {
|
|
27
|
+
max-width: 620px;
|
|
28
|
+
margin: 5px 0 0;
|
|
29
|
+
color: #89928c;
|
|
30
|
+
font-size: 10.5px;
|
|
31
|
+
line-height: 1.5;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.interactive-badge {
|
|
36
|
+
flex: 0 0 auto;
|
|
37
|
+
border-radius: 999px;
|
|
38
|
+
background: #edf3ee;
|
|
39
|
+
padding: 5px 9px;
|
|
40
|
+
color: #47715a;
|
|
41
|
+
font-size: 9px;
|
|
42
|
+
font-weight: 750;
|
|
43
|
+
letter-spacing: 0.06em;
|
|
44
|
+
text-transform: uppercase;
|
|
45
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core';
|
|
2
|
+
import { VisualizationSpec } from 'vega-embed';
|
|
3
|
+
import { VegaChartComponent } from '../../vega-chart/vega-chart.component';
|
|
4
|
+
import { baseSpec, palette } from '../chart-theme';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'analytics-route-traffic-chart',
|
|
8
|
+
imports: [VegaChartComponent],
|
|
9
|
+
templateUrl: './route-traffic-chart.component.html',
|
|
10
|
+
styleUrl: './route-traffic-chart.component.scss',
|
|
11
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12
|
+
})
|
|
13
|
+
export class RouteTrafficChartComponent {
|
|
14
|
+
readonly rows = input.required<Record<string, unknown>[]>();
|
|
15
|
+
readonly selectionChange = output<{name: string, value: unknown}>();
|
|
16
|
+
|
|
17
|
+
readonly spec = computed(() => {
|
|
18
|
+
const data = this.rows();
|
|
19
|
+
return {
|
|
20
|
+
...baseSpec(),
|
|
21
|
+
height: Math.max(230, Math.min(data.length, 14) * 28),
|
|
22
|
+
data: { values: data.slice(0, 14) },
|
|
23
|
+
encoding: {
|
|
24
|
+
y: {
|
|
25
|
+
field: 'route', type: 'nominal',
|
|
26
|
+
sort: { field: 'total_visits', order: 'descending' },
|
|
27
|
+
axis: { title: null, labelLimit: 280, labelPadding: 8 },
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
layer: [
|
|
31
|
+
{
|
|
32
|
+
params: [{ name: 'route_pick', select: { type: 'point', fields: ['route'], on: 'click', clear: 'dblclick' } }],
|
|
33
|
+
mark: { type: 'bar', cornerRadiusEnd: 4, color: palette.mint },
|
|
34
|
+
encoding: {
|
|
35
|
+
x: { field: 'total_visits', type: 'quantitative', axis: { title: 'Visits', tickMinStep: 1 } },
|
|
36
|
+
opacity: { condition: { param: 'route_pick', value: 1, empty: true }, value: 0.32 },
|
|
37
|
+
tooltip: [
|
|
38
|
+
{ field: 'route', type: 'nominal', title: 'Route' },
|
|
39
|
+
{ field: 'total_visits', type: 'quantitative', title: 'Visits', format: ',' },
|
|
40
|
+
{ field: 'median_active_seconds', type: 'quantitative', title: 'Median active time', format: '.1f' },
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
mark: { type: 'point', filled: true, size: 70, color: palette.clay, stroke: 'white', strokeWidth: 1.5 },
|
|
46
|
+
encoding: {
|
|
47
|
+
x: { field: 'median_active_seconds', type: 'quantitative', axis: { title: 'Median active seconds', orient: 'top', titleColor: palette.clay, labelColor: palette.clay } },
|
|
48
|
+
opacity: { condition: { param: 'route_pick', value: 1, empty: true }, value: 0.32 },
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
resolve: { scale: { x: 'independent' } },
|
|
53
|
+
} as VisualizationSpec;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@if (loading()) {
|
|
2
|
+
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
|
|
3
|
+
}
|
|
4
|
+
@if (error()) {
|
|
5
|
+
<aside class="message-card error-card">
|
|
6
|
+
<span>Data service</span>
|
|
7
|
+
<strong>{{ error() }}</strong>
|
|
8
|
+
<p>Check that the local analytics service is running, then reload this page.</p>
|
|
9
|
+
</aside>
|
|
10
|
+
} @else if (!loading() && !available()) {
|
|
11
|
+
<aside class="message-card setup-card">
|
|
12
|
+
<span>First snapshot</span>
|
|
13
|
+
<strong>No computed analytics have been loaded yet.</strong>
|
|
14
|
+
<p>Authenticate with Google Cloud and run the refresh. A private identifier salt will be generated locally and reused automatically.</p>
|
|
15
|
+
<code class="command">npm run analytics:refresh</code>
|
|
16
|
+
<p class="setup-note">The previous successful snapshot is always retained if a refresh fails.</p>
|
|
17
|
+
</aside>
|
|
18
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
mat-progress-bar {
|
|
2
|
+
margin: -10px 0 26px;
|
|
3
|
+
border-radius: 20px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.message-card {
|
|
7
|
+
max-width: 700px;
|
|
8
|
+
margin: 72px auto;
|
|
9
|
+
border: 1px solid #dce2da;
|
|
10
|
+
border-radius: 18px;
|
|
11
|
+
background: #ffffff;
|
|
12
|
+
padding: 36px;
|
|
13
|
+
box-shadow: 0 18px 52px rgba(37, 55, 45, 0.08);
|
|
14
|
+
|
|
15
|
+
> span {
|
|
16
|
+
color: #65806f;
|
|
17
|
+
font-size: 10px;
|
|
18
|
+
font-weight: 800;
|
|
19
|
+
letter-spacing: 0.13em;
|
|
20
|
+
text-transform: uppercase;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
> strong {
|
|
24
|
+
display: block;
|
|
25
|
+
margin-top: 11px;
|
|
26
|
+
color: #24372c;
|
|
27
|
+
font-family: Georgia, 'Times New Roman', serif;
|
|
28
|
+
font-size: 25px;
|
|
29
|
+
font-weight: 500;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
p { color: #68746c; line-height: 1.6; }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.command {
|
|
36
|
+
display: block;
|
|
37
|
+
border-radius: 10px;
|
|
38
|
+
background: #1f2e26;
|
|
39
|
+
padding: 14px 17px;
|
|
40
|
+
color: #dfeae2;
|
|
41
|
+
font-size: 13px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.setup-note { margin-bottom: 0; font-size: 12px; }
|
|
45
|
+
.error-card { border-color: #e7cfc6; }
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
|
2
|
+
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'analytics-status-message',
|
|
6
|
+
imports: [MatProgressBarModule],
|
|
7
|
+
templateUrl: './status-message.component.html',
|
|
8
|
+
styleUrl: './status-message.component.scss',
|
|
9
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
10
|
+
})
|
|
11
|
+
export class StatusMessageComponent {
|
|
12
|
+
readonly loading = input(false);
|
|
13
|
+
readonly error = input<string | null>(null);
|
|
14
|
+
readonly available = input(true);
|
|
15
|
+
}
|
package/src/ng-add/files/projects/analytics/src/app/vega-chart/vega-chart.component.ts.template
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps the vega-embed library to render declarative Vega-Lite
|
|
3
|
+
* visualization specifications inside Angular template DOM containers.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
ChangeDetectionStrategy,
|
|
8
|
+
Component,
|
|
9
|
+
DestroyRef,
|
|
10
|
+
ElementRef,
|
|
11
|
+
effect,
|
|
12
|
+
inject,
|
|
13
|
+
input,
|
|
14
|
+
output,
|
|
15
|
+
viewChild,
|
|
16
|
+
} from '@angular/core';
|
|
17
|
+
import vegaEmbed, { Result, VisualizationSpec } from 'vega-embed';
|
|
18
|
+
|
|
19
|
+
/** Selection event emitted when a user clicks an element in a Vega chart */
|
|
20
|
+
export interface ChartSelection {
|
|
21
|
+
name: string;
|
|
22
|
+
value: unknown;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@Component({
|
|
26
|
+
selector: 'analytics-vega-chart',
|
|
27
|
+
template: '<div #host class="chart-host" [attr.aria-label]="ariaLabel()"></div>',
|
|
28
|
+
styles: [`
|
|
29
|
+
:host, .chart-host {
|
|
30
|
+
display: block;
|
|
31
|
+
width: 100%;
|
|
32
|
+
min-height: 280px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.chart-host {
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
}
|
|
38
|
+
`],
|
|
39
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
40
|
+
})
|
|
41
|
+
export class VegaChartComponent {
|
|
42
|
+
/** Declarative Vega-Lite visualization specification object */
|
|
43
|
+
readonly spec = input.required<VisualizationSpec>();
|
|
44
|
+
/** Accessible aria-label description */
|
|
45
|
+
readonly ariaLabel = input('Analytics chart');
|
|
46
|
+
/** Array of Vega signal names to listen for user selection events */
|
|
47
|
+
readonly signalNames = input<string[]>([]);
|
|
48
|
+
/** Output event emitted when a Vega signal updates */
|
|
49
|
+
readonly selectionChange = output<ChartSelection>();
|
|
50
|
+
|
|
51
|
+
private readonly host = viewChild.required<ElementRef<HTMLDivElement>>('host');
|
|
52
|
+
private readonly destroyRef = inject(DestroyRef);
|
|
53
|
+
|
|
54
|
+
private result?: Result;
|
|
55
|
+
private resizeObserver?: ResizeObserver;
|
|
56
|
+
private renderVersion = 0;
|
|
57
|
+
|
|
58
|
+
constructor() {
|
|
59
|
+
// Re-render chart whenever spec input changes
|
|
60
|
+
effect(() => {
|
|
61
|
+
const spec = this.spec();
|
|
62
|
+
const hostEl = this.host().nativeElement;
|
|
63
|
+
void this.render(spec, hostEl);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Clean up DOM observers and finalize Vega view on destroy
|
|
67
|
+
this.destroyRef.onDestroy(() => {
|
|
68
|
+
this.resizeObserver?.disconnect();
|
|
69
|
+
this.result?.view.finalize();
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Renders the Vega-Lite specification inside the host element */
|
|
74
|
+
private async render(spec: VisualizationSpec, hostEl: HTMLDivElement): Promise<void> {
|
|
75
|
+
const version = ++this.renderVersion;
|
|
76
|
+
|
|
77
|
+
// Clean up previous render
|
|
78
|
+
this.resizeObserver?.disconnect();
|
|
79
|
+
this.result?.view.finalize();
|
|
80
|
+
hostEl.replaceChildren();
|
|
81
|
+
hostEl.removeAttribute('data-render-error');
|
|
82
|
+
hostEl.removeAttribute('role');
|
|
83
|
+
|
|
84
|
+
try {
|
|
85
|
+
const result = await vegaEmbed(hostEl, spec, {
|
|
86
|
+
actions: false,
|
|
87
|
+
renderer: 'svg',
|
|
88
|
+
});
|
|
89
|
+
if (version !== this.renderVersion) {
|
|
90
|
+
result.view.finalize();
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
this.result = result;
|
|
94
|
+
await result.view.runAsync();
|
|
95
|
+
|
|
96
|
+
// Attach ResizeObserver to keep chart dimensions responsive
|
|
97
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
98
|
+
void this.result?.view.resize().runAsync();
|
|
99
|
+
});
|
|
100
|
+
this.resizeObserver.observe(hostEl);
|
|
101
|
+
|
|
102
|
+
// Attach signal listeners for interactive filtering
|
|
103
|
+
for (const signalName of this.signalNames()) {
|
|
104
|
+
try {
|
|
105
|
+
result.view.addSignalListener(signalName, (_name, value) => {
|
|
106
|
+
this.selectionChange.emit({ name: signalName, value });
|
|
107
|
+
});
|
|
108
|
+
} catch {
|
|
109
|
+
// A chart specification may omit a signal if rendering empty data
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
} catch (error) {
|
|
113
|
+
if (version !== this.renderVersion) return;
|
|
114
|
+
hostEl.textContent = 'This chart could not be rendered.';
|
|
115
|
+
hostEl.setAttribute('role', 'alert');
|
|
116
|
+
hostEl.setAttribute('data-render-error', 'true');
|
|
117
|
+
console.error('Unable to render analytics chart.', error);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title><%= classify(project) %> Analytics</title>
|
|
6
|
+
<meta
|
|
7
|
+
name="description"
|
|
8
|
+
content="A private local workbench for <%= classify(project) %> product and research analytics."
|
|
9
|
+
>
|
|
10
|
+
<base href="/">
|
|
11
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
12
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
13
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
14
|
+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
<analytics-root></analytics-root>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { bootstrapApplication } from '@angular/platform-browser';
|
|
2
|
+
import { provideBrowserGlobalErrorListeners, provideZonelessChangeDetection } from '@angular/core';
|
|
3
|
+
import { provideHttpClient } from '@angular/common/http';
|
|
4
|
+
import { provideRouter } from '@angular/router';
|
|
5
|
+
import { AppComponent } from './app/app.component';
|
|
6
|
+
import { routes } from './app/app.routes';
|
|
7
|
+
|
|
8
|
+
bootstrapApplication(AppComponent, {
|
|
9
|
+
providers: [
|
|
10
|
+
provideBrowserGlobalErrorListeners(),
|
|
11
|
+
provideZonelessChangeDetection(),
|
|
12
|
+
provideHttpClient(),
|
|
13
|
+
provideRouter(routes),
|
|
14
|
+
],
|
|
15
|
+
}).catch((error) => console.error(error));
|
|
16
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
* {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
html,
|
|
6
|
+
body {
|
|
7
|
+
min-height: 100%;
|
|
8
|
+
margin: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
body {
|
|
12
|
+
background: #f4f5f1;
|
|
13
|
+
color: #253129;
|
|
14
|
+
font-family:
|
|
15
|
+
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
|
|
16
|
+
sans-serif;
|
|
17
|
+
-webkit-font-smoothing: antialiased;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
button,
|
|
21
|
+
input {
|
|
22
|
+
font: inherit;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
::selection {
|
|
26
|
+
background: #d8e6dc;
|
|
27
|
+
color: #163c28;
|
|
28
|
+
}
|
|
@@ -5,10 +5,9 @@ import { MatSnackBar } from '@angular/material/snack-bar';
|
|
|
5
5
|
import { Provider } from '@angular/core';
|
|
6
6
|
|
|
7
7
|
import { AdminPanelComponent } from './admin-panel.component';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
|
|
8
|
+
import { provideAppMocks } from 'src/app/core/testing/app-mocks';
|
|
9
|
+
import { BATCH_WRITE_SERVICE } from '@tech4good/platform-data';
|
|
10
|
+
import { BatchWriteMockService } from '@tech4good/platform-data/testing';
|
|
12
11
|
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
13
12
|
import { AuthLoggedInMockDB } from 'src/app/core/store/auth/auth.mock';
|
|
14
13
|
import { UserStore } from 'src/app/core/store/user/user.store';
|
|
@@ -32,7 +31,7 @@ async function setup(providers: Provider[] = [], componentInputs: any = {}) {
|
|
|
32
31
|
provideRouter([]),
|
|
33
32
|
{ provide: ActivatedRoute, useValue: activatedRouteMock },
|
|
34
33
|
{ provide: MatSnackBar, useValue: snackBarMock },
|
|
35
|
-
|
|
34
|
+
...provideAppMocks(),
|
|
36
35
|
{ provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
|
|
37
36
|
{ provide: AuthStore, useClass: AuthLoggedInMockDB },
|
|
38
37
|
UserStore,
|
|
@@ -4,10 +4,9 @@ import { MatSnackBar } from '@angular/material/snack-bar';
|
|
|
4
4
|
import { Provider } from '@angular/core';
|
|
5
5
|
|
|
6
6
|
import { AdminSettingsComponent } from './admin-settings.component';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
|
|
7
|
+
import { provideAppMocks } from 'src/app/core/testing/app-mocks';
|
|
8
|
+
import { BATCH_WRITE_SERVICE } from '@tech4good/platform-data';
|
|
9
|
+
import { BatchWriteMockService } from '@tech4good/platform-data/testing';
|
|
11
10
|
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
12
11
|
import { AuthLoggedInMockDB } from 'src/app/core/store/auth/auth.mock';
|
|
13
12
|
import { UserStore } from 'src/app/core/store/user/user.store';
|
|
@@ -23,7 +22,7 @@ async function setup(providers: Provider[] = []) {
|
|
|
23
22
|
const view = await render(AdminSettingsComponent, {
|
|
24
23
|
providers: [
|
|
25
24
|
{ provide: MatSnackBar, useValue: snackBarMock },
|
|
26
|
-
|
|
25
|
+
...provideAppMocks(),
|
|
27
26
|
{ provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
|
|
28
27
|
{ provide: AuthStore, useClass: AuthLoggedInMockDB },
|
|
29
28
|
UserStore,
|
|
@@ -4,21 +4,22 @@ import { MatSnackBar } from '@angular/material/snack-bar';
|
|
|
4
4
|
import { Provider } from '@angular/core';
|
|
5
5
|
|
|
6
6
|
import { AdminUserListComponent } from './admin-user-list.component';
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
import { BATCH_WRITE_SERVICE } from '
|
|
10
|
-
import { BatchWriteMockService } from '
|
|
7
|
+
|
|
8
|
+
import { MockDataService } from '@tech4good/platform-data/testing';
|
|
9
|
+
import { BATCH_WRITE_SERVICE } from '@tech4good/platform-data';
|
|
10
|
+
import { BatchWriteMockService } from '@tech4good/platform-data/testing';
|
|
11
11
|
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
12
12
|
import { AuthLoggedInMockDB } from 'src/app/core/store/auth/auth.mock';
|
|
13
13
|
import { UserStore } from 'src/app/core/store/user/user.store';
|
|
14
14
|
import { UserContextStore } from 'src/app/core/store/user-context/user-context.store';
|
|
15
|
-
import { AccessState } from 'src/app/core/store/user/user.model';
|
|
16
|
-
import {
|
|
15
|
+
import { AccessState, User } from 'src/app/core/store/user/user.model';
|
|
16
|
+
import { UserContext } from 'src/app/core/store/user-context/user-context.model';
|
|
17
|
+
import { provideAppMocks } from 'src/app/core/testing/app-mocks';
|
|
17
18
|
import { MOCK_USER_LIST } from 'src/app/core/store/user/user.mock';
|
|
18
19
|
import { MOCK_USERCONTEXT_LIST } from 'src/app/core/store/user-context/user-context.mock';
|
|
19
20
|
|
|
20
21
|
/** Sets up the testing environment for AdminUserListComponent using render. */
|
|
21
|
-
async function setup(providers: Provider[] = [], seededUsers:
|
|
22
|
+
async function setup(providers: Provider[] = [], seededUsers: User[] = [], seededUserContexts: UserContext[] = []) {
|
|
22
23
|
const user = userEvent.setup();
|
|
23
24
|
const snackBarMock = {
|
|
24
25
|
open: jest.fn(),
|
|
@@ -26,10 +27,8 @@ async function setup(providers: Provider[] = [], seededUsers: any[] = [], seeded
|
|
|
26
27
|
|
|
27
28
|
const view = await render(AdminUserListComponent, {
|
|
28
29
|
providers: [
|
|
29
|
-
...
|
|
30
|
-
|
|
31
|
-
userContexts: seededUserContexts,
|
|
32
|
-
}),
|
|
30
|
+
...provideAppMocks({ collections: { users: seededUsers,
|
|
31
|
+
userContexts: seededUserContexts } }),
|
|
33
32
|
{ provide: MatSnackBar, useValue: snackBarMock },
|
|
34
33
|
{ provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
|
|
35
34
|
{ provide: AuthStore, useClass: AuthLoggedInMockDB },
|
|
@@ -43,7 +42,7 @@ async function setup(providers: Provider[] = [], seededUsers: any[] = [], seeded
|
|
|
43
42
|
user,
|
|
44
43
|
fixture: view.fixture,
|
|
45
44
|
snackBarMock,
|
|
46
|
-
dbService: view.fixture.debugElement.injector.get(
|
|
45
|
+
dbService: view.fixture.debugElement.injector.get(MockDataService),
|
|
47
46
|
userStore: view.fixture.debugElement.injector.get(UserStore),
|
|
48
47
|
};
|
|
49
48
|
}
|