Skip to content

Commit ce9a0db

Browse files
agent: add adapter for Mercado Libre
1 parent 7182c21 commit ce9a0db

3 files changed

Lines changed: 72 additions & 0 deletions

File tree

src/chrome/src/agent/adapters.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16279,6 +16279,22 @@ 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+
- Mercado Libre/Livre is a multi-seller MARKETPLACE with localized UI. Argentina/Mexico use Spanish labels such as "Comprar ahora", "Agregar al carrito", and "Otras opciones de compra"; Brazil uses "Comprar agora", "Adicionar ao carrinho", and "Outras opções de compra". Follow the labels for the current country — do not mix the Spanish and Portuguese flows.
16291+
- Catalog product pages can group the same product from many sellers. The main buy box represents ONE seller/offer, while "Otras opciones de compra"/"Outras opções de compra" may have a different price, seller reputation, shipping cost, or arrival date. Compare the active offer before quoting or adding it.
16292+
- Variant trap: choose required color, size ("talle"/"talla"/"tamanho"), capacity, voltage, flavor, or other variation BEFORE adding. A variation can change stock, seller, price, and delivery; read back the selected variation from the product page or cart.
16293+
- LOCATION-FIRST shipping: set the destination postal code ("código postal" in AR/MX, "CEP" in BR) before promising availability, freight, free shipping, pickup, or an arrival date. Re-check these in the cart because they depend on both destination and seller.
16294+
- Displayed discounts and installment amounts ("cuotas"/"parcelas") may depend on the payment method, and the listing price can exclude shipping. Use "Agregar/Adicionar ao carrito" when choices still need review; verify seller, variations, quantity, shipping, and the final payable total before any consequential "Comprar ahora/agora" action.
16295+
- Search/result hosts such as listado.mercadolibre.com.ar, listado.mercadolibre.com.mx, and lista.mercadolivre.com.br may redirect automation to /gz/account-verification. If that verification wall appears, STOP and ask the user to complete it manually; do not retry, bypass it, or claim that results were inspected.`,
16296+
},
16297+
1628216298
// ─── Regional — Türkiye (TR) ──────────────────────────────────────────
1628316299
// Regional adapters are the project's #1 wanted contribution (CONTRIBUTING.md);
1628416300
// Türkiye is top of the priority list. Add more TR sites (trendyol,

src/firefox/src/agent/adapters.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16277,6 +16277,22 @@ 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+
- Mercado Libre/Livre is a multi-seller MARKETPLACE with localized UI. Argentina/Mexico use Spanish labels such as "Comprar ahora", "Agregar al carrito", and "Otras opciones de compra"; Brazil uses "Comprar agora", "Adicionar ao carrinho", and "Outras opções de compra". Follow the labels for the current country — do not mix the Spanish and Portuguese flows.
16289+
- Catalog product pages can group the same product from many sellers. The main buy box represents ONE seller/offer, while "Otras opciones de compra"/"Outras opções de compra" may have a different price, seller reputation, shipping cost, or arrival date. Compare the active offer before quoting or adding it.
16290+
- Variant trap: choose required color, size ("talle"/"talla"/"tamanho"), capacity, voltage, flavor, or other variation BEFORE adding. A variation can change stock, seller, price, and delivery; read back the selected variation from the product page or cart.
16291+
- LOCATION-FIRST shipping: set the destination postal code ("código postal" in AR/MX, "CEP" in BR) before promising availability, freight, free shipping, pickup, or an arrival date. Re-check these in the cart because they depend on both destination and seller.
16292+
- Displayed discounts and installment amounts ("cuotas"/"parcelas") may depend on the payment method, and the listing price can exclude shipping. Use "Agregar/Adicionar ao carrito" when choices still need review; verify seller, variations, quantity, shipping, and the final payable total before any consequential "Comprar ahora/agora" action.
16293+
- Search/result hosts such as listado.mercadolibre.com.ar, listado.mercadolibre.com.mx, and lista.mercadolivre.com.br may redirect automation to /gz/account-verification. If that verification wall appears, STOP and ask the user to complete it manually; do not retry, bypass it, or claim that results were inspected.`,
16294+
},
16295+
1628016296
// ─── Regional — Türkiye (TR) ──────────────────────────────────────────
1628116297
// Regional adapters are the project's #1 wanted contribution (CONTRIBUTING.md);
1628216298
// Türkiye is top of the priority list. Add more TR sites (trendyol,

test/run.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2387,6 +2387,46 @@ test('matches apple store pages', () => {
23872387
assert.equal(getActiveAdapter('https://secure.store.apple.com/shop/checkout')?.name, 'apple');
23882388
});
23892389

2390+
test('matches Mercado Libre LATAM storefronts and includes marketplace guidance', () => {
2391+
const trustedUrls = [
2392+
'https://mercadolibre.com.ar/',
2393+
'https://www.mercadolibre.com.ar/notebook/p/MLA123',
2394+
'https://listado.mercadolibre.com.ar/notebook',
2395+
'https://articulo.mercadolibre.com.ar/MLA-123-notebook-_JM',
2396+
'https://www.mercadolibre.com.mx/notebook/p/MLM123',
2397+
'https://listado.mercadolibre.com.mx/notebook',
2398+
'https://mercadolivre.com.br/',
2399+
'https://www.mercadolivre.com.br/notebook/p/MLB123',
2400+
'https://lista.mercadolivre.com.br/notebook',
2401+
'https://produto.mercadolivre.com.br/MLB-123-notebook-_JM',
2402+
];
2403+
for (const url of trustedUrls) {
2404+
assert.equal(getActiveAdapter(url)?.name, 'mercado-libre');
2405+
assert.equal(getActiveAdapterFx(url)?.name, 'mercado-libre');
2406+
}
2407+
2408+
const rejectedUrls = [
2409+
'https://mercadolibre.com.ar.phishing.example/notebook',
2410+
'https://mercadolivre.com.br.evil.example/notebook',
2411+
'https://example.com/mercadolibre.com.mx/notebook',
2412+
// Other country storefronts need their own localized research before inclusion.
2413+
'https://www.mercadolibre.cl/notebook',
2414+
];
2415+
for (const url of rejectedUrls) {
2416+
assert.notEqual(getActiveAdapter(url)?.name, 'mercado-libre');
2417+
assert.notEqual(getActiveAdapterFx(url)?.name, 'mercado-libre');
2418+
}
2419+
2420+
const adapter = getActiveAdapter('https://www.mercadolibre.com.mx/notebook/p/MLM123');
2421+
const firefoxAdapter = getActiveAdapterFx('https://www.mercadolivre.com.br/notebook/p/MLB123');
2422+
assert.match(adapter?.notes || '', /MARKETPLACE/);
2423+
assert.match(adapter?.notes || '', /Otras opciones de compra/);
2424+
assert.match(adapter?.notes || '', /Outras opções de compra/);
2425+
assert.match(adapter?.notes || '', /CEP/);
2426+
assert.match(adapter?.notes || '', /account-verification/);
2427+
assert.equal(firefoxAdapter?.notes, adapter?.notes);
2428+
});
2429+
23902430
test('matches sahibinden.com and includes anti-bot guidance', () => {
23912431
assert.equal(getActiveAdapter('https://www.sahibinden.com/')?.name, 'sahibinden');
23922432
assert.equal(getActiveAdapter('https://sahibinden.com/kategori/vasita')?.name, 'sahibinden');

0 commit comments

Comments
 (0)