# Atelier admin

The Persian staff Mini App specified in `REDESIGN_BRIEF_ADMIN.md`. It shares Atelier’s charcoal, apricot, typography and restrained card geometry, with an admin-specific information architecture.

Open **http://127.0.0.1:8765/admin-atelier/** from the existing local server. Serve the repository root, including `shared/`; no build step is needed. The customer counterpart is **http://127.0.0.1:8765/02-atelier/**.

## Workspaces

- **Today:** received deposits, sales and renewals, setup readiness, top payers, on-demand panel health, and revenue analysis.
- **Customers:** search and case files, independent wallet corrections, block/partner controls, purchases, live subscription adjustments, history, and permanent deletion.
- **Catalog:** plans, discounts, categories and their commitment terms, lifecycle rules, panels, templates, connections, and global selling/renewal controls.
- **Payments:** bankcards and period limits, Safe Mode with countdown and audit history, method/wallet overrides, cashback, secret configuration, and a nested ALL/ANY unlock-rule editor with a real-data draft tester.
- **Operations:** test-first broadcasts, notification rules, channels, tutorials, ad attribution, referrals, frozen bulk previews and progress, notification queues, system jobs, and seven-step setup.

## One shared world

The original `abnabot.world.v1` remains the only persisted domain store. `shared/admin-api.js` is the staff UI boundary. Its core, finance and operations modules transact against `shared/api.js`; the UI never accesses storage directly. Customers, subscriptions, categories, plans, wallets and ledger entries are shared with all twenty customer concepts. Revenue uses successful incoming deposits, excluding cashback, corrections and subscription spending.

The browser is a working simulation, including panel and Telegram effects, rather than a connection to production services. Replace the typed API boundary to integrate the real admin backend. Real Telegram launches retain host theme, back navigation, haptics and confirmation support. Browser previews start in the dark Atelier theme; the demonstration controls can switch themes.

## Review the behavior

The header settings button opens **محیط آزمایش**. It provides admin, non-admin, expired and missing Telegram identities; next-request errors; domain-specific failures; named edge-case subscriptions; server-time advancement; the complete seed; and a fresh setup seed. Reset affects the shared customer/admin sample world in this browser.

The complete seed adds 60 customers, 300 subscriptions including a 240-account organizational category, 960 deposits covering 14 months, 14 plans, 8 categories and 4 infrastructure panels. Existing customer fixtures remain available. The fresh seed exposes the same seven setup steps and real management actions, with prerequisites and report-group registration simulation.

Forms retain failures inline. Financial, destructive and bulk actions require explicit consequence review. Live processes refresh only while visible and stop at terminal states. Safe Mode uses server time. All displayed dates are Tehran dates and times; technical strings retain Latin digits. Native dialogs provide focus containment and dismissal; chart values have keyboard selection, a spoken readout and a complete table. Motion respects reduced-motion preferences.

## Checks

```powershell
node --test shared/api.test.mjs shared/admin-core.test.mjs shared/admin-finance.test.mjs shared/admin-operations.test.mjs
```

Browser drivers and visual artifacts are in `output/playwright/admin-*`. The API checks cover money consistency and rollback, actor attribution, subscription guards and deletion, revenue ranges and comparison, catalog changes, card limits and rotations, secret masking, nested rule evaluation, broadcasts, frozen bulk jobs and setup.

## Two brief inconsistencies resolved

- Revenue follows §7.4’s formal maximum of **400 monthly points**. A five-year range is valid because it needs only 60 monthly points; the contradictory five-year refusal in the acceptance checklist is tested with a range that actually exceeds 400 months instead.
- NOWPayments includes **all 29 explicitly named settings**. The brief’s heading says 30, but its listed groups total 29; no unsupported extra setting was invented.
