# @heartfulnessinstitute/react-hfn-profile

> Login and Profile APIs for MySRCM / Heartfulness Profile

Latest version **3.2.7** (published 2020-11-08) · ISC license · 0 weekly downloads

## Install

```sh
npm install @heartfulnessinstitute/react-hfn-profile
pnpm add @heartfulnessinstitute/react-hfn-profile
yarn add @heartfulnessinstitute/react-hfn-profile
bun add @heartfulnessinstitute/react-hfn-profile
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.2.7 |
| Published | 2020-11-08 |
| First published | 2019-07-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 68.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sree Hari Nagaralu |
| Maintainers | nsreehari |

## Links

- npm: https://www.npmjs.com/package/@heartfulnessinstitute/react-hfn-profile
- Repository: https://github.com/HeartfulnessInstitute/react-hfn-profile
- Homepage: https://github.com/HeartfulnessInstitute/react-hfn-profile#readme
- Issues: https://github.com/HeartfulnessInstitute/react-hfn-profile/issues
- npm.io page: https://npm.io/package/@heartfulnessinstitute/react-hfn-profile

## Dependencies (3)

- [query-string](https://npm.io/package/query-string.md) ^6.8.3
- [react-spinners](https://npm.io/package/react-spinners.md) ^0.5.12
- [react-firebaseui](https://npm.io/package/react-firebaseui.md) ^4.0.0

## Recent versions

- 3.2.7 (latest) — 2020-11-08
- 3.2.6 — 2020-04-23
- 3.2.5 — 2020-02-15
- 3.2.4 — 2020-02-15
- 3.2.3 — 2020-02-04
- 3.2.2 — 2019-10-28
- 3.2.1 — 2019-10-19
- 3.2.0 — 2019-10-19
- 3.1.7 — 2019-09-15
- 3.1.6 — 2019-09-14
- 3.1.5 — 2019-09-14
- 3.1.4 — 2019-09-13
- 3.1.3 — 2019-09-07
- 3.1.2 — 2019-09-07
- 3.1.1 — 2019-09-06
- … 17 more at https://npm.io/package/@heartfulnessinstitute/react-hfn-profile/versions

## README

# react-hfn-profile

## Configuration Variables to be set in .env:

```javascript
// firebase config for Profile auth
REACT_APP_FIREBASE_AUTH_CONFIG='{"apiKey":"XXXXXXXXXX","authDomain":"XXXXXXXXXXX","projectId":"XXXXX","messagingSenderId":"99999999999999","appId":"XXXXXXXXXXXXXXX"}'

// config for Profile API access
REACT_APP_MYSRCM_CONFIG='{"xClientId":"SSSSSSSSSSSSSS", "profileServer":"http://profile.XXXXXXXXXX"}'

// optional config for secondary firebase instance
REACT_APP_FIREBASE_DFLT_CONFIG='{"apiKey":"XXXXXXXXXX","authDomain":"XXXXXXXXXXX","databaseURL":"https://XXXXXXXXXXXX","projectId":"XXXXXXXXXXX","storageBucket":"XXXXXXXXXXXXX","messagingSenderId":"33333333333333333","appId":"XXXXXXXXXXXXXXXXXXXXXX"}'

// config for Reg Server - optional only if reg server apis are needed
REACT_APP_REG_SERVER="XXXXXXXXXXXXXXXX"

```


## Exports

1. *HfnFirebaseAuth* - Wrapper on top of StyledFirebaseAuth with necessary plumbing for Profile APIs
2. *signOut()* - method for sign out 
3. *fetchProfileAPI(api, method="GET", extraHdrs={}, extraData={})* - Profile Server REST APIs wrapper
4. *fetchProfileMe()* - sugar for the api "/me"
5. *getFirebaseApp()* - firebase app (secondary) instance if REACT_APP_FIREBASE_DFLT_CONFIG variable is set
6. *HfnAvatar* - Component that displays the image/initial of the logged in user, with a dropdown menu for My Profile and Sign Out.
7. *isSignedIn()* - true or false based on whether the user is signed in or not
8. *xUserId()* - uid of the signed in user
9. *xUserName()* - user display name of the signed in user
10. *xAbhyasiId()* - abhyasi ID of the signed in user, if exists, or "" (empty string)
11. *xUserPhoto()* - photo url of the signed in user
12. *xUserEmail()* - email id of the signed in user
13. *xIsPrefect()* - is the signed user a prefect?
14. *xMe()* - /me info for the signed in user
15. *authenticatedRequest(url, method = "GET", headers = {}, data = {})* - Wrapper on top of fetch request which adds the appropriate authorization headers
16. *authenticatedCall(fn, onSuccessCallback)* - calls the passed function *fn* with the parameters *fn(uid, token, onSuccessCallback)*.  The function gets passed the uid and token values. The function is expected to call onSuccessCallback(payload) with result.
17. *EnsureHfnSignedIn* - React Component decorator to render children components if signed in, otherwise HfnFirebaseAuth Component


18. *fetchKanhaRegAPI(api, method, paramsDict)* - REST API wrapper for Reg Server

Sugars for *fetchKanhaRegAPI*

    getKanhaRegApi(api, payload = {}, extraHdrs = {}, extraData = {}) 
    postKanhaRegApi = (api, payload, extraHdrs = {}, extraData = {})
    putKanhaRegApi = (api, payload, extraHdrs = {}, extraData = {})
    deleteKanhaRegApi = (api, payload, extraHdrs = {}, extraData = {}) 

    getKanhaRegApiId = (api, id, payload = {}, extraHdrs = {}, extraData = {})
    postKanhaRegApiId = (api, id, payload, extraHdrs = {}, extraData = {})
    putKanhaRegApiId = (api, id, payload, extraHdrs = {}, extraData = {}) 
    deleteKanhaRegApiId = (api, id, payload = {}, extraHdrs = {}, extraData = {}) 

    getKanhaRegApiPk = (api, pk, payload = {}, extraHdrs = {}, extraData = {}) 
    postKanhaRegApiPk = (api, pk, payload, extraHdrs = {}, extraData = {}) 
    putKanhaRegApiPk = (api, pk, payload, extraHdrs = {}, extraData = {}) 
    deleteKanhaRegApiPk = (api, pk, payload = {}, extraHdrs = {}, extraData = {}) 




## Setup
```
# npm i @heartfulnessinstitute/react-hfn-profile -S
```

---
_Source: https://npm.io/package/@heartfulnessinstitute/react-hfn-profile · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
