# bazhora/sales-bonus architecture

> Architecture diagram of the GitHub repository bazhora/sales-bonus, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bazhora/sales-bonus
- Repository: https://github.com/bazhora/sales-bonus

## Overview

“Пряники” is a browser-run sales analytics program: a user opens the page with one of three example datasets selected, and the program reports sellers ranked by profit with calculated bonuses in the DevTools console. The main analysis validates and aggregates purchase records, ranks sellers, and builds each seller’s summary, delegating revenue and bonus calculations to separate functions. The excerpts show the analysis logic and dataset shapes; page wiring and console output are supported by the README, not inspected HTML source.

Main entry points: [`index.html`](https://github.com/bazhora/sales-bonus/blob/main/index.html) (Launch page), [`src/main.js`](https://github.com/bazhora/sales-bonus/blob/main/src/main.js) (Sales analysis), [`data/dataset_1.js`](https://github.com/bazhora/sales-bonus/blob/main/data/dataset_1.js) (Dataset 1), [`data/dataset_2.js`](https://github.com/bazhora/sales-bonus/blob/main/data/dataset_2.js) (Dataset 2)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Sales inputs"]
  node_dataset1["Dataset 1<br/>[dataset_1.js]"]
  node_dataset2["Dataset 2<br/>[dataset_2.js]"]
  node_dataset3["Dataset 3<br/>[dataset_3.js]"]
end

subgraph group_analysis["Seller analysis"]
  node_analyze["Sales analysis<br/>[main.js]"]
end

subgraph group_calculations["Calculation rules"]
  node_revenue["Revenue rule<br/>[main.js]"]
  node_bonus["Bonus rule<br/>[main.js]"]
end

subgraph group_runtime["Browser runtime"]
  node_page["Launch page<br/>[index.html]"]
  node_console(("DevTools console"))
end

node_user(("User"))

node_user -->|"opens"| node_page
node_page -->|"selects dataset"| node_dataset1
node_page -->|"selects dataset"| node_dataset2
node_page -->|"selects dataset"| node_dataset3
node_page -->|"runs analysis"| node_analyze
node_analyze -->|"calls"| node_revenue
node_analyze -->|"calls"| node_bonus
node_analyze -->|"prints ranking"| node_console

click node_page "https://github.com/bazhora/sales-bonus/blob/main/index.html"
click node_dataset1 "https://github.com/bazhora/sales-bonus/blob/main/data/dataset_1.js"
click node_dataset2 "https://github.com/bazhora/sales-bonus/blob/main/data/dataset_2.js"
click node_dataset3 "https://github.com/bazhora/sales-bonus/blob/main/data/dataset_3.js"
click node_analyze "https://github.com/bazhora/sales-bonus/blob/main/src/main.js"
click node_revenue "https://github.com/bazhora/sales-bonus/blob/main/src/main.js"
click node_bonus "https://github.com/bazhora/sales-bonus/blob/main/src/main.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dataset1,node_dataset2,node_dataset3,node_user toneBlue
class node_analyze toneAmber
class node_revenue,node_bonus toneMint
class node_page,node_console toneRose
```

## Components

### Sales inputs

- [Dataset 1](https://github.com/bazhora/sales-bonus/blob/main/data/dataset_1.js): `data/dataset_1.js`
- [Dataset 2](https://github.com/bazhora/sales-bonus/blob/main/data/dataset_2.js): `data/dataset_2.js`
- [Dataset 3](https://github.com/bazhora/sales-bonus/blob/main/data/dataset_3.js): `data/dataset_3.js`

### Seller analysis

- [Sales analysis](https://github.com/bazhora/sales-bonus/blob/main/src/main.js): `src/main.js`

### Calculation rules

- [Revenue rule](https://github.com/bazhora/sales-bonus/blob/main/src/main.js): `src/main.js`
- [Bonus rule](https://github.com/bazhora/sales-bonus/blob/main/src/main.js): `src/main.js`

### Browser runtime

- [Launch page](https://github.com/bazhora/sales-bonus/blob/main/index.html): `index.html`
- **DevTools console**

### Other components

- **User**

## Connections

- User → Launch page: opens (evidence: `README.md`)
- Launch page → Dataset 1: selects dataset (evidence: `README.md`)
- Launch page → Dataset 2: selects dataset (evidence: `README.md`)
- Launch page → Dataset 3: selects dataset (evidence: `README.md`)
- Launch page → Sales analysis: runs analysis (evidence: `README.md`)
- Sales analysis → Revenue rule: calls (evidence: `src/main.js`)
- Sales analysis → Bonus rule: calls (evidence: `src/main.js`)
- Sales analysis → DevTools console: prints ranking (evidence: `README.md`)
