l-min-components 1.0.647 → 1.0.650

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "l-min-components",
3
- "version": "1.0.647",
3
+ "version": "1.0.650",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -25,6 +25,7 @@ import InstructorAccountSwitcher from "../instructorAccountSwitcher";
25
25
  import InstructorRightBar from "../fileRightBar/instructorRightBar";
26
26
  import EnterpriseRightBar from "../fileRightBar/enterpriseRightBar";
27
27
  import PersonalRightBar from "../fileRightBar/personalRightBar";
28
+ import useHeader from "../header/getHeaderDetails";
28
29
 
29
30
  const AppMainLayout = () => {
30
31
  const [isOpen, setIsOpen] = useState(true);
@@ -46,6 +47,7 @@ const AppMainLayout = () => {
46
47
  const [affiliatesActive, setAffiliatesActive] = useState(false);
47
48
  const [accessToken, setAccessToken] = useState("");
48
49
  const [envType, setEnvType] = useState("");
50
+ const { setDefaultAccount, handleSetDefaultAccount } = useHeader();
49
51
 
50
52
  useEffect(() => {
51
53
  if (window.location.host.includes("coming")) {
@@ -71,21 +73,42 @@ const AppMainLayout = () => {
71
73
  }, [defaultAcct]);
72
74
 
73
75
  // set access token from cookie to context
76
+
74
77
  useEffect(() => {
75
78
  let cookieValue = null;
76
79
  const cookieName = "access";
80
+
77
81
  // Retrieve the value of the cookie
82
+
78
83
  const cookies = document.cookie.split(";");
79
84
  for (let i = 0; i < cookies.length; i++) {
80
85
  const cookie = cookies[i].trim();
81
86
  if (cookie.startsWith(cookieName + "=")) {
82
87
  cookieValue = cookie.substring(cookieName.length + 1);
83
- setDefaultAcct(cookieValue);
88
+ setAccessToken(cookieValue);
84
89
  break;
85
90
  }
86
91
  }
87
- setAccessToken(cookieValue);
88
- }, [defaultAcct]);
92
+ }, []);
93
+
94
+ // get current account and set as default acct on page load.
95
+
96
+ useEffect(() => {
97
+ let cookieValue = null;
98
+ const cookieName = "defaultAccountID";
99
+
100
+ // Retrieve the value of the cookie
101
+
102
+ const cookies = document.cookie.split(";");
103
+ for (let i = 0; i < cookies.length; i++) {
104
+ const cookie = cookies[i].trim();
105
+ if (cookie.startsWith(cookieName + "=")) {
106
+ cookieValue = cookie.substring(cookieName.length + 1);
107
+ handleSetDefaultAccount(cookieValue);
108
+ break;
109
+ }
110
+ }
111
+ }, []);
89
112
 
90
113
  // setting current environment type
91
114
  useEffect(() => {
@@ -97,7 +120,7 @@ const AppMainLayout = () => {
97
120
  setEnvType("live");
98
121
  }
99
122
  }, []);
100
- console.log("envType", envType)
123
+ console.log("envType", envType);
101
124
 
102
125
  return (
103
126
  <OutletContext.Provider
@@ -124,7 +147,7 @@ const AppMainLayout = () => {
124
147
  setHideAffilicates,
125
148
  affiliatesActive,
126
149
  accessToken,
127
- envType
150
+ envType,
128
151
  }}
129
152
  >
130
153
  <Layout
@@ -149,7 +172,8 @@ const AppMainLayout = () => {
149
172
  ? "personal"
150
173
  : window.location.pathname.includes("instructor")
151
174
  ? "instructor"
152
- : window.location.pathname.includes("developer") || window.location.hostname.includes("developer")
175
+ : window.location.pathname.includes("developer") ||
176
+ window.location.hostname.includes("developer")
153
177
  ? "developer"
154
178
  : defaultAcct
155
179
  }
@@ -187,7 +211,7 @@ const AppMainLayout = () => {
187
211
  ) : window.location.pathname.includes("personal/courses") ? (
188
212
  <InstructorRightBar personal />
189
213
  ) : window.location.pathname.includes(
190
- "personal/library/selectlanguage",
214
+ "personal/library/selectlanguage"
191
215
  ) ? (
192
216
  <InstructorRightBar personal />
193
217
  ) : window.location.pathname.includes("personal/library") ? (