job-pro 1.0.90 → 1.0.91

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.
Files changed (2) hide show
  1. package/dist/apply.js +17 -11
  2. package/package.json +1 -1
package/dist/apply.js CHANGED
@@ -1208,11 +1208,6 @@ export async function executeCdpRealBrowser(staged, session, target) {
1208
1208
  if (!existsSync(resumeField.value)) {
1209
1209
  return { ok: false, posted_to: targetUrl, message: `resume file not found: ${resumeField.value}`, steps };
1210
1210
  }
1211
- const applicant = {};
1212
- for (const f of staged.staged) {
1213
- if (f.name === "name" || f.name === "email" || f.name === "phone")
1214
- applicant[f.name] = f.value;
1215
- }
1216
1211
  const r = await withPage(async (page) => {
1217
1212
  await page.goto(targetUrl, { waitUntil: "networkidle2", timeout: 30000 });
1218
1213
  steps.push({
@@ -1268,18 +1263,29 @@ export async function executeCdpRealBrowser(staged, session, target) {
1268
1263
  return { kind: "no-form" };
1269
1264
  }
1270
1265
  steps.push({ step: "wait-form", url: page.url(), status: 200, ok: true, message: "modal rendered" });
1271
- // Fill name/email/phone if matching inputs exist.
1272
- for (const [key, value] of Object.entries(applicant)) {
1273
- if (!value)
1266
+ // Fill every staged non-file field. The schema layer normalises field
1267
+ // names to whatever the upstream API expects (first_name, last_name,
1268
+ // email, phone, question_XXX for Greenhouse custom questions, name/
1269
+ // email/phone for Feishu, etc.) — so input[name="<f.name>"] usually
1270
+ // matches. Falls back to placeholder / aria-label / id contains-match.
1271
+ let filled = 0, missed = 0;
1272
+ for (const f of staged.staged) {
1273
+ if (f.type === "input_file")
1274
+ continue;
1275
+ if (!f.value)
1274
1276
  continue;
1275
1277
  try {
1276
- const sel = `input[name="${key}"], input[placeholder*="${key}"], input[aria-label*="${key}"]`;
1277
- await page.type(sel, value, { delay: 30 });
1278
+ const sel = `input[name="${f.name}"], textarea[name="${f.name}"], ` +
1279
+ `input[id="${f.name}"], textarea[id="${f.name}"], ` +
1280
+ `input[placeholder*="${f.name}"], input[aria-label*="${f.name}"]`;
1281
+ await page.type(sel, f.value, { delay: 20 });
1282
+ filled++;
1278
1283
  }
1279
1284
  catch {
1280
- steps.push({ step: `fill-${key}`, url: page.url(), status: 0, ok: false, message: "selector not found" });
1285
+ missed++;
1281
1286
  }
1282
1287
  }
1288
+ steps.push({ step: "fill-fields", url: page.url(), status: 200, ok: filled > 0, message: `filled ${filled}, missed ${missed}` });
1283
1289
  // Upload resume.
1284
1290
  try {
1285
1291
  const fileInput = await page.$('input[type=file]');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "job-pro",
3
- "version": "1.0.90",
3
+ "version": "1.0.91",
4
4
  "description": "Query Chinese big-tech campus recruiting + auto-apply from your terminal. 50 companies, all 50 live (46 via official APIs, 4 via Liepin third-party fallback). 45/50 with end-to-end verified apply endpoints; 5 structurally-external (Liepin IM × 4 + Unitree WeChat). No signup, no token, no server.",
5
5
  "homepage": "https://job.ha7ch.com",
6
6
  "repository": "https://github.com/HA7CH/job-pro",