How satriotsubasa/powerplatform-leak works
1. This is a Chromium Manifest V3 browser extension for Microsoft Dynamics 365 / Power Apps. The architecture is split into five runtime surfaces: background service worker, content script, injected page runtime, popup UI, and side panel UI. The key design choice is that anything needing Xrm or Dataverse page APIs runs in the page context, not in the extension context.
2. src/manifest.json is the root integration point. It declares the service worker, popup, side panel, web-accessible assets, icons, and the permissions needed to inspect/act on Dynamics tabs. The manifest is what ties the otherwise separate extension entry points together.
3. The background layer (src/background/background.ts) is the central coordinator. It detects Dynamics tabs, manages side-panel behavior, registers handlers, and brokers extension-level messages. It is also where cross-tab and browser-level concerns live, such as context menu setup and side-panel tab scope behavior.
4. The content script layer (src/content/content.ts) is the bridge from extension land into the page. It injects the page runtime, forwards messages, handles responses, and shows page overlays during long-running requests. This layer is the boundary that separates generic browser-extension logic from Dynamics-specific in-page execution.
5. The injected page runtime (src/content/levelup.extension.ts plus src/content/modules/*.ts) is where the actual Dynamics actions run. Modules are organized by concern: form actions, navigation, debugging, diagnostics, admin actions, “more features,” UI framework helpers, dialogs, Web API access, and request overlays. This runtime is the only place that directly relies on page objects like Xrm.
6. Action routing is layered rather than direct. src/services/ActionHandlerRegistry.ts maps action IDs to behaviors, src/services/MessageService.ts carries extension messages, and the content script relays those into the injected runtime. This creates a clear pipeline: UI event → extension service/message → active tab/content script → page runtime → Dynamics API call/result.
7. The sidebar is the primary workspace UI (src/sidebar/sidebar.tsx and src/sidebar/components/*). It contains the full action catalog, favorites, recently used items, custom commands, diagnostics, impersonation, theme switching, and status/alert surfaces. The sidebar also owns the richer interaction model, including dialogs and persistent preferences.
8. The popup is a compact quick-action surface (src/popup/popup.tsx and src/popup/components/*). It reuses the same underlying action model but presents a smaller, faster UI for common tasks and mode switching. Architecturally, it is a second UI entry point into the same action/message infrastructure, not a separate feature set.
9. Diagnostics is a major subsystem with its own shared UI package. The sidebar and popup both consume diagnostics configuration and shared components from src/ui/diagnostics/*, while the page runtime executes the diagnostics-specific data gathering logic. This split keeps the UI for diagnostic tables/dialogs separate from the data collection and page-context discovery logic.
10. Impersonation is a cross-cutting feature spanning service, hook, and UI layers. src/services/ImpersonationService.ts manages the feature’s state/behavior, sidebar hooks and components expose it to users, and the runtime flow likely impacts which user context is used when actions are executed. It is not isolated to a single screen; it affects the action execution model.
11. Custom commands, community sharing, and GitHub integration form a smaller ecosystem around user-defined actions. CustomCommandsService and the code editor/dialog components manage local command definitions, while GitHubApiService supports sharing/collection workflows. This is separate from built-in Dynamics actions and is mainly a sidebar capability.
12. Shared design and presentation concerns are centralized. Material 3 tokens/themes live in src/ui/material3/*, theme preferences are stored in sidebar contexts, and utility helpers such as icon maps, debounce, focus management, and Dynamics detection are shared across surfaces. This keeps UI consistency and tab detection logic from being duplicated across popup, sidebar, and content code.
13. Build and packaging are Vite- and TypeScript-based. vite.config.ts builds multiple entry points for background, sidebar, content, injected runtime, and popup, while helper scripts handle version bumps, release notes, and ZIP packaging. The build output is the unpacked extension in build/, with release artifacts created under release/.
14. Tests are organized by runtime boundary, which mirrors the architecture: background tests, content tests, popup tests, service tests, and sidebar tests. That structure reflects the major seams in the codebase and is useful for drawing a diagram that shows how the extension is partitioned by responsibility rather than by feature alone.
Main entry points: sidebar.tsx Sidebar · popup.tsx Popup · vite.config.ts Build pipeline · background.ts Background
Components 20
Extension runtime
Manifest, background, content, and injected page execution boundaries.
- Manifest · Root integration point that wires together the service worker, popup, side panel, permissions, and web-accessible assets.
src/manifest.json - Background · Coordinates tab detection, side panel behavior, context menus, and extension-level message handling.
src/background/background.ts - Tab detection · Identifies Dynamics/Power Apps tabs and supports background-level routing decisions.
src/background/dynamics-detection.ts - Content bridge · Injects the page runtime, forwards messages, and mediates long-running request overlays.
src/content/content.ts - Page runtime · Injected Dynamics execution environment that runs actions against Xrm and page APIs.
src/content/levelup.extension.ts - Action modules · Concern-based action implementations for forms, navigation, debugging, diagnostics, admin tasks, and web API access.
src/content/modules/form-actions.ts - Page bridge · Shared bridge utilities that connect extension messages to the page context.
src/content/page-context-bridge.ts
UI surfaces
Sidebar and popup entry points plus shared UI components.
- Sidebar · Primary workspace UI for action catalog, favorites, recent items, custom commands, diagnostics, impersonation, and preferences.
src/sidebar/sidebar.tsx - Sidebar components · Reusable sidebar UI pieces such as action sections, dialogs, status, alerts, and command editing.
src/sidebar/components/ActionSection.tsx - Popup · Compact surface for common actions and mode switching using the same action model as the sidebar.
src/popup/popup.tsx - Popup components · Popup-specific layout and controls for action sections, headers, and sidebar mode selection.
src/popup/components/PopupActionSection.tsx
Shared core
Message routing, services, utilities, and types reused across surfaces.
- Action registry · Maps action IDs to executable behaviors and centralizes action dispatch rules.
src/services/ActionHandlerRegistry.ts - Message service · Carries extension messages across UI, background, and content boundaries.
src/services/MessageService.ts - Custom commands · Stores and manages user-defined actions and community command workflows.
src/services/CustomCommandsService.ts - Impersonation · Manages impersonation state and behavior that affects action execution context.
src/services/ImpersonationService.ts - Diagnostics UI · Shared diagnostics dialog, state, table, and launcher components consumed by multiple surfaces.
src/ui/diagnostics/DiagnosticsDialog.tsx - Theme system · Material 3 tokens and theme primitives used to keep presentation consistent across surfaces.
src/ui/material3/material3Theme.ts - Core utils · Shared helpers for Dynamics detection, icons, debounce, overlay focus, and active page context.
src/utils/dynamicsDetection.ts
Build & packaging
Vite build entry points and release scripts.
- Build pipeline · Multi-entry build configuration that produces the extension bundles for background, content, injected runtime, sidebar, and popup.
vite.config.ts - Release scripts · Version bumping, release notes generation, and ZIP packaging for distribution artifacts.
scripts/package.js
Connections 34
- Manifest → Background: declares · Manifest registers the background service worker.
- Manifest → Popup: declares · Manifest registers the popup entry point.
- Manifest → Sidebar: declares · Manifest registers the side panel entry point.
- Manifest → Content bridge: loads · Manifest exposes content assets and wiring for tab injection.
- Background → Tab detection: uses · Background relies on tab detection to scope Dynamics behavior.
- Background → Message service: routes · Background handles extension message brokering.
- Background → Manifest: orchestrated by · Background responsibilities are rooted in manifest wiring.
- Content bridge → Page runtime: injects · Content script injects the page runtime into the active tab.
- Content bridge → Page bridge: bridges · Content script uses the page bridge to cross the extension/page boundary.
- Content bridge → Message service: forwards · Content script relays messages between page and extension layers.
- Page runtime → Action modules: hosts · Injected runtime loads module-based action implementations.
- Page runtime → Action registry: executes · Action routing resolves into page-context behaviors.
- Page runtime → Core utils: shares · Runtime reuses shared helpers and page detection utilities.
- Sidebar → Sidebar components: composes · Sidebar is built from many reusable sidebar components.
- Sidebar → Action registry: dispatches · Sidebar action selections flow into the registry.
- Sidebar → Custom commands: manages · Sidebar surfaces custom command creation and usage.
- Sidebar → Impersonation: exposes · Sidebar presents impersonation controls and state.
- Sidebar → Diagnostics UI: uses · Sidebar consumes the shared diagnostics UI package.
- Popup → Popup components: composes · Popup is assembled from popup-specific components.
- Popup → Action registry: dispatches · Popup reuses the same action routing model as the sidebar.
- Popup → Diagnostics UI: uses · Popup also consumes the shared diagnostics UI.
- Diagnostics UI → Page runtime: gathers from · Diagnostics UI depends on page-context diagnostics collection.
- Diagnostics UI → Sidebar: shared by · Used from the sidebar diagnostics section.
- Diagnostics UI → Popup: shared by · Used from the popup diagnostics section.
- Theme system → Sidebar: themes · Theme tokens drive sidebar presentation.
- Theme system → Popup: themes · Theme tokens also influence popup presentation.
- Core utils → Background: supports · Shared utilities feed browser-level detection and UI behavior.
- Core utils → Content bridge: supports · Utilities are reused by the content bridge.
- Build pipeline → Background: builds · Vite bundles the background entry.
- Build pipeline → Content bridge: builds · Vite bundles the content entry.
- Build pipeline → Page runtime: builds · Vite bundles the injected page runtime.
- Build pipeline → Sidebar: builds · Vite bundles the sidebar entry.
- Build pipeline → Popup: builds · Vite bundles the popup entry.
- Release scripts → Build pipeline: packages · Release scripts consume build output and assemble distributable artifacts.