Fix QR detection (parallel loops), price extraction, and camera pre-warm
QR scanning: - Run BarcodeDetector and jsQR in parallel — jsQR starts after JSQR_DELAY_MS (1.5 s) so both decode simultaneously. BarcodeDetector silently returns empty arrays for some QR variants; running jsQR in parallel via a separate rAF loop (rafId2) and its own off-screen canvas catches those cases. First decoder to find anything calls handleQrResult and sets qrFound = true; the other stops. Price extraction (two bugs): - ScanLabel: unitPrice was catalogMatch?.UnitPrice ?? 0m, ignoring aiResult .UnitCostPerLb entirely when no catalog match — changed to fall through to AI result - AppendOffer: only read JSON-LD "price" field; Shopify AggregateOffer uses "lowPrice" instead — now checked as fallback so Prismatic Powders prices are found Camera pre-warm: - Reverted localStorage approach (caused getUserMedia to fire on every page load, showing Chrome's "Ask" prompt immediately before user clicked anything) - Restored Permissions API gate: preWarmCamera only calls getUserMedia when navigator.permissions.query returns 'granted', never risks a page-load prompt Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -848,7 +848,7 @@ public class InventoryController : Controller
|
||||
requiresClearCoat = catalogMatch?.RequiresClearCoat ?? aiResult.RequiresClearCoat,
|
||||
coverageSqFtPerLb = catalogMatch?.CoverageSqFtPerLb ?? aiResult.CoverageSqFtPerLb,
|
||||
transferEfficiency = catalogMatch?.TransferEfficiency ?? aiResult.TransferEfficiency,
|
||||
unitPrice = catalogMatch?.UnitPrice ?? 0m,
|
||||
unitPrice = catalogMatch?.UnitPrice ?? aiResult.UnitCostPerLb ?? 0m,
|
||||
imageUrl = catalogMatch?.ImageUrl ?? aiResult.ImageUrl,
|
||||
productUrl = catalogMatch?.ProductUrl ?? aiResult.SpecPageUrl,
|
||||
sdsUrl = catalogMatch?.SdsUrl ?? aiResult.SdsUrl,
|
||||
|
||||
Reference in New Issue
Block a user