feat(dashboard): Next.js 16 merchant panel with offline POS and PWA
Complete merchant dashboard upgrade:
Next.js 16 compatibility:
- Fix params/searchParams typed as Promise<{}> throughout App Router
- Replace middleware.ts with proxy.ts (Next.js 16 convention)
- Remove unused @ts-expect-error directives caught by stricter TS
- Cast dynamic next-intl t() keys to fix TranslateArgs type errors
Offline POS:
- IndexedDB queue (meezi_pos_offline) for orders created while offline
- Zustand sync store tracking queueCount, isSyncing, isOnline
- useOfflineSync hook: auto-syncs on reconnect/visibility-change
- SyncStatusIndicator chip in topbar (amber=offline, blue=syncing)
- submitOrderToApi falls back to local order on network failure
- Local orders skip payment flow; sync on reconnect
PWA (installable):
- @ducanh2912/next-pwa with Workbox runtime caching rules
- Web App Manifest (manifest.ts) — RTL/Farsi, theme #0F6E56
- PWA icons: 192px, 512px, maskable 512px
- next.config.ts replaces next.config.mjs
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { test, expect } from "@playwright/test";
|
||||
|
||||
const apiURL = process.env.PLAYWRIGHT_API_URL ?? "http://localhost:5080";
|
||||
|
||||
test.describe("API health", () => {
|
||||
test("GET /health returns 200", async ({ request }) => {
|
||||
const res = await request.get(`${apiURL}/health`);
|
||||
expect(res.ok()).toBeTruthy();
|
||||
const body = await res.json();
|
||||
expect(body.status).toBe("healthy");
|
||||
});
|
||||
|
||||
test("GET /api/public/security-config", async ({ request }) => {
|
||||
const res = await request.get(`${apiURL}/api/public/security-config`);
|
||||
expect(res.ok()).toBeTruthy();
|
||||
const json = await res.json();
|
||||
expect(json.success).toBe(true);
|
||||
expect(json.data).toBeDefined();
|
||||
});
|
||||
|
||||
test("GET /api/public/discover returns list", async ({ request }) => {
|
||||
const res = await request.get(`${apiURL}/api/public/discover?city=تهران`);
|
||||
expect(res.ok()).toBeTruthy();
|
||||
const json = await res.json();
|
||||
expect(json.success).toBe(true);
|
||||
expect(Array.isArray(json.data)).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user