Skip to content

Migrate extension to Manifest V3 and make store self-contained#2

Open
Blakew316 wants to merge 1 commit into
mainfrom
mv3-and-self-contained-store
Open

Migrate extension to Manifest V3 and make store self-contained#2
Blakew316 wants to merge 1 commit into
mainfrom
mv3-and-self-contained-store

Conversation

@Blakew316

Copy link
Copy Markdown
Owner

Summary

Makes the ShopConnect extension load on current Chrome and lets the demo store deploy as a single app to a real host (Vercel), fixing the two blockers that kept the extension from working with the live site.

Extension → Manifest V3 (packages/extension)

  • manifest.json MV2 → MV3: background.service_worker, action (was browser_action), host_permissions, structured web_accessible_resources.
  • CSP uses wasm-unsafe-eval (MV3 forbids unsafe-eval; the Polygon ID ZK circuits run as WebAssembly, so this is what's actually needed).
  • Fixed the placeholder description.
  • background.js / contentScript.js needed no changes — they only use chrome.windows / chrome.tabs / chrome.runtime, all service-worker-safe.

Store made self-contained (packages/store)

  • New lib/shopconnect-demo.js: inlined demo backend (promotions / verify / issue), dependency-free via node:crypto.
  • The 3 app/api/shopconnect/*/route.js now use the inline demo by default and only proxy to a separate Express API when SHOPCONNECT_API_URL is set.
  • Dropped the localhost:3001 default from next.config.js.

This lets the store deploy to Vercel with working /api/shopconnect/* routes — which GitHub Pages (static-only) could not host.

Verification

  • Extension: npm run build succeeds; loads unpacked with no MV2 warning.
  • Store: production build passes (API routes compile as serverless functions).
  • Deployed to Vercel: https://store-five-sable.vercel.app/api/shopconnect/promotions returns 200 (was 404 on GitHub Pages), /verify returns approved: true.

🤖 Generated with Claude Code

Extension:
- manifest.json MV2 -> MV3 (service_worker, action, host_permissions,
  structured web_accessible_resources, wasm-unsafe-eval CSP for the ZK circuits)
- Fix placeholder description

Store:
- Add lib/shopconnect-demo.js: self-contained demo backend (promotions/verify/
  issue) so the store deploys as a single Next.js app with no separate Express API
- Routes use the inline demo by default; proxy only when SHOPCONNECT_API_URL is set
- Drop the localhost:3001 default from next.config.js

Enables deploying the store (with working /api routes) to Vercel, which
GitHub Pages could not host.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant