Skip to content

Commit 101449b

Browse files
authored
Merge pull request #2607 from alectimison-maker/agent/add-mercado-libre-adapter
agent: add adapter for Mercado Libre
2 parents fc4b3fc + 83cea01 commit 101449b

3 files changed

Lines changed: 74 additions & 0 deletions

File tree

src/chrome/src/agent/adapters.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16279,6 +16279,21 @@ const ADAPTERS = [
1627916279
- Pre-orders / "Made to order" listings have a longer ship date — surface that to the user before buying.`,
1628016280
},
1628116281

16282+
// ─── Regional — Mercado Libre / Mercado Livre (LATAM) ────────────────
16283+
// Start with the AR, MX, and BR storefronts requested in CONTRIBUTING.md.
16284+
// Other country sites need separate localization research before inclusion.
16285+
{
16286+
name: 'mercado-libre',
16287+
category: 'general',
16288+
matches: (url) => /^https?:\/\/(?:[a-z0-9-]+\.)*(?:mercadolibre\.com\.(?:ar|mx)|mercadolivre\.com\.br)\//.test(url),
16289+
notes: `
16290+
- Multi-seller MARKETPLACE. As of 2026-07 the buy controls are AR/MX "Comprar ahora" / "Agregar al carrito" / "Otras opciones de compra"; BR "Comprar agora" / "Adicionar ao carrinho" / "Outras opções de compra". Use one locale's labels, never a blend of the two.
16291+
- Catalog pages (path contains /p/MLA…, /p/MLM…, /p/MLB…) group MANY sellers under one product: the buy box is ONE offer, and "Otras opciones de compra"/"Outras opções de compra" lists the rest at different prices and arrival dates — open it before quoting a price. Single-seller listings (articulo.mercadolibre.com.*, produto.mercadolivre.com.br, paths ending -_JM) have no such list.
16292+
- Shipping cost and arrival date are computed from the destination "código postal" (AR/MX) / "CEP" (BR) and differ per seller. Set it before stating either, and re-check in the cart.
16293+
- Buy-now hands off to a Mercado Pago host where this guidance stops applying — confirm the final total there.
16294+
- Search hosts (listado.mercadolibre.com.ar, listado.mercadolibre.com.mx, lista.mercadolivre.com.br) can redirect automation to /gz/account-verification. If that wall appears, STOP and ask the user to complete it manually — do not retry, bypass, or claim results were read.`,
16295+
},
16296+
1628216297
// ─── Regional — Türkiye (TR) ──────────────────────────────────────────
1628316298
// Regional adapters are the project's #1 wanted contribution (CONTRIBUTING.md);
1628416299
// Türkiye is top of the priority list. Add more TR sites (trendyol,

src/firefox/src/agent/adapters.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16277,6 +16277,21 @@ const ADAPTERS = [
1627716277
- Pre-orders / "Made to order" listings have a longer ship date — surface that to the user before buying.`,
1627816278
},
1627916279

16280+
// ─── Regional — Mercado Libre / Mercado Livre (LATAM) ────────────────
16281+
// Start with the AR, MX, and BR storefronts requested in CONTRIBUTING.md.
16282+
// Other country sites need separate localization research before inclusion.
16283+
{
16284+
name: 'mercado-libre',
16285+
category: 'general',
16286+
matches: (url) => /^https?:\/\/(?:[a-z0-9-]+\.)*(?:mercadolibre\.com\.(?:ar|mx)|mercadolivre\.com\.br)\//.test(url),
16287+
notes: `
16288+
- Multi-seller MARKETPLACE. As of 2026-07 the buy controls are AR/MX "Comprar ahora" / "Agregar al carrito" / "Otras opciones de compra"; BR "Comprar agora" / "Adicionar ao carrinho" / "Outras opções de compra". Use one locale's labels, never a blend of the two.
16289+
- Catalog pages (path contains /p/MLA…, /p/MLM…, /p/MLB…) group MANY sellers under one product: the buy box is ONE offer, and "Otras opciones de compra"/"Outras opções de compra" lists the rest at different prices and arrival dates — open it before quoting a price. Single-seller listings (articulo.mercadolibre.com.*, produto.mercadolivre.com.br, paths ending -_JM) have no such list.
16290+
- Shipping cost and arrival date are computed from the destination "código postal" (AR/MX) / "CEP" (BR) and differ per seller. Set it before stating either, and re-check in the cart.
16291+
- Buy-now hands off to a Mercado Pago host where this guidance stops applying — confirm the final total there.
16292+
- Search hosts (listado.mercadolibre.com.ar, listado.mercadolibre.com.mx, lista.mercadolivre.com.br) can redirect automation to /gz/account-verification. If that wall appears, STOP and ask the user to complete it manually — do not retry, bypass, or claim results were read.`,
16293+
},
16294+
1628016295
// ─── Regional — Türkiye (TR) ──────────────────────────────────────────
1628116296
// Regional adapters are the project's #1 wanted contribution (CONTRIBUTING.md);
1628216297
// Türkiye is top of the priority list. Add more TR sites (trendyol,

test/run.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2398,6 +2398,50 @@ test('matches apple store pages', () => {
23982398
assert.equal(getActiveAdapter('https://secure.store.apple.com/shop/checkout')?.name, 'apple');
23992399
});
24002400

2401+
test('matches Mercado Libre LATAM storefronts and includes marketplace guidance', () => {
2402+
const trustedUrls = [
2403+
'https://mercadolibre.com.ar/',
2404+
'https://www.mercadolibre.com.ar/notebook/p/MLA123',
2405+
'https://listado.mercadolibre.com.ar/notebook',
2406+
'https://articulo.mercadolibre.com.ar/MLA-123-notebook-_JM',
2407+
'https://www.mercadolibre.com.mx/notebook/p/MLM123',
2408+
'https://listado.mercadolibre.com.mx/notebook',
2409+
'https://mercadolivre.com.br/',
2410+
'https://www.mercadolivre.com.br/notebook/p/MLB123',
2411+
'https://lista.mercadolivre.com.br/notebook',
2412+
'https://produto.mercadolivre.com.br/MLB-123-notebook-_JM',
2413+
];
2414+
for (const url of trustedUrls) {
2415+
assert.equal(getActiveAdapter(url)?.name, 'mercado-libre');
2416+
assert.equal(getActiveAdapterFx(url)?.name, 'mercado-libre');
2417+
}
2418+
2419+
const rejectedUrls = [
2420+
'https://mercadolibre.com.ar.phishing.example/notebook',
2421+
'https://mercadolivre.com.br.evil.example/notebook',
2422+
'https://example.com/mercadolibre.com.mx/notebook',
2423+
// Other country storefronts need their own localized research before inclusion.
2424+
'https://www.mercadolibre.cl/notebook',
2425+
];
2426+
for (const url of rejectedUrls) {
2427+
assert.notEqual(getActiveAdapter(url)?.name, 'mercado-libre');
2428+
assert.notEqual(getActiveAdapterFx(url)?.name, 'mercado-libre');
2429+
}
2430+
2431+
const adapter = getActiveAdapter('https://www.mercadolibre.com.mx/notebook/p/MLM123');
2432+
const firefoxAdapter = getActiveAdapterFx('https://www.mercadolivre.com.br/notebook/p/MLB123');
2433+
assert.match(adapter?.notes || '', /MARKETPLACE/);
2434+
assert.match(adapter?.notes || '', /Otras opciones de compra/);
2435+
assert.match(adapter?.notes || '', /Outras opções de compra/);
2436+
assert.match(adapter?.notes || '', /CEP/);
2437+
assert.match(adapter?.notes || '', /account-verification/);
2438+
// Checkout leaves the matched hosts, so the notes must hand the total off.
2439+
assert.match(adapter?.notes || '', /Mercado Pago/);
2440+
// Blended ES/PT labels match no real control on either storefront.
2441+
assert.doesNotMatch(adapter?.notes || '', /Agregar\/Adicionar|ahora\/agora|carrito\/carrinho/);
2442+
assert.equal(firefoxAdapter?.notes, adapter?.notes);
2443+
});
2444+
24012445
test('matches sahibinden.com and includes anti-bot guidance', () => {
24022446
assert.equal(getActiveAdapter('https://www.sahibinden.com/')?.name, 'sahibinden');
24032447
assert.equal(getActiveAdapter('https://sahibinden.com/kategori/vasita')?.name, 'sahibinden');

0 commit comments

Comments
 (0)