@heartfulnessinstitute/react-hfn-profile

3.2.7 • Public • Published

react-hfn-profile

Configuration Variables to be set in .env:

// 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

Readme

Keywords

none

Package Sidebar

Install

npm i @heartfulnessinstitute/react-hfn-profile

Weekly Downloads

7

Version

3.2.7

License

ISC

Unpacked Size

70.3 kB

Total Files

7

Last publish

Collaborators

  • nsreehari