@fayz-ai/plugin-dashboard 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +55 -0
  2. package/package.json +3 -3
package/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # @fayz-ai/plugin-dashboard
2
+
3
+ > One composable home where every plugin renders its own widgets.
4
+
5
+ [![npm](https://img.shields.io/npm/v/@fayz-ai/plugin-dashboard.svg)](https://www.npmjs.com/package/@fayz-ai/plugin-dashboard)
6
+ [![license](https://img.shields.io/npm/l/@fayz-ai/plugin-dashboard.svg)](https://github.com/FayaLabs/fayz-sdk/blob/main/LICENSE)
7
+
8
+ A SaaS home page is never owned by one team. Bookings wants today's agenda, finance wants revenue, the shop wants top products. The usual outcome is one god-component that imports everything and rots. This plugin kills that. It provides the `/` home surface and a **widget registry**: every plugin contributes its own `dashboardWidgets`, and the dashboard renders, orders, and lays them out into a single coherent grid — no plugin needs to know any other plugin exists.
9
+
10
+ That's the whole bet of the Fayz SDK at the home screen. Enable booking + finance + shop and the home fills itself out. The app author curates — which widgets show, order, span, an optional shared time-range — and each plugin owns its own data. Compose a real SaaS home from plugins instead of maintaining a dashboard by hand.
11
+
12
+ ## What's inside
13
+ - The `/` home **surface** rendered by `DashboardCanvas`, driven entirely by the widget registry
14
+ - KPI metrics with async `compute`, trends, goals, and currency formatting (`metrics` → KPI cards)
15
+ - Custom app sections, an onboarding/getting-started checklist, and app-contributed `customWidgets`
16
+ - App-level `layout` curation on top of every plugin's registered defaults — visibility, order, span
17
+ - An optional shared, sticky `range` control (7d/30d/90d) that widgets read via `useDashboardRange()`
18
+ - An `getKpiSummary` AI tool so an assistant can answer "how is my business doing today?"
19
+ - Per-surface user preferences (show/hide/reorder), persisted, plus full i18n
20
+
21
+ ## Install
22
+ ```bash
23
+ npm install @fayz-ai/plugin-dashboard
24
+ ```
25
+ Peer deps: `@fayz-ai/core`, `@fayz-ai/ui` (+ `react`, `react-dom`).
26
+
27
+ ## Usage
28
+ ```tsx
29
+ import { defineSaas } from '@fayz-ai/saas'
30
+ import { createDashboardPlugin } from '@fayz-ai/plugin-dashboard'
31
+
32
+ export const app = defineSaas({
33
+ // ...
34
+ plugins: [
35
+ createDashboardPlugin({
36
+ metrics: [
37
+ { id: 'revenue', label: 'Revenue', icon: 'DollarSign', format: 'currency', compute: getRevenue },
38
+ ],
39
+ currency: { code: 'BRL', locale: 'pt-BR' },
40
+ onboardingSteps: [
41
+ { id: 'connect-payments', label: 'Connect payments', done: false },
42
+ ],
43
+ range: true, // shared 7d/30d/90d time-range on the home
44
+ }),
45
+ // other plugins contribute their own widgets into this same home
46
+ ],
47
+ })
48
+ ```
49
+ Other plugins just ship `dashboardWidgets` in their manifest — they land on this surface automatically. Use `defineKpiWidget` / `defineChartWidget` / `defineTableWidget` from `@fayz-ai/ui` to build them.
50
+
51
+ ## Part of the Fayz SDK
52
+ The home surface and widget registry that the rest of the Fayz plugins render into.
53
+
54
+ ## Roadmap & contributing
55
+ Built and evolving in the open. See the [Fayz SDK roadmap](../../docs/ROADMAP.md#plugin-dashboard) for current gaps, missing features, and good first issues.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fayz-ai/plugin-dashboard",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Fayz SDK — plugin-dashboard plugin",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -25,8 +25,8 @@
25
25
  "dependencies": {
26
26
  "lucide-react": "^0.400.0",
27
27
  "zustand": "^4.5.0",
28
- "@fayz-ai/ui": "^0.1.6",
29
- "@fayz-ai/core": "^0.1.6"
28
+ "@fayz-ai/core": "^0.1.7",
29
+ "@fayz-ai/ui": "^0.1.7"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/react": "^18.3.0",