@tech4good/angular-schematics 21.6.0 → 21.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +266 -1
  3. package/package.json +34 -7
  4. package/src/component/files/__name@dasherize__/__name@dasherize__.component.spec.ts.template +4 -5
  5. package/src/component/files/__name@dasherize__/__name@dasherize__.component.ts.template +1 -1
  6. package/src/entity/files/__name@dasherize__/__name@dasherize__.mock.ts.template +14 -6
  7. package/src/entity/files/__name@dasherize__/__name@dasherize__.model.ts.template +12 -6
  8. package/src/entity/files/__name@dasherize__/__name@dasherize__.store.ts.template +18 -10
  9. package/src/entity/index.js +4 -49
  10. package/src/entity/index.js.map +1 -1
  11. package/src/guard/files/__name@dasherize__.guard.spec.ts.template +0 -1
  12. package/src/ng-add/files/.github/workflows/angular-github-ci.yml.template +3 -0
  13. package/src/ng-add/files/.gitignore.template +3 -0
  14. package/src/ng-add/files/analytics/datasets.js.template +206 -0
  15. package/src/ng-add/files/analytics/entity_sources.js.template +58 -0
  16. package/src/ng-add/files/analytics/entity_sources.test.js.template +57 -0
  17. package/src/ng-add/files/analytics/lib/api_query.js.template +87 -0
  18. package/src/ng-add/files/analytics/lib/api_query.test.js.template +84 -0
  19. package/src/ng-add/files/analytics/lib/bigquery_query_compatibility.test.js.template +53 -0
  20. package/src/ng-add/files/analytics/lib/dataset_schema.js.template +53 -0
  21. package/src/ng-add/files/analytics/lib/dataset_schema.test.js.template +34 -0
  22. package/src/ng-add/files/analytics/lib/entity_sync.js.template +397 -0
  23. package/src/ng-add/files/analytics/lib/entity_sync.test.js.template +212 -0
  24. package/src/ng-add/files/analytics/lib/identifier_salt.js.template +57 -0
  25. package/src/ng-add/files/analytics/lib/identifier_salt.test.js.template +36 -0
  26. package/src/ng-add/files/analytics/lib/snapshot_files.js.template +46 -0
  27. package/src/ng-add/files/analytics/lib/snapshot_files.test.js.template +67 -0
  28. package/src/ng-add/files/analytics/lib/sqlite.js.template +92 -0
  29. package/src/ng-add/files/analytics/lib/upload_entities.js.template +81 -0
  30. package/src/ng-add/files/analytics/lib/upload_entities.test.js.template +86 -0
  31. package/src/ng-add/files/analytics/proxy.conf.json.template +7 -0
  32. package/src/ng-add/files/analytics/scripts/refresh_snapshot.js.template +518 -0
  33. package/src/ng-add/files/analytics/scripts/start.js.template +88 -0
  34. package/src/ng-add/files/analytics/server/server.js.template +212 -0
  35. package/src/ng-add/files/angular.json.template +80 -1
  36. package/src/ng-add/files/bigquery/queries/active_time_by_route.sql.template +27 -8
  37. package/src/ng-add/files/bigquery/queries/active_user_windows.sql.template +67 -0
  38. package/src/ng-add/files/bigquery/queries/dashboard_route_visits.sql.template +47 -0
  39. package/src/ng-add/files/bigquery/queries/data_quality.sql.template +323 -0
  40. package/src/ng-add/files/bigquery/queries/onboarding_funnel.sql.template +512 -0
  41. package/src/ng-add/files/bigquery/queries/onboarding_stage_observations.sql.template +134 -0
  42. package/src/ng-add/files/bigquery/queries/weekly_retention_cohorts.sql.template +90 -0
  43. package/src/ng-add/files/bigquery/scripts/export_entities.js.template +120 -0
  44. package/src/ng-add/files/bigquery/scripts/init_views.js.template +57 -0
  45. package/src/ng-add/files/bigquery/scripts/run_query.js.template +141 -0
  46. package/src/ng-add/files/bigquery/views/events_flat.sql.template +27 -12
  47. package/src/ng-add/files/bigquery/views/logs_latest.sql.template +16 -3
  48. package/src/ng-add/files/docs-infra/analytics-guide.md.template +270 -25
  49. package/src/ng-add/files/docs-infra/analytics-workbench-guide.md.template +307 -0
  50. package/src/ng-add/files/docs-infra/authentication-architecture.md.template +54 -24
  51. package/src/ng-add/files/docs-infra/email-infrastructure.md.template +43 -0
  52. package/src/ng-add/files/docs-infra/firestore-index-checker.md.template +87 -0
  53. package/src/ng-add/files/docs-infra/infrastructure-guide.md.template +108 -29
  54. package/src/ng-add/files/docs-infra/load-system-architecture.md.template +15 -1
  55. package/src/ng-add/files/docs-infra/querying-strategy.md.template +14 -0
  56. package/src/ng-add/files/docs-infra/stream-system-architecture.md.template +21 -7
  57. package/src/ng-add/files/eslint.config.js.template +22 -3
  58. package/src/ng-add/files/functions/package.json.template +1 -0
  59. package/src/ng-add/files/functions/src/email.ts.template +23 -0
  60. package/src/ng-add/files/jest.config.ts.template +3 -2
  61. package/src/ng-add/files/package.json.template +39 -16
  62. package/src/ng-add/files/projects/analytics/src/app/analytics-api.service.ts.template +130 -0
  63. package/src/ng-add/files/projects/analytics/src/app/app.component.html.template +77 -0
  64. package/src/ng-add/files/projects/analytics/src/app/app.component.scss.template +240 -0
  65. package/src/ng-add/files/projects/analytics/src/app/app.component.ts.template +96 -0
  66. package/src/ng-add/files/projects/analytics/src/app/app.routes.ts.template +11 -0
  67. package/src/ng-add/files/projects/analytics/src/app/dashboard-pages.spec.ts.template +151 -0
  68. package/src/ng-add/files/projects/analytics/src/app/data-quality/data-quality-page/data-quality-page.component.html.template +39 -0
  69. package/src/ng-add/files/projects/analytics/src/app/data-quality/data-quality-page/data-quality-page.component.scss.template +1 -0
  70. package/src/ng-add/files/projects/analytics/src/app/data-quality/data-quality-page/data-quality-page.component.ts.template +95 -0
  71. package/src/ng-add/files/projects/analytics/src/app/engagement/engagement-page/engagement-page.component.html.template +47 -0
  72. package/src/ng-add/files/projects/analytics/src/app/engagement/engagement-page/engagement-page.component.scss.template +1 -0
  73. package/src/ng-add/files/projects/analytics/src/app/engagement/engagement-page/engagement-page.component.ts.template +120 -0
  74. package/src/ng-add/files/projects/analytics/src/app/onboarding/onboarding-page/onboarding-page.component.html.template +40 -0
  75. package/src/ng-add/files/projects/analytics/src/app/onboarding/onboarding-page/onboarding-page.component.scss.template +1 -0
  76. package/src/ng-add/files/projects/analytics/src/app/onboarding/onboarding-page/onboarding-page.component.ts.template +98 -0
  77. package/src/ng-add/files/projects/analytics/src/app/overview/overview-page/overview-page.component.html.template +35 -0
  78. package/src/ng-add/files/projects/analytics/src/app/overview/overview-page/overview-page.component.scss.template +1 -0
  79. package/src/ng-add/files/projects/analytics/src/app/overview/overview-page/overview-page.component.ts.template +84 -0
  80. package/src/ng-add/files/projects/analytics/src/app/routes/routes-page/routes-page.component.html.template +42 -0
  81. package/src/ng-add/files/projects/analytics/src/app/routes/routes-page/routes-page.component.scss.template +1 -0
  82. package/src/ng-add/files/projects/analytics/src/app/routes/routes-page/routes-page.component.ts.template +110 -0
  83. package/src/ng-add/files/projects/analytics/src/app/shared/analytics-utils.ts.template +43 -0
  84. package/src/ng-add/files/projects/analytics/src/app/shared/chart-theme.ts.template +42 -0
  85. package/src/ng-add/files/projects/analytics/src/app/shared/dashboard-layout.scss.template +239 -0
  86. package/src/ng-add/files/projects/analytics/src/app/shared/dashboard-table/dashboard-table.component.html.template +76 -0
  87. package/src/ng-add/files/projects/analytics/src/app/shared/dashboard-table/dashboard-table.component.scss.template +128 -0
  88. package/src/ng-add/files/projects/analytics/src/app/shared/dashboard-table/dashboard-table.component.spec.ts.template +31 -0
  89. package/src/ng-add/files/projects/analytics/src/app/shared/dashboard-table/dashboard-table.component.ts.template +153 -0
  90. package/src/ng-add/files/projects/analytics/src/app/shared/funnel-chart/funnel-chart.component.html.template +16 -0
  91. package/src/ng-add/files/projects/analytics/src/app/shared/funnel-chart/funnel-chart.component.scss.template +63 -0
  92. package/src/ng-add/files/projects/analytics/src/app/shared/funnel-chart/funnel-chart.component.ts.template +52 -0
  93. package/src/ng-add/files/projects/analytics/src/app/shared/metric-card/metric-card.component.html.template +5 -0
  94. package/src/ng-add/files/projects/analytics/src/app/shared/metric-card/metric-card.component.scss.template +56 -0
  95. package/src/ng-add/files/projects/analytics/src/app/shared/metric-card/metric-card.component.spec.ts.template +30 -0
  96. package/src/ng-add/files/projects/analytics/src/app/shared/metric-card/metric-card.component.ts.template +15 -0
  97. package/src/ng-add/files/projects/analytics/src/app/shared/quality-chart/quality-chart.component.html.template +9 -0
  98. package/src/ng-add/files/projects/analytics/src/app/shared/quality-chart/quality-chart.component.scss.template +43 -0
  99. package/src/ng-add/files/projects/analytics/src/app/shared/quality-chart/quality-chart.component.ts.template +62 -0
  100. package/src/ng-add/files/projects/analytics/src/app/shared/route-distribution-chart/route-distribution-chart.component.html.template +9 -0
  101. package/src/ng-add/files/projects/analytics/src/app/shared/route-distribution-chart/route-distribution-chart.component.scss.template +33 -0
  102. package/src/ng-add/files/projects/analytics/src/app/shared/route-distribution-chart/route-distribution-chart.component.ts.template +82 -0
  103. package/src/ng-add/files/projects/analytics/src/app/shared/route-traffic-chart/route-traffic-chart.component.html.template +15 -0
  104. package/src/ng-add/files/projects/analytics/src/app/shared/route-traffic-chart/route-traffic-chart.component.scss.template +45 -0
  105. package/src/ng-add/files/projects/analytics/src/app/shared/route-traffic-chart/route-traffic-chart.component.ts.template +55 -0
  106. package/src/ng-add/files/projects/analytics/src/app/shared/status-message/status-message.component.html.template +18 -0
  107. package/src/ng-add/files/projects/analytics/src/app/shared/status-message/status-message.component.scss.template +45 -0
  108. package/src/ng-add/files/projects/analytics/src/app/shared/status-message/status-message.component.ts.template +15 -0
  109. package/src/ng-add/files/projects/analytics/src/app/vega-chart/vega-chart.component.ts.template +121 -0
  110. package/src/ng-add/files/projects/analytics/src/index.html.template +19 -0
  111. package/src/ng-add/files/projects/analytics/src/main.ts.template +16 -0
  112. package/src/ng-add/files/projects/analytics/src/styles.scss.template +28 -0
  113. package/src/ng-add/files/projects/analytics/tsconfig.app.json.template +13 -0
  114. package/src/ng-add/files/projects/analytics/tsconfig.spec.json.template +15 -0
  115. package/src/ng-add/files/src/app/admin/admin-panel/admin-panel.component.spec.ts.template +4 -5
  116. package/src/ng-add/files/src/app/admin/admin-panel/admin-settings/admin-settings.component.spec.ts.template +4 -5
  117. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-list.component.spec.ts.template +11 -12
  118. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-list.component.ts.template +7 -7
  119. 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
  120. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.component.ts.template +3 -2
  121. package/src/ng-add/files/src/app/app.component.html.template +1 -1
  122. package/src/ng-add/files/src/app/app.component.scss.template +1 -1
  123. package/src/ng-add/files/src/app/app.component.spec.ts.template +4 -5
  124. package/src/ng-add/files/src/app/app.component.ts.template +1 -2
  125. package/src/ng-add/files/src/app/app.config.ts.template +21 -15
  126. package/src/ng-add/files/src/app/auth-routing.spec.ts.template +4 -5
  127. package/src/ng-add/files/src/app/core/analytics/time-analytics.service.spec.ts.template +46 -29
  128. package/src/ng-add/files/src/app/core/analytics/time-analytics.service.ts.template +27 -18
  129. package/src/ng-add/files/src/app/core/auth/auth.providers.spec.ts.template +112 -0
  130. package/src/ng-add/files/src/app/core/auth/auth.providers.ts.template +48 -0
  131. package/src/ng-add/files/src/app/core/auth/auth.service.ts.template +9 -23
  132. package/src/ng-add/files/src/app/core/auth/guards/require-admin.guard.spec.ts.template +3 -14
  133. package/src/ng-add/files/src/app/core/firebase/data.providers.prod.ts.template +21 -0
  134. package/src/ng-add/files/src/app/core/firebase/data.providers.ts.template +13 -0
  135. package/src/ng-add/files/src/app/core/local-storage/session.service.spec.ts.template +43 -0
  136. package/src/ng-add/files/src/app/core/local-storage/session.service.ts.template +7 -0
  137. package/src/ng-add/files/src/app/core/store/app-data.spec.ts.template +76 -0
  138. package/src/ng-add/files/src/app/core/store/auth/auth.mock.ts.template +19 -67
  139. package/src/ng-add/files/src/app/core/store/auth/auth.store.spec.ts.template +102 -12
  140. package/src/ng-add/files/src/app/core/store/auth/auth.store.ts.template +32 -237
  141. package/src/ng-add/files/src/app/core/store/user/user.mock.ts.template +17 -12
  142. package/src/ng-add/files/src/app/core/store/user/user.model.ts.template +6 -7
  143. package/src/ng-add/files/src/app/core/store/user/user.store.ts.template +14 -10
  144. package/src/ng-add/files/src/app/core/store/user-context/user-context.mock.ts.template +20 -8
  145. package/src/ng-add/files/src/app/core/store/user-context/user-context.model.ts.template +5 -6
  146. package/src/ng-add/files/src/app/core/store/user-context/user-context.store.ts.template +14 -10
  147. package/src/ng-add/files/src/app/core/store/user-private/user-private.mock.ts.template +20 -7
  148. package/src/ng-add/files/src/app/core/store/user-private/user-private.model.ts.template +5 -6
  149. package/src/ng-add/files/src/app/core/store/user-private/user-private.store.ts.template +14 -10
  150. package/src/ng-add/files/src/app/core/testing/app-mocks.ts.template +42 -0
  151. package/src/ng-add/files/src/app/first-time/consent/consent.component.html.template +2 -1
  152. package/src/ng-add/files/src/app/first-time/consent/consent.component.scss.template +7 -3
  153. package/src/ng-add/files/src/app/first-time/consent/consent.component.spec.ts.template +31 -11
  154. package/src/ng-add/files/src/app/first-time/consent/consent.component.ts.template +16 -1
  155. package/src/ng-add/files/src/app/first-time/early-access/early-access.component.spec.ts.template +15 -15
  156. package/src/ng-add/files/src/app/first-time/early-access/early-access.component.ts.template +11 -3
  157. package/src/ng-add/files/src/app/first-time/early-access/survey-form/survey-form.component.html.template +2 -1
  158. package/src/ng-add/files/src/app/first-time/early-access/survey-form/survey-form.component.scss.template +7 -3
  159. package/src/ng-add/files/src/app/first-time/early-access/survey-form/survey-form.component.spec.ts.template +20 -6
  160. package/src/ng-add/files/src/app/first-time/early-access/survey-form/survey-form.component.ts.template +2 -0
  161. package/src/ng-add/files/src/app/first-time/early-access/waitlist-view/waitlist-view.component.spec.ts.template +4 -5
  162. package/src/ng-add/files/src/app/first-time/email-link/email-link.component.spec.ts.template +17 -1
  163. package/src/ng-add/files/src/app/first-time/email-link/email-link.component.ts.template +15 -0
  164. package/src/ng-add/files/src/app/first-time/first-time-routing.spec.ts.template +4 -5
  165. package/src/ng-add/files/src/app/first-time/landing/hero/hero.component.ts.template +15 -0
  166. package/src/ng-add/files/src/app/first-time/landing/landing.component.spec.ts.template +2 -0
  167. package/src/ng-add/files/src/app/first-time/login/login.component.spec.ts.template +21 -3
  168. package/src/ng-add/files/src/app/first-time/login/login.component.ts.template +26 -0
  169. package/src/ng-add/files/src/app/first-time/onboarding/onboarding.component.spec.ts.template +4 -2
  170. package/src/ng-add/files/src/app/first-time/onboarding/onboarding.component.ts.template +1 -1
  171. package/src/ng-add/files/src/app/main/account-profile/account-profile.component.spec.ts.template +2 -2
  172. package/src/ng-add/files/src/app/main/account-profile/delete-guest-card/delete-guest-card.component.spec.ts.template +2 -2
  173. package/src/ng-add/files/src/app/main/account-profile/profile-details-card/profile-details-card.component.spec.ts.template +4 -4
  174. package/src/ng-add/files/src/app/main/account-profile/sign-in-methods-card/sign-in-methods-card.component.spec.ts.template +2 -2
  175. package/src/ng-add/files/src/app/main/home/home.component.spec.ts.template +4 -5
  176. package/src/ng-add/files/src/app/main/home/home.component.ts.template +1 -1
  177. package/src/ng-add/files/src/app/shared/guest-warning-bar/guest-warning-bar.component.spec.ts.template +4 -4
  178. package/src/ng-add/files/src/app/shared/navbar/navbar.component.spec.ts.template +2 -2
  179. package/src/ng-add/files/tsconfig.spec.json.template +3 -1
  180. package/src/ng-add/index.js +7 -0
  181. package/src/ng-add/index.js.map +1 -1
  182. package/src/shared/entity-registry.d.ts +8 -0
  183. package/src/shared/entity-registry.js +28 -0
  184. package/src/shared/entity-registry.js.map +1 -0
  185. package/.agents/skills/publish-npm/SKILL.md +0 -37
  186. package/.agents/skills/publish-npm/eval.yaml +0 -32
  187. package/.agents/skills/publish-npm/fixtures/package-v21.json.template +0 -8
  188. package/.husky/commit-msg +0 -1
  189. package/.husky/pre-commit +0 -1
  190. package/.t4g/agent-memory.db +0 -0
  191. package/src/component/index_spec.d.ts +0 -1
  192. package/src/component/index_spec.js +0 -68
  193. package/src/component/index_spec.js.map +0 -1
  194. package/src/entity/index_spec.d.ts +0 -1
  195. package/src/entity/index_spec.js +0 -153
  196. package/src/entity/index_spec.js.map +0 -1
  197. package/src/guard/index_spec.d.ts +0 -1
  198. package/src/guard/index_spec.js +0 -64
  199. package/src/guard/index_spec.js.map +0 -1
  200. package/src/ng-add/files/bigquery/scripts/export_entities.py.template +0 -143
  201. package/src/ng-add/files/bigquery/scripts/run_query.py.template +0 -167
  202. package/src/ng-add/files/src/app/core/firebase/cached-listeners.service.ts.template +0 -500
  203. package/src/ng-add/files/src/app/core/firebase/database.service.ts.template +0 -73
  204. package/src/ng-add/files/src/app/core/firebase/email-link-context.service.spec.ts.template +0 -59
  205. package/src/ng-add/files/src/app/core/firebase/email-link-context.service.ts.template +0 -147
  206. package/src/ng-add/files/src/app/core/firebase/firebase.mock.service.ts.template +0 -453
  207. package/src/ng-add/files/src/app/core/firebase/firebase.service.spec.ts.template +0 -116
  208. package/src/ng-add/files/src/app/core/firebase/firebase.service.ts.template +0 -639
  209. package/src/ng-add/files/src/app/core/firebase/simulate-load.spec.ts.template +0 -104
  210. package/src/ng-add/files/src/app/core/firebase/simulate-stream.spec.ts.template +0 -127
  211. package/src/ng-add/files/src/app/core/firebase/simulation.mock.ts.template +0 -38
  212. package/src/ng-add/files/src/app/core/firebase/stream-multiplexer.ts.template +0 -445
  213. package/src/ng-add/files/src/app/core/logging/logging.service.spec.ts.template +0 -118
  214. package/src/ng-add/files/src/app/core/logging/logging.service.ts.template +0 -168
  215. package/src/ng-add/files/src/app/core/store/app.model.ts.template +0 -21
  216. package/src/ng-add/files/src/app/core/store/app.store.spec.ts.template +0 -920
  217. package/src/ng-add/files/src/app/core/store/app.store.ts.template +0 -1320
  218. package/src/ng-add/files/src/app/core/store/batch-write.firebase.service.ts.template +0 -58
  219. package/src/ng-add/files/src/app/core/store/batch-write.mock.service.ts.template +0 -105
  220. package/src/ng-add/files/src/app/core/store/batch-write.service.ts.template +0 -126
  221. package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.component.html.template +0 -9
  222. package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.component.scss.template +0 -46
  223. package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.component.spec.ts.template +0 -69
  224. package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.component.ts.template +0 -39
  225. package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.service.spec.ts.template +0 -122
  226. package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.service.ts.template +0 -88
  227. package/src/ng-add/index_spec.d.ts +0 -1
  228. package/src/ng-add/index_spec.js +0 -108
  229. package/src/ng-add/index_spec.js.map +0 -1
