Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix component prop type validation to use elementType #321

Merged
merged 2 commits into from
Oct 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/context/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ render(<App />, document.getElementById('root'));

```javascript
const propTypes = {
notAuthenticated: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), // react component displayed during authentication
notAuthorized: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), // react component displayed in case user is not Authorised
authenticating: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), // react component displayed when about to redirect user to be authenticated
callbackComponentOverride: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), // react component displayed when user is connected
notAuthenticated: PropTypes.elementType, // react component displayed during authentication
notAuthorized: PropTypes.elementType, // react component displayed in case user is not Authorised
authenticating: PropTypes.elementType, // react component displayed when about to redirect user to be authenticated
callbackComponentOverride: PropTypes.elementType, // react component displayed when user is connected
configuration: PropTypes.shape({
client_id: PropTypes.string.isRequired, // oidc client configuration, the same as oidc client library used internally https://github.com/IdentityModel/oidc-client-js
redirect_uri: PropTypes.string.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import withServices from '../withServices';
export const AuthenticationContext = React.createContext(null);

const propTypes = {
notAuthenticated: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
notAuthorized: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
authenticating: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
callbackComponentOverride: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
notAuthenticated: PropTypes.elementType,
notAuthorized: PropTypes.elementType,
authenticating: PropTypes.elementType,
callbackComponentOverride: PropTypes.elementType,
configuration: PropTypes.shape({
client_id: PropTypes.string.isRequired,
redirect_uri: PropTypes.string.isRequired,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/routes/OidcRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { getPath } from './route-utils';
import { SilentCallback } from '../callbacks';

const propTypes = {
notAuthenticated: PropTypes.node,
notAuthorized: PropTypes.node,
notAuthenticated: PropTypes.elementType,
notAuthorized: PropTypes.elementType,
callbackComponent: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).isRequired,
configuration: PropTypes.shape({
redirect_uri: PropTypes.string.isRequired,
Expand Down
6 changes: 3 additions & 3 deletions packages/redux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ The optional parameter "isEnabled" allows you to enable or disable authenticatio

```javascript
const propTypes = {
notAuthenticated: PropTypes.node, // react component displayed during authentication
callbackComponentOverride: PropTypes.node, // react component displayed when user is connected
notAuthorized: PropTypes.node, // react component displayed in case user is not Authorised
notAuthenticated: PropTypes.elementType, // react component displayed during authentication
callbackComponentOverride: PropTypes.elementType, // react component displayed when user is connected
notAuthorized: PropTypes.elementType, // react component displayed in case user is not Authorised
configuration: PropTypes.shape({
client_id: PropTypes.string.isRequired, // oidc client configuration, the same as oidc client library used internally https://github.com/IdentityModel/oidc-client-js
redirect_uri: PropTypes.string.isRequired,
Expand Down
2 changes: 1 addition & 1 deletion packages/redux/src/AuthenticationCallback.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import PropTypes from 'prop-types';
const propTypes = {
history: PropTypes.object.isRequired,
userManager: PropTypes.object.isRequired,
callbackComponentOverride: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
callbackComponentOverride: PropTypes.elementType,
};

const defaultProps = {
Expand Down
6 changes: 3 additions & 3 deletions packages/redux/src/Oidc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import { OidcRoutes, authenticationService, getUserManager } from '@axa-fr/react
import AuthenticationCallback from './AuthenticationCallback';

const propTypes = {
notAuthenticated: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
notAuthorized: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
notAuthenticated: PropTypes.elementType,
notAuthorized: PropTypes.elementType,
configuration: PropTypes.object.isRequired,
store: PropTypes.object.isRequired,
isEnabled: PropTypes.bool,
children: PropTypes.node,
callbackComponentOverride: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
callbackComponentOverride: PropTypes.elementType,
};

const defaultPropsObject = {
Expand Down