@factoringplus/pl-components-pack-v3 0.4.94-pre-11 → 0.4.94-pre-13

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.
@@ -44207,17 +44207,9 @@ function isLogger(logger) {
44207
44207
  }
44208
44208
  const useConfigStore = defineStore("config", {
44209
44209
  state: () => ({
44210
- token: "232323",
44210
+ token: "",
44211
44211
  baseUrl: ""
44212
44212
  }),
44213
- getters: {
44214
- channelsConnectionHub: (state) => new HubConnectionBuilder().withUrl(`${state.baseUrl}/v2/channels`, {
44215
- accessTokenFactory: () => `${state.token}`
44216
- }).configureLogging(LogLevel.Information).build(),
44217
- interactionsConnectionHub: (state) => new HubConnectionBuilder().withUrl(`${state.baseUrl}/v2/interactions`, {
44218
- accessTokenFactory: () => `${state.token}`
44219
- }).configureLogging(LogLevel.Information).build()
44220
- },
44221
44213
  actions: {
44222
44214
  getToken(token) {
44223
44215
  this.token = token;
@@ -44227,40 +44219,6 @@ const useConfigStore = defineStore("config", {
44227
44219
  },
44228
44220
  api(optionsRequest) {
44229
44221
  return ApiJs(optionsRequest, false, `Bearer ${this.token}`, true);
44230
- },
44231
- async connectChannelsSignalR(channelId) {
44232
- let startedPromise = null;
44233
- const start = async () => {
44234
- startedPromise = await this.channelsConnectionHub.start().catch((err) => {
44235
- console.error("Failed to connect with hub", err);
44236
- return new Promise((res, rej) => setTimeout(() => start().then(res).catch(rej), 5e3));
44237
- });
44238
- console.log("start $channelsConnectionHub");
44239
- return startedPromise;
44240
- };
44241
- try {
44242
- await start();
44243
- await this.channelsConnectionHub.invoke("Join", channelId);
44244
- } catch (err) {
44245
- console.error(err.toString());
44246
- }
44247
- },
44248
- async connectInteractionsSignalR(groupId) {
44249
- let startedPromise = null;
44250
- const start = async () => {
44251
- startedPromise = await this.interactionsConnectionHub.start().catch((err) => {
44252
- console.error("Failed to connect with hub", err);
44253
- return new Promise((res, rej) => setTimeout(() => start().then(res).catch(rej), 5e3));
44254
- });
44255
- console.log("start $interactionsConnectionHub");
44256
- return startedPromise;
44257
- };
44258
- try {
44259
- await start();
44260
- await this.interactionsConnectionHub.invoke("Join", groupId);
44261
- } catch (err) {
44262
- console.error(err.toString());
44263
- }
44264
44222
  }
44265
44223
  }
44266
44224
  });
@@ -44383,6 +44341,23 @@ const useChannelsStore = defineStore("channels", {
44383
44341
  });
44384
44342
  var PlChatBtn_vue_vue_type_style_index_0_lang = "";
44385
44343
  var PlChatPopup_vue_vue_type_style_index_0_lang = "";
44344
+ const connectSignalR = async (id, hub, type4) => {
44345
+ let startedPromise = null;
44346
+ const start = async () => {
44347
+ startedPromise = await hub.start().catch((err) => {
44348
+ console.error("Failed to connect with hub", err);
44349
+ return new Promise((res, rej) => setTimeout(() => start().then(res).catch(rej), 5e3));
44350
+ });
44351
+ console.log(`start $${type4}ConnectionHub`);
44352
+ return startedPromise;
44353
+ };
44354
+ try {
44355
+ await start();
44356
+ await hub.invoke("Join", id);
44357
+ } catch (err) {
44358
+ console.error(err.toString());
44359
+ }
44360
+ };
44386
44361
  const _sfc_main = {
44387
44362
  __name: "pl-chat-manager",
44388
44363
  props: {
@@ -44422,31 +44397,14 @@ const _sfc_main = {
44422
44397
  console.log(error2);
44423
44398
  }
44424
44399
  };
44425
- const connectChannelsSignalR = async (channelId, test) => {
44426
- let startedPromise = null;
44427
- const start = async () => {
44428
- startedPromise = await test.start().catch((err) => {
44429
- console.error("Failed to connect with hub", err);
44430
- return new Promise((res, rej) => setTimeout(() => start().then(res).catch(rej), 5e3));
44431
- });
44432
- console.log("start $channelsConnectionHub");
44433
- return startedPromise;
44434
- };
44435
- try {
44436
- await start();
44437
- await test.invoke("Join", channelId);
44438
- } catch (err) {
44439
- console.error(err.toString());
44440
- }
44441
- };
44442
44400
  const managerChannelsSignalR = async () => {
44443
44401
  if (channelsStore.notifications.activeChannels.length) {
44444
44402
  try {
44445
44403
  await Promise.all(channelsStore.notifications.activeChannels.map(async (channel) => {
44446
- const channelsConnectionHub = new HubConnectionBuilder().withUrl(`${baseUrl}/v2/channels`, {
44447
- accessTokenFactory: () => `${token}`
44404
+ const channelsConnectionHub = new HubConnectionBuilder().withUrl(`${baseUrl.value}/v2/channels`, {
44405
+ accessTokenFactory: () => `${token.value}`
44448
44406
  }).configureLogging(LogLevel.Information).build();
44449
- await connectChannelsSignalR(channel.channelId, channelsConnectionHub);
44407
+ await connectSignalR(channel.channelId, channelsConnectionHub, "channels");
44450
44408
  await channelsConnectionHub.on("MessageAddedNotification", async (message2) => {
44451
44409
  console.log("MessageAddedNotificationManager", message2);
44452
44410
  await updateChannels();
@@ -44461,11 +44419,32 @@ const _sfc_main = {
44461
44419
  }
44462
44420
  }
44463
44421
  };
44422
+ const managerInteractionsSignalR = async () => {
44423
+ try {
44424
+ const interactionsConnectionHub = new HubConnectionBuilder().withUrl(`${baseUrl.value}/v2/channels`, {
44425
+ accessTokenFactory: () => `${token.value}`
44426
+ }).configureLogging(LogLevel.Information).build();
44427
+ await Promise.all([
44428
+ await connectSignalR("FLINE", interactionsConnectionHub, "interactions"),
44429
+ await interactionsConnectionHub.on("InteractionAddedNotification", (message2) => {
44430
+ console.log("InteractionAddedNotification", message2);
44431
+ updateChannels();
44432
+ }),
44433
+ await interactionsConnectionHub.on("InteractionChangedNotification", (message2) => {
44434
+ console.log("InteractionChangedNotification", message2);
44435
+ updateChannels();
44436
+ })
44437
+ ]);
44438
+ } catch (error2) {
44439
+ console.log(error2);
44440
+ }
44441
+ };
44464
44442
  const chatManagerStart = async () => {
44465
44443
  try {
44466
44444
  await Promise.all([
44467
44445
  await getChannelsInfo(),
44468
- await managerChannelsSignalR()
44446
+ await managerChannelsSignalR(),
44447
+ await managerInteractionsSignalR()
44469
44448
  ]);
44470
44449
  } catch (error2) {
44471
44450
  console.log(error2);