l-min-components 1.0.679 → 1.0.680

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.679",
3
+ "version": "1.0.680",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -6,7 +6,10 @@ import { PeopleIcon } from "./assets/svg/people";
6
6
  import { MessageIcon } from "./assets/svg/message";
7
7
  import { SettingIcon } from "./assets/svg/setting";
8
8
  import { SearchIcon } from "./assets/svg/search";
9
- import { NotificationEmptyIcon, NotificationIcon } from "./assets/svg/notification";
9
+ import {
10
+ NotificationEmptyIcon,
11
+ NotificationIcon,
12
+ } from "./assets/svg/notification";
10
13
  import { ArrowDownIcon } from "./assets/svg/arrow-down";
11
14
  import AccountDropdown from "./account-dropdown";
12
15
  import avatar from "./assets/images/avatar.png";
@@ -54,7 +57,7 @@ const HeaderComponent = (props) => {
54
57
  handleGetUnreadNotification,
55
58
  generalNotificationCountData,
56
59
  handleGeneralNotificationCount,
57
- notificationMarkReadData
60
+ notificationMarkReadData,
58
61
  } = useHeader();
59
62
  const { pathname } = useLocation();
60
63
  const { setGeneralData, generalData } = useContext(OutletContext);
@@ -70,17 +73,21 @@ const HeaderComponent = (props) => {
70
73
 
71
74
  // Merge the notification_count into the results data using find
72
75
 
73
- const allUserAccountsDetail = userAccountsDetail?.data?.results.map(item => {
74
- const detail = generalNotificationCountData?.data?.detail?.find(detailItem => detailItem?.account_id === item?.id);
75
- return {
76
- ...item,
77
- notification_count: detail ? detail?.notification_count : 0
78
- };
79
- });
76
+ const allUserAccountsDetail = userAccountsDetail?.data?.results.map(
77
+ (item) => {
78
+ const detail = generalNotificationCountData?.data?.detail?.find(
79
+ (detailItem) => detailItem?.account_id === item?.id
80
+ );
81
+ return {
82
+ ...item,
83
+ notification_count: detail ? detail?.notification_count : 0,
84
+ };
85
+ }
86
+ );
80
87
 
81
88
  useEffect(() => {
82
- handleGeneralNotificationCount();
83
- }, [])
89
+ handleGeneralNotificationCount();
90
+ }, []);
84
91
 
85
92
  useEffect(() => {
86
93
  if (userAccountsDetail?.data) {
@@ -143,7 +150,8 @@ const HeaderComponent = (props) => {
143
150
  if (
144
151
  window.location.host?.includes("developer") ||
145
152
  window.location.host?.includes("coming") ||
146
- window.location.host?.includes("localhost") || window.location.pathname.includes('developer')
153
+ window.location.host?.includes("localhost") ||
154
+ window.location.pathname.includes("developer")
147
155
  ) {
148
156
  setSelectedAccount(
149
157
  developerArray?.find(
@@ -262,8 +270,8 @@ const HeaderComponent = (props) => {
262
270
  const [socketUrl, setSocketUrl] = useState(
263
271
  "dev-117782726-api.learngual.com/notify/v1/ws/connect/"
264
272
  );
265
- const socket = useRef()
266
- const generalSocket = useRef()
273
+ const socket = useRef();
274
+ const generalSocket = useRef();
267
275
  const token = getCookie("access");
268
276
  const account_id = generalData?.defaultAccount?.id || "";
269
277
 
@@ -288,12 +296,11 @@ const HeaderComponent = (props) => {
288
296
  const data = JSON.parse(event?.data); //check for incoming message from socket
289
297
  if (data.event === "new.notification.result") {
290
298
  if (data.data) {
291
- console.log(data)
299
+ console.log(data);
292
300
  handleGetUnreadNotification();
293
301
  handleGeneralNotificationCount();
294
302
  }
295
303
  }
296
-
297
304
  }
298
305
  };
299
306
  websocket.addEventListener("message", handler, { passive: true });
@@ -308,7 +315,6 @@ const HeaderComponent = (props) => {
308
315
  `wss://${socketUrl}?account=${account_id}&authorization=${token}&room_id=${account_id}`
309
316
  );
310
317
 
311
-
312
318
  // websocket for room
313
319
  useEffect(() => {
314
320
  websocket2.onopen = () => {
@@ -326,16 +332,15 @@ const HeaderComponent = (props) => {
326
332
  const data = JSON.parse(event?.data); //check for incoming message from socket
327
333
  if (data.event === "new.notification.result") {
328
334
  if (data.data) {
329
-
330
335
  }
331
336
  }
332
337
  if (data.event === "message.new") {
333
338
  }
334
339
  if (data.event === "new.room.result") {
335
- console.log(data)
340
+ console.log(data);
336
341
  if (data.status) {
337
342
  handleGetUnreadNotification();
338
- handleGeneralNotificationCount();
343
+ handleGeneralNotificationCount();
339
344
  }
340
345
  }
341
346
  }
@@ -349,9 +354,9 @@ const HeaderComponent = (props) => {
349
354
  }, [websocket2]);
350
355
 
351
356
  useEffect(() => {
352
- handleGetUnreadNotification();
353
- handleGeneralNotificationCount();
354
- }, [notificationMarkReadData?.response])
357
+ handleGetUnreadNotification();
358
+ handleGeneralNotificationCount();
359
+ }, [notificationMarkReadData?.response]);
355
360
 
356
361
  return (
357
362
  <Navbar>
@@ -393,7 +398,11 @@ const HeaderComponent = (props) => {
393
398
  </li>
394
399
  <li>
395
400
  <a
396
- href={`https://559staging.learngual.com/${selectedAccount?.type? selectedAccount?.type?.toLowerCase(): userAccountsDetail?.data[0]?.type?.toLowerCase()}/notifications/`}
401
+ href={`https://559staging.learngual.com/${
402
+ selectedAccount?.type
403
+ ? selectedAccount?.type?.toLowerCase()
404
+ : userAccountsDetail?.data?.[0]?.type?.toLowerCase()
405
+ }/notifications/`}
397
406
  className={
398
407
  window.location.pathname.includes("notifications") ? "active" : ""
399
408
  }