From 02c4b4cb57b2c21ff60b672a9f40be3ca2d0440d Mon Sep 17 00:00:00 2001 From: alectimison-maker Date: Tue, 4 Aug 2026 12:45:06 +0800 Subject: [PATCH] agent: add adapter for Lazada --- src/chrome/src/agent/adapters.js | 18 ++++++++++++- src/firefox/src/agent/adapters.js | 18 ++++++++++++- test/run.js | 43 +++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 2 deletions(-) diff --git a/src/chrome/src/agent/adapters.js b/src/chrome/src/agent/adapters.js index 275e68d0b..26bc145eb 100644 --- a/src/chrome/src/agent/adapters.js +++ b/src/chrome/src/agent/adapters.js @@ -16595,7 +16595,23 @@ const ADAPTERS = [ - "Order Received" can release held purchase funds to the seller and affect guarantee or return timing. Never select it from tracking status alone; require the user's explicit confirmation that the exact goods arrived and were inspected. Report a placed order only from the confirmation or My Purchases page with an order ID; a cart, checkout, payment prompt, or submitted request is incomplete.`, }, - // ─── Regional — Flipkart (India) ───────────────────────────────────── + // ─── Regional — Lazada (Southeast Asia) ───────────────────────── + { + name: 'lazada', + category: 'general', + matches: (url) => /^https?:\/\/(?:(?:www|m|my|member|pages)\.)?lazada\.(?:co\.id|com\.ph|com\.my|sg|co\.th|vn)\//.test(url), + notes: ` +- Observed 2026-08: Lazada uses separate Indonesia, Philippines, Malaysia, Singapore, Thailand, and Vietnam storefronts. Choose the user's market before searching; accounts, language, currency, catalog, stock, delivery addresses, vouchers, and payment methods are region-specific, so one market's offer is not proof another can fulfill it. +- Catalog or product navigation can redirect to a path containing /_____tmd_____/punish and expose only "Click to feedback >". Stop retries and ask the user to complete the traffic check manually in the current tab, then re-read it; do not bypass the check or report the empty page as no products. +- Select the exact variation and quantity before comparing price, stock, delivery, warranty, or returns. Lazada product pages can combine color, size, storage, pack count, and seller-specific offers, and changing a variation can change all of those details. +- LazMall identifies a participating brand or authorized-store program, not a universal guarantee for every offer. Read the selected seller, store rating, item reviews, return policy, shipping origin, delivery estimate, and warranty rather than transferring a product-level badge or review score to every seller. +- Treat vouchers, free shipping, coins, cashback, flash-sale prices, and payment promotions as conditional. Check product, seller, minimum-spend, user, payment-method, quota, and expiry requirements, and quote the final payable checkout total separately from advertised savings. +- "Add to Cart" / Indonesian "Tambah ke Troli" preserves a review step; "Buy Now" / "Beli Sekarang" enters checkout directly. Do not use Buy Now for research, and re-read the exact item, variation, seller, quantity, shipping option, and price after adding it. +- Login or checkout can require password, SMS OTP, QR/app confirmation, CAPTCHA, or trusted-device approval. Ask the user to complete verification manually; never request, read, repeat, or expose a verification code, and continue from the returned page instead of restarting. +- Before "Place Order" or any payment control, re-read the address, items, variations, sellers, quantities, delivery, returns, vouchers, payment method, and final total, then require the user's explicit confirmation. Report success only from My Orders or a confirmation page with an order number and explicit state; a cart, checkout page, payment redirect, or pending order is incomplete.`, + }, + + // ─── Regional — Flipkart (India) ──────────────────── { name: 'flipkart', category: 'general', diff --git a/src/firefox/src/agent/adapters.js b/src/firefox/src/agent/adapters.js index 02cedb860..5c2112af9 100644 --- a/src/firefox/src/agent/adapters.js +++ b/src/firefox/src/agent/adapters.js @@ -16593,7 +16593,23 @@ const ADAPTERS = [ - "Order Received" can release held purchase funds to the seller and affect guarantee or return timing. Never select it from tracking status alone; require the user's explicit confirmation that the exact goods arrived and were inspected. Report a placed order only from the confirmation or My Purchases page with an order ID; a cart, checkout, payment prompt, or submitted request is incomplete.`, }, - // ─── Regional — Flipkart (India) ───────────────────────────────────── + // ─── Regional — Lazada (Southeast Asia) ───────────────────────── + { + name: 'lazada', + category: 'general', + matches: (url) => /^https?:\/\/(?:(?:www|m|my|member|pages)\.)?lazada\.(?:co\.id|com\.ph|com\.my|sg|co\.th|vn)\//.test(url), + notes: ` +- Observed 2026-08: Lazada uses separate Indonesia, Philippines, Malaysia, Singapore, Thailand, and Vietnam storefronts. Choose the user's market before searching; accounts, language, currency, catalog, stock, delivery addresses, vouchers, and payment methods are region-specific, so one market's offer is not proof another can fulfill it. +- Catalog or product navigation can redirect to a path containing /_____tmd_____/punish and expose only "Click to feedback >". Stop retries and ask the user to complete the traffic check manually in the current tab, then re-read it; do not bypass the check or report the empty page as no products. +- Select the exact variation and quantity before comparing price, stock, delivery, warranty, or returns. Lazada product pages can combine color, size, storage, pack count, and seller-specific offers, and changing a variation can change all of those details. +- LazMall identifies a participating brand or authorized-store program, not a universal guarantee for every offer. Read the selected seller, store rating, item reviews, return policy, shipping origin, delivery estimate, and warranty rather than transferring a product-level badge or review score to every seller. +- Treat vouchers, free shipping, coins, cashback, flash-sale prices, and payment promotions as conditional. Check product, seller, minimum-spend, user, payment-method, quota, and expiry requirements, and quote the final payable checkout total separately from advertised savings. +- "Add to Cart" / Indonesian "Tambah ke Troli" preserves a review step; "Buy Now" / "Beli Sekarang" enters checkout directly. Do not use Buy Now for research, and re-read the exact item, variation, seller, quantity, shipping option, and price after adding it. +- Login or checkout can require password, SMS OTP, QR/app confirmation, CAPTCHA, or trusted-device approval. Ask the user to complete verification manually; never request, read, repeat, or expose a verification code, and continue from the returned page instead of restarting. +- Before "Place Order" or any payment control, re-read the address, items, variations, sellers, quantities, delivery, returns, vouchers, payment method, and final total, then require the user's explicit confirmation. Report success only from My Orders or a confirmation page with an order number and explicit state; a cart, checkout page, payment redirect, or pending order is incomplete.`, + }, + + // ─── Regional — Flipkart (India) ──────────────────── { name: 'flipkart', category: 'general', diff --git a/test/run.js b/test/run.js index 3e243bc16..40a7177c0 100644 --- a/test/run.js +++ b/test/run.js @@ -3043,6 +3043,49 @@ test('matches current Shopee regional storefronts with marketplace guidance', () assert.equal(firefoxAdapter?.notes, adapter?.notes); }); +test('matches Lazada consumer storefronts and stops at the observed traffic gate', () => { + const trustedUrls = [ + 'https://www.lazada.co.id/', + 'https://www.lazada.com.ph/products/example-item.html', + 'https://www.lazada.com.my/catalog/?q=phone', + 'https://www.lazada.sg/shop-mobiles/', + 'https://m.lazada.co.th/products/example-item.html', + 'https://www.lazada.vn/', + 'https://my.lazada.co.id/customer/order/index/', + 'https://member.lazada.com.ph/user/account#/', + 'https://pages.lazada.com.my/wow/example', + ]; + for (const url of trustedUrls) { + assert.equal(getActiveAdapter(url)?.name, 'lazada'); + assert.equal(getActiveAdapterFx(url)?.name, 'lazada'); + } + + const rejectedUrls = [ + 'https://sellercenter.lazada.co.id/apps/register/index', + 'https://helpcenter.lazada.com.ph/', + 'https://careers.lazada.sg/', + 'https://lazada.co.id.phishing.example/products/item', + 'https://example.com/?next=https://www.lazada.vn/', + ]; + for (const url of rejectedUrls) { + assert.notEqual(getActiveAdapter(url)?.name, 'lazada'); + assert.notEqual(getActiveAdapterFx(url)?.name, 'lazada'); + } + + const adapter = getActiveAdapter(trustedUrls[0]); + const firefoxAdapter = getActiveAdapterFx(trustedUrls[5]); + assert.match(adapter?.notes || '', /2026-08.*separate Indonesia.*Vietnam storefronts/s); + assert.match(adapter?.notes || '', /_____tmd_____\/punish.*Click to feedback.*complete the traffic check manually/s); + assert.match(adapter?.notes || '', /exact variation.*changing a variation.*change all of those details/s); + assert.match(adapter?.notes || '', /LazMall.*selected seller.*return policy/s); + assert.match(adapter?.notes || '', /vouchers.*minimum-spend.*final payable checkout total/s); + assert.match(adapter?.notes || '', /Add to Cart.*Tambah ke Troli.*Buy Now.*Beli Sekarang/s); + assert.match(adapter?.notes || '', /OTP.*verification manually.*never request.*verification code/s); + assert.match(adapter?.notes || '', /Place Order.*explicit confirmation.*order number.*explicit state/s); + assert.equal((adapter?.notes || '').trim().split('\n').filter((line) => line.startsWith('- ')).length, 8); + assert.equal(firefoxAdapter?.notes, adapter?.notes); +}); + test('matches Flipkart shopping surfaces with India marketplace guidance', () => { const trustedUrls = [ 'https://flipkart.com/',