@companieshouse/ch-node-utils 1.3.19 → 1.3.21

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/README.md CHANGED
@@ -109,6 +109,7 @@ The macro requires the following parameters:
109
109
  - `displayAuthorisedAgent`: A flag for displaying the "Authorised agent" menu item. If the logged user has ACSP membership, this flag should be set to `'yes'`. If your service uses i18 middleware provided in the `@companieshouse/ch-node-utils` package, then this flag will be set to the correct value automatically. If not, you can use `isAuthorisedAgent` function from `./utils/sessionUtils`.
110
110
  - `displayYourCompanies`: A flag for displaying the "Your companies" menu item. It should be set to `'yes` if this menu iten needs to be displayed.
111
111
  - `displayUserManagementAdmin`: A flag for displaying the "User management admin" menu item. It should be set to `'yes` if this menu iten needs to be displayed.
112
+ - `pageLanguage`: The language code for the page. (e.g. `'en'` or `'cy'`). This allows the language to be kept after navigating to the new service.
112
113
 
113
114
  #### Localization
114
115
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companieshouse/ch-node-utils",
3
- "version": "1.3.19",
3
+ "version": "1.3.21",
4
4
  "author": "companieshouse",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -35,7 +35,7 @@ It receives:
35
35
  </div>
36
36
  </div>
37
37
 
38
- <script>
38
+ <script {% if cspNonce %} nonce={{ cspNonce | dump | safe }} {% endif %}>
39
39
  document.addEventListener('DOMContentLoaded', function() {
40
40
  const languageLinks = document.querySelectorAll('.language-link');
41
41
 
@@ -62,16 +62,17 @@ It receives:
62
62
  - displayAuthorisedAgent: a flag indicating whether to display the 'Authorised agent' menu item
63
63
  - displayYourCompanies: a flag indicating whether to display the 'Your companies' menu item
64
64
  - displayUserManagementAdmin: a flag indicating whether to display the 'User management admin' menu item
65
+ - pageLanguage: the language code for the page (e.g. 'en', 'cy')
65
66
  #}
66
- {% macro addPredefinedNavbar(userDisplayText, chsMonitorGuiUrl, lang, displayAuthorisedAgent, displayYourCompanies, displayUserManagementAdmin) %}
67
+ {% macro addPredefinedNavbar(userDisplayText, chsMonitorGuiUrl, lang, displayAuthorisedAgent, displayYourCompanies, displayUserManagementAdmin, pageLanguage="en") %}
67
68
  {% set menuItems = [
68
- { id: "user-management-admin", href: "/identity-verification", displayText: lang.userManagementAdmin or "User management admin" } if displayUserManagementAdmin === "yes",
69
- { id: "authorised-agent", href: "/authorised-agent", displayText: lang.authorisedAgent or "Authorised agent" } if displayAuthorisedAgent === "yes",
70
- { id: "your-companies", href: "/your-companies", displayText: lang.yourCompanies or "Your companies" } if displayYourCompanies === "yes",
71
- { id: "your-filings", href: "/user/transactions", displayText: lang.yourFilings or "Your filings" },
69
+ { id: "user-management-admin", href: "/identity-verification?lang=" + pageLanguage, displayText: lang.userManagementAdmin or "User management admin" } if displayUserManagementAdmin === "yes",
70
+ { id: "authorised-agent", href: "/authorised-agent?lang=" + pageLanguage, displayText: lang.authorisedAgent or "Authorised agent" } if displayAuthorisedAgent === "yes",
71
+ { id: "your-companies", href: "/your-companies?lang=" + pageLanguage, displayText: lang.yourCompanies or "Your companies" } if displayYourCompanies === "yes",
72
+ { id: "your-filings", href: "/user/transactions?lang=" + pageLanguage, displayText: lang.yourFilings or "Your filings" },
72
73
  { id: "companies-you-follow", href: chsMonitorGuiUrl, displayText: lang.companiesYouFollow or "Companies you follow" },
73
- { id: "basket", href: "/basket", displayText: lang.basket or "Basket" },
74
- { id: "your-details", href: "/user/account", displayText: lang.manageAccount or "Manage account" },
74
+ { id: "basket", href: "/basket?lang=" + pageLanguage, displayText: lang.basket or "Basket" },
75
+ { id: "your-details", href: "/user/account?lang=" + pageLanguage, displayText: lang.manageAccount or "Manage account" },
75
76
  { id: "user-signout", href: "/signout", displayText: lang.signOut or "Sign out" }
76
77
  ] | reject("falsy") %}
77
78