@ministryofjustice/hmpps-digital-prison-reporting-frontend 6.3.0 → 6.3.2

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 (70) hide show
  1. package/README.md +111 -4
  2. package/all.bundle.js +5 -9
  3. package/all.bundle.js.map +1 -1
  4. package/all.js +5 -9
  5. package/all.js.map +1 -1
  6. package/cjs/dpr/routes/journeys/my-reports/bookmarks/service.js +6 -6
  7. package/cjs/dpr/routes/journeys/my-reports/bookmarks/service.js.map +1 -1
  8. package/cjs/dpr/utils/durationCalculator.js.map +1 -1
  9. package/dpr/all.scss +11 -11
  10. package/dpr/components/_async/async-filters-form/actions/save-defaults/view.njk +1 -1
  11. package/dpr/components/_async/async-filters-form/fields/filter-fields/view.njk +1 -1
  12. package/dpr/components/_async/async-filters-form/fields/hidden-fields/view.njk +1 -1
  13. package/dpr/components/_async/async-filters-form/view.njk +2 -2
  14. package/dpr/components/_async/async-polling/current-status/failed-state/view.njk +2 -2
  15. package/dpr/components/_async/async-polling/current-status/finished-state/view.njk +2 -2
  16. package/dpr/components/_async/async-polling/current-status/in-progress-state/view.njk +2 -2
  17. package/dpr/components/_async/async-polling/current-status/view.njk +1 -1
  18. package/dpr/components/_async/async-polling/view.njk +1 -1
  19. package/dpr/components/_async/request-details/view.njk +2 -2
  20. package/dpr/components/_catalogue/catalogue-filter-by-type/view.njk +1 -1
  21. package/dpr/components/_catalogue/catalogue-filters/view.njk +6 -6
  22. package/dpr/components/_catalogue/catalogue-how-to-use/view.njk +3 -4
  23. package/dpr/components/_charts/chart/view.njk +4 -4
  24. package/dpr/components/_charts/chart-tabs/view.njk +3 -3
  25. package/dpr/components/_dashboards/dashboard/view.njk +2 -2
  26. package/dpr/components/_dashboards/dashboard-list/view.njk +3 -3
  27. package/dpr/components/_dashboards/dashboard-section/view.njk +2 -2
  28. package/dpr/components/_dashboards/dashboard-sidebar/view.njk +6 -6
  29. package/dpr/components/_dashboards/dashboard-visualisation/view.njk +2 -2
  30. package/dpr/components/_dashboards/scorecard/view.njk +1 -1
  31. package/dpr/components/_dashboards/scorecard-group/view.njk +1 -1
  32. package/dpr/components/_filters/filter-input/view.njk +4 -4
  33. package/dpr/components/_filters/filters-help/view.njk +7 -7
  34. package/dpr/components/_filters/filters-interactive/view.njk +3 -3
  35. package/dpr/components/_filters/filters-save-defaults/view.njk +2 -2
  36. package/dpr/components/_inputs/date-input/view.njk +14 -14
  37. package/dpr/components/_inputs/date-range/view.njk +1 -1
  38. package/dpr/components/_inputs/granular-date-range/view.njk +2 -2
  39. package/dpr/components/_reports/report-heading/report-columns/view.njk +1 -1
  40. package/dpr/components/_reports/report-heading/report-download-message/view.njk +1 -1
  41. package/dpr/components/_reports/report-heading/report-filters/view.njk +1 -1
  42. package/dpr/components/_reports/report-heading/view.njk +2 -2
  43. package/dpr/components/_reports/report-page/report-template/report-section/parent-child-template/view.njk +1 -1
  44. package/dpr/components/_reports/report-page/report-template/report-section/report-section-heading/view.njk +1 -1
  45. package/dpr/components/_reports/report-page/report-template/report-section/view.njk +5 -5
  46. package/dpr/components/_reports/report-page/report-template/view.njk +3 -3
  47. package/dpr/components/_reports/report-page/view.njk +1 -1
  48. package/dpr/components/bookmark/view.njk +6 -6
  49. package/dpr/components/button-link/view.njk +1 -1
  50. package/dpr/components/code-block/view.njk +1 -1
  51. package/dpr/components/error-summary/view.njk +3 -3
  52. package/dpr/components/my-reports/my-reports-empty/view.njk +1 -1
  53. package/dpr/components/my-reports/my-reports-list/macro.njk +3 -3
  54. package/dpr/components/my-reports/my-reports-list-help/view.njk +4 -4
  55. package/dpr/components/my-reports/my-reports-list-item/my-reports-list-item-actions/remove-action/view.njk +1 -1
  56. package/dpr/components/my-reports/my-reports-list-item/my-reports-list-item-actions/view.njk +3 -3
  57. package/dpr/components/my-reports/my-reports-list-item/my-reports-list-item-filters/view.njk +5 -5
  58. package/dpr/components/my-reports/my-reports-list-item/my-reports-list-item-title/view.njk +3 -3
  59. package/dpr/components/my-reports/my-reports-list-item/row.njk +9 -9
  60. package/dpr/components/my-reports/my-reports-list-totals/view.njk +4 -4
  61. package/dpr/routes/journeys/download-report/request-download/form/form.njk +1 -1
  62. package/dpr/routes/journeys/my-reports/bookmarks/service.js +6 -6
  63. package/dpr/routes/journeys/my-reports/bookmarks/service.js.map +1 -1
  64. package/dpr/routes/journeys/my-reports/user-reports-view.njk +1 -1
  65. package/dpr/routes/journeys/request-missing-report/form/form.njk +3 -3
  66. package/dpr/routes/journeys/request-missing-report/submitted/view.njk +1 -1
  67. package/dpr/routes/journeys/request-report/filters/view.njk +7 -7
  68. package/dpr/routes/journeys/view-report/error.njk +10 -10
  69. package/dpr/utils/durationCalculator.js.map +1 -1
  70. package/package.json +1 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A front-end library for components created by the Digital Prison Reporting team.
