@burdenoff/microfe-support 2026.830.2 → 2026.902.2

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,33 @@
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";
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 a, Label as o, Select as s, SelectContent as c, SelectItem as l, SelectTrigger as u, SelectValue as ne, Textarea as d } from "../ui.js";
2
+ import { BulkEnsureInterviewRoundsDocument as f, BulkRandomizeAndSendAssignmentDocument as p, BulkSendCustomEmailDocument as m, BulkSendRoundMessageDocument as h, BulkUpdateApplicationStatusDocument as g, NotifyDuplicateApplicantsDocument as _, useGetJobPostingQuery as v } from "../../../generated/global-operations.js";
3
+ import { InterviewRoundType as y } from "../../../generated/global-types.js";
4
+ import { nativeNotify as re } from "../../../utils/nativeBridge.js";
5
+ import { statusLabels as b, statusOrder as x } from "../../constants/pipeline.js";
6
+ import { RichTextEditor as S } from "./RichTextEditor.js";
7
+ import { aggregateBulkCustomEmailResult as C, aggregateBulkStatusUpdateResult as w, aggregateCandidateEmailResult as T, aggregateDuplicateNoticeResult as E, aggregateEnsureRoundResult as D, assertCompleteBulkCustomEmailChunkResult as O, assertCompleteBulkStatusUpdateChunkResult as k, assertCompleteCandidateEmailChunkResult as A, assertCompleteEnsureRoundChunkResult as j, createEmptyBulkCustomEmailAggregate as M, createEmptyBulkStatusUpdateAggregate as N, createEmptyCandidateEmailAggregate as P, createEmptyDuplicateNoticeAggregate as F, createEmptyEnsureRoundAggregate as I, executeSequentialCandidateChunks as ie, getBulkOperationNotificationSeverity as ae, getCandidateSelectionCount as oe, getSelectedCandidateIds as L, hasCandidateEmailType as R, resolveExactCandidateRounds as z } from "../../utils/bulkCandidateOperations.js";
8
+ import { BulkCandidateActionGuidance as B } from "./BulkCandidateActionGuidance.js";
9
+ import { BulkCustomEmailResultDetails as V, BulkOperationProgress as se, BulkStatusUpdateResultDetails as ce, CandidateEmailResultDetails as le, DuplicateNoticeResultDetails as H, EnsureRoundResultDetails as ue, StoppedBulkOperationNotice as U } from "./BulkOperationFeedback.js";
10
+ import { useEffect as de, useMemo as fe, useState as W } from "react";
11
+ import { AlertCircle as pe, Loader2 as G, Mail as K, Send as me, Tag as q, UserPlus as he } from "lucide-react";
12
+ import { graphqlFetch as ge } from "@burdenoff/fe-libs/shared/graphql/fetch";
13
+ import { jsx as J, jsxs as Y } from "react/jsx-runtime";
14
+ import { useApolloClient as _e } from "@apollo/client/react";
15
+ import { print as ve } from "graphql";
14
16
  //#region src/support/components/careers/BulkCandidateDialogs.tsx
15
- function R(e) {
16
- return e.isAssignmentRound || e.roundType === h.TakeHome;
17
+ function ye(e) {
18
+ return e.isAssignmentRound || e.roundType === y.TakeHome;
17
19
  }
18
- var _e = {
20
+ var be = {
19
21
  message: "ROUND_MESSAGE",
20
22
  assignment: "ASSIGNMENT"
21
23
  };
22
- function ve(e) {
24
+ function xe(e) {
23
25
  return e instanceof Error ? e.message : "The request failed without an error message.";
24
26
  }
25
- async function z(e, t, n) {
26
- let r = await P({
27
+ async function X(e, t, n) {
28
+ let r = await ge({
27
29
  gateway: "global",
28
- query: L(e),
30
+ query: ve(e),
29
31
  variables: t,
30
32
  operationName: n,
31
33
  skipAuthRetry: !0
@@ -34,39 +36,39 @@ async function z(e, t, n) {
34
36
  if (!r.data) throw Error(`${n} returned no data.`);
35
37
  return r.data;
36
38
  }
37
- function ye(e, t) {
38
- let n = C(t);
39
+ function Se(e, t) {
40
+ let n = L(t);
39
41
  return e.filter((e) => n.has(e.id));
40
42
  }
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
+ function Ce({ mode: f, open: m, onClose: g, onOpenAddRound: _, targets: y, selection: b, jobPostingId: x, previewLoading: S, previewError: C }) {
44
+ let w = _e(), [E, D] = W(""), [O, k] = W(""), [j, M] = W(!1), [N, F] = W(null), [I, L] = W(P), [V, ce] = W(null), [H, ue] = W(!1), [K, q] = W(!1), { data: ge, loading: ve, error: Ce } = v({
43
45
  variables: { id: x },
44
- skip: !p || !x,
46
+ skip: !m || !x,
45
47
  fetchPolicy: "network-only"
46
48
  });
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) : {
49
+ de(() => {
50
+ m && (D(""), k(""), M(!1), F(null), L(P()), ce(null), ue(!1), q(!1));
51
+ }, [m, f]);
52
+ let we = fe(() => Se(y, b), [b, y]), Te = oe(b), Ee = we.length === Te, De = ge?.jobPosting?.rounds ?? [], Oe = De.filter((e) => f !== "assignment" || ye(e)), ke = De.find((e) => e.id === E), Z = ke ? z(we, ke.id) : {
51
53
  pairs: [],
52
54
  unresolved: []
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
+ }, Ae = Z.unresolved.filter((e) => e.reason === "MISSING").length, je = Z.unresolved.filter((e) => e.reason === "AMBIGUOUS").length, Me = be[f], Ne = Z.pairs.filter(({ round: e }) => R(e, Me)).length, Pe = Z.pairs.filter(({ round: e }) => j || !R(e, Me)).length, Fe = we.some((e) => e.jobPostingId !== x), Q = C;
56
+ !Q && Ce ? Q = "Could not load the posting rounds. Nothing will be sent." : !Q && !S && !Ee ? 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 && E && !ve && !ke ? Q = "The selected round is no longer available. Choose another round." : !Q && je > 0 && (Q = `${je} selected candidate${je === 1 ? " has" : "s have"} multiple concrete rounds for this configuration. Nothing will be sent until the data is corrected.`);
55
57
  let Ie = async () => {
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
- items: X.pairs.map(({ applicationId: e, roundId: t }) => ({
58
+ if (K || H || S || ve || Q || !Ee || !ke || Z.pairs.length === 0 || Pe === 0 || f === "message" && !O.trim()) return;
59
+ q(!0), ue(!0), ce(null), L(P());
60
+ let e = await ie({
61
+ items: Z.pairs.map(({ applicationId: e, roundId: t }) => ({
60
62
  applicationId: e,
61
63
  roundId: t
62
64
  })),
63
- initialAggregate: b(),
64
- onProgress: U,
65
+ initialAggregate: P(),
66
+ onProgress: F,
65
67
  executeChunk: async (e) => {
66
- if (u === "assignment") {
67
- let t = (await z(d, { input: {
68
+ if (f === "assignment") {
69
+ let t = (await X(p, { input: {
68
70
  items: [...e],
69
- force: B
71
+ force: j
70
72
  } }, "BulkRandomizeAndSendAssignment")).bulkRandomizeAndSendAssignment;
71
73
  if (!t) throw Error("The assignment request returned no result.");
72
74
  let n = {
@@ -86,12 +88,12 @@ function B({ mode: u, open: p, onClose: h, onOpenAddRound: oe, targets: _, selec
86
88
  message: e.message
87
89
  }))
88
90
  };
89
- return v(e, n), n;
91
+ return A(e, n), n;
90
92
  }
91
- let t = (await z(f, { input: {
93
+ let t = (await X(h, { input: {
92
94
  items: [...e],
93
- message: P.trim(),
94
- force: B
95
+ message: O.trim(),
96
+ force: j
95
97
  } }, "BulkSendRoundMessage")).bulkSendRoundMessage;
96
98
  if (!t) throw Error("The message request returned no result.");
97
99
  let n = {
@@ -111,80 +113,80 @@ function B({ mode: u, open: p, onClose: h, onOpenAddRound: oe, targets: _, selec
111
113
  message: e.message
112
114
  }))
113
115
  };
114
- return v(e, n), n;
116
+ return A(e, n), n;
115
117
  },
116
- mergeResult: g
118
+ mergeResult: T
117
119
  });
118
- W(e.aggregate), e.error && K({
120
+ L(e.aggregate), e.error && ce({
119
121
  knownCompleted: e.processedItems.length,
120
122
  ambiguous: e.ambiguousItems.length,
121
123
  notStarted: e.notStartedItems.length,
122
- message: ve(e.error)
123
- }), ae(ce({
124
+ message: xe(e.error)
125
+ }), re(ae({
124
126
  succeeded: e.aggregate.succeeded.length,
125
127
  skipped: e.aggregate.skipped.length,
126
128
  failed: e.aggregate.failed.length,
127
129
  ambiguous: !!e.error
128
- })), Se(!1), O.refetchQueries({ include: ["GetJobApplications", "GetJobApplicationInterviewRounds"] }).catch(() => void 0);
129
- }, $ = S || we;
130
- return /* @__PURE__ */ F(n, {
131
- open: p,
130
+ })), q(!1), w.refetchQueries({ include: ["GetJobApplications", "GetJobApplicationInterviewRounds"] }).catch(() => void 0);
131
+ }, $ = S || ve;
132
+ return /* @__PURE__ */ J(n, {
133
+ open: m,
132
134
  onOpenChange: (e) => {
133
- !e && !J && h();
135
+ !e && !K && g();
134
136
  },
135
- children: /* @__PURE__ */ I(r, {
137
+ children: /* @__PURE__ */ Y(r, {
136
138
  className: "sm:max-w-xl max-h-[90vh] overflow-y-auto",
137
139
  children: [
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
- unresolvedCount: je
140
+ /* @__PURE__ */ Y(te, { children: [/* @__PURE__ */ J(a, { children: f === "assignment" ? "Assign & Email Random Take-Home" : "Send Message" }), /* @__PURE__ */ J(ee, { children: "Choose one configured round for the candidates in the filtered posting." })] }),
141
+ /* @__PURE__ */ J(B, {
142
+ action: f,
143
+ unresolvedCount: Ae
142
144
  }),
143
- xe ? /* @__PURE__ */ I("div", {
145
+ H ? /* @__PURE__ */ Y("div", {
144
146
  className: "space-y-4",
145
147
  children: [
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,
148
+ N ? /* @__PURE__ */ J(se, { progress: N }) : null,
149
+ /* @__PURE__ */ J(le, { result: I }),
150
+ V ? /* @__PURE__ */ J(U, { details: V }) : null,
151
+ /* @__PURE__ */ J(i, { children: /* @__PURE__ */ J(e, {
152
+ onClick: g,
153
+ disabled: K,
152
154
  children: "Done"
153
155
  }) })
154
156
  ]
155
- }) : /* @__PURE__ */ I("div", {
157
+ }) : /* @__PURE__ */ Y("div", {
156
158
  className: "space-y-4",
157
159
  children: [
158
- $ ? /* @__PURE__ */ I("div", {
160
+ $ ? /* @__PURE__ */ Y("div", {
159
161
  className: "flex items-center gap-2 text-sm text-text-secondary",
160
- children: [/* @__PURE__ */ F(j, {
162
+ children: [/* @__PURE__ */ J(G, {
161
163
  size: 14,
162
164
  className: "animate-spin"
163
165
  }), "Refreshing candidates and configured rounds…"]
164
166
  }) : null,
165
- Q ? /* @__PURE__ */ I("div", {
167
+ Q ? /* @__PURE__ */ Y("div", {
166
168
  className: "flex items-start gap-2 text-sm text-status-error-text",
167
169
  role: "alert",
168
- children: [/* @__PURE__ */ F(me, {
170
+ children: [/* @__PURE__ */ J(pe, {
169
171
  size: 14,
170
172
  className: "mt-0.5 shrink-0"
171
- }), /* @__PURE__ */ F("span", { children: Q })]
173
+ }), /* @__PURE__ */ J("span", { children: Q })]
172
174
  }) : null,
173
- /* @__PURE__ */ I("div", {
175
+ /* @__PURE__ */ Y("div", {
174
176
  className: "space-y-1.5",
175
177
  children: [
176
- /* @__PURE__ */ F(a, {
178
+ /* @__PURE__ */ J(o, {
177
179
  htmlFor: "bulk-round-config",
178
180
  children: "Target round"
179
181
  }),
180
- /* @__PURE__ */ I(o, {
181
- value: k,
182
- onValueChange: M,
182
+ /* @__PURE__ */ Y(s, {
183
+ value: E,
184
+ onValueChange: D,
183
185
  disabled: $ || !!Q,
184
- children: [/* @__PURE__ */ F(c, {
186
+ children: [/* @__PURE__ */ J(u, {
185
187
  id: "bulk-round-config",
186
- children: /* @__PURE__ */ F(ie, { placeholder: "Select a round" })
187
- }), /* @__PURE__ */ F(s, { children: Ae.map((e) => /* @__PURE__ */ I(re, {
188
+ children: /* @__PURE__ */ J(ne, { placeholder: "Select a round" })
189
+ }), /* @__PURE__ */ J(c, { children: Oe.map((e) => /* @__PURE__ */ Y(l, {
188
190
  value: e.id,
189
191
  children: [
190
192
  "Round ",
@@ -194,77 +196,77 @@ function B({ mode: u, open: p, onClose: h, onOpenAddRound: oe, targets: _, selec
194
196
  ]
195
197
  }, e.id)) })]
196
198
  }),
197
- Ae.length === 0 && !$ && !Q ? /* @__PURE__ */ F("p", {
199
+ Oe.length === 0 && !$ && !Q ? /* @__PURE__ */ J("p", {
198
200
  className: "text-xs text-status-warning-text",
199
- children: u === "assignment" ? "This posting has no configured assignment round." : "This posting has no configured interview rounds."
201
+ children: f === "assignment" ? "This posting has no configured assignment round." : "This posting has no configured interview rounds."
200
202
  }) : null
201
203
  ]
202
204
  }),
203
- u === "message" ? /* @__PURE__ */ I("div", {
205
+ f === "message" ? /* @__PURE__ */ Y("div", {
204
206
  className: "space-y-1.5",
205
- children: [/* @__PURE__ */ F(a, {
207
+ children: [/* @__PURE__ */ J(o, {
206
208
  htmlFor: "bulk-message",
207
209
  children: "Free-text message"
208
- }), /* @__PURE__ */ F(l, {
210
+ }), /* @__PURE__ */ J(d, {
209
211
  id: "bulk-message",
210
- value: P,
211
- onChange: (e) => L(e.target.value),
212
+ value: O,
213
+ onChange: (e) => k(e.target.value),
212
214
  placeholder: "Write the message sent to each candidate",
213
215
  rows: 5
214
216
  })]
215
217
  }) : null,
216
- k && !$ && !Q ? /* @__PURE__ */ I("div", {
218
+ E && !$ && !Q ? /* @__PURE__ */ Y("div", {
217
219
  className: "space-y-2 rounded-md border border-border-seam bg-bg-sunken/30 p-3 text-xs text-text-secondary",
218
220
  children: [
219
- /* @__PURE__ */ F("p", {
221
+ /* @__PURE__ */ J("p", {
220
222
  className: "font-medium text-text-primary",
221
223
  children: "Preview"
222
224
  }),
223
- /* @__PURE__ */ I("p", { children: [
225
+ /* @__PURE__ */ Y("p", { children: [
224
226
  "Will send to ",
225
- /* @__PURE__ */ F("span", {
227
+ /* @__PURE__ */ J("span", {
226
228
  className: "font-semibold",
227
- children: Z
229
+ children: Pe
228
230
  }),
229
231
  " candidate",
230
- Z === 1 ? "" : "s",
232
+ Pe === 1 ? "" : "s",
231
233
  "."
232
234
  ] }),
233
- Pe > 0 ? /* @__PURE__ */ I("p", { children: [
234
- Pe,
235
+ Ne > 0 ? /* @__PURE__ */ Y("p", { children: [
236
+ Ne,
235
237
  " already received this email type",
236
238
  " ",
237
- B ? "(force will send again)" : "(the backend will skip them)",
239
+ j ? "(force will send again)" : "(the backend will skip them)",
238
240
  "."
239
241
  ] }) : null,
240
- je > 0 ? /* @__PURE__ */ I(e, {
242
+ Ae > 0 ? /* @__PURE__ */ Y(e, {
241
243
  type: "button",
242
244
  size: "sm",
243
245
  variant: "outline",
244
- onClick: oe,
245
- children: [/* @__PURE__ */ F(he, { size: 14 }), "Add Selected to Round"]
246
+ onClick: _,
247
+ children: [/* @__PURE__ */ J(he, { size: 14 }), "Add Selected to Round"]
246
248
  }) : null,
247
- /* @__PURE__ */ I("label", {
249
+ /* @__PURE__ */ Y("label", {
248
250
  className: "flex cursor-pointer items-start gap-2 pt-1",
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." })]
251
+ children: [/* @__PURE__ */ J(t, {
252
+ checked: j,
253
+ onCheckedChange: (e) => M(e === !0)
254
+ }), /* @__PURE__ */ J("span", { children: "Force resend to candidates with a prior email. Force sends are non-idempotent and are never retried automatically." })]
253
255
  })
254
256
  ]
255
257
  }) : null,
256
- /* @__PURE__ */ I(i, { children: [/* @__PURE__ */ F(e, {
258
+ /* @__PURE__ */ Y(i, { children: [/* @__PURE__ */ J(e, {
257
259
  variant: "outline",
258
- onClick: h,
259
- disabled: J,
260
+ onClick: g,
261
+ disabled: K,
260
262
  children: "Cancel"
261
- }), /* @__PURE__ */ I(e, {
263
+ }), /* @__PURE__ */ Y(e, {
262
264
  onClick: () => void Ie(),
263
- disabled: J || $ || !!Q || !Oe || !k || X.pairs.length === 0 || Z === 0 || u === "message" && !P.trim(),
264
- children: [J ? /* @__PURE__ */ F(j, {
265
+ disabled: K || $ || !!Q || !Ee || !E || Z.pairs.length === 0 || Pe === 0 || f === "message" && !O.trim(),
266
+ children: [K ? /* @__PURE__ */ J(G, {
265
267
  size: 16,
266
268
  className: "mr-2 animate-spin"
267
- }) : /* @__PURE__ */ F(N, { size: 16 }), J ? "Sending…" : "Send"]
269
+ }) : /* @__PURE__ */ J(me, { size: 16 }), K ? "Sending…" : "Send"]
268
270
  })] })
269
271
  ]
270
272
  })
@@ -272,28 +274,28 @@ function B({ mode: u, open: p, onClose: h, onOpenAddRound: oe, targets: _, selec
272
274
  })
273
275
  });
274
276
  }
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,
277
+ function we({ open: t, onClose: d, targets: p, selection: m, jobPostingId: h, previewLoading: g, previewError: _ }) {
278
+ let y = _e(), [b, x] = W(""), [S, C] = W(null), [w, T] = W(I), [E, O] = W(null), [k, A] = W(!1), [M, N] = W(!1), { data: P, loading: F, error: L } = v({
279
+ variables: { id: h },
280
+ skip: !t || !h,
279
281
  fetchPolicy: "network-only"
280
282
  });
281
- fe(() => {
282
- t && (b(""), C(null), T(S()), D(null), M(!1), P(!1));
283
+ de(() => {
284
+ t && (x(""), C(null), T(I()), O(null), A(!1), N(!1));
283
285
  }, [t]);
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(),
286
+ let R = fe(() => Se(p, m), [m, p]), z = oe(m), B = R.length === z, V = R.map((e) => e.id), ce = R.some((e) => e.jobPostingId !== h), le = P?.jobPosting?.rounds ?? [], H = le.find((e) => e.id === b), K = _;
287
+ !K && L ? K = "Could not load the posting rounds. Nothing will be changed." : !K && !g && !B ? K = "Some selected candidate details are unavailable. Refresh the selection before adding rounds." : !K && ce ? K = "Some selected candidates do not belong to the filtered posting." : !K && b && !F && !H && (K = "The selected round is no longer available. Choose another round.");
288
+ let me = async () => {
289
+ if (M || k || g || F || K || !B || !H || V.length === 0) return;
290
+ N(!0), A(!0), O(null), T(I());
291
+ let e = await ie({
292
+ items: V,
293
+ initialAggregate: I(),
292
294
  onProgress: C,
293
295
  executeChunk: async (e) => {
294
- let t = (await z(u, { input: {
295
- jobPostingId: p,
296
- roundConfigId: G.id,
296
+ let t = (await X(f, { input: {
297
+ jobPostingId: h,
298
+ roundConfigId: H.id,
297
299
  applicationIds: [...e]
298
300
  } }, "BulkEnsureInterviewRounds")).bulkEnsureInterviewRounds;
299
301
  if (!t) throw Error("The add-to-round request returned no result.");
@@ -312,80 +314,80 @@ function V({ open: t, onClose: l, targets: d, selection: f, jobPostingId: p, pre
312
314
  message: e.message
313
315
  }))
314
316
  };
315
- return y(e, n), n;
317
+ return j(e, n), n;
316
318
  },
317
- mergeResult: _
319
+ mergeResult: D
318
320
  });
319
- T(e.aggregate), e.error && D({
321
+ T(e.aggregate), e.error && O({
320
322
  knownCompleted: e.processedItems.length,
321
323
  ambiguous: e.ambiguousItems.length,
322
324
  notStarted: e.notStartedItems.length,
323
- message: ve(e.error)
324
- }), ae(ce({
325
+ message: xe(e.error)
326
+ }), re(ae({
325
327
  succeeded: e.aggregate.created.length + e.aggregate.alreadyPresent.length,
326
328
  skipped: 0,
327
329
  failed: e.aggregate.failed.length,
328
330
  ambiguous: !!e.error
329
- })), P(!1), oe.refetchQueries({ include: ["GetJobApplications", "GetJobApplicationInterviewRounds"] }).catch(() => void 0);
330
- }, q = h || R;
331
- return /* @__PURE__ */ F(n, {
331
+ })), N(!1), y.refetchQueries({ include: ["GetJobApplications", "GetJobApplicationInterviewRounds"] }).catch(() => void 0);
332
+ }, q = g || F;
333
+ return /* @__PURE__ */ J(n, {
332
334
  open: t,
333
335
  onOpenChange: (e) => {
334
- !e && !N && l();
336
+ !e && !M && d();
335
337
  },
336
- children: /* @__PURE__ */ I(r, {
338
+ children: /* @__PURE__ */ Y(r, {
337
339
  className: "sm:max-w-xl max-h-[90vh] overflow-y-auto",
338
340
  children: [
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
+ /* @__PURE__ */ Y(te, { children: [/* @__PURE__ */ J(a, { children: "Add Selected to Round" }), /* @__PURE__ */ J(ee, { children: "Add every selected candidate in this posting to one configured interview round." })] }),
342
+ /* @__PURE__ */ J("div", {
341
343
  className: "rounded-md border border-border-seam bg-bg-sunken/30 p-3 text-sm text-text-secondary",
342
344
  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
345
  }),
344
- O ? /* @__PURE__ */ I("div", {
346
+ k ? /* @__PURE__ */ Y("div", {
345
347
  className: "space-y-4",
346
348
  children: [
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,
349
+ S ? /* @__PURE__ */ J(se, { progress: S }) : null,
350
+ /* @__PURE__ */ J(ue, { result: w }),
351
+ E ? /* @__PURE__ */ J(U, { details: E }) : null,
352
+ /* @__PURE__ */ J(i, { children: /* @__PURE__ */ J(e, {
353
+ onClick: d,
354
+ disabled: M,
353
355
  children: "Done"
354
356
  }) })
355
357
  ]
356
- }) : /* @__PURE__ */ I("div", {
358
+ }) : /* @__PURE__ */ Y("div", {
357
359
  className: "space-y-4",
358
360
  children: [
359
- q ? /* @__PURE__ */ I("div", {
361
+ q ? /* @__PURE__ */ Y("div", {
360
362
  className: "flex items-center gap-2 text-sm text-text-secondary",
361
- children: [/* @__PURE__ */ F(j, {
363
+ children: [/* @__PURE__ */ J(G, {
362
364
  size: 14,
363
365
  className: "animate-spin"
364
366
  }), "Refreshing candidates and configured rounds…"]
365
367
  }) : null,
366
- K ? /* @__PURE__ */ I("div", {
368
+ K ? /* @__PURE__ */ Y("div", {
367
369
  className: "flex items-start gap-2 text-sm text-status-error-text",
368
370
  role: "alert",
369
- children: [/* @__PURE__ */ F(me, {
371
+ children: [/* @__PURE__ */ J(pe, {
370
372
  size: 14,
371
373
  className: "mt-0.5 shrink-0"
372
- }), /* @__PURE__ */ F("span", { children: K })]
374
+ }), /* @__PURE__ */ J("span", { children: K })]
373
375
  }) : null,
374
- /* @__PURE__ */ I("div", {
376
+ /* @__PURE__ */ Y("div", {
375
377
  className: "space-y-1.5",
376
378
  children: [
377
- /* @__PURE__ */ F(a, {
379
+ /* @__PURE__ */ J(o, {
378
380
  htmlFor: "ensure-round-config",
379
381
  children: "Interview round"
380
382
  }),
381
- /* @__PURE__ */ I(o, {
382
- value: v,
383
- onValueChange: b,
383
+ /* @__PURE__ */ Y(s, {
384
+ value: b,
385
+ onValueChange: x,
384
386
  disabled: q || !!K,
385
- children: [/* @__PURE__ */ F(c, {
387
+ children: [/* @__PURE__ */ J(u, {
386
388
  id: "ensure-round-config",
387
- children: /* @__PURE__ */ F(ie, { placeholder: "Select a round" })
388
- }), /* @__PURE__ */ F(s, { children: W.map((e) => /* @__PURE__ */ I(re, {
389
+ children: /* @__PURE__ */ J(ne, { placeholder: "Select a round" })
390
+ }), /* @__PURE__ */ J(c, { children: le.map((e) => /* @__PURE__ */ Y(l, {
389
391
  value: e.id,
390
392
  children: [
391
393
  "Round ",
@@ -395,34 +397,34 @@ function V({ open: t, onClose: l, targets: d, selection: f, jobPostingId: p, pre
395
397
  ]
396
398
  }, e.id)) })]
397
399
  }),
398
- W.length === 0 && !q && !K ? /* @__PURE__ */ F("p", {
400
+ le.length === 0 && !q && !K ? /* @__PURE__ */ J("p", {
399
401
  className: "text-xs text-status-warning-text",
400
402
  children: "This posting has no configured interview rounds."
401
403
  }) : null
402
404
  ]
403
405
  }),
404
- /* @__PURE__ */ I("p", {
406
+ /* @__PURE__ */ Y("p", {
405
407
  className: "text-xs text-text-secondary",
406
408
  children: [
407
- V,
409
+ z,
408
410
  " selected candidate",
409
- V === 1 ? "" : "s",
411
+ z === 1 ? "" : "s",
410
412
  " ",
411
413
  "will be checked. Existing target rounds are reported as already present."
412
414
  ]
413
415
  }),
414
- /* @__PURE__ */ I(i, { children: [/* @__PURE__ */ F(e, {
416
+ /* @__PURE__ */ Y(i, { children: [/* @__PURE__ */ J(e, {
415
417
  variant: "outline",
416
- onClick: l,
417
- disabled: N,
418
+ onClick: d,
419
+ disabled: M,
418
420
  children: "Cancel"
419
- }), /* @__PURE__ */ I(e, {
420
- onClick: () => void xe(),
421
- disabled: N || q || !!K || !H || !v || U.length === 0,
422
- children: [N ? /* @__PURE__ */ F(j, {
421
+ }), /* @__PURE__ */ Y(e, {
422
+ onClick: () => void me(),
423
+ disabled: M || q || !!K || !B || !b || V.length === 0,
424
+ children: [M ? /* @__PURE__ */ J(G, {
423
425
  size: 16,
424
426
  className: "mr-2 animate-spin"
425
- }) : /* @__PURE__ */ F(he, { size: 16 }), N ? "Adding…" : "Add Selected to Round"]
427
+ }) : /* @__PURE__ */ J(he, { size: 16 }), M ? "Adding…" : "Add Selected to Round"]
426
428
  })] })
427
429
  ]
428
430
  })
@@ -430,22 +432,22 @@ function V({ open: t, onClose: l, targets: d, selection: f, jobPostingId: p, pre
430
432
  })
431
433
  });
432
434
  }
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));
435
+ function Te({ open: t, onClose: o, targets: s, selection: c, jobPostingId: l, previewLoading: u, previewError: ne }) {
436
+ let d = _e(), [f, p] = W(null), [m, h] = W(F), [g, v] = W(null), [y, b] = W(!1), [x, S] = W(!1);
437
+ de(() => {
438
+ t && (p(null), h(F()), v(null), b(!1), S(!1));
437
439
  }, [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,
440
+ let C = fe(() => Se(s, c), [c, s]), w = oe(c), T = C.length === w, D = C.map((e) => e.id), O = C.some((e) => e.jobPostingId !== l), k = ne;
441
+ !k && !u && !T ? k = "Some selected candidate details are unavailable. Refresh the selection before notifying." : !k && O && (k = "Some selected candidates do not belong to the filtered posting.");
442
+ let A = async () => {
443
+ if (x || y || u || k || !T || D.length === 0) return;
444
+ S(!0), b(!0), v(null), h(F());
445
+ let e = await ie({
446
+ items: D,
447
+ initialAggregate: F(),
448
+ onProgress: p,
447
449
  executeChunk: async (e) => {
448
- let t = (await z(p, { input: { applicationIds: [...e] } }, "NotifyDuplicateApplicants")).notifyDuplicateApplicants;
450
+ let t = (await X(_, { input: { applicationIds: [...e] } }, "NotifyDuplicateApplicants")).notifyDuplicateApplicants;
449
451
  if (!t) throw Error("The duplicate-notice request returned no result.");
450
452
  return {
451
453
  succeeded: t.succeeded.map((e) => ({ email: e.email })),
@@ -460,85 +462,85 @@ function H({ open: t, onClose: a, targets: o, selection: s, jobPostingId: re, pr
460
462
  }))
461
463
  };
462
464
  },
463
- mergeResult: oe
465
+ mergeResult: E
464
466
  });
465
- m(e.aggregate), e.error && g({
467
+ h(e.aggregate), e.error && v({
466
468
  knownCompleted: e.processedItems.length,
467
469
  ambiguous: e.ambiguousItems.length,
468
470
  notStarted: e.notStartedItems.length,
469
- message: ve(e.error)
470
- }), ae(ce({
471
+ message: xe(e.error)
472
+ }), re(ae({
471
473
  succeeded: e.aggregate.succeeded.length,
472
474
  skipped: e.aggregate.skipped.length,
473
475
  failed: e.aggregate.failed.length,
474
476
  ambiguous: !!e.error
475
- })), b(!1), l.refetchQueries({ include: ["GetJobApplications"] }).catch(() => void 0);
477
+ })), S(!1), d.refetchQueries({ include: ["GetJobApplications"] }).catch(() => void 0);
476
478
  };
477
- return /* @__PURE__ */ F(n, {
479
+ return /* @__PURE__ */ J(n, {
478
480
  open: t,
479
481
  onOpenChange: (e) => {
480
- !e && !y && a();
482
+ !e && !x && o();
481
483
  },
482
- children: /* @__PURE__ */ I(r, {
484
+ children: /* @__PURE__ */ Y(r, {
483
485
  className: "sm:max-w-xl max-h-[90vh] overflow-y-auto",
484
486
  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
+ /* @__PURE__ */ Y(te, { children: [/* @__PURE__ */ J(a, { children: "Notify Duplicate Applicants" }), /* @__PURE__ */ J(ee, { children: "Let candidates with more than one application know they only need to complete one take-home assignment." })] }),
488
+ /* @__PURE__ */ J("div", {
487
489
  className: "rounded-md border border-border-seam bg-bg-sunken/30 p-3 text-sm text-text-secondary",
488
490
  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
491
  }),
490
- _ ? /* @__PURE__ */ I("div", {
492
+ y ? /* @__PURE__ */ Y("div", {
491
493
  className: "space-y-4",
492
494
  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,
495
+ f ? /* @__PURE__ */ J(se, { progress: f }) : null,
496
+ /* @__PURE__ */ J(H, { result: m }),
497
+ g ? /* @__PURE__ */ J(U, { details: g }) : null,
498
+ /* @__PURE__ */ J(i, { children: /* @__PURE__ */ J(e, {
499
+ onClick: o,
500
+ disabled: x,
499
501
  children: "Done"
500
502
  }) })
501
503
  ]
502
- }) : /* @__PURE__ */ I("div", {
504
+ }) : /* @__PURE__ */ Y("div", {
503
505
  className: "space-y-4",
504
506
  children: [
505
- c ? /* @__PURE__ */ I("div", {
507
+ u ? /* @__PURE__ */ Y("div", {
506
508
  className: "flex items-center gap-2 text-sm text-text-secondary",
507
- children: [/* @__PURE__ */ F(j, {
509
+ children: [/* @__PURE__ */ J(G, {
508
510
  size: 14,
509
511
  className: "animate-spin"
510
512
  }), "Refreshing candidates…"]
511
513
  }) : null,
512
- D ? /* @__PURE__ */ I("div", {
514
+ k ? /* @__PURE__ */ Y("div", {
513
515
  className: "flex items-start gap-2 text-sm text-status-error-text",
514
516
  role: "alert",
515
- children: [/* @__PURE__ */ F(me, {
517
+ children: [/* @__PURE__ */ J(pe, {
516
518
  size: 14,
517
519
  className: "mt-0.5 shrink-0"
518
- }), /* @__PURE__ */ F("span", { children: D })]
520
+ }), /* @__PURE__ */ J("span", { children: k })]
519
521
  }) : null,
520
- /* @__PURE__ */ I("p", {
522
+ /* @__PURE__ */ Y("p", {
521
523
  className: "text-xs text-text-secondary",
522
524
  children: [
523
- C,
525
+ w,
524
526
  " selected application",
525
- C === 1 ? "" : "s",
527
+ w === 1 ? "" : "s",
526
528
  " ",
527
529
  "will be checked and grouped by email."
528
530
  ]
529
531
  }),
530
- /* @__PURE__ */ I(i, { children: [/* @__PURE__ */ F(e, {
532
+ /* @__PURE__ */ Y(i, { children: [/* @__PURE__ */ J(e, {
531
533
  variant: "outline",
532
- onClick: a,
533
- disabled: y,
534
+ onClick: o,
535
+ disabled: x,
534
536
  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, {
537
+ }), /* @__PURE__ */ Y(e, {
538
+ onClick: () => void A(),
539
+ disabled: x || u || !!k || !T || D.length === 0,
540
+ children: [x ? /* @__PURE__ */ J(G, {
539
541
  size: 16,
540
542
  className: "mr-2 animate-spin"
541
- }) : /* @__PURE__ */ F(M, { size: 16 }), y ? "Notifying…" : "Notify Duplicate Applicants"]
543
+ }) : /* @__PURE__ */ J(K, { size: 16 }), x ? "Notifying…" : "Notify Duplicate Applicants"]
542
544
  })] })
543
545
  ]
544
546
  })
@@ -546,7 +548,269 @@ function H({ open: t, onClose: a, targets: o, selection: s, jobPostingId: re, pr
546
548
  })
547
549
  });
548
550
  }
551
+ function Ee({ open: t, onClose: s, targets: c, selection: l, previewLoading: u, previewError: ne }) {
552
+ let d = _e(), [f, p] = W(""), [h, g] = W(""), [_, v] = W(null), [y, b] = W(M), [x, w] = W(null), [T, E] = W(!1), [D, k] = W(!1);
553
+ de(() => {
554
+ t && (p(""), g(""), v(null), b(M()), w(null), E(!1), k(!1));
555
+ }, [t]);
556
+ let A = fe(() => Se(c, l), [l, c]), j = oe(l), N = A.length === j, P = A.map((e) => e.id), F = f.trim().length > 0, I = h.trim().length > 0, L = ne;
557
+ !L && !u && !N && (L = "Some selected candidate details are unavailable. Refresh the selection before sending.");
558
+ let R = !D && !T && !u && !L && N && P.length > 0 && F && I, z = async () => {
559
+ if (!R) return;
560
+ k(!0), E(!0), w(null), b(M());
561
+ let e = await ie({
562
+ items: P,
563
+ initialAggregate: M(),
564
+ onProgress: v,
565
+ executeChunk: async (e) => {
566
+ let t = (await X(m, { input: {
567
+ applicationIds: [...e],
568
+ subject: f.trim(),
569
+ message: h
570
+ } }, "BulkSendCustomEmail")).bulkSendCustomEmail;
571
+ if (!t) throw Error("The bulk email request returned no result.");
572
+ let n = {
573
+ succeeded: t.succeeded.map((e) => ({
574
+ applicationId: e.id,
575
+ email: e.email
576
+ })),
577
+ failed: t.failed.map((e) => ({
578
+ applicationId: e.applicationId,
579
+ message: e.message
580
+ }))
581
+ };
582
+ return O([...e], n), n;
583
+ },
584
+ mergeResult: C
585
+ });
586
+ b(e.aggregate), e.error && w({
587
+ knownCompleted: e.processedItems.length,
588
+ ambiguous: e.ambiguousItems.length,
589
+ notStarted: e.notStartedItems.length,
590
+ message: xe(e.error)
591
+ }), re(ae({
592
+ succeeded: e.aggregate.succeeded.length,
593
+ skipped: 0,
594
+ failed: e.aggregate.failed.length,
595
+ ambiguous: !!e.error
596
+ })), k(!1), d.refetchQueries({ include: ["GetJobApplications"] }).catch(() => void 0);
597
+ };
598
+ return /* @__PURE__ */ J(n, {
599
+ open: t,
600
+ onOpenChange: (e) => {
601
+ !e && !D && s();
602
+ },
603
+ children: /* @__PURE__ */ Y(r, {
604
+ className: "sm:max-w-xl max-h-[90vh] overflow-y-auto",
605
+ children: [/* @__PURE__ */ Y(te, { children: [/* @__PURE__ */ J(a, { children: "Send Custom Email" }), /* @__PURE__ */ J(ee, { children: "Send the same branded email — your own subject and message — to every selected candidate, regardless of their stage or round. Useful for progress updates or a closing note to candidates who won't move forward." })] }), T ? /* @__PURE__ */ Y("div", {
606
+ className: "space-y-4",
607
+ children: [
608
+ _ ? /* @__PURE__ */ J(se, { progress: _ }) : null,
609
+ /* @__PURE__ */ J(V, { result: y }),
610
+ x ? /* @__PURE__ */ J(U, { details: x }) : null,
611
+ /* @__PURE__ */ J(i, { children: /* @__PURE__ */ J(e, {
612
+ onClick: s,
613
+ disabled: D,
614
+ children: "Done"
615
+ }) })
616
+ ]
617
+ }) : /* @__PURE__ */ Y("div", {
618
+ className: "space-y-4",
619
+ children: [
620
+ u ? /* @__PURE__ */ Y("div", {
621
+ className: "flex items-center gap-2 text-sm text-text-secondary",
622
+ children: [/* @__PURE__ */ J(G, {
623
+ size: 14,
624
+ className: "animate-spin"
625
+ }), "Refreshing candidates…"]
626
+ }) : null,
627
+ L ? /* @__PURE__ */ Y("div", {
628
+ className: "flex items-start gap-2 text-sm text-status-error-text",
629
+ role: "alert",
630
+ children: [/* @__PURE__ */ J(pe, {
631
+ size: 14,
632
+ className: "mt-0.5 shrink-0"
633
+ }), /* @__PURE__ */ J("span", { children: L })]
634
+ }) : null,
635
+ /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J(o, {
636
+ htmlFor: "bulk-custom-email-subject",
637
+ children: "Subject"
638
+ }), /* @__PURE__ */ J("input", {
639
+ id: "bulk-custom-email-subject",
640
+ type: "text",
641
+ value: f,
642
+ onChange: (e) => p(e.target.value),
643
+ placeholder: "e.g. An update on your application",
644
+ className: "mt-1.5 w-full rounded-lg border border-border-default bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-primary/30"
645
+ })] }),
646
+ /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J(o, {
647
+ htmlFor: "bulk-custom-email-message",
648
+ children: "Message"
649
+ }), /* @__PURE__ */ J("div", {
650
+ className: "mt-1.5",
651
+ children: /* @__PURE__ */ J(S, {
652
+ id: "bulk-custom-email-message",
653
+ value: h,
654
+ onChange: g,
655
+ placeholder: "Type your message… This will be sent as a branded email to every selected candidate.",
656
+ "aria-required": !0
657
+ })
658
+ })] }),
659
+ /* @__PURE__ */ Y("p", {
660
+ className: "text-xs text-text-secondary",
661
+ children: [
662
+ j,
663
+ " selected candidate",
664
+ j === 1 ? "" : "s",
665
+ " ",
666
+ "will each receive their own copy of this email."
667
+ ]
668
+ }),
669
+ /* @__PURE__ */ Y(i, { children: [/* @__PURE__ */ J(e, {
670
+ variant: "outline",
671
+ onClick: s,
672
+ disabled: D,
673
+ children: "Cancel"
674
+ }), /* @__PURE__ */ Y(e, {
675
+ onClick: () => void z(),
676
+ disabled: !R,
677
+ children: [D ? /* @__PURE__ */ J(G, {
678
+ size: 16,
679
+ className: "mr-2 animate-spin"
680
+ }) : /* @__PURE__ */ J(K, { size: 16 }), D ? "Sending…" : "Send Email"]
681
+ })] })
682
+ ]
683
+ })]
684
+ })
685
+ });
686
+ }
687
+ function De({ open: t, onClose: d, targets: f, selection: p, previewLoading: m, previewError: h }) {
688
+ let _ = _e(), [v, y] = W(null), [S, C] = W(null), [T, E] = W(N), [D, O] = W(null), [A, j] = W(!1), [M, P] = W(!1);
689
+ de(() => {
690
+ t && (y(null), C(null), E(N()), O(null), j(!1), P(!1));
691
+ }, [t]);
692
+ let F = fe(() => Se(f, p), [p, f]), I = oe(p), L = F.length === I, R = F.map((e) => e.id), z = h;
693
+ !z && !m && !L && (z = "Some selected candidate details are unavailable. Refresh the selection before updating.");
694
+ let B = !M && !A && !m && !z && L && R.length > 0 && v !== null, V = async () => {
695
+ if (!B || v === null) return;
696
+ P(!0), j(!0), O(null), E(N());
697
+ let e = await ie({
698
+ items: R,
699
+ initialAggregate: N(),
700
+ onProgress: C,
701
+ executeChunk: async (e) => {
702
+ let t = (await X(g, { input: {
703
+ applicationIds: [...e],
704
+ status: v
705
+ } }, "BulkUpdateApplicationStatus")).bulkUpdateApplicationStatus;
706
+ if (!t) throw Error("The bulk status update request returned no result.");
707
+ let n = {
708
+ succeeded: t.succeeded.map((e) => ({
709
+ applicationId: e.id,
710
+ status: e.status
711
+ })),
712
+ failed: t.failed.map((e) => ({
713
+ applicationId: e.applicationId,
714
+ message: e.message
715
+ }))
716
+ };
717
+ return k([...e], n), n;
718
+ },
719
+ mergeResult: w
720
+ });
721
+ E(e.aggregate), e.error && O({
722
+ knownCompleted: e.processedItems.length,
723
+ ambiguous: e.ambiguousItems.length,
724
+ notStarted: e.notStartedItems.length,
725
+ message: xe(e.error)
726
+ }), re(ae({
727
+ succeeded: e.aggregate.succeeded.length,
728
+ skipped: 0,
729
+ failed: e.aggregate.failed.length,
730
+ ambiguous: !!e.error
731
+ })), P(!1), _.refetchQueries({ include: ["GetJobApplications"] }).catch(() => void 0);
732
+ };
733
+ return /* @__PURE__ */ J(n, {
734
+ open: t,
735
+ onOpenChange: (e) => {
736
+ !e && !M && d();
737
+ },
738
+ children: /* @__PURE__ */ Y(r, {
739
+ className: "sm:max-w-md",
740
+ children: [/* @__PURE__ */ Y(te, { children: [/* @__PURE__ */ J(a, { children: "Update Status" }), /* @__PURE__ */ J(ee, { children: "Set the same status on every selected candidate — e.g. mark everyone you just sent a bulk email as \"Email Sent\" so a later send doesn't reach them twice, then move them back to their real stage once you decide the outcome." })] }), A ? /* @__PURE__ */ Y("div", {
741
+ className: "space-y-4",
742
+ children: [
743
+ S ? /* @__PURE__ */ J(se, { progress: S }) : null,
744
+ /* @__PURE__ */ J(ce, { result: T }),
745
+ D ? /* @__PURE__ */ J(U, { details: D }) : null,
746
+ /* @__PURE__ */ J(i, { children: /* @__PURE__ */ J(e, {
747
+ onClick: d,
748
+ disabled: M,
749
+ children: "Done"
750
+ }) })
751
+ ]
752
+ }) : /* @__PURE__ */ Y("div", {
753
+ className: "space-y-4",
754
+ children: [
755
+ m ? /* @__PURE__ */ Y("div", {
756
+ className: "flex items-center gap-2 text-sm text-text-secondary",
757
+ children: [/* @__PURE__ */ J(G, {
758
+ size: 14,
759
+ className: "animate-spin"
760
+ }), "Refreshing candidates…"]
761
+ }) : null,
762
+ z ? /* @__PURE__ */ Y("div", {
763
+ className: "flex items-start gap-2 text-sm text-status-error-text",
764
+ role: "alert",
765
+ children: [/* @__PURE__ */ J(pe, {
766
+ size: 14,
767
+ className: "mt-0.5 shrink-0"
768
+ }), /* @__PURE__ */ J("span", { children: z })]
769
+ }) : null,
770
+ /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J(o, {
771
+ htmlFor: "bulk-status-update-status",
772
+ children: "New status"
773
+ }), /* @__PURE__ */ Y(s, {
774
+ value: v ?? "",
775
+ onValueChange: (e) => y(e),
776
+ children: [/* @__PURE__ */ J(u, {
777
+ id: "bulk-status-update-status",
778
+ className: "mt-1.5",
779
+ children: /* @__PURE__ */ J(ne, { placeholder: "Select a status" })
780
+ }), /* @__PURE__ */ J(c, { children: x.map((e) => /* @__PURE__ */ J(l, {
781
+ value: e,
782
+ children: b[e] || e
783
+ }, e)) })]
784
+ })] }),
785
+ /* @__PURE__ */ Y("p", {
786
+ className: "text-xs text-text-secondary",
787
+ children: [
788
+ I,
789
+ " selected candidate",
790
+ I === 1 ? "" : "s",
791
+ " ",
792
+ "will be moved to this status."
793
+ ]
794
+ }),
795
+ /* @__PURE__ */ Y(i, { children: [/* @__PURE__ */ J(e, {
796
+ variant: "outline",
797
+ onClick: d,
798
+ disabled: M,
799
+ children: "Cancel"
800
+ }), /* @__PURE__ */ Y(e, {
801
+ onClick: () => void V(),
802
+ disabled: !B,
803
+ children: [M ? /* @__PURE__ */ J(G, {
804
+ size: 16,
805
+ className: "mr-2 animate-spin"
806
+ }) : /* @__PURE__ */ J(q, { size: 16 }), M ? "Updating…" : "Update Status"]
807
+ })] })
808
+ ]
809
+ })]
810
+ })
811
+ });
812
+ }
549
813
  //#endregion
550
- export { V as AddSelectedToRoundDialog, B as BulkCandidateSendDialog, H as NotifyDuplicateApplicantsDialog, R as isAssignmentRoundConfig };
814
+ export { we as AddSelectedToRoundDialog, Ce as BulkCandidateSendDialog, Ee as BulkCustomEmailDialog, De as BulkStatusUpdateDialog, Te as NotifyDuplicateApplicantsDialog, ye as isAssignmentRoundConfig };
551
815
 
552
816
  //# sourceMappingURL=BulkCandidateDialogs.js.map