feat(messenger): expose adapter directory() for DM/group picker + pull SDK build

CrmMessagingAdapter.directory() now returns the org people list (Person[]) for the
new 'New message' picker; internal name-resolution uses directoryMap(). The DM/group
create path rides the existing crm.messenger.conversation.open door (dedupe + group).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-22 19:23:57 +05:30
parent eb7e1f7995
commit 7a312a1ace
2 changed files with 10 additions and 5 deletions
+9 -4
View File
@@ -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;
}