Skip to content

Commit e67bbd7

Browse files
authored
v3.7.0 (#988)
* feat(populate): added support for `storeAs` when populating child from redux - @nagarjuna993 * fix(types): change `updateProfile` return type (#975) - @nikitakost * feat(auth): github OAuth provider option in login (#986) - @davidepalazzo * chore(deps): update babel dev dependencies to ^7.10.4
1 parent db3e802 commit e67bbd7

File tree

8 files changed

+2414
-2680
lines changed

8 files changed

+2414
-2680
lines changed

docs/auth.md

+148-116
Large diffs are not rendered by default.

index.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ interface CreateUserCredentials {
596596
type Credentials =
597597
| CreateUserCredentials
598598
| {
599-
provider: 'facebook' | 'google' | 'twitter'
599+
provider: 'facebook' | 'google' | 'twitter' | 'github' | 'microsoft.com' | 'apple.com' | 'yahoo.com'
600600
type: 'popup' | 'redirect'
601601
scopes?: string[]
602602
}
@@ -734,7 +734,7 @@ interface ExtendedAuthInstance {
734734
* @see https://react-redux-firebase.com/docs/api/firebaseInstance.html#updateprofile
735735
* @see https://react-redux-firebase.com/docs/recipes/profile.html#update-profile
736736
*/
737-
updateProfile: (profile: Partial<ProfileType>, options?: Object) => void
737+
updateProfile: (profile: Partial<ProfileType>, options?: Object) => Promise<void>
738738
}
739739

740740
/**

package-lock.json

+2,209-2,534
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+24-23
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-redux-firebase",
3-
"version": "3.6.0",
3+
"version": "3.7.0",
44
"description": "Redux integration for Firebase. Comes with a Higher Order Components for use with React.",
55
"main": "lib/index.js",
66
"module": "es/index.js",
@@ -53,28 +53,29 @@
5353
"react",
5454
"babel",
5555
"hoc",
56+
"hooks",
5657
"redux-react-firebase"
5758
],
5859
"dependencies": {
5960
"hoist-non-react-statics": "^3.3.2",
60-
"lodash": "^4.17.15",
61+
"lodash": "^4.17.19",
6162
"prop-types": "^15.7.2"
6263
},
6364
"peerDependencies": {
6465
"react": "^16.3.0"
6566
},
6667
"devDependencies": {
67-
"@babel/cli": "^7.10.1",
68-
"@babel/core": "^7.10.1",
69-
"@babel/plugin-proposal-class-properties": "^7.10.1",
70-
"@babel/plugin-transform-async-to-generator": "^7.10.1",
71-
"@babel/plugin-transform-modules-commonjs": "^7.10.1",
72-
"@babel/plugin-transform-regenerator": "^7.10.1",
73-
"@babel/plugin-transform-runtime": "^7.10.1",
74-
"@babel/preset-env": "^7.10.1",
75-
"@babel/preset-react": "^7.10.1",
76-
"@babel/register": "^7.10.1",
77-
"@babel/runtime": "^7.10.1",
68+
"@babel/cli": "^7.10.5",
69+
"@babel/core": "^7.10.5",
70+
"@babel/plugin-proposal-class-properties": "^7.10.4",
71+
"@babel/plugin-transform-async-to-generator": "^7.10.4",
72+
"@babel/plugin-transform-modules-commonjs": "^7.10.4",
73+
"@babel/plugin-transform-regenerator": "^7.10.4",
74+
"@babel/plugin-transform-runtime": "^7.10.5",
75+
"@babel/preset-env": "^7.10.4",
76+
"@babel/preset-react": "^7.10.4",
77+
"@babel/register": "^7.10.5",
78+
"@babel/runtime": "^7.10.5",
7879
"babel-eslint": "^10.1.0",
7980
"babel-loader": "^8.1.0",
8081
"babel-plugin-add-module-exports": "^1.0.2",
@@ -90,25 +91,25 @@
9091
"documentation-markdown-api-theme": "^1.0.2",
9192
"enzyme": "^3.10.0",
9293
"enzyme-adapter-react-16": "^1.14.0",
93-
"eslint": "^7.2.0",
94-
"eslint-config-prettier": "^6.10.0",
94+
"eslint": "^7.5.0",
95+
"eslint-config-prettier": "^6.11.0",
9596
"eslint-config-standard": "^14.1.1",
9697
"eslint-config-standard-react": "^9.2.0",
9798
"eslint-plugin-babel": "^5.3.0",
98-
"eslint-plugin-import": "^2.20.1",
99-
"eslint-plugin-jsdoc": "^22.1.0",
100-
"eslint-plugin-node": "^11.0.0",
101-
"eslint-plugin-prettier": "^2.1.2",
102-
"eslint-plugin-promise": "^3.5.0",
103-
"eslint-plugin-react": "^7.19.0",
104-
"eslint-plugin-react-hooks": "^2.5.1",
99+
"eslint-plugin-import": "^2.22.0",
100+
"eslint-plugin-jsdoc": "^30.0.3",
101+
"eslint-plugin-node": "^11.1.0",
102+
"eslint-plugin-prettier": "^3.1.4",
103+
"eslint-plugin-promise": "^4.2.1",
104+
"eslint-plugin-react": "^7.20.0",
105+
"eslint-plugin-react-hooks": "^4.0.8",
105106
"eslint-plugin-standard": "^4.0.1",
106107
"firebase": "7.14.6",
107108
"firebase-server": "^1.0.2",
108109
"gitbook-cli": "^2.3.2",
109110
"husky": "^4.2.3",
110111
"jsdom": "^11.10.0",
111-
"lint-staged": "^10.2.7",
112+
"lint-staged": "^10.2.11",
112113
"lodash-webpack-plugin": "^0.11.5",
113114
"mocha": "^3.5.3",
114115
"nyc": "^15.0.0",

src/constants.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,9 @@ export const supportedAuthProviders = [
231231
'github',
232232
'twitter',
233233
'facebook',
234-
'microsoft.com'
234+
'microsoft.com',
235+
'apple.com',
236+
'yahoo.com'
235237
]
236238

237239
/**

src/helpers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ function populateChild(state, child, p) {
234234
// populate child is key
235235
if (typeof childVal === 'string' || childVal instanceof String) {
236236
// attach child paramter if it exists
237-
const dotRoot = p.root
237+
const dotRoot = (p.storeAs ? p.storeAs : p.root)
238238
.split('/')
239239
.filter(Boolean) // Drop falsey values (compact)
240240
.join('.')

src/utils/auth.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@ function createAuthProvider(firebase, providerName, scopes) {
1313
// TODO: Verify scopes are valid before adding
1414
// TODO: Validate parameter inputs
1515

16-
if (providerName.toLowerCase() === 'microsoft.com') {
17-
const provider = new firebase.auth.OAuthProvider('microsoft.com')
16+
const lowerCaseProviderName = providerName.toLowerCase()
17+
18+
if (
19+
lowerCaseProviderName === 'microsoft.com' ||
20+
lowerCaseProviderName === 'apple.com' ||
21+
lowerCaseProviderName === 'yahoo.com'
22+
) {
23+
const provider = new firebase.auth.OAuthProvider(providerName)
1824
return provider
1925
}
2026

@@ -38,7 +44,7 @@ function createAuthProvider(firebase, providerName, scopes) {
3844

3945
// Handle providers without scopes
4046
if (
41-
providerName.toLowerCase() === 'twitter' ||
47+
lowerCaseProviderName === 'twitter' ||
4248
typeof provider.addScope !== 'function'
4349
) {
4450
return provider

test/unit/utils/auth.spec.js

+18
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,24 @@ describe('Utils: Auth', () => {
2626
).to.include.keys('method')
2727
})
2828

29+
it('github provider', () => {
30+
expect(
31+
getLoginMethodAndParams(firebase, { provider: 'github' })
32+
).to.include.keys('method')
33+
})
34+
35+
it('apple.com provider', () => {
36+
expect(
37+
getLoginMethodAndParams(firebase, { provider: 'apple.com' })
38+
).to.include.keys('method')
39+
})
40+
41+
it('yahoo.com provider', () => {
42+
expect(
43+
getLoginMethodAndParams(firebase, { provider: 'yahoo.com' })
44+
).to.include.keys('method')
45+
})
46+
2947
it('token', () => {
3048
expect(
3149
getLoginMethodAndParams(firebase, { token: 'asdf' })

0 commit comments

Comments
 (0)