@companieshouse/ch-node-utils 1.3.20 → 1.3.22

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,8 @@ 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.
113
+ - `accountUrl`: base URL to account service - ACCOUNT_URL
112
114
 
113
115
  #### Localization
114
116
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companieshouse/ch-node-utils",
3
- "version": "1.3.20",
3
+ "version": "1.3.22",
4
4
  "author": "companieshouse",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -62,16 +62,18 @@ 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')
66
+ - accountUrl: base URL to account service - ACCOUNT_URL
65
67
  #}
66
- {% macro addPredefinedNavbar(userDisplayText, chsMonitorGuiUrl, lang, displayAuthorisedAgent, displayYourCompanies, displayUserManagementAdmin) %}
68
+ {% macro addPredefinedNavbar(userDisplayText, chsMonitorGuiUrl, lang, displayAuthorisedAgent, displayYourCompanies, displayUserManagementAdmin, pageLanguage="en", accountUrl) %}
67
69
  {% 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" },
70
+ { id: "user-management-admin", href: "/identity-verification?lang=" + pageLanguage, displayText: lang.userManagementAdmin or "User management admin" } if displayUserManagementAdmin === "yes",
71
+ { id: "authorised-agent", href: "/authorised-agent?lang=" + pageLanguage, displayText: lang.authorisedAgent or "Authorised agent" } if displayAuthorisedAgent === "yes",
72
+ { id: "your-companies", href: "/your-companies?lang=" + pageLanguage, displayText: lang.yourCompanies or "Your companies" } if displayYourCompanies === "yes",
73
+ { id: "your-filings", href: "/user/transactions?lang=" + pageLanguage, displayText: lang.yourFilings or "Your filings" },
72
74
  { 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" },
75
+ { id: "basket", href: "/basket?lang=" + pageLanguage, displayText: lang.basket or "Basket" },
76
+ { id: "your-details", href: accountUrl + "/user/account?lang=" + pageLanguage, displayText: lang.manageAccount or "Manage account" },
75
77
  { id: "user-signout", href: "/signout", displayText: lang.signOut or "Sign out" }
76
78
  ] | reject("falsy") %}
77
79