@tech4good/angular-schematics 21.5.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 +44 -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 +16 -7
- package/src/entity/files/__name@dasherize__/__name@dasherize__.model.ts.template +13 -6
- package/src/entity/files/__name@dasherize__/__name@dasherize__.store.ts.template +18 -10
- package/src/entity/index.js +61 -49
- package/src/entity/index.js.map +1 -1
- package/src/entity/schema.json +4 -0
- 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 +5 -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 +300 -0
- 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 +123 -38
- 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/firebase.json.template +6 -0
- package/src/ng-add/files/firestore.indexes.json.template +23 -0
- package/src/ng-add/files/firestore.rules.spec.ts.template +84 -15
- package/src/ng-add/files/firestore.rules.template +29 -17
- package/src/ng-add/files/functions/.gitignore.template +3 -0
- package/src/ng-add/files/functions/package.json.template +13 -0
- package/src/ng-add/files/functions/src/email.ts.template +23 -0
- package/src/ng-add/files/functions/src/index.ts.template +44 -0
- package/src/ng-add/files/functions/tsconfig.json.template +13 -0
- package/src/ng-add/files/jest.config.ts.template +3 -2
- package/src/ng-add/files/package.json.template +41 -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.html.template +3 -1
- package/src/ng-add/files/src/app/admin/admin-panel/admin-panel.component.spec.ts.template +10 -13
- package/src/ng-add/files/src/app/admin/admin-panel/admin-panel.component.ts.template +2 -0
- 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 +3 -3
- 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 +3 -2
- package/src/ng-add/files/src/app/app.config.ts.template +21 -15
- package/src/ng-add/files/src/app/app.routes.ts.template +6 -0
- package/src/ng-add/files/src/app/auth-routing.spec.ts.template +13 -9
- 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 +14 -23
- package/src/ng-add/files/src/app/core/auth/guards/require-admin.guard.spec.ts.template +27 -0
- package/src/ng-add/files/src/app/core/auth/guards/require-admin.guard.ts.template +3 -2
- package/src/ng-add/files/src/app/core/auth/guards/require-auth-and-consent.guard.ts.template +7 -2
- 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 +20 -82
- package/src/ng-add/files/src/app/core/store/auth/auth.store.spec.ts.template +217 -0
- package/src/ng-add/files/src/app/core/store/auth/auth.store.ts.template +36 -172
- package/src/ng-add/files/src/app/core/store/user/user.mock.ts.template +18 -15
- package/src/ng-add/files/src/app/core/store/user/user.model.ts.template +7 -8
- 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 +6 -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/auth-action/auth-action.component.html.template +4 -0
- package/src/ng-add/files/src/app/first-time/auth-action/auth-action.component.scss.template +1 -0
- package/src/ng-add/files/src/app/first-time/auth-action/auth-action.component.ts.template +38 -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/consent/consent.guard.ts.template +5 -1
- package/src/ng-add/files/src/app/first-time/early-access/early-access.component.spec.ts.template +27 -16
- package/src/ng-add/files/src/app/first-time/early-access/early-access.component.ts.template +102 -49
- package/src/ng-add/files/src/app/first-time/early-access/early-access.guard.ts.template +5 -1
- 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.html.template +18 -0
- package/src/ng-add/files/src/app/first-time/email-link/email-link.component.scss.template +2 -0
- package/src/ng-add/files/src/app/first-time/email-link/email-link.component.spec.ts.template +56 -0
- package/src/ng-add/files/src/app/first-time/email-link/email-link.component.ts.template +91 -0
- package/src/ng-add/files/src/app/first-time/first-time-routing.spec.ts.template +11 -7
- package/src/ng-add/files/src/app/first-time/landing/hero/hero.component.html.template +19 -7
- package/src/ng-add/files/src/app/first-time/landing/hero/hero.component.scss.template +51 -0
- package/src/ng-add/files/src/app/first-time/landing/hero/hero.component.ts.template +44 -5
- package/src/ng-add/files/src/app/first-time/landing/landing.component.html.template +2 -1
- package/src/ng-add/files/src/app/first-time/landing/landing.component.scss.template +12 -8
- package/src/ng-add/files/src/app/first-time/landing/landing.component.spec.ts.template +33 -10
- package/src/ng-add/files/src/app/first-time/landing/landing.component.ts.template +6 -19
- package/src/ng-add/files/src/app/first-time/login/login.component.html.template +58 -6
- package/src/ng-add/files/src/app/first-time/login/login.component.scss.template +151 -22
- package/src/ng-add/files/src/app/first-time/login/login.component.spec.ts.template +30 -32
- package/src/ng-add/files/src/app/first-time/login/login.component.ts.template +85 -31
- 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.html.template +12 -0
- package/src/ng-add/files/src/app/main/account-profile/account-profile.component.scss.template +39 -0
- package/src/ng-add/files/src/app/main/account-profile/account-profile.component.spec.ts.template +68 -0
- package/src/ng-add/files/src/app/main/account-profile/account-profile.component.ts.template +20 -0
- package/src/ng-add/files/src/app/main/account-profile/delete-guest-card/delete-guest-card.component.html.template +24 -0
- package/src/ng-add/files/src/app/main/account-profile/delete-guest-card/delete-guest-card.component.scss.template +50 -0
- package/src/ng-add/files/src/app/main/account-profile/delete-guest-card/delete-guest-card.component.spec.ts.template +65 -0
- package/src/ng-add/files/src/app/main/account-profile/delete-guest-card/delete-guest-card.component.ts.template +59 -0
- package/src/ng-add/files/src/app/main/account-profile/guest-deletion-dialog.component.ts.template +51 -0
- package/src/ng-add/files/src/app/main/account-profile/profile-details-card/profile-details-card.component.html.template +50 -0
- package/src/ng-add/files/src/app/main/account-profile/profile-details-card/profile-details-card.component.scss.template +137 -0
- package/src/ng-add/files/src/app/main/account-profile/profile-details-card/profile-details-card.component.spec.ts.template +57 -0
- package/src/ng-add/files/src/app/main/account-profile/profile-details-card/profile-details-card.component.ts.template +59 -0
- package/src/ng-add/files/src/app/main/account-profile/sign-in-methods-card/sign-in-methods-card.component.html.template +133 -0
- package/src/ng-add/files/src/app/main/account-profile/sign-in-methods-card/sign-in-methods-card.component.scss.template +207 -0
- package/src/ng-add/files/src/app/main/account-profile/sign-in-methods-card/sign-in-methods-card.component.spec.ts.template +74 -0
- package/src/ng-add/files/src/app/main/account-profile/sign-in-methods-card/sign-in-methods-card.component.ts.template +130 -0
- 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 -6
- package/src/ng-add/files/src/app/shared/guest-warning-bar/guest-warning-bar.component.html.template +15 -0
- package/src/ng-add/files/src/app/shared/guest-warning-bar/guest-warning-bar.component.scss.template +79 -0
- package/src/ng-add/files/src/app/shared/guest-warning-bar/guest-warning-bar.component.spec.ts.template +59 -0
- package/src/ng-add/files/src/app/shared/guest-warning-bar/guest-warning-bar.component.ts.template +44 -0
- package/src/ng-add/files/src/app/shared/navbar/navbar.component.html.template +45 -15
- package/src/ng-add/files/src/app/shared/navbar/navbar.component.scss.template +103 -19
- package/src/ng-add/files/src/app/shared/navbar/navbar.component.spec.ts.template +73 -9
- package/src/ng-add/files/src/app/shared/navbar/navbar.component.ts.template +46 -18
- package/src/ng-add/files/src/environments/environment.prod.ts.template +1 -0
- package/src/ng-add/files/src/environments/environment.test.ts.template +1 -0
- package/src/ng-add/files/src/environments/environment.ts.template +1 -1
- 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/tsconfig.json +2 -2
- 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 -494
- package/src/ng-add/files/src/app/core/firebase/database.service.ts.template +0 -56
- package/src/ng-add/files/src/app/core/firebase/firebase.mock.service.ts.template +0 -366
- package/src/ng-add/files/src/app/core/firebase/firebase.service.ts.template +0 -342
- 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 -1317
- 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
|
@@ -1,41 +1,45 @@
|
|
|
1
1
|
import { inject, effect, WritableSignal } from '@angular/core';
|
|
2
2
|
import { signalStore, patchState, 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 { UserContext, userContextEntity } from './user-context.model';
|
|
7
8
|
|
|
9
|
+
/** Nested one-shot load descriptor; construction alone does not fetch records. */
|
|
8
10
|
export class LoadUserContext extends EntityLoadQuery<UserContext> {
|
|
9
11
|
constructor(
|
|
10
12
|
store,
|
|
11
13
|
queryParams: QueryParams,
|
|
12
14
|
queryOptions: QueryOptions,
|
|
13
|
-
loadQueries?: (entity: UserContext) => EntityLoadQuery<
|
|
15
|
+
loadQueries?: (entity: UserContext) => EntityLoadQuery<DataEntity>[],
|
|
14
16
|
) {
|
|
15
|
-
super(
|
|
17
|
+
super(userContextEntity.collection, store, queryParams, queryOptions, loadQueries);
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
static create(store, queryParams: QueryParams, queryOptions: QueryOptions, loadQueries?: (entity: UserContext) => EntityLoadQuery<
|
|
20
|
+
static create(store, queryParams: QueryParams, queryOptions: QueryOptions, loadQueries?: (entity: UserContext) => EntityLoadQuery<DataEntity>[]): LoadUserContext {
|
|
19
21
|
return new LoadUserContext(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 StreamUserContext extends EntityStreamQuery<UserContext> {
|
|
24
27
|
constructor(
|
|
25
28
|
store,
|
|
26
29
|
queryParams: QueryParams,
|
|
27
30
|
queryOptions: QueryOptions,
|
|
28
|
-
streamQueries?: (entity: UserContext) => EntityStreamQuery<
|
|
31
|
+
streamQueries?: (entity: UserContext) => EntityStreamQuery<DataEntity>[],
|
|
29
32
|
) {
|
|
30
|
-
super(
|
|
33
|
+
super(userContextEntity.collection, store, queryParams, queryOptions, streamQueries);
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
static create(store, queryParams: QueryParams, queryOptions: QueryOptions, streamQueries?: (entity: UserContext) => EntityStreamQuery<
|
|
36
|
+
static create(store, queryParams: QueryParams, queryOptions: QueryOptions, streamQueries?: (entity: UserContext) => EntityStreamQuery<DataEntity>[]): StreamUserContext {
|
|
34
37
|
return new StreamUserContext(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 UserContextStore = signalStore(
|
|
39
43
|
{ providedIn: 'root' },
|
|
40
|
-
withEntitiesAndDBMethods<UserContext>(
|
|
44
|
+
withEntitiesAndDBMethods<UserContext>(userContextEntity.collection),
|
|
41
45
|
);
|
|
@@ -1,15 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { UserPrivate } from './user-private.model';
|
|
3
|
-
import { withEntitiesForMockDB } from '
|
|
1
|
+
import { dataTimestampNow } from '@tech4good/platform-data';
|
|
2
|
+
import { UserPrivate, userPrivateEntity } from './user-private.model';
|
|
3
|
+
import { defineEntityMock, withEntitiesForMockDB } from '@tech4good/platform-data/testing';
|
|
4
4
|
import { signalStore } from '@ngrx/signals';
|
|
5
5
|
|
|
6
|
+
/** Mock backend storage; frontend entity stores read from it through MockDataService. */
|
|
6
7
|
export const UserPrivateMockDB = signalStore(
|
|
7
8
|
{ providedIn: 'root' },
|
|
8
|
-
withEntitiesForMockDB<UserPrivate>(
|
|
9
|
+
withEntitiesForMockDB<UserPrivate>(userPrivateEntity.collection),
|
|
9
10
|
);
|
|
10
11
|
|
|
12
|
+
/** Build a complete stored record for tests, allowing domain fields and metadata to be overridden. */
|
|
13
|
+
export function createMockUserPrivate(overrides?: Partial<UserPrivate>): UserPrivate {
|
|
14
|
+
return {
|
|
15
|
+
__id: 'mock-user-id', email: 'user@example.test',
|
|
16
|
+
_createdAt: dataTimestampNow(), _updatedAt: dataTimestampNow(), _deleted: false,
|
|
17
|
+
...overrides,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
11
21
|
export const USERPRIVATE_DB: UserPrivate[] = [
|
|
12
|
-
{ __id: '1', email: 'a@sample.com' },
|
|
13
|
-
{ __id: 'u1', email: 'alice@example.com' },
|
|
14
|
-
{ __id: 'u2', email: 'bob@example.com' },
|
|
22
|
+
createMockUserPrivate({ __id: '1', email: 'a@sample.com' }),
|
|
23
|
+
createMockUserPrivate({ __id: 'u1', email: 'alice@example.com' }),
|
|
24
|
+
createMockUserPrivate({ __id: 'u2', email: 'bob@example.com' }),
|
|
15
25
|
];
|
|
26
|
+
|
|
27
|
+
/** Discovered mock wiring; tests can replace seeds through provideAppMocks({ collections: ... }). */
|
|
28
|
+
export const userPrivateMock = defineEntityMock(userPrivateEntity, { store: UserPrivateMockDB, seeds: USERPRIVATE_DB });
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineEntity, DataEntity } from '@tech4good/platform-data';
|
|
2
2
|
|
|
3
|
-
export interface UserPrivate {
|
|
4
|
-
__id: string;
|
|
5
|
-
_createdAt?: Timestamp;
|
|
6
|
-
_updatedAt?: Timestamp;
|
|
7
|
-
_deleted?: boolean;
|
|
3
|
+
export interface UserPrivate extends DataEntity {
|
|
8
4
|
email: string;
|
|
5
|
+
emailLinkEnabled?: boolean;
|
|
9
6
|
}
|
|
7
|
+
|
|
8
|
+
/** Collection identity discovered by t4g-entities; keep the name literal and this export in the model file. */
|
|
9
|
+
export const userPrivateEntity = defineEntity<UserPrivate>({ collection: 'userPrivates' });
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.auth-action { max-width: 430px; margin: 80px auto; text-align: center; display: grid; justify-items: center; gap: 16px; }
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, inject, OnInit, signal } from '@angular/core';
|
|
2
|
+
import { ActivatedRoute, Router } from '@angular/router';
|
|
3
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Endpoint view for handling Firebase Auth email action redirects (`/auth/action`).
|
|
7
|
+
*
|
|
8
|
+
* Configured in Firebase Console as the default action handler. Receives URL query parameters
|
|
9
|
+
* (such as `mode=signIn` and action codes) and forwards valid email link sign-in flows to `/email-link`.
|
|
10
|
+
*/
|
|
11
|
+
@Component({
|
|
12
|
+
selector: 'app-auth-action',
|
|
13
|
+
templateUrl: './auth-action.component.html',
|
|
14
|
+
styleUrl: './auth-action.component.scss',
|
|
15
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
16
|
+
imports: [MatProgressSpinnerModule],
|
|
17
|
+
})
|
|
18
|
+
export class AuthActionComponent implements OnInit {
|
|
19
|
+
private readonly route = inject(ActivatedRoute);
|
|
20
|
+
private readonly router = inject(Router);
|
|
21
|
+
|
|
22
|
+
/** Status message displayed to the user while processing the email action callback. */
|
|
23
|
+
readonly message = signal('Completing your secure email action…');
|
|
24
|
+
|
|
25
|
+
async ngOnInit(): Promise<void> {
|
|
26
|
+
const params = this.route.snapshot.queryParams;
|
|
27
|
+
const mode = params['mode'];
|
|
28
|
+
try {
|
|
29
|
+
if (mode === 'signIn') {
|
|
30
|
+
await this.router.navigate(['/email-link'], { queryParams: params });
|
|
31
|
+
} else {
|
|
32
|
+
this.message.set('This email action is not valid or has expired.');
|
|
33
|
+
}
|
|
34
|
+
} catch {
|
|
35
|
+
this.message.set('This email action is not valid or has expired. Request a new email and try again.');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -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
|
}
|
|
@@ -4,6 +4,7 @@ import { map } from 'rxjs/operators';
|
|
|
4
4
|
import { AuthService } from '../../core/auth/auth.service';
|
|
5
5
|
import { User, AccessState } from '../../core/store/user/user.model';
|
|
6
6
|
import { hasAdminOverride } from '../../core/auth/guards/admin-override';
|
|
7
|
+
import { environment } from 'src/environments/environment';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Single guard logic for the consent page that checks two conditions:
|
|
@@ -20,11 +21,14 @@ export function handleAccess(
|
|
|
20
21
|
router: Router,
|
|
21
22
|
route: ActivatedRouteSnapshot,
|
|
22
23
|
state: RouterStateSnapshot,
|
|
24
|
+
hasWaitlist: boolean = environment.hasWaitlist,
|
|
23
25
|
): boolean {
|
|
24
26
|
if (hasAdminOverride(user, state.url)) return true;
|
|
25
27
|
|
|
26
28
|
// Check 1: Has the user cleared the waitlist?
|
|
27
|
-
const waitingStates =
|
|
29
|
+
const waitingStates = hasWaitlist ?
|
|
30
|
+
[AccessState.SUBMIT_INTEREST, AccessState.WAITING] :
|
|
31
|
+
[AccessState.SUBMIT_INTEREST];
|
|
28
32
|
if (user && waitingStates.includes(user.accessState)) {
|
|
29
33
|
router.navigate(['/early-access'], { queryParams: route.queryParams });
|
|
30
34
|
return false;
|
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,
|
|
@@ -57,6 +57,7 @@ async function setup(providers: Provider[] = [], seededUsers: any[] = []) {
|
|
|
57
57
|
routerMock,
|
|
58
58
|
snackBarMock,
|
|
59
59
|
batchWriteMock: view.fixture.debugElement.injector.get(BATCH_WRITE_SERVICE) as any,
|
|
60
|
+
authStore: view.fixture.debugElement.injector.get(AuthStore),
|
|
60
61
|
};
|
|
61
62
|
}
|
|
62
63
|
|
|
@@ -74,6 +75,14 @@ describe('EarlyAccessComponent', () => {
|
|
|
74
75
|
expect(screen.getByRole('button', { name: /Submit/i })).toBeDisabled();
|
|
75
76
|
});
|
|
76
77
|
|
|
78
|
+
it('should safely clear the page when the authenticated user is removed during account deletion', async () => {
|
|
79
|
+
const { authStore, fixture } = await setup();
|
|
80
|
+
|
|
81
|
+
await authStore.deleteAnonymousAccount();
|
|
82
|
+
expect(() => fixture.detectChanges()).not.toThrow();
|
|
83
|
+
expect(screen.queryByText(/Please help us understand/i)).not.toBeInTheDocument();
|
|
84
|
+
});
|
|
85
|
+
|
|
77
86
|
it('should enforce minLength validators on survey inputs', async () => {
|
|
78
87
|
const { user } = await setup();
|
|
79
88
|
|
|
@@ -100,7 +109,7 @@ describe('EarlyAccessComponent', () => {
|
|
|
100
109
|
});
|
|
101
110
|
|
|
102
111
|
it('should perform batch write and update accessState and user context on submit', async () => {
|
|
103
|
-
const { user, batchWriteMock, snackBarMock } = await setup();
|
|
112
|
+
const { user, batchWriteMock, snackBarMock, routerMock } = await setup();
|
|
104
113
|
|
|
105
114
|
const writeSpy = jest.spyOn(batchWriteMock, 'batchWrite');
|
|
106
115
|
|
|
@@ -114,7 +123,7 @@ describe('EarlyAccessComponent', () => {
|
|
|
114
123
|
// Verify batchWrite called
|
|
115
124
|
expect(writeSpy).toHaveBeenCalled();
|
|
116
125
|
|
|
117
|
-
// Verify
|
|
126
|
+
// Verify the write uses the shared timestamp value.
|
|
118
127
|
const batchFn = writeSpy.mock.calls[0][0] as any;
|
|
119
128
|
const dummyBatch = {
|
|
120
129
|
update: jest.fn(),
|
|
@@ -132,20 +141,22 @@ describe('EarlyAccessComponent', () => {
|
|
|
132
141
|
const updateCall = dummyBatch.update.mock.calls.find((call) => call[0].path.startsWith('users/'));
|
|
133
142
|
expect(updateCall).toBeDefined();
|
|
134
143
|
const changes = updateCall[1];
|
|
135
|
-
expect(changes.joinedWaitlistAt).
|
|
144
|
+
expect(isDataTimestamp(changes.joinedWaitlistAt)).toBe(true);
|
|
145
|
+
expect(changes.accessState).toBe(AccessState.CONSENT);
|
|
136
146
|
|
|
137
147
|
// Verify success notification shown with Undo action
|
|
138
148
|
await waitFor(() => {
|
|
139
149
|
expect(snackBarMock.open).toHaveBeenCalledWith('Submitted interest form!', 'Undo', expect.any(Object));
|
|
140
150
|
});
|
|
151
|
+
expect(routerMock.navigate).toHaveBeenCalledWith(['/consent'], { queryParams: undefined });
|
|
141
152
|
|
|
142
153
|
writeSpy.mockRestore();
|
|
143
154
|
});
|
|
144
155
|
|
|
145
156
|
it('should render waitlist card and display correct position when accessState is WAITING', async () => {
|
|
146
157
|
// Seed database with two waitlisted users to verify position calculation
|
|
147
|
-
const time1 =
|
|
148
|
-
const time2 =
|
|
158
|
+
const time1 = dataTimestampFromDate(new Date('2026-05-10T12:00:00Z'));
|
|
159
|
+
const time2 = dataTimestampFromDate(new Date('2026-05-15T12:00:00Z'));
|
|
149
160
|
|
|
150
161
|
// Mutate the auth store user to WAITING (joined at time2)
|
|
151
162
|
USER_DB[0].accessState = AccessState.WAITING;
|