|
| 1 | +# shoplit extension (dev) |
| 2 | + |
| 3 | +## Dev load |
| 4 | + |
| 5 | +1. `npm install && npm run build` |
| 6 | +2. Chrome → chrome://extensions → enable Developer mode → "Load unpacked" → select `extension/dist`. |
| 7 | +3. Copy the extension ID Chrome shows; set `NEXT_PUBLIC_EXTENSION_ID` for the web app (and rebuild the connect page) so the auto-handoff works. Without it, the copy-paste fallback is used. |
| 8 | +4. Sign in at https://shoplit.in, open https://shoplit.in/connect-extension to connect. |
| 9 | +5. Visit a product page on Nykaa/Myntra/Amazon/Flipkart/AJIO → click the toolbar icon or the "+ shoplit" button → pick a cart → Add. |
| 10 | + |
| 11 | +## Connect flow |
| 12 | + |
| 13 | +- Navigating to `/connect-extension` while signed in mints a Bearer token via `POST /api/v1/extension/token`. |
| 14 | +- If the extension is detected (via `externally_connectable`), the token is handed off directly using `chrome.runtime.sendMessage` → the service worker stores it in `chrome.storage.local`. |
| 15 | +- If the extension is not detected (e.g., first load before granting permission, or a version mismatch), a copy-paste fallback is shown: copy the token and paste it into the extension popup manually. |
| 16 | + |
| 17 | +## Manual E2E checklist |
| 18 | + |
| 19 | +Record results in the PR description. For each retailer (Nykaa, Myntra, Amazon.in, Flipkart, AJIO): |
| 20 | + |
| 21 | +- [ ] Open a product page; confirm the "+ shoplit" floating button appears within 2 seconds of page load. |
| 22 | +- [ ] Click the toolbar icon; confirm the popup shows the correct title, image, and price (populated from JSON-LD or OG tags). |
| 23 | +- [ ] Select a cart from the dropdown and click "+ Add to cart"; confirm the request succeeds (no error message). |
| 24 | +- [ ] Open the cart's `/c/{slug}` page and confirm the product appears with title, image, and price. |
| 25 | +- [ ] Confirm the product's "Shop" link redirects to the original product URL on the retailer site. |
| 26 | + |
| 27 | +Expected: title + image populate on at least JSON-LD retailers (Nykaa, Amazon); price where present. Where a field is missing, the inline edit lets the user fix it before adding. |
| 28 | + |
| 29 | +## Build and test |
| 30 | + |
| 31 | +```bash |
| 32 | +cd extension |
| 33 | +npm install |
| 34 | +npm run build # esbuild → dist/ |
| 35 | +npx vitest run # retailer classification + product extraction tests |
| 36 | +``` |
0 commit comments