hh-shipments 0.3.18 → 0.3.19
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 +1 -1
- package/public/index.html +1 -1
- package/src/extract.js +23 -0
package/package.json
CHANGED
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.
|
|
7
|
+
<meta name="app-version" content="0.3.19">
|
|
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,29 @@
|
|
|
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. Take the
|
|
94
|
+
// first title-case name in the top lines — never Hunter's own name /
|
|
95
|
+
// address bubble, never app or chat UI words.
|
|
96
|
+
if (!out.seller_name) {
|
|
97
|
+
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;
|
|
98
|
+
var clines = String(text).split(/\r?\n/);
|
|
99
|
+
var checked = 0;
|
|
100
|
+
for (var ci = 0; ci < clines.length && checked < 6; ci++) {
|
|
101
|
+
var ch = clines[ci].trim();
|
|
102
|
+
if (!ch || ch.length > 40) continue;
|
|
103
|
+
checked++;
|
|
104
|
+
if (/\d/.test(ch)) continue;
|
|
105
|
+
var cw = ch.split(/\s+/);
|
|
106
|
+
if (cw.length < 2 || cw.length > 3) continue;
|
|
107
|
+
var cok = true;
|
|
108
|
+
for (var cj = 0; cj < cw.length; cj++) if (!/^[A-Z][a-z]{2,}$/.test(cw[cj])) { cok = false; break; }
|
|
109
|
+
if (!cok) continue;
|
|
110
|
+
if (cheadBlock.test(ch)) continue;
|
|
111
|
+
out.seller_name = ch;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
92
115
|
// Hunter's typed format: tracking number on one line, seller name on
|
|
93
116
|
// another ("1Z...\nAbdullah S"). Typed text is trusted — take the first
|
|
94
117
|
// plausible name line that isn't the number itself.
|