@@ -5,6 +5,7 @@ import { MatButtonModule } from '@angular/material/button';
5
5
  import { MatFormFieldModule } from '@angular/material/form-field';
6
6
  import { MatInputModule } from '@angular/material/input';
7
7
  import { AuthStore } from 'src/app/core/store/auth/auth.store';
8
+ import { TimeAnalyticsService } from 'src/app/core/analytics/time-analytics.service';
8
9
 
9
10
  /**
10
11
  * Handles the completion phase of email magic-link authentication (`/email-link`).
@@ -23,6 +24,7 @@ import { AuthStore } from 'src/app/core/store/auth/auth.store';
23
24
  export class EmailLinkComponent implements OnInit {
24
25
  private readonly authStore = inject(AuthStore);
25
26
  private readonly router = inject(Router);
27
+ private readonly analytics = inject(TimeAnalyticsService);
26
28
  private readonly storedEmail = this.authStore.getStoredEmailForEmailLink();
27
29
 
28
30
  /** User-facing status or error message. */
@@ -59,11 +61,24 @@ export class EmailLinkComponent implements OnInit {
59
61
  private async completeWith(email: string): Promise<void> {
60
62
  this.isSubmitting.set(true);
61
63
  this.message.set(null);
64
+ this.analytics.trackInteraction('onboarding', 'auth_attempt', {
65
+ method: 'email_link_complete',
66
+ });
62
67
  try {
63
68
  await this.authStore.completeEmailSignInLink(window.location.href, email);
69
+ this.analytics.trackInteraction('onboarding', 'auth_result', {
70
+ method: 'email_link_complete',
71
+ outcome: 'success',
72
+ authenticatedUserId: this.authStore.user()?.__id,
73
+ accessState: this.authStore.user()?.accessState,
74
+ });
64
75
  await this.router.navigate(['/home']);
65
76
  } catch (error) {
66
77
  const code = (error as { code?: string }).code;
78
+ this.analytics.trackInteraction('onboarding', 'auth_result', {
79
+ method: 'email_link_complete',
80
+ outcome: 'error',
81
+ });
67
82
  this.message.set(
68
83
  code === 'auth/link-requires-original-session' ?
69
84
  'Return to the browser where you started this account upgrade to save that guest progress.' :
@@ -5,10 +5,9 @@ import { AuthService } from '../core/auth/auth.service';
5
5
  import { routes } from '../app.routes';
6
6
  import { of } from 'rxjs';
7
7
  import { AccessState, User } from '../core/store/user/user.model';
8
- import { DATABASE_SERVICE } from '../core/firebase/database.service';
9
- import { FirebaseMockService } from '../core/firebase/firebase.mock.service';
10
- import { BatchWriteMockService } from '../core/store/batch-write.mock.service';
11
- import { BATCH_WRITE_SERVICE } from '../core/store/batch-write.service';
8
+ import { provideAppMocks } from 'src/app/core/testing/app-mocks';
9
+ import { BatchWriteMockService } from '@tech4good/platform-data/testing';
10
+ import { BATCH_WRITE_SERVICE } from '@tech4good/platform-data';
12
11
  import { LOG_SERVICE, LogInDevService } from '../core/analytics/log.service';
13
12
  import { AuthStore } from '../core/store/auth/auth.store';
14
13
  import { signal } from '@angular/core';
@@ -34,7 +33,7 @@ describe('First-Time / Onboarding Routing', () => {
34
33
  provideRouter(routes),
35
34
  { provide: AuthService, useValue: mockAuthService },
36
35
  { provide: AuthStore, useValue: { user: mockUserSignal, afUser: mockAfUserSignal } },
37
- { provide: DATABASE_SERVICE, useClass: FirebaseMockService },
36
+ ...provideAppMocks(),
38
37
  { provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
39
38
  { provide: LOG_SERVICE, useClass: LogInDevService },
40
39
  ],
@@ -2,6 +2,7 @@ import { Component, ChangeDetectionStrategy, inject, input, signal } from '@angu
2
2
  import { Router } from '@angular/router';
3
3
  import { RotatingQuotesComponent } from '../rotating-quotes/rotating-quotes.component';
4
4
  import { AuthStore } from 'src/app/core/store/auth/auth.store';
5
+ import { TimeAnalyticsService } from 'src/app/core/analytics/time-analytics.service';
5
6
 
6
7
  @Component({
7
8
  selector: 'app-hero',
@@ -13,6 +14,7 @@ import { AuthStore } from 'src/app/core/store/auth/auth.store';
13
14
  export class HeroComponent {
14
15
  private readonly authStore = inject(AuthStore);
15
16
  private readonly router = inject(Router);
17
+ private readonly analytics = inject(TimeAnalyticsService);
16
18
 
17
19
  readonly sentences = [
18
20
  'First generic placeholder quote.',
@@ -33,11 +35,24 @@ export class HeroComponent {
33
35
  async tryWithoutLoggingIn() {
34
36
  if (this.isGuestLoading()) return;
35
37
  this.isGuestLoading.set(true);
38
+ this.analytics.trackInteraction('onboarding', 'auth_attempt', {
39
+ method: 'guest',
40
+ });
36
41
  try {
37
42
  await this.authStore.loginAnonymously();
43
+ this.analytics.trackInteraction('onboarding', 'auth_result', {
44
+ method: 'guest',
45
+ outcome: 'success',
46
+ authenticatedUserId: this.authStore.user()?.__id,
47
+ accessState: this.authStore.user()?.accessState,
48
+ });
38
49
  await this.router.navigate(['/home']);
39
50
  } catch (error) {
40
51
  console.error('[HeroComponent] Guest login failed:', error);
52
+ this.analytics.trackInteraction('onboarding', 'auth_result', {
53
+ method: 'guest',
54
+ outcome: 'error',
55
+ });
41
56
  this.isGuestLoading.set(false);
42
57
  }
43
58
  }
@@ -6,6 +6,7 @@ import { provideRouter, Router } from '@angular/router';
6
6
  import { LandingComponent } from './landing.component';
7
7
  import { AuthStore } from 'src/app/core/store/auth/auth.store';
8
8
  import { AuthMockDB } from 'src/app/core/store/auth/auth.mock';
9
+ import { TimeAnalyticsService } from 'src/app/core/analytics/time-analytics.service';
9
10
 
10
11
  /** Sets up the testing environment for LandingComponent using render. */
11
12
  async function setup(providers: Provider[] = []) {
@@ -18,6 +19,7 @@ async function setup(providers: Provider[] = []) {
18
19
  { path: 'home', component: LandingComponent },
19
20
  ]),
20
21
  { provide: AuthStore, useClass: AuthMockDB },
22
+ { provide: TimeAnalyticsService, useValue: { trackInteraction: jest.fn() } },
21
23
  ...providers,
22
24
  ],
23
25
  });
@@ -5,18 +5,30 @@ import { Provider } from '@angular/core';
5
5
  import { LoginComponent } from './login.component';
6
6
  import { AuthStore } from 'src/app/core/store/auth/auth.store';
7
7
  import { AuthMockDB } from 'src/app/core/store/auth/auth.mock';
8
+ import { TimeAnalyticsService } from 'src/app/core/analytics/time-analytics.service';
9
+ import { AccessState } from 'src/app/core/store/user/user.model';
8
10
 
9
11
  async function setup(providers: Provider[] = []) {
10
12
  const user = userEvent.setup();
13
+ const analytics = { trackInteraction: jest.fn() };
11
14
  const view = await render(LoginComponent, {
12
- providers: [provideRouter([]), { provide: AuthStore, useClass: AuthMockDB }, ...providers],
15
+ providers: [
16
+ provideRouter([]),
17
+ { provide: AuthStore, useClass: AuthMockDB },
18
+ { provide: TimeAnalyticsService, useValue: analytics },
19
+ ...providers,
20
+ ],
13
21
  });
14
- return { user, authStore: view.fixture.debugElement.injector.get(AuthStore) };
22
+ return {
23
+ user,
24
+ authStore: view.fixture.debugElement.injector.get(AuthStore),
25
+ analytics: view.fixture.debugElement.injector.get(TimeAnalyticsService),
26
+ };
15
27
  }
16
28
 
17
29
  describe('LoginComponent', () => {
18
30
  it('offers an email magic link first and Google beneath it', async () => {
19
- const { user, authStore } = await setup();
31
+ const { user, authStore, analytics } = await setup();
20
32
  expect(screen.getByRole('button', { name: /send me a magic link/i })).toBeVisible();
21
33
  expect(screen.getByRole('button', { name: /continue with google/i })).toBeVisible();
22
34
  expect(screen.queryByLabelText('Password')).not.toBeInTheDocument();
@@ -24,6 +36,12 @@ describe('LoginComponent', () => {
24
36
  const googleSpy = jest.spyOn(authStore, 'signInWithGoogle');
25
37
  await user.click(screen.getByRole('button', { name: /continue with google/i }));
26
38
  expect(googleSpy).toHaveBeenCalled();
39
+ expect(analytics.trackInteraction).toHaveBeenCalledWith('onboarding', 'auth_result', {
40
+ method: 'google',
41
+ outcome: 'success',
42
+ authenticatedUserId: '1',
43
+ accessState: AccessState.DONE,
44
+ });
27
45
  });
28
46
 
29
47
  it('sends a magic link and confirms the destination email', async () => {
@@ -6,6 +6,7 @@ import { MatInputModule } from '@angular/material/input';
6
6
  import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
7
7
  import { Router } from '@angular/router';
8
8
  import { AuthStore } from 'src/app/core/store/auth/auth.store';
9
+ import { TimeAnalyticsService } from 'src/app/core/analytics/time-analytics.service';
9
10
 
10
11
  @Component({
11
12
  selector: 'app-login',
@@ -17,6 +18,7 @@ import { AuthStore } from 'src/app/core/store/auth/auth.store';
17
18
  export class LoginComponent {
18
19
  readonly authStore = inject(AuthStore);
19
20
  private readonly router = inject(Router);
21
+ private readonly analytics = inject(TimeAnalyticsService);
20
22
  readonly message = signal<string | null>(null);
21
23
  readonly sentEmail = signal(false);
22
24
  readonly isSendingMagicLink = signal(false);
@@ -38,10 +40,21 @@ export class LoginComponent {
38
40
  await submit(this.form, async () => {
39
41
  this.message.set(null);
40
42
  this.isSendingMagicLink.set(true);
43
+ this.analytics.trackInteraction('onboarding', 'auth_attempt', {
44
+ method: 'email_link',
45
+ });
41
46
  try {
42
47
  await this.authStore.sendEmailSignInLink(this.loginModel().email);
48
+ this.analytics.trackInteraction('onboarding', 'auth_result', {
49
+ method: 'email_link',
50
+ outcome: 'link_sent',
51
+ });
43
52
  this.sentEmail.set(true);
44
53
  } catch {
54
+ this.analytics.trackInteraction('onboarding', 'auth_result', {
55
+ method: 'email_link',
56
+ outcome: 'error',
57
+ });
45
58
  this.message.set('We could not send a sign-in link. Please try again.');
46
59
  } finally {
47
60
  this.isSendingMagicLink.set(false);
@@ -53,11 +66,24 @@ export class LoginComponent {
53
66
  if (this.isLoading()) return;
54
67
  this.message.set(null);
55
68
  this.isSigningInGoogle.set(true);
69
+ this.analytics.trackInteraction('onboarding', 'auth_attempt', {
70
+ method: 'google',
71
+ });
56
72
  try {
57
73
  await this.authStore.signInWithGoogle();
74
+ this.analytics.trackInteraction('onboarding', 'auth_result', {
75
+ method: 'google',
76
+ outcome: 'success',
77
+ authenticatedUserId: this.authStore.user()?.__id,
78
+ accessState: this.authStore.user()?.accessState,
79
+ });
58
80
  await this.router.navigate(['/home']);
59
81
  } catch (error) {
60
82
  const code = (error as { code?: string }).code;
83
+ this.analytics.trackInteraction('onboarding', 'auth_result', {
84
+ method: 'google',
85
+ outcome: code === 'auth/popup-closed-by-user' ? 'cancelled' : 'error',
86
+ });
61
87
  if (code === 'auth/account-exists-with-different-credential') {
62
88
  this.message.set(
63
89
  'Sign in with an email link first, then use Link Google from your account page.',
@@ -1,17 +1,19 @@
1
+ import { provideAppMocks } from 'src/app/core/testing/app-mocks';
1
2
  import { render } from '@testing-library/angular';
2
3
  import { Provider } from '@angular/core';
3
4
 
4
5
  import { OnboardingComponent } from './onboarding.component';
5
6
  import { AuthStore } from 'src/app/core/store/auth/auth.store';
6
7
  import { AuthLoggedInMockDB } from 'src/app/core/store/auth/auth.mock';
7
- import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
8
- import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
8
+ import { BATCH_WRITE_SERVICE } from '@tech4good/platform-data';
9
+ import { BatchWriteMockService } from '@tech4good/platform-data/testing';
9
10
 
10
11
  /** Sets up the testing environment for OnboardingComponent using render. */
11
12
  async function setup(providers: Provider[] = []) {
12
13
  const view = await render(OnboardingComponent, {
13
14
  imports: [],
14
15
  providers: [
16
+ ...provideAppMocks({ disableLatency: true }),
15
17
  { provide: AuthStore, useClass: AuthLoggedInMockDB },
16
18
  { provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
17
19
  ...providers,
@@ -1,7 +1,7 @@
1
1
  import { Component, OnInit, ChangeDetectionStrategy, input, output, inject, WritableSignal, Signal, signal, computed, Inject, Injector } from '@angular/core';
2
2
  import { User } from 'src/app/core/store/user/user.model';
3
3
  import { AuthStore } from 'src/app/core/store/auth/auth.store';
4
- import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
4
+ import { BatchWriteService, BATCH_WRITE_SERVICE } from '@tech4good/platform-data';
5
5
 
6
6
  @Component({
7
7
  selector: 'app-onboarding',
@@ -4,7 +4,7 @@ import { provideRouter } from '@angular/router';
4
4
  import { render, screen } from '@testing-library/angular';
5
5
  import userEvent from '@testing-library/user-event';
6
6
  import { of } from 'rxjs';
7
- import { provideFirebaseMock } from 'src/app/core/firebase/firebase.mock.service';
7
+ import { provideAppMocks } from 'src/app/core/testing/app-mocks';
8
8
  import { AuthLoggedInMockDB } from 'src/app/core/store/auth/auth.mock';
9
9
  import { AuthStore } from 'src/app/core/store/auth/auth.store';
10
10
  import { USER_DB } from 'src/app/core/store/user/user.mock';
@@ -39,7 +39,7 @@ async function setup(options: { guest?: boolean; dialogResult?: unknown } = {})
39
39
  useClass: options.guest ? GuestAuthMockDB : AuthLoggedInMockDB,
40
40
  },
41
41
  { provide: MatDialog, useValue: dialog },
42
- ...provideFirebaseMock({ disableLatency: true }),
42
+ ...provideAppMocks({ disableLatency: true }),
43
43
  ],
44
44
  });
45
45
 
@@ -3,7 +3,7 @@ import { MatDialog } from '@angular/material/dialog';
3
3
  import { render, screen } from '@testing-library/angular';
4
4
  import userEvent from '@testing-library/user-event';
5
5
  import { of } from 'rxjs';
6
- import { provideFirebaseMock } from 'src/app/core/firebase/firebase.mock.service';
6
+ import { provideAppMocks } from 'src/app/core/testing/app-mocks';
7
7
  import { AuthLoggedInMockDB } from 'src/app/core/store/auth/auth.mock';
8
8
  import { AuthStore } from 'src/app/core/store/auth/auth.store';
9
9
  import { USER_DB } from 'src/app/core/store/user/user.mock';
@@ -33,7 +33,7 @@ async function setup(dialogResult: unknown, onSaveProgress = jest.fn()) {
33
33
  providers: [
34
34
  { provide: AuthStore, useClass: GuestAuthMockDB },
35
35
  { provide: MatDialog, useValue: dialog },
36
- ...provideFirebaseMock({ disableLatency: true }),
36
+ ...provideAppMocks({ disableLatency: true }),
37
37
  ],
38
38
  on: { saveProgressRequested: onSaveProgress },
39
39
  });
@@ -1,7 +1,7 @@
1
1
  import { Injectable, signal } from '@angular/core';
2
2
  import { render, screen } from '@testing-library/angular';
3
3
  import userEvent from '@testing-library/user-event';
4
- import { provideFirebaseMock } from 'src/app/core/firebase/firebase.mock.service';
4
+ import { provideAppMocks } from 'src/app/core/testing/app-mocks';
5
5
  import { AuthLoggedInMockDB } from 'src/app/core/store/auth/auth.mock';
6
6
  import { AuthStore } from 'src/app/core/store/auth/auth.store';
7
7
  import { USER_DB } from 'src/app/core/store/user/user.mock';
@@ -13,7 +13,7 @@ async function setup(authStore = AuthLoggedInMockDB) {
13
13
  const view = await render(ProfileDetailsCardComponent, {
14
14
  providers: [
15
15
  { provide: AuthStore, useClass: authStore },
16
- ...provideFirebaseMock({ disableLatency: true }),
16
+ ...provideAppMocks({ disableLatency: true }),
17
17
  ],
18
18
  });
19
19
  const userStore = view.fixture.debugElement.injector.get(UserStore);
@@ -29,12 +29,12 @@ describe('ProfileDetailsCardComponent', () => {
29
29
 
30
30
  expect(screen.getByText('Admin')).toBeVisible();
31
31
  await user.clear(nameInput);
32
- await user.type(nameInput, 'New Trainer Name');
32
+ await user.type(nameInput, 'New Display Name');
33
33
  await user.click(screen.getByRole('button', { name: /Save profile/i }));
34
34
 
35
35
  expect(updateSpy).toHaveBeenCalledWith(
36
36
  USER_DB[0].__id,
37
- { name: 'New Trainer Name' },
37
+ { name: 'New Display Name' },
38
38
  expect.any(Object),
39
39
  );
40
40
  expect(await screen.findByRole('status')).toHaveTextContent(/Profile updated successfully/i);
@@ -1,7 +1,7 @@
1
1
  import { Injectable, signal, Type } from '@angular/core';
2
2
  import { render, screen } from '@testing-library/angular';
3
3
  import userEvent from '@testing-library/user-event';
4
- import { provideFirebaseMock } from 'src/app/core/firebase/firebase.mock.service';
4
+ import { provideAppMocks } from 'src/app/core/testing/app-mocks';
5
5
  import { AuthLoggedInMockDB } from 'src/app/core/store/auth/auth.mock';
6
6
  import { AuthStore } from 'src/app/core/store/auth/auth.store';
7
7
  import { USER_DB } from 'src/app/core/store/user/user.mock';
@@ -27,7 +27,7 @@ async function setup(authStore: Type<AuthStore> = AuthLoggedInMockDB) {
27
27
  const view = await render(SignInMethodsCardComponent, {
28
28
  providers: [
29
29
  { provide: AuthStore, useClass: authStore },
30
- ...provideFirebaseMock({ disableLatency: true }),
30
+ ...provideAppMocks({ disableLatency: true }),
31
31
  ],
32
32
  });
33
33
  const auth = view.fixture.debugElement.injector.get(AuthStore);
@@ -2,10 +2,9 @@ import { render } from '@testing-library/angular';
2
2
  import userEvent from '@testing-library/user-event';
3
3
 
4
4
  import { HomeComponent } from './home.component';
5
- import { DATABASE_SERVICE } from 'src/app/core/firebase/database.service';
6
- import { FirebaseMockService } from 'src/app/core/firebase/firebase.mock.service';
7
- import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
8
- import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
5
+ import { provideAppMocks } from 'src/app/core/testing/app-mocks';
6
+ import { BatchWriteMockService } from '@tech4good/platform-data/testing';
7
+ import { BATCH_WRITE_SERVICE } from '@tech4good/platform-data';
9
8
 
10
9
  /** Sets up the testing environment for HomeComponent using render. */
11
10
  async function setup() {
@@ -15,7 +14,7 @@ async function setup() {
15
14
  const view = await render(HomeComponent, {
16
15
  imports: [],
17
16
  providers: [
18
- { provide: DATABASE_SERVICE, useClass: FirebaseMockService },
17
+ ...provideAppMocks(),
19
18
  { provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
20
19
  ],
21
20
  componentInputs: {},
@@ -1,7 +1,7 @@
1
1
  import { Component, OnInit, ChangeDetectionStrategy, input, output, inject, WritableSignal, Signal, signal, computed, Inject, Injector } from '@angular/core';
2
2
  import { User } from 'src/app/core/store/user/user.model';
3
3
  import { AuthStore } from 'src/app/core/store/auth/auth.store';
4
- import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
4
+ import { BatchWriteService, BATCH_WRITE_SERVICE } from '@tech4good/platform-data';
5
5
  import { NavbarComponent } from 'src/app/shared/navbar/navbar.component';
6
6
 
7
7
  @Component({
@@ -1,7 +1,7 @@
1
1
  import { render, screen } from '@testing-library/angular';
2
2
  import { Injectable, signal } from '@angular/core';
3
3
  import { provideRouter } from '@angular/router';
4
- import { provideFirebaseMock } from 'src/app/core/firebase/firebase.mock.service';
4
+ import { provideAppMocks } from 'src/app/core/testing/app-mocks';
5
5
  import { GuestWarningBarComponent } from './guest-warning-bar.component';
6
6
  import { AuthStore } from 'src/app/core/store/auth/auth.store';
7
7
  import { AuthMockDB, AuthLoggedInMockDB } from 'src/app/core/store/auth/auth.mock';
@@ -12,7 +12,7 @@ describe('GuestWarningBarComponent', () => {
12
12
  providers: [
13
13
  provideRouter([]),
14
14
  { provide: AuthStore, useClass: AuthMockDB },
15
- ...provideFirebaseMock({ disableLatency: true }),
15
+ ...provideAppMocks({ disableLatency: true }),
16
16
  ],
17
17
  });
18
18
  expect(screen.queryByText(/Guest Account:/i)).toBeNull();
@@ -23,7 +23,7 @@ describe('GuestWarningBarComponent', () => {
23
23
  providers: [
24
24
  provideRouter([]),
25
25
  { provide: AuthStore, useClass: AuthLoggedInMockDB },
26
- ...provideFirebaseMock({ disableLatency: true }),
26
+ ...provideAppMocks({ disableLatency: true }),
27
27
  ],
28
28
  });
29
29
  expect(screen.queryByText(/Guest Account:/i)).toBeNull();
@@ -48,7 +48,7 @@ describe('GuestWarningBarComponent', () => {
48
48
  providers: [
49
49
  provideRouter([]),
50
50
  { provide: AuthStore, useClass: AnonymousAuthMockDB },
51
- ...provideFirebaseMock({ disableLatency: true }),
51
+ ...provideAppMocks({ disableLatency: true }),
52
52
  ],
53
53
  });
54
54
 
@@ -2,7 +2,7 @@ import { render, screen } from '@testing-library/angular';
2
2
  import userEvent from '@testing-library/user-event';
3
3
  import { Injectable, Provider, signal } from '@angular/core';
4
4
  import { provideRouter } from '@angular/router';
5
- import { provideFirebaseMock } from 'src/app/core/firebase/firebase.mock.service';
5
+ import { provideAppMocks } from 'src/app/core/testing/app-mocks';
6
6
 
7
7
  import { NavbarComponent } from './navbar.component';
8
8
  import { AuthStore } from 'src/app/core/store/auth/auth.store';
@@ -17,7 +17,7 @@ async function setup(providers: Provider[] = []) {
17
17
  providers: [
18
18
  provideRouter([]),
19
19
  { provide: AuthStore, useClass: AuthMockDB },
20
- ...provideFirebaseMock({ disableLatency: true }),
20
+ ...provideAppMocks({ disableLatency: true }),
21
21
  ...providers,
22
22
  ],
23
23
  });
@@ -15,6 +15,8 @@
15
15
  },
16
16
  "include": [
17
17
  "src/**/*.spec.ts",
18
- "src/**/*.d.ts"
18
+ "src/**/*.d.ts",
19
+ "projects/analytics/src/**/*.spec.ts",
20
+ "projects/analytics/src/**/*.d.ts"
19
21
  ]
20
22
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ngAdd = ngAdd;
4
+ const tslib_1 = require("tslib");
4
5
  const schematics_1 = require("@angular-devkit/schematics");
5
6
  //import { InsertChange } from '@schematics/angular/utility/change';
6
7
  //import { buildRelativePath, findModuleFromOptions } from '@schematics/angular/utility/find-module';
@@ -8,6 +9,10 @@ const schematics_1 = require("@angular-devkit/schematics");
8
9
  //import { validateHtmlSelector } from '@schematics/angular/utility/validation';
9
10
  const workspace_1 = require("@schematics/angular/utility/workspace");
10
11
  const core_1 = require("@angular-devkit/core");
12
+ const fs_1 = require("fs");
13
+ const path = tslib_1.__importStar(require("path"));
14
+ const entity_registry_1 = require("../shared/entity-registry");
15
+ const schematicsVersion = JSON.parse((0, fs_1.readFileSync)(path.join(__dirname, '../../package.json'), 'utf8')).version;
11
16
  //import { getSourceText, simpleInsert } from '../shared/statements-adder';
12
17
  function ngAdd(options) {
13
18
  return async (tree, context) => {
@@ -30,6 +35,7 @@ function ngAdd(options) {
30
35
  const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
31
36
  (0, schematics_1.applyTemplates)({
32
37
  ...core_1.strings,
38
+ schematicsVersion,
33
39
  ...options,
34
40
  }),
35
41
  //move(parsedPath.path),
@@ -54,6 +60,7 @@ function ngAdd(options) {
54
60
  return tree;
55
61
  },
56
62
  (0, schematics_1.mergeWith)(templateSource, schematics_1.MergeStrategy.Overwrite),
63
+ (0, entity_registry_1.updateEntityRegistry)(),
57
64
  ]);
58
65
  };
59
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAeA,sBAsDC;AArED,2DAIoC;AACpC,oEAAoE;AACpE,qGAAqG;AACrG,qEAAqE;AACrE,gFAAgF;AAChF,qEAAuF;AAEvF,+CAA+C;AAE/C,2EAA2E;AAE3E,SAAgB,KAAK,CAAC,OAAY;IAChC,OAAO,KAAK,EAAE,IAAU,EAAE,OAAyB,EAAE,EAAE;QAErD,wFAAwF;QACxF,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACrB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,iIAAiI,CAAC,CAAC;YACvJ,OAAO,IAAA,iBAAI,GAAE,CAAC;QAChB,CAAC;QAED,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3D,MAAM,SAAS,GAAG,MAAM,IAAA,wBAAY,EAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,OAAiB,CAAC,CAAC;QAElE,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,gCAAmB,CAAC,YAAY,OAAO,CAAC,OAAO,mBAAmB,CAAC,CAAC;QAChF,CAAC;QAED,OAAO,CAAC,IAAI,GAAG,IAAA,4BAAgB,EAAC,OAAO,CAAC,CAAC;QACzC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAErD,qEAAqE;QACrE,iCAAiC;QACjC,iCAAiC;QAEjC,MAAM,cAAc,GAAG,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,SAAS,CAAC,EAAE;YAC3C,IAAA,2BAAc,EAAC;gBACb,GAAG,cAAO;gBACV,GAAG,OAAO;aACX,CAAC;YACF,wBAAwB;SACzB,CAAC,CAAC;QAEH,OAAO,IAAA,kBAAK,EAAC;YACX,iFAAiF;YACjF,2EAA2E;YAC3E,wFAAwF;YACxF,CAAC,IAAU,EAAE,EAAE;gBACb,MAAM,eAAe,GAAG;oBACtB,gBAAgB;oBAChB,kBAAkB;oBAClB,kBAAkB;oBAClB,qBAAqB;iBACtB,CAAC;gBACF,KAAK,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC;oBACnC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;wBACtB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;wBAClB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,6BAA6B,IAAI,EAAE,CAAC,CAAC;oBAC3D,CAAC;gBACH,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;YACD,IAAA,sBAAS,EAAC,cAAc,EAAE,0BAAa,CAAC,SAAS,CAAC;SACnD,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAsBA,sBAwDC;;AA9ED,2DAIoC;AACpC,oEAAoE;AACpE,qGAAqG;AACrG,qEAAqE;AACrE,gFAAgF;AAChF,qEAAuF;AAEvF,+CAA+C;AAC/C,2BAAkC;AAClC,mDAA6B;AAC7B,+DAAiE;AAEjE,MAAM,iBAAiB,GAAW,IAAI,CAAC,KAAK,CAC1C,IAAA,iBAAY,EAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,EAAE,MAAM,CAAC,CACjE,CAAC,OAAO,CAAC;AAEV,2EAA2E;AAE3E,SAAgB,KAAK,CAAC,OAAY;IAChC,OAAO,KAAK,EAAE,IAAU,EAAE,OAAyB,EAAE,EAAE;QAErD,wFAAwF;QACxF,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACrB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,iIAAiI,CAAC,CAAC;YACvJ,OAAO,IAAA,iBAAI,GAAE,CAAC;QAChB,CAAC;QAED,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3D,MAAM,SAAS,GAAG,MAAM,IAAA,wBAAY,EAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,OAAiB,CAAC,CAAC;QAElE,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,gCAAmB,CAAC,YAAY,OAAO,CAAC,OAAO,mBAAmB,CAAC,CAAC;QAChF,CAAC;QAED,OAAO,CAAC,IAAI,GAAG,IAAA,4BAAgB,EAAC,OAAO,CAAC,CAAC;QACzC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAErD,qEAAqE;QACrE,iCAAiC;QACjC,iCAAiC;QAEjC,MAAM,cAAc,GAAG,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,SAAS,CAAC,EAAE;YAC3C,IAAA,2BAAc,EAAC;gBACb,GAAG,cAAO;gBACV,iBAAiB;gBACjB,GAAG,OAAO;aACX,CAAC;YACF,wBAAwB;SACzB,CAAC,CAAC;QAEH,OAAO,IAAA,kBAAK,EAAC;YACX,iFAAiF;YACjF,2EAA2E;YAC3E,wFAAwF;YACxF,CAAC,IAAU,EAAE,EAAE;gBACb,MAAM,eAAe,GAAG;oBACtB,gBAAgB;oBAChB,kBAAkB;oBAClB,kBAAkB;oBAClB,qBAAqB;iBACtB,CAAC;gBACF,KAAK,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC;oBACnC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;wBACtB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;wBAClB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,6BAA6B,IAAI,EAAE,CAAC,CAAC;oBAC3D,CAAC;gBACH,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;YACD,IAAA,sBAAS,EAAC,cAAc,EAAE,0BAAa,CAAC,SAAS,CAAC;YAClD,IAAA,sCAAoB,GAAE;SACvB,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ /**
3
+ * Refresh app registries after ng-add/entity templates merge into the virtual Tree.
4
+ * Read the Tree instead of disk because newly generated files are not written yet.
5
+ * Both schematics and the development CLI use the tooling package's same discovery
6
+ * rules; only this integration is responsible for applying results to a Tree.
7
+ */
8
+ export declare function updateEntityRegistry(): Rule;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateEntityRegistry = updateEntityRegistry;
4
+ const platform_tooling_1 = require("@tech4good/platform-tooling");
5
+ /**
6
+ * Refresh app registries after ng-add/entity templates merge into the virtual Tree.
7
+ * Read the Tree instead of disk because newly generated files are not written yet.
8
+ * Both schematics and the development CLI use the tooling package's same discovery
9
+ * rules; only this integration is responsible for applying results to a Tree.
10
+ */
11
+ function updateEntityRegistry() {
12
+ return (tree) => {
13
+ const sources = {};
14
+ tree.visit(file => {
15
+ if (/\.(model|mock)\.ts$/.test(file))
16
+ sources[file] = tree.read(file).toString();
17
+ });
18
+ const result = (0, platform_tooling_1.generateEntityRegistrySources)(sources);
19
+ for (const [file, source] of Object.entries(result.files)) {
20
+ if (tree.exists(file))
21
+ tree.overwrite(file, source);
22
+ else
23
+ tree.create(file, source);
24
+ }
25
+ return tree;
26
+ };
27
+ }
28
+ //# sourceMappingURL=entity-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-registry.js","sourceRoot":"","sources":["entity-registry.ts"],"names":[],"mappings":";;AASA,oDAaC;AArBD,kEAA4E;AAE5E;;;;;GAKG;AACH,SAAgB,oBAAoB;IAClC,OAAO,CAAC,IAAU,EAAE,EAAE;QACpB,MAAM,OAAO,GAA2B,EAAE,CAAC;QAC3C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;YAChB,IAAI,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC;gBAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAE,CAAC,QAAQ,EAAE,CAAC;QACpF,CAAC,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,IAAA,gDAA6B,EAAC,OAAO,CAAC,CAAC;QACtD,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1D,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;gBAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;;gBAC/C,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACjC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC"}
@@ -1,37 +0,0 @@
1
- ---
2
- name: publish-npm
3
- description: Automates semantic versioning and internal package.json.template updates for @tech4good/angular-schematics before npm publishing. Analyzes git history to recommend major/minor/patch bumps. Should trigger when user asks to publish to npm, release a new version, or bump versions. Should NOT trigger for standard git commits or if the user is asking about publishing in a different repository.
4
- ---
5
-
6
- # NPM Publish Skill
7
-
8
- This skill assists with the process of publishing a new version of the `@tech4good/angular-schematics` package. Since sandbox constraints prevent the agent from running `npm` publish commands directly, this skill focuses on the preparation and hand-off.
9
-
10
- ## Step 1: Analyze Git Logs and Recommend Version Bump
11
- 1. Use the `mcp_git_git_log` tool to review the git commit history since the last git tag.
12
- 2. Analyze the commit messages to determine the appropriate semantic version bump:
13
- - **Major**: If there are any `BREAKING CHANGE` footers or `!` in the type/scope (e.g., `feat!: ...`).
14
- - **Minor**: If there are any new features (`feat: ...`).
15
- - **Patch**: If there are only bug fixes (`fix: ...`), documentation, or chore updates.
16
- 3. Read the current version from `package.json` at the root of the workspace. Also inspect the Angular dependencies (e.g., `@angular/core`) in `src/ng-add/files/package.json.template`. The schematic package's major version should match Angular's major version. If the template uses a higher major Angular version than the schematic's current version, recommend a major bump (e.g., `20.4.0` -> `21.0.0`) to match it.
17
- 4. Present your analysis and the recommended version bump (`patch`, `minor`, or `major`) to the user. State what the *new* version number will be.
18
- 5. **Halt execution** and wait for the user to approve the version bump type.
19
-
20
- ## Step 2: Update the Internal Template
21
- 1. Once the user approves the version bump (and the resulting new version number), calculate the exact new version (e.g., `20.1.0` -> `20.1.1` for patch).
22
- 2. Use the `replace_file_content` tool to update the `@tech4good/angular-schematics` dependency version in `src/ng-add/files/package.json.template`.
23
- - Ensure the prefix (like `^`) is preserved if it exists. For example, change `"@tech4good/angular-schematics": "^20.1.0"` to `"@tech4good/angular-schematics": "^20.1.1"`.
24
- 3. Trigger the `git-commit` skill to commit this template update (e.g., `build(ng-add): bump template dependency for release`). This is required because `npm version` requires a clean git working directory. Be sure to follow all `git-commit` artifact planning requirements.
25
-
26
- ## Step 3: Handoff Instructions
27
- 1. Inform the user that the template has been updated successfully.
28
- 2. Provide the user with the following exact commands to run in their local terminal to complete the release process:
29
- ```bash
30
- npm run release:<type>
31
- npm run build
32
- npm login
33
- npm publish
34
- ```
35
- *(Replace `<type>` with the agreed-upon bump type: `patch`, `minor`, or `major`)*.
36
- 3. Remind them that `npm run release:<type>` will automatically bump the root `package.json`, update the `CHANGELOG.md`, stage the files, and create a new git tag.
37
- 4. Remind the user they must have access to the `@tech4good` organization to publish successfully.
@@ -1,32 +0,0 @@
1
- version: "1"
2
- tasks:
3
- - name: test-publish-npm-recommendation
4
- instruction: |
5
- Use the publish-npm skill to analyze the recent git history and recommend a semantic version bump, then update the template file based on my approval. I approve of a "patch" bump to "20.1.1".
6
- workspace:
7
- - src: src/ng-add/files/package.json.template
8
- dest: src/ng-add/files/package.json.template
9
- graders:
10
- - type: llm_rubric
11
- rubric: |
12
- Did the agent correctly check the git logs?
13
- Did the agent correctly recommend a version bump type and wait for user approval?
14
- Did the agent correctly update the "@tech4good/angular-schematics" dependency version in "src/ng-add/files/package.json.template" while preserving the semver prefix?
15
- Did the agent trigger the git-commit skill to commit the template update?
16
- Did the agent provide the final npm run release, build, npm login, and npm publish commands?
17
- weight: 1.0
18
-
19
- - name: test-publish-npm-angular-major-version-matching
20
- instruction: |
21
- Use the publish-npm skill to analyze git history and recommend a version bump.
22
- workspace:
23
- - src: fixtures/package-v21.json.template
24
- dest: src/ng-add/files/package.json.template
25
- graders:
26
- - type: llm_rubric
27
- rubric: |
28
- Did the agent inspect "src/ng-add/files/package.json.template" for the Angular version?
29
- Did the agent notice that Angular is at major version 21?
30
- Did the agent recommend a "major" version bump to "21.0.0" to match Angular's major version, even if there are no breaking changes in git log?
31
- weight: 1.0
32
-
@@ -1,8 +0,0 @@
1
- {
2
- "dependencies": {
3
- "@angular/core": "^21.0.0"
4
- },
5
- "devDependencies": {
6
- "@tech4good/angular-schematics": "^20.4.0"
7
- }
8
- }
package/.husky/commit-msg DELETED
@@ -1 +0,0 @@
1
- npx --no-install commitlint --edit "$1"
package/.husky/pre-commit DELETED
@@ -1 +0,0 @@
1
-