Code Reference — jbwui
High-level guide to the front-end code.
All paths relative to st-integration/jbwui/src/.
Application Shell
Section titled “Application Shell”| File | Responsibility |
|---|---|
index.js | CRA entry; renders <App/> in StrictMode |
App.js | Router (createBrowserRouter) + providers: AuthProvider, MUI ThemeProvider, CssBaseline |
AuthContext.jsx | Global auth/session provider: current user, Cognito session, group/role, dealer, onboarding state, sign-in/out, proactive token refresh (60 s loop, refresh <5 min to expiry), 30-min idle timeout, session-expired dialog. Persists token to localStorage |
RouteGuard.jsx | Redirects unauthenticated users to / |
hooks/useIdleTimer.js | Activity-based idle timer with pause/resume |
layouts/RootLayout.js | Public shell (bare <Outlet/>) |
layouts/HomeLayout.js | Authenticated shell: TopBar + Sidebar + content outlet |
layouts/OnboardingLayout.jsx | Wizard card shell for the onboarding steps |
themes/theme.js | Active MUI theme (custom palette + typography variants). Other files in themes/ are unused factories |
utils/encryption.js | AES encrypt/decrypt (crypto-js) for signin/reset URL payloads — ⚠ hardcoded key |
Pages (pages/)
Section titled “Pages (pages/)”| File | Screen |
|---|---|
SignIn.js | Login; handles invited-user autofill (/signin/:id encrypted payload), routes by role post-login |
Register.js | Dealer/user self-registration (Register_old.js is a legacy copy) |
VerifyUser.js / ResetPassword.js / ChangePassword.js | Forgot-password initiate / reset with code / forced new-password |
Overview.js | Admin dashboard: DealerCards KPIs + LatestOnboardingCard + JbwAdminTools |
DealerDetails.jsx | Dealer dashboard: DealerInfo, KPIs, TenantsList, AgreementsClaimsTabs, release-notes dialog |
Onboarding.js | Dealer list (ClientGrid) + onboard new dealer + per-dealer tenant sync |
AgreementsSyncHome.jsx | Agreement sync console: 3 tabs via AgreementSyncGrid, admin dealer search, sync trigger |
UsersList.js | User management (delegates to sections/users/userscard.jsx) |
TransactionLogs.jsx | Sync/transmission logs |
JBWarrantiesFrame.jsx | JB Warranties claims iframe embed |
ToDoHome.jsx | Email-notification/to-do inbox |
onboarding/ClientName.jsx → ClientLocation.jsx →ClientPlatform.jsx → ClientCustom.jsx / ClientId.jsx (ServiceTitan) or ClientAccountId.jsx (Workiz) → CLientConnect.jsx | 4–5-step onboarding wizard; platform choice branches the path; final step calls createNewOnboarding |
Components (components/, ~72 files) — by group
Section titled “Components (components/, ~72 files) — by group”Most UI complexity lives in the agreements/claims workflows and dealer onboarding groups — start there; the rest is chrome, dialogs, and primitives.
Chrome/navigation — the authenticated app frame: role-based menu, top bar utilities, loader, and session dialog.
Sidebar.jsx (role-based menu), TopBar.jsx (greeting, admin global dealer search, release notes, contact support, user menu, staging banner), UserProfileMenu.jsx, GlobalLoader.jsx (listens to api-loading events), SessionExpiredDialog.jsx
Admin tools — the Admin Tools console: a vertical-tab launcher and one panel per tool.
JbwAdminTools.jsx (launcher) → DealerAdminTool.jsx, AddDealerTOJB360Tool.jsx, InvoiceAdminTools.jsx, ClaimManagmentAdminTool.jsx, DealerSummaryAdminTool.jsx, InvoiceSummary.jsx, ClaimsAdminTool.jsx
Agreements & sync — core agreement UI, the match/approve sync grid, equipment dialogs, and JBW push/upload/download helpers. The workhorse group.
AgreementsClaimsTabs.jsx (Agreements/Claims/Invoices tabs), AgreementList.jsx, AgreementsGrid.jsx, AgreementSyncGrid.jsx (the match/approve grid), AgreementDetails.jsx, AgreementInfo.jsx, AgreementEquipmentForm.jsx + Agm* equipment dialogs, AgreementSyncFileUpload.jsx, AgreementSyncDataDownload.jsx / AgreementSyncDownloadMenu.jsx, NewAgreementDialog.jsx, DuplicateAgreementCreateDialog.jsx, EquipmentsTable.jsx
Claims — claims grids and creation/duplication dialogs, including the bridge into the JB Warranties iframe.
ClaimsList.jsx, ClaimsGrid.jsx, CreateClaimDialog.jsx, DuplicateClaimDialog.jsx, PotentialClaimsCreateDialog.jsx, DownloadClaimsTool.jsx, JBWClaimsIframDialog.jsx (postMessage bridge to jbandassociates.biz)
Invoices — invoice list and detail dialogs.
InvoiceList.jsx, InvoiceDetailsDialog.jsx, InvoiceSummary.jsx
Dealer/tenant — dealer search/forms, tenant grids and dialogs, and the ST location/product lookups used in matching.
DealerSearch.jsx, AdminDealerSearch.jsx, DealerForm.jsx, ClientGrid.jsx, TenantsList.jsx, TenantGrid.jsx, TenantsDialog.jsx, TenantsMultiSelect.jsx, BusinessUnitSelect.jsx, STLocationSearch.jsx / STLocationSearchPopup.jsx, TblProductsSearch.jsx
Auth dialogs — password lifecycle and user registration.
ChangePasswordDialog.jsx, ResetPasswordDialog.jsx, UserRegistrationDialog.jsx
Logs — the sync/transmission log views.
TransmissionDetailsList.jsx, TransmissionGrid.jsx, TransmissionDetails.jsx
Primitives/misc — small reusable inputs, indicators, charts, and one-off dialogs.
IconTextField.jsx, JbwSwitch.jsx, JbwAvatar.jsx, JBWDateLabel.jsx, JBWAlertDialog.jsx, JBWReleasaNotesDialog.jsx, ContactUsDialog.jsx, EmailNotificationBtn.jsx, CopyToClipboardButton.jsx, GradientCircularProgress.jsx, ClientProgressBar.jsx, RevenueChart.jsx, MultiSelectChipsComponent.jsx, gridNoRowOverLay.jsx
Sections (sections/) — page-scoped composites for dealer details, overview, and users.
dealerdetails/DealerCards.jsx, dealerdetails/DealerInfo.jsx, overview/latestOnboardingCard.jsx, overview/RevenueCard.jsx, users/userscard.jsx
Service Modules
Section titled “Service Modules”All in services/, all through the shared axios instance (services/configs/axiosConfig.js, baseURL = REACT_APP_AWS_GATEWAY_BASE_URL). Cognito config in services/configs/cognitoConfig.js; auth operations in services/jbwAuthServices.js.
One module per backend domain — representative endpoints below; the complete method+path→Lambda map is the jbw-sam routes table.
| Module | Purpose | Representative endpoints |
|---|---|---|
agreementServices.js | Agreement CRUD, equipment rows, the JBW push | GET agreements/dealer/{dealerId} · PUT agreements/{id}/equipmentsync (creates in JBW) · GET/POST/PATCH agreements/{id}/equipments · +7 more (invoice search, ST equipment, duplicate, lookups) |
agreementMatchDataService.js | Match/approve console + sync trigger | GET agreementsync/{dealerId} (paged/tabbed) · GET agreementsync/{dealerId}/spcall (sync trigger) · PUT agreementsync/approve · +4 more (location match, file upload, dismiss, update) |
ClaimsServices.js | Claims grid + JBW claim-status sync | GET claims/{dealerId} · PATCH /claims/stupdate (JBW → DB sync) · POST claims/{dealerId}/createpotentialclaim · +6 more (reject, claim-id updates, search, download, admin tools) |
dealerServices.js | Dealer lookup, dashboards, onboarding kick-off, admin tools | GET /dealer?key=&type= · POST newdealeronboard · GET /dealer/{id}/gettenantinfo / /getworkizinfo (sync triggers) · PUT /dealer/{id}/admtools · +9 more (verify, cards, transmission logs, lists) |
dealerRegisterServices.js | Registration + user status | POST dealerregister/add · PUT dealerregister/userstatus · +2 more |
dealeronboard.js | Onboarded-dealer list/search | GET /dealeronboard · GET dealeronboard/search?key= |
tenantServices.js | ST tenant config | GET/PATCH /tenant/{id} · PUT /tenant/{id}/autoprocessagreement · +1 more |
InvoiceService.js | Invoice lookups + admin updates | GET /invoices/invoicedetails/{id} · +3 more |
emailNotifcationService.js | Notification inbox + agreement emails | GET/PATCH emailnotifications · POST /agreements/sendagreementemail |
signupService.js | Auth-adjacent HTTP | POST /signup, /changepassword, /resetpassword, /resetpasswordexpireduser (resend expired invite / admin password reset — :17-20) |
userservice.js | Sign-in user lookup + Terms-of-Use acceptance | GET user?email= · PUT user/updateterms (the path literal at :9 has a cosmetic trailing space — stripped by URL parsing, harmless) |
stlocationService.js / equipmentService.js / TblProductsServices.js / adminDashboardServices.js / customDataServices.js / contactusService.js | Single-endpoint helpers | GET stlocations/search/{dealerid} · GET /equipment/types · GET tblproducts/search · GET admindashboard/cardsdata · GET /customdata · POST contactus |
JWBServiceTitenService.js / JBWServiceWorkizService.js | Platform verification at onboarding | POST /jbwservicetitan (ST creds) · GET /workiz/accountverify |
JBWAgreementsService.js | JBW agreement lookup | GET /jbwagreements/agreement/{jbwAgreementID} |
jbwAuthServices.js | Cognito (non-HTTP) | signUp/confirm · authenticate · forgot/confirm password · new-password challenge · getSession/refreshSession · signOut |