Naboo's Podracing Misadventure

    TypeScript icon, indicating that this package has built-in type declarations

    2.25.6 • Public • Published


    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.


    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


    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


    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 for an example of how to integrate the Timeout Notification Service and Timeout Notification Service Modal.



    npm i @hmcts/rpx-xui-node-lib

    DownloadsWeekly Downloads






    Unpacked Size

    187 kB

    Total Files


    Last publish


    • bendiggle
    • ellie-harrison
    • adrianc
    • hemantt
    • adamsilver
    • trevorsaint
    • timja-hmcts
    • dharmendrak
    • robertparkinson
    • pragnesh
    • damdun
    • p.jar
    • sabah.irfan
    • jenkins-reform-hmcts
    • andrewwa-kainos
    • timja