@factoringplus/pl-components-pack-v3 0.4.94-pre-4 → 0.4.94-pre-6
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,9 +44207,17 @@ function isLogger(logger) {
|
|
|
44207
44207
|
}
|
|
44208
44208
|
const useConfigStore = defineStore("config", {
|
|
44209
44209
|
state: () => ({
|
|
44210
|
-
token: "",
|
|
44210
|
+
token: "232323",
|
|
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
|
+
},
|
|
44213
44221
|
actions: {
|
|
44214
44222
|
getToken(token) {
|
|
44215
44223
|
this.token = token;
|
|
@@ -44220,11 +44228,6 @@ const useConfigStore = defineStore("config", {
|
|
|
44220
44228
|
api(optionsRequest) {
|
|
44221
44229
|
return ApiJs(optionsRequest, false, `Bearer ${this.token}`, true);
|
|
44222
44230
|
},
|
|
44223
|
-
channelsConnectionHub() {
|
|
44224
|
-
return new HubConnectionBuilder().withUrl(`${this.baseUrl}/v2/channels`, {
|
|
44225
|
-
accessTokenFactory: () => `${this.token}`
|
|
44226
|
-
}).configureLogging(LogLevel.Information).build();
|
|
44227
|
-
},
|
|
44228
44231
|
async connectChannelsSignalR(channelId) {
|
|
44229
44232
|
let startedPromise = null;
|
|
44230
44233
|
async function start() {
|
|
@@ -44242,27 +44245,19 @@ const useConfigStore = defineStore("config", {
|
|
|
44242
44245
|
console.error(err.toString());
|
|
44243
44246
|
}
|
|
44244
44247
|
},
|
|
44245
|
-
interactionsConnectionHub() {
|
|
44246
|
-
return new HubConnectionBuilder().withUrl(`${this.baseUrl}/v2/interactions`, {
|
|
44247
|
-
accessTokenFactory: () => `${this.token}`
|
|
44248
|
-
}).configureLogging(LogLevel.Information).build();
|
|
44249
|
-
},
|
|
44250
44248
|
async connectInteractionsSignalR(groupId) {
|
|
44251
|
-
const signalRTest = new HubConnectionBuilder().withUrl(`${this.baseUrl}/v2/interactions`, {
|
|
44252
|
-
accessTokenFactory: () => `${this.token}`
|
|
44253
|
-
}).configureLogging(LogLevel.Information).build();
|
|
44254
44249
|
let startedPromise = null;
|
|
44255
|
-
async
|
|
44256
|
-
startedPromise = await
|
|
44250
|
+
const start = async () => {
|
|
44251
|
+
startedPromise = await this.interactionsConnectionHub.start().catch((err) => {
|
|
44257
44252
|
console.error("Failed to connect with hub", err);
|
|
44258
44253
|
return new Promise((res, rej) => setTimeout(() => start().then(res).catch(rej), 5e3));
|
|
44259
44254
|
});
|
|
44260
44255
|
console.log("start $interactionsConnectionHub");
|
|
44261
44256
|
return startedPromise;
|
|
44262
|
-
}
|
|
44257
|
+
};
|
|
44263
44258
|
try {
|
|
44264
44259
|
await start();
|
|
44265
|
-
await
|
|
44260
|
+
await this.interactionsConnectionHub.invoke("Join", groupId);
|
|
44266
44261
|
} catch (err) {
|
|
44267
44262
|
console.error(err.toString());
|
|
44268
44263
|
}
|
|
@@ -44417,11 +44412,50 @@ const _sfc_main = {
|
|
|
44417
44412
|
await channelsStore.getGroups()
|
|
44418
44413
|
]);
|
|
44419
44414
|
};
|
|
44415
|
+
const updateChannels = async () => {
|
|
44416
|
+
try {
|
|
44417
|
+
await Promise.all([
|
|
44418
|
+
await channelsStore.getChannels(channelsStore.channelCategory),
|
|
44419
|
+
await channelsStore.getUnreadChannels()
|
|
44420
|
+
]);
|
|
44421
|
+
} catch (error2) {
|
|
44422
|
+
console.log(error2);
|
|
44423
|
+
}
|
|
44424
|
+
};
|
|
44425
|
+
const managerChannelsSignalR = async () => {
|
|
44426
|
+
console.log("managerChannelsSignalR");
|
|
44427
|
+
console.log("channelsStore.notifications.activeChannels.length", channelsStore.notifications.activeChannels.length);
|
|
44428
|
+
if (channelsStore.notifications.activeChannels.length) {
|
|
44429
|
+
console.log("is channels active");
|
|
44430
|
+
try {
|
|
44431
|
+
await Promise.all(channelsStore.notifications.activeChannels.map(async (channel) => {
|
|
44432
|
+
await configStore.connectChannelsSignalR(channel.channelId);
|
|
44433
|
+
await configStore.channelsConnectionHub.on("MessageAddedNotification", async (message2) => {
|
|
44434
|
+
console.log("MessageAddedNotificationManager", message2);
|
|
44435
|
+
await updateChannels();
|
|
44436
|
+
});
|
|
44437
|
+
await configStore.channelsConnectionHub.on("MessagesReadNotification", (message2) => {
|
|
44438
|
+
console.log("MessagesReadNotification", message2);
|
|
44439
|
+
updateChannels();
|
|
44440
|
+
});
|
|
44441
|
+
}));
|
|
44442
|
+
} catch (error2) {
|
|
44443
|
+
console.log(error2);
|
|
44444
|
+
}
|
|
44445
|
+
}
|
|
44446
|
+
};
|
|
44420
44447
|
const managerInteractionsSignalR = async () => {
|
|
44421
|
-
console.log("managerInteractionsSignalR");
|
|
44422
44448
|
try {
|
|
44423
44449
|
await Promise.all([
|
|
44424
|
-
await configStore.connectInteractionsSignalR("FLINE")
|
|
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
|
+
})
|
|
44425
44459
|
]);
|
|
44426
44460
|
} catch (error2) {
|
|
44427
44461
|
console.log(error2);
|
|
@@ -44431,6 +44465,7 @@ const _sfc_main = {
|
|
|
44431
44465
|
try {
|
|
44432
44466
|
await Promise.all([
|
|
44433
44467
|
getChannelsInfo(),
|
|
44468
|
+
managerChannelsSignalR(),
|
|
44434
44469
|
managerInteractionsSignalR()
|
|
44435
44470
|
]);
|
|
44436
44471
|
} catch (error2) {
|