hof 22.8.5-fix-error-title-beta.3 → 22.8.5-fix-error-title-beta.4

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 CHANGED
@@ -1,4 +1,4 @@
1
- ## 2025-07-24, Version 22.8.5 (Stable), @Rhodine-orleans-lindsay
1
+ ## 2025-08-28, Version 22.8.5 (Stable), @Rhodine-orleans-lindsay
2
2
  ### Fixed
3
3
  - Fixed bug where if `serviceName` had not been set in journey.json, the title tab on error pages did not default to the `header` in journey.json.
4
4
 
@@ -14,15 +14,25 @@ const getContent = (err, translate) => {
14
14
  const t = key => (typeof translate === 'function' ? translate(key) : undefined);
15
15
 
16
16
  // set const for checking whether a service name has been set in the journey.json file
17
- const isServiceNameSet = t('journey.serviceName') !== 'journey.serviceName';
17
+ // const isServiceNameSet = t('journey.serviceName') !== 'journey.serviceName';
18
+ const getServiceName = t => {
19
+ const serviceName = t('journey.serviceName');
20
+ const header = t('journey.header');
21
+
22
+ // Return serviceName if it's translated, otherwise fallback to header
23
+ return serviceName && serviceName !== 'journey.serviceName' ? serviceName : header;
24
+ };
25
+ const serviceName = getServiceName(t);
18
26
 
19
27
  if (err.code === 'SESSION_TIMEOUT') {
20
28
  err.status = 401;
21
29
  err.template = 'session-timeout';
22
- err.serviceName = isServiceNameSet ? t('journey.serviceName') : t('journey.header');
30
+ // err.serviceName = isServiceNameSet ? t('journey.serviceName') : t('journey.header');
31
+ err.serviceName = serviceName;
23
32
  err.title = t('errors.session.title');
24
33
  err.message = t('errors.session.message');
25
- content.serviceName = isServiceNameSet ? t('journey.serviceName') : t('journey.header');
34
+ // content.serviceName = isServiceNameSet ? t('journey.serviceName') : t('journey.header');
35
+ content.serviceName = serviceName;
26
36
  content.title = t('errors.session.title');
27
37
  content.message = t('errors.session.message');
28
38
  }
@@ -38,14 +48,16 @@ const getContent = (err, translate) => {
38
48
  if (err.code === 'DDOS_RATE_LIMIT') {
39
49
  err.status = 429;
40
50
  err.template = 'rate-limit-error';
41
- err.serviceName = isServiceNameSet ? t('journey.serviceName') : t('journey.header');
51
+ // err.serviceName = isServiceNameSet ? t('journey.serviceName') : t('journey.header');
52
+ err.serviceName = serviceName;
42
53
  err.title = t('errors.ddos-rate-limit.title');
43
54
  err.message = t('errors.ddos-rate-limit.message');
44
55
  err.preTimeToWait = t('errors.ddos-rate-limit.pre-time-to-wait');
45
56
  err.timeToWait = rateLimitsConfig.rateLimits.requests.windowSizeInMinutes;
46
57
  err.postTimeToWait = t('errors.ddos-rate-limit.post-time-to-wait');
47
58
  content.title = t('errors.ddos-rate-limit.title');
48
- content.serviceName = isServiceNameSet ? t('journey.serviceName') : t('journey.header');
59
+ // content.serviceName = isServiceNameSet ? t('journey.serviceName') : t('journey.header');
60
+ content.serviceName = serviceName;
49
61
  content.message = t('errors.ddos-rate-limit.message');
50
62
  content.preTimeToWait = t('errors.ddos-rate-limit.pre-time-to-wait');
51
63
  content.timeToWait = rateLimitsConfig.rateLimits.requests.windowSizeInMinutes;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hof",
3
3
  "description": "A bootstrap for HOF projects",
4
- "version": "22.8.5-fix-error-title-beta.3",
4
+ "version": "22.8.5-fix-error-title-beta.4",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "author": "HomeOffice",