l-min-components 1.0.1171 → 1.0.1176

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.1171",
3
+ "version": "1.0.1176",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -16,4 +16,23 @@ export function getCookie(name) {
16
16
 
17
17
  // Return null if not found
18
18
  return null;
19
- }
19
+ }
20
+
21
+ export const getCookieAffiliate = () => {
22
+ const cookies = document.cookie;
23
+ const cookieArray = cookies.split(";");
24
+
25
+ let affiliateAccount = null;
26
+
27
+ cookieArray?.forEach((cookieValue) => {
28
+ const cookie = cookieValue?.trim();
29
+ if (cookie.startsWith("affiliateAccount=")) {
30
+ affiliateAccount = cookie.substring(
31
+ "affiliateAccount=".length,
32
+ cookie.length
33
+ );
34
+ }
35
+ });
36
+
37
+ return affiliateAccount;
38
+ };
@@ -45,6 +45,8 @@ const InputSection = ({
45
45
  courseID,
46
46
  handleCreateMessage,
47
47
  createMessageData,
48
+ enterpriseAffiliateID,
49
+ receiverID
48
50
  }) => {
49
51
  const [showEmoji, setShowEmoji] = useState();
50
52
  const [inputMethod, setInputMethod] = useState("text"); // text | recorder
@@ -87,7 +89,7 @@ const InputSection = ({
87
89
  const data = {
88
90
  media: file,
89
91
  };
90
- handleCreateMessageWithMedia(data.media, userID);
92
+ handleCreateMessageWithMedia(data.media, receiverID);
91
93
  setInputMethod("text");
92
94
  //console.log("uploas", file);
93
95
  }
@@ -97,7 +99,7 @@ const InputSection = ({
97
99
  setIsMessageSending(true);
98
100
 
99
101
  setTimeout(() => {
100
- handleCreateMessage(userID, accountType, text, courseID, "");
102
+ handleCreateMessage(receiverID, accountType, text, courseID, enterpriseAffiliateID);
101
103
  }, 1000);
102
104
  }
103
105
  };
@@ -263,6 +263,36 @@ const useMessaging = () => {
263
263
  }
264
264
  };
265
265
 
266
+ const [
267
+ { ...roomRecipientDetailsAffiliateData },
268
+ roomRecipientDetailsAffiliate,
269
+ ] = useAxios(
270
+ {
271
+ method: "GET",
272
+ },
273
+ {
274
+ manual: true,
275
+ }
276
+ );
277
+
278
+ const handleRoomRecipientDetailsAffiliate = async (
279
+ enterprise_account_id,
280
+ account_id,
281
+ course_id
282
+ ) => {
283
+ try {
284
+ await roomRecipientDetailsAffiliate({
285
+ url: `/notify/v1/instructor/${enterprise_account_id}/chats/recipient_details/`,
286
+ params: {
287
+ account_id,
288
+ course_id,
289
+ },
290
+ });
291
+ } catch (err) {
292
+ console.log(err);
293
+ }
294
+ };
295
+
266
296
  //GET Room Messages for Recipient
267
297
  const [{ ...roomMessageRecipientData }, roomMessageRecipient] = useAxios(
268
298
  {
@@ -481,6 +511,8 @@ const useMessaging = () => {
481
511
  handleClearChatPersonal,
482
512
  clearChatAffiliateData,
483
513
  handleClearChatAffiliate,
514
+ roomRecipientDetailsAffiliateData,
515
+ handleRoomRecipientDetailsAffiliate,
484
516
  };
485
517
  };
486
518
 
@@ -19,7 +19,8 @@ const MessagesAddon = ({
19
19
  receiverID,
20
20
  setReceiverID,
21
21
  accountType,
22
- affiliates
22
+ affiliates,
23
+ enterpriseAffiliateID
23
24
  }) => {
24
25
  const messagesContextData = useMessagesContext();
25
26
 
@@ -42,6 +43,7 @@ const MessagesAddon = ({
42
43
  setReceiverID={setReceiverID}
43
44
  accountType={accountType}
44
45
  affiliates={affiliates}
46
+ enterpriseAffiliateID={enterpriseAffiliateID}
45
47
  />
46
48
  </MessagesContext.Provider>
47
49
  );
@@ -50,6 +50,7 @@ const Messages = ({
50
50
  receiverID,
51
51
  setReceiverID,
52
52
  accountType,
53
+ enterpriseAffiliateID,
53
54
  affiliates = false,
54
55
  }) => {
55
56
  const [showEmoji, setShowEmoji] = useState(false);
@@ -105,6 +106,8 @@ const Messages = ({
105
106
  handleRoomMessageAffiliate,
106
107
  roomRecipientDetailsPersonalData,
107
108
  handleRoomRecipientDetailsPersonal,
109
+
110
+ handleRoomRecipientDetailsAffiliate,
108
111
  } = useMessaging();
109
112
  const {
110
113
  handleGetMyRooms,
@@ -194,7 +197,8 @@ const Messages = ({
194
197
  }
195
198
  if (affiliates && accountType === "instructor") {
196
199
  handleRoomMessageAffiliate(receiverID, courseID, roomID);
197
- handleRoomRecipientDetails(accountType, receiverID, courseID);
200
+ handleRoomRecipientDetailsAffiliate(enterpriseAffiliateID, receiverID, courseID); //check later
201
+ // handleRoomRecipientDetails(accountType, receiverID, courseID);
198
202
  }
199
203
  if (accountType === "personal") {
200
204
  handleRetrieveMessage(receiverID, courseID, roomID);
@@ -441,6 +445,8 @@ const Messages = ({
441
445
  affiliates={affiliates}
442
446
  handleCreateMessage={handleCreateMessage}
443
447
  createMessageData={createMessageData}
448
+ enterpriseAffiliateID={enterpriseAffiliateID}
449
+ receiverID={receiverID}
444
450
  />
445
451
  </div>
446
452
  </>