Skip to content

hmcts/rpx-xui-node-lib

This branch is 1 commit ahead of master.

Folders and files

NameName
Last commit message
Last commit date
Nov 13, 2024
Jun 1, 2020
Jul 3, 2020
Mar 9, 2022
Feb 25, 2025
Mar 24, 2023
May 6, 2020
May 29, 2020
Nov 13, 2024
May 6, 2020
Nov 13, 2024
May 14, 2020
Nov 13, 2024
Feb 25, 2025
Jan 18, 2024
May 6, 2020
Jun 8, 2020
Jul 1, 2024
May 14, 2020
Feb 25, 2025
Jul 6, 2020
Nov 4, 2024
Jun 19, 2020
Jul 18, 2024
Mar 6, 2025

Repository files navigation

rpx-xui-node-lib

Common Nodejs library components for XUI

Commitizen friendly Semantic-Release

Committing to this library

It should be noted that this library adheres to the gitflow convention. Please use proper naming conventions for your feature/bug branches. Also, when committing please use conventional commits (@see this guide). This style is now enforced using git commit hooks and there are a number of ways to commit.

Commitizen

This is the preferred way of generating a commit against this library as it ensures the commit is formatted correctly and also allows you to interactively build your commit. To do so, you can either type yarn commit or git cz

Alternative

You can still use git commit however in doing so you have to manually enforce the commit standard and type (please be aware that your commit will still get linted and may fail otherwise).

Get User Session Timeout

getUserSessionTimeout() allows a 3rd party application to calculate the Session Notification Timeout for a User, based on their User Roles, and an array of Session Notification Timeouts, as defined by the 3rd party service.

Feature example:

A W&P User on Manage Cases should have a Total Idle Time of 12 minutes, and should show the Session Timeout Modal 3 minutes before the end of their session.

Whereas a Manage Organisation application user should have an Total Idle Time of 50 minutes, and should show the Session Timeout Modal 10 minutes before the end of their session.

Session Notification Timeouts shape

"sessionTimeouts": [
    {
      "idleModalDisplayTime": 3,
      "pattern": "-dwpresponsewriter",
      "totalIdleTime": 12
    },
    {
      "idleModalDisplayTime": 3,
      "pattern": "-homeoffice",
      "totalIdleTime": 12
    },
    {
      "idleModalDisplayTime": 10,
      "pattern": "-solicitor",
      "totalIdleTime": 50
    },
    {
      "idleModalDisplayTime": 10,
      "pattern": ".",
      "totalIdleTime": 480
    }
  ]

The Session Timeout configuration should be in PRIORITY ORDER, with the DEFAULT for this application being the last item in the array.

The application DEFAULT is defined using the wildcard pattern ie '.'

User Roles shape

[
    'pui-organisation-manager',
    'pui-user-manager',
    'pui-finance-manager',
]

Steps to implement:

  1. Include the node library within your package.json file ie.
yarn add @hmcts/rpx-xui-node-lib@latest --save
  1. Import the function
import { getUserSessionTimeout } from '@hmcts/rpx-xui-node-lib'
  1. Include the function call, and pass in the Users roles, and sessionTimeouts as set by your team. @see above for shape inputs.
const sessionTimeout = getUserSessionTimeout(roles, sessionTimeouts)
  1. Handle the returned object ie.
{
  "idleModalDisplayTime": 3,
  "pattern": "-homeoffice",
  "totalIdleTime": 12
}

This object can be passed through to an UI. If the UI is in Angular, the Angular UI can then implement the Timeout Notification Service and Timeout Notification Service Modal, which the object generated by this Node API can be transfered into.

@see https://github.com/hmcts/rpx-xui-common-lib#timeout-notification-service for an example of how to integrate the Timeout Notification Service and Timeout Notification Service Modal.

END2