@cosmotech/core 1.19.0 → 1.19.1-beta.0

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.
Binary file
package/dist/index.cjs.js CHANGED
@@ -57370,13 +57370,15 @@ var acquireTokens = /*#__PURE__*/function () {
57370
57370
  }();
57371
57371
  var handleResponse = response => {
57372
57372
  if (response != null) {
57373
+ var _account$idTokenClaim, _account$idTokenClaim2;
57373
57374
  var account = response.account;
57374
57375
  _updateTokensInStorage(response);
57375
57376
  writeToStorage('authIdTokenPopup', response.idToken);
57376
57377
  writeToStorage('authAuthenticated', 'true');
57377
57378
  writeToStorage('authAccountId', account.homeAccountId);
57379
+ writeToStorage('authEmail', (_account$idTokenClaim = account.idTokenClaims) === null || _account$idTokenClaim === void 0 ? void 0 : _account$idTokenClaim.email);
57378
57380
  authData.accountId = account.homeAccountId;
57379
- authData.userEmail = account.username; // In MSAL account data, username property contains user email
57381
+ authData.userEmail = (_account$idTokenClaim2 = account.idTokenClaims) === null || _account$idTokenClaim2 === void 0 ? void 0 : _account$idTokenClaim2.email;
57380
57382
  authData.username = account.name;
57381
57383
  authData.userId = account.localAccountId;
57382
57384
  redirectOnAuthSuccess();
@@ -57402,6 +57404,7 @@ var signOut = () => {
57402
57404
  clearFromStorage('authIdToken');
57403
57405
  clearFromStorage('authAccessToken');
57404
57406
  clearFromStorage('authAccountId');
57407
+ clearFromStorage('authEmail');
57405
57408
  writeToStorage('authAuthenticated', 'false');
57406
57409
  var logoutRequest = {
57407
57410
  account: msalApp.getAccountByHomeId((_authData$accountId = authData.accountId) !== null && _authData$accountId !== void 0 ? _authData$accountId : accountId),
@@ -57493,10 +57496,10 @@ var refreshTokens = /*#__PURE__*/function () {
57493
57496
  };
57494
57497
  }();
57495
57498
  var getUserEmail = () => {
57496
- var _authData$userEmail, _msalApp$getAllAccoun2;
57499
+ var _ref6, _readFromStorage, _msalApp$getAllAccoun2;
57497
57500
  if (!checkInit()) return;
57498
57501
  // Note: account data from MSAL seems to contain user email in the 'username' property
57499
- return (_authData$userEmail = authData === null || authData === void 0 ? void 0 : authData.userEmail) !== null && _authData$userEmail !== void 0 ? _authData$userEmail : (_msalApp$getAllAccoun2 = msalApp.getAllAccounts()) === null || _msalApp$getAllAccoun2 === void 0 || (_msalApp$getAllAccoun2 = _msalApp$getAllAccoun2[0]) === null || _msalApp$getAllAccoun2 === void 0 ? void 0 : _msalApp$getAllAccoun2.username;
57502
+ return (_ref6 = (_readFromStorage = readFromStorage('authEmail')) !== null && _readFromStorage !== void 0 ? _readFromStorage : authData === null || authData === void 0 ? void 0 : authData.userEmail) !== null && _ref6 !== void 0 ? _ref6 : (_msalApp$getAllAccoun2 = msalApp.getAllAccounts()) === null || _msalApp$getAllAccoun2 === void 0 || (_msalApp$getAllAccoun2 = _msalApp$getAllAccoun2[0]) === null || _msalApp$getAllAccoun2 === void 0 ? void 0 : _msalApp$getAllAccoun2.username;
57500
57503
  };
57501
57504
  var getUserName = () => {
57502
57505
  var _authData$name, _msalApp$getAllAccoun3;
package/dist/index.esm.js CHANGED
@@ -57368,13 +57368,15 @@ var acquireTokens = /*#__PURE__*/function () {
57368
57368
  }();
57369
57369
  var handleResponse = response => {
57370
57370
  if (response != null) {
57371
+ var _account$idTokenClaim, _account$idTokenClaim2;
57371
57372
  var account = response.account;
57372
57373
  _updateTokensInStorage(response);
57373
57374
  writeToStorage('authIdTokenPopup', response.idToken);
57374
57375
  writeToStorage('authAuthenticated', 'true');
57375
57376
  writeToStorage('authAccountId', account.homeAccountId);
57377
+ writeToStorage('authEmail', (_account$idTokenClaim = account.idTokenClaims) === null || _account$idTokenClaim === void 0 ? void 0 : _account$idTokenClaim.email);
57376
57378
  authData.accountId = account.homeAccountId;
57377
- authData.userEmail = account.username; // In MSAL account data, username property contains user email
57379
+ authData.userEmail = (_account$idTokenClaim2 = account.idTokenClaims) === null || _account$idTokenClaim2 === void 0 ? void 0 : _account$idTokenClaim2.email;
57378
57380
  authData.username = account.name;
57379
57381
  authData.userId = account.localAccountId;
57380
57382
  redirectOnAuthSuccess();
@@ -57400,6 +57402,7 @@ var signOut = () => {
57400
57402
  clearFromStorage('authIdToken');
57401
57403
  clearFromStorage('authAccessToken');
57402
57404
  clearFromStorage('authAccountId');
57405
+ clearFromStorage('authEmail');
57403
57406
  writeToStorage('authAuthenticated', 'false');
57404
57407
  var logoutRequest = {
57405
57408
  account: msalApp.getAccountByHomeId((_authData$accountId = authData.accountId) !== null && _authData$accountId !== void 0 ? _authData$accountId : accountId),
@@ -57491,10 +57494,10 @@ var refreshTokens = /*#__PURE__*/function () {
57491
57494
  };
57492
57495
  }();
57493
57496
  var getUserEmail = () => {
57494
- var _authData$userEmail, _msalApp$getAllAccoun2;
57497
+ var _ref6, _readFromStorage, _msalApp$getAllAccoun2;
57495
57498
  if (!checkInit()) return;
57496
57499
  // Note: account data from MSAL seems to contain user email in the 'username' property
57497
- return (_authData$userEmail = authData === null || authData === void 0 ? void 0 : authData.userEmail) !== null && _authData$userEmail !== void 0 ? _authData$userEmail : (_msalApp$getAllAccoun2 = msalApp.getAllAccounts()) === null || _msalApp$getAllAccoun2 === void 0 || (_msalApp$getAllAccoun2 = _msalApp$getAllAccoun2[0]) === null || _msalApp$getAllAccoun2 === void 0 ? void 0 : _msalApp$getAllAccoun2.username;
57500
+ return (_ref6 = (_readFromStorage = readFromStorage('authEmail')) !== null && _readFromStorage !== void 0 ? _readFromStorage : authData === null || authData === void 0 ? void 0 : authData.userEmail) !== null && _ref6 !== void 0 ? _ref6 : (_msalApp$getAllAccoun2 = msalApp.getAllAccounts()) === null || _msalApp$getAllAccoun2 === void 0 || (_msalApp$getAllAccoun2 = _msalApp$getAllAccoun2[0]) === null || _msalApp$getAllAccoun2 === void 0 ? void 0 : _msalApp$getAllAccoun2.username;
57498
57501
  };
57499
57502
  var getUserName = () => {
57500
57503
  var _authData$name, _msalApp$getAllAccoun3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmotech/core",
3
- "version": "1.19.0",
3
+ "version": "1.19.1-beta.0",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",