Architecture: hbf-console
C4 Component Diagram
Key Flows
Authentication
LoginScreendispatches an RTK Query mutation viaauthApi.- On success, JWT and refresh token are stored in
localStorage. Root.jsxsets aREFRESH_TOKEN_INTERVAL_MILLISECONDSinterval that callsisTokenAboutToExpireand firesrefreshTokenMutationpreemptively.- When running inside MS Teams (
is.inMicrosoftTeams()),microsoftTeams.app.initialize()is called at mount andTeamsLoginScreenusesteamsAppLoginutil for SSO.
Bot Designer Render
BotScreenloads bot data via RTK Query (hbf-bot/hbf-core).- The flow graph JSON is transformed by
generateFlowGraph(dagre layout) into ReactFlow nodes and edges. AddNodePanelprovides a draggable palette; dropping a node dispatches a Redux action to append it to the graph.- Each node type has a display component (rendered on canvas) and a form component (rendered in the properties panel on selection).
Live Chat
- On org load with
LIVE_AGENTrole,Root.jsxdispatchesestablishConnectionthunk. - The thunk opens a Socket.IO connection to hbf-lcm (
REACT_APP_API_LIVECHAT_URL). - Incoming message and presence events update the
liveChatRedux slice. LiveChatScreenrenders the inbox using@chatscope/chat-ui-kit-react.- On org change or logout,
disconnectLivechatSocketis dispatched.
Feature Flag Routing
constants/env.js reads REACT_APP_* env vars at build time. The router in Root.jsx uses these flags to conditionally include routes and swap screen components (e.g., IS_HRWIZ_CONSOLE_ENABLED replaces BotScreen with HRWizConsoleScreen; IS_LIVECHAT_CONSOLE_ONLY strips all routes except live chat).