@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
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: contents;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.card-section {
|
|
6
|
+
margin-bottom: 24px;
|
|
7
|
+
padding: 28px 32px;
|
|
8
|
+
border: 1px solid rgba(255, 255, 255, 0.9);
|
|
9
|
+
border-radius: 20px;
|
|
10
|
+
background: rgba(255, 255, 255, 0.85);
|
|
11
|
+
box-shadow:
|
|
12
|
+
0 10px 30px -10px rgba(79, 70, 229, 0.1),
|
|
13
|
+
0 4px 12px rgba(0, 0, 0, 0.03);
|
|
14
|
+
backdrop-filter: blur(16px);
|
|
15
|
+
|
|
16
|
+
h2 {
|
|
17
|
+
margin: 0 0 20px;
|
|
18
|
+
color: #1e1b4b;
|
|
19
|
+
font-size: 1.25rem;
|
|
20
|
+
font-weight: 700;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.avatar-preview-container {
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
gap: 16px;
|
|
28
|
+
margin-bottom: 24px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.avatar-img,
|
|
32
|
+
.avatar-placeholder {
|
|
33
|
+
width: 64px;
|
|
34
|
+
height: 64px;
|
|
35
|
+
border: 3px solid #fff;
|
|
36
|
+
border-radius: 50%;
|
|
37
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.avatar-img {
|
|
41
|
+
object-fit: cover;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.avatar-placeholder {
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
box-sizing: border-box;
|
|
49
|
+
background: linear-gradient(135deg, #6366f1, #4f46e5);
|
|
50
|
+
color: #fff;
|
|
51
|
+
font-size: 1.6rem;
|
|
52
|
+
font-weight: 700;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.avatar-info {
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
gap: 4px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.user-name-text {
|
|
62
|
+
color: #0f172a;
|
|
63
|
+
font-size: 1.1rem;
|
|
64
|
+
font-weight: 700;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.user-email-subtext {
|
|
68
|
+
color: #64748b;
|
|
69
|
+
font-size: 0.875rem;
|
|
70
|
+
font-weight: 500;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.user-role-badge {
|
|
74
|
+
width: fit-content;
|
|
75
|
+
padding: 2px 10px;
|
|
76
|
+
border-radius: 12px;
|
|
77
|
+
background: rgba(99, 102, 241, 0.1);
|
|
78
|
+
color: #4f46e5;
|
|
79
|
+
font-size: 0.75rem;
|
|
80
|
+
font-weight: 700;
|
|
81
|
+
letter-spacing: 0.05em;
|
|
82
|
+
text-transform: uppercase;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.full-width {
|
|
86
|
+
width: 100%;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
mat-form-field {
|
|
90
|
+
::ng-deep .mdc-text-field--outlined {
|
|
91
|
+
--mdc-outlined-text-field-container-shape: 14px;
|
|
92
|
+
--mdc-outlined-text-field-outline-color: #cbd5e1;
|
|
93
|
+
--mdc-outlined-text-field-focus-outline-color: #6366f1;
|
|
94
|
+
border-radius: 14px;
|
|
95
|
+
background: #fff;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.save-btn {
|
|
100
|
+
height: 44px !important;
|
|
101
|
+
margin-top: 8px;
|
|
102
|
+
padding: 0 24px !important;
|
|
103
|
+
border-radius: 14px !important;
|
|
104
|
+
background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
|
|
105
|
+
color: #fff !important;
|
|
106
|
+
font-weight: 700 !important;
|
|
107
|
+
box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25) !important;
|
|
108
|
+
transition: all 0.2s ease !important;
|
|
109
|
+
|
|
110
|
+
&:hover:not(:disabled) {
|
|
111
|
+
transform: translateY(-1px);
|
|
112
|
+
box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35) !important;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.message-banner {
|
|
117
|
+
margin-top: 20px;
|
|
118
|
+
padding: 12px 16px;
|
|
119
|
+
border: 1px solid #bfdbfe;
|
|
120
|
+
border-radius: 12px;
|
|
121
|
+
background: #eff6ff;
|
|
122
|
+
color: #1e40af;
|
|
123
|
+
font-size: 0.9rem;
|
|
124
|
+
font-weight: 600;
|
|
125
|
+
|
|
126
|
+
&.message-error {
|
|
127
|
+
border-color: #fca5a5;
|
|
128
|
+
background: #fef2f2;
|
|
129
|
+
color: #b91c1c;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@media (max-width: 640px) {
|
|
134
|
+
.card-section {
|
|
135
|
+
padding: 20px;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Injectable, signal } from '@angular/core';
|
|
2
|
+
import { render, screen } from '@testing-library/angular';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { provideAppMocks } from 'src/app/core/testing/app-mocks';
|
|
5
|
+
import { AuthLoggedInMockDB } from 'src/app/core/store/auth/auth.mock';
|
|
6
|
+
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
7
|
+
import { USER_DB } from 'src/app/core/store/user/user.mock';
|
|
8
|
+
import { UserStore } from 'src/app/core/store/user/user.store';
|
|
9
|
+
import { ProfileDetailsCardComponent } from './profile-details-card.component';
|
|
10
|
+
|
|
11
|
+
async function setup(authStore = AuthLoggedInMockDB) {
|
|
12
|
+
const user = userEvent.setup();
|
|
13
|
+
const view = await render(ProfileDetailsCardComponent, {
|
|
14
|
+
providers: [
|
|
15
|
+
{ provide: AuthStore, useClass: authStore },
|
|
16
|
+
...provideAppMocks({ disableLatency: true }),
|
|
17
|
+
],
|
|
18
|
+
});
|
|
19
|
+
const userStore = view.fixture.debugElement.injector.get(UserStore);
|
|
20
|
+
|
|
21
|
+
return { user, userStore };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
describe('ProfileDetailsCardComponent', () => {
|
|
25
|
+
it('renders profile identity and saves an edited display name', async () => {
|
|
26
|
+
const { user, userStore } = await setup();
|
|
27
|
+
const updateSpy = jest.spyOn(userStore, 'update').mockResolvedValue(undefined as never);
|
|
28
|
+
const nameInput = screen.getByRole('textbox', { name: /Display Name/i });
|
|
29
|
+
|
|
30
|
+
expect(screen.getByText('Admin')).toBeVisible();
|
|
31
|
+
await user.clear(nameInput);
|
|
32
|
+
await user.type(nameInput, 'New Display Name');
|
|
33
|
+
await user.click(screen.getByRole('button', { name: /Save profile/i }));
|
|
34
|
+
|
|
35
|
+
expect(updateSpy).toHaveBeenCalledWith(
|
|
36
|
+
USER_DB[0].__id,
|
|
37
|
+
{ name: 'New Display Name' },
|
|
38
|
+
expect.any(Object),
|
|
39
|
+
);
|
|
40
|
+
expect(await screen.findByRole('status')).toHaveTextContent(/Profile updated successfully/i);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('renders save failures and omits the role badge for non-admin users', async () => {
|
|
44
|
+
@Injectable()
|
|
45
|
+
class NonAdminAuthMockDB extends AuthLoggedInMockDB {
|
|
46
|
+
override user = signal({ ...USER_DB[0], isAdmin: false });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const { user, userStore } = await setup(NonAdminAuthMockDB);
|
|
50
|
+
jest.spyOn(userStore, 'update').mockRejectedValue(new Error('save failed'));
|
|
51
|
+
|
|
52
|
+
expect(screen.queryByText('Admin')).not.toBeInTheDocument();
|
|
53
|
+
await user.click(screen.getByRole('button', { name: /Save profile/i }));
|
|
54
|
+
|
|
55
|
+
expect(await screen.findByRole('alert')).toHaveTextContent(/Could not update profile/i);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, inject, linkedSignal, signal } from '@angular/core';
|
|
2
|
+
import { form, FormField, required, submit } from '@angular/forms/signals';
|
|
3
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
4
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
5
|
+
import { MatInputModule } from '@angular/material/input';
|
|
6
|
+
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
7
|
+
import { UserStore } from 'src/app/core/store/user/user.store';
|
|
8
|
+
|
|
9
|
+
type ProfileMessage = { text: string; isError: boolean };
|
|
10
|
+
|
|
11
|
+
/** Owns display-name editing and profile identity presentation. */
|
|
12
|
+
@Component({
|
|
13
|
+
selector: 'app-profile-details-card',
|
|
14
|
+
templateUrl: './profile-details-card.component.html',
|
|
15
|
+
styleUrl: './profile-details-card.component.scss',
|
|
16
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
17
|
+
imports: [FormField, MatButtonModule, MatFormFieldModule, MatInputModule],
|
|
18
|
+
})
|
|
19
|
+
export class ProfileDetailsCardComponent {
|
|
20
|
+
private readonly authStore = inject(AuthStore);
|
|
21
|
+
private readonly userStore = inject(UserStore);
|
|
22
|
+
|
|
23
|
+
// --------------- LOCAL UI STATE ----------------------
|
|
24
|
+
|
|
25
|
+
readonly message = signal<ProfileMessage | null>(null);
|
|
26
|
+
readonly isSaving = signal(false);
|
|
27
|
+
readonly userModel = linkedSignal(() => ({
|
|
28
|
+
name: this.currentUser()?.name ?? '',
|
|
29
|
+
}));
|
|
30
|
+
readonly profileForm = form(this.userModel, (schema) => {
|
|
31
|
+
required(schema.name, { message: 'Name is required' });
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// --------------- COMPUTED DATA -----------------------
|
|
35
|
+
|
|
36
|
+
readonly currentUser = this.authStore.user;
|
|
37
|
+
readonly session = this.authStore.afUser;
|
|
38
|
+
|
|
39
|
+
// --------------- EVENT HANDLING ----------------------
|
|
40
|
+
|
|
41
|
+
async updateProfile(): Promise<void> {
|
|
42
|
+
const user = this.currentUser();
|
|
43
|
+
if (!user) return;
|
|
44
|
+
|
|
45
|
+
await submit(this.profileForm, async () => {
|
|
46
|
+
this.message.set(null);
|
|
47
|
+
try {
|
|
48
|
+
await this.userStore.update(
|
|
49
|
+
user.__id,
|
|
50
|
+
{ name: this.userModel().name },
|
|
51
|
+
{ loading: this.isSaving },
|
|
52
|
+
);
|
|
53
|
+
this.message.set({ text: 'Profile updated successfully.', isError: false });
|
|
54
|
+
} catch {
|
|
55
|
+
this.message.set({ text: 'Could not update profile. Please try again.', isError: true });
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<section class="card-section" aria-labelledby="sign-in-methods-heading">
|
|
2
|
+
<h2 id="sign-in-methods-heading">Sign-In Methods</h2>
|
|
3
|
+
|
|
4
|
+
<div class="providers-container">
|
|
5
|
+
<div class="provider-card">
|
|
6
|
+
<div class="provider-header-group">
|
|
7
|
+
<div class="provider-icon-wrapper google" aria-hidden="true">
|
|
8
|
+
<svg viewBox="0 0 24 24" width="22" height="22">
|
|
9
|
+
<path fill="#4285f4" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"/>
|
|
10
|
+
<path fill="#34a853" d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"/>
|
|
11
|
+
<path fill="#fbbc05" d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.06H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.94l2.85-2.22.81-.63z"/>
|
|
12
|
+
<path fill="#ea4335" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.06l3.66 2.84c.87-2.6 3.3-4.52 6.16-4.52z"/>
|
|
13
|
+
</svg>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div class="provider-meta">
|
|
17
|
+
<span class="provider-title">Google Account</span>
|
|
18
|
+
@if (hasGoogleProvider()) {
|
|
19
|
+
<p class="provider-desc status-active">Google is linked to your profile.</p>
|
|
20
|
+
} @else if (session()?.isAnonymous) {
|
|
21
|
+
<p class="provider-desc">Save your guest progress with 1-click Google sign-in.</p>
|
|
22
|
+
} @else {
|
|
23
|
+
<p class="provider-desc">Link your Google account for 1-click sign-in.</p>
|
|
24
|
+
}
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<div class="provider-action-top">
|
|
28
|
+
@if (hasGoogleProvider()) {
|
|
29
|
+
<span class="badge-linked">✓ Linked</span>
|
|
30
|
+
} @else {
|
|
31
|
+
<button mat-flat-button class="btn-link-google" type="button" (click)="addGoogle()">
|
|
32
|
+
<svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true">
|
|
33
|
+
<path fill="#4285f4" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"/>
|
|
34
|
+
<path fill="#34a853" d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"/>
|
|
35
|
+
<path fill="#fbbc05" d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.06H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.94l2.85-2.22.81-.63z"/>
|
|
36
|
+
<path fill="#ea4335" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.06l3.66 2.84c.87-2.6 3.3-4.52 6.16-4.52z"/>
|
|
37
|
+
</svg>
|
|
38
|
+
Link Google
|
|
39
|
+
</button>
|
|
40
|
+
}
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<div class="provider-card">
|
|
46
|
+
<div class="provider-header-group">
|
|
47
|
+
<div class="provider-icon-wrapper email" aria-hidden="true">
|
|
48
|
+
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2">
|
|
49
|
+
<rect x="2" y="4" width="20" height="16" rx="3"/>
|
|
50
|
+
<path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/>
|
|
51
|
+
</svg>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<div class="provider-meta">
|
|
55
|
+
<span class="provider-title">Email Magic Link</span>
|
|
56
|
+
@if (session()?.emailLinkEnabled) {
|
|
57
|
+
<p class="provider-desc status-active">Email-link sign-in is enabled.</p>
|
|
58
|
+
} @else if (session()?.isAnonymous) {
|
|
59
|
+
<p class="provider-desc">Save your guest progress by connecting an email address.</p>
|
|
60
|
+
} @else if (session()?.email) {
|
|
61
|
+
<p class="provider-desc">Receive a secure sign-in link without creating another password.</p>
|
|
62
|
+
} @else {
|
|
63
|
+
<p class="provider-desc">Connect an email address to receive passwordless sign-in links.</p>
|
|
64
|
+
}
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
@if (session()?.emailLinkEnabled) {
|
|
68
|
+
<div class="provider-action-top">
|
|
69
|
+
<span class="badge-linked">✓ Enabled</span>
|
|
70
|
+
</div>
|
|
71
|
+
} @else if (!session()?.isAnonymous && session()?.email) {
|
|
72
|
+
<div class="provider-action-top">
|
|
73
|
+
<button mat-flat-button class="btn-primary-action" type="button" (click)="enableEmailLink()">
|
|
74
|
+
Enable Email Link
|
|
75
|
+
</button>
|
|
76
|
+
</div>
|
|
77
|
+
}
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
@if (!session()?.emailLinkEnabled && (session()?.isAnonymous || !session()?.email)) {
|
|
81
|
+
<form class="guest-email-container" (submit)="upgradeGuestWithEmailLink(); $event.preventDefault()">
|
|
82
|
+
<div class="email-input-row">
|
|
83
|
+
<mat-form-field appearance="outline" class="email-field">
|
|
84
|
+
<mat-label>Email Address</mat-label>
|
|
85
|
+
<input
|
|
86
|
+
#guestEmailInput
|
|
87
|
+
matInput
|
|
88
|
+
type="email"
|
|
89
|
+
autocomplete="email"
|
|
90
|
+
placeholder="name@example.com"
|
|
91
|
+
[formField]="guestEmailForm.email"
|
|
92
|
+
/>
|
|
93
|
+
@if (guestEmailForm.email().touched() && guestEmailForm.email().invalid()) {
|
|
94
|
+
<mat-error>Enter a valid email address.</mat-error>
|
|
95
|
+
}
|
|
96
|
+
</mat-form-field>
|
|
97
|
+
|
|
98
|
+
@if (magicLinkSent()) {
|
|
99
|
+
<span class="badge-linked magic-link-sent" role="status">✓ Magic link sent</span>
|
|
100
|
+
} @else {
|
|
101
|
+
<button mat-flat-button class="btn-magic-link" type="submit">
|
|
102
|
+
<svg
|
|
103
|
+
viewBox="0 0 24 24"
|
|
104
|
+
width="18"
|
|
105
|
+
height="18"
|
|
106
|
+
fill="none"
|
|
107
|
+
stroke="currentColor"
|
|
108
|
+
stroke-width="2"
|
|
109
|
+
aria-hidden="true"
|
|
110
|
+
>
|
|
111
|
+
<line x1="22" y1="2" x2="11" y2="13"/>
|
|
112
|
+
<polygon points="22 2 15 22 11 13 2 9 22 2"/>
|
|
113
|
+
</svg>
|
|
114
|
+
Send Magic Link
|
|
115
|
+
</button>
|
|
116
|
+
}
|
|
117
|
+
</div>
|
|
118
|
+
</form>
|
|
119
|
+
}
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
@if (message(); as message) {
|
|
124
|
+
<div
|
|
125
|
+
class="sign-in-message"
|
|
126
|
+
[class.sign-in-message-error]="message.isError"
|
|
127
|
+
[attr.role]="message.isError ? 'alert' : 'status'"
|
|
128
|
+
aria-live="polite"
|
|
129
|
+
>
|
|
130
|
+
{{ message.text }}
|
|
131
|
+
</div>
|
|
132
|
+
}
|
|
133
|
+
</section>
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: contents;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.card-section {
|
|
6
|
+
margin-bottom: 24px;
|
|
7
|
+
padding: 28px 32px;
|
|
8
|
+
border: 1px solid rgba(255, 255, 255, 0.9);
|
|
9
|
+
border-radius: 20px;
|
|
10
|
+
background: rgba(255, 255, 255, 0.85);
|
|
11
|
+
box-shadow:
|
|
12
|
+
0 10px 30px -10px rgba(79, 70, 229, 0.1),
|
|
13
|
+
0 4px 12px rgba(0, 0, 0, 0.03);
|
|
14
|
+
backdrop-filter: blur(16px);
|
|
15
|
+
|
|
16
|
+
h2 {
|
|
17
|
+
margin: 0 0 20px;
|
|
18
|
+
color: #1e1b4b;
|
|
19
|
+
font-size: 1.25rem;
|
|
20
|
+
font-weight: 700;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.providers-container {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
gap: 16px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.provider-card {
|
|
31
|
+
padding: 20px 24px;
|
|
32
|
+
border: 1px solid #e2e8f0;
|
|
33
|
+
border-radius: 16px;
|
|
34
|
+
background: #fff;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.provider-header-group {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: 16px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.provider-icon-wrapper {
|
|
44
|
+
display: flex;
|
|
45
|
+
flex: 0 0 44px;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
width: 44px;
|
|
49
|
+
height: 44px;
|
|
50
|
+
border-radius: 12px;
|
|
51
|
+
|
|
52
|
+
&.google {
|
|
53
|
+
border: 1px solid #e2e8f0;
|
|
54
|
+
background: #f8fafc;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&.email {
|
|
58
|
+
border: 1px solid #e0e7ff;
|
|
59
|
+
background: #eef2ff;
|
|
60
|
+
color: #4f46e5;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.provider-meta {
|
|
65
|
+
flex: 1;
|
|
66
|
+
min-width: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.provider-title {
|
|
70
|
+
display: block;
|
|
71
|
+
color: #0f172a;
|
|
72
|
+
font-size: 1.05rem;
|
|
73
|
+
font-weight: 700;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.provider-desc {
|
|
77
|
+
margin: 3px 0 0;
|
|
78
|
+
color: #64748b;
|
|
79
|
+
font-size: 0.875rem;
|
|
80
|
+
line-height: 1.4;
|
|
81
|
+
|
|
82
|
+
&.status-active {
|
|
83
|
+
color: #16a34a;
|
|
84
|
+
font-weight: 600;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.provider-action-top {
|
|
89
|
+
display: flex;
|
|
90
|
+
flex-shrink: 0;
|
|
91
|
+
align-items: center;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.btn-link-google,
|
|
95
|
+
.btn-primary-action,
|
|
96
|
+
.btn-magic-link {
|
|
97
|
+
border-radius: 12px !important;
|
|
98
|
+
font-weight: 600 !important;
|
|
99
|
+
white-space: nowrap !important;
|
|
100
|
+
|
|
101
|
+
::ng-deep .mdc-button__label {
|
|
102
|
+
display: inline-flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
gap: 8px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
svg {
|
|
108
|
+
flex-shrink: 0;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.btn-link-google {
|
|
113
|
+
height: 42px !important;
|
|
114
|
+
padding: 0 18px !important;
|
|
115
|
+
border: 1px solid #cbd5e1 !important;
|
|
116
|
+
background: #fff !important;
|
|
117
|
+
color: #1e293b !important;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.btn-primary-action,
|
|
121
|
+
.btn-magic-link {
|
|
122
|
+
background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
|
|
123
|
+
color: #fff !important;
|
|
124
|
+
box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2) !important;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.btn-primary-action {
|
|
128
|
+
height: 42px !important;
|
|
129
|
+
padding: 0 20px !important;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.guest-email-container {
|
|
133
|
+
margin-top: 18px;
|
|
134
|
+
padding-top: 18px;
|
|
135
|
+
border-top: 1px solid #f1f5f9;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.email-input-row {
|
|
139
|
+
display: flex;
|
|
140
|
+
align-items: flex-start;
|
|
141
|
+
gap: 12px;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.email-field {
|
|
145
|
+
flex: 1;
|
|
146
|
+
margin-bottom: 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.btn-magic-link {
|
|
150
|
+
flex-shrink: 0;
|
|
151
|
+
height: 56px !important;
|
|
152
|
+
padding: 0 22px !important;
|
|
153
|
+
border-radius: 14px !important;
|
|
154
|
+
font-weight: 700 !important;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.badge-linked {
|
|
158
|
+
display: inline-flex;
|
|
159
|
+
align-items: center;
|
|
160
|
+
padding: 6px 14px;
|
|
161
|
+
border: 1px solid #bbf7d0;
|
|
162
|
+
border-radius: 12px;
|
|
163
|
+
background: #f0fdf4;
|
|
164
|
+
color: #16a34a;
|
|
165
|
+
font-size: 0.85rem;
|
|
166
|
+
font-weight: 700;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.magic-link-sent {
|
|
170
|
+
min-height: 44px;
|
|
171
|
+
box-sizing: border-box;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.sign-in-message {
|
|
175
|
+
margin-top: 16px;
|
|
176
|
+
padding: 12px 14px;
|
|
177
|
+
border: 1px solid #86efac;
|
|
178
|
+
border-radius: 12px;
|
|
179
|
+
background: #ecfdf5;
|
|
180
|
+
color: #166534;
|
|
181
|
+
font-size: 0.9rem;
|
|
182
|
+
font-weight: 600;
|
|
183
|
+
line-height: 1.45;
|
|
184
|
+
|
|
185
|
+
&.sign-in-message-error {
|
|
186
|
+
border-color: #fca5a5;
|
|
187
|
+
background: #fef2f2;
|
|
188
|
+
color: #b91c1c;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
@media (max-width: 640px) {
|
|
193
|
+
.card-section {
|
|
194
|
+
padding: 20px;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
@media (max-width: 580px) {
|
|
199
|
+
.provider-header-group {
|
|
200
|
+
flex-wrap: wrap;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.email-input-row {
|
|
204
|
+
flex-direction: column;
|
|
205
|
+
align-items: stretch;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Injectable, signal, Type } from '@angular/core';
|
|
2
|
+
import { render, screen } from '@testing-library/angular';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { provideAppMocks } from 'src/app/core/testing/app-mocks';
|
|
5
|
+
import { AuthLoggedInMockDB } from 'src/app/core/store/auth/auth.mock';
|
|
6
|
+
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
7
|
+
import { USER_DB } from 'src/app/core/store/user/user.mock';
|
|
8
|
+
import { SignInMethodsCardComponent } from './sign-in-methods-card.component';
|
|
9
|
+
|
|
10
|
+
@Injectable()
|
|
11
|
+
class GuestAuthMockDB extends AuthLoggedInMockDB {
|
|
12
|
+
override afUser = signal({
|
|
13
|
+
uid: USER_DB[0].__id,
|
|
14
|
+
email: null,
|
|
15
|
+
displayName: 'Guest',
|
|
16
|
+
photoURL: null,
|
|
17
|
+
isAnonymous: true,
|
|
18
|
+
emailVerified: false,
|
|
19
|
+
emailLinkEnabled: false,
|
|
20
|
+
providerIds: [],
|
|
21
|
+
});
|
|
22
|
+
override user = signal({ ...USER_DB[0], name: 'Guest' });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async function setup(authStore: Type<AuthStore> = AuthLoggedInMockDB) {
|
|
26
|
+
const user = userEvent.setup();
|
|
27
|
+
const view = await render(SignInMethodsCardComponent, {
|
|
28
|
+
providers: [
|
|
29
|
+
{ provide: AuthStore, useClass: authStore },
|
|
30
|
+
...provideAppMocks({ disableLatency: true }),
|
|
31
|
+
],
|
|
32
|
+
});
|
|
33
|
+
const auth = view.fixture.debugElement.injector.get(AuthStore);
|
|
34
|
+
|
|
35
|
+
return { user, auth };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
describe('SignInMethodsCardComponent', () => {
|
|
39
|
+
it('shows linked providers and enables email-link sign-in', async () => {
|
|
40
|
+
const { user, auth } = await setup();
|
|
41
|
+
const enableSpy = jest.spyOn(auth, 'sendEmailLinkForCurrentAccount');
|
|
42
|
+
|
|
43
|
+
expect(screen.getByText(/Google is linked/i)).toBeVisible();
|
|
44
|
+
await user.click(screen.getByRole('button', { name: /Enable Email Link/i }));
|
|
45
|
+
|
|
46
|
+
expect(enableSpy).toHaveBeenCalled();
|
|
47
|
+
expect(await screen.findByRole('status')).toHaveTextContent(/sent a confirmation link/i);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('shows a Google collision error inside the card', async () => {
|
|
51
|
+
const { user, auth } = await setup(GuestAuthMockDB);
|
|
52
|
+
jest.spyOn(auth, 'linkGoogle').mockRejectedValue({
|
|
53
|
+
code: 'auth/credential-already-in-use',
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
await user.click(screen.getByRole('button', { name: /Link Google/i }));
|
|
57
|
+
|
|
58
|
+
const alert = await screen.findByRole('alert');
|
|
59
|
+
expect(alert).toHaveTextContent(/belongs to a different profile/i);
|
|
60
|
+
expect(alert.closest('section')).toHaveAccessibleName('Sign-In Methods');
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('sends a guest magic link and replaces the button with confirmation text', async () => {
|
|
64
|
+
const { user, auth } = await setup(GuestAuthMockDB);
|
|
65
|
+
const sendLinkSpy = jest.spyOn(auth, 'sendEmailSignInLink');
|
|
66
|
+
|
|
67
|
+
await user.type(screen.getByRole('textbox', { name: /Email Address/i }), 'guest@example.com');
|
|
68
|
+
await user.click(screen.getByRole('button', { name: /Send Magic Link/i }));
|
|
69
|
+
|
|
70
|
+
expect(sendLinkSpy).toHaveBeenCalledWith('guest@example.com');
|
|
71
|
+
expect(screen.queryByRole('button', { name: /Send Magic Link/i })).not.toBeInTheDocument();
|
|
72
|
+
expect(await screen.findByText(/Magic link sent/i)).toBeVisible();
|
|
73
|
+
});
|
|
74
|
+
});
|