Skip to content

Commit d3f2061

Browse files
authored
Version v2.0.0 Beta 2 (#197)
* Node v8 support (`package.lock.json` added, and `8` added to node versions in travis config) * `credential` support for login method - #186 * createUserProfile called with Facebook authentication - #187 * Switched back to using constructor to set context vars (attempt to fix undefined vars in component mount) * Merged changes that set `displayName` and `wrappedComponent` * Docs sections `redux-observable` and `epics` combined * Docs updated with changes to compose function (no longer supports passing fbConfig) * Docs added about `presence` and `sessions` config options
1 parent 289f73e commit d3f2061

21 files changed

+10708
-179
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ language: node_js
22

33
node_js:
44
- "6"
5+
- "8"
56

67
sudo: false
78

SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
* [Profile](/docs/recipes/profile.md)
1212
* [Auth](/docs/recipes/auth.md)
1313
* [Actions](/docs/recipes/actions.md)
14-
* [Epics](/docs/recipes/epics.md)
1514
* [Routing](/docs/recipes/routing.md)
1615
* [Roles](/docs/recipes/roles.md)
1716
* [Populate](/docs/recipes/populate.md)
@@ -20,6 +19,7 @@
2019
* [Redux Form](/docs/recipes/redux-form.md)
2120
* [Redux Persist](/docs/recipes/redux-persist.md)
2221
* [Redux Saga](/docs/recipes/redux-saga.md)
22+
* [Redux Observable](/docs/recipes/redux-observable.md)
2323
* [React Native](/docs/recipes/react-native.md)
2424
* [React Chrome Redux](/docs/recipes/react-chrome-redux.md)
2525
* [Server Side Rendering](/docs/recipes/ssr.md)

bin/api-docs-generate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const exec = require('child_process').exec
22
const files = [
33
{
4-
src: 'connect.js',
4+
src: 'firebaseConnect.js',
55
dest: 'connect.md'
66
},
77
{

docs/api/compose.md

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@ Middleware that handles configuration (placed in redux's
55

66
**Properties**
77

8-
- `fbConfig` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object containing Firebase config including
9-
databaseURL or Firebase instance
10-
- `fbConfig.apiKey` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Firebase apiKey
11-
- `fbConfig.authDomain` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Firebase auth domain
12-
- `fbConfig.databaseURL` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Firebase database url
13-
- `fbConfig.storageBucket` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Firebase storage bucket
14-
- `config` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Containing react-redux-firebase specific config
15-
such as userProfile
16-
- `config.userProfile` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Location on firebase to store user
17-
profiles
18-
- `config.enableLogging` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not to enable Firebase
19-
database logging
8+
- `firebaseInstance` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Initiated firebase instance (can also
9+
be library following Firebase JS API such as `react-native-firebase`)
10+
- `config` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Containing react-redux-firebase specific configuration
11+
- `config.userProfile` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Location on firebase to store user profiles
12+
- `config.enableLogging` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not to enable Firebase database logging.
13+
**Note**: Only works if instance has enableLogging function.
14+
- `config.profileFactory` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** Factory for modifying how user profile is saved.
15+
- `config.presence` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Location on Firebase to store currently
16+
online users list. Often set to `'presence'` or `'onlineUsers'`.
17+
- `config.sessions` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Location on Firebase where user
18+
sessions are stored (only if presense is set). Often set to `'sessions'` or `'onlineUsers'`.
2019
- `config.updateProfileOnLogin` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not to update
2120
profile when logging in. (default: `false`)
2221
- `config.enableRedirectHandling` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not to enable
@@ -32,15 +31,13 @@ Middleware that handles configuration (placed in redux's
3231
result is returned. Argument Pattern: `(authData, firebase, dispatch)`
3332
- `config.customAuthParameters` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object for setting which
3433
customAuthParameters are passed to external auth providers.
35-
- `config.profileFactory` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** Factory for modifying how user
36-
profile is saved.
3734
- `config.uploadFileDataFactory` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** Factory for modifying
3835
how file meta data is written during file uploads
3936
- `config.profileParamsToPopulate` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String))** Parameters within
40-
profile object to populate
41-
- `config.autoPopulateProfile` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not to
42-
automatically populate profile with data loaded through
43-
profileParamsToPopulate config. (default: `true`)
37+
profile object to populate. As of `v2.0.0` data is only loaded for population, not actually automatically populated
38+
(allows access to both unpopulated and populated profile data).
39+
- `config.autoPopulateProfile` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** **NOTE**: Not yet enabled for v2.0.0. Whether or not to
40+
automatically populate profile with data loaded through profileParamsToPopulate config. (default: `true`)
4441
- `config.setProfilePopulateResults` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not to
4542
call SET actions for data that results from populating profile to redux under
4643
the data path. For example: role paramter on profile populated from 'roles'
@@ -76,19 +73,5 @@ const createStoreWithFirebase = compose(
7673
const store = createStoreWithFirebase(rootReducer, initialState)
7774
```
7875

79-
_Custom Auth Parameters_
80-
81-
```javascript
82-
// Follow Setup example with the following config:
83-
const config = {
84-
customAuthParameters: {
85-
google: {
86-
// prompts user to select account on every google login
87-
prompt: 'select_account'
88-
}
89-
}
90-
}
91-
```
92-
9376
Returns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** That accepts a component and returns a Component which
9477
wraps the provided component (higher order component).

docs/api/constants.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ Default configuration options
6464
- `presence` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** `null` Location on Firebase where of currently
6565
online users is stored. Often set to `'presence'` or `'onlineUsers'`.
6666
- `sessions` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** `sessions` Location on Firebase where user
67-
sessions are stored (only if presense is set). Often set to `'presence'` or
68-
`'onlineUsers'`.
67+
sessions are stored (only if presense is set). Often set to `'sessions'` or
68+
`'userSessions'`.
6969
- `enableLogging` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** `false` Whether or not firebase
7070
database logging is enabled.
7171
- `updateProfileOnLogin` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** `true` Whether or not to update

docs/recipes/epics.md

Lines changed: 0 additions & 36 deletions
This file was deleted.

docs/recipes/redux-observable.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,24 @@ const somethingEpic = (action$, store, getFirebase) =>
1616
)
1717
```
1818

19-
## Write To Firebase As User Types
19+
## Write User Input To Firebase
2020

21-
`redux-observable` can easily be used with `redux-form` to write changes to Firebase as a user types into an input, [see the `redux-form` recipes section for more details](/docs/recipes/redux-form.md)
21+
`redux-observable` can easily be used with `redux-form` to write changes to Firebase as a user types into an input, [see the `redux-form` recipes section for more details](/docs/recipes/redux-form.md)/
22+
23+
In the Angular world this has been called "3-Way Data Binding".
24+
25+
### Debounced Notifications
26+
Debounce writing to a ref on Firebase such as `/notifications` (useful so that tons of similar notifications aren't created).
27+
28+
```js
29+
const SEND_NOTIFICATION = 'SEND_NOTIFICATION';
30+
31+
export const notificationEpic = (action$, { getState, dispatch }, { getFirebase }) =>
32+
action$.ofType(SEND_NOTIFICATION) // stream of notification actions
33+
.debounceTime(2000) // debounce SEND_NOTIFICATION actions by 2 seconds
34+
.do((action) => {
35+
// push the notification object to the notifications ref
36+
return getFirebase().push('/notifications', action.payload)
37+
})
38+
.mapTo({ type: 'EMAIL_NOTIFICATION_CREATED' });
39+
```

docs/v2-migration-guide.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* allows any version of Firebase to be used
1212
* allows [`react-native-firebase`](https://github.com/invertase/react-native-firebase) to be passed (for using native modules instead of JS within `react-native`)
1313
* firebase is no longer a dependency (shrinks umd bundle size)
14+
* `profileParamsToPopulate` does not automatically populate profile, populated version can be loaded with `populate` (there will most likely be an option to enable auto populating before `v2.0.0` is out of pre-release)
1415

1516
### Pass In Firebase instance
1617

0 commit comments

Comments
 (0)