Replaces the brittle agent-driven /api/bizportal/search queue with a
deterministic Python FastAPI service that drives BizPortal via a real
headless Chromium. The old flow is untouched.
What this adds:
- scripts/bizportal_service.py — FastAPI + Playwright service with
/search, /reserve, /health endpoints. Persistent login session
via storage_state.json. Locator-based selectors (vs eval JS).
- app/bizportal-2/ — new /bizportal-2 page, synchronous fetch
(no polling), shows round-trip duration, mirrors the existing
bulk-add + link UX.
- app/api/bizportal-2/{search,reserve,health}/route.ts — thin
proxies to the Python sidecar.
- scripts/README.md, .env.example, .gitignore, requirements.txt.
- .gitignore: ignore tsconfig.tsbuildinfo (build artefact).
Wiring:
- components/NavBar.tsx: 'BizPortal 2.0' nav entry with TEST badge.
- app/bizportal/page.tsx: 'Try BizPortal 2.0' action link in
header so the new option is discoverable from the existing page.
Run: cd scripts && source .venv/bin/activate && uvicorn
bizportal_service:app --port 7001
15 lines
476 B
Text
15 lines
476 B
Text
# BizPortal gateway credentials. Fill in once, never commit.
|
|
BIZPORTAL_ID_NO=8709225206083
|
|
BIZPORTAL_PASSWORD=Mull2ZerX1000
|
|
|
|
# Run the browser headless on the server. Set to false for debugging.
|
|
BIZPORTAL_HEADLESS=true
|
|
|
|
# Minimum CIPC prepaid balance required to lodge a name reservation.
|
|
BIZPORTAL_BALANCE_MIN=50
|
|
|
|
# Navigation timeout (ms) for slow BizPortal pages.
|
|
BIZPORTAL_NAV_TIMEOUT_MS=30000
|
|
|
|
# Logging — DEBUG for selector-trails, INFO for normal use.
|
|
LOG_LEVEL=INFO
|