4
4
 
5
- This README is intended for developers of and contributors to the project. If you are looking to integrate the components into your own project, please see the consumer documentation here: https://ministryofjustice.github.io/hmpps-digital-prison-reporting-frontend/
5
+ This README is intended for developers of and contributors to the project. If you are looking to integrate the components into your own project, please see the consumer documentation here: https://ministryofjustice.github.io/hmpps-digital-prison-reporting-frontend/
6
6
 
7
7
  ## Publishing
8
8
 
@@ -55,7 +55,7 @@ To run the app in dev mode, use `start:dev:noMockClients` for the test app, and
55
55
  server {
56
56
  listen 8081;
57
57
  server_name localhost;
58
-
58
+
59
59
  # Handle all other hmpps-digital-prison-reporting-frontend requests
60
60
  location /hmpps-digital-prison-reporting-frontend/ {
61
61
  proxy_pass http://localhost:3000/;
@@ -68,7 +68,7 @@ server {
68
68
  proxy_redirect / /hmpps-digital-prison-reporting-frontend/;
69
69
  proxy_set_header Accept-Encoding "";
70
70
  }
71
-
71
+
72
72
  # Handle requests without trailing slash
73
73
  location = /hmpps-digital-prison-reporting-frontend {
74
74
  return 301 /hmpps-digital-prison-reporting-frontend/;
@@ -78,4 +78,111 @@ server {
78
78
 
79
79
  Then run `sudo nginx -t` to ensure there's no errors, then `sudo nginx -s reload` to reload its config.
80
80
 
81
- This forwards all requests from http://localhost:8081 to http://localhost:3000 (where your app will be running). Now run `npm run docs:serve-prod` and then navigate to http://localhost:8081/hmpps-digital-prison-reporting-frontend and it should be working.
81
+ This forwards all requests from http://localhost:8081 to http://localhost:3000 (where your app will be running). Now run `npm run docs:serve-prod` and then navigate to http://localhost:8081/hmpps-digital-prison-reporting-frontend and it should be working.
82
+
83
+ ## Developer Onboarding (Fresh Clone)
84
+
85
+ Run the following commands to enable the local pre-commit hooks.
86
+
87
+ ---
88
+
89
+ ### Step 1 — Clone the Repository
90
+
91
+ ```bash
92
+ git clone <repo-url>
93
+ cd hmpps-digital-prison-reporting-frontend
94
+ ```
95
+
96
+ ---
97
+
98
+ ### Step 2 — Use the Correct Node Version
99
+
100
+ Run:
101
+
102
+ ```bash
103
+ nvm use
104
+ ```
105
+
106
+ Verify the versions:
107
+
108
+ ```bash
109
+ node -v
110
+ npm -v
111
+ ```
112
+
113
+ Expected:
114
+
115
+ - Node `22.x` or `24.x`
116
+ - npm `10.x` or `11.x`
117
+
118
+ ---
119
+
120
+ ### Step 3 — Install Dependencies
121
+
122
+ Run:
123
+
124
+ ```bash
125
+ npm install
126
+ ```
127
+
128
+ or:
129
+
130
+ ```bash
131
+ npm ci
132
+ ```
133
+
134
+ ---
135
+
136
+ ### Step 4 — Register the Git Pre-Commit Hook Locally
137
+
138
+ Run:
139
+
140
+ ```bash
141
+ npm run prepare
142
+ ```
143
+
144
+ Expected output:
145
+
146
+ ```bash
147
+ Initialising prek hooks on this repo
148
+ prek installed at`.git/hooks/pre-commit` ✅
149
+ ```
150
+
151
+ Hooks are now active locally.
152
+
153
+ ---
154
+
155
+ ### Step 5 — Verify the Setup
156
+
157
+ Run:
158
+
159
+ ```bash
160
+ prek run --all-files
161
+ ```
162
+
163
+ This validates:
164
+
165
+ - secret scanning (`gitleaks`)
166
+ - lint checks
167
+ - type checks
168
+ - tests
169
+ - JSON/YAML validation
170
+
171
+ If all hooks pass, your local setup is complete.
172
+
173
+ ---
174
+
175
+ ## Quick Setup Summary
176
+
177
+ ```bash
178
+ git clone <repo-url>
179
+ cd hmpps-digital-prison-reporting-frontend
180
+
181
+ nvm use
182
+
183
+ npm install
184
+
185
+ npm run prepare
186
+
187
+ prek run --all-files
188
+ ```
package/all.bundle.js CHANGED
@@ -2226,19 +2226,15 @@ class DprMyReports extends PollingClientClass {
2226
2226
  return;
2227
2227
  this.removing = true;
2228
2228
  try {
2229
- const formData = new URLSearchParams();
2230
- if (this.maxRows !== undefined) {
2231
- formData.append('maxRows', this.maxRows);
2232
- }
2233
- formData.append('_csrf', this.csrfToken);
2234
2229
  const res = await fetch(form.action, {
2235
2230
  method: 'POST',
2236
2231
  headers: {
2237
- 'X-Requested-With': 'XMLHttpRequest',
2238
- 'Content-Type': 'application/x-www-form-urlencoded',
2232
+ 'Content-Type': 'application/json',
2233
+ 'CSRF-Token': this.csrfToken,
2239
2234
  },
2240
- body: formData.toString(),
2241
- credentials: 'same-origin',
2235
+ body: JSON.stringify({
2236
+ ...(this.maxRows && { maxRows: this.maxRows }),
2237
+ }),
2242
2238
  });
2243
2239
  if (!res.ok) {
2244
2240
  console.error('Remove failed');