Panly API docsstaging

Screens / App shell (every signed-in page)

App shell (every signed-in page)

Navigation, merchant switcher, add business and sign-out. Menu entries and pages follow the permission keys of the session (PAN-88): a permission_denied answer or coming back to the app re-reads GET /v1/me, and a person who can open no page lands on /no-access. Add business is disabled once the account owns as many businesses as the plan allows (PAN-98: Free 1, Premium 2, Lifetime 5), with "N of M businesses used" under it; businesses over the limit still open. Any 401 triggers one silent token refresh. PAN-136 restyle: refined side bar on desktop and a bottom bar plus More page on a phone. Add business asks for a name and a business code (live check). A grace banner shows while a lapsed plan is in its grace period (PAN-116), and a 402 sends the owner to /premium and staff to /business-paused (PAN-114).

App routes
all shell pages
Access
any signed-in person
Screen code
lib/screens/shell/shell_controller.dart
lib/widget/merchant_switcher.dart
lib/core/network/session_refresher.dart
lib/screens/shell/widgets/business_limit_note.dart
lib/domain/plans/business_limit.dart
lib/core/navigation/permission_guard.dart
lib/screens/shell/widgets/new_business_dialog.dart
lib/screens/shell/widgets/grace_banner.dart
lib/core/navigation/payment_gate.dart
Source
elmermj/panly-app @ pre-staging-test (72aaffd)

API calls (14)

CallWhy the screen makes itWhere in the app code
GET /v1/me/merchants
List the merchants I belong to
List the account's merchants for the switcher
The owned businesses counted against the limit are the rows where the account is the owner.
lib/screens/shell/shell_controller.dart:206
lib/data/repositories/auth_repository.dart:360
GET /v1/merchants/me
Get my merchant (tier, storage usage)
Owners only (`settings.manage`): the business's plan limits, `limits.effective.max_merchants`, for the Add business limit (PAN-98). A failure leaves Add business enabled and the server answers 409 MERCHANT_LIMIT if needed lib/screens/shell/shell_controller.dart:229
lib/domain/usecases/settings/settings_usecase.dart:12
lib/data/repositories/settings_repository.dart:14
POST /v1/auth/switch-merchant
Switch to another merchant of the same account
Switch merchant (switcher tap) lib/widget/merchant_switcher.dart:228
lib/screens/shell/shell_controller.dart:276
lib/data/repositories/auth_repository.dart:316
GET /v1/merchants/me/onboarding
Get onboarding state
After a switch to a business the owner owns: the startup gate again, so a business whose setup is not finished opens /onboarding lib/screens/shell/shell_controller.dart:318
lib/core/navigation/onboarding_gate.dart:44
lib/domain/usecases/onboarding/onboarding_usecase.dart:12
lib/data/repositories/onboarding_repository.dart:16
GET /v1/me
Get the signed-in account, its role here and the current merchant
Enrich the session after a switch lib/data/repositories/auth_repository.dart:281
lib/data/repositories/auth_repository.dart:426
GET /v1/me
Get the signed-in account, its role here and the current merchant
Re-read the role and permission keys (PAN-88) when a call is answered permission_denied and when the app resumes; at most one per 2 seconds lib/screens/shell/shell_controller.dart:121
lib/data/repositories/auth_repository.dart:421
POST /v1/devices/fcm
Register this device's FCM token for kitchen queue nudges
Re-register this browser's FCM token for the new merchant lib/screens/shell/shell_controller.dart:309
lib/data/push/kitchen_live_updates.dart:137
lib/data/push/fcm_device_api.dart:14
POST /v1/merchants
Create another merchant for my account
Add a business, then switch to it
A 409 MERCHANT_LIMIT shows "You've reached the business limit for this plan." chosen by the error code, in English and Indonesian.
lib/screens/shell/widgets/new_business_dialog.dart:68
lib/screens/shell/shell_controller.dart:348
lib/domain/usecases/auth/auth_usecase.dart:100
lib/data/repositories/auth_repository.dart:382
DELETE /v1/devices/fcm
Unregister an FCM token (call on sign-out)
Unregister the FCM token before sign-out lib/screens/shell/shell_controller.dart:369
lib/data/push/kitchen_live_updates.dart:121
lib/data/push/fcm_device_api.dart:22
POST /v1/auth/logout
Revoke this refresh token family
Sign out (this device) lib/widget/merchant_switcher.dart:466
lib/screens/shell/shell_controller.dart:375
lib/data/repositories/auth_repository.dart:241
POST /v1/auth/logout-all
Revoke all refresh tokens of the current account (all merchants)
Sign out everywhere lib/widget/merchant_switcher.dart:467
lib/screens/shell/shell_controller.dart:373
lib/data/repositories/auth_repository.dart:255
POST /v1/auth/refresh
Rotate refresh token
Silent refresh after a 401 on any call lib/core/network/session_refresher.dart:55
GET /v1/billing
Billing status of the current business
Read the plan lapse phase for the grace banner (PAN-116) lib/screens/shell/shell_controller.dart:179
lib/domain/usecases/billing/billing_usecase.dart:14
lib/data/repositories/billing_repository.dart:29
GET /v1/merchant-codes/{code}/availability
Check whether a business code is free (public)
Add business: live business code check lib/screens/business_code/business_code_controller.dart:100
lib/domain/usecases/business_code/business_code_usecase.dart:14
lib/data/repositories/business_code_repository.dart:14

Each call links to its operation in the API reference. Code locations are file:line in panly-app at 72aaffd, listed from the screen down to the line that sends the request.