Modules / los-partner

los-partner TECH

The multi-tenant back-office CRM used by each lending brand's own staff — sales, credit, sanctioning, disbursement ops, collections and HR — across the full loan lifecycle.

Ground truth as of 2026-09-30
Correction to the original documentation site los-partner is the internal staff back-office CRM — the app that the original Documentation site's Frontend and User Functions pages describe. Its name suggests an external partner portal, but "partner" here means each lending brand (QuaLoan, jhatpatcash, FastSalary, CredNidhi, MinutesLoan, PaisaPop, Salary4Sure, SalaryBaba, ShubLakshmi, ZeptoFinance, FastRupees) is a partner/tenant of the 8byte platform; the people using this app are that brand's own employees — sales, credit, sanction, disbursement ops, collections and HR staff. The genuinely external-facing app is the sibling repo los-webv1 (the borrower/customer app). The team's earlier assumption that a different repo (los-webv1) was the staff console was incorrect; los-webv1 is the borrower-facing app, and los-partner is the staff console.
How to read this page This document was rebuilt directly from the current codebase (route table, Redux slices, enum file, API service layer, deploy configs) as of 2026-09-30. It should be read alongside los-backend's tech page, since every request this app makes lands on los-backend's partner auth surface.

01 Stack & architecture

A React SPA, one per brand at runtime (brand resolved by hostname), talking exclusively to los-backend's partner-scoped API surface.

Framework
React 19 + Vite 6
TypeScript 5.7, @vitejs/plugin-react-swc
Styling
Tailwind CSS v4
@tailwindcss/vite, tailwind-merge, clsx
Routing
react-router-dom v7
useRoutes, brand-scoped :brandId/... paths, one central route table in routes.tsx
State
Redux Toolkit v2 + react-redux v9
Slices: brand, common, partnerUser, user, plus state.auth
Rich text
Tiptap
image/link/placeholder/text-align/underline extensions — blog & help-center content editing
Charts
Chart.js + recharts
Two charting libraries coexist — dashboard v1/v2/v3 variants use different libs
HTTP
axios
Single shared instance, shared/services/axios.ts, base /api/v1
Device / security
FingerprintJS + @sphoro/bugcatch-web-sdk
Device fingerprinting for login tracking; error reporting SDK
Telephony
@sphoro/voice-web
In-app dialer SDK, click-to-dial backed by Acefone
Drag/drop
@dnd-kit/*
Ordering UI — e.g. workflow-step / settings configuration
PDF
pdfjs-dist
In-browser viewing of loan agreements/documents
Misc UI
@base-ui/react, @headlessui/react
Headless primitives; @svg-maps/india for the users-by-location dashboard card

Not the customer app

This SPA is served per-brand (identity resolved by hostname via getBrandInfo(domain)) and every authenticated route is scoped :brandId/.... Dev server runs on port 5174 — distinct from the unrelated LOS Customer App (the borrower-facing app, dev port 5200). Build is tsc -b && vite build with a 6GB heap allotted via NODE_OPTIONS, reflecting the size of the codebase (~45 feature directories, ~70 API service files).

Architecture — staff browser to backend
graph TB STAFF["Staff browser
(brand subdomain)"] subgraph SPA [los-partner — React SPA] ROUTES["routes.tsx
:brandId/... route table"] GUARDS["Route guards
SuperAdminRoute · AdminOrPermissionRoute
LeadsAccessRoute · CoinBetaRoute"] FEATURES["features/**
~45 domain modules"] APISVC["shared/services/api/**
~70 endpoint wrapper files"] end BACKEND["los-backend
AuthType: partner surface"] DB[("PostgreSQL
via los-backend, Brand-scoped")] STAFF --> ROUTES --> GUARDS --> FEATURES --> APISVC APISVC -->|axios, Bearer token| BACKEND BACKEND --> DB

02 Module map

src/ top-level directories, ~45 feature dirs paired 1:1 with most pages/ entries.

DirectoryPurpose
App.tsx, routes.tsxRoot app shell and the single central route table (react-router v7 useRoutes).
features/*Business-logic modules: login, leads, customers, customerDetails, loans, loanCollection/collectionV2, loanCompleted, loanCreditExecutive, loanSanctionManager, loansOps, disbursedCases, awaitingLoanAgreement, mandateQueue, estampQueue, pdLink (personal-discussion link), fieldVisit, telephony, chatbot, callRequests, globalSearch, dashboard/dashboardV2/dashboardV3, msiReport, partnerUsers, admin, adminSettings, settings, coinWallet/coinAdmin/coinApprovals/coinLeaderboard, referralLink, payment, repeatLoans, lastLoanCompleted, lendbox, helpCenter, Reminders/failedReminders, bugcatch, profile.
pages/*Thin route-target wrappers around features/* — page-level composition, mirroring feature names 1:1.
shared/services/api/*~70 files, one per backend domain: loan.api.ts, customer.api.ts, collection.api.ts, bre.api.ts, evaluation.api.ts/evaluationV2.api.ts, coins.api.ts, report.api.ts, partner-user.api.ts, global-search.api.ts, disbursement-batch.api.ts, plus settings/ (20+ files), external/, leads/ sub-folders. No react-query/SWR — components call these directly and manage their own loading state.
shared/redux/Store + slices (brand.slice.ts, common.ts, partnerUser.slice.ts, user.ts) wired in store.ts/middleware.ts.
shared/bre/BRE engine registry — single file, breEngines.ts. See §06.
common/Shared presentational primitives: ui/ (buttons, tables, badges, PII-mask toggle, column-visibility dropdown, pagination), dialog/ (modal system), filter/, sidebar/.
components/ProtectedRoute.tsxReusable component-level role/permission gate (allowedRoles, allowedPermissions props) — separate from the route-level guards in routes.tsx.
layout/ (+ layout/sidebar/)App shell chrome — top nav, side nav.
context/roleContext.tsx, permissionContext.tsx (current effective role/permission), toastContext.
constant/enum.tsHuge central enum file — loan/charge/BRE/role/permission/status enums.
lib/role.ts (isAdmin, isSuperAdmin, isOtherRoles, isValidRole), getCurrentRoleAndPermissions.ts, utils.ts (PII masking: maskPan, maskEmail, maskPhone).
hooks/useDevice (device registration/fingerprint), useVersionGuard (forces refresh on stale build), useServerIdentity.
templates/, styles/Per-brand theme/branding scaffolding, consistent with multi-tenant brand.slice.ts.

03 Full route inventory

From src/routes.tsx. Unauthenticated routes are top-level; everything else lives under ProtectedRoutes and, unless noted, is scoped :brandId/....

RouteNotes
pd/:tokenStandalone personal-discussion link page, opened outside the authenticated shell.
/loginMulti-step login, per-brand themed variant.
/reset-passwordPassword reset via emailed token.
/HomeRedirect — computes a role/permission-driven landing route (see Product page).

Dashboards & global

:brandId/dashboardLegacy — redirects to v1/v2/v3 per brand config.
:brandId/dashboard-v1, -v2 (flag-gated via VITE_ENABLE_DASHBOARD_V2), -v3Dashboard version variants.
:brandId/global-searchCross-entity search — loan tasks, KYC, legal, stage details.
:brandId/help-center, /blogsInternal help content and blog management.
:brandId/reportsLarge permission-gated report catalog.

Customers, leads & loans

:brandId/customers, /call-requestsCustomer list and call-request queue.
:brandId/leadsGated by LeadsAccessRoute (ALL/LEADS/RELOCATE_LEAD permission), not the generic guard.
:brandId/:fallbackpage/customers/:customerId, .../loan/:loanIdCustomer/loan detail — the fallback-page param lets the detail view "return" to whichever list it was opened from.
:brandId/repeat-loans, /last-loan-completedReloan-eligible customer surfacing.

Credit, sanction & field work

:brandId/credit-executive, /sanction-managerUnderwriting and final-sanction queues.
:brandId/sales-queue, /credit-queue, /field-visits, /collection-field-visitsField-visit workflows across sales, credit and collection.

Pre-disbursement & disbursement

:brandId/esign-pendingAwaiting loan agreement (e-sign) queue.
:brandId/estamp-queueE-stamp processing queue.
:brandId/mandate-queueNACH/UPI Autopay mandate setup queue.
:brandId/loans-ops/pending-disbursement, /payment-approval, /payment-rejected, /payment-approved, /no-due-pendingLOAN_OPS disbursement and payment-review queues.
:brandId/disbursed-casesCompleted disbursements list.

Collection V2 suite

:brandId/collection/all, /pre-collection, /post-collection, /npa-collection, /legal-action-collection, /follow-up-calendarStage-segmented collection queues. :brandId/npa-collection redirects to collection/npa-collection.

Closure, partner users & coin wallet

:brandId/completed, /completed/all, /completed/closed, /completed/settled, /completed/writeoffClosed-loan buckets.
:brandId/partner-users, /partner-users/create, /partner-users/:userId/editOrg user management.
:brandId/coin-wallet, /coin-leaderboard, /coin-approvals, /coin-adminAll additionally gated by CoinBetaRoute (private beta, server-decided access).
:brandId/referral-linkReferral-link generation utility for staff.
:brandId/reminders, /failed-remindersReminder management/failure queue.
:brandId/settings, /settings/:settingIdBrand configuration (~20 sub-areas).
admin (SUPER_ADMIN only)Cross-brand admin — not brand-scoped.
admin/settings (SUPER_ADMIN only)Cross-brand platform settings.
*Redirect to /.

04 Auth flow & route protection

Two independent guard layers, plus five distinct credential methods spread across eight visual login-page variants.

Two guard layers

  • Route-level (routes.tsx) — ProtectedRoutes checks state.auth.accessToken presence and redirects to /login if absent. Nested guard components (SuperAdminRoute, AdminOrPermissionRoute, DashboardVersionRoute, LeadsAccessRoute, CoinBetaRoute) further restrict by role/permission/brand-config before rendering a page.
  • Component-level — src/components/ProtectedRoute.tsx, a reusable wrapper (allowedRoles, allowedPermissions props) driven by useRole()/usePermission() contexts, for gating UI within a page rather than the whole route.

Five login methods, eight page variants

Login (src/features/login/, auth.api.ts) supports five identifier + credential flows via useLoginController.ts/useSteppedLogin.ts, rendered by whichever of loginV1…loginV8 the brand's loginVersions.ts/loginTheme.ts selects — eight parallel visual implementations for the same underlying logic.

MethodMechanism
PasswordPOST /auth/partner/login with {identifier, password, deviceId}.
OTPPOST /auth/partner/send-login-otp → POST /auth/partner/verify-login-otp.
TOTP (authenticator app)POST /auth/partner/totp-status → if unenrolled, verify-totp-setup (QR code) → verify-totp-login.
Sign-in codePOST /auth/partner/verify-sign-in-code with {code, deviceId} — see detail below.
Resetsend-reset-password-email → reset-password (token + new password); change-password while authenticated.
Sign-in code mechanism A passwordless staff-recovery path, admin-issued from Partner Users → Actions → Generate sign-in code: a 12-char one-time code (XXXX-XXXX-XXXX, ~59 bits entropy), expiry chosen at issue time (15 min default / 1 hour / 24 hours), single-use and single-live-per-user (issuing a new one revokes the old), revocable by an admin, and explicitly blocked for ADMIN/SUPER_ADMIN accounts to prevent privilege-escalation via code sharing. Backend stores only a SHA-256 hash; plaintext is shown once. Documented in depth on los-backend's own docs — see los-backend §03.

Token, session & identity

  • Token storage — sessionStorage.getItem("access_token"), injected as Authorization: Bearer <token> on every axios request via a request interceptor.
  • 401 → clears sessionStorage and hard-redirects to /login.
  • 403 PUNCH_IN_REQUIRED → dispatches an attendance:punch-in-required window event; an attendance context intercepts and blocks the UI until the user punches in (brand-configurable attendance gate).
  • Device tracking — every login variant sends a FingerprintJS deviceId; useDevice() also calls postRegisterUserDevice() on every authenticated app load.
  • Multi-brand identity — getBrandInfo(domain) resolves brand config by hostname (dedup'd in-flight via a shared promise); the app is served per-brand subdomain, and theming/config loads before/around login. useServerIdentity() and useVersionGuard() run on every authenticated load.

05 Role & permission model

Two enums in src/constant/enum.ts: a coarse PartnerUserRoleEnum and a much larger, fine-grained PartnerUserPermissionEnum (~100 values).

EnumContents
PartnerUserRoleEnumOTHER, SUPER_ADMIN (cross-brand platform admin, sees /admin), ADMIN (brand admin), LOAN_OPS, COLLECTION_EXECUTIVE, COLLECTION_MANAGER, COLLECTION_HEAD, SANCTION_MANAGER, SANCTION_HEAD, CREDIT_EXECUTIVE, SALES, SALES_MANAGER, SALES_HEAD, NPA_EXECUTIVE, HR, plus legacy/overlap values (BRAND_SETTINGS, CUSTOMER, VIEW_DASHBOARD, REPORT, PARTNER_USER_MANAGEMENT, LOANS).
PartnerUserPermissionEnum~100 fine-grained values grouped by comment banner: SUPER_ADMIN (ALL), CUSTOMER (status-specific, e.g. CUSTOMER_PENDING, CUSTOMER_BRE_REJECTED), LEADS (LEADS, RELOCATE_LEAD), LOANS (LOAN_CREATE, LOAN_EVALUATION, LOAN_AGREEMENT, LOAN_FORCE_BYPASS, CAM_CALCULATOR), LOAN OPERATIONS, CREDIT/SANCTION, DISBURSEMENT (SEND_TO_DISBURSEMENT, DISBURSE_LOAN, BULK_DISBURSEMENT), PAYMENTS, COLLECTIONS (NPA_COLLECTION, LEGAL_ACTION_COLLECTION, FIELD_VISIT), ALLOCATION, PARTNER/USER MANAGEMENT, DASHBOARDS (V1/V2/V3 variants + VIEW_EXECUTIVE_TARGET_SNAPSHOT), a large REPORTS block (dozens of named permissions), BLOG_MANAGEMENT, MARKETPLACE_SSO, LENDBOX_WORKFLOW_SYNC, and internal API-access flags (DASHBOARD_V2_API, USER_WORKFLOW_API, LOANWALLE_API).

Three-tier allocation permission model

The ALLOCATION permission group encodes three distinct capabilities per work type (fresh vs. repeat), not one: FRESH_ALLOCATION/REPEAT_ALLOCATION (can receive work), ALLOCATE_FRESH/ALLOCATE_REPEAT (can assign unowned work to someone), and REALLOCATE_FRESH/REALLOCATE_REPEAT (can move already-owned work). The same three-tier pattern repeats on the collection side (desk = SALES|COLLECTION).

Enforcement

  • A user's role[] and permissions[] arrays live on state.auth.data (Redux). RoleProvider/PermissionProvider (src/context/) resolve a single effective role/permission via getCurrentRoleAndPermissions() for the component-level ProtectedRoute.
  • Route guards mostly use isValidRole()/isAdmin()/isSuperAdmin()/isOtherRoles() (lib/role.ts) plus direct permissions.includes(...) checks — ALL is a super-permission that satisfies almost every check.
  • Permission-to-role administration lives under role-group.api.ts/partner-permissions.api.ts and the :brandId/partner-users and :brandId/settings UI.
  • Users can hold multiple roles and permissions simultaneously — these are arrays, not a single value.
Enum drift — don't assume clean separation PartnerUserRoleEnum contains several values (BRAND_SETTINGS, CUSTOMER, VIEW_DASHBOARD, REPORT, PARTNER_USER_MANAGEMENT, LOANS) that duplicate names in PartnerUserPermissionEnum — early role/permission conflation still left in the enum. When documenting or extending the permission model, don't assume role and permission are cleanly separated concepts here.

06 BRE integration

src/shared/bre/breEngines.ts defines a small registry of credit-eligibility engines — an internal underwriting tool for credit staff, not a customer-facing instant-approval widget.

// shared/bre/breEngines.ts — engine registry
SMART_BRE           // autoRun: true
CRIF_BRE            // autoRun: true
NEETIX_BRE          // autoRun: true
MARKETING_ANALYSIS  // autoRun: false

Each engine has an enabledKey checked per-brand (BreEngines type from bre-engine.api.ts) — a brand can turn individual engines on or off. bre.api.ts / bre-engine.api.ts / evaluation.api.ts / evaluationV2.api.ts together implement the credit team's underwriting workflow: fetch bureau reports (Equifax, CRIF ProV2/V1, TotalEkycCrif, TruLens CRIF, Digitap CRIF), initiate CIBIL consent via Signzy, and run/upsert an evaluation per loan — a checklist of items each markable ELIGIBLE/NOT_ELIGIBLE, with an override flag and comments for a human underwriter to override the automated verdict.

This is used by CREDIT_EXECUTIVE/SANCTION_MANAGER-permissioned staff on the customer/loan detail page during underwriting. Reports on BRE outcomes are surfaced via the CIC/BRE/AUDIT report permission group (SMART_BRE_REPORT, CIC_REPORT, TRANSUNION_REPORT, EQUIFAX_CIC_BETA_REPORT, CUSTOMER_AUDIT_REPORT).

Not a self-serve tool BRE here is the internal credit-decisioning pipeline the partner org's own credit team drives — there is no self-serve pre-qualification check exposed to an external referrer or borrower in this app. (The borrower-facing eligibility check, if any, lives in los-webv1.)

07 Deployment / infrastructure

LayerDetail
DockerDockerfile.production — multi-stage: node:20-alpine build stage (npm install --legacy-peer-deps, npm run build) → nginx:stable-alpine serving /dist via nginx.conf. Dockerfile.dev for dev container use.
nginxSPA fallback (try_files ... /index.html), strict CSP, HSTS, and a CORS allow-origin hardcoded to https://console.acefone.in (telephony/IVR provider); form-action also whitelists *.acefone.in.
PM2ecosystem.config.js/.cjs — app name qualoan-partner, runs npm run start → npx serve -l 5174 dist (static file server, single instance, autorestart).
Dev serverVite, port 5174, manual chunk-splitting configured for vendor-react/router/state/ui/charts.
Env configsrc/shared/services/config.ts — VITE_APP_MODE=local switches to http://localhost:4002; otherwise VITE_NODE_URL is the backend base URL. VITE_ENABLE_DASHBOARD_V2 feature-flags dashboard v2.
Two coexisting deploy paths — cleanup opportunity The Docker/nginx static-serve image and the PM2 + npx serve process (app name literally qualoan-partner — a single brand's name leaking into what's meant to be a multi-tenant app's own ops tooling) both exist in the repo. Worth confirming with the team which is actually current in production and retiring the other.

08 Recent activity

  • UCIC report addition — pr/ucic-report (feat(reports): add UCIC report to report list, src/features/msiReport/components/reportList.tsx) — a trivial 7-line addition of one new catalog entry. Confirms the generic async-report lifecycle (triggerAsyncReport/getAsyncReportStatus/listAsyncReportsForUser/getVisibleReportCatalog) is the right extension point for new report types, and that most "add a report" backend PRs need only a matching one-line frontend PR.
  • Global search extension — feat(globalSearch): show loan tasks, KYC, legal and stage details — recently extended to surface loan tasks/KYC/legal/stage info in one search, beyond its original scope.
  • Callex Message UI — active work on telephony/dialer messaging UI (callexConfigModal and related), alongside the pre-existing Acefone/Sphoro voice integration.