l-min-components 1.7.1383 → 1.7.1385
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 +3 -11
- package/src/components/dashboardState/pendingDeleteState.jsx +1 -1
- package/src/components/header/index.jsx +9 -1
- package/src/components/index.js +0 -2
- package/src/components/instructorAccountSwitcher/deleteCookies.jsx +0 -7
- package/src/components/instructorAccountSwitcher/index.jsx +2 -8
- package/src/components/sideBar/sideMenu/index.jsx +3 -2
- package/src/components/sideBar/userCard/index.jsx +4 -9
- package/src/components/sideNav/index.jsx +0 -7
- package/src/hooks/leftNavMenu.jsx +3 -9
- package/src/utils/deleteCookies.js +0 -6
- package/src/components/dashboardState/images/information-icon.png +0 -0
- package/src/components/getErrorFeatures/error404.jsx +0 -0
- package/src/components/getErrorFeatures/errorWrapper.jsx +0 -205
- package/src/components/getErrorFeatures/images/bg-403.png +0 -0
- package/src/components/getErrorFeatures/images/bg-404.png +0 -0
- package/src/components/getErrorFeatures/images/bg-500.png +0 -0
- package/src/components/getErrorFeatures/images/bg-503.png +0 -0
- package/src/components/getErrorFeatures/index.jsx +0 -158
- package/src/hooks/useCustomNavigate.jsx +0 -21
- package/src/utils/getCookie.js +0 -13
package/package.json
CHANGED
|
@@ -158,22 +158,15 @@ 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
|
-
|
|
168
161
|
document.cookie =
|
|
169
162
|
"defaultAccountID=" +
|
|
170
163
|
getDefaultAccount?.data?.id +
|
|
171
|
-
`;
|
|
164
|
+
`; path=/; expires=${date.toUTCString()};`;
|
|
172
165
|
|
|
173
166
|
document.cookie =
|
|
174
167
|
"defaultAccountType=" +
|
|
175
168
|
getDefaultAccount?.data?.type +
|
|
176
|
-
`;
|
|
169
|
+
`; path=/; expires=${date.toUTCString()};`;
|
|
177
170
|
|
|
178
171
|
localStorage.setItem("defaultLang", getDefaultAccount?.data?.language);
|
|
179
172
|
|
|
@@ -425,8 +418,7 @@ const AppMainLayout = ({ children }) => {
|
|
|
425
418
|
</LeftLayout>
|
|
426
419
|
<CenterLayout isOpen={isOpen} style={centerLayoutStyle}>
|
|
427
420
|
{(window.location.pathname.includes("instructor") ||
|
|
428
|
-
|
|
429
|
-
!accountIsPendingDeletion)) && (
|
|
421
|
+
activeAccountType === "instructor") && (
|
|
430
422
|
<InstructorAccountSwitcher
|
|
431
423
|
// setAccountType={setAffiliatesActive}
|
|
432
424
|
generalData={generalData}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
|
-
import warning from "./images/
|
|
2
|
+
import warning from "./images/warning-db.png";
|
|
3
3
|
import ButtonComponent from "../button";
|
|
4
4
|
import moment from "moment";
|
|
5
5
|
import redirectURL from "../../utils/redirectURL";
|
|
@@ -10,7 +10,15 @@ 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 {
|
|
13
|
+
import {
|
|
14
|
+
Navbar,
|
|
15
|
+
NavGroup,
|
|
16
|
+
Nav,
|
|
17
|
+
SearchInputGroup,
|
|
18
|
+
SearchInput,
|
|
19
|
+
UserProfile,
|
|
20
|
+
Help,
|
|
21
|
+
} from "./index.styled";
|
|
14
22
|
import useHeader from "./getHeaderDetails";
|
|
15
23
|
import { FullPageLoader, OutletContext } from "..";
|
|
16
24
|
import { useLocation } from "react-router-dom";
|
package/src/components/index.js
CHANGED
|
@@ -62,5 +62,3 @@ export { default as useAiUtils } from "../utils/useAiUtils";
|
|
|
62
62
|
export { default as useAudioRecorder } from "../hooks/recorder-kit";
|
|
63
63
|
export { default as useCookiePolling } from "../hooks/utils/cookiePolling";
|
|
64
64
|
export { default as convertBlobToWav } from "../utils/webm2wav";
|
|
65
|
-
export { default as useErrorFeatures } from "./getErrorFeatures";
|
|
66
|
-
export { default as useCustomNavigate } from "../hooks/useCustomNavigate";
|
|
@@ -11,23 +11,16 @@ 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",
|
|
17
14
|
expires: date,
|
|
18
15
|
path: "/",
|
|
19
16
|
});
|
|
20
17
|
} else if (env === "local") {
|
|
21
18
|
Cookies.remove(name, {
|
|
22
|
-
domain: "localhost",
|
|
23
19
|
expires: date,
|
|
24
20
|
path: "/",
|
|
25
21
|
});
|
|
26
22
|
} else {
|
|
27
23
|
Cookies.remove(name, {
|
|
28
|
-
domain: window.location.hostname?.includes("ca")
|
|
29
|
-
? ".learngual.ca"
|
|
30
|
-
: ".learngual.com",
|
|
31
24
|
expires: date,
|
|
32
25
|
path: "/",
|
|
33
26
|
});
|
|
@@ -71,13 +71,7 @@ const InstructorAccountSwitcher = ({
|
|
|
71
71
|
date.setDate(date.getDate() + 20);
|
|
72
72
|
const expires = "; expires=" + date.toUTCString();
|
|
73
73
|
const path = "; path=/";
|
|
74
|
-
|
|
75
|
-
? "localhost"
|
|
76
|
-
: window.location.hostname?.includes("ca")
|
|
77
|
-
? ".learngual.ca"
|
|
78
|
-
: ".learngual.com";
|
|
79
|
-
document.cookie =
|
|
80
|
-
"affiliateAccount=" + id + expires + path + "; domain=" + domain;
|
|
74
|
+
document.cookie = "affiliateAccount=" + id + expires + path;
|
|
81
75
|
};
|
|
82
76
|
|
|
83
77
|
const cookieValue = getCookie();
|
|
@@ -268,7 +262,7 @@ const InstructorAccountSwitcher = ({
|
|
|
268
262
|
className={switchValue !== "affiliates" ? "active" : ""}
|
|
269
263
|
onClick={() => handleSwitch(1)}
|
|
270
264
|
>
|
|
271
|
-
<span>
|
|
265
|
+
<span>My Account</span>
|
|
272
266
|
<span className="circle"></span>
|
|
273
267
|
</button>
|
|
274
268
|
)}
|
|
@@ -83,10 +83,11 @@ const SideMenu = ({
|
|
|
83
83
|
}, [affiliatesActive, filteredRoutes]);
|
|
84
84
|
|
|
85
85
|
// Right bars
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
const EnterpriseRight = <EnterpriseRightBar />;
|
|
87
|
+
const InstructorRight = <InstructorRightBar />;
|
|
88
88
|
|
|
89
89
|
const renderNavigationItem = (route, index) => {
|
|
90
|
+
console.log(route, "route");
|
|
90
91
|
let notificationCount;
|
|
91
92
|
const { icon, iconActive, text, notifications, path, affiliates, newTab } =
|
|
92
93
|
route;
|
|
@@ -20,25 +20,19 @@ 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
|
-
|
|
29
23
|
date.setDate(date.getDate() + 28);
|
|
30
24
|
document.cookie =
|
|
31
25
|
"activeDeveloperAccount=" +
|
|
32
26
|
generalData?.selectedAccount?.id +
|
|
33
|
-
`; path=/;
|
|
27
|
+
`; path=/; expires=${date.toUTCString()};`;
|
|
34
28
|
document.cookie =
|
|
35
29
|
"defaultAccountID=" +
|
|
36
30
|
generalData?.selectedAccount?.id +
|
|
37
|
-
`; path=/;
|
|
31
|
+
`; path=/; expires=${date.toUTCString()};`;
|
|
38
32
|
document.cookie =
|
|
39
33
|
"defaultAccountType=" +
|
|
40
34
|
generalData?.selectedAccount?.type +
|
|
41
|
-
`; path=/;
|
|
35
|
+
`; path=/; expires=${date.toUTCString()};`;
|
|
42
36
|
|
|
43
37
|
handleSetDefaultAccount(generalData?.selectedAccount?.id);
|
|
44
38
|
|
|
@@ -51,6 +45,7 @@ const UserCard = ({ isOpen, findText }) => {
|
|
|
51
45
|
}
|
|
52
46
|
}
|
|
53
47
|
}, [generalData]);
|
|
48
|
+
console.log(generalData, "data...");
|
|
54
49
|
|
|
55
50
|
return (
|
|
56
51
|
<UserCardContainer isOpen={isOpen}>
|
|
@@ -24,23 +24,16 @@ 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",
|
|
30
27
|
expires: date,
|
|
31
28
|
path: "/",
|
|
32
29
|
});
|
|
33
30
|
} else if (env === "local") {
|
|
34
31
|
Cookies.remove(name, {
|
|
35
|
-
domain: "localhost",
|
|
36
32
|
expires: date,
|
|
37
33
|
path: "/",
|
|
38
34
|
});
|
|
39
35
|
} else {
|
|
40
36
|
Cookies.remove(name, {
|
|
41
|
-
domain: window.location.hostname?.includes("ca")
|
|
42
|
-
? ".learngual.ca"
|
|
43
|
-
: ".learngual.com",
|
|
44
37
|
expires: date,
|
|
45
38
|
path: "/",
|
|
46
39
|
});
|
|
@@ -83,9 +83,7 @@ export const leftNavMenu = [
|
|
|
83
83
|
icon: <DictionaryIcon />,
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
|
-
path:
|
|
87
|
-
? "https://demo.learngual.ca/type-select"
|
|
88
|
-
: "https://demo.learngual.com/type-select",
|
|
86
|
+
path: "https://demo.learngual.com/type-select",
|
|
89
87
|
label: "Demo",
|
|
90
88
|
icon: <CompuetrerIcon />,
|
|
91
89
|
},
|
|
@@ -94,9 +92,7 @@ export const leftNavMenu = [
|
|
|
94
92
|
export const getLeftRoutes = (accoutType) => {
|
|
95
93
|
const leftNavMenu = [
|
|
96
94
|
{
|
|
97
|
-
path:
|
|
98
|
-
? `https://www.learngual.ca/${accoutType}`
|
|
99
|
-
: `https://www.learngual.com/${accoutType}`,
|
|
95
|
+
path: `https://www.learngual.com/${accoutType}`,
|
|
100
96
|
label: "Learning",
|
|
101
97
|
icon: <Learning />,
|
|
102
98
|
},
|
|
@@ -126,9 +122,7 @@ export const getLeftRoutes = (accoutType) => {
|
|
|
126
122
|
icon: <DictionaryIcon />,
|
|
127
123
|
},
|
|
128
124
|
{
|
|
129
|
-
path:
|
|
130
|
-
? "https://demo.learngual.ca/type-select"
|
|
131
|
-
: "https://demo.learngual.com/type-select",
|
|
125
|
+
path: "https://demo.learngual.com/type-select",
|
|
132
126
|
label: "Demo",
|
|
133
127
|
icon: <CompuetrerIcon />,
|
|
134
128
|
},
|
|
@@ -31,18 +31,12 @@ const deleteCookies = (names) => {
|
|
|
31
31
|
if (env === "local") {
|
|
32
32
|
// For local environment
|
|
33
33
|
deleteSingleCookie(name, {
|
|
34
|
-
domain: "localhost",
|
|
35
34
|
expires: date,
|
|
36
35
|
path: "/",
|
|
37
36
|
});
|
|
38
37
|
} else {
|
|
39
38
|
// For staging and production environments
|
|
40
39
|
deleteSingleCookie(name, {
|
|
41
|
-
domain: window.location.href.includes("localhost")
|
|
42
|
-
? "localhost"
|
|
43
|
-
: window.location.hostname?.includes("ca")
|
|
44
|
-
? ".learngual.ca"
|
|
45
|
-
: ".learngual.com",
|
|
46
40
|
expires: date,
|
|
47
41
|
path: "/",
|
|
48
42
|
});
|
|
Binary file
|
|
File without changes
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
|
-
|
|
4
|
-
import logo from "../../assets/images/logo.png";
|
|
5
|
-
import bg from "./images/bg-404.png";
|
|
6
|
-
import redirectURL from "../../utils/redirectURL";
|
|
7
|
-
import useCustomNavigate from "../../hooks/useCustomNavigate";
|
|
8
|
-
import getCookie from "../../utils/getCookie";
|
|
9
|
-
|
|
10
|
-
const ErrorWrapper = ({
|
|
11
|
-
title = "Oops!",
|
|
12
|
-
subTitle = "Page not found",
|
|
13
|
-
message = "Seems we can't find the page you are looking for. Let's get you back home.",
|
|
14
|
-
btnText = "Go to home page",
|
|
15
|
-
bgSrc,
|
|
16
|
-
fallbackPath,
|
|
17
|
-
isDashboard,
|
|
18
|
-
}) => {
|
|
19
|
-
const navigate = useCustomNavigate();
|
|
20
|
-
const handleNav = () => {
|
|
21
|
-
const accountType = getCookie("defaultAccountType")?.toLocaleLowerCase();
|
|
22
|
-
|
|
23
|
-
if (isDashboard && accountType) {
|
|
24
|
-
const route =
|
|
25
|
-
accountType === "developer"
|
|
26
|
-
? "/developer"
|
|
27
|
-
: `/${accountType}/dashboard`;
|
|
28
|
-
|
|
29
|
-
navigate(fallbackPath || route || "/", { reload: true });
|
|
30
|
-
} else {
|
|
31
|
-
navigate(fallbackPath || "/", { reload: true });
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
return (
|
|
35
|
-
<Container>
|
|
36
|
-
<Navbar>
|
|
37
|
-
<a href="/">
|
|
38
|
-
<img src={logo} alt="Learngual logo" />
|
|
39
|
-
</a>
|
|
40
|
-
</Navbar>
|
|
41
|
-
<Content>
|
|
42
|
-
<LeftDiv>
|
|
43
|
-
<h1>{title}</h1>
|
|
44
|
-
<div>
|
|
45
|
-
{subTitle && <h2>{subTitle}</h2>}
|
|
46
|
-
{message && <p>{message}</p>}
|
|
47
|
-
</div>
|
|
48
|
-
|
|
49
|
-
<button onClick={handleNav}>{btnText}</button>
|
|
50
|
-
</LeftDiv>
|
|
51
|
-
<ImageBox>
|
|
52
|
-
<img src={bgSrc || bg} alt="" />
|
|
53
|
-
</ImageBox>
|
|
54
|
-
</Content>
|
|
55
|
-
</Container>
|
|
56
|
-
);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const Container = styled.div`
|
|
60
|
-
min-height: 100vh;
|
|
61
|
-
width: 100%;
|
|
62
|
-
background-color: #fff;
|
|
63
|
-
padding: 0 25px;
|
|
64
|
-
display: flex;
|
|
65
|
-
flex-direction: column;
|
|
66
|
-
@media screen and (min-width: 850px) {
|
|
67
|
-
padding: 0 104px;
|
|
68
|
-
}
|
|
69
|
-
`;
|
|
70
|
-
|
|
71
|
-
const Navbar = styled.nav`
|
|
72
|
-
width: 100%;
|
|
73
|
-
height: 80px;
|
|
74
|
-
display: flex;
|
|
75
|
-
align-items: center;
|
|
76
|
-
justify-content: space-between;
|
|
77
|
-
img {
|
|
78
|
-
width: 52px;
|
|
79
|
-
}
|
|
80
|
-
@media screen and (min-width: 850px) {
|
|
81
|
-
height: 100px;
|
|
82
|
-
img {
|
|
83
|
-
width: 60px;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
`;
|
|
87
|
-
|
|
88
|
-
const Content = styled.div`
|
|
89
|
-
flex: 1;
|
|
90
|
-
display: flex;
|
|
91
|
-
align-items: center;
|
|
92
|
-
padding-bottom: 80px;
|
|
93
|
-
gap: 30px;
|
|
94
|
-
flex-direction: column-reverse;
|
|
95
|
-
justify-content: flex-end;
|
|
96
|
-
padding-top: 60px;
|
|
97
|
-
max-width: 390px;
|
|
98
|
-
margin: 0 auto;
|
|
99
|
-
@media screen and (min-width: 850px) {
|
|
100
|
-
flex-direction: row;
|
|
101
|
-
padding-top: 0px;
|
|
102
|
-
justify-content: flex-start;
|
|
103
|
-
gap: 100px;
|
|
104
|
-
padding-bottom: 100px;
|
|
105
|
-
max-width: none;
|
|
106
|
-
margin: 0px;
|
|
107
|
-
}
|
|
108
|
-
`;
|
|
109
|
-
|
|
110
|
-
const LeftDiv = styled.div`
|
|
111
|
-
width: 100%;
|
|
112
|
-
display: flex;
|
|
113
|
-
flex-direction: column;
|
|
114
|
-
gap: 12px;
|
|
115
|
-
text-align: center;
|
|
116
|
-
align-items: center;
|
|
117
|
-
color: #313333;
|
|
118
|
-
border-radius: 15px;
|
|
119
|
-
background: #f5f7f7;
|
|
120
|
-
padding: 20px 18px;
|
|
121
|
-
h1 {
|
|
122
|
-
font-size: 25px;
|
|
123
|
-
}
|
|
124
|
-
> div {
|
|
125
|
-
width: 100%;
|
|
126
|
-
display: flex;
|
|
127
|
-
flex-direction: column;
|
|
128
|
-
gap: 8px;
|
|
129
|
-
h2 {
|
|
130
|
-
font-weight: 500;
|
|
131
|
-
font-size: 18px;
|
|
132
|
-
}
|
|
133
|
-
p {
|
|
134
|
-
font-size: 16px;
|
|
135
|
-
color: #636666;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
button {
|
|
139
|
-
width: fit-content;
|
|
140
|
-
height: 40px;
|
|
141
|
-
padding: 0px 40px;
|
|
142
|
-
border-radius: 6px;
|
|
143
|
-
background: #febf10;
|
|
144
|
-
box-shadow: 0px 10px 20px 0px rgba(254, 191, 16, 0.25);
|
|
145
|
-
border: none;
|
|
146
|
-
outline: none;
|
|
147
|
-
cursor: pointer;
|
|
148
|
-
color: white;
|
|
149
|
-
font-weight: 700;
|
|
150
|
-
font-size: 14px;
|
|
151
|
-
margin-top: 12px;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
@media screen and (min-width: 850px) {
|
|
155
|
-
max-width: 462px;
|
|
156
|
-
gap: 24px;
|
|
157
|
-
text-align: left;
|
|
158
|
-
flex: none;
|
|
159
|
-
align-items: flex-start;
|
|
160
|
-
border-radius: 0px;
|
|
161
|
-
background: transparent;
|
|
162
|
-
padding: 0px;
|
|
163
|
-
flex: 1;
|
|
164
|
-
h1 {
|
|
165
|
-
font-size: 44px;
|
|
166
|
-
}
|
|
167
|
-
> div {
|
|
168
|
-
gap: 12px;
|
|
169
|
-
h2 {
|
|
170
|
-
font-size: 30px;
|
|
171
|
-
}
|
|
172
|
-
p {
|
|
173
|
-
font-size: 18px;
|
|
174
|
-
line-height: 32px;
|
|
175
|
-
color: #313333;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
button {
|
|
179
|
-
margin-top: 0;
|
|
180
|
-
height: 50px;
|
|
181
|
-
font-size: 16px;
|
|
182
|
-
border-radius: 12px;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
`;
|
|
186
|
-
|
|
187
|
-
const ImageBox = styled.div`
|
|
188
|
-
width: 100%;
|
|
189
|
-
height: 160px;
|
|
190
|
-
display: grid;
|
|
191
|
-
place-items: center;
|
|
192
|
-
img {
|
|
193
|
-
width: 100%;
|
|
194
|
-
max-width: 550px;
|
|
195
|
-
height: 100%;
|
|
196
|
-
max-height: 550px;
|
|
197
|
-
object-fit: contain;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
@media screen and (min-width: 850px) {
|
|
201
|
-
height: 100%;
|
|
202
|
-
flex: 1;
|
|
203
|
-
}
|
|
204
|
-
`;
|
|
205
|
-
export default ErrorWrapper;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import ErrorWrapper from "./errorWrapper";
|
|
2
|
-
import bg403 from "./images/bg-403.png";
|
|
3
|
-
import bg500 from "./images/bg-500.png";
|
|
4
|
-
import bg503 from "./images/bg-503.png";
|
|
5
|
-
|
|
6
|
-
const Error404 = ({ btnText, fallbackPath, isDashboard }) => (
|
|
7
|
-
<ErrorWrapper
|
|
8
|
-
fallbackPath={fallbackPath}
|
|
9
|
-
btnText={btnText}
|
|
10
|
-
isDashboard={isDashboard}
|
|
11
|
-
/>
|
|
12
|
-
);
|
|
13
|
-
const Error403 = ({ btnText, fallbackPath, isDashboard }) => (
|
|
14
|
-
<ErrorWrapper
|
|
15
|
-
subTitle="Sorry, you don’t have permission to access this page."
|
|
16
|
-
message="If you believe this is a mistake, please contact the site administrator or check if you have the correct login credentials."
|
|
17
|
-
bgSrc={bg403}
|
|
18
|
-
fallbackPath={fallbackPath}
|
|
19
|
-
btnText={btnText}
|
|
20
|
-
isDashboard={isDashboard}
|
|
21
|
-
/>
|
|
22
|
-
);
|
|
23
|
-
const Error500 = ({ btnText, fallbackPath, isDashboard }) => (
|
|
24
|
-
<ErrorWrapper
|
|
25
|
-
subTitle="Something went wrong"
|
|
26
|
-
message="We’re so sorry about that! Our tech team is already on the case. Please try again later."
|
|
27
|
-
bgSrc={bg500}
|
|
28
|
-
fallbackPath={fallbackPath}
|
|
29
|
-
btnText={btnText}
|
|
30
|
-
isDashboard={isDashboard}
|
|
31
|
-
/>
|
|
32
|
-
);
|
|
33
|
-
const Error503 = ({ btnText, fallbackPath, isDashboard }) => (
|
|
34
|
-
<ErrorWrapper
|
|
35
|
-
subTitle=""
|
|
36
|
-
message="It'll be back up and running in a jiffy. Try again later."
|
|
37
|
-
title="Our servers are temporarily busy."
|
|
38
|
-
bgSrc={bg503}
|
|
39
|
-
fallbackPath={fallbackPath}
|
|
40
|
-
btnText={btnText}
|
|
41
|
-
isDashboard={isDashboard}
|
|
42
|
-
/>
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
function ErrorBoundary({
|
|
46
|
-
routeError,
|
|
47
|
-
isRouteErrorResponse,
|
|
48
|
-
fallbackPath,
|
|
49
|
-
btnText,
|
|
50
|
-
isDashboard,
|
|
51
|
-
}) {
|
|
52
|
-
if (isRouteErrorResponse?.(routeError)) {
|
|
53
|
-
if (error.status === 404)
|
|
54
|
-
return (
|
|
55
|
-
<Error404
|
|
56
|
-
fallbackPath={fallbackPath}
|
|
57
|
-
btnText={btnText}
|
|
58
|
-
isDashboard={isDashboard}
|
|
59
|
-
/>
|
|
60
|
-
);
|
|
61
|
-
if (error.status === 403)
|
|
62
|
-
return (
|
|
63
|
-
<Error403
|
|
64
|
-
fallbackPath={fallbackPath}
|
|
65
|
-
btnText={btnText}
|
|
66
|
-
isDashboard={isDashboard}
|
|
67
|
-
/>
|
|
68
|
-
);
|
|
69
|
-
if (error.status === 500)
|
|
70
|
-
return (
|
|
71
|
-
<Error500
|
|
72
|
-
fallbackPath={fallbackPath}
|
|
73
|
-
btnText={btnText}
|
|
74
|
-
isDashboard={isDashboard}
|
|
75
|
-
/>
|
|
76
|
-
);
|
|
77
|
-
if (error.status === 503)
|
|
78
|
-
return (
|
|
79
|
-
<Error503
|
|
80
|
-
fallbackPath={fallbackPath}
|
|
81
|
-
btnText={btnText}
|
|
82
|
-
isDashboard={isDashboard}
|
|
83
|
-
/>
|
|
84
|
-
);
|
|
85
|
-
return (
|
|
86
|
-
<Error500
|
|
87
|
-
fallbackPath={fallbackPath}
|
|
88
|
-
btnText={btnText}
|
|
89
|
-
isDashboard={isDashboard}
|
|
90
|
-
/>
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (error instanceof Error)
|
|
95
|
-
return (
|
|
96
|
-
<Error500
|
|
97
|
-
fallbackPath={fallbackPath}
|
|
98
|
-
btnText={btnText}
|
|
99
|
-
isDashboard={isDashboard}
|
|
100
|
-
/>
|
|
101
|
-
);
|
|
102
|
-
return (
|
|
103
|
-
<Error500
|
|
104
|
-
fallbackPath={fallbackPath}
|
|
105
|
-
btnText={btnText}
|
|
106
|
-
isDashboard={isDashboard}
|
|
107
|
-
/>
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function ErrorComponent({ fallbackPath, btnText, isDashboard = false }) {
|
|
112
|
-
const params = new URLSearchParams(window.location.search);
|
|
113
|
-
const errorParam = params.get("error-status");
|
|
114
|
-
|
|
115
|
-
if (errorParam === "_403_")
|
|
116
|
-
return (
|
|
117
|
-
<Error403
|
|
118
|
-
fallbackPath={fallbackPath}
|
|
119
|
-
btnText={btnText}
|
|
120
|
-
isDashboard={isDashboard}
|
|
121
|
-
/>
|
|
122
|
-
);
|
|
123
|
-
if (errorParam === "_500_")
|
|
124
|
-
return (
|
|
125
|
-
<Error500
|
|
126
|
-
fallbackPath={fallbackPath}
|
|
127
|
-
btnText={btnText}
|
|
128
|
-
isDashboard={isDashboard}
|
|
129
|
-
/>
|
|
130
|
-
);
|
|
131
|
-
if (errorParam === "_503_")
|
|
132
|
-
return (
|
|
133
|
-
<Error503
|
|
134
|
-
fallbackPath={fallbackPath}
|
|
135
|
-
btnText={btnText}
|
|
136
|
-
isDashboard={isDashboard}
|
|
137
|
-
/>
|
|
138
|
-
);
|
|
139
|
-
return (
|
|
140
|
-
<Error404
|
|
141
|
-
fallbackPath={fallbackPath}
|
|
142
|
-
btnText={btnText}
|
|
143
|
-
isDashboard={isDashboard}
|
|
144
|
-
/>
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const getErrorFeatures = () => {
|
|
149
|
-
return {
|
|
150
|
-
Error404,
|
|
151
|
-
Error403,
|
|
152
|
-
Error500,
|
|
153
|
-
Error503,
|
|
154
|
-
ErrorBoundary,
|
|
155
|
-
ErrorComponent,
|
|
156
|
-
};
|
|
157
|
-
};
|
|
158
|
-
export default getErrorFeatures;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export default function useCustomNavigate() {
|
|
2
|
-
return (path, { replace = false, state = null, reload = false } = {}) => {
|
|
3
|
-
if (reload) {
|
|
4
|
-
if (replace) {
|
|
5
|
-
window.location.replace(path);
|
|
6
|
-
} else {
|
|
7
|
-
window.location.href = path;
|
|
8
|
-
}
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const historyState = { ...state };
|
|
13
|
-
if (replace) {
|
|
14
|
-
window.history.replaceState(historyState, "", path);
|
|
15
|
-
} else {
|
|
16
|
-
window.history.pushState(historyState, "", path);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
20
|
-
};
|
|
21
|
-
}
|
package/src/utils/getCookie.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
function getCookie(name) {
|
|
2
|
-
const cookieStr = document.cookie;
|
|
3
|
-
const cookies = cookieStr.split("; ");
|
|
4
|
-
|
|
5
|
-
for (const cookie of cookies) {
|
|
6
|
-
const [key, value] = cookie.split("=");
|
|
7
|
-
if (key === name) return decodeURIComponent(value);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
return null; // Not found
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default getCookie;
|