From 530bf6cff826b1136fcaf38e507335b72982229c Mon Sep 17 00:00:00 2001 From: alectimison-maker Date: Fri, 31 Jul 2026 13:38:09 +0800 Subject: [PATCH] agent: add adapter for Allegro --- src/chrome/src/agent/adapters.js | 14 ++++++++++++ src/firefox/src/agent/adapters.js | 14 ++++++++++++ test/run.js | 37 +++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) diff --git a/src/chrome/src/agent/adapters.js b/src/chrome/src/agent/adapters.js index fcdb91584..37709fb37 100644 --- a/src/chrome/src/agent/adapters.js +++ b/src/chrome/src/agent/adapters.js @@ -16337,6 +16337,20 @@ const ADAPTERS = [ - "ポイント", SPU, and スーパーDEAL are conditional rewards, not an immediate cash-price reduction; campaigns may require entry, membership, payment methods, or have caps, and shipping/tax do not earn ordinary points. Report the payable total separately from expected points.`, }, + // ─── Regional — Allegro (Poland) ───────────────────────────────────── + { + name: 'allegro', + category: 'general', + matches: (url) => /^https?:\/\/(www\.)?allegro\.pl\//.test(url), + notes: ` +- As of 2026-07, Allegro.pl is a Polish MARKETPLACE. Stable labels: "dodaj do koszyka" = add to cart, "dostawa i płatność" = delivery and payment, and "kup i zapłać" = buy and pay. +- Search placements marked "Sponsorowane" or "Promowane" are paid placements. For price comparisons choose "cena z dostawą: od najniższej" and compare the delivered total, not the default relevance order or bare item price. +- Product cards can group variants and sellers: "dostępne warianty" means variants are available, while "zobacz N ofert" opens the other offers for that product. Select the exact variant and compare seller, delivery date, and delivered price before choosing. +- The cart can contain products from multiple sellers and groups them by seller. All added products are selected by default, adding does not reserve stock, and delivery is still calculated per seller; re-check the selected rows and totals before continuing. +- "kup i zapłać" is the quick-purchase path and skips the delivery/payment form by reusing saved choices. Do not click it for collection or comparison tasks; use the cart and "dostawa i płatność" when the user wants to review details first. +- Smart! free delivery is conditional on an eligible offer, one seller's qualifying total, the selected delivery method, and the account's current terms. Verify the Smart! badge and cart delivery charge instead of promising free delivery from the badge alone.`, + }, + // ─── Regional — Türkiye (TR) ────────────────────────────────────────── // Regional adapters are the project's #1 wanted contribution (CONTRIBUTING.md); // Türkiye is top of the priority list. Add more TR sites (trendyol, diff --git a/src/firefox/src/agent/adapters.js b/src/firefox/src/agent/adapters.js index 514726e1a..1027791f3 100644 --- a/src/firefox/src/agent/adapters.js +++ b/src/firefox/src/agent/adapters.js @@ -16335,6 +16335,20 @@ const ADAPTERS = [ - "ポイント", SPU, and スーパーDEAL are conditional rewards, not an immediate cash-price reduction; campaigns may require entry, membership, payment methods, or have caps, and shipping/tax do not earn ordinary points. Report the payable total separately from expected points.`, }, + // ─── Regional — Allegro (Poland) ───────────────────────────────────── + { + name: 'allegro', + category: 'general', + matches: (url) => /^https?:\/\/(www\.)?allegro\.pl\//.test(url), + notes: ` +- As of 2026-07, Allegro.pl is a Polish MARKETPLACE. Stable labels: "dodaj do koszyka" = add to cart, "dostawa i płatność" = delivery and payment, and "kup i zapłać" = buy and pay. +- Search placements marked "Sponsorowane" or "Promowane" are paid placements. For price comparisons choose "cena z dostawą: od najniższej" and compare the delivered total, not the default relevance order or bare item price. +- Product cards can group variants and sellers: "dostępne warianty" means variants are available, while "zobacz N ofert" opens the other offers for that product. Select the exact variant and compare seller, delivery date, and delivered price before choosing. +- The cart can contain products from multiple sellers and groups them by seller. All added products are selected by default, adding does not reserve stock, and delivery is still calculated per seller; re-check the selected rows and totals before continuing. +- "kup i zapłać" is the quick-purchase path and skips the delivery/payment form by reusing saved choices. Do not click it for collection or comparison tasks; use the cart and "dostawa i płatność" when the user wants to review details first. +- Smart! free delivery is conditional on an eligible offer, one seller's qualifying total, the selected delivery method, and the account's current terms. Verify the Smart! badge and cart delivery charge instead of promising free delivery from the badge alone.`, + }, + // ─── Regional — Türkiye (TR) ────────────────────────────────────────── // Regional adapters are the project's #1 wanted contribution (CONTRIBUTING.md); // Türkiye is top of the priority list. Add more TR sites (trendyol, diff --git a/test/run.js b/test/run.js index d8046e693..e4c741d72 100644 --- a/test/run.js +++ b/test/run.js @@ -2575,6 +2575,43 @@ test('matches Rakuten Ichiba shopping surfaces and includes marketplace guidance assert.equal(firefoxAdapter?.notes, adapter?.notes); }); +test('matches Allegro.pl shopping surfaces and includes Polish marketplace guidance', () => { + const trustedUrls = [ + 'https://allegro.pl/', + 'https://www.allegro.pl/listing?string=sluchawki', + 'https://allegro.pl/oferta/example-product-123456789', + 'https://allegro.pl/koszyk', + ]; + for (const url of trustedUrls) { + assert.equal(getActiveAdapter(url)?.name, 'allegro'); + assert.equal(getActiveAdapterFx(url)?.name, 'allegro'); + } + + const rejectedUrls = [ + 'https://allegrolokalnie.pl/oferta/example', + 'https://allegro.cz/listing?string=sluchawki', + 'https://allegro.pl.phishing.example/oferta/example', + 'https://example.com/allegro.pl/oferta/example', + ]; + for (const url of rejectedUrls) { + assert.notEqual(getActiveAdapter(url)?.name, 'allegro'); + assert.notEqual(getActiveAdapterFx(url)?.name, 'allegro'); + } + + const adapter = getActiveAdapter('https://allegro.pl/listing?string=sluchawki'); + const firefoxAdapter = getActiveAdapterFx('https://allegro.pl/oferta/example-product-123456789'); + assert.match(adapter?.notes || '', /2026-07/); + assert.match(adapter?.notes || '', /MARKETPLACE/); + assert.match(adapter?.notes || '', /Sponsorowane/); + assert.match(adapter?.notes || '', /Promowane/); + assert.match(adapter?.notes || '', /cena z dostawą: od najniższej/); + assert.match(adapter?.notes || '', /zobacz N ofert/); + assert.match(adapter?.notes || '', /kup i zapłać/); + assert.match(adapter?.notes || '', /dostawa i płatność/); + assert.match(adapter?.notes || '', /Smart!/); + assert.equal(firefoxAdapter?.notes, adapter?.notes); +}); + test('matches sahibinden.com and includes anti-bot guidance', () => { assert.equal(getActiveAdapter('https://www.sahibinden.com/')?.name, 'sahibinden'); assert.equal(getActiveAdapter('https://sahibinden.com/kategori/vasita')?.name, 'sahibinden');