@tattvafoundation/digit-ui-module-emarket
v1.0.5
Published
Market & Stall Module - BMC
Readme
@tattvafoundation/digit-ui-module-emarket
Market & Stall (EMARKET) Module for BMC — a micro-UI module used in UPYOG by Tattva Foundation (https://tattvafoundation.org).
This package is a self-contained micro-UI module that provides screens and utilities for Market & Stall Management, Revenue & Billing, License Management, Reports and Dashboard features used by the UPYOG frontend.
Key points
- Part of the UPYOG micro-ui frontend.
- Built to be bundled together with other UPYOG modules (uses Node.js 14 for compatibility across modules).
- Uses the project's own CSS based on Tailwind CSS v2.
- Compatible with React 17 (peer) and has allowances for React 18 where possible.
Contents
- Source entry:
src/Module.tsx(exportsEMARKETModuleandinitEMARKETComponents). - Main component(s) registered:
EMARKETCard(seecomponentsToRegisterinModule.tsx). - Routes and feature list: see "Routes" section below (sourced from
the_one_using.md).
Contract (quick)
- Inputs:
EMARKETModuleaccepts props:stateCode: string,userType: string(e.g.,citizenoremployee),tenants?: string[]. - Outputs: React routes/pages mounted under the host app's routing. The module registers components via
Digit.ComponentRegistryServicewheninitEMARKETComponentsis run. - Error modes: module expects Digit runtime services (Store, ComponentRegistryService). If those are missing or the language/store calls fail, the UI may show loading or fallback behavior.
Routes / Features
The module exposes routes used by the host application (non-exhaustive, from the_one_using.md):
License Management
/license/register/license/search/license/view/:id/license/renewal/license/transfer/*(legal-heir, distant-heir, sublet, multiple-stall)/license/modification/*(name-correction, ownership-update, document-update)/license/revocation/create/license/restoration/create
Market & Stall Management
/market/structural/facility-request/market/structural/permission/market/amalgamation/create/market/subdivision/create/market/notices/scn/market/notices/view/:id
Revenue & Billing
/billing/demand-generation/billing/payment/:id/billing/receipt/:id/billing/ledger/:licenseId/billing/arrears/billing/waivers
Reports & Dashboard
/reports/*/dashboard
Include these routes in the host application's router (the module itself mounts pages using the path provided by react-router's useRouteMatch).
Usage
Install (when publishing to npm the package will be consumed by the host application):
# from the host micro-ui workspace (example)
yarn add @tattvafoundation/digit-ui-module-emarketAPI notes (from src/Module.tsx):
EMARKETModuleusesDigit.Services.useStoreto load store config for the module (moduleCode = 'EMARKET') and the current language. IfuserType === 'citizen'the module returnsnull(server/employee-only UI).initEMARKETComponentsregisters named components (e.g.,EMARKETCard) intoDigit.ComponentRegistryService.
Development
Prerequisites
- Node.js 14.x (the module is bundled to be compatible with other modules that require Node 14)
- Yarn (recommended, used by the UPYOG workspace)
Common commands (from package.json):
# build
yarn build
# prepublish step runs build automaticallyBuild notes
- The package uses
microbundle-crlto producedist/index.jsanddist/index.modern.jsbundles and outputs type definitions todist/index.d.ts. - CSS: this module imports its own Tailwind-based stylesheet (
@/styles/tailwind.css). Tailwind v2 build tooling must be compatible with the host build pipeline. The module disables CSS-modules in the microbundle config used here.
Compatibility
- Node: 14.x required for consistent bundling with other UPYOG modules.
- React: peer dependency allows React 17 (and a tolerant range for React 18). Tested against React 17.
- react-router-dom: v5.3.0 is a peer dependency; the host app should use v5 to match routing expectations.
Peer dependencies (from package.json)
- react: 17.0.2 || ^18
- react-router-dom: 5.3.0
Other runtime dependencies are declared in package.json; ensure the host app provides compatible versions.
Testing & Quality
- There are no unit tests in this package by default. Recommended additions:
- A smoke test that mounts
EMARKETModuleinside a memory router and asserts it renders foremployeeuserType. - A small test for
initEMARKETComponentsto ensure components are registered.
- A smoke test that mounts
Edge cases to consider
- Missing
Digitruntime (store, services, ComponentRegistryService) — host must provide Digit runtime. - Language/store fetch failures — UI should show loading/errors as appropriate.
- Host using react-router v6 — module expects v5
useRouteMatchand will need adaptation.
Troubleshooting
- If styles do not appear, verify Tailwind v2 build is included in host pipeline and
@/styles/tailwind.cssresolves correctly when the package is bundled. - If components fail to register, make sure
initEMARKETComponents()is called after the host initializesDigit.ComponentRegistryService.
Contributing
If you plan to contribute, follow the host project's contribution conventions. Keep changes minimal and add tests for new behaviours. Run yarn build before submitting PRs to ensure bundles are generated.
License
This module is published under the MIT license (see package.json).
For more implementation details see src/Module.tsx and package.json in this package.
