3.2.7 • Published 4 years ago

@heartfulnessinstitute/react-hfn-profile v3.2.7

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

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
  1. 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
3.2.7

4 years ago

3.2.6

4 years ago

3.2.5

4 years ago

3.2.4

4 years ago

3.2.3

4 years ago

3.2.2

5 years ago

3.2.1

5 years ago

3.2.0

5 years ago

3.1.7

5 years ago

3.1.6

5 years ago

3.1.5

5 years ago

3.1.4

5 years ago

3.1.3

5 years ago

3.1.2

5 years ago

3.1.1

5 years ago

3.1.0

5 years ago

3.0.0

5 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago