2.1.0 • Published 24 days ago

react-session-timeout-alert v2.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
24 days ago

React Session Timeout Alert

NPM version npm downloads GitHub license

A Session Timeout Alert component to display after a set idle time for a user. The primary purpose for the alert is to logout a authenticated user after a set time of no interaction with the UI.

Install

npm install react-session-timeout-alert

Available Props

NameTypeDefaultDescription
alertActionsClassStringrst-alert-actionsClass for Alert Modal actions
alertContainerClassStringrst-alertClass for Alert Modal container
alertContentClassStringrst-alert-contentClass for Alert Modal content
alertTimerClassStringrst-alert-timerClass for Alert Modal timer
alertTitleStringnullTitle for Alert Modal
alertDescriptionStringnullDescription for Alert Modal
cancelBtnObject{class: "rst-btn rst-btn-danger", text: "Stay Logged In", type: "button"}Title and Text for Alert cancel button
confirmBtnObject{class: "rst-btn rst-btn-primary", text: "Logout", type: "submit"}Title and Text for Alert submit button
debounceTimeNumber500delay in ms before timer starts back due to user inactivity proceeding re-activity
handleSessionTimeoutFunction() => alert("logging out")Function to call on Alert submit button click and alert timer end
idleTimeNumber5Number of minutes before displaying alert modal
modalTimeoutNumber20Number of seconds for countdown before hiding alert modal and calling handleSessionTimeout method

Basic Usage

import { ReactSessionTimeoutAlert } from 'react-session-timeout-alert';

<ReactSessionTimeoutAlert
  idleTime={5}
  modalTimeout={20}
  alertTitle={"Idle Timeout Warning"}
  alertDescription={"You are about to be logged out due to inactivity"}
  cancelBtn={{
    text: "Cancel",
    class: "rst-btn rst-btn-danger"
  }}
  handleSessionTimeout = {() => alert("logging out")}
/>

Story Book

git clone git@github.com:EvanMiller12/react-session-timeout-alert.git

cd react-session-timeout-alert

make sure to use Node >=16.0.0

npm install

npm run storybook

Simple Example

git clone git@github.com:EvanMiller12/react-session-timeout-alert.git

cd react-session-timeout-alert/example

make sure to use Node >=16.0.0

npm install

npm run start

License

MIT license, Copyright (c) 2024 Evan Miller. For more information see LICENSE.

2.1.0

24 days ago

2.0.0

25 days ago

1.2.0

1 month ago

1.1.0

1 month ago

1.2.1

1 month ago

1.0.3

2 months ago

1.0.2

2 months ago

1.0.1

2 months ago

1.0.0

2 months ago