@factoringplus/pl-components-pack-v3 0.4.94-pre-8 → 0.4.94-pre-10

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.
@@ -44422,19 +44422,36 @@ const _sfc_main = {
44422
44422
  console.log(error2);
44423
44423
  }
44424
44424
  };
44425
+ const channelsConnectionHub = new HubConnectionBuilder().withUrl(`${baseUrl}/v2/channels`, {
44426
+ accessTokenFactory: () => `${token}`
44427
+ }).configureLogging(LogLevel.Information).build();
44428
+ const connectChannelsSignalR = async (channelId) => {
44429
+ let startedPromise = null;
44430
+ const start = async () => {
44431
+ startedPromise = await channelsConnectionHub.start().catch((err) => {
44432
+ console.error("Failed to connect with hub", err);
44433
+ return new Promise((res, rej) => setTimeout(() => start().then(res).catch(rej), 5e3));
44434
+ });
44435
+ console.log("start $channelsConnectionHub");
44436
+ return startedPromise;
44437
+ };
44438
+ try {
44439
+ await start();
44440
+ await channelsConnectionHub.invoke("Join", channelId);
44441
+ } catch (err) {
44442
+ console.error(err.toString());
44443
+ }
44444
+ };
44425
44445
  const managerChannelsSignalR = async () => {
44426
- console.log("managerChannelsSignalR");
44427
- console.log("channelsStore.notifications.activeChannels.length", channelsStore.notifications.activeChannels.length);
44428
44446
  if (channelsStore.notifications.activeChannels.length) {
44429
- console.log("is channels active");
44430
44447
  try {
44431
44448
  await Promise.all(channelsStore.notifications.activeChannels.map(async (channel) => {
44432
- await configStore.connectChannelsSignalR(channel.channelId);
44433
- await configStore.channelsConnectionHub.on("MessageAddedNotification", async (message2) => {
44449
+ await connectChannelsSignalR(channel.channelId);
44450
+ await channelsConnectionHub.on("MessageAddedNotification", async (message2) => {
44434
44451
  console.log("MessageAddedNotificationManager", message2);
44435
44452
  await updateChannels();
44436
44453
  });
44437
- await configStore.channelsConnectionHub.on("MessagesReadNotification", (message2) => {
44454
+ await channelsConnectionHub.on("MessagesReadNotification", (message2) => {
44438
44455
  console.log("MessagesReadNotification", message2);
44439
44456
  updateChannels();
44440
44457
  });
@@ -44444,29 +44461,11 @@ const _sfc_main = {
44444
44461
  }
44445
44462
  }
44446
44463
  };
44447
- const managerInteractionsSignalR = async () => {
44448
- try {
44449
- await Promise.all([
44450
- await configStore.connectInteractionsSignalR("FLINE"),
44451
- await configStore.interactionsConnectionHub.on("InteractionAddedNotification", (message2) => {
44452
- console.log("InteractionAddedNotification", message2);
44453
- updateChannels();
44454
- }),
44455
- await configStore.interactionsConnectionHub.on("InteractionChangedNotification", (message2) => {
44456
- console.log("InteractionChangedNotification", message2);
44457
- updateChannels();
44458
- })
44459
- ]);
44460
- } catch (error2) {
44461
- console.log(error2);
44462
- }
44463
- };
44464
44464
  const chatManagerStart = async () => {
44465
44465
  try {
44466
44466
  await Promise.all([
44467
44467
  await getChannelsInfo(),
44468
- await managerChannelsSignalR(),
44469
- await managerInteractionsSignalR()
44468
+ await managerChannelsSignalR()
44470
44469
  ]);
44471
44470
  } catch (error2) {
44472
44471
  console.log(error2);