@evoke-platform/context 1.3.0-dev.6 → 1.3.0-dev.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,7 @@ export type AuthenticationContext = {
9
9
  export type UserAccount = {
10
10
  id: string;
11
11
  name?: string;
12
+ lastLoginTime?: number;
12
13
  };
13
14
  export type AuthenticationContextProviderProps = {
14
15
  msal?: IMsalContext;
@@ -41,18 +41,25 @@ function MsalProvider({ msal, authRequest, children }) {
41
41
  }
42
42
  });
43
43
  }, [msal, authRequest, account]);
44
- const context = useMemo(() => account
45
- ? {
46
- account: { id: account.localAccountId, name: account.name },
47
- logout: () => {
48
- msal.instance.logoutRedirect({
49
- account,
50
- postLogoutRedirectUri: `/logout?p=${encodeURIComponent(window.location.pathname + window.location.search)}`,
51
- });
52
- },
53
- getAccessToken,
54
- }
55
- : undefined, [account, msal, getAccessToken, authRequest]);
44
+ const context = useMemo(() => {
45
+ var _a;
46
+ return account
47
+ ? {
48
+ account: {
49
+ id: account.localAccountId,
50
+ name: account.name,
51
+ lastLoginTime: (_a = account.idTokenClaims) === null || _a === void 0 ? void 0 : _a.last_login_time,
52
+ },
53
+ logout: () => {
54
+ msal.instance.logoutRedirect({
55
+ account,
56
+ postLogoutRedirectUri: `/logout?p=${encodeURIComponent(window.location.pathname + window.location.search)}`,
57
+ });
58
+ },
59
+ getAccessToken,
60
+ }
61
+ : undefined;
62
+ }, [account, msal, getAccessToken, authRequest]);
56
63
  return _jsx(Context.Provider, { value: context, children: children });
57
64
  }
58
65
  function OidcProvider({ authRequest, children }) {
@@ -95,7 +102,11 @@ function OidcProvider({ authRequest, children }) {
95
102
  }, [auth, authRequest]);
96
103
  const context = useMemo(() => auth.isAuthenticated && auth.user
97
104
  ? {
98
- account: { id: auth.user.profile.sub, name: auth.user.profile.name },
105
+ account: {
106
+ id: auth.user.profile.sub,
107
+ name: auth.user.profile.name,
108
+ lastLoginTime: auth.user.profile.auth_time,
109
+ },
99
110
  logout: () => {
100
111
  auth.signoutRedirect({
101
112
  post_logout_redirect_uri: `/logout?p=${encodeURIComponent(window.location.pathname + window.location.search)}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evoke-platform/context",
3
- "version": "1.3.0-dev.6",
3
+ "version": "1.3.0-dev.7",
4
4
  "description": "Utilities that provide context to Evoke platform widgets",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",