Update Extension files and add deploy script

This commit is contained in:
2026-01-18 17:31:18 +01:00
parent ed9a75a1dc
commit 86d2191a25
4 changed files with 664 additions and 16 deletions

View File

@@ -218,10 +218,34 @@ async function handleScanProductsRequest(url, accountId, sendResponse) {
// Send parse message to content script
chrome.tabs.sendMessage(tabId, { action: "PARSE_PRODUCT_LIST" })
.then(response => {
if (response && response.ok && response.data) {
handleScanComplete(tabId, response.data);
if (response && response.ok) {
// Prüfe ob items vorhanden und nicht leer
const items = response.items || response.data?.items || [];
const meta = response.meta || response.data?.meta || {};
// Log meta für Debugging
console.log("[SCAN meta]", meta);
if (items.length === 0) {
// Leere items: behandele als Fehler mit meta
cleanupScanRequest(tabId, null, {
ok: false,
error: "empty_items",
meta: meta
});
} else {
// Erfolg: sende items + meta
handleScanComplete(tabId, { items, meta });
}
} else {
cleanupScanRequest(tabId, null, { ok: false, error: response?.error || "Parsing failed" });
// Fehler: sende error + meta
const meta = response?.meta || {};
console.log("[SCAN meta]", meta);
cleanupScanRequest(tabId, null, {
ok: false,
error: response?.error || "Parsing failed",
meta: meta
});
}
})
.catch(err => {
@@ -273,8 +297,10 @@ async function cleanupScanRequest(tabId, data, error) {
// Send response
if (request.sendResponse) {
if (error) {
// error kann bereits meta enthalten
request.sendResponse(error);
} else if (data) {
// data kann items + meta enthalten
request.sendResponse({ ok: true, data: data });
} else {
request.sendResponse({ ok: false, error: "Unknown error" });