@evoke-platform/context 1.3.0-dev.10 → 1.3.0-dev.12

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
+ username?: string;
12
13
  lastLoginTime?: number;
13
14
  activeMfaSession?: boolean;
14
15
  };
@@ -48,6 +48,7 @@ function MsalProvider({ msal, authRequest, children }) {
48
48
  account: {
49
49
  id: account.localAccountId,
50
50
  name: account.name,
51
+ username: account.username,
51
52
  lastLoginTime: (_a = account.idTokenClaims) === null || _a === void 0 ? void 0 : _a.last_login_time,
52
53
  activeMfaSession: Boolean((_b = account.idTokenClaims) === null || _b === void 0 ? void 0 : _b.active_mfa_session),
53
54
  },
@@ -102,19 +103,20 @@ function OidcProvider({ authRequest, children }) {
102
103
  });
103
104
  }, [auth, authRequest]);
104
105
  const context = useMemo(() => {
105
- var _a, _b, _c;
106
+ var _a, _b, _c, _d;
106
107
  return auth.isAuthenticated && auth.user
107
108
  ? {
108
109
  account: {
109
110
  id: auth.user.profile.sub,
110
111
  name: (_a = auth.user.profile.name) !== null && _a !== void 0 ? _a : (`${(_b = auth.user.profile.given_name) !== null && _b !== void 0 ? _b : ''} ${(_c = auth.user.profile.family_name) !== null && _c !== void 0 ? _c : ''}` ||
111
112
  undefined),
113
+ username: (_d = auth.user.profile.preferred_username) !== null && _d !== void 0 ? _d : auth.user.profile.email,
112
114
  lastLoginTime: auth.user.profile.lastLoginTime,
113
115
  },
114
116
  logout: () => {
115
117
  auth.signoutRedirect({
116
118
  // Fusion auth requires an absolute url.
117
- post_logout_redirect_uri: `${window.location.origin}/logout`,
119
+ post_logout_redirect_uri: `${window.location.origin}/logout?p=${encodeURIComponent(window.location.pathname + window.location.search)}`,
118
120
  });
119
121
  },
120
122
  getAccessToken,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evoke-platform/context",
3
- "version": "1.3.0-dev.10",
3
+ "version": "1.3.0-dev.12",
4
4
  "description": "Utilities that provide context to Evoke platform widgets",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",