Skip to content

Commit c3f4de4

Browse files
authored
Merge pull request #43 from 8base/add-email-verified
feat: add isEmailVerified data
2 parents 284df8a + 94db702 commit c3f4de4

File tree

12 files changed

+77
-87
lines changed

12 files changed

+77
-87
lines changed

examples/with-api-token-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"dependencies": {
66
"8base-react-sdk": "^1.5.0",
7-
"@8base/auth": "^1.3.2",
7+
"@8base/auth": "^1.4.0",
88
"apollo-client": "^2.6.3",
99
"graphql": "^14.3.1",
1010
"react": "^16.8.6",

examples/with-authorization-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"dependencies": {
66
"8base-react-sdk": "^1.5.0",
7-
"@8base/auth": "^1.3.2",
7+
"@8base/auth": "^1.4.0",
88
"apollo-client": "^2.6.3",
99
"graphql": "^14.3.1",
1010
"react": "^16.8.6",

examples/with-protected-routes/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"dependencies": {
66
"8base-react-sdk": "^1.5.0",
7-
"@8base/auth": "^1.3.2",
7+
"@8base/auth": "^1.4.0",
88
"apollo-client": "^2.6.3",
99
"graphql": "^14.3.1",
1010
"react": "^16.8.6",

packages/app-provider/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
"dependencies": {
2222
"@8base-react/auth": "^1.5.0",
2323
"@8base-react/table-schema-provider": "^1.5.0",
24-
"@8base/apollo-client": "^1.3.2",
25-
"@8base/auth": "^1.3.2",
24+
"@8base/apollo-client": "^1.4.0",
25+
"@8base/auth": "^1.4.0",
2626
"@8base/error-codes": "^1.0.22",
27-
"@8base/utils": "^1.3.2",
27+
"@8base/utils": "^1.4.0",
2828
"apollo-cache-inmemory": "^1.5.1",
2929
"ramda": "^0.26.1"
3030
},
3131
"devDependencies": {
32-
"@8base/web-auth0-auth-client": "^1.2.8",
32+
"@8base/web-auth0-auth-client": "^1.4.0",
3333
"@types/graphql": "^0.13.0",
3434
"@types/jest": "^24.0.13",
3535
"@types/node": "^12.0.2",

packages/auth/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
},
1818
"dependencies": {
1919
"@8base-react/utils": "^1.5.0",
20-
"@8base/auth": "^1.3.2",
21-
"@8base/utils": "^1.3.2"
20+
"@8base/auth": "^1.4.0",
21+
"@8base/utils": "^1.4.0"
2222
},
2323
"devDependencies": {
2424
"@types/jest": "^24.0.13",

packages/auth/src/AuthContext.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ISubscribableAuthClient } from '@8base/auth';
44

55
export type AuthContextProps = {
66
isAuthorized: boolean;
7+
isEmailVerified?: boolean;
78
authState: IAuthState;
89
authClient: ISubscribableAuthClient;
910
};

packages/auth/src/AuthProvider.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ type AuthProviderProps = {
1111

1212
type AuthProviderState = {
1313
isAuthorized: boolean;
14+
isEmailVerified?: boolean;
1415
authState: IAuthState;
1516
};
1617

@@ -54,8 +55,10 @@ class AuthProvider extends React.Component<AuthProviderProps, AuthProviderState>
5455

5556
const authState = authClient.getState();
5657
const isAuthorized = authClient.checkIsAuthorized();
58+
const isEmailVerified =
59+
authClient.checkIsEmailVerified && (authClient.checkIsEmailVerified() as boolean | undefined);
5760

58-
this.setState({ isAuthorized, authState });
61+
this.setState({ isAuthorized, isEmailVerified, authState });
5962
};
6063

6164
public componentDidMount() {
@@ -82,14 +85,15 @@ class AuthProvider extends React.Component<AuthProviderProps, AuthProviderState>
8285

8386
public render() {
8487
const { children, authClient } = this.props;
85-
const { isAuthorized, authState } = this.state;
88+
const { isAuthorized, isEmailVerified, authState } = this.state;
8689

8790
return (
8891
<AuthContext.Provider
8992
value={{
9093
authClient,
9194
authState,
9295
isAuthorized,
96+
isEmailVerified,
9397
}}
9498
>
9599
{children}

packages/auth/test/utils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ export const DummyAuthClient = (): IAuthClient => {
4646
return externalAuth.logout();
4747
});
4848

49+
const getTokenInfo = jest.fn(() => {
50+
return {};
51+
});
52+
4953
return {
54+
getTokenInfo,
5055
getState,
5156
setState,
5257
purgeState,

packages/crud/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"@8base-react/permissions-provider": "^1.5.0",
2222
"@8base-react/table-schema-provider": "^1.5.0",
2323
"@8base/schema-name-generator": "^0.1.21",
24-
"@8base/utils": "^1.3.2",
24+
"@8base/utils": "^1.4.0",
2525
"graphql-tag": "^2.10.0",
2626
"ramda": "^0.26.1"
2727
},

packages/forms/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
"@8base-react/permissions-provider": "^1.5.0",
2323
"@8base-react/table-schema-provider": "^1.5.0",
2424
"@8base/error-codes": "^1.0.22",
25-
"@8base/utils": "^1.3.2",
26-
"@8base/validate": "^1.3.2",
25+
"@8base/utils": "^1.4.0",
26+
"@8base/validate": "^1.4.0",
2727
"final-form": "^4.20.1",
2828
"final-form-arrays": "^3.0.2",
2929
"graphql-tag": "^2.10.0",

0 commit comments

Comments
 (0)