2023-02-15 01:16:59 +02:00
# Tuitio client react
2023-02-11 05:11:27 +02:00
## Introduction
2023-02-15 01:16:59 +02:00
Tuitio client react is an npm package written in typescript that facilitates the integration of a react application with [Tuitio ](https://lab.code-rove.com/gitea/tudor.stanciu/tuitio ).
2023-02-11 05:11:27 +02:00
2023-02-11 22:34:16 +02:00
This package uses [tuitio-client ](https://lab.code-rove.com/gitea/bricks/tuitio-client#readme ) internally and adds state management through react contexts and various react hooks through which the user has access to data and actions.
2023-02-11 05:11:27 +02:00
## Package installation
The package installation can be done in two ways:
2023-02-15 01:16:59 +02:00
- from the command line: `npm install @flare/tuitio-client-react@1.0.0`
- from the package.json file: `"@flare/tuitio-client-react": "1.0.0"`
2023-02-11 05:11:27 +02:00
## How to use the package
2023-02-11 22:34:16 +02:00
```javascript!
2023-04-03 19:14:35 +03:00
const { TuitioProvider, useTuitioClient, useTuitioUser, useTuitioToken, useTuitioUserInfo } = require("@flare/tuitio-client-react");
const TuitioProvider = require("@flare/tuitio-client-react");
2023-02-11 22:34:16 +02:00
```
```javascript!
2023-04-03 19:14:35 +03:00
import { TuitioProvider, useTuitioClient, useTuitioUser, useTuitioToken, useTuitioUserInfo } from "@flare/tuitio-client-react";
2023-02-15 01:16:59 +02:00
import TuitioProvider from "@flare/tuitio-client-react";
2023-02-11 22:34:16 +02:00
```
2023-02-11 05:11:27 +02:00
## Unit testing
2023-02-11 22:34:16 +02:00
Unit testing is done using [Jest ](https://jestjs.io/ ). This is an awesome testing framework created by Facebook.
The files containing tests are identified by the extension `*.test.ts` .
2023-02-11 05:11:27 +02:00
All tests in the package can be executed by running: `npm test` .
## Changelog
2023-04-09 13:35:35 +03:00
1.0.0 - Package initialization.
1.0.1 - Added useTuitioClient default options.
1.1.0 - In this version, the account logout method and the latest changes published by Tuitio were implemented.
1.1.1 - Account logout bug fix.
2023-03-30 10:03:07 +03:00
1.2.0 - Has been implemented the "user-info" method exposed by the Tuitio API and the latest changes published by "@flare/tuitio-client".
2023-03-30 19:28:14 +03:00
1.2.1 - Added decodedToken in useTuitioToken hook. The token is obtained directly from TuitioProvider's react context.
2023-04-03 19:14:35 +03:00
1.2.2 - Upgraded @flare/tuitio -client and @flare/js -utils packages.
2023-04-04 08:59:01 +03:00
1.2.3 - User roles were handled in useTuitioUserInfo hook.
2023-04-09 13:35:35 +03:00
1.2.4 - Upgraded @flare/tuitio -client.
1.2.5 - Upgraded @flare/tuitio -client.