@burdenoff/microfe-support 2026.819.5 → 2026.824.1

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.
@@ -1,31 +1,31 @@
1
- import { Button as e, Checkbox as t, Dialog as n, DialogContent as r, DialogDescription as ee, DialogFooter as i, DialogHeader as te, DialogTitle as ne, Label as a, Select as re, SelectContent as ie, SelectItem as ae, SelectTrigger as oe, SelectValue as se, Textarea as o } from "../ui.js";
2
- import { BulkEnsureInterviewRoundsDocument as s, BulkRandomizeAndSendAssignmentDocument as c, BulkSendRoundMessageDocument as l, useGetJobPostingQuery as ce } from "../../../generated/global-operations.js";
3
- import { InterviewRoundType as u } from "../../../generated/global-types.js";
4
- import { nativeNotify as le } from "../../../utils/nativeBridge.js";
5
- import { aggregateCandidateEmailResult as d, aggregateEnsureRoundResult as f, assertCompleteCandidateEmailChunkResult as p, assertCompleteEnsureRoundChunkResult as ue, createEmptyCandidateEmailAggregate as m, createEmptyEnsureRoundAggregate as h, executeSequentialCandidateChunks as de, getBulkOperationNotificationSeverity as fe, getCandidateSelectionCount as pe, getSelectedCandidateIds as g, hasCandidateEmailType as _, resolveExactCandidateRounds as v } from "../../utils/bulkCandidateOperations.js";
6
- import { BulkCandidateActionGuidance as y } from "./BulkCandidateActionGuidance.js";
7
- import { BulkOperationProgress as me, CandidateEmailResultDetails as he, EnsureRoundResultDetails as b, StoppedBulkOperationNotice as ge } from "./BulkOperationFeedback.js";
8
- import { useEffect as _e, useMemo as ve, useState as x } from "react";
9
- import { AlertCircle as ye, Loader2 as S, Send as C, UserPlus as be } from "lucide-react";
10
- import { graphqlFetch as w } from "@burdenoff/fe-libs/shared/graphql/fetch";
11
- import { jsx as T, jsxs as E } from "react/jsx-runtime";
12
- import { useApolloClient as xe } from "@apollo/client/react";
13
- import { print as D } from "graphql";
1
+ import { Button as e, Checkbox as t, Dialog as n, DialogContent as r, DialogDescription as ee, DialogFooter as i, DialogHeader as te, DialogTitle as ne, Label as a, Select as o, SelectContent as s, SelectItem as re, SelectTrigger as c, SelectValue as ie, Textarea as l } from "../ui.js";
2
+ import { BulkEnsureInterviewRoundsDocument as u, BulkRandomizeAndSendAssignmentDocument as d, BulkSendRoundMessageDocument as f, NotifyDuplicateApplicantsDocument as p, useGetJobPostingQuery as m } from "../../../generated/global-operations.js";
3
+ import { InterviewRoundType as h } from "../../../generated/global-types.js";
4
+ import { nativeNotify as ae } from "../../../utils/nativeBridge.js";
5
+ import { aggregateCandidateEmailResult as g, aggregateDuplicateNoticeResult as oe, aggregateEnsureRoundResult as _, assertCompleteCandidateEmailChunkResult as v, assertCompleteEnsureRoundChunkResult as y, createEmptyCandidateEmailAggregate as b, createEmptyDuplicateNoticeAggregate as x, createEmptyEnsureRoundAggregate as S, executeSequentialCandidateChunks as se, getBulkOperationNotificationSeverity as ce, getCandidateSelectionCount as le, getSelectedCandidateIds as C, hasCandidateEmailType as w, resolveExactCandidateRounds as T } from "../../utils/bulkCandidateOperations.js";
6
+ import { BulkCandidateActionGuidance as E } from "./BulkCandidateActionGuidance.js";
7
+ import { BulkOperationProgress as ue, CandidateEmailResultDetails as D, DuplicateNoticeResultDetails as O, EnsureRoundResultDetails as k, StoppedBulkOperationNotice as de } from "./BulkOperationFeedback.js";
8
+ import { useEffect as fe, useMemo as pe, useState as A } from "react";
9
+ import { AlertCircle as me, Loader2 as j, Mail as M, Send as N, UserPlus as he } from "lucide-react";
10
+ import { graphqlFetch as P } from "@burdenoff/fe-libs/shared/graphql/fetch";
11
+ import { jsx as F, jsxs as I } from "react/jsx-runtime";
12
+ import { useApolloClient as ge } from "@apollo/client/react";
13
+ import { print as L } from "graphql";
14
14
  //#region src/support/components/careers/BulkCandidateDialogs.tsx
15
- function O(e) {
16
- return e.isAssignmentRound || e.roundType === u.TakeHome;
15
+ function R(e) {
16
+ return e.isAssignmentRound || e.roundType === h.TakeHome;
17
17
  }
18
- var Se = {
18
+ var _e = {
19
19
  message: "ROUND_MESSAGE",
20
20
  assignment: "ASSIGNMENT"
21
21
  };
22
- function Ce(e) {
22
+ function ve(e) {
23
23
  return e instanceof Error ? e.message : "The request failed without an error message.";
24
24
  }
25
- async function k(e, t, n) {
26
- let r = await w({
25
+ async function z(e, t, n) {
26
+ let r = await P({
27
27
  gateway: "global",
28
- query: D(e),
28
+ query: L(e),
29
29
  variables: t,
30
30
  operationName: n,
31
31
  skipAuthRetry: !0
@@ -34,39 +34,39 @@ async function k(e, t, n) {
34
34
  if (!r.data) throw Error(`${n} returned no data.`);
35
35
  return r.data;
36
36
  }
37
- function we(e, t) {
38
- let n = g(t);
37
+ function ye(e, t) {
38
+ let n = C(t);
39
39
  return e.filter((e) => n.has(e.id));
40
40
  }
41
- function A({ mode: s, open: u, onClose: f, onOpenAddRound: ue, targets: h, selection: g, jobPostingId: b, previewLoading: w, previewError: D }) {
42
- let A = xe(), [j, M] = x(""), [N, P] = x(""), [F, I] = x(!1), [L, R] = x(null), [Te, z] = x(m), [B, V] = x(null), [H, U] = x(!1), [W, G] = x(!1), { data: Ee, loading: K, error: De } = ce({
43
- variables: { id: b },
44
- skip: !u || !b,
41
+ function B({ mode: u, open: p, onClose: h, onOpenAddRound: oe, targets: _, selection: y, jobPostingId: x, previewLoading: S, previewError: C }) {
42
+ let O = ge(), [k, M] = A(""), [P, L] = A(""), [B, V] = A(!1), [H, U] = A(null), [be, W] = A(b), [G, K] = A(null), [xe, q] = A(!1), [J, Se] = A(!1), { data: Ce, loading: we, error: Te } = m({
43
+ variables: { id: x },
44
+ skip: !p || !x,
45
45
  fetchPolicy: "network-only"
46
46
  });
47
- _e(() => {
48
- u && (M(""), P(""), I(!1), R(null), z(m()), V(null), U(!1), G(!1));
49
- }, [u, s]);
50
- let q = ve(() => we(h, g), [g, h]), Oe = pe(g), J = q.length === Oe, ke = Ee?.jobPosting?.rounds ?? [], Ae = ke.filter((e) => s !== "assignment" || O(e)), Y = ke.find((e) => e.id === j), X = Y ? v(q, Y.id) : {
47
+ fe(() => {
48
+ p && (M(""), L(""), V(!1), U(null), W(b()), K(null), q(!1), Se(!1));
49
+ }, [p, u]);
50
+ let Ee = pe(() => ye(_, y), [y, _]), De = le(y), Oe = Ee.length === De, ke = Ce?.jobPosting?.rounds ?? [], Ae = ke.filter((e) => u !== "assignment" || R(e)), Y = ke.find((e) => e.id === k), X = Y ? T(Ee, Y.id) : {
51
51
  pairs: [],
52
52
  unresolved: []
53
- }, je = X.unresolved.filter((e) => e.reason === "MISSING").length, Me = X.unresolved.filter((e) => e.reason === "AMBIGUOUS").length, Ne = Se[s], Pe = X.pairs.filter(({ round: e }) => _(e, Ne)).length, Z = X.pairs.filter(({ round: e }) => F || !_(e, Ne)).length, Fe = q.some((e) => e.jobPostingId !== b), Q = D;
54
- !Q && De ? Q = "Could not load the posting rounds. Nothing will be sent." : !Q && !w && !J ? Q = "Some selected candidate details are unavailable. Refresh the selection before sending." : !Q && Fe ? Q = "Some selected candidates do not belong to the filtered posting." : !Q && j && !K && !Y ? Q = "The selected round is no longer available. Choose another round." : !Q && Me > 0 && (Q = `${Me} selected candidate${Me === 1 ? " has" : "s have"} multiple concrete rounds for this configuration. Nothing will be sent until the data is corrected.`);
53
+ }, je = X.unresolved.filter((e) => e.reason === "MISSING").length, Me = X.unresolved.filter((e) => e.reason === "AMBIGUOUS").length, Ne = _e[u], Pe = X.pairs.filter(({ round: e }) => w(e, Ne)).length, Z = X.pairs.filter(({ round: e }) => B || !w(e, Ne)).length, Fe = Ee.some((e) => e.jobPostingId !== x), Q = C;
54
+ !Q && Te ? Q = "Could not load the posting rounds. Nothing will be sent." : !Q && !S && !Oe ? Q = "Some selected candidate details are unavailable. Refresh the selection before sending." : !Q && Fe ? Q = "Some selected candidates do not belong to the filtered posting." : !Q && k && !we && !Y ? Q = "The selected round is no longer available. Choose another round." : !Q && Me > 0 && (Q = `${Me} selected candidate${Me === 1 ? " has" : "s have"} multiple concrete rounds for this configuration. Nothing will be sent until the data is corrected.`);
55
55
  let Ie = async () => {
56
- if (W || H || w || K || Q || !J || !Y || X.pairs.length === 0 || Z === 0 || s === "message" && !N.trim()) return;
57
- G(!0), U(!0), V(null), z(m());
58
- let e = await de({
56
+ if (J || xe || S || we || Q || !Oe || !Y || X.pairs.length === 0 || Z === 0 || u === "message" && !P.trim()) return;
57
+ Se(!0), q(!0), K(null), W(b());
58
+ let e = await se({
59
59
  items: X.pairs.map(({ applicationId: e, roundId: t }) => ({
60
60
  applicationId: e,
61
61
  roundId: t
62
62
  })),
63
- initialAggregate: m(),
64
- onProgress: R,
63
+ initialAggregate: b(),
64
+ onProgress: U,
65
65
  executeChunk: async (e) => {
66
- if (s === "assignment") {
67
- let t = (await k(c, { input: {
66
+ if (u === "assignment") {
67
+ let t = (await z(d, { input: {
68
68
  items: [...e],
69
- force: F
69
+ force: B
70
70
  } }, "BulkRandomizeAndSendAssignment")).bulkRandomizeAndSendAssignment;
71
71
  if (!t) throw Error("The assignment request returned no result.");
72
72
  let n = {
@@ -86,12 +86,12 @@ function A({ mode: s, open: u, onClose: f, onOpenAddRound: ue, targets: h, selec
86
86
  message: e.message
87
87
  }))
88
88
  };
89
- return p(e, n), n;
89
+ return v(e, n), n;
90
90
  }
91
- let t = (await k(l, { input: {
91
+ let t = (await z(f, { input: {
92
92
  items: [...e],
93
- message: N.trim(),
94
- force: F
93
+ message: P.trim(),
94
+ force: B
95
95
  } }, "BulkSendRoundMessage")).bulkSendRoundMessage;
96
96
  if (!t) throw Error("The message request returned no result.");
97
97
  let n = {
@@ -111,80 +111,80 @@ function A({ mode: s, open: u, onClose: f, onOpenAddRound: ue, targets: h, selec
111
111
  message: e.message
112
112
  }))
113
113
  };
114
- return p(e, n), n;
114
+ return v(e, n), n;
115
115
  },
116
- mergeResult: d
116
+ mergeResult: g
117
117
  });
118
- z(e.aggregate), e.error && V({
118
+ W(e.aggregate), e.error && K({
119
119
  knownCompleted: e.processedItems.length,
120
120
  ambiguous: e.ambiguousItems.length,
121
121
  notStarted: e.notStartedItems.length,
122
- message: Ce(e.error)
123
- }), le(fe({
122
+ message: ve(e.error)
123
+ }), ae(ce({
124
124
  succeeded: e.aggregate.succeeded.length,
125
125
  skipped: e.aggregate.skipped.length,
126
126
  failed: e.aggregate.failed.length,
127
127
  ambiguous: !!e.error
128
- })), G(!1), A.refetchQueries({ include: ["GetJobApplications", "GetJobApplicationInterviewRounds"] }).catch(() => void 0);
129
- }, $ = w || K;
130
- return /* @__PURE__ */ T(n, {
131
- open: u,
128
+ })), Se(!1), O.refetchQueries({ include: ["GetJobApplications", "GetJobApplicationInterviewRounds"] }).catch(() => void 0);
129
+ }, $ = S || we;
130
+ return /* @__PURE__ */ F(n, {
131
+ open: p,
132
132
  onOpenChange: (e) => {
133
- !e && !W && f();
133
+ !e && !J && h();
134
134
  },
135
- children: /* @__PURE__ */ E(r, {
135
+ children: /* @__PURE__ */ I(r, {
136
136
  className: "sm:max-w-xl max-h-[90vh] overflow-y-auto",
137
137
  children: [
138
- /* @__PURE__ */ E(te, { children: [/* @__PURE__ */ T(ne, { children: s === "assignment" ? "Assign & Email Random Take-Home" : "Send Message" }), /* @__PURE__ */ T(ee, { children: "Choose one configured round for the candidates in the filtered posting." })] }),
139
- /* @__PURE__ */ T(y, {
140
- action: s,
138
+ /* @__PURE__ */ I(te, { children: [/* @__PURE__ */ F(ne, { children: u === "assignment" ? "Assign & Email Random Take-Home" : "Send Message" }), /* @__PURE__ */ F(ee, { children: "Choose one configured round for the candidates in the filtered posting." })] }),
139
+ /* @__PURE__ */ F(E, {
140
+ action: u,
141
141
  unresolvedCount: je
142
142
  }),
143
- H ? /* @__PURE__ */ E("div", {
143
+ xe ? /* @__PURE__ */ I("div", {
144
144
  className: "space-y-4",
145
145
  children: [
146
- L ? /* @__PURE__ */ T(me, { progress: L }) : null,
147
- /* @__PURE__ */ T(he, { result: Te }),
148
- B ? /* @__PURE__ */ T(ge, { details: B }) : null,
149
- /* @__PURE__ */ T(i, { children: /* @__PURE__ */ T(e, {
150
- onClick: f,
151
- disabled: W,
146
+ H ? /* @__PURE__ */ F(ue, { progress: H }) : null,
147
+ /* @__PURE__ */ F(D, { result: be }),
148
+ G ? /* @__PURE__ */ F(de, { details: G }) : null,
149
+ /* @__PURE__ */ F(i, { children: /* @__PURE__ */ F(e, {
150
+ onClick: h,
151
+ disabled: J,
152
152
  children: "Done"
153
153
  }) })
154
154
  ]
155
- }) : /* @__PURE__ */ E("div", {
155
+ }) : /* @__PURE__ */ I("div", {
156
156
  className: "space-y-4",
157
157
  children: [
158
- $ ? /* @__PURE__ */ E("div", {
158
+ $ ? /* @__PURE__ */ I("div", {
159
159
  className: "flex items-center gap-2 text-sm text-text-secondary",
160
- children: [/* @__PURE__ */ T(S, {
160
+ children: [/* @__PURE__ */ F(j, {
161
161
  size: 14,
162
162
  className: "animate-spin"
163
163
  }), "Refreshing candidates and configured rounds…"]
164
164
  }) : null,
165
- Q ? /* @__PURE__ */ E("div", {
165
+ Q ? /* @__PURE__ */ I("div", {
166
166
  className: "flex items-start gap-2 text-sm text-status-error-text",
167
167
  role: "alert",
168
- children: [/* @__PURE__ */ T(ye, {
168
+ children: [/* @__PURE__ */ F(me, {
169
169
  size: 14,
170
170
  className: "mt-0.5 shrink-0"
171
- }), /* @__PURE__ */ T("span", { children: Q })]
171
+ }), /* @__PURE__ */ F("span", { children: Q })]
172
172
  }) : null,
173
- /* @__PURE__ */ E("div", {
173
+ /* @__PURE__ */ I("div", {
174
174
  className: "space-y-1.5",
175
175
  children: [
176
- /* @__PURE__ */ T(a, {
176
+ /* @__PURE__ */ F(a, {
177
177
  htmlFor: "bulk-round-config",
178
178
  children: "Target round"
179
179
  }),
180
- /* @__PURE__ */ E(re, {
181
- value: j,
180
+ /* @__PURE__ */ I(o, {
181
+ value: k,
182
182
  onValueChange: M,
183
183
  disabled: $ || !!Q,
184
- children: [/* @__PURE__ */ T(oe, {
184
+ children: [/* @__PURE__ */ F(c, {
185
185
  id: "bulk-round-config",
186
- children: /* @__PURE__ */ T(se, { placeholder: "Select a round" })
187
- }), /* @__PURE__ */ T(ie, { children: Ae.map((e) => /* @__PURE__ */ E(ae, {
186
+ children: /* @__PURE__ */ F(ie, { placeholder: "Select a round" })
187
+ }), /* @__PURE__ */ F(s, { children: Ae.map((e) => /* @__PURE__ */ I(re, {
188
188
  value: e.id,
189
189
  children: [
190
190
  "Round ",
@@ -194,35 +194,35 @@ function A({ mode: s, open: u, onClose: f, onOpenAddRound: ue, targets: h, selec
194
194
  ]
195
195
  }, e.id)) })]
196
196
  }),
197
- Ae.length === 0 && !$ && !Q ? /* @__PURE__ */ T("p", {
197
+ Ae.length === 0 && !$ && !Q ? /* @__PURE__ */ F("p", {
198
198
  className: "text-xs text-status-warning-text",
199
- children: s === "assignment" ? "This posting has no configured assignment round." : "This posting has no configured interview rounds."
199
+ children: u === "assignment" ? "This posting has no configured assignment round." : "This posting has no configured interview rounds."
200
200
  }) : null
201
201
  ]
202
202
  }),
203
- s === "message" ? /* @__PURE__ */ E("div", {
203
+ u === "message" ? /* @__PURE__ */ I("div", {
204
204
  className: "space-y-1.5",
205
- children: [/* @__PURE__ */ T(a, {
205
+ children: [/* @__PURE__ */ F(a, {
206
206
  htmlFor: "bulk-message",
207
207
  children: "Free-text message"
208
- }), /* @__PURE__ */ T(o, {
208
+ }), /* @__PURE__ */ F(l, {
209
209
  id: "bulk-message",
210
- value: N,
211
- onChange: (e) => P(e.target.value),
210
+ value: P,
211
+ onChange: (e) => L(e.target.value),
212
212
  placeholder: "Write the message sent to each candidate",
213
213
  rows: 5
214
214
  })]
215
215
  }) : null,
216
- j && !$ && !Q ? /* @__PURE__ */ E("div", {
216
+ k && !$ && !Q ? /* @__PURE__ */ I("div", {
217
217
  className: "space-y-2 rounded-md border border-border-seam bg-bg-sunken/30 p-3 text-xs text-text-secondary",
218
218
  children: [
219
- /* @__PURE__ */ T("p", {
219
+ /* @__PURE__ */ F("p", {
220
220
  className: "font-medium text-text-primary",
221
221
  children: "Preview"
222
222
  }),
223
- /* @__PURE__ */ E("p", { children: [
223
+ /* @__PURE__ */ I("p", { children: [
224
224
  "Will send to ",
225
- /* @__PURE__ */ T("span", {
225
+ /* @__PURE__ */ F("span", {
226
226
  className: "font-semibold",
227
227
  children: Z
228
228
  }),
@@ -230,41 +230,41 @@ function A({ mode: s, open: u, onClose: f, onOpenAddRound: ue, targets: h, selec
230
230
  Z === 1 ? "" : "s",
231
231
  "."
232
232
  ] }),
233
- Pe > 0 ? /* @__PURE__ */ E("p", { children: [
233
+ Pe > 0 ? /* @__PURE__ */ I("p", { children: [
234
234
  Pe,
235
235
  " already received this email type",
236
236
  " ",
237
- F ? "(force will send again)" : "(the backend will skip them)",
237
+ B ? "(force will send again)" : "(the backend will skip them)",
238
238
  "."
239
239
  ] }) : null,
240
- je > 0 ? /* @__PURE__ */ E(e, {
240
+ je > 0 ? /* @__PURE__ */ I(e, {
241
241
  type: "button",
242
242
  size: "sm",
243
243
  variant: "outline",
244
- onClick: ue,
245
- children: [/* @__PURE__ */ T(be, { size: 14 }), "Add Selected to Round"]
244
+ onClick: oe,
245
+ children: [/* @__PURE__ */ F(he, { size: 14 }), "Add Selected to Round"]
246
246
  }) : null,
247
- /* @__PURE__ */ E("label", {
247
+ /* @__PURE__ */ I("label", {
248
248
  className: "flex cursor-pointer items-start gap-2 pt-1",
249
- children: [/* @__PURE__ */ T(t, {
250
- checked: F,
251
- onCheckedChange: (e) => I(e === !0)
252
- }), /* @__PURE__ */ T("span", { children: "Force resend to candidates with a prior email. Force sends are non-idempotent and are never retried automatically." })]
249
+ children: [/* @__PURE__ */ F(t, {
250
+ checked: B,
251
+ onCheckedChange: (e) => V(e === !0)
252
+ }), /* @__PURE__ */ F("span", { children: "Force resend to candidates with a prior email. Force sends are non-idempotent and are never retried automatically." })]
253
253
  })
254
254
  ]
255
255
  }) : null,
256
- /* @__PURE__ */ E(i, { children: [/* @__PURE__ */ T(e, {
256
+ /* @__PURE__ */ I(i, { children: [/* @__PURE__ */ F(e, {
257
257
  variant: "outline",
258
- onClick: f,
259
- disabled: W,
258
+ onClick: h,
259
+ disabled: J,
260
260
  children: "Cancel"
261
- }), /* @__PURE__ */ E(e, {
261
+ }), /* @__PURE__ */ I(e, {
262
262
  onClick: () => void Ie(),
263
- disabled: W || $ || !!Q || !J || !j || X.pairs.length === 0 || Z === 0 || s === "message" && !N.trim(),
264
- children: [W ? /* @__PURE__ */ T(S, {
263
+ disabled: J || $ || !!Q || !Oe || !k || X.pairs.length === 0 || Z === 0 || u === "message" && !P.trim(),
264
+ children: [J ? /* @__PURE__ */ F(j, {
265
265
  size: 16,
266
266
  className: "mr-2 animate-spin"
267
- }) : /* @__PURE__ */ T(C, { size: 16 }), W ? "Sending…" : "Send"]
267
+ }) : /* @__PURE__ */ F(N, { size: 16 }), J ? "Sending…" : "Send"]
268
268
  })] })
269
269
  ]
270
270
  })
@@ -272,28 +272,28 @@ function A({ mode: s, open: u, onClose: f, onOpenAddRound: ue, targets: h, selec
272
272
  })
273
273
  });
274
274
  }
275
- function j({ open: t, onClose: o, targets: c, selection: l, jobPostingId: u, previewLoading: d, previewError: p }) {
276
- let m = xe(), [g, _] = x(""), [v, y] = x(null), [he, C] = x(h), [w, D] = x(null), [O, Se] = x(!1), [A, j] = x(!1), { data: M, loading: N, error: P } = ce({
277
- variables: { id: u },
278
- skip: !t || !u,
275
+ function V({ open: t, onClose: l, targets: d, selection: f, jobPostingId: p, previewLoading: h, previewError: g }) {
276
+ let oe = ge(), [v, b] = A(""), [x, C] = A(null), [w, T] = A(S), [E, D] = A(null), [O, M] = A(!1), [N, P] = A(!1), { data: L, loading: R, error: _e } = m({
277
+ variables: { id: p },
278
+ skip: !t || !p,
279
279
  fetchPolicy: "network-only"
280
280
  });
281
- _e(() => {
282
- t && (_(""), y(null), C(h()), D(null), Se(!1), j(!1));
281
+ fe(() => {
282
+ t && (b(""), C(null), T(S()), D(null), M(!1), P(!1));
283
283
  }, [t]);
284
- let F = ve(() => we(c, l), [l, c]), I = pe(l), L = F.length === I, R = F.map((e) => e.id), Te = F.some((e) => e.jobPostingId !== u), z = M?.jobPosting?.rounds ?? [], B = z.find((e) => e.id === g), V = p;
285
- !V && P ? V = "Could not load the posting rounds. Nothing will be changed." : !V && !d && !L ? V = "Some selected candidate details are unavailable. Refresh the selection before adding rounds." : !V && Te ? V = "Some selected candidates do not belong to the filtered posting." : !V && g && !N && !B && (V = "The selected round is no longer available. Choose another round.");
286
- let H = async () => {
287
- if (A || O || d || N || V || !L || !B || R.length === 0) return;
288
- j(!0), Se(!0), D(null), C(h());
289
- let e = await de({
290
- items: R,
291
- initialAggregate: h(),
292
- onProgress: y,
284
+ let B = pe(() => ye(d, f), [f, d]), V = le(f), H = B.length === V, U = B.map((e) => e.id), be = B.some((e) => e.jobPostingId !== p), W = L?.jobPosting?.rounds ?? [], G = W.find((e) => e.id === v), K = g;
285
+ !K && _e ? K = "Could not load the posting rounds. Nothing will be changed." : !K && !h && !H ? K = "Some selected candidate details are unavailable. Refresh the selection before adding rounds." : !K && be ? K = "Some selected candidates do not belong to the filtered posting." : !K && v && !R && !G && (K = "The selected round is no longer available. Choose another round.");
286
+ let xe = async () => {
287
+ if (N || O || h || R || K || !H || !G || U.length === 0) return;
288
+ P(!0), M(!0), D(null), T(S());
289
+ let e = await se({
290
+ items: U,
291
+ initialAggregate: S(),
292
+ onProgress: C,
293
293
  executeChunk: async (e) => {
294
- let t = (await k(s, { input: {
295
- jobPostingId: u,
296
- roundConfigId: B.id,
294
+ let t = (await z(u, { input: {
295
+ jobPostingId: p,
296
+ roundConfigId: G.id,
297
297
  applicationIds: [...e]
298
298
  } }, "BulkEnsureInterviewRounds")).bulkEnsureInterviewRounds;
299
299
  if (!t) throw Error("The add-to-round request returned no result.");
@@ -312,80 +312,80 @@ function j({ open: t, onClose: o, targets: c, selection: l, jobPostingId: u, pre
312
312
  message: e.message
313
313
  }))
314
314
  };
315
- return ue(e, n), n;
315
+ return y(e, n), n;
316
316
  },
317
- mergeResult: f
317
+ mergeResult: _
318
318
  });
319
- C(e.aggregate), e.error && D({
319
+ T(e.aggregate), e.error && D({
320
320
  knownCompleted: e.processedItems.length,
321
321
  ambiguous: e.ambiguousItems.length,
322
322
  notStarted: e.notStartedItems.length,
323
- message: Ce(e.error)
324
- }), le(fe({
323
+ message: ve(e.error)
324
+ }), ae(ce({
325
325
  succeeded: e.aggregate.created.length + e.aggregate.alreadyPresent.length,
326
326
  skipped: 0,
327
327
  failed: e.aggregate.failed.length,
328
328
  ambiguous: !!e.error
329
- })), j(!1), m.refetchQueries({ include: ["GetJobApplications", "GetJobApplicationInterviewRounds"] }).catch(() => void 0);
330
- }, U = d || N;
331
- return /* @__PURE__ */ T(n, {
329
+ })), P(!1), oe.refetchQueries({ include: ["GetJobApplications", "GetJobApplicationInterviewRounds"] }).catch(() => void 0);
330
+ }, q = h || R;
331
+ return /* @__PURE__ */ F(n, {
332
332
  open: t,
333
333
  onOpenChange: (e) => {
334
- !e && !A && o();
334
+ !e && !N && l();
335
335
  },
336
- children: /* @__PURE__ */ E(r, {
336
+ children: /* @__PURE__ */ I(r, {
337
337
  className: "sm:max-w-xl max-h-[90vh] overflow-y-auto",
338
338
  children: [
339
- /* @__PURE__ */ E(te, { children: [/* @__PURE__ */ T(ne, { children: "Add Selected to Round" }), /* @__PURE__ */ T(ee, { children: "Add every selected candidate in this posting to one configured interview round." })] }),
340
- /* @__PURE__ */ T("div", {
339
+ /* @__PURE__ */ I(te, { children: [/* @__PURE__ */ F(ne, { children: "Add Selected to Round" }), /* @__PURE__ */ F(ee, { children: "Add every selected candidate in this posting to one configured interview round." })] }),
340
+ /* @__PURE__ */ F("div", {
341
341
  className: "rounded-md border border-border-seam bg-bg-sunken/30 p-3 text-sm text-text-secondary",
342
342
  children: "Candidates without this concrete round are added with status Scheduled. Existing target rounds are left unchanged, and all prior round history and application status remain unchanged."
343
343
  }),
344
- O ? /* @__PURE__ */ E("div", {
344
+ O ? /* @__PURE__ */ I("div", {
345
345
  className: "space-y-4",
346
346
  children: [
347
- v ? /* @__PURE__ */ T(me, { progress: v }) : null,
348
- /* @__PURE__ */ T(b, { result: he }),
349
- w ? /* @__PURE__ */ T(ge, { details: w }) : null,
350
- /* @__PURE__ */ T(i, { children: /* @__PURE__ */ T(e, {
351
- onClick: o,
352
- disabled: A,
347
+ x ? /* @__PURE__ */ F(ue, { progress: x }) : null,
348
+ /* @__PURE__ */ F(k, { result: w }),
349
+ E ? /* @__PURE__ */ F(de, { details: E }) : null,
350
+ /* @__PURE__ */ F(i, { children: /* @__PURE__ */ F(e, {
351
+ onClick: l,
352
+ disabled: N,
353
353
  children: "Done"
354
354
  }) })
355
355
  ]
356
- }) : /* @__PURE__ */ E("div", {
356
+ }) : /* @__PURE__ */ I("div", {
357
357
  className: "space-y-4",
358
358
  children: [
359
- U ? /* @__PURE__ */ E("div", {
359
+ q ? /* @__PURE__ */ I("div", {
360
360
  className: "flex items-center gap-2 text-sm text-text-secondary",
361
- children: [/* @__PURE__ */ T(S, {
361
+ children: [/* @__PURE__ */ F(j, {
362
362
  size: 14,
363
363
  className: "animate-spin"
364
364
  }), "Refreshing candidates and configured rounds…"]
365
365
  }) : null,
366
- V ? /* @__PURE__ */ E("div", {
366
+ K ? /* @__PURE__ */ I("div", {
367
367
  className: "flex items-start gap-2 text-sm text-status-error-text",
368
368
  role: "alert",
369
- children: [/* @__PURE__ */ T(ye, {
369
+ children: [/* @__PURE__ */ F(me, {
370
370
  size: 14,
371
371
  className: "mt-0.5 shrink-0"
372
- }), /* @__PURE__ */ T("span", { children: V })]
372
+ }), /* @__PURE__ */ F("span", { children: K })]
373
373
  }) : null,
374
- /* @__PURE__ */ E("div", {
374
+ /* @__PURE__ */ I("div", {
375
375
  className: "space-y-1.5",
376
376
  children: [
377
- /* @__PURE__ */ T(a, {
377
+ /* @__PURE__ */ F(a, {
378
378
  htmlFor: "ensure-round-config",
379
379
  children: "Interview round"
380
380
  }),
381
- /* @__PURE__ */ E(re, {
382
- value: g,
383
- onValueChange: _,
384
- disabled: U || !!V,
385
- children: [/* @__PURE__ */ T(oe, {
381
+ /* @__PURE__ */ I(o, {
382
+ value: v,
383
+ onValueChange: b,
384
+ disabled: q || !!K,
385
+ children: [/* @__PURE__ */ F(c, {
386
386
  id: "ensure-round-config",
387
- children: /* @__PURE__ */ T(se, { placeholder: "Select a round" })
388
- }), /* @__PURE__ */ T(ie, { children: z.map((e) => /* @__PURE__ */ E(ae, {
387
+ children: /* @__PURE__ */ F(ie, { placeholder: "Select a round" })
388
+ }), /* @__PURE__ */ F(s, { children: W.map((e) => /* @__PURE__ */ I(re, {
389
389
  value: e.id,
390
390
  children: [
391
391
  "Round ",
@@ -395,34 +395,150 @@ function j({ open: t, onClose: o, targets: c, selection: l, jobPostingId: u, pre
395
395
  ]
396
396
  }, e.id)) })]
397
397
  }),
398
- z.length === 0 && !U && !V ? /* @__PURE__ */ T("p", {
398
+ W.length === 0 && !q && !K ? /* @__PURE__ */ F("p", {
399
399
  className: "text-xs text-status-warning-text",
400
400
  children: "This posting has no configured interview rounds."
401
401
  }) : null
402
402
  ]
403
403
  }),
404
- /* @__PURE__ */ E("p", {
404
+ /* @__PURE__ */ I("p", {
405
405
  className: "text-xs text-text-secondary",
406
406
  children: [
407
- I,
407
+ V,
408
408
  " selected candidate",
409
- I === 1 ? "" : "s",
409
+ V === 1 ? "" : "s",
410
410
  " ",
411
411
  "will be checked. Existing target rounds are reported as already present."
412
412
  ]
413
413
  }),
414
- /* @__PURE__ */ E(i, { children: [/* @__PURE__ */ T(e, {
414
+ /* @__PURE__ */ I(i, { children: [/* @__PURE__ */ F(e, {
415
415
  variant: "outline",
416
- onClick: o,
417
- disabled: A,
416
+ onClick: l,
417
+ disabled: N,
418
418
  children: "Cancel"
419
- }), /* @__PURE__ */ E(e, {
420
- onClick: () => void H(),
421
- disabled: A || U || !!V || !L || !g || R.length === 0,
422
- children: [A ? /* @__PURE__ */ T(S, {
419
+ }), /* @__PURE__ */ I(e, {
420
+ onClick: () => void xe(),
421
+ disabled: N || q || !!K || !H || !v || U.length === 0,
422
+ children: [N ? /* @__PURE__ */ F(j, {
423
423
  size: 16,
424
424
  className: "mr-2 animate-spin"
425
- }) : /* @__PURE__ */ T(be, { size: 16 }), A ? "Adding…" : "Add Selected to Round"]
425
+ }) : /* @__PURE__ */ F(he, { size: 16 }), N ? "Adding…" : "Add Selected to Round"]
426
+ })] })
427
+ ]
428
+ })
429
+ ]
430
+ })
431
+ });
432
+ }
433
+ function H({ open: t, onClose: a, targets: o, selection: s, jobPostingId: re, previewLoading: c, previewError: ie }) {
434
+ let l = ge(), [u, d] = A(null), [f, m] = A(x), [h, g] = A(null), [_, v] = A(!1), [y, b] = A(!1);
435
+ fe(() => {
436
+ t && (d(null), m(x()), g(null), v(!1), b(!1));
437
+ }, [t]);
438
+ let S = pe(() => ye(o, s), [s, o]), C = le(s), w = S.length === C, T = S.map((e) => e.id), E = S.some((e) => e.jobPostingId !== re), D = ie;
439
+ !D && !c && !w ? D = "Some selected candidate details are unavailable. Refresh the selection before notifying." : !D && E && (D = "Some selected candidates do not belong to the filtered posting.");
440
+ let k = async () => {
441
+ if (y || _ || c || D || !w || T.length === 0) return;
442
+ b(!0), v(!0), g(null), m(x());
443
+ let e = await se({
444
+ items: T,
445
+ initialAggregate: x(),
446
+ onProgress: d,
447
+ executeChunk: async (e) => {
448
+ let t = (await z(p, { input: { applicationIds: [...e] } }, "NotifyDuplicateApplicants")).notifyDuplicateApplicants;
449
+ if (!t) throw Error("The duplicate-notice request returned no result.");
450
+ return {
451
+ succeeded: t.succeeded.map((e) => ({ email: e.email })),
452
+ skipped: t.skipped.map((e) => ({
453
+ email: e.email,
454
+ reason: e.reason,
455
+ message: e.message
456
+ })),
457
+ failed: t.failed.map((e) => ({
458
+ email: e.email,
459
+ message: e.message
460
+ }))
461
+ };
462
+ },
463
+ mergeResult: oe
464
+ });
465
+ m(e.aggregate), e.error && g({
466
+ knownCompleted: e.processedItems.length,
467
+ ambiguous: e.ambiguousItems.length,
468
+ notStarted: e.notStartedItems.length,
469
+ message: ve(e.error)
470
+ }), ae(ce({
471
+ succeeded: e.aggregate.succeeded.length,
472
+ skipped: e.aggregate.skipped.length,
473
+ failed: e.aggregate.failed.length,
474
+ ambiguous: !!e.error
475
+ })), b(!1), l.refetchQueries({ include: ["GetJobApplications"] }).catch(() => void 0);
476
+ };
477
+ return /* @__PURE__ */ F(n, {
478
+ open: t,
479
+ onOpenChange: (e) => {
480
+ !e && !y && a();
481
+ },
482
+ children: /* @__PURE__ */ I(r, {
483
+ className: "sm:max-w-xl max-h-[90vh] overflow-y-auto",
484
+ children: [
485
+ /* @__PURE__ */ I(te, { children: [/* @__PURE__ */ F(ne, { children: "Notify Duplicate Applicants" }), /* @__PURE__ */ F(ee, { children: "Let candidates with more than one application know they only need to complete one take-home assignment." })] }),
486
+ /* @__PURE__ */ F("div", {
487
+ className: "rounded-md border border-border-seam bg-bg-sunken/30 p-3 text-sm text-text-secondary",
488
+ children: "Selected applications are grouped by email address — exactly one notice goes out per unique candidate, even if you select several of their duplicate applications. An email that only appears once among your selection is skipped (it isn't a duplicate), and an email already notified before is skipped automatically."
489
+ }),
490
+ _ ? /* @__PURE__ */ I("div", {
491
+ className: "space-y-4",
492
+ children: [
493
+ u ? /* @__PURE__ */ F(ue, { progress: u }) : null,
494
+ /* @__PURE__ */ F(O, { result: f }),
495
+ h ? /* @__PURE__ */ F(de, { details: h }) : null,
496
+ /* @__PURE__ */ F(i, { children: /* @__PURE__ */ F(e, {
497
+ onClick: a,
498
+ disabled: y,
499
+ children: "Done"
500
+ }) })
501
+ ]
502
+ }) : /* @__PURE__ */ I("div", {
503
+ className: "space-y-4",
504
+ children: [
505
+ c ? /* @__PURE__ */ I("div", {
506
+ className: "flex items-center gap-2 text-sm text-text-secondary",
507
+ children: [/* @__PURE__ */ F(j, {
508
+ size: 14,
509
+ className: "animate-spin"
510
+ }), "Refreshing candidates…"]
511
+ }) : null,
512
+ D ? /* @__PURE__ */ I("div", {
513
+ className: "flex items-start gap-2 text-sm text-status-error-text",
514
+ role: "alert",
515
+ children: [/* @__PURE__ */ F(me, {
516
+ size: 14,
517
+ className: "mt-0.5 shrink-0"
518
+ }), /* @__PURE__ */ F("span", { children: D })]
519
+ }) : null,
520
+ /* @__PURE__ */ I("p", {
521
+ className: "text-xs text-text-secondary",
522
+ children: [
523
+ C,
524
+ " selected application",
525
+ C === 1 ? "" : "s",
526
+ " ",
527
+ "will be checked and grouped by email."
528
+ ]
529
+ }),
530
+ /* @__PURE__ */ I(i, { children: [/* @__PURE__ */ F(e, {
531
+ variant: "outline",
532
+ onClick: a,
533
+ disabled: y,
534
+ children: "Cancel"
535
+ }), /* @__PURE__ */ I(e, {
536
+ onClick: () => void k(),
537
+ disabled: y || c || !!D || !w || T.length === 0,
538
+ children: [y ? /* @__PURE__ */ F(j, {
539
+ size: 16,
540
+ className: "mr-2 animate-spin"
541
+ }) : /* @__PURE__ */ F(M, { size: 16 }), y ? "Notifying…" : "Notify Duplicate Applicants"]
426
542
  })] })
427
543
  ]
428
544
  })
@@ -431,6 +547,6 @@ function j({ open: t, onClose: o, targets: c, selection: l, jobPostingId: u, pre
431
547
  });
432
548
  }
433
549
  //#endregion
434
- export { j as AddSelectedToRoundDialog, A as BulkCandidateSendDialog, O as isAssignmentRoundConfig };
550
+ export { V as AddSelectedToRoundDialog, B as BulkCandidateSendDialog, H as NotifyDuplicateApplicantsDialog, R as isAssignmentRoundConfig };
435
551
 
436
552
  //# sourceMappingURL=BulkCandidateDialogs.js.map