l-min-components 1.0.223 → 1.0.228

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.223",
3
+ "version": "1.0.228",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -17,13 +17,14 @@
17
17
  "axios-hooks": "^4.0.0",
18
18
  "chart.js": "^4.2.1",
19
19
  "classnames": "^2.3.2",
20
- "l-min-components": "^1.0.197",
20
+ "l-min-components": "^1.0.220",
21
21
  "moment": "^2.29.4",
22
22
  "prop-types": "^15.8.1",
23
23
  "rc-slider": "^10.1.1",
24
24
  "rc-tooltip": "^6.0.1",
25
25
  "react": "^18.2.0",
26
26
  "react-chartjs-2": "^5.2.0",
27
+ "react-cookie": "^4.1.1",
27
28
  "react-datepicker": "^4.10.0",
28
29
  "react-dom": "^18.2.0",
29
30
  "react-flags-select": "^2.2.3",
@@ -32,6 +32,19 @@ const AccountDropdown = (props) => {
32
32
  let developerArray = [];
33
33
  let instructorArray = [];
34
34
  let enterpriseArray = [];
35
+ const cookies = document.cookie;
36
+ const cookieArray = cookies.split(";");
37
+ let activeDeveloperAccount;
38
+ for (let i = 0; i < cookieArray.length; i++) {
39
+ const cookie = cookieArray[i].trim();
40
+ if (cookie.startsWith("activeDeveloperAccount=")) {
41
+ activeDeveloperAccount = cookie.substring(
42
+ "activeDeveloperAccount=".length,
43
+ cookie.length
44
+ );
45
+ break;
46
+ }
47
+ }
35
48
  props?.data?.data?.results?.map((accountItem, idx) => {
36
49
  if (
37
50
  accountItem?.type === "PERSONAL" &&
@@ -67,7 +80,10 @@ const AccountDropdown = (props) => {
67
80
  props?.setSelectedAccount(personalArray[0]);
68
81
  }
69
82
  if (window.location.host?.includes("developer")) {
70
- props?.setSelectedAccount(developerArray[0]);
83
+ props?.setSelectedAccount(
84
+ developerArray.find((item) => item.id === activeDeveloperAccount) ??
85
+ {}
86
+ );
71
87
  }
72
88
  if (pathname?.includes("instructor")) {
73
89
  props?.setSelectedAccount(instructorArray[0]);
@@ -58,7 +58,19 @@ const HeaderComponent = (props) => {
58
58
  accounts: userAccountsDetail?.data,
59
59
  user: userDetails?.data,
60
60
  }));
61
-
61
+ const cookies = document.cookie;
62
+ const cookieArray = cookies.split(";");
63
+ let activeDeveloperAccount;
64
+ for (let i = 0; i < cookieArray.length; i++) {
65
+ const cookie = cookieArray[i].trim();
66
+ if (cookie.startsWith("activeDeveloperAccount=")) {
67
+ activeDeveloperAccount = cookie.substring(
68
+ "activeDeveloperAccount=".length,
69
+ cookie.length
70
+ );
71
+ break;
72
+ }
73
+ }
62
74
  let personalArray = [];
63
75
  let developerArray = [];
64
76
  let instructorArray = [];
@@ -94,7 +106,10 @@ const HeaderComponent = (props) => {
94
106
  setSelectedAccount(personalArray[0]);
95
107
  }
96
108
  if (window.location.host?.includes("developer")) {
97
- setSelectedAccount(developerArray[0]);
109
+ setSelectedAccount(
110
+ developerArray.find((item) => item.id === activeDeveloperAccount) ??
111
+ {}
112
+ );
98
113
  }
99
114
  if (pathname?.includes("instructor")) {
100
115
  setSelectedAccount(instructorArray[0]);
@@ -128,7 +143,7 @@ const HeaderComponent = (props) => {
128
143
  <a
129
144
  onClick={() => {
130
145
  window.location.href =
131
- "https://developer-staging-01.learngual.com/settings/payment";
146
+ "https://developer-staging-01.learngual.com/settings/";
132
147
  }}
133
148
  >
134
149
  <SettingIcon /> Settings
@@ -43,14 +43,14 @@ const SideMenu = ({
43
43
  window.location.hostname.includes("staging") &&
44
44
  window.location.hostname.includes("developer")
45
45
  ) {
46
- window.location.href = `developer-staging-01.learngual.com/${path}`;
46
+ window.location.href = `https://developer-staging-01.learngual.com/${path}`;
47
47
  } else if (window.location.hostname.includes("localhost")) {
48
48
  window.location.href = `http://localhost:${window.location.port}${path}`;
49
49
  } else if (
50
50
  window.location.hostname.includes("developer") &&
51
51
  !window.location.hostname.includes("staging")
52
52
  ) {
53
- window.location.href = `developer.learngual.com/${path}`;
53
+ window.location.href = `https://developer.learngual.com/${path}`;
54
54
  }
55
55
  }}
56
56
  // to={route.path}