From 7a312a1ace66dd0f5978929b865aa03f2c26dd5f Mon Sep 17 00:00:00 2001 From: maaz519 Date: Wed, 22 Jul 2026 19:23:57 +0530 Subject: [PATCH] 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 --- package-lock.json | 2 +- src/lib/crm-messaging-adapter.ts | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 14c6369..5272f7a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/src/lib/crm-messaging-adapter.ts b/src/lib/crm-messaging-adapter.ts index 0ecb00e..f85b1ef 100644 --- a/src/lib/crm-messaging-adapter.ts +++ b/src/lib/crm-messaging-adapter.ts @@ -81,7 +81,7 @@ export class CrmMessagingAdapter implements MessagingAdapter { async listConversations(): Promise { const [convs, names] = await Promise.all([ this.sdk.query("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 { + const dir = await this.sdk.query("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> { + private async directoryMap(): Promise> { if (!this.names) { - const dir = await this.sdk.query("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; }