hh-shipments 0.3.18 → 0.3.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "test": "node test/run-tests.js && node test/run-carriers-tests.js"
19
19
  },
20
20
  "type": "commonjs",
21
- "version": "0.3.18",
21
+ "version": "0.3.20",
22
22
  "bin": {
23
23
  "hh-shipments": "server.js"
24
24
  },
package/public/index.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
6
6
  <meta name="theme-color" content="#0a84ff">
7
- <meta name="app-version" content="0.3.18">
7
+ <meta name="app-version" content="0.3.20">
8
8
  <title>HH Shipments</title>
9
9
  <link rel="manifest" href="/manifest.webmanifest">
10
10
  <link rel="apple-touch-icon" href="/icon-192.png">
package/src/extract.js CHANGED
@@ -89,6 +89,27 @@
89
89
  if (looksLikeLabelName(cleaned)) { out.seller_name = cleaned; break; }
90
90
  }
91
91
  }
92
+ // Chat screenshots (Messenger): the other person's name is the header at
93
+ // the very top ("Abdullah Sohail"), above the message bubbles. OCR wraps
94
+ // it in garbage ("{® Abdullah Sohail LC Be"), so find the name *within*
95
+ // the top lines instead of requiring a clean line. Never Hunter's own
96
+ // name/address bubble, never app or chat UI words.
97
+ if (!out.seller_name) {
98
+ var cheadBlock = /\b(UPS|FEDEX|USPS|DHL|GROUND|EXPRESS|PRIORITY|BILLING|TRACKING|POSTAGE|LABEL|SHIPMENT|SHIP\b|SCREENSHOT|READING|FINDING|UPLOADING|EXTRACT|PASTE|DETAILS|SAVE|TAP|CLIPBOARD|NUMBER|BACK|HOME|ARCHIVE|SETTINGS|HUNTER|HILLS|THANK|THANKS|YOU|DELIVERED|SEEN|TYPING|AFTERMARKET|DISPLAY)\b/i;
99
+ var clines = String(text).split(/\r?\n/);
100
+ var checked = 0;
101
+ for (var ci = 0; ci < clines.length && checked < 8; ci++) {
102
+ var ch = clines[ci];
103
+ if (!ch || !ch.trim() || ch.length > 80) continue;
104
+ checked++;
105
+ if (/\d/.test(ch)) continue;
106
+ var nm = ch.match(/\b([A-Z][a-z]{2,}(?:\s+[A-Z][a-z]{2,}){1,2})\b/);
107
+ if (!nm) continue;
108
+ if (cheadBlock.test(nm[1])) continue;
109
+ out.seller_name = nm[1];
110
+ break;
111
+ }
112
+ }
92
113
  // Hunter's typed format: tracking number on one line, seller name on
93
114
  // another ("1Z...\nAbdullah S"). Typed text is trusted — take the first
94
115
  // plausible name line that isn't the number itself.