Feat/adopt messaging sdk #31
Generated
+1
-1
@@ -1030,7 +1030,7 @@
|
||||
"node_modules/@insignia/iios-messaging-ui": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "file:../iios/packages/iios-messaging-ui/insignia-iios-messaging-ui-0.1.0.tgz",
|
||||
"integrity": "sha512-Ks+tTnNBw3QqNpBlggEnbmfRrDnCSq9jq3b5TOsc/XEEgzdebtFDuQziVW/G6oRp4ysTQ6Fci/XRm1z1yLf4Wg==",
|
||||
"integrity": "sha512-sfNRRJQgbq3FCvwUtn4H7ojHnhQZnM5bd2MQmq3XFmTZNsj0BGNh/dcKvR9/7vbLaXP10kuOHZGXrCi/1LsJYA==",
|
||||
"peerDependencies": {
|
||||
"@insignia/iios-kernel-client": "*",
|
||||
"react": ">=18",
|
||||
|
||||
@@ -81,7 +81,7 @@ export class CrmMessagingAdapter implements MessagingAdapter {
|
||||
async listConversations(): Promise<Conversation[]> {
|
||||
const [convs, names] = await Promise.all([
|
||||
this.sdk.query<ConversationDTO[]>("crm.messenger.conversation.list", {}),
|
||||
this.directory(),
|
||||
this.directoryMap(),
|
||||
]);
|
||||
return convs.map((c) => this.toConversation(c, names));
|
||||
}
|
||||
@@ -219,11 +219,16 @@ export class CrmMessagingAdapter implements MessagingAdapter {
|
||||
poll.timer = setInterval(tick, POLL_MS);
|
||||
}
|
||||
|
||||
/** The org directory — people you can start a DM/group with. Drives the "New message" picker. */
|
||||
async directory(): Promise<Person[]> {
|
||||
const dir = await this.sdk.query<DirectoryDTO[]>("crm.messenger.directory", { kind: "all", limit: 200 });
|
||||
return dir.map((d) => ({ id: d.id, name: d.displayName, kind: d.kind }));
|
||||
}
|
||||
|
||||
// ── mapping ────────────────────────────────────────────────────
|
||||
private async directory(): Promise<Map<string, string>> {
|
||||
private async directoryMap(): Promise<Map<string, string>> {
|
||||
if (!this.names) {
|
||||
const dir = await this.sdk.query<DirectoryDTO[]>("crm.messenger.directory", { kind: "all", limit: 200 });
|
||||
this.names = new Map(dir.map((d) => [d.id, d.displayName]));
|
||||
this.names = new Map((await this.directory()).map((p) => [p.id, p.name]));
|
||||
}
|
||||
return this.names;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user