l-min-components 1.7.1381 → 1.7.1382
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 +1 -1
- package/src/components/AppMainLayout/index.jsx +9 -2
- package/src/components/header/index.jsx +1 -9
- package/src/components/instructorAccountSwitcher/deleteCookies.jsx +7 -0
- package/src/components/sideBar/sideMenu/index.jsx +2 -3
- package/src/components/sideBar/userCard/index.jsx +9 -4
- package/src/components/sideNav/index.jsx +7 -0
- package/src/hooks/leftNavMenu.jsx +9 -3
- package/src/utils/deleteCookies.js +15 -7
package/package.json
CHANGED
|
@@ -158,15 +158,22 @@ const AppMainLayout = ({ children }) => {
|
|
|
158
158
|
if (getDefaultAccount?.data) {
|
|
159
159
|
const date = new Date();
|
|
160
160
|
date.setDate(date.getDate() + 28);
|
|
161
|
+
|
|
162
|
+
const domain = window.location.href.includes("localhost")
|
|
163
|
+
? "localhost"
|
|
164
|
+
: window.location.hostname?.includes("ca")
|
|
165
|
+
? ".learngual.ca"
|
|
166
|
+
: ".learngual.com";
|
|
167
|
+
|
|
161
168
|
document.cookie =
|
|
162
169
|
"defaultAccountID=" +
|
|
163
170
|
getDefaultAccount?.data?.id +
|
|
164
|
-
`; path=/; expires=${date.toUTCString()};`;
|
|
171
|
+
`; domain=${domain}; path=/; expires=${date.toUTCString()};`;
|
|
165
172
|
|
|
166
173
|
document.cookie =
|
|
167
174
|
"defaultAccountType=" +
|
|
168
175
|
getDefaultAccount?.data?.type +
|
|
169
|
-
`; path=/; expires=${date.toUTCString()};`;
|
|
176
|
+
`; domain=${domain}; path=/; expires=${date.toUTCString()};`;
|
|
170
177
|
|
|
171
178
|
localStorage.setItem("defaultLang", getDefaultAccount?.data?.language);
|
|
172
179
|
|
|
@@ -10,15 +10,7 @@ import {
|
|
|
10
10
|
import { ArrowDownIcon } from "./assets/svg/arrow-down";
|
|
11
11
|
import AccountDropdown from "./account-dropdown";
|
|
12
12
|
import avatar from "./assets/images/avatar.png";
|
|
13
|
-
import {
|
|
14
|
-
Navbar,
|
|
15
|
-
NavGroup,
|
|
16
|
-
Nav,
|
|
17
|
-
SearchInputGroup,
|
|
18
|
-
SearchInput,
|
|
19
|
-
UserProfile,
|
|
20
|
-
Help,
|
|
21
|
-
} from "./index.styled";
|
|
13
|
+
import { Navbar, NavGroup, Nav, UserProfile } from "./index.styled";
|
|
22
14
|
import useHeader from "./getHeaderDetails";
|
|
23
15
|
import { FullPageLoader, OutletContext } from "..";
|
|
24
16
|
import { useLocation } from "react-router-dom";
|
|
@@ -11,16 +11,23 @@ const deleteCookies = (name) => {
|
|
|
11
11
|
: "production";
|
|
12
12
|
if (env === "staging") {
|
|
13
13
|
Cookies.remove(name, {
|
|
14
|
+
domain: window.location.hostname?.includes("ca")
|
|
15
|
+
? ".learngual.ca"
|
|
16
|
+
: ".learngual.com",
|
|
14
17
|
expires: date,
|
|
15
18
|
path: "/",
|
|
16
19
|
});
|
|
17
20
|
} else if (env === "local") {
|
|
18
21
|
Cookies.remove(name, {
|
|
22
|
+
domain: "localhost",
|
|
19
23
|
expires: date,
|
|
20
24
|
path: "/",
|
|
21
25
|
});
|
|
22
26
|
} else {
|
|
23
27
|
Cookies.remove(name, {
|
|
28
|
+
domain: window.location.hostname?.includes("ca")
|
|
29
|
+
? ".learngual.ca"
|
|
30
|
+
: ".learngual.com",
|
|
24
31
|
expires: date,
|
|
25
32
|
path: "/",
|
|
26
33
|
});
|
|
@@ -83,11 +83,10 @@ const SideMenu = ({
|
|
|
83
83
|
}, [affiliatesActive, filteredRoutes]);
|
|
84
84
|
|
|
85
85
|
// Right bars
|
|
86
|
-
const EnterpriseRight = <EnterpriseRightBar />;
|
|
87
|
-
const InstructorRight = <InstructorRightBar />;
|
|
86
|
+
// const EnterpriseRight = <EnterpriseRightBar />;
|
|
87
|
+
// const InstructorRight = <InstructorRightBar />;
|
|
88
88
|
|
|
89
89
|
const renderNavigationItem = (route, index) => {
|
|
90
|
-
console.log(route, "route");
|
|
91
90
|
let notificationCount;
|
|
92
91
|
const { icon, iconActive, text, notifications, path, affiliates, newTab } =
|
|
93
92
|
route;
|
|
@@ -20,19 +20,25 @@ const UserCard = ({ isOpen, findText }) => {
|
|
|
20
20
|
useEffect(() => {
|
|
21
21
|
if (generalData?.selectedAccount) {
|
|
22
22
|
const date = new Date();
|
|
23
|
+
const domain = window.location.href.includes("localhost")
|
|
24
|
+
? "localhost"
|
|
25
|
+
: window.location.hostname?.includes("ca")
|
|
26
|
+
? ".learngual.ca"
|
|
27
|
+
: ".learngual.com";
|
|
28
|
+
|
|
23
29
|
date.setDate(date.getDate() + 28);
|
|
24
30
|
document.cookie =
|
|
25
31
|
"activeDeveloperAccount=" +
|
|
26
32
|
generalData?.selectedAccount?.id +
|
|
27
|
-
`; path=/; expires=${date.toUTCString()};`;
|
|
33
|
+
`; path=/; domain=${domain}; expires=${date.toUTCString()};`;
|
|
28
34
|
document.cookie =
|
|
29
35
|
"defaultAccountID=" +
|
|
30
36
|
generalData?.selectedAccount?.id +
|
|
31
|
-
`; path=/; expires=${date.toUTCString()};`;
|
|
37
|
+
`; path=/; domain=${domain}; expires=${date.toUTCString()};`;
|
|
32
38
|
document.cookie =
|
|
33
39
|
"defaultAccountType=" +
|
|
34
40
|
generalData?.selectedAccount?.type +
|
|
35
|
-
`; path=/; expires=${date.toUTCString()};`;
|
|
41
|
+
`; path=/; domain=${domain}; expires=${date.toUTCString()};`;
|
|
36
42
|
|
|
37
43
|
handleSetDefaultAccount(generalData?.selectedAccount?.id);
|
|
38
44
|
|
|
@@ -45,7 +51,6 @@ const UserCard = ({ isOpen, findText }) => {
|
|
|
45
51
|
}
|
|
46
52
|
}
|
|
47
53
|
}, [generalData]);
|
|
48
|
-
console.log(generalData, "data...");
|
|
49
54
|
|
|
50
55
|
return (
|
|
51
56
|
<UserCardContainer isOpen={isOpen}>
|
|
@@ -24,16 +24,23 @@ const SideBar = ({ routes, findText }) => {
|
|
|
24
24
|
: "production";
|
|
25
25
|
if (env === "staging") {
|
|
26
26
|
Cookies.remove(name, {
|
|
27
|
+
domain: window.location.hostname?.includes("ca")
|
|
28
|
+
? ".learngual.ca"
|
|
29
|
+
: ".learngual.com",
|
|
27
30
|
expires: date,
|
|
28
31
|
path: "/",
|
|
29
32
|
});
|
|
30
33
|
} else if (env === "local") {
|
|
31
34
|
Cookies.remove(name, {
|
|
35
|
+
domain: "localhost",
|
|
32
36
|
expires: date,
|
|
33
37
|
path: "/",
|
|
34
38
|
});
|
|
35
39
|
} else {
|
|
36
40
|
Cookies.remove(name, {
|
|
41
|
+
domain: window.location.hostname?.includes("ca")
|
|
42
|
+
? ".learngual.ca"
|
|
43
|
+
: ".learngual.com",
|
|
37
44
|
expires: date,
|
|
38
45
|
path: "/",
|
|
39
46
|
});
|
|
@@ -83,7 +83,9 @@ export const leftNavMenu = [
|
|
|
83
83
|
icon: <DictionaryIcon />,
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
|
-
path:
|
|
86
|
+
path: window.location.hostname.includes("ca")
|
|
87
|
+
? "https://demo.learngual.ca/type-select"
|
|
88
|
+
: "https://demo.learngual.com/type-select",
|
|
87
89
|
label: "Demo",
|
|
88
90
|
icon: <CompuetrerIcon />,
|
|
89
91
|
},
|
|
@@ -92,7 +94,9 @@ export const leftNavMenu = [
|
|
|
92
94
|
export const getLeftRoutes = (accoutType) => {
|
|
93
95
|
const leftNavMenu = [
|
|
94
96
|
{
|
|
95
|
-
path:
|
|
97
|
+
path: window.location.hostname.includes("ca")
|
|
98
|
+
? `https://www.learngual.ca/${accoutType}`
|
|
99
|
+
: `https://www.learngual.com/${accoutType}`,
|
|
96
100
|
label: "Learning",
|
|
97
101
|
icon: <Learning />,
|
|
98
102
|
},
|
|
@@ -122,7 +126,9 @@ export const getLeftRoutes = (accoutType) => {
|
|
|
122
126
|
icon: <DictionaryIcon />,
|
|
123
127
|
},
|
|
124
128
|
{
|
|
125
|
-
path:
|
|
129
|
+
path: window.location.hostname.includes("ca")
|
|
130
|
+
? "https://demo.learngual.ca/type-select"
|
|
131
|
+
: "https://demo.learngual.com/type-select",
|
|
126
132
|
label: "Demo",
|
|
127
133
|
icon: <CompuetrerIcon />,
|
|
128
134
|
},
|
|
@@ -5,8 +5,8 @@ import Cookies from "js-cookie";
|
|
|
5
5
|
* @param {string} name - Cookie name to delete
|
|
6
6
|
* @param {Object} options - Cookie options (domain, expires, path)
|
|
7
7
|
*/
|
|
8
|
-
const deleteSingleCookie = (name, options) => {
|
|
9
|
-
Cookies.remove(name, options);
|
|
8
|
+
const deleteSingleCookie = (domain, name, options) => {
|
|
9
|
+
Cookies.remove(domain, name, options);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -30,16 +30,24 @@ const deleteCookies = (names) => {
|
|
|
30
30
|
cookieNames.forEach((name) => {
|
|
31
31
|
if (env === "local") {
|
|
32
32
|
// For local environment
|
|
33
|
-
deleteSingleCookie(name, {
|
|
33
|
+
deleteSingleCookie("localhost", name, {
|
|
34
34
|
expires: date,
|
|
35
35
|
path: "/",
|
|
36
36
|
});
|
|
37
37
|
} else {
|
|
38
38
|
// For staging and production environments
|
|
39
|
-
deleteSingleCookie(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
deleteSingleCookie(
|
|
40
|
+
window.location.href.includes("localhost")
|
|
41
|
+
? "localhost"
|
|
42
|
+
: window.location.hostname?.includes("ca")
|
|
43
|
+
? ".learngual.ca"
|
|
44
|
+
: ".learngual.com",
|
|
45
|
+
name,
|
|
46
|
+
{
|
|
47
|
+
expires: date,
|
|
48
|
+
path: "/",
|
|
49
|
+
}
|
|
50
|
+
);
|
|
43
51
|
}
|
|
44
52
|
});
|
|
45
53
|
};
|