mario-core 2.9.210-release → 2.9.212-release

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.
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const ButtonLogin: ({ fnLoginSSO }: any) => JSX.Element;
3
+ export default ButtonLogin;
@@ -0,0 +1,38 @@
1
+ import { LogLevel } from "@azure/msal-browser";
2
+ /**
3
+ * Configuration object to be passed to MSAL instance on creation.
4
+ * For a full list of MSAL.js configuration parameters, visit:
5
+ * https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/configuration.md
6
+ */
7
+ export declare const msalConfig: {
8
+ auth: {
9
+ clientId: string;
10
+ authority: string;
11
+ redirectUri: string;
12
+ };
13
+ cache: {
14
+ cacheLocation: string;
15
+ storeAuthStateInCookie: boolean;
16
+ };
17
+ system: {
18
+ loggerOptions: {
19
+ loggerCallback: (level: LogLevel, message: string, containsPii: any) => void;
20
+ };
21
+ };
22
+ };
23
+ /**
24
+ * Scopes you add here will be prompted for user consent during sign-in.
25
+ * By default, MSAL.js will add OIDC scopes (openid, profile, email) to any login request.
26
+ * For more information about OIDC scopes, visit:
27
+ * https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent#openid-connect-scopes
28
+ */
29
+ export declare const loginRequest: {
30
+ scopes: string[];
31
+ };
32
+ /**
33
+ * Add here the scopes to request when obtaining an access token for MS Graph API. For more information, see:
34
+ * https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/resources-and-scopes.md
35
+ */
36
+ export declare const graphConfig: {
37
+ graphMeEndpoint: string;
38
+ };
@@ -0,0 +1,6 @@
1
+ export declare const config: {
2
+ appId: string;
3
+ redirectUri: string;
4
+ scopes: string[];
5
+ authority: string;
6
+ };
package/dist/index.js CHANGED
@@ -22381,6 +22381,10 @@ var useLogin = function useLogin() {
22381
22381
  profileImageFileName: profileImageFileName
22382
22382
  }));
22383
22383
 
22384
+ if (!localStorage.getItem("ROLES") && roles.includes("Admin")) {
22385
+ localStorage.setItem("ROLES", "Admin");
22386
+ }
22387
+
22384
22388
  if (data !== null && data !== void 0 && data.email && !roles.includes("Admin")) {
22385
22389
  var _data$roles;
22386
22390
 
@@ -23794,6 +23798,7 @@ var TheSidebar = function TheSidebar(_ref) {
23794
23798
 
23795
23799
  var signOut = React.useCallback(function () {
23796
23800
  localStorage.removeItem(ACCESS_TOKEN);
23801
+ localStorage.removeItem("ROLES");
23797
23802
  dispatch(reset());
23798
23803
  history.push("/");
23799
23804
  }, []);
@@ -23986,6 +23991,7 @@ var TheHeaderDropdown = function TheHeaderDropdown(_ref) {
23986
23991
  var isTeacher = roles.includes(TEACHER_ROLE);
23987
23992
  var signOut = React.useCallback(function () {
23988
23993
  localStorage.removeItem(ACCESS_TOKEN);
23994
+ localStorage.removeItem("ROLES");
23989
23995
  dispatch(reset());
23990
23996
  history.push("/");
23991
23997
  }, []);
@@ -24297,11 +24303,7 @@ var ModelSelectRole = function ModelSelectRole(_ref) {
24297
24303
  var roles = user === null || user === void 0 ? void 0 : user.roles;
24298
24304
 
24299
24305
  var handleSelectUserRoles = function handleSelectUserRoles(roles) {
24300
- if (roles.includes("Admin")) {
24301
- dispatch(setLoading(true));
24302
- return history.push("/admin/dashboard");
24303
- }
24304
-
24306
+ dispatch(setLoading(true));
24305
24307
  var roleSelect = roles.includes("Teacher/Assistant") ? ["Teacher", "Assistant"] : roles;
24306
24308
  dispatch(setUser(_extends({}, user, {
24307
24309
  roles: roleSelect
@@ -24311,6 +24313,8 @@ var ModelSelectRole = function ModelSelectRole(_ref) {
24311
24313
 
24312
24314
  if (roles.includes("Parent")) {
24313
24315
  history.push("/parent");
24316
+ } else if (roles.includes("Admin")) {
24317
+ history.push("/admin/dashboard");
24314
24318
  } else {
24315
24319
  pathname !== "/home" ? history.push("/home") : window.location.reload();
24316
24320
  }