How jangbersahaja/wokkang works
StoreHub Transaction Monitor is a Next.js dashboard for authenticated staff to inspect live sales and transaction details. The main workflow polls the app’s transaction and product endpoints, which enforce session access and fetch/normalize StoreHub data; the dashboard then derives sales, payment and product metrics. Separate account workflows support sign-in, token-based registration, and role-governed invitations and account removal. The graph reflects the supplied excerpts and README; some page and persistence wiring is represented only at the supported directory or module level.
Main entry points: auth.ts Auth actions · page.tsx Dashboard · session.ts Session cookies · route.ts Transactions endpoint
Components 19
Sales dashboard
- Dashboard
app/page.tsx - Dashboard cards
components/dashboard/MetricCard.tsx - Payment cards
components/dashboard/PaymentMethodCard.tsx - Transaction status
components/dashboard/StatusBadge.tsx
StoreHub data
- Transactions endpoint
app/api/transactions/route.ts - Products endpoint
app/api/products/route.ts - StoreHub integration
lib/storehubApi.ts
Identity and access
- Sign-in page
app/login/page.tsx - Auth actions
app/actions/auth.ts - Session cookies
lib/auth/session.ts - Session authorization
lib/auth/dal.ts - Role rules
lib/auth/roles.ts - User and token data
lib/auth/users.ts
Account administration
- Token registration
app/register/[token]/page.tsx - Account management
app/admin/accounts - Account controls
app/admin/accounts/AccountsManagementClient.tsx
Other components
- Staff user
- StoreHub API
- Application database
lib/db.ts
Connections 24
- Staff user → Dashboard: views
- Dashboard → Transactions endpoint: requests transactions
- Dashboard → Products endpoint: requests products
- Transactions endpoint → Session cookies: checks session
- Products endpoint → Session cookies: checks session
- Transactions endpoint → StoreHub integration: fetches transactions
- Products endpoint → StoreHub integration: fetches products
- StoreHub integration → StoreHub API: calls API
- Dashboard → Dashboard cards: renders metrics
- Dashboard → Payment cards: renders breakdown
- Dashboard → Transaction status: renders status
- Staff user → Sign-in page: signs in
- Sign-in page → Auth actions: submits credentials
- Auth actions → User and token data: looks up users
- Auth actions → Session cookies: creates session
- Staff user → Token registration: uses invitation
- Token registration → Auth actions: submits registration
- Auth actions → User and token data: manages users and tokens
- Auth actions → Role rules: checks role rules
- Account management → Account controls: renders controls
- Account controls → Auth actions: invites or removes
- Session authorization → Session cookies: verifies session
- Session authorization → Role rules: checks access
- User and token data → Application database: reads and writes