Platform-v2 step 2.5 (APPS_PLATFORM D-7, D-10, §9): - @xenia/api: createApiClient (app passes its axios; session/device headers, err.xenia codes, 401/offline hooks, manager-override retry: ask PIN, grant, retry once with X-Xenia-Override); errorMessage; createLiveClient = the waiter's WebSocket logic (cursor replay, backoff, online) moved unchanged - @xenia/access: AccessProvider (bootstrap per session token, language + venue formats, translated ui labels, approval dialog), useAccess/useCan/ useModule, Can, RequireModule - i18n: errors namespace for every backend code (en/el, test vs core/errors.py), override/access texts - manager: client from createApiClient, AccessProvider in a layout route, /kds behind RequireModule, usePermissions from bootstrap keys; login and unlock no longer treat a wrong password/PIN as "session ended" (a wrong lock-screen PIN used to log the manager out) - waiter: useWebSocket is a thin wrapper over createLiveClient - tests: api/access unit tests; new e2e suite tests/e2e/manager.mjs; CS-18 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
895 B
JavaScript
26 lines
895 B
JavaScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
|
|
const BACKEND = process.env.XENIA_BACKEND || 'http://localhost:8000'
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
// npm workspace (D-15): shared packages are imported from source, so make
|
|
// sure every import of React resolves to this app's copy.
|
|
resolve: {
|
|
dedupe: ['react', 'react-dom'],
|
|
},
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: 5174,
|
|
// Same as the waiter: the API is same-origin in production (nginx), so in
|
|
// dev (and `vite preview`) forward it to the local backend. XENIA_BACKEND picks
|
|
// another one (the e2e suite runs its own on :8056).
|
|
proxy: {
|
|
'/api/ws': { target: BACKEND.replace(/^http/, 'ws'), ws: true, changeOrigin: true },
|
|
'/api': { target: BACKEND, changeOrigin: true },
|
|
'/static': { target: BACKEND, changeOrigin: true },
|
|
},
|
|
},
|
|
})
|