File size: 915 Bytes
4327358
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
exports.LoadWAHA = () => {
  window.WAHA = {};
  window.WAHA.WAWebBizLabelEditingAction = window.require(
    'WAWebBizLabelEditingAction',
  );

  window.WAHA.getChats = async (pagination, filter) => {
    let chats = window.Store.Chat.getModelsArray().slice();

    // Filter chats by IDs if filter is provided
    if (filter && filter.ids && filter.ids.length > 0) {
      chats = chats.filter((chat) => filter.ids.includes(chat.id._serialized));
    }

    const paginator = new window.Paginator(pagination);
    chats = paginator.apply(chats);
    const chatPromises = chats.map((chat) => window.WWebJS.getChatModel(chat));
    return await Promise.all(chatPromises);
  };

  // Set push name
  window.WAHA.WAWebSetPushnameConnAction = window.require(
    'WAWebSetPushnameConnAction',
  );

  // Get my status
  window.WAHA.WAWebTextStatusCollection = window.require(
    'WAWebTextStatusCollection',
  );
};