hh-shipments 0.3.22 → 0.3.23
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/app.js +11 -1
- package/public/index.html +1 -1
package/package.json
CHANGED
package/public/app.js
CHANGED
|
@@ -233,7 +233,7 @@ async function handlePhotoFile(f) {
|
|
|
233
233
|
target.innerHTML = `<div class="review"><img src="${url}" style="max-width:100%;border-radius:10px"><p class="muted" id="ocr-live-photo">📷 Scanning barcode…</p></div>`;
|
|
234
234
|
const live = $('ocr-live-photo');
|
|
235
235
|
const barcode = await decodeBarcode(f);
|
|
236
|
-
let text, preset, topText = null;
|
|
236
|
+
let text, preset, topText = null, upIdPhoto = null;
|
|
237
237
|
if (barcode) {
|
|
238
238
|
text = barcode;
|
|
239
239
|
if (live) live.textContent = '📷 Barcode read — reading sender…';
|
|
@@ -244,6 +244,7 @@ async function handlePhotoFile(f) {
|
|
|
244
244
|
topText = await ocrTopStrip(orig, $('ocr-status'));
|
|
245
245
|
const up = await upPromise;
|
|
246
246
|
if (!up.ok) throw new Error('upload failed');
|
|
247
|
+
upIdPhoto = await up.json().then((j) => j.id).catch(() => null);
|
|
247
248
|
preset = topText ? { labelText: topText } : undefined;
|
|
248
249
|
} else {
|
|
249
250
|
if (live) live.textContent = '📖 Reading screenshot…';
|
|
@@ -255,8 +256,11 @@ async function handlePhotoFile(f) {
|
|
|
255
256
|
try { up = await fetchTimeout('/api/intake/image', { method: 'POST', body: fd }, 60000); }
|
|
256
257
|
catch (e) { throw new Error('upload timed out — check your connection and try again'); }
|
|
257
258
|
if (!up.ok) throw new Error('upload failed');
|
|
259
|
+
upIdPhoto = await up.json().then((j) => j.id).catch(() => null);
|
|
258
260
|
}
|
|
259
261
|
const r = await runQuick(text, $('photo-result'), preset);
|
|
262
|
+
// Photo flow already handled this image — don't leave it nagging in the review queue.
|
|
263
|
+
if (upIdPhoto) api.patch('/api/intake/' + upIdPhoto, { state: 'reviewed' }).catch(() => {});
|
|
260
264
|
if (looksLikeAppScreenshot(topText || text)) $('photo-result').insertAdjacentHTML('afterbegin', '<p class="warn">⚠️ This looks like a screenshot of the app itself — choose the label photo directly for best results.</p>');
|
|
261
265
|
if (barcode && r && r.added.length) $('photo-result').insertAdjacentHTML('afterbegin', '<p class="muted">📷 Read from the barcode — checksum verified.</p>');
|
|
262
266
|
if (r && !r.added.length && !r.duplicates.length && !r.needs_review.some((c) => c.carrier && c.carrier !== 'unknown')) showOcrRead($('photo-result'), text);
|
|
@@ -432,8 +436,11 @@ async function handlePastedImageFile(f) {
|
|
|
432
436
|
const topText = await ocrTopStrip(orig, $('ocr-status-paste'));
|
|
433
437
|
const up = await upPromise;
|
|
434
438
|
if (!up.ok) throw new Error('upload failed');
|
|
439
|
+
const upId = await up.json().then((j) => j.id).catch(() => null);
|
|
435
440
|
if (live) live.textContent = '🔍 Finding tracking number…';
|
|
436
441
|
const r = await runQuick(text, target, topText ? { labelText: topText } : undefined);
|
|
442
|
+
// Paste flow already handled this image — don't leave it nagging in the review queue.
|
|
443
|
+
if (upId) api.patch('/api/intake/' + upId, { state: 'reviewed' }).catch(() => {});
|
|
437
444
|
if (looksLikeAppScreenshot(topText)) target.insertAdjacentHTML('afterbegin', '<p class="warn">⚠️ This looks like a screenshot of the app itself — paste the label photo directly for best results.</p>');
|
|
438
445
|
if (r && r.added.length) target.insertAdjacentHTML('afterbegin', '<p class="muted">📷 Read from the barcode — checksum verified.</p>');
|
|
439
446
|
if (r && !r.added.length && !r.duplicates.length && !r.needs_review.some((c) => c.carrier && c.carrier !== 'unknown')) showOcrRead(target, text);
|
|
@@ -449,8 +456,11 @@ async function handlePastedImageFile(f) {
|
|
|
449
456
|
try { up = await fetchTimeout('/api/intake/image', { method: 'POST', body: fd }, 60000); }
|
|
450
457
|
catch (e) { throw new Error('upload timed out — check your connection and try again'); }
|
|
451
458
|
if (!up.ok) throw new Error('upload failed');
|
|
459
|
+
const upId2 = await up.json().then((j) => j.id).catch(() => null);
|
|
452
460
|
if (live) live.textContent = '🔍 Finding tracking number…';
|
|
453
461
|
const r = await runQuick(text, target);
|
|
462
|
+
// Paste flow already handled this image — don't leave it nagging in the review queue.
|
|
463
|
+
if (upId2) api.patch('/api/intake/' + upId2, { state: 'reviewed' }).catch(() => {});
|
|
454
464
|
if (looksLikeAppScreenshot(text)) target.insertAdjacentHTML('afterbegin', '<p class="warn">⚠️ This looks like a screenshot of the app itself — paste the label photo directly for best results.</p>');
|
|
455
465
|
if (r && !r.added.length && !r.duplicates.length && !r.needs_review.some((c) => c.carrier && c.carrier !== 'unknown')) showOcrRead(target, text);
|
|
456
466
|
} catch (err) { $('ocr-status-paste').textContent = ''; target.innerHTML = `<p class="error">${esc(err.message)}</p>`; }
|
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.23">
|
|
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">
|