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

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.
@@ -44383,6 +44383,26 @@ const useChannelsStore = defineStore("channels", {
44383
44383
  });
44384
44384
  var PlChatBtn_vue_vue_type_style_index_0_lang = "";
44385
44385
  var PlChatPopup_vue_vue_type_style_index_0_lang = "";
44386
+ const channelsConnectionHub = (baseUrl, token) => new HubConnectionBuilder().withUrl(`${baseUrl}/v2/channels`, {
44387
+ accessTokenFactory: () => `${token}`
44388
+ }).configureLogging(LogLevel.Information).build();
44389
+ const connectChannelsSignalR = async (channelId) => {
44390
+ let startedPromise = null;
44391
+ const start = async () => {
44392
+ startedPromise = await channelsConnectionHub.start().catch((err) => {
44393
+ console.error("Failed to connect with hub", err);
44394
+ return new Promise((res, rej) => setTimeout(() => start().then(res).catch(rej), 5e3));
44395
+ });
44396
+ console.log("start $channelsConnectionHub");
44397
+ return startedPromise;
44398
+ };
44399
+ try {
44400
+ await start();
44401
+ await channelsConnectionHub.invoke("Join", channelId);
44402
+ } catch (err) {
44403
+ console.error(err.toString());
44404
+ }
44405
+ };
44386
44406
  const _sfc_main = {
44387
44407
  __name: "pl-chat-manager",
44388
44408
  props: {
@@ -44423,18 +44443,15 @@ const _sfc_main = {
44423
44443
  }
44424
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(baseUrl, token).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(baseUrl, token).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);