@hadoku/jobplatform 3.42.69 → 3.42.71

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,306 +0,0 @@
1
- import { jsxs as s, jsx as t, Fragment as U } from "react/jsx-runtime";
2
- import { useState as m, useEffect as R, useMemo as I } from "react";
3
- import { J as k, u as q, i as v, h as B } from "./entry-D7QDbdxu.js";
4
- import { i as J, g as O } from "./pipeline-Es-b-u_8.js";
5
- const Y = [
6
- { value: "saved", label: "Saved" },
7
- { value: "interested", label: "Interested" },
8
- { value: "applied", label: "Applied" },
9
- { value: "interviewing", label: "Interviewing" }
10
- ];
11
- function G({
12
- auth: e,
13
- onImported: n,
14
- onOpen: p
15
- }) {
16
- const [o, h] = m(""), [c, f] = m("saved"), [r, g] = m(!1), [u, b] = m(null), [y, N] = m(null), w = async () => {
17
- if (!(!o.trim() || r)) {
18
- g(!0), N(null), b(null);
19
- try {
20
- const d = await J(o.trim(), c, e);
21
- b(d), h(""), n();
22
- } catch (d) {
23
- N(d instanceof k ? d.message : "Import failed");
24
- } finally {
25
- g(!1);
26
- }
27
- }
28
- };
29
- return /* @__PURE__ */ s("div", { className: "jp-import", "data-testid": "import-posting", children: [
30
- /* @__PURE__ */ s(
31
- "form",
32
- {
33
- className: "jp-import__form",
34
- onSubmit: (d) => {
35
- d.preventDefault(), w();
36
- },
37
- children: [
38
- /* @__PURE__ */ t(
39
- "input",
40
- {
41
- type: "url",
42
- className: "jp-jobs__search",
43
- placeholder: "Add a posting by URL — Greenhouse, Lever, Ashby or a company careers page",
44
- value: o,
45
- onChange: (d) => h(d.target.value),
46
- "aria-label": "Posting URL",
47
- required: !0
48
- }
49
- ),
50
- /* @__PURE__ */ t(
51
- "select",
52
- {
53
- className: "jp-import__state",
54
- value: c,
55
- onChange: (d) => f(d.target.value),
56
- "aria-label": "Add it as",
57
- children: Y.map((d) => /* @__PURE__ */ t("option", { value: d.value, children: d.label }, d.value))
58
- }
59
- ),
60
- /* @__PURE__ */ t(
61
- "button",
62
- {
63
- type: "submit",
64
- className: "jp-drawer__cta jp-drawer__cta--primary",
65
- disabled: r || !o.trim(),
66
- children: r ? "Reading the posting…" : "Add"
67
- }
68
- )
69
- ]
70
- }
71
- ),
72
- y && /* @__PURE__ */ t("p", { className: "jp-error", children: y }),
73
- u && /* @__PURE__ */ s("p", { className: "jp-import__done", "data-testid": "import-result", children: [
74
- u.already_tracked ? `Already in your pipeline as ${u.state}: ` : `Added as ${u.state}: `,
75
- /* @__PURE__ */ s("button", { type: "button", className: "jp-drawer__link", onClick: () => p(u.job.id), children: [
76
- u.job.company,
77
- " — ",
78
- u.job.title
79
- ] }),
80
- !u.created && !u.already_tracked && /* @__PURE__ */ t("span", { className: "jp-muted", children: " (it was already in the feed)" })
81
- ] })
82
- ] });
83
- }
84
- const F = [
85
- { state: "interested", label: "Interested" },
86
- { state: "saved", label: "Saved" },
87
- { state: "applied", label: "Applied" },
88
- { state: "interviewing", label: "Interviewing" },
89
- { state: "offered", label: "Offered" },
90
- { state: "rejected", label: "Rejected" }
91
- ], H = { 1: "High", 3: "Low" };
92
- function Q() {
93
- const e = /* @__PURE__ */ new Date(), n = (p) => String(p).padStart(2, "0");
94
- return `${e.getFullYear()}-${n(e.getMonth() + 1)}-${n(e.getDate())}`;
95
- }
96
- function D(e) {
97
- const n = /^\d{4}-\d{2}-\d{2}$/.test(e) ? /* @__PURE__ */ new Date(`${e}T00:00:00`) : new Date(e);
98
- return Number.isNaN(n.getTime()) ? e : n.toLocaleDateString(void 0, { month: "short", day: "numeric" });
99
- }
100
- function z(e, n) {
101
- const p = e.tracking.priority ?? 2, o = n.tracking.priority ?? 2;
102
- if (p !== o) return p - o;
103
- const h = e.tracking.follow_up_at ?? "9999", c = n.tracking.follow_up_at ?? "9999";
104
- return h !== c ? h < c ? -1 : 1 : e.updated_at < n.updated_at ? 1 : -1;
105
- }
106
- function K({ date: e, today: n }) {
107
- const p = e < n ? "overdue" : e === n ? "today" : "upcoming", o = p === "overdue" ? `Follow up — was ${D(e)}` : p === "today" ? "Follow up today" : `Follow up ${D(e)}`;
108
- return /* @__PURE__ */ t("span", { className: `jp-pipe-chip jp-pipe-chip--${p}`, "data-testid": "pipe-follow-up", children: o });
109
- }
110
- function V({
111
- item: e,
112
- today: n,
113
- onSelect: p,
114
- onMove: o,
115
- moving: h
116
- }) {
117
- const c = e.tracking.priority, f = c === 1 || c === 3 ? H[c] : null;
118
- return /* @__PURE__ */ s(
119
- "li",
120
- {
121
- className: `jp-pipe-card${h ? " jp-pipe-card--moving" : ""}`,
122
- draggable: !h,
123
- onDragStart: (r) => {
124
- r.dataTransfer.setData("text/plain", e.job_id), r.dataTransfer.effectAllowed = "move";
125
- },
126
- "data-testid": "pipe-card",
127
- "data-job-id": e.job_id,
128
- children: [
129
- /* @__PURE__ */ s(
130
- "div",
131
- {
132
- role: "button",
133
- tabIndex: 0,
134
- className: "jp-pipe-card__open",
135
- onClick: () => p(e.job_id),
136
- onKeyDown: (r) => {
137
- r.target === r.currentTarget && (r.key === "Enter" || r.key === " ") && (r.preventDefault(), p(e.job_id));
138
- },
139
- children: [
140
- /* @__PURE__ */ s("div", { className: "jp-pipe-card__head", children: [
141
- /* @__PURE__ */ t("span", { className: "jp-pipe-card__company", children: e.company }),
142
- f && /* @__PURE__ */ t("span", { className: `jp-pipe-chip jp-pipe-chip--priority-${c}`, children: f })
143
- ] }),
144
- /* @__PURE__ */ t("span", { className: "jp-pipe-card__title", children: e.title }),
145
- /* @__PURE__ */ s("span", { className: "jp-pipe-card__meta", children: [
146
- e.applied_at ? `Applied ${D(e.applied_at)}` : `Updated ${D(e.updated_at)}`,
147
- e.location && ` · ${e.location}`
148
- ] }),
149
- (e.tracking.follow_up_at ?? e.application_status ?? e.tracking.contact_name) && /* @__PURE__ */ s("div", { className: "jp-pipe-card__chips", children: [
150
- e.tracking.follow_up_at && /* @__PURE__ */ t(K, { date: e.tracking.follow_up_at, today: n }),
151
- e.application_status && /* @__PURE__ */ s("span", { className: "jp-pipe-chip jp-pipe-chip--neutral", title: "Apply queue status", children: [
152
- "Runner: ",
153
- e.application_status.replace("_", " ")
154
- ] }),
155
- e.tracking.contact_name && /* @__PURE__ */ t("span", { className: "jp-pipe-chip jp-pipe-chip--neutral", children: e.tracking.contact_name })
156
- ] })
157
- ]
158
- }
159
- ),
160
- /* @__PURE__ */ s(
161
- "select",
162
- {
163
- className: "jp-pipe-card__move",
164
- "aria-label": `Move ${e.company} — ${e.title}`,
165
- value: e.state,
166
- disabled: h,
167
- onChange: (r) => o(e.job_id, r.target.value),
168
- children: [
169
- F.map((r) => /* @__PURE__ */ t("option", { value: r.state, children: r.label }, r.state)),
170
- /* @__PURE__ */ t("option", { value: "dismissed", children: "Dismiss" })
171
- ]
172
- }
173
- )
174
- ]
175
- }
176
- );
177
- }
178
- function ae({ auth: e, onSelect: n, reloadKey: p }) {
179
- const {
180
- data: o,
181
- loading: h,
182
- error: c,
183
- reload: f
184
- } = q("pipeline", () => O(e)), [r, g] = m({}), [u, b] = m(/* @__PURE__ */ new Set()), [y, N] = m(null), [w, d] = m(""), [A, L] = m(null), S = Q();
185
- R(() => {
186
- p !== 0 && (v("pipeline"), f());
187
- }, [p]), R(() => g({}), [o]);
188
- const $ = I(() => {
189
- const a = w.trim().toLowerCase();
190
- return (o ?? []).map((i) => r[i.job_id] ? { ...i, state: r[i.job_id] } : i).filter((i) => i.state !== "dismissed").filter((i) => !a || i.company.toLowerCase().includes(a) || i.title.toLowerCase().includes(a));
191
- }, [o, r, w]), T = $.filter((a) => a.tracking.follow_up_at && a.tracking.follow_up_at <= S), C = async (a, i) => {
192
- const l = $.find((_) => _.job_id === a);
193
- if (!(!l || l.state === i || u.has(a))) {
194
- N(null), g((_) => ({ ..._, [a]: i })), b((_) => new Set(_).add(a));
195
- try {
196
- await B(a, i, e), v(`job:${a}:`), v("jobs:"), v("pipeline"), f();
197
- } catch (_) {
198
- g((j) => {
199
- const x = { ...j };
200
- return delete x[a], x;
201
- }), N(
202
- `Could not move ${l.company}: ${_ instanceof k ? _.message : "request failed"}`
203
- );
204
- } finally {
205
- b((_) => {
206
- const j = new Set(_);
207
- return j.delete(a), j;
208
- });
209
- }
210
- }
211
- }, M = (a) => (i) => {
212
- i.preventDefault(), L(null);
213
- const l = i.dataTransfer.getData("text/plain");
214
- l && C(l, a);
215
- }, P = c instanceof k && c.status === 403;
216
- if (h) return /* @__PURE__ */ t("p", { className: "jp-muted", children: "Loading your pipeline…" });
217
- if (P)
218
- return /* @__PURE__ */ t("p", { className: "jp-muted", children: "The pipeline is per-account — sign in to see yours." });
219
- if (c)
220
- return /* @__PURE__ */ t("p", { className: "jp-error", children: c instanceof k ? c.message : "Failed to load the pipeline" });
221
- const E = /* @__PURE__ */ t(
222
- G,
223
- {
224
- auth: e,
225
- onOpen: n,
226
- onImported: () => {
227
- v("pipeline"), v("jobs:"), f();
228
- }
229
- }
230
- );
231
- return (o ?? []).length === 0 ? /* @__PURE__ */ s("div", { className: "jp-pipe", children: [
232
- E,
233
- /* @__PURE__ */ t("p", { className: "jp-muted", children: "Nothing in your pipeline yet. Mark a posting interested, save it or apply from the feed, or add one by URL above, and it lands here." })
234
- ] }) : /* @__PURE__ */ s("div", { className: "jp-pipe", children: [
235
- E,
236
- /* @__PURE__ */ s("div", { className: "jp-pipe__toolbar", children: [
237
- /* @__PURE__ */ t(
238
- "input",
239
- {
240
- type: "search",
241
- className: "jp-jobs__search",
242
- placeholder: "Filter by company or title",
243
- value: w,
244
- onChange: (a) => d(a.target.value),
245
- "aria-label": "Filter the pipeline"
246
- }
247
- ),
248
- /* @__PURE__ */ s("span", { className: "jp-pipe__summary", "data-testid": "pipe-summary", children: [
249
- $.length,
250
- " in play",
251
- T.length > 0 && /* @__PURE__ */ s(U, { children: [
252
- " · ",
253
- /* @__PURE__ */ s("strong", { children: [
254
- T.length,
255
- " follow-up",
256
- T.length === 1 ? "" : "s",
257
- " due"
258
- ] })
259
- ] })
260
- ] })
261
- ] }),
262
- y && /* @__PURE__ */ t("p", { className: "jp-error", children: y }),
263
- /* @__PURE__ */ t("div", { className: "jp-pipe__board", children: F.map((a) => {
264
- const i = $.filter((l) => l.state === a.state).sort(z);
265
- return /* @__PURE__ */ s(
266
- "section",
267
- {
268
- className: `jp-pipe__col jp-pipe__col--${a.state}${A === a.state ? " jp-pipe__col--drop" : ""}`,
269
- "aria-label": a.label,
270
- "data-testid": `pipe-col-${a.state}`,
271
- onDragOver: (l) => {
272
- l.preventDefault(), l.dataTransfer.dropEffect = "move", A !== a.state && L(a.state);
273
- },
274
- onDragLeave: (l) => {
275
- l.currentTarget.contains(l.relatedTarget) || L(null);
276
- },
277
- onDrop: M(a.state),
278
- children: [
279
- /* @__PURE__ */ s("h3", { className: "jp-pipe__col-head", children: [
280
- /* @__PURE__ */ t("span", { className: `jp-jobcard__state jp-jobcard__state--${a.state}`, children: a.label }),
281
- /* @__PURE__ */ t("span", { className: "jp-pipe__count", children: i.length })
282
- ] }),
283
- /* @__PURE__ */ t("ul", { className: "jp-pipe__cards", children: i.map((l) => /* @__PURE__ */ t(
284
- V,
285
- {
286
- item: l,
287
- today: S,
288
- onSelect: n,
289
- onMove: (_, j) => {
290
- C(_, j);
291
- },
292
- moving: u.has(l.job_id)
293
- },
294
- l.job_id
295
- )) })
296
- ]
297
- },
298
- a.state
299
- );
300
- }) })
301
- ] });
302
- }
303
- export {
304
- F as PIPELINE_COLUMNS,
305
- ae as PipelineBoard
306
- };