Skip to content

Commit

Permalink
v3.7.0 (#988)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
prescottprue authored Jul 26, 2020
1 parent db3e802 commit e67bbd7
Show file tree
Hide file tree
Showing 8 changed files with 2,414 additions and 2,680 deletions.
264 changes: 148 additions & 116 deletions docs/auth.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ interface CreateUserCredentials {
type Credentials =
| CreateUserCredentials
| {
provider: 'facebook' | 'google' | 'twitter'
provider: 'facebook' | 'google' | 'twitter' | 'github' | 'microsoft.com' | 'apple.com' | 'yahoo.com'
type: 'popup' | 'redirect'
scopes?: string[]
}
Expand Down Expand Up @@ -734,7 +734,7 @@ interface ExtendedAuthInstance {
* @see https://react-redux-firebase.com/docs/api/firebaseInstance.html#updateprofile
* @see https://react-redux-firebase.com/docs/recipes/profile.html#update-profile
*/
updateProfile: (profile: Partial<ProfileType>, options?: Object) => void
updateProfile: (profile: Partial<ProfileType>, options?: Object) => Promise<void>
}

/**
Expand Down
4,743 changes: 2,209 additions & 2,534 deletions package-lock.json

Large diffs are not rendered by default.

47 changes: 24 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-redux-firebase",
"version": "3.6.0",
"version": "3.7.0",
"description": "Redux integration for Firebase. Comes with a Higher Order Components for use with React.",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down Expand Up @@ -53,28 +53,29 @@
"react",
"babel",
"hoc",
"hooks",
"redux-react-firebase"
],
"dependencies": {
"hoist-non-react-statics": "^3.3.2",
"lodash": "^4.17.15",
"lodash": "^4.17.19",
"prop-types": "^15.7.2"
},
"peerDependencies": {
"react": "^16.3.0"
},
"devDependencies": {
"@babel/cli": "^7.10.1",
"@babel/core": "^7.10.1",
"@babel/plugin-proposal-class-properties": "^7.10.1",
"@babel/plugin-transform-async-to-generator": "^7.10.1",
"@babel/plugin-transform-modules-commonjs": "^7.10.1",
"@babel/plugin-transform-regenerator": "^7.10.1",
"@babel/plugin-transform-runtime": "^7.10.1",
"@babel/preset-env": "^7.10.1",
"@babel/preset-react": "^7.10.1",
"@babel/register": "^7.10.1",
"@babel/runtime": "^7.10.1",
"@babel/cli": "^7.10.5",
"@babel/core": "^7.10.5",
"@babel/plugin-proposal-class-properties": "^7.10.4",
"@babel/plugin-transform-async-to-generator": "^7.10.4",
"@babel/plugin-transform-modules-commonjs": "^7.10.4",
"@babel/plugin-transform-regenerator": "^7.10.4",
"@babel/plugin-transform-runtime": "^7.10.5",
"@babel/preset-env": "^7.10.4",
"@babel/preset-react": "^7.10.4",
"@babel/register": "^7.10.5",
"@babel/runtime": "^7.10.5",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
"babel-plugin-add-module-exports": "^1.0.2",
Expand All @@ -90,25 +91,25 @@
"documentation-markdown-api-theme": "^1.0.2",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0",
"eslint": "^7.2.0",
"eslint-config-prettier": "^6.10.0",
"eslint": "^7.5.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-standard": "^14.1.1",
"eslint-config-standard-react": "^9.2.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jsdoc": "^22.1.0",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^2.1.2",
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^2.5.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsdoc": "^30.0.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-react-hooks": "^4.0.8",
"eslint-plugin-standard": "^4.0.1",
"firebase": "7.14.6",
"firebase-server": "^1.0.2",
"gitbook-cli": "^2.3.2",
"husky": "^4.2.3",
"jsdom": "^11.10.0",
"lint-staged": "^10.2.7",
"lint-staged": "^10.2.11",
"lodash-webpack-plugin": "^0.11.5",
"mocha": "^3.5.3",
"nyc": "^15.0.0",
Expand Down
4 changes: 3 additions & 1 deletion src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ export const supportedAuthProviders = [
'github',
'twitter',
'facebook',
'microsoft.com'
'microsoft.com',
'apple.com',
'yahoo.com'
]

/**
Expand Down
2 changes: 1 addition & 1 deletion src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ function populateChild(state, child, p) {
// populate child is key
if (typeof childVal === 'string' || childVal instanceof String) {
// attach child paramter if it exists
const dotRoot = p.root
const dotRoot = (p.storeAs ? p.storeAs : p.root)
.split('/')
.filter(Boolean) // Drop falsey values (compact)
.join('.')
Expand Down
12 changes: 9 additions & 3 deletions src/utils/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ function createAuthProvider(firebase, providerName, scopes) {
// TODO: Verify scopes are valid before adding
// TODO: Validate parameter inputs

if (providerName.toLowerCase() === 'microsoft.com') {
const provider = new firebase.auth.OAuthProvider('microsoft.com')
const lowerCaseProviderName = providerName.toLowerCase()

if (
lowerCaseProviderName === 'microsoft.com' ||
lowerCaseProviderName === 'apple.com' ||
lowerCaseProviderName === 'yahoo.com'
) {
const provider = new firebase.auth.OAuthProvider(providerName)
return provider
}

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

// Handle providers without scopes
if (
providerName.toLowerCase() === 'twitter' ||
lowerCaseProviderName === 'twitter' ||
typeof provider.addScope !== 'function'
) {
return provider
Expand Down
18 changes: 18 additions & 0 deletions test/unit/utils/auth.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,24 @@ describe('Utils: Auth', () => {
).to.include.keys('method')
})

it('github provider', () => {
expect(
getLoginMethodAndParams(firebase, { provider: 'github' })
).to.include.keys('method')
})

it('apple.com provider', () => {
expect(
getLoginMethodAndParams(firebase, { provider: 'apple.com' })
).to.include.keys('method')
})

it('yahoo.com provider', () => {
expect(
getLoginMethodAndParams(firebase, { provider: 'yahoo.com' })
).to.include.keys('method')
})

it('token', () => {
expect(
getLoginMethodAndParams(firebase, { token: 'asdf' })
Expand Down

0 comments on commit e67bbd7

Please sign in to comment.