@burdenoff/microfe-botmanor 2026.1120.27 → 2026.1120.28
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.
- package/dist/botlit/components/HandoffConfigPanel.js +133 -132
- package/dist/botlit/components/HandoffConfigPanel.js.map +1 -1
- package/dist/botlit/components/HandoffTargetPickers.d.ts +28 -0
- package/dist/botlit/components/HandoffTargetPickers.js +180 -0
- package/dist/botlit/components/HandoffTargetPickers.js.map +1 -0
- package/dist/botlit/hooks/index.js +2 -2
- package/dist/botlit/hooks/useHandoffInbox.d.ts +26 -0
- package/dist/botlit/hooks/useHandoffInbox.js +126 -0
- package/dist/botlit/hooks/useHandoffInbox.js.map +1 -0
- package/dist/botlit/hooks/useHandoffs.js +36 -63
- package/dist/botlit/hooks/useHandoffs.js.map +1 -1
- package/dist/botlit/hooks/useMyIntegrationConnections.d.ts +4 -0
- package/dist/botlit/hooks/useMyIntegrationConnections.js +26 -0
- package/dist/botlit/hooks/useMyIntegrationConnections.js.map +1 -0
- package/dist/botlit/hooks/useWorkspaceMemberDirectory.d.ts +26 -0
- package/dist/botlit/hooks/useWorkspaceMemberDirectory.js +84 -0
- package/dist/botlit/hooks/useWorkspaceMemberDirectory.js.map +1 -0
- package/dist/botlit/pages/BotChannelsTab.js +288 -250
- package/dist/botlit/pages/BotChannelsTab.js.map +1 -1
- package/dist/botlit/pages/HandoffsPage.js +190 -149
- package/dist/botlit/pages/HandoffsPage.js.map +1 -1
- package/dist/botlit/utils/handoffInbox.d.ts +64 -0
- package/dist/botlit/utils/handoffInbox.js +62 -0
- package/dist/botlit/utils/handoffInbox.js.map +1 -0
- package/dist/generated/wspace-operations.d.ts +160 -0
- package/dist/generated/wspace-operations.js +128 -87
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.js +8 -6
- package/dist/generated/wspace-types.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BotmanorMyIntegrationConnectionsDocument as e } from "../../generated/wspace-operations.js";
|
|
2
|
+
import { ConnectionAccessFilter as t } from "../../generated/wspace-types.js";
|
|
3
|
+
import { useWorkspaceId as n, useWorkspaceQuery as r } from "./internal/workspaceGateway.js";
|
|
4
|
+
import { useMemo as i } from "react";
|
|
5
|
+
// src/botlit/hooks/useMyIntegrationConnections.ts
|
|
6
|
+
var a = [];
|
|
7
|
+
function o(o) {
|
|
8
|
+
let s = n(), c = i(() => ({
|
|
9
|
+
filter: { access: t.OwnedByMe },
|
|
10
|
+
pagination: {
|
|
11
|
+
limit: 100,
|
|
12
|
+
offset: 0
|
|
13
|
+
}
|
|
14
|
+
}), []);
|
|
15
|
+
return r({
|
|
16
|
+
document: e,
|
|
17
|
+
variables: c,
|
|
18
|
+
select: (e) => e?.getConnections.items ?? a,
|
|
19
|
+
fallback: a,
|
|
20
|
+
enabled: o && !!s,
|
|
21
|
+
errorMessage: "Failed to load your integration connections"
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export { o as useMyIntegrationConnections };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=useMyIntegrationConnections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMyIntegrationConnections.js","names":["NO_CONNECTIONS","useMyIntegrationConnections","workspaceId","useWorkspaceId","variables","useMemo","ConnectionAccessFilter","useWorkspaceQuery","BotmanorMyIntegrationConnectionsDocument","data","enabled"],"sources":["../../../src/botlit/hooks/useMyIntegrationConnections.ts"],"sourcesContent":["/**\n * The caller's own integration connections (BOFF-15472)\n * @module botlit/hooks\n *\n * Feeds the channel \"link your account\" picker, which used to ask people to\n * paste a raw connection id copied from the Integrations page.\n */\n\nimport { useMemo } from 'react';\n\nimport {\n BotmanorMyIntegrationConnectionsDocument,\n type BotmanorMyIntegrationConnectionsQuery,\n} from '../../generated/wspace-operations';\nimport { ConnectionAccessFilter } from '../../generated/wspace-types';\nimport { useWorkspaceId, useWorkspaceQuery, type QueryResult } from './internal/workspaceGateway';\n\nexport type MyIntegrationConnection = NonNullable<\n BotmanorMyIntegrationConnectionsQuery['getConnections']\n>['items'][number];\n\nconst NO_CONNECTIONS: MyIntegrationConnection[] = [];\n\nexport function useMyIntegrationConnections(\n enabled: boolean\n): QueryResult<MyIntegrationConnection[]> {\n const workspaceId = useWorkspaceId();\n const variables = useMemo(\n () => ({\n filter: { access: ConnectionAccessFilter.OwnedByMe },\n pagination: { limit: 100, offset: 0 },\n }),\n []\n );\n return useWorkspaceQuery<BotmanorMyIntegrationConnectionsQuery, MyIntegrationConnection[]>({\n document: BotmanorMyIntegrationConnectionsDocument,\n variables,\n select: (data) => data?.getConnections.items ?? NO_CONNECTIONS,\n fallback: NO_CONNECTIONS,\n enabled: enabled && Boolean(workspaceId),\n errorMessage: 'Failed to load your integration connections',\n });\n}\n"],"mappings":";;;;;AAqBA,IAAMA,IAA4C,CAAC;AAEnD,SAAgBC,EACd,GACwC;CACxC,IAAMC,IAAcC,EAAe,GAC7BC,IAAYC,SACT;EACL,QAAQ,EAAE,QAAQC,EAAuB,UAAU;EACnD,YAAY;GAAE,OAAO;GAAK,QAAQ;EAAE;CACtC,IACA,CAAC,CACH;CACA,OAAOC,EAAoF;EACzF,UAAUC;EACV;EACA,SAAS,MAASC,GAAM,eAAe,SAAST;EAChD,UAAUA;EACV,SAASU,KAAW,EAAQR;EAC5B,cAAc;CAChB,CAAC;AACH"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace member directory for pickers (BOFF-15472)
|
|
3
|
+
* @module botlit/hooks
|
|
4
|
+
*
|
|
5
|
+
* Lists the active workspace's members with their membership role and a
|
|
6
|
+
* human identity (name, email), so handoff routing picks teammates by name
|
|
7
|
+
* instead of asking for raw auth user ids. Identity lookup is best effort: a
|
|
8
|
+
* member whose identity cannot be resolved still appears, under a short id.
|
|
9
|
+
*/
|
|
10
|
+
export interface DirectoryMember {
|
|
11
|
+
/** Auth user id — what handoff routing stores. */
|
|
12
|
+
userId: string;
|
|
13
|
+
/** Membership role, e.g. owner, admin, member. */
|
|
14
|
+
role: string;
|
|
15
|
+
displayName: string;
|
|
16
|
+
email: string | null;
|
|
17
|
+
}
|
|
18
|
+
export interface WorkspaceMemberDirectory {
|
|
19
|
+
members: DirectoryMember[];
|
|
20
|
+
loading: boolean;
|
|
21
|
+
error: Error | undefined;
|
|
22
|
+
refetch: () => Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
/** Short label for a member whose identity is unknown. */
|
|
25
|
+
export declare function shortUserLabel(userId: string): string;
|
|
26
|
+
export declare function useWorkspaceMemberDirectory(enabled?: boolean): WorkspaceMemberDirectory;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { BotmanorWorkspaceMemberIdentitiesDocument as e, BotmanorWorkspaceMembersDocument as t } from "../../generated/wspace-operations.js";
|
|
2
|
+
import { extractGraphqlFailureMessage as n } from "../utils/errors.js";
|
|
3
|
+
import { useWorkspaceClient as r, useWorkspaceId as i } from "./internal/workspaceGateway.js";
|
|
4
|
+
import { useCallback as a, useEffect as o, useState as s } from "react";
|
|
5
|
+
// src/botlit/hooks/useWorkspaceMemberDirectory.ts
|
|
6
|
+
var c = 100, l = 1e3, u = 100;
|
|
7
|
+
function d(e) {
|
|
8
|
+
return e.length > 12 ? `${e.slice(0, 8)}…` : e;
|
|
9
|
+
}
|
|
10
|
+
function f(f = !0) {
|
|
11
|
+
let p = r(), m = i(), [h, g] = s([]), [_, v] = s(f && !!m), [y, b] = s(), x = a(async () => {
|
|
12
|
+
if (f && m) {
|
|
13
|
+
v(!0), b(void 0);
|
|
14
|
+
try {
|
|
15
|
+
let n = [];
|
|
16
|
+
for (let e = 0; e < l; e += c) {
|
|
17
|
+
let r = await p.query({
|
|
18
|
+
query: t,
|
|
19
|
+
variables: {
|
|
20
|
+
workspaceId: m,
|
|
21
|
+
pagination: {
|
|
22
|
+
limit: c,
|
|
23
|
+
offset: e
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
fetchPolicy: "network-only"
|
|
27
|
+
}), i = r.error;
|
|
28
|
+
if (i != null) throw i;
|
|
29
|
+
let a = r.data?.workspaceMembers;
|
|
30
|
+
if (n.push(...a?.items ?? []), !a?.hasMore) break;
|
|
31
|
+
}
|
|
32
|
+
let r = n.filter((e) => e.status.toLowerCase() !== "suspended"), i = [...new Set(r.map((e) => e.userId))], a = /* @__PURE__ */ new Map();
|
|
33
|
+
for (let t = 0; t < i.length; t += u) try {
|
|
34
|
+
let n = await p.query({
|
|
35
|
+
query: e,
|
|
36
|
+
variables: {
|
|
37
|
+
workspaceId: m,
|
|
38
|
+
userIds: i.slice(t, t + u)
|
|
39
|
+
},
|
|
40
|
+
fetchPolicy: "network-only"
|
|
41
|
+
});
|
|
42
|
+
for (let e of n.data?.workspaceMemberIdentities ?? []) a.set(e.userId, {
|
|
43
|
+
displayName: e.displayName,
|
|
44
|
+
email: e.email ?? null
|
|
45
|
+
});
|
|
46
|
+
} catch {}
|
|
47
|
+
let o = /* @__PURE__ */ new Set(), s = [];
|
|
48
|
+
for (let e of r) {
|
|
49
|
+
if (o.has(e.userId)) continue;
|
|
50
|
+
o.add(e.userId);
|
|
51
|
+
let t = a.get(e.userId);
|
|
52
|
+
s.push({
|
|
53
|
+
userId: e.userId,
|
|
54
|
+
role: e.role,
|
|
55
|
+
displayName: t?.displayName || t?.email || d(e.userId),
|
|
56
|
+
email: t?.email ?? null
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
s.sort((e, t) => e.displayName.localeCompare(t.displayName)), g(s);
|
|
60
|
+
} catch (e) {
|
|
61
|
+
g([]);
|
|
62
|
+
let t = n(e) ?? (e instanceof Error && e.message ? e.message : "Failed to load workspace members");
|
|
63
|
+
b(Error(t, { cause: e }));
|
|
64
|
+
} finally {
|
|
65
|
+
v(!1);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}, [
|
|
69
|
+
p,
|
|
70
|
+
f,
|
|
71
|
+
m
|
|
72
|
+
]);
|
|
73
|
+
return o(() => {
|
|
74
|
+
x();
|
|
75
|
+
}, [x]), {
|
|
76
|
+
members: h,
|
|
77
|
+
loading: _,
|
|
78
|
+
error: y,
|
|
79
|
+
refetch: x
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export { d as shortUserLabel, f as useWorkspaceMemberDirectory };
|
|
83
|
+
|
|
84
|
+
//# sourceMappingURL=useWorkspaceMemberDirectory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWorkspaceMemberDirectory.js","names":["PAGE_SIZE","MAX_MEMBERS","IDENTITY_BATCH","shortUserLabel","userId","useWorkspaceMemberDirectory","client","useWorkspaceClient","workspaceId","useWorkspaceId","members","setMembers","useState","loading","setLoading","enabled","error","setError","refetch","useCallback","rows","offset","result","BotmanorWorkspaceMembersDocument","operationError","page","active","row","userIds","identities","start","BotmanorWorkspaceMemberIdentitiesDocument","identity","seen","resolved","a","b","cause","message","extractGraphqlFailureMessage","useEffect"],"sources":["../../../src/botlit/hooks/useWorkspaceMemberDirectory.ts"],"sourcesContent":["/**\n * Workspace member directory for pickers (BOFF-15472)\n * @module botlit/hooks\n *\n * Lists the active workspace's members with their membership role and a\n * human identity (name, email), so handoff routing picks teammates by name\n * instead of asking for raw auth user ids. Identity lookup is best effort: a\n * member whose identity cannot be resolved still appears, under a short id.\n */\n\nimport { useCallback, useEffect, useState } from 'react';\n\nimport {\n BotmanorWorkspaceMemberIdentitiesDocument,\n BotmanorWorkspaceMembersDocument,\n type BotmanorWorkspaceMemberIdentitiesQuery,\n type BotmanorWorkspaceMembersQuery,\n} from '../../generated/wspace-operations';\nimport { extractGraphqlFailureMessage } from '../utils/errors';\nimport { useWorkspaceClient, useWorkspaceId } from './internal/workspaceGateway';\n\nexport interface DirectoryMember {\n /** Auth user id — what handoff routing stores. */\n userId: string;\n /** Membership role, e.g. owner, admin, member. */\n role: string;\n displayName: string;\n email: string | null;\n}\n\nexport interface WorkspaceMemberDirectory {\n members: DirectoryMember[];\n loading: boolean;\n error: Error | undefined;\n refetch: () => Promise<void>;\n}\n\nconst PAGE_SIZE = 100;\n/** Upper bound on members listed in a picker (10 pages). */\nconst MAX_MEMBERS = 1000;\n/** User ids per identity lookup. */\nconst IDENTITY_BATCH = 100;\n\n/** Short label for a member whose identity is unknown. */\nexport function shortUserLabel(userId: string): string {\n return userId.length > 12 ? `${userId.slice(0, 8)}…` : userId;\n}\n\nexport function useWorkspaceMemberDirectory(enabled = true): WorkspaceMemberDirectory {\n const client = useWorkspaceClient();\n const workspaceId = useWorkspaceId();\n const [members, setMembers] = useState<DirectoryMember[]>([]);\n // Loading from the first frame when a read will start, so pickers don't\n // flash \"every teammate is already chosen\" before it does.\n const [loading, setLoading] = useState(enabled && Boolean(workspaceId));\n const [error, setError] = useState<Error | undefined>();\n\n const refetch = useCallback(async () => {\n if (!enabled || !workspaceId) return;\n setLoading(true);\n setError(undefined);\n try {\n const rows: Array<{ userId: string; role: string; status: string }> = [];\n for (let offset = 0; offset < MAX_MEMBERS; offset += PAGE_SIZE) {\n const result = await client.query<BotmanorWorkspaceMembersQuery>({\n query: BotmanorWorkspaceMembersDocument,\n variables: { workspaceId, pagination: { limit: PAGE_SIZE, offset } },\n fetchPolicy: 'network-only',\n });\n const operationError = (result as { error?: unknown }).error;\n if (operationError != null) throw operationError;\n const page = result.data?.workspaceMembers;\n rows.push(...(page?.items ?? []));\n if (!page?.hasMore) break;\n }\n const active = rows.filter((row) => row.status.toLowerCase() !== 'suspended');\n const userIds = [...new Set(active.map((row) => row.userId))];\n\n const identities = new Map<string, { displayName: string; email: string | null }>();\n // In batches, so a large workspace never sends one huge id list.\n for (let start = 0; start < userIds.length; start += IDENTITY_BATCH) {\n try {\n const result = await client.query<BotmanorWorkspaceMemberIdentitiesQuery>({\n query: BotmanorWorkspaceMemberIdentitiesDocument,\n variables: { workspaceId, userIds: userIds.slice(start, start + IDENTITY_BATCH) },\n fetchPolicy: 'network-only',\n });\n for (const identity of result.data?.workspaceMemberIdentities ?? []) {\n identities.set(identity.userId, {\n displayName: identity.displayName,\n email: identity.email ?? null,\n });\n }\n } catch {\n // Best effort: members of this batch stay selectable under their short id.\n }\n }\n\n const seen = new Set<string>();\n const resolved: DirectoryMember[] = [];\n for (const row of active) {\n if (seen.has(row.userId)) continue;\n seen.add(row.userId);\n const identity = identities.get(row.userId);\n resolved.push({\n userId: row.userId,\n role: row.role,\n displayName: identity?.displayName || identity?.email || shortUserLabel(row.userId),\n email: identity?.email ?? null,\n });\n }\n resolved.sort((a, b) => a.displayName.localeCompare(b.displayName));\n setMembers(resolved);\n } catch (cause) {\n setMembers([]);\n const message =\n extractGraphqlFailureMessage(cause) ??\n (cause instanceof Error && cause.message\n ? cause.message\n : 'Failed to load workspace members');\n setError(new Error(message, { cause }));\n } finally {\n setLoading(false);\n }\n }, [client, enabled, workspaceId]);\n\n useEffect(() => {\n void refetch();\n }, [refetch]);\n\n return { members, loading, error, refetch };\n}\n"],"mappings":";;;;;AAqCA,IAAMA,IAAY,KAEZC,IAAc,KAEdC,IAAiB;AAGvB,SAAgBC,EAAe,GAAwB;CACrD,OAAOC,EAAO,SAAS,KAAK,GAAGA,EAAO,MAAM,GAAG,CAAC,EAAE,KAAKA;AACzD;AAEA,SAAgBC,EAA4B,IAAU,IAAgC;CACpF,IAAMC,IAASC,EAAmB,GAC5BC,IAAcC,EAAe,GAC7B,CAACC,GAASC,KAAcC,EAA4B,CAAC,CAAC,GAGtD,CAACC,GAASC,KAAcF,EAASG,KAAW,EAAQP,CAAY,GAChE,CAACQ,GAAOC,KAAYL,EAA4B,GAEhDM,IAAUC,EAAY,YAAY;EACtC,IAAKJ,KAAYP,GACjB;GACA,AADAM,EAAW,EAAI,GACfG,EAAS,KAAA,CAAS;GAClB,IAAI;IACF,IAAMG,IAAgE,CAAC;IACvE,KAAK,IAAIC,IAAS,GAAGA,IAASpB,GAAa,KAAUD,GAAW;KAC9D,IAAMsB,IAAS,MAA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