@burdenoff/microfe-planmagnet 2026.930.19 → 2026.930.21
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/index.js +2 -1
- package/dist/planmagnet/PlanMagnetRoutes.d.ts.map +1 -1
- package/dist/planmagnet/PlanMagnetRoutes.js +17 -5
- package/dist/planmagnet/PlanMagnetRoutes.js.map +1 -1
- package/dist/planmagnet/automation/AutomationExecutionsPanel.d.ts.map +1 -1
- package/dist/planmagnet/automation/AutomationExecutionsPanel.js +43 -39
- package/dist/planmagnet/automation/AutomationExecutionsPanel.js.map +1 -1
- package/dist/planmagnet/automation/AutomationRuleFields.d.ts +23 -4
- package/dist/planmagnet/automation/AutomationRuleFields.d.ts.map +1 -1
- package/dist/planmagnet/automation/AutomationRuleFields.js +255 -108
- package/dist/planmagnet/automation/AutomationRuleFields.js.map +1 -1
- package/dist/planmagnet/automation/automationRuleTypes.d.ts +138 -15
- package/dist/planmagnet/automation/automationRuleTypes.d.ts.map +1 -1
- package/dist/planmagnet/automation/automationRuleTypes.js +162 -22
- package/dist/planmagnet/automation/automationRuleTypes.js.map +1 -1
- package/dist/planmagnet/controls/AutomationRuleControls.d.ts.map +1 -1
- package/dist/planmagnet/controls/AutomationRuleControls.js +76 -71
- package/dist/planmagnet/controls/AutomationRuleControls.js.map +1 -1
- package/dist/planmagnet/controls/SyncControls.d.ts +101 -0
- package/dist/planmagnet/controls/SyncControls.d.ts.map +1 -0
- package/dist/planmagnet/controls/SyncControls.js +616 -0
- package/dist/planmagnet/controls/SyncControls.js.map +1 -0
- package/dist/planmagnet/index.d.ts +1 -0
- package/dist/planmagnet/index.d.ts.map +1 -1
- package/dist/planmagnet/index.js +1 -0
- package/dist/planmagnet/integrations/routes.d.ts +13 -0
- package/dist/planmagnet/integrations/routes.d.ts.map +1 -0
- package/dist/planmagnet/integrations/routes.js +9 -0
- package/dist/planmagnet/integrations/routes.js.map +1 -0
- package/dist/planmagnet/integrations/syncTypes.d.ts +143 -0
- package/dist/planmagnet/integrations/syncTypes.d.ts.map +1 -0
- package/dist/planmagnet/integrations/syncTypes.js +71 -0
- package/dist/planmagnet/integrations/syncTypes.js.map +1 -0
- package/dist/planmagnet/integrations/useSyncProviderCapabilities.d.ts +8 -0
- package/dist/planmagnet/integrations/useSyncProviderCapabilities.d.ts.map +1 -0
- package/dist/planmagnet/integrations/useSyncProviderCapabilities.js +27 -0
- package/dist/planmagnet/integrations/useSyncProviderCapabilities.js.map +1 -0
- package/dist/planmagnet/pages/AutomationAutomationRuleDetailPagePage.d.ts.map +1 -1
- package/dist/planmagnet/pages/AutomationAutomationRuleDetailPagePage.js +85 -76
- package/dist/planmagnet/pages/AutomationAutomationRuleDetailPagePage.js.map +1 -1
- package/dist/planmagnet/pages/AutomationAutomationRulesPagePage.js +12 -12
- package/dist/planmagnet/pages/AutomationAutomationRulesPagePage.js.map +1 -1
- package/dist/planmagnet/pages/AutomationCreateAutomationRulePagePage.d.ts.map +1 -1
- package/dist/planmagnet/pages/AutomationCreateAutomationRulePagePage.js +48 -44
- package/dist/planmagnet/pages/AutomationCreateAutomationRulePagePage.js.map +1 -1
- package/dist/planmagnet/pages/IntegrationsNewSyncPagePage.d.ts +2 -0
- package/dist/planmagnet/pages/IntegrationsNewSyncPagePage.d.ts.map +1 -0
- package/dist/planmagnet/pages/IntegrationsNewSyncPagePage.js +411 -0
- package/dist/planmagnet/pages/IntegrationsNewSyncPagePage.js.map +1 -0
- package/dist/planmagnet/pages/IntegrationsSyncDetailPagePage.d.ts +2 -0
- package/dist/planmagnet/pages/IntegrationsSyncDetailPagePage.d.ts.map +1 -0
- package/dist/planmagnet/pages/IntegrationsSyncDetailPagePage.js +593 -0
- package/dist/planmagnet/pages/IntegrationsSyncDetailPagePage.js.map +1 -0
- package/dist/planmagnet/pages/IntegrationsSyncsPagePage.d.ts +2 -0
- package/dist/planmagnet/pages/IntegrationsSyncsPagePage.d.ts.map +1 -0
- package/dist/planmagnet/pages/IntegrationsSyncsPagePage.js +267 -0
- package/dist/planmagnet/pages/IntegrationsSyncsPagePage.js.map +1 -0
- package/dist/planmagnet/people/People.d.ts.map +1 -1
- package/dist/planmagnet/people/People.js +30 -17
- package/dist/planmagnet/people/People.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { usePlanMagnet as e, usePlanMagnetNavigate as t } from "../providers/PlanMagnetProvider.js";
|
|
2
|
+
import { enumLabel as n } from "../controls/WorkItemControls.js";
|
|
3
|
+
import { ProjectSelect as r } from "../controls/Pickers.js";
|
|
4
|
+
import { detailPath as i, rowLinkProps as a, stopRowActivation as o } from "../utils/rowNavigation.js";
|
|
5
|
+
import { SYNC_STATUSES as s, directionLabel as c, providerLabel as l } from "../integrations/syncTypes.js";
|
|
6
|
+
import { PauseResumeButton as u, RunNowButton as d, SyncHealthSummary as f, SyncRunResultSummary as p, SyncStatusBadge as m, TruncatedText as h } from "../controls/SyncControls.js";
|
|
7
|
+
import { useDeferredValue as g, useState as _ } from "react";
|
|
8
|
+
import { ExternalLink as v, Plug as y, Plus as b, Search as x } from "lucide-react";
|
|
9
|
+
import { gql as S } from "@apollo/client";
|
|
10
|
+
import { useQuery as C } from "@apollo/client/react";
|
|
11
|
+
import { jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
12
|
+
import { Button as E, EmptyState as D, Input as O } from "@burdenoff/fe-libs/ui";
|
|
13
|
+
//#region src/planmagnet/pages/IntegrationsSyncsPagePage.tsx
|
|
14
|
+
var k = 20, A = ["ALL", ...s], j = S`
|
|
15
|
+
query SyncsList(
|
|
16
|
+
$workspaceId: ID!
|
|
17
|
+
$filter: PlanmagnetExternalSyncFilter
|
|
18
|
+
$pagination: PlanmagnetPaginationInput
|
|
19
|
+
) {
|
|
20
|
+
planmagnetExternalSyncs(workspaceId: $workspaceId, filter: $filter, pagination: $pagination) {
|
|
21
|
+
totalCount
|
|
22
|
+
pageInfo {
|
|
23
|
+
hasNextPage
|
|
24
|
+
endCursor
|
|
25
|
+
}
|
|
26
|
+
items {
|
|
27
|
+
id
|
|
28
|
+
provider
|
|
29
|
+
direction
|
|
30
|
+
status
|
|
31
|
+
projectId
|
|
32
|
+
project {
|
|
33
|
+
id
|
|
34
|
+
name
|
|
35
|
+
}
|
|
36
|
+
externalProjectId
|
|
37
|
+
externalProjectUrl
|
|
38
|
+
conflictStrategy
|
|
39
|
+
fieldMapping
|
|
40
|
+
lastSyncedAt
|
|
41
|
+
lastSyncError
|
|
42
|
+
totalItemsSynced
|
|
43
|
+
createdAt
|
|
44
|
+
updatedAt
|
|
45
|
+
runHealth {
|
|
46
|
+
lastRunAt
|
|
47
|
+
lastStatus
|
|
48
|
+
consecutiveFailures
|
|
49
|
+
runsLast7Days
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
function M() {
|
|
56
|
+
let { workspaceId: s } = e(), S = t(), [M, N] = _(""), [P, F] = _(""), [I, L] = _("ALL"), [R, z] = _(!1), [B, V] = _({}), H = g(M.trim()), U = {
|
|
57
|
+
...H ? { search: H } : {},
|
|
58
|
+
...P ? { projectId: P } : {},
|
|
59
|
+
...I === "ALL" ? {} : { status: I }
|
|
60
|
+
}, { data: W, loading: G, error: K, fetchMore: q } = C(j, {
|
|
61
|
+
variables: {
|
|
62
|
+
workspaceId: s ?? "",
|
|
63
|
+
filter: U,
|
|
64
|
+
pagination: { first: k }
|
|
65
|
+
},
|
|
66
|
+
skip: !s,
|
|
67
|
+
fetchPolicy: "cache-and-network"
|
|
68
|
+
}), J = W?.planmagnetExternalSyncs, Y = J?.items ?? [], X = H !== "" || P !== "" || I !== "ALL", Z = !!J && Y.length === 0 && !X, Q = async () => {
|
|
69
|
+
let e = J?.pageInfo.endCursor;
|
|
70
|
+
if (e) {
|
|
71
|
+
z(!0);
|
|
72
|
+
try {
|
|
73
|
+
await q({
|
|
74
|
+
variables: { pagination: {
|
|
75
|
+
first: k,
|
|
76
|
+
after: e
|
|
77
|
+
} },
|
|
78
|
+
updateQuery: (e, { fetchMoreResult: t }) => ({ planmagnetExternalSyncs: {
|
|
79
|
+
...t.planmagnetExternalSyncs,
|
|
80
|
+
items: [...e.planmagnetExternalSyncs.items, ...t.planmagnetExternalSyncs.items]
|
|
81
|
+
} })
|
|
82
|
+
});
|
|
83
|
+
} finally {
|
|
84
|
+
z(!1);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
return /* @__PURE__ */ T("div", {
|
|
89
|
+
className: "space-y-6 p-6",
|
|
90
|
+
"data-testid": "sync-list",
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ T("div", {
|
|
93
|
+
className: "flex flex-wrap items-center justify-between gap-3",
|
|
94
|
+
children: [/* @__PURE__ */ T("div", { children: [/* @__PURE__ */ T("h1", {
|
|
95
|
+
className: "text-2xl font-semibold flex items-center gap-2",
|
|
96
|
+
children: [/* @__PURE__ */ w(y, { className: "h-5 w-5 text-primary" }), "Integrations"]
|
|
97
|
+
}), /* @__PURE__ */ w("p", {
|
|
98
|
+
className: "text-sm text-muted-foreground",
|
|
99
|
+
children: J ? `${J.totalCount} sync${J.totalCount === 1 ? "" : "s"}` : "Keep a project in step with an external issue tracker"
|
|
100
|
+
})] }), !Z && /* @__PURE__ */ T(E, {
|
|
101
|
+
size: "sm",
|
|
102
|
+
onClick: () => S("/integrations/new-sync-page"),
|
|
103
|
+
"data-testid": "sync-setup",
|
|
104
|
+
children: [/* @__PURE__ */ w(b, { className: "mr-1 h-4 w-4" }), "Set up a sync"]
|
|
105
|
+
})]
|
|
106
|
+
}),
|
|
107
|
+
/* @__PURE__ */ T("div", {
|
|
108
|
+
className: "flex flex-wrap items-center gap-3",
|
|
109
|
+
children: [/* @__PURE__ */ T("div", {
|
|
110
|
+
className: "relative w-full max-w-sm",
|
|
111
|
+
children: [/* @__PURE__ */ w(x, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ w(O, {
|
|
112
|
+
"aria-label": "Search syncs",
|
|
113
|
+
placeholder: "Search by external project",
|
|
114
|
+
className: "pl-8",
|
|
115
|
+
value: M,
|
|
116
|
+
"data-testid": "sync-list-search",
|
|
117
|
+
onChange: (e) => N(e.target.value)
|
|
118
|
+
})]
|
|
119
|
+
}), /* @__PURE__ */ w("div", {
|
|
120
|
+
className: "w-48",
|
|
121
|
+
"data-testid": "sync-list-project-filter",
|
|
122
|
+
children: /* @__PURE__ */ w(r, {
|
|
123
|
+
id: "sync-list-filter-project",
|
|
124
|
+
value: P,
|
|
125
|
+
onChange: F,
|
|
126
|
+
noneLabel: "Any project"
|
|
127
|
+
})
|
|
128
|
+
})]
|
|
129
|
+
}),
|
|
130
|
+
/* @__PURE__ */ w("div", {
|
|
131
|
+
className: "flex flex-wrap gap-1",
|
|
132
|
+
role: "group",
|
|
133
|
+
"aria-label": "Filter by status",
|
|
134
|
+
children: A.map((e) => /* @__PURE__ */ w("button", {
|
|
135
|
+
type: "button",
|
|
136
|
+
"aria-pressed": I === e,
|
|
137
|
+
"data-testid": `sync-list-status-${e}`,
|
|
138
|
+
onClick: () => L(e),
|
|
139
|
+
className: `px-3 py-1.5 text-sm rounded-md ${I === e ? "bg-primary text-primary-foreground" : "text-muted-foreground hover:bg-muted"}`,
|
|
140
|
+
children: e === "ALL" ? "All" : n(e)
|
|
141
|
+
}, e))
|
|
142
|
+
}),
|
|
143
|
+
K && /* @__PURE__ */ T("p", {
|
|
144
|
+
role: "alert",
|
|
145
|
+
className: "text-sm text-destructive",
|
|
146
|
+
children: ["Syncs could not be loaded: ", K.message]
|
|
147
|
+
}),
|
|
148
|
+
G && !W && /* @__PURE__ */ w("p", {
|
|
149
|
+
className: "text-sm text-muted-foreground",
|
|
150
|
+
children: "Loading syncs…"
|
|
151
|
+
}),
|
|
152
|
+
J && Y.length === 0 && /* @__PURE__ */ w(D, {
|
|
153
|
+
icon: /* @__PURE__ */ w(y, { className: "h-8 w-8 text-muted-foreground" }),
|
|
154
|
+
title: X ? "No syncs match" : "No syncs yet",
|
|
155
|
+
description: "A sync keeps a project's work items in step with an external tool such as GitHub Issues — created, updated, and resolved on both sides.",
|
|
156
|
+
action: Z ? /* @__PURE__ */ T(E, {
|
|
157
|
+
size: "sm",
|
|
158
|
+
onClick: () => S("/integrations/new-sync-page"),
|
|
159
|
+
"data-testid": "sync-setup-empty",
|
|
160
|
+
children: [/* @__PURE__ */ w(b, { className: "mr-1 h-4 w-4" }), "Set up a sync"]
|
|
161
|
+
}) : void 0
|
|
162
|
+
}),
|
|
163
|
+
/* @__PURE__ */ w("ul", {
|
|
164
|
+
className: "space-y-3",
|
|
165
|
+
children: Y.map((e) => {
|
|
166
|
+
let t = a(() => S(i("/integrations/sync-detail-page", e.id)), `${l(e.provider)} sync for ${e.project?.name ?? "unknown project"}`);
|
|
167
|
+
return /* @__PURE__ */ T("li", {
|
|
168
|
+
"data-testid": "sync-row",
|
|
169
|
+
...t,
|
|
170
|
+
className: `rounded-md border p-4 space-y-2 ${t.className}`,
|
|
171
|
+
children: [/* @__PURE__ */ T("div", {
|
|
172
|
+
className: "flex flex-wrap items-start justify-between gap-3",
|
|
173
|
+
children: [/* @__PURE__ */ T("div", {
|
|
174
|
+
className: "min-w-0 space-y-1",
|
|
175
|
+
children: [
|
|
176
|
+
/* @__PURE__ */ T("div", {
|
|
177
|
+
className: "flex flex-wrap items-center gap-2",
|
|
178
|
+
children: [
|
|
179
|
+
/* @__PURE__ */ w("span", {
|
|
180
|
+
className: "text-sm font-medium",
|
|
181
|
+
children: l(e.provider)
|
|
182
|
+
}),
|
|
183
|
+
/* @__PURE__ */ w(m, { status: e.status }),
|
|
184
|
+
/* @__PURE__ */ w("span", {
|
|
185
|
+
className: "text-xs text-muted-foreground",
|
|
186
|
+
children: c(e.direction)
|
|
187
|
+
})
|
|
188
|
+
]
|
|
189
|
+
}),
|
|
190
|
+
/* @__PURE__ */ T("p", {
|
|
191
|
+
className: "text-xs text-muted-foreground",
|
|
192
|
+
children: [
|
|
193
|
+
e.project?.name ?? "Unknown project",
|
|
194
|
+
" · ",
|
|
195
|
+
e.externalProjectUrl ? /* @__PURE__ */ T("a", {
|
|
196
|
+
href: e.externalProjectUrl,
|
|
197
|
+
target: "_blank",
|
|
198
|
+
rel: "noreferrer noopener",
|
|
199
|
+
className: "inline-flex items-center gap-1 text-primary hover:underline",
|
|
200
|
+
onClick: o,
|
|
201
|
+
children: [e.externalProjectId, /* @__PURE__ */ w(v, { className: "h-3 w-3" })]
|
|
202
|
+
}) : e.externalProjectId,
|
|
203
|
+
" · ",
|
|
204
|
+
e.totalItemsSynced,
|
|
205
|
+
" item",
|
|
206
|
+
e.totalItemsSynced === 1 ? "" : "s",
|
|
207
|
+
" synced"
|
|
208
|
+
]
|
|
209
|
+
}),
|
|
210
|
+
/* @__PURE__ */ w(f, { health: e.runHealth }),
|
|
211
|
+
e.lastSyncError && /* @__PURE__ */ w("p", {
|
|
212
|
+
className: "text-xs text-status-error-text",
|
|
213
|
+
"data-testid": "sync-row-last-error",
|
|
214
|
+
children: /* @__PURE__ */ w(h, {
|
|
215
|
+
text: e.lastSyncError,
|
|
216
|
+
max: 120,
|
|
217
|
+
className: "text-status-error-text"
|
|
218
|
+
})
|
|
219
|
+
})
|
|
220
|
+
]
|
|
221
|
+
}), /* @__PURE__ */ T("div", {
|
|
222
|
+
className: "flex shrink-0 flex-wrap items-center gap-2",
|
|
223
|
+
onClick: o,
|
|
224
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
225
|
+
children: [
|
|
226
|
+
/* @__PURE__ */ w(d, {
|
|
227
|
+
syncId: e.id,
|
|
228
|
+
onResult: (t) => V((n) => ({
|
|
229
|
+
...n,
|
|
230
|
+
[e.id]: t
|
|
231
|
+
}))
|
|
232
|
+
}),
|
|
233
|
+
/* @__PURE__ */ w(u, {
|
|
234
|
+
syncId: e.id,
|
|
235
|
+
status: e.status
|
|
236
|
+
}),
|
|
237
|
+
/* @__PURE__ */ w(E, {
|
|
238
|
+
size: "sm",
|
|
239
|
+
variant: "ghost",
|
|
240
|
+
onClick: () => S(i("/integrations/sync-detail-page", e.id)),
|
|
241
|
+
children: "Open"
|
|
242
|
+
})
|
|
243
|
+
]
|
|
244
|
+
})]
|
|
245
|
+
}), B[e.id] && /* @__PURE__ */ w("div", {
|
|
246
|
+
onClick: o,
|
|
247
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
248
|
+
children: /* @__PURE__ */ w(p, { result: B[e.id] })
|
|
249
|
+
})]
|
|
250
|
+
}, e.id);
|
|
251
|
+
})
|
|
252
|
+
}),
|
|
253
|
+
J?.pageInfo.hasNextPage && /* @__PURE__ */ w(E, {
|
|
254
|
+
size: "sm",
|
|
255
|
+
variant: "outline",
|
|
256
|
+
onClick: () => void Q(),
|
|
257
|
+
disabled: R,
|
|
258
|
+
"data-testid": "sync-list-more",
|
|
259
|
+
children: R ? "Loading…" : `Show more (${Y.length} of ${J.totalCount})`
|
|
260
|
+
})
|
|
261
|
+
]
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
//#endregion
|
|
265
|
+
export { M as IntegrationsSyncsPagePage };
|
|
266
|
+
|
|
267
|
+
//# sourceMappingURL=IntegrationsSyncsPagePage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IntegrationsSyncsPagePage.js","names":[],"sources":["../../../src/planmagnet/pages/IntegrationsSyncsPagePage.tsx"],"sourcesContent":["import { useDeferredValue, useState } from 'react';\nimport { gql } from '@apollo/client';\nimport { useQuery } from '@apollo/client/react';\nimport { Button, EmptyState, Input } from '@burdenoff/fe-libs/ui';\nimport { ExternalLink, Plug, Plus, Search } from 'lucide-react';\nimport { usePlanMagnet, usePlanMagnetNavigate } from '../providers/PlanMagnetProvider';\nimport { ProjectSelect } from '../controls/Pickers';\nimport { enumLabel } from '../controls/WorkItemControls';\nimport {\n PauseResumeButton,\n RunNowButton,\n SyncHealthSummary,\n SyncRunResultSummary,\n SyncStatusBadge,\n TruncatedText,\n} from '../controls/SyncControls';\nimport {\n providerLabel,\n directionLabel,\n type ExternalSyncRow,\n type SyncRunResult,\n SYNC_STATUSES,\n} from '../integrations/syncTypes';\nimport { detailPath, rowLinkProps, stopRowActivation } from '../utils/rowNavigation';\n\n/**\n * Integrations (sync) list (AUT-08/40/09): every ExternalSync of the workspace, with its live health and the\n * actions that don't need the detail page — run now, pause/resume, open. Backend\n * (planmagnetExternalSyncs/CreateExternalSync/…/ResolveSyncConflict) is real and prod-verified for GITHUB\n * (BOFF-4446, AUT-04..25) — this is the page that makes it reachable.\n */\n\nconst PAGE = 20;\nconst STATUS_FILTERS = ['ALL', ...SYNC_STATUSES] as const;\n\nconst SYNCS_LIST = gql`\n query SyncsList(\n $workspaceId: ID!\n $filter: PlanmagnetExternalSyncFilter\n $pagination: PlanmagnetPaginationInput\n ) {\n planmagnetExternalSyncs(workspaceId: $workspaceId, filter: $filter, pagination: $pagination) {\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n items {\n id\n provider\n direction\n status\n projectId\n project {\n id\n name\n }\n externalProjectId\n externalProjectUrl\n conflictStrategy\n fieldMapping\n lastSyncedAt\n lastSyncError\n totalItemsSynced\n createdAt\n updatedAt\n runHealth {\n lastRunAt\n lastStatus\n consecutiveFailures\n runsLast7Days\n }\n }\n }\n }\n`;\n\nexport function IntegrationsSyncsPagePage() {\n const { workspaceId } = usePlanMagnet();\n const navigate = usePlanMagnetNavigate();\n const [search, setSearch] = useState('');\n const [projectId, setProjectId] = useState('');\n const [status, setStatus] = useState<(typeof STATUS_FILTERS)[number]>('ALL');\n const [loadingMore, setLoadingMore] = useState(false);\n const [runResults, setRunResults] = useState<Record<string, SyncRunResult>>({});\n const term = useDeferredValue(search.trim());\n\n const filter = {\n ...(term ? { search: term } : {}),\n ...(projectId ? { projectId } : {}),\n ...(status !== 'ALL' ? { status } : {}),\n };\n\n const { data, loading, error, fetchMore } = useQuery<{\n planmagnetExternalSyncs: {\n totalCount: number;\n pageInfo: { hasNextPage: boolean; endCursor: string | null };\n items: ExternalSyncRow[];\n };\n }>(SYNCS_LIST, {\n variables: { workspaceId: workspaceId ?? '', filter, pagination: { first: PAGE } },\n skip: !workspaceId,\n fetchPolicy: 'cache-and-network',\n });\n\n const list = data?.planmagnetExternalSyncs;\n const syncs = list?.items ?? [];\n const filtersActive = term !== '' || projectId !== '' || status !== 'ALL';\n // Mirrors QualityGates/Templates pages' own gate: the EmptyState's own \"Set up a sync\" action replaces the\n // header's button only once the list is confirmed empty AND unfiltered, so the two never render together.\n const showsEmptyStateAction = !!list && syncs.length === 0 && !filtersActive;\n\n const loadMore = async () => {\n const after = list?.pageInfo.endCursor;\n if (!after) return;\n setLoadingMore(true);\n try {\n await fetchMore({\n variables: { pagination: { first: PAGE, after } },\n updateQuery: (prev, { fetchMoreResult }) => ({\n planmagnetExternalSyncs: {\n ...fetchMoreResult.planmagnetExternalSyncs,\n items: [\n ...prev.planmagnetExternalSyncs.items,\n ...fetchMoreResult.planmagnetExternalSyncs.items,\n ],\n },\n }),\n });\n } finally {\n setLoadingMore(false);\n }\n };\n\n return (\n <div className=\"space-y-6 p-6\" data-testid=\"sync-list\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div>\n <h1 className=\"text-2xl font-semibold flex items-center gap-2\">\n <Plug className=\"h-5 w-5 text-primary\" />\n Integrations\n </h1>\n <p className=\"text-sm text-muted-foreground\">\n {list\n ? `${list.totalCount} sync${list.totalCount === 1 ? '' : 's'}`\n : 'Keep a project in step with an external issue tracker'}\n </p>\n </div>\n {!showsEmptyStateAction && (\n <Button\n size=\"sm\"\n onClick={() => navigate('/integrations/new-sync-page')}\n data-testid=\"sync-setup\"\n >\n <Plus className=\"mr-1 h-4 w-4\" />\n Set up a sync\n </Button>\n )}\n </div>\n\n <div className=\"flex flex-wrap items-center gap-3\">\n <div className=\"relative w-full max-w-sm\">\n <Search className=\"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground\" />\n <Input\n aria-label=\"Search syncs\"\n placeholder=\"Search by external project\"\n className=\"pl-8\"\n value={search}\n data-testid=\"sync-list-search\"\n onChange={(e) => setSearch(e.target.value)}\n />\n </div>\n <div className=\"w-48\" data-testid=\"sync-list-project-filter\">\n <ProjectSelect\n id=\"sync-list-filter-project\"\n value={projectId}\n onChange={setProjectId}\n noneLabel=\"Any project\"\n />\n </div>\n </div>\n <div className=\"flex flex-wrap gap-1\" role=\"group\" aria-label=\"Filter by status\">\n {STATUS_FILTERS.map((s) => (\n <button\n key={s}\n type=\"button\"\n aria-pressed={status === s}\n data-testid={`sync-list-status-${s}`}\n onClick={() => setStatus(s)}\n className={`px-3 py-1.5 text-sm rounded-md ${status === s ? 'bg-primary text-primary-foreground' : 'text-muted-foreground hover:bg-muted'}`}\n >\n {s === 'ALL' ? 'All' : enumLabel(s)}\n </button>\n ))}\n </div>\n\n {error && (\n <p role=\"alert\" className=\"text-sm text-destructive\">\n Syncs could not be loaded: {error.message}\n </p>\n )}\n {/* Only before the first load: a refetch after an action must not blank the page. */}\n {loading && !data && <p className=\"text-sm text-muted-foreground\">Loading syncs…</p>}\n {list && syncs.length === 0 && (\n <EmptyState\n icon={<Plug className=\"h-8 w-8 text-muted-foreground\" />}\n title={filtersActive ? 'No syncs match' : 'No syncs yet'}\n description=\"A sync keeps a project's work items in step with an external tool such as GitHub Issues — created, updated, and resolved on both sides.\"\n action={\n showsEmptyStateAction ? (\n <Button\n size=\"sm\"\n onClick={() => navigate('/integrations/new-sync-page')}\n data-testid=\"sync-setup-empty\"\n >\n <Plus className=\"mr-1 h-4 w-4\" />\n Set up a sync\n </Button>\n ) : undefined\n }\n />\n )}\n\n <ul className=\"space-y-3\">\n {syncs.map((sync) => {\n const rowProps = rowLinkProps(\n () => navigate(detailPath('/integrations/sync-detail-page', sync.id)),\n `${providerLabel(sync.provider)} sync for ${sync.project?.name ?? 'unknown project'}`\n );\n return (\n <li\n key={sync.id}\n data-testid=\"sync-row\"\n {...rowProps}\n className={`rounded-md border p-4 space-y-2 ${rowProps.className}`}\n >\n <div className=\"flex flex-wrap items-start justify-between gap-3\">\n <div className=\"min-w-0 space-y-1\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <span className=\"text-sm font-medium\">{providerLabel(sync.provider)}</span>\n <SyncStatusBadge status={sync.status} />\n <span className=\"text-xs text-muted-foreground\">\n {directionLabel(sync.direction)}\n </span>\n </div>\n <p className=\"text-xs text-muted-foreground\">\n {sync.project?.name ?? 'Unknown project'}\n {' · '}\n {sync.externalProjectUrl ? (\n <a\n href={sync.externalProjectUrl}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n className=\"inline-flex items-center gap-1 text-primary hover:underline\"\n onClick={stopRowActivation}\n >\n {sync.externalProjectId}\n <ExternalLink className=\"h-3 w-3\" />\n </a>\n ) : (\n sync.externalProjectId\n )}\n {' · '}\n {sync.totalItemsSynced} item{sync.totalItemsSynced === 1 ? '' : 's'} synced\n </p>\n <SyncHealthSummary health={sync.runHealth} />\n {sync.lastSyncError && (\n <p className=\"text-xs text-status-error-text\" data-testid=\"sync-row-last-error\">\n <TruncatedText\n text={sync.lastSyncError}\n max={120}\n className=\"text-status-error-text\"\n />\n </p>\n )}\n </div>\n <div\n className=\"flex shrink-0 flex-wrap items-center gap-2\"\n onClick={stopRowActivation}\n onKeyDown={(e) => e.stopPropagation()}\n >\n <RunNowButton\n syncId={sync.id}\n onResult={(result) => setRunResults((prev) => ({ ...prev, [sync.id]: result }))}\n />\n <PauseResumeButton syncId={sync.id} status={sync.status} />\n <Button\n size=\"sm\"\n variant=\"ghost\"\n onClick={() => navigate(detailPath('/integrations/sync-detail-page', sync.id))}\n >\n Open\n </Button>\n </div>\n </div>\n {runResults[sync.id] && (\n <div onClick={stopRowActivation} onKeyDown={(e) => e.stopPropagation()}>\n <SyncRunResultSummary result={runResults[sync.id]} />\n </div>\n )}\n </li>\n );\n })}\n </ul>\n {list?.pageInfo.hasNextPage && (\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() => void loadMore()}\n disabled={loadingMore}\n data-testid=\"sync-list-more\"\n >\n {loadingMore ? 'Loading…' : `Show more (${syncs.length} of ${list.totalCount})`}\n </Button>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAgCA,IAAM,IAAO,IACP,IAAiB,CAAC,OAAO,GAAG,EAAc,EAE1C,IAAa,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CtB,SAAgB,IAA4B;CAC1C,IAAM,EAAE,mBAAgB,GAAe,EACjC,IAAW,GAAuB,EAClC,CAAC,GAAQ,KAAa,EAAS,GAAG,EAClC,CAAC,GAAW,KAAgB,EAAS,GAAG,EACxC,CAAC,GAAQ,KAAa,EAA0C,MAAM,EACtE,CAAC,GAAa,KAAkB,EAAS,GAAM,EAC/C,CAAC,GAAY,KAAiB,EAAwC,EAAE,CAAC,EACzE,IAAO,EAAiB,EAAO,MAAM,CAAC,EAEtC,IAAS;EACb,GAAI,IAAO,EAAE,QAAQ,GAAM,GAAG,EAAE;EAChC,GAAI,IAAY,EAAE,cAAW,GAAG,EAAE;EAClC,GAAI,MAAW,QAAqB,EAAE,GAAf,EAAE,WAAQ;EAClC,EAEK,EAAE,SAAM,YAAS,UAAO,iBAAc,EAMzC,GAAY;EACb,WAAW;GAAE,aAAa,KAAe;GAAI;GAAQ,YAAY,EAAE,OAAO,GAAM;GAAE;EAClF,MAAM,CAAC;EACP,aAAa;EACd,CAAC,EAEI,IAAO,GAAM,yBACb,IAAQ,GAAM,SAAS,EAAE,EACzB,IAAgB,MAAS,MAAM,MAAc,MAAM,MAAW,OAG9D,IAAwB,CAAC,CAAC,KAAQ,EAAM,WAAW,KAAK,CAAC,GAEzD,IAAW,YAAY;EAC3B,IAAM,IAAQ,GAAM,SAAS;AACxB,SACL;KAAe,GAAK;AACpB,OAAI;AACF,UAAM,EAAU;KACd,WAAW,EAAE,YAAY;MAAE,OAAO;MAAM;MAAO,E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
{"version":3,"file":"People.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/people/People.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,YAAY,EAElB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"People.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/people/People.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,YAAY,EAElB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AA8Cf,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,QAAQ,GACT,EAAE;IACD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,SAAS,CAAC;CACrB,2CAkBA;AAED,MAAM,WAAW,eAAe;IAC9B,sDAAsD;IACtD,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,YAAY,GAAG,IAAI,CAsBnF;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,eAAe,2CAQ5D;AAED,mFAAmF;AACnF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ/C;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,iBAAiB,2CAahE"}
|
|
@@ -2,33 +2,46 @@ import { createContext as e, useCallback as t, useContext as n, useEffect as r,
|
|
|
2
2
|
import { jsx as o } from "react/jsx-runtime";
|
|
3
3
|
import { buildActorFallback as s, useActorProfiles as c } from "@burdenoff/fe-libs/shared";
|
|
4
4
|
//#region src/planmagnet/people/People.tsx
|
|
5
|
-
var l =
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
var l = {
|
|
6
|
+
"automation:engine": "Automation",
|
|
7
|
+
"automation:scheduler": "Automation"
|
|
8
|
+
}, u = e(null);
|
|
9
|
+
function d({ workspaceId: e, children: n }) {
|
|
10
|
+
let [r, s] = a([]), l = t((e) => {
|
|
8
11
|
s((t) => t.includes(e) ? t : [...t, e]);
|
|
9
12
|
}, []), d = c(i(() => r.map((e) => ({
|
|
10
13
|
actorId: e,
|
|
11
14
|
actorType: "user"
|
|
12
15
|
})), [r]), { workspaceId: e }), f = i(() => ({
|
|
13
|
-
request:
|
|
16
|
+
request: l,
|
|
14
17
|
profiles: d
|
|
15
|
-
}), [
|
|
16
|
-
return /* @__PURE__ */ o(
|
|
18
|
+
}), [l, d]);
|
|
19
|
+
return /* @__PURE__ */ o(u.Provider, {
|
|
17
20
|
value: f,
|
|
18
21
|
children: n
|
|
19
22
|
});
|
|
20
23
|
}
|
|
21
|
-
function
|
|
22
|
-
let t = n(
|
|
24
|
+
function f(e) {
|
|
25
|
+
let t = n(u), i = t?.request, a = e ? l[e] : void 0;
|
|
23
26
|
return r(() => {
|
|
24
|
-
e && i && i(e);
|
|
25
|
-
}, [
|
|
27
|
+
e && i && !a && i(e);
|
|
28
|
+
}, [
|
|
29
|
+
e,
|
|
30
|
+
i,
|
|
31
|
+
a
|
|
32
|
+
]), e ? a ? {
|
|
33
|
+
actorId: e,
|
|
34
|
+
actorType: "service",
|
|
35
|
+
displayName: a,
|
|
36
|
+
secondaryLabel: "Automation",
|
|
37
|
+
resolved: !0
|
|
38
|
+
} : t?.profiles[e] ?? s({
|
|
26
39
|
actorId: e,
|
|
27
40
|
actorType: "user"
|
|
28
41
|
}) : null;
|
|
29
42
|
}
|
|
30
|
-
function
|
|
31
|
-
let n =
|
|
43
|
+
function p({ id: e, className: t }) {
|
|
44
|
+
let n = f(e);
|
|
32
45
|
return n ? /* @__PURE__ */ o("span", {
|
|
33
46
|
className: t,
|
|
34
47
|
title: n.email ?? void 0,
|
|
@@ -38,19 +51,19 @@ function f({ id: e, className: t }) {
|
|
|
38
51
|
children: "—"
|
|
39
52
|
});
|
|
40
53
|
}
|
|
41
|
-
function
|
|
54
|
+
function m(e) {
|
|
42
55
|
return e.trim().split(/\s+/).filter(Boolean).slice(0, 2).map((e) => e[0].toUpperCase()).join("");
|
|
43
56
|
}
|
|
44
|
-
function
|
|
45
|
-
let n =
|
|
57
|
+
function h({ id: e, className: t }) {
|
|
58
|
+
let n = f(e), r = n ? n.email ? `${n.displayName} (${n.email})` : n.displayName : void 0;
|
|
46
59
|
return /* @__PURE__ */ o("span", {
|
|
47
60
|
className: t,
|
|
48
61
|
title: r,
|
|
49
62
|
"aria-label": r,
|
|
50
|
-
children: (n?.resolved ?
|
|
63
|
+
children: (n?.resolved ? m(n.displayName) : "") || "?"
|
|
51
64
|
});
|
|
52
65
|
}
|
|
53
66
|
//#endregion
|
|
54
|
-
export {
|
|
67
|
+
export { d as PeopleProvider, h as PersonAvatar, p as PersonName, m as initialsOf, f as usePersonProfile };
|
|
55
68
|
|
|
56
69
|
//# sourceMappingURL=People.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"People.js","names":[],"sources":["../../../src/planmagnet/people/People.tsx"],"sourcesContent":["import {\n buildActorFallback,\n useActorProfiles,\n type ActorInput,\n type ActorProfile,\n type ActorProfileMap,\n} from '@burdenoff/fe-libs/shared';\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n type ReactNode,\n} from 'react';\n\n/**\n * Show people by name, not by UUID.\n *\n * Until 2026-09-24, 21 places in this MFE rendered a raw user id where a\n * person belonged — project owners, roadmap owners, assignees, the team lead.\n * fe-libs already resolves ids to workspace-member identities\n * (`useActorProfiles`, with a 5-minute cache), but it batches per CALL and\n * does not dedupe across calls, so calling it from every row would fire a\n * burst of lookups on the first render of each list.\n *\n * So there is exactly one call, here. Every `<PersonName id>` on screen\n * registers its id with the provider; ids registered during the same render\n * land in one state update, and the provider resolves them together. A\n * growing list costs one request for the NEW ids only — already-resolved ids\n * come from the fe-libs cache.\n *\n * An id that cannot be resolved (not a member of this workspace, lookup\n * failed) renders fe-libs' short fallback, \"User 1a2b3c\", rather than the full\n * UUID: still identifiable, never a wall of hex.\n */\n\ninterface PeopleContextValue {\n request: (id: string) => void;\n profiles: ActorProfileMap;\n}\n\nconst PeopleContext = createContext<PeopleContextValue | null>(null);\n\nexport function PeopleProvider({\n workspaceId,\n children,\n}: {\n workspaceId?: string;\n children: ReactNode;\n}) {\n const [ids, setIds] = useState<readonly string[]>([]);\n\n const request = useCallback((id: string) => {\n setIds((previous) => (previous.includes(id) ? previous : [...previous, id]));\n }, []);\n\n const actors = useMemo<ActorInput[]>(\n () => ids.map((actorId) => ({ actorId, actorType: 'user' })),\n [ids]\n );\n\n // No apiGatewayUrl on purpose: this MFE is handed the WORKSPACE gateway, and\n // the hook resolves the right gateways from the hostname itself.\n const profiles = useActorProfiles(actors, { workspaceId });\n\n const value = useMemo(() => ({ request, profiles }), [request, profiles]);\n return <PeopleContext.Provider value={value}>{children}</PeopleContext.Provider>;\n}\n\nexport interface PersonNameProps {\n /** A user id. Empty or missing renders an em dash. */\n id: string | null | undefined;\n className?: string;\n}\n\n/**\n * Inline text on purpose. fe-libs' `ActorIdentity` is a block (avatar plus two\n * stacked paragraphs); every place this replaces is an inline label —\n * \"Owner: …\", a table cell, a <span> inside a <p> — where a block would break\n * the layout and nest a <div> inside a <p>. The email, when known, is the\n * hover title, so two people with the same name stay distinguishable.\n */\n/**\n * Register an id with the provider and return its profile: the resolved identity, or fe-libs' short fallback\n * (\"User 1a2b3c\", `resolved: false`) until and unless it resolves. `null` for an empty id.\n */\nexport function usePersonProfile(id: string | null | undefined): ActorProfile | null {\n const context = useContext(PeopleContext);\n const request = context?.request;\n\n useEffect(() => {\n if (id && request) request(id);\n }, [id, request]);\n\n if (!id) return null;\n return context?.profiles[id] ?? buildActorFallback({ actorId: id, actorType: 'user' });\n}\n\nexport function PersonName({ id, className }: PersonNameProps) {\n const profile = usePersonProfile(id);\n if (!profile) return <span className={className ?? 'text-muted-foreground'}>—</span>;\n return (\n <span className={className} title={profile.email ?? undefined}>\n {profile.displayName}\n </span>\n );\n}\n\n/** Up to two initials from a display name (\"Ada Lovelace\" → \"AL\", \"ada\" → \"A\"). */\nexport function initialsOf(name: string): string {\n return name\n .trim()\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, 2)\n .map((word) => word[0]!.toUpperCase())\n .join('');\n}\n\nexport interface PersonAvatarProps {\n id: string | null | undefined;\n className?: string;\n}\n\n/**\n * An initials bubble for a user id. Initials come from the RESOLVED name; until the id resolves (or when it never\n * does) the bubble shows a neutral \"?\" rather than letters cut from the UUID, which matched nobody (BOFF-7977,\n * BOFF-8000). The tooltip is the name, plus the email when known.\n */\nexport function PersonAvatar({ id, className }: PersonAvatarProps) {\n const profile = usePersonProfile(id);\n const label = profile\n ? profile.email\n ? `${profile.displayName} (${profile.email})`\n : profile.displayName\n : undefined;\n const initials = profile?.resolved ? initialsOf(profile.displayName) : '';\n return (\n <span className={className} title={label} aria-label={label}>\n {initials || '?'}\n </span>\n );\n}\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"People.js","names":[],"sources":["../../../src/planmagnet/people/People.tsx"],"sourcesContent":["import {\n buildActorFallback,\n useActorProfiles,\n type ActorInput,\n type ActorProfile,\n type ActorProfileMap,\n} from '@burdenoff/fe-libs/shared';\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n type ReactNode,\n} from 'react';\n\n/**\n * Show people by name, not by UUID.\n *\n * Until 2026-09-24, 21 places in this MFE rendered a raw user id where a\n * person belonged — project owners, roadmap owners, assignees, the team lead.\n * fe-libs already resolves ids to workspace-member identities\n * (`useActorProfiles`, with a 5-minute cache), but it batches per CALL and\n * does not dedupe across calls, so calling it from every row would fire a\n * burst of lookups on the first render of each list.\n *\n * So there is exactly one call, here. Every `<PersonName id>` on screen\n * registers its id with the provider; ids registered during the same render\n * land in one state update, and the provider resolves them together. A\n * growing list costs one request for the NEW ids only — already-resolved ids\n * come from the fe-libs cache.\n *\n * An id that cannot be resolved (not a member of this workspace, lookup\n * failed) renders fe-libs' short fallback, \"User 1a2b3c\", rather than the full\n * UUID: still identifiable, never a wall of hex.\n */\n\ninterface PeopleContextValue {\n request: (id: string) => void;\n profiles: ActorProfileMap;\n}\n\n/**\n * The automation engine's own actor identities (BOFF-8047 follow-up) — never a real workspace member's id, so\n * they are mapped explicitly rather than sent through `useActorProfiles` (which would only ever resolve them to\n * its generic \"not a member\" fallback). Sourced directly from wspace-planmagnet-svc, not guessed:\n * - `automation-engine.ts`'s `AUTOMATION_COMMENT_AUTHOR_ID` (`'automation:engine'`) — the fixed author of every\n * comment a POST_COMMENT action posts, regardless of which trigger or actor caused the run.\n * - `automation-scheduler.ts`'s `AUTOMATION_SCHEDULER_ACTOR_ID` (`'automation:scheduler'`) — the actor behind a\n * SCHEDULE-triggered run (threaded through as `updatedBy` on that run's other actions).\n * No real actor id can ever collide with the `automation:` prefix (workspace-member ids are uuids) — see that\n * constant's own doc comment in the engine.\n */\nconst AUTOMATION_ACTOR_NAMES: Record<string, string> = {\n 'automation:engine': 'Automation',\n 'automation:scheduler': 'Automation',\n};\n\nconst PeopleContext = createContext<PeopleContextValue | null>(null);\n\nexport function PeopleProvider({\n workspaceId,\n children,\n}: {\n workspaceId?: string;\n children: ReactNode;\n}) {\n const [ids, setIds] = useState<readonly string[]>([]);\n\n const request = useCallback((id: string) => {\n setIds((previous) => (previous.includes(id) ? previous : [...previous, id]));\n }, []);\n\n const actors = useMemo<ActorInput[]>(\n () => ids.map((actorId) => ({ actorId, actorType: 'user' })),\n [ids]\n );\n\n // No apiGatewayUrl on purpose: this MFE is handed the WORKSPACE gateway, and\n // the hook resolves the right gateways from the hostname itself.\n const profiles = useActorProfiles(actors, { workspaceId });\n\n const value = useMemo(() => ({ request, profiles }), [request, profiles]);\n return <PeopleContext.Provider value={value}>{children}</PeopleContext.Provider>;\n}\n\nexport interface PersonNameProps {\n /** A user id. Empty or missing renders an em dash. */\n id: string | null | undefined;\n className?: string;\n}\n\n/**\n * Inline text on purpose. fe-libs' `ActorIdentity` is a block (avatar plus two\n * stacked paragraphs); every place this replaces is an inline label —\n * \"Owner: …\", a table cell, a <span> inside a <p> — where a block would break\n * the layout and nest a <div> inside a <p>. The email, when known, is the\n * hover title, so two people with the same name stay distinguishable.\n */\n/**\n * Register an id with the provider and return its profile: the resolved identity, or fe-libs' short fallback\n * (\"User 1a2b3c\", `resolved: false`) until and unless it resolves. `null` for an empty id.\n */\nexport function usePersonProfile(id: string | null | undefined): ActorProfile | null {\n const context = useContext(PeopleContext);\n const request = context?.request;\n const automationName = id ? AUTOMATION_ACTOR_NAMES[id] : undefined;\n\n useEffect(() => {\n // An automation identity is never a real workspace member — registering it with the provider would only\n // ever come back as the generic \"not a member\" fallback, and would cost a wasted slot in every batch lookup.\n if (id && request && !automationName) request(id);\n }, [id, request, automationName]);\n\n if (!id) return null;\n if (automationName) {\n return {\n actorId: id,\n actorType: 'service',\n displayName: automationName,\n secondaryLabel: 'Automation',\n resolved: true,\n };\n }\n return context?.profiles[id] ?? buildActorFallback({ actorId: id, actorType: 'user' });\n}\n\nexport function PersonName({ id, className }: PersonNameProps) {\n const profile = usePersonProfile(id);\n if (!profile) return <span className={className ?? 'text-muted-foreground'}>—</span>;\n return (\n <span className={className} title={profile.email ?? undefined}>\n {profile.displayName}\n </span>\n );\n}\n\n/** Up to two initials from a display name (\"Ada Lovelace\" → \"AL\", \"ada\" → \"A\"). */\nexport function initialsOf(name: string): string {\n return name\n .trim()\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, 2)\n .map((word) => word[0]!.toUpperCase())\n .join('');\n}\n\nexport interface PersonAvatarProps {\n id: string | null | undefined;\n className?: string;\n}\n\n/**\n * An initials bubble for a user id. Initials come from the RESOLVED name; until the id resolves (or when it never\n * does) the bubble shows a neutral \"?\" rather than letters cut from the UUID, which matched nobody (BOFF-7977,\n * BOFF-8000). The tooltip is the name, plus the email when known.\n */\nexport function PersonAvatar({ id, className }: PersonAvatarProps) {\n const profile = usePersonProfile(id);\n const label = profile\n ? profile.email\n ? `${profile.displayName} (${profile.email})`\n : profile.displayName\n : undefined;\n const initials = profile?.resolved ? initialsOf(profile.displayName) : '';\n return (\n <span className={className} title={label} aria-label={label}>\n {initials || '?'}\n </span>\n );\n}\n"],"mappings":";;;;AAsDA,IAAM,IAAiD;CACrD,qBAAqB;CACrB,wBAAwB;CACzB,EAEK,IAAgB,EAAyC,KAAK;AAEpE,SAAgB,EAAe,EAC7B,gBACA,eAIC;CACD,IAAM,CAAC,GAAK,KAAU,EAA4B,EAAE,CAAC,EAE/C,IAAU,GAAa,MAAe;AAC1C,KAAQ,MAAc,EAAS,SAAS,EAAG,GAAG,IAAW,CAAC,GAAG,GAAU,EAAG,CAAE;IAC3E,EAAE,CAAC,EASA,IAAW,EAPF,QACP,EAAI,KAAK,OAAa;EAAE;EAAS,WAAW;EAAQ,EAAE,EAC5D,CAAC,EAAI,CACN,EAIyC,EAAE,gBAAa,CAAC,EAEpD,IAAQ,SAAe;EAAE;EAAS;EAAU,GAAG,CAAC,GAAS,EAAS,CAAC;AACzE,QAAO,kBAAC,EAAc,UAAf;EAA+B;EAAQ;EAAkC,CAAA;;AAoBlF,SAAgB,EAAiB,GAAoD;CACnF,IAAM,IAAU,EAAW,EAAc,EACnC,IAAU,GAAS,SACnB,IAAiB,IAAK,EAAuB,KAAM,KAAA;AAkBzD,QAhBA,QAAgB;AAGd,EAAI,KAAM,KAAW,CAAC,KAAgB,EAAQ,EAAG;IAChD;EAAC;EAAI;EAAS;EAAe,CAAC,EAE5B,IACD,IACK;EACL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