@factoringplus/pl-components-pack-v3 0.4.93 → 0.4.94-pre-2

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.
@@ -44241,6 +44241,28 @@ const useConfigStore = defineStore("config", {
44241
44241
  } catch (err) {
44242
44242
  console.error(err.toString());
44243
44243
  }
44244
+ },
44245
+ interactionsConnectionHub() {
44246
+ return new HubConnectionBuilder().withUrl(`${this.baseUrl}/v2/interactions`, {
44247
+ accessTokenFactory: () => `${this.token}`
44248
+ }).configureLogging(LogLevel.Information).build();
44249
+ },
44250
+ async connectInteractionsSignalR(groupId) {
44251
+ let startedPromise = null;
44252
+ async function start() {
44253
+ startedPromise = await this.interactionsConnectionHub.start().catch((err) => {
44254
+ console.error("Failed to connect with hub", err);
44255
+ return new Promise((res, rej) => setTimeout(() => start().then(res).catch(rej), 5e3));
44256
+ });
44257
+ console.log("start $interactionsConnectionHub");
44258
+ return startedPromise;
44259
+ }
44260
+ try {
44261
+ await start();
44262
+ await this.interactionsConnectionHub.invoke("Join", groupId);
44263
+ } catch (err) {
44264
+ console.error(err.toString());
44265
+ }
44244
44266
  }
44245
44267
  }
44246
44268
  });
@@ -44385,6 +44407,7 @@ const _sfc_main = {
44385
44407
  const getChannelsInfo = async () => {
44386
44408
  configStore.getToken(token);
44387
44409
  configStore.getBaseUrl(baseUrl);
44410
+ console.log("getChannelsInfo");
44388
44411
  await Promise.all([
44389
44412
  await channelsStore.getChannels("Active"),
44390
44413
  await channelsStore.getUnreadChannels(),
@@ -44402,7 +44425,9 @@ const _sfc_main = {
44402
44425
  }
44403
44426
  };
44404
44427
  const managerChannelsSignalR = async () => {
44428
+ console.log("managerChannelsSignalR");
44405
44429
  if (channelsStore.notifications.activeChannels.length) {
44430
+ console.log("is channels active");
44406
44431
  try {
44407
44432
  await Promise.all(channelsStore.notifications.activeChannels.map(async (channel) => {
44408
44433
  await configStore.connectChannelsSignalR(channel.channelId);
@@ -44420,11 +44445,30 @@ const _sfc_main = {
44420
44445
  }
44421
44446
  }
44422
44447
  };
44448
+ const managerInteractionsSignalR = async () => {
44449
+ console.log("managerInteractionsSignalR");
44450
+ try {
44451
+ await Promise.all([
44452
+ await configStore.connectInteractionsSignalR("FLINE"),
44453
+ await configStore.interactionsConnectionHub.on("InteractionAddedNotification", (message2) => {
44454
+ console.log("InteractionAddedNotification", message2);
44455
+ updateChannels();
44456
+ }),
44457
+ await configStore.interactionsConnectionHub.on("InteractionChangedNotification", (message2) => {
44458
+ console.log("InteractionChangedNotification", message2);
44459
+ updateChannels();
44460
+ })
44461
+ ]);
44462
+ } catch (error2) {
44463
+ console.log(error2);
44464
+ }
44465
+ };
44423
44466
  const chatManagerStart = async () => {
44424
44467
  try {
44425
44468
  await Promise.all([
44426
44469
  getChannelsInfo(),
44427
- managerChannelsSignalR()
44470
+ managerChannelsSignalR(),
44471
+ managerInteractionsSignalR()
44428
44472
  ]);
44429
44473
  } catch (error2) {
44430
44474
  console.log(error2);