How soulcodeagency/bexio-chrome-extension works
Main Components
• Chrome Extension Core (packages/chrome-extension):
– Integrates directly with bexio’s time tracking page.
– Contains entry point files, event listeners, apps (like bexioProjectList and bexioTimetrackingTemplates), selectors, and utilities for DOM manipulation and form filling.
• Side Panel Application (packages/sidePanel-import):
– Provides the user interface for managing templates and importing entries.
– Built on a modern framework (e.g., React, as indicated by the .tsx files) and implements context/state management for template data.
• Shared Modules (packages/shared):
– Holds common functionalities and helper functions (e.g., chromeStorage, utility functions for template handling).
– Provides reusable types and functions that both the chrome-extension and side panel rely upon.
• Build and Configuration:
– npm workspace configuration (package.json at the root level)
– Build scripts and release management (Build.ps1, CreateRelease.ps1, cliff.toml, etc.)
– GitHub Actions workflows (*.github/workflows)
• Assets and Branding:
– Assets like logos, screenshots, and other UI images (assets directory) used in the extension and published on the Chrome webstore.
Establish Relationships and Data Flow
• User interactions on the bexio page trigger the chrome-extension’s event listeners (in packages/chrome-extension/src/eventListeners).
• From the event triggers, there is a data flow to:
– The “apps” layer (which organizes different functionalities like auto-filling templates in bexioProjectList and bexioTimetrackingTemplates)
– The “selectors” layer and “utils” that manipulate the DOM or handle data operations such as reading form data, triggering fields, or managing loaders.
• The shared module supplies services such as chromeStorage to persist, load, or sync templates and settings.
• The sidePanel-import package functions as the management UI:
– It uses its own set of components (TemplateEntries, TemplateModal, TemplateSelect, etc.) to display and let users interact with stored data.
– It interacts with the shared modules to fetch and update template data.
• The build configuration and scripts coordinate releases, testing, and continuous integration via tools (e.g., GitHub Actions).
Architectural Patterns and Technologies
• Modularity: The project is modularized into distinct packages (chrome-extension, sidePanel-import, shared) under a monorepo managed by npm workspaces.
• Separation of Concerns:
– UI Logic is separated (side panel vs. in-page functionalities)
– Shared functions are isolated in a common library.
• Event-driven Interactions:
– Using event listeners to capture chrome extension messages and DOM changes.
• Modern Web Development:
– Use of TypeScript in both the extension and side panel (indicated by *.ts, *.tsx and tsconfig files)
– Usage of Vite for development/build in some packages.
• Integration with External Tools:
– Import functionality from ManicTime, applying templates and filling forms accordingly.