@fayz-ai/plugin-dashboard 0.9.0 → 0.9.1
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.
- package/README.md +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{builders.d.ts → lib/builders.d.ts} +1 -1
- package/dist/lib/builders.d.ts.map +1 -0
- package/dist/{DashboardPage.d.ts → views/DashboardPage.d.ts} +1 -1
- package/dist/views/DashboardPage.d.ts.map +1 -0
- package/package.json +4 -6
- package/dist/DashboardPage.d.ts.map +0 -1
- package/dist/builders.d.ts.map +0 -1
- package/src/DashboardPage.tsx +0 -42
- package/src/builders.tsx +0 -99
- package/src/index.ts +0 -204
- package/src/locales/en.ts +0 -23
- package/src/locales/index.ts +0 -7
- package/src/locales/pt-BR.ts +0 -23
- package/src/types.ts +0 -127
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @fayz-ai/plugin-dashboard
|
|
2
2
|
|
|
3
|
-
> **Status: experimental (incubating).** Not capability-complete — missing some or all of the capability bar (data-provider contract w/ supabase+mock pair, entity registries, settings, migrations; see `docs/PLUGIN-PATTERNS.md`). Fine to explore in dogfoods; NOT ready for fresh installs or generated apps, and its API may change without notice.
|
|
3
|
+
> **Status: experimental (incubating).** Not capability-complete — missing some or all of the capability bar (data-provider contract w/ supabase+mock pair, entity registries, settings, migrations; see `docs/plugins/PLUGIN-PATTERNS.md`). Fine to explore in dogfoods; NOT ready for fresh installs or generated apps, and its API may change without notice.
|
|
4
4
|
|
|
5
5
|
> One composable home where every plugin renders its own widgets.
|
|
6
6
|
|
|
@@ -28,7 +28,7 @@ Peer deps: `@fayz-ai/core`, `@fayz-ai/ui` (+ `react`, `react-dom`).
|
|
|
28
28
|
|
|
29
29
|
## Usage
|
|
30
30
|
```tsx
|
|
31
|
-
import { defineSaas } from '@fayz-ai/
|
|
31
|
+
import { defineSaas } from '@fayz-ai/admin'
|
|
32
32
|
import { createDashboardPlugin } from '@fayz-ai/plugin-dashboard'
|
|
33
33
|
|
|
34
34
|
export const app = defineSaas({
|
|
@@ -54,4 +54,4 @@ Other plugins just ship `dashboardWidgets` in their manifest — they land on th
|
|
|
54
54
|
The home surface and widget registry that the rest of the Fayz plugins render into.
|
|
55
55
|
|
|
56
56
|
## Roadmap & contributing
|
|
57
|
-
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.
|
|
57
|
+
Built and evolving in the open. See the [Fayz SDK roadmap](../../docs/platform/ROADMAP.md#plugin-dashboard) for current gaps, missing features, and good first issues.
|
package/dist/index.d.ts
CHANGED
|
@@ -55,8 +55,8 @@ export interface DashboardPluginOptions {
|
|
|
55
55
|
range?: DashboardCanvasProps['range'];
|
|
56
56
|
}
|
|
57
57
|
export declare function createDashboardPlugin(options?: DashboardPluginOptions): PluginManifest;
|
|
58
|
-
export { DashboardPage } from './DashboardPage';
|
|
58
|
+
export { DashboardPage } from './views/DashboardPage';
|
|
59
59
|
export { DashboardCanvas, DashboardNavigateProvider, useDashboardNavigate, resolveDashboardLayout, useDashboardPreferences, type DashboardCanvasProps, type LaidOutWidget, type DashboardPreferencesState, } from '@fayz-ai/ui';
|
|
60
|
-
export { metricsToWidgets, sectionsToWidgets, onboardingToWidget, } from './builders';
|
|
60
|
+
export { metricsToWidgets, sectionsToWidgets, onboardingToWidget, } from './lib/builders';
|
|
61
61
|
export type { DashboardMetric, MetricValue, MetricCategory, MetricFormat, ResolvedMetric, DashboardSection, DashboardSectionProps, DashboardZone, OnboardingStep, OnboardingProgress, DashboardPreferences, } from './types';
|
|
62
62
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc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cAAc,EACd,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,SAAS,CAAA"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/builders.tsx","../src/locales/en.ts","../src/locales/pt-BR.ts","../src/locales/index.ts","../src/DashboardPage.tsx","../src/index.ts"],"names":["jsx","React"],"mappings":";;;;;;;AAcA,IAAM,MAAA,GAAS,WAAA;AAGR,SAAS,gBAAA,CAAiB,SAA4B,QAAA,EAA8C;AACzG,EAAA,OAAO,OAAA,CAAQ,GAAA;AAAA,IAAI,CAAC,MAAA,EAAQ,CAAA,KAC1B,eAAA,CAAgB;AAAA,MACd,EAAA,EAAI,CAAA,cAAA,EAAiB,MAAA,CAAO,EAAE,CAAA,CAAA;AAAA,MAC9B,OAAO,MAAA,CAAO,KAAA;AAAA,MACd,MAAM,MAAA,CAAO,IAAA;AAAA,MACb,MAAA,EAAQ,MAAA;AAAA,MACR,gBAAgB,MAAA,CAAO,cAAA;AAAA,MACvB,YAAA,EAAc,OAAO,YAAA,IAAgB,CAAA;AAAA,MACrC,WAAW,sBACT,GAAA;AAAA,QAAC,OAAA;AAAA,QAAA;AAAA,UACC,OAAO,MAAA,CAAO,KAAA;AAAA,UACd,MAAM,MAAA,CAAO,IAAA;AAAA,UACb,SAAS,MAAA,CAAO,OAAA;AAAA,UAChB,QAAQ,MAAA,CAAO,MAAA;AAAA,UACf,QAAA;AAAA,UACA,MAAM,MAAA,CAAO,IAAA;AAAA,UACb,QAAQ,MAAA,CAAO;AAAA;AAAA;AACjB,KAEH;AAAA,GACH;AACF;AAGO,SAAS,kBAAkB,QAAA,EAAoD;AACpF,EAAA,OAAO,QAAA,CAAS,GAAA,CAAI,CAAC,OAAA,KAAY;AAC/B,IAAA,MAAM,mBAAmB,OAAA,CAAQ,SAAA;AACjC,IAAA,MAAM,UAA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A,MACP;AAAA,QACE,EAAA,EAAI,uBAAA;AAAA,QACJ,IAAA,EAAM,eAAA;AAAA,QACN,WAAA,EAAa,mGAAA;AAAA,QACb,IAAA,EAAM,WAAA;AAAA,QACN,IAAA,EAAM,MAAA;AAAA,QACN,QAAA,EAAU,WAAA;AAAA,QACV,UAAA,EAAY;AAAA,UACV,IAAA,EAAM,QAAA;AAAA,UACN,UAAA,EAAY;AAAA,YACV,QAAA,EAAU;AAAA,cACR,IAAA,EAAM,QAAA;AAAA,cACN,WAAA,EAAa,2BAAA;AAAA,cACb,MAAM,CAAC,SAAA,EAAW,YAAA,EAAc,SAAA,EAAW,UAAU,KAAK;AAAA;AAC5D;AACF,SACF;AAAA,QACA,WAAA,EAAa;AAAA,UACX,EAAE,OAAO,iCAAA,EAAkC;AAAA,UAC3C,EAAE,OAAO,0BAAA,EAA2B;AAAA,UACpC,EAAE,OAAO,4BAAA;AAA6B;AACxC;AACF,KACF;AAAA,IAEA,OAAA,EAAS;AAAA,GACX;AACF","file":"index.js","sourcesContent":["import * as React from 'react'\nimport type { DashboardWidgetDef } from '@fayz-ai/core'\nimport {\n KpiCard,\n OnboardingWidget,\n defineKpiWidget,\n defineCustomWidget,\n defineOnboardingWidget,\n useDashboardNavigate,\n type KpiCurrency,\n type OnboardingStepInput,\n} from '@fayz-ai/ui'\nimport type { DashboardMetric, DashboardSection, OnboardingStep } from './types'\n\nconst DOMAIN = 'dashboard'\n\n/** Legacy DashboardMetric[] → KPI widgets (async compute via the shared KpiCard). */\nexport function metricsToWidgets(metrics: DashboardMetric[], currency?: KpiCurrency): DashboardWidgetDef[] {\n return metrics.map((metric, i) =>\n defineKpiWidget({\n id: `dashboard.kpi.${metric.id}`,\n title: metric.label,\n icon: metric.icon,\n domain: DOMAIN,\n defaultVisible: metric.defaultVisible,\n defaultOrder: metric.defaultOrder ?? i,\n component: () => (\n <KpiCard\n label={metric.label}\n icon={metric.icon}\n compute={metric.compute}\n format={metric.format}\n currency={currency}\n goal={metric.goal}\n accent={metric.accent}\n />\n ),\n }),\n )\n}\n\n/** Legacy DashboardSection[] → full-width custom widgets. */\nexport function sectionsToWidgets(sections: DashboardSection[]): DashboardWidgetDef[] {\n return sections.map((section) => {\n const SectionComponent = section.component\n const Wrapped = () => {\n const navigate = useDashboardNavigate()\n return <SectionComponent onNavigate={navigate} />\n }\n return defineCustomWidget({\n id: `dashboard.section.${section.id}`,\n title: section.title,\n icon: section.icon,\n domain: DOMAIN,\n // Half-width by default (guide/section cards like \"Agenda de Hoje\" should\n // sit beside others, not dominate the row). Sections can opt into full\n // width with `span: 4`.\n span: section.span ?? 2,\n defaultOrder: 100 + section.order,\n verticalId: section.verticalId,\n component: Wrapped,\n })\n })\n}\n\n/** Onboarding steps → a single \"first steps to set up\" checklist widget. */\nexport function onboardingToWidget(\n steps: OnboardingStep[],\n labels: { title: string; subtitle: string },\n): DashboardWidgetDef {\n const sorted = [...steps].sort((a, b) => a.order - b.order)\n // Built once, outside the component: OnboardingWidget keys its async check\n // effect on the `steps` identity, so rebuilding this array on every render\n // restarted (and cancelled) the in-flight checks every time an ancestor\n // re-rendered — the checklist could sit on its skeleton forever and re-issue\n // one query per step per render while it did.\n const items: OnboardingStepInput[] = sorted.map((s) => ({\n id: s.id,\n title: s.title,\n description: s.description,\n icon: s.icon,\n check: s.check,\n action: s.action,\n }))\n const Onboarding = () => {\n const navigate = useDashboardNavigate()\n return <OnboardingWidget title={labels.title} subtitle={labels.subtitle} steps={items} onNavigate={navigate} />\n }\n return defineOnboardingWidget({\n id: 'dashboard.onboarding',\n title: labels.title,\n domain: DOMAIN,\n // Half-width (2 of 4 cols) so the getting-started guide sits beside other\n // content rather than dominating the row.\n span: 2,\n defaultOrder: 50,\n component: Onboarding,\n })\n}\n","export const en: Record<string, string> = {\n 'dashboard.title': 'Dashboard',\n 'dashboard.subtitle': 'Business overview',\n 'dashboard.kpi.title': 'Key Metrics',\n 'dashboard.kpi.noData': 'No metrics configured',\n 'dashboard.kpi.error': 'Failed to load',\n 'dashboard.kpi.refresh': 'Refresh',\n 'dashboard.onboarding.title': 'Getting Started',\n 'dashboard.onboarding.subtitle': 'Complete these steps to set up your business',\n 'dashboard.onboarding.completed': 'Completed',\n 'dashboard.onboarding.allDone': \"All done! You're all set.\",\n 'dashboard.onboarding.dismiss': 'Dismiss',\n 'dashboard.onboarding.step': 'Step',\n 'dashboard.onboarding.of': 'of',\n 'dashboard.settings.title': 'Dashboard',\n 'dashboard.settings.subtitle': 'Choose which metrics appear on your dashboard',\n 'dashboard.settings.metricsVisibility': 'Visible Metrics',\n 'dashboard.settings.metricOrder': 'Metric Order',\n 'dashboard.settings.resetDefaults': 'Reset to Defaults',\n 'dashboard.settings.saved': 'Dashboard preferences saved',\n 'dashboard.empty.title': 'Welcome!',\n 'dashboard.empty.subtitle': 'Your dashboard will show key metrics and information here.',\n}\n","export const ptBR: Record<string, string> = {\n 'dashboard.title': 'Painel',\n 'dashboard.subtitle': 'Visao geral do seu negocio',\n 'dashboard.kpi.title': 'Metricas',\n 'dashboard.kpi.noData': 'Nenhuma metrica configurada',\n 'dashboard.kpi.error': 'Falha ao carregar',\n 'dashboard.kpi.refresh': 'Atualizar',\n 'dashboard.onboarding.title': 'Primeiros Passos',\n 'dashboard.onboarding.subtitle': 'Complete estes passos para configurar seu negocio',\n 'dashboard.onboarding.completed': 'Concluido',\n 'dashboard.onboarding.allDone': 'Tudo pronto! Voce esta configurado.',\n 'dashboard.onboarding.dismiss': 'Dispensar',\n 'dashboard.onboarding.step': 'Passo',\n 'dashboard.onboarding.of': 'de',\n 'dashboard.settings.title': 'Painel',\n 'dashboard.settings.subtitle': 'Escolha quais metricas aparecem no seu painel',\n 'dashboard.settings.metricsVisibility': 'Metricas Visiveis',\n 'dashboard.settings.metricOrder': 'Ordem das Metricas',\n 'dashboard.settings.resetDefaults': 'Restaurar Padrao',\n 'dashboard.settings.saved': 'Preferencias do painel salvas',\n 'dashboard.empty.title': 'Bem-vindo!',\n 'dashboard.empty.subtitle': 'Seu painel mostrara metricas e informacoes importantes aqui.',\n}\n","import { en } from './en'\nimport { ptBR } from './pt-BR'\n\nexport const dashboardLocales: Record<string, Record<string, string>> = {\n en,\n 'pt-BR': ptBR,\n}\n","import * as React from 'react'\nimport type { DashboardWidgetDef } from '@fayz-ai/core'\nimport { WidgetGrid } from '@fayz-ai/ui'\nimport { metricsToWidgets, sectionsToWidgets } from './builders'\nimport type { DashboardMetric, DashboardSection } from './types'\n\nexport interface DashboardPageProps {\n title?: string\n subtitle?: string\n metrics?: DashboardMetric[]\n sections?: DashboardSection[]\n currency?: { code?: string; locale?: string; symbol?: string }\n /** Render the in-content title/subtitle. Set false when the app shell owns\n * the page title (sidebar/GHL-style layouts). Default: true. */\n showHeader?: boolean\n}\n\n/**\n * Back-compat shim. The dashboard is now a widget registry (see DashboardCanvas),\n * but standalone callers can still render a fixed set of metrics/sections. This\n * converts them to widget definitions and renders them through the shared grid.\n */\nexport function DashboardPage({\n title = 'Dashboard', subtitle = 'Business overview', metrics = [], sections = [], currency, showHeader = true,\n}: DashboardPageProps) {\n const widgets: DashboardWidgetDef[] = React.useMemo(\n () => [...metricsToWidgets(metrics, currency), ...sectionsToWidgets(sections)],\n [metrics, sections, currency],\n )\n\n return (\n <div className=\"space-y-6 p-6\">\n {showHeader ? (\n <div>\n <h1 className=\"text-2xl font-semibold tracking-tight\">{title}</h1>\n <p className=\"mt-1 text-sm text-muted-foreground\">{subtitle}</p>\n </div>\n ) : null}\n <WidgetGrid widgets={widgets} surface=\"home\" />\n </div>\n )\n}\n","import React from 'react'\nimport type { PluginManifest, PluginScope, VerticalId, DashboardWidgetDef, DashboardLayoutConfig } from '@fayz-ai/core'\nimport { DashboardCanvas, type DashboardCanvasProps } from '@fayz-ai/ui'\nimport { DashboardPage } from './DashboardPage'\nimport { metricsToWidgets, sectionsToWidgets, onboardingToWidget } from './builders'\nimport { dashboardLocales } from './locales'\nimport type { DashboardMetric, DashboardSection, OnboardingStep } from './types'\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\nexport interface DashboardPluginLabels {\n pageTitle: string\n pageSubtitle: string\n kpiTitle: string\n onboardingTitle: string\n onboardingSubtitle: string\n settingsTitle: string\n}\n\nexport interface DashboardPluginOptions {\n /** KPI metrics to show on the dashboard */\n metrics?: DashboardMetric[]\n /** Custom sections injected by the consumer app */\n sections?: DashboardSection[]\n /** Onboarding steps for the getting-started checklist */\n onboardingSteps?: OnboardingStep[]\n /** Label overrides */\n labels?: Partial<DashboardPluginLabels>\n /** Currency config for metrics that use 'currency' format */\n currency?: { code?: string; locale?: string; symbol?: string }\n /** Plugin scope */\n scope?: PluginScope\n /** Vertical ID */\n verticalId?: VerticalId\n /** Whether to show onboarding module. Default: true if onboardingSteps provided */\n showOnboarding?: boolean\n /** Nav position (default: 0 — first item) */\n navPosition?: number\n /** Nav section (default: 'main') */\n navSection?: 'main' | 'secondary'\n /** Navigation icon override (default: 'LayoutDashboard') */\n navIcon?: string\n /** Skip adding a navigation entry (use when the consumer app provides its own page entry for '/') */\n skipNavigation?: boolean\n /** Render the in-content title/subtitle. Set false when the app shell owns the\n * page title (sidebar/GHL-style layouts). Default: true. */\n showHeader?: boolean\n /** Show the \"Customize\" menu (choose which widgets appear). Set false for a\n * clean, chrome-free B2C home. Default: true. */\n customizable?: boolean\n /** App-level curation of the home surface — which widgets show, order, span.\n * Applied on top of every plugin's registered defaults. */\n layout?: DashboardLayoutConfig\n /** Custom widgets the consumer app contributes directly to the home surface. */\n customWidgets?: DashboardWidgetDef[]\n /** Show the shared, sticky time-range control on the home. Pass `true` for\n * defaults (7d/30d/90d) or an options object. Widgets read it via\n * useDashboardRange(); provide `onChange` to drive app-level refetching. */\n range?: DashboardCanvasProps['range']\n}\n\n// ---------------------------------------------------------------------------\n// Defaults\n// ---------------------------------------------------------------------------\n\nconst DEFAULT_LABELS: DashboardPluginLabels = {\n pageTitle: 'Dashboard',\n pageSubtitle: 'Business overview',\n kpiTitle: 'Key Metrics',\n onboardingTitle: 'Getting Started',\n onboardingSubtitle: 'Complete these steps to set up your business',\n settingsTitle: 'Dashboard',\n}\n\n// ---------------------------------------------------------------------------\n// Factory\n// ---------------------------------------------------------------------------\n\nexport function createDashboardPlugin(options?: DashboardPluginOptions): PluginManifest {\n const labels: DashboardPluginLabels = { ...DEFAULT_LABELS, ...options?.labels }\n const onboardingSteps = options?.onboardingSteps ?? []\n const showOnboarding = options?.showOnboarding ?? onboardingSteps.length > 0\n\n // Everything the dashboard plugin owns flows through the widget registry:\n // legacy metrics/sections, the onboarding checklist, and app custom widgets.\n const dashboardWidgets: DashboardWidgetDef[] = [\n ...metricsToWidgets(options?.metrics ?? [], options?.currency),\n ...sectionsToWidgets(options?.sections ?? []),\n ...(showOnboarding && onboardingSteps.length > 0\n ? [onboardingToWidget(onboardingSteps, { title: labels.onboardingTitle, subtitle: labels.onboardingSubtitle })]\n : []),\n ...(options?.customWidgets ?? []),\n ]\n\n const PageComponent: React.ComponentType<unknown> = () =>\n React.createElement(DashboardCanvas, {\n surface: 'home',\n title: labels.pageTitle,\n subtitle: labels.pageSubtitle,\n showHeader: options?.showHeader,\n customizable: options?.customizable,\n appLayout: options?.layout,\n range: options?.range,\n })\n\n return {\n id: 'dashboard',\n name: labels.pageTitle,\n icon: 'LayoutDashboard',\n version: '1.0.0',\n scope: options?.scope ?? 'universal',\n verticalId: options?.verticalId,\n defaultEnabled: true,\n dependencies: [],\n declaredFeatures: [\n { id: 'dashboard', label: labels.pageTitle, group: 'Core' },\n ],\n\n navigation: options?.skipNavigation ? [] : [\n {\n section: options?.navSection ?? 'main',\n position: options?.navPosition ?? 0,\n label: labels.pageTitle,\n route: '/',\n icon: options?.navIcon ?? 'LayoutDashboard',\n },\n ],\n\n routes: [\n {\n path: '/',\n component: PageComponent,\n },\n ],\n\n widgets: [],\n dashboardWidgets,\n\n aiTools: [\n {\n id: 'dashboard.kpi-summary',\n name: 'getKpiSummary',\n description: 'Returns a summary of all KPI metrics for the current dashboard, including trends and comparisons.',\n icon: 'BarChart3',\n mode: 'read' as const,\n category: 'Dashboard',\n parameters: {\n type: 'object' as const,\n properties: {\n category: {\n type: 'string' as const,\n description: 'Filter by metric category',\n enum: ['revenue', 'operations', 'clients', 'custom', 'all'],\n },\n },\n },\n suggestions: [\n { label: 'How is my business doing today?' },\n { label: \"What's my revenue today?\" },\n { label: 'Give me a summary of today' },\n ],\n },\n ],\n\n locales: dashboardLocales,\n }\n}\n\n// ---------------------------------------------------------------------------\n// Re-exports\n// ---------------------------------------------------------------------------\n\nexport { DashboardPage } from './DashboardPage'\nexport {\n DashboardCanvas,\n DashboardNavigateProvider,\n useDashboardNavigate,\n resolveDashboardLayout,\n useDashboardPreferences,\n type DashboardCanvasProps,\n type LaidOutWidget,\n type DashboardPreferencesState,\n} from '@fayz-ai/ui'\nexport {\n metricsToWidgets,\n sectionsToWidgets,\n onboardingToWidget,\n} from './builders'\n\nexport type {\n DashboardMetric,\n MetricValue,\n MetricCategory,\n MetricFormat,\n ResolvedMetric,\n DashboardSection,\n DashboardSectionProps,\n DashboardZone,\n OnboardingStep,\n OnboardingProgress,\n DashboardPreferences,\n} from './types'\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/lib/builders.tsx","../src/locales/en.ts","../src/locales/pt-BR.ts","../src/locales/index.ts","../src/views/DashboardPage.tsx","../src/index.ts"],"names":["jsx","React"],"mappings":";;;;;;;AAcA,IAAM,MAAA,GAAS,WAAA;AAGR,SAAS,gBAAA,CAAiB,SAA4B,QAAA,EAA8C;AACzG,EAAA,OAAO,OAAA,CAAQ,GAAA;AAAA,IAAI,CAAC,MAAA,EAAQ,CAAA,KAC1B,eAAA,CAAgB;AAAA,MACd,EAAA,EAAI,CAAA,cAAA,EAAiB,MAAA,CAAO,EAAE,CAAA,CAAA;AAAA,MAC9B,OAAO,MAAA,CAAO,KAAA;AAAA,MACd,MAAM,MAAA,CAAO,IAAA;AAAA,MACb,MAAA,EAAQ,MAAA;AAAA,MACR,gBAAgB,MA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EAAE,EAAA,EAAI,WAAA,EAAa,OAAO,MAAA,CAAO,SAAA,EAAW,OAAO,MAAA;AAAO,KAC5D;AAAA,IAEA,UAAA,EAAY,OAAA,EAAS,cAAA,GAAiB,EAAC,GAAI;AAAA,MACzC;AAAA,QACE,OAAA,EAAS,SAAS,UAAA,IAAc,MAAA;AAAA,QAChC,QAAA,EAAU,SAAS,WAAA,IAAe,CAAA;AAAA,QAClC,OAAO,MAAA,CAAO,SAAA;AAAA,QACd,KAAA,EAAO,GAAA;AAAA,QACP,IAAA,EAAM,SAAS,OAAA,IAAW;AAAA;AAC5B,KACF;AAAA,IAEA,MAAA,EAAQ;AAAA,MACN;AAAA,QACE,IAAA,EAAM,GAAA;AAAA,QACN,SAAA,EAAW;AAAA;AACb,KACF;AAAA,IAEA,SAAS,EAAC;AAAA,IACV,gBAAA;AAAA,IAEA,OAAA,EAAS;AAAA,MACP;AAAA,QACE,EAAA,EAAI,uBAAA;AAAA,QACJ,IAAA,EAAM,eAAA;AAAA,QACN,WAAA,EAAa,mGAAA;AAAA,QACb,IAAA,EAAM,WAAA;AAAA,QACN,IAAA,EAAM,MAAA;AAAA,QACN,QAAA,EAAU,WAAA;AAAA,QACV,UAAA,EAAY;AAAA,UACV,IAAA,EAAM,QAAA;AAAA,UACN,UAAA,EAAY;AAAA,YACV,QAAA,EAAU;AAAA,cACR,IAAA,EAAM,QAAA;AAAA,cACN,WAAA,EAAa,2BAAA;AAAA,cACb,MAAM,CAAC,SAAA,EAAW,YAAA,EAAc,SAAA,EAAW,UAAU,KAAK;AAAA;AAC5D;AACF,SACF;AAAA,QACA,WAAA,EAAa;AAAA,UACX,EAAE,OAAO,iCAAA,EAAkC;AAAA,UAC3C,EAAE,OAAO,0BAAA,EAA2B;AAAA,UACpC,EAAE,OAAO,4BAAA;AAA6B;AACxC;AACF,KACF;AAAA,IAEA,OAAA,EAAS;AAAA,GACX;AACF","file":"index.js","sourcesContent":["import * as React from 'react'\nimport type { DashboardWidgetDef } from '@fayz-ai/core'\nimport {\n KpiCard,\n OnboardingWidget,\n defineKpiWidget,\n defineCustomWidget,\n defineOnboardingWidget,\n useDashboardNavigate,\n type KpiCurrency,\n type OnboardingStepInput,\n} from '@fayz-ai/ui'\nimport type { DashboardMetric, DashboardSection, OnboardingStep } from '../types'\n\nconst DOMAIN = 'dashboard'\n\n/** Legacy DashboardMetric[] → KPI widgets (async compute via the shared KpiCard). */\nexport function metricsToWidgets(metrics: DashboardMetric[], currency?: KpiCurrency): DashboardWidgetDef[] {\n return metrics.map((metric, i) =>\n defineKpiWidget({\n id: `dashboard.kpi.${metric.id}`,\n title: metric.label,\n icon: metric.icon,\n domain: DOMAIN,\n defaultVisible: metric.defaultVisible,\n defaultOrder: metric.defaultOrder ?? i,\n component: () => (\n <KpiCard\n label={metric.label}\n icon={metric.icon}\n compute={metric.compute}\n format={metric.format}\n currency={currency}\n goal={metric.goal}\n accent={metric.accent}\n />\n ),\n }),\n )\n}\n\n/** Legacy DashboardSection[] → full-width custom widgets. */\nexport function sectionsToWidgets(sections: DashboardSection[]): DashboardWidgetDef[] {\n return sections.map((section) => {\n const SectionComponent = section.component\n const Wrapped = () => {\n const navigate = useDashboardNavigate()\n return <SectionComponent onNavigate={navigate} />\n }\n return defineCustomWidget({\n id: `dashboard.section.${section.id}`,\n title: section.title,\n icon: section.icon,\n domain: DOMAIN,\n // Half-width by default (guide/section cards like \"Agenda de Hoje\" should\n // sit beside others, not dominate the row). Sections can opt into full\n // width with `span: 4`.\n span: section.span ?? 2,\n defaultOrder: 100 + section.order,\n verticalId: section.verticalId,\n component: Wrapped,\n })\n })\n}\n\n/** Onboarding steps → a single \"first steps to set up\" checklist widget. */\nexport function onboardingToWidget(\n steps: OnboardingStep[],\n labels: { title: string; subtitle: string },\n): DashboardWidgetDef {\n const sorted = [...steps].sort((a, b) => a.order - b.order)\n // Built once, outside the component: OnboardingWidget keys its async check\n // effect on the `steps` identity, so rebuilding this array on every render\n // restarted (and cancelled) the in-flight checks every time an ancestor\n // re-rendered — the checklist could sit on its skeleton forever and re-issue\n // one query per step per render while it did.\n const items: OnboardingStepInput[] = sorted.map((s) => ({\n id: s.id,\n title: s.title,\n description: s.description,\n icon: s.icon,\n check: s.check,\n action: s.action,\n }))\n const Onboarding = () => {\n const navigate = useDashboardNavigate()\n return <OnboardingWidget title={labels.title} subtitle={labels.subtitle} steps={items} onNavigate={navigate} />\n }\n return defineOnboardingWidget({\n id: 'dashboard.onboarding',\n title: labels.title,\n domain: DOMAIN,\n // Half-width (2 of 4 cols) so the getting-started guide sits beside other\n // content rather than dominating the row.\n span: 2,\n defaultOrder: 50,\n component: Onboarding,\n })\n}\n","export const en: Record<string, string> = {\n 'dashboard.title': 'Dashboard',\n 'dashboard.subtitle': 'Business overview',\n 'dashboard.kpi.title': 'Key Metrics',\n 'dashboard.kpi.noData': 'No metrics configured',\n 'dashboard.kpi.error': 'Failed to load',\n 'dashboard.kpi.refresh': 'Refresh',\n 'dashboard.onboarding.title': 'Getting Started',\n 'dashboard.onboarding.subtitle': 'Complete these steps to set up your business',\n 'dashboard.onboarding.completed': 'Completed',\n 'dashboard.onboarding.allDone': \"All done! You're all set.\",\n 'dashboard.onboarding.dismiss': 'Dismiss',\n 'dashboard.onboarding.step': 'Step',\n 'dashboard.onboarding.of': 'of',\n 'dashboard.settings.title': 'Dashboard',\n 'dashboard.settings.subtitle': 'Choose which metrics appear on your dashboard',\n 'dashboard.settings.metricsVisibility': 'Visible Metrics',\n 'dashboard.settings.metricOrder': 'Metric Order',\n 'dashboard.settings.resetDefaults': 'Reset to Defaults',\n 'dashboard.settings.saved': 'Dashboard preferences saved',\n 'dashboard.empty.title': 'Welcome!',\n 'dashboard.empty.subtitle': 'Your dashboard will show key metrics and information here.',\n}\n","export const ptBR: Record<string, string> = {\n 'dashboard.title': 'Painel',\n 'dashboard.subtitle': 'Visao geral do seu negocio',\n 'dashboard.kpi.title': 'Metricas',\n 'dashboard.kpi.noData': 'Nenhuma metrica configurada',\n 'dashboard.kpi.error': 'Falha ao carregar',\n 'dashboard.kpi.refresh': 'Atualizar',\n 'dashboard.onboarding.title': 'Primeiros Passos',\n 'dashboard.onboarding.subtitle': 'Complete estes passos para configurar seu negocio',\n 'dashboard.onboarding.completed': 'Concluido',\n 'dashboard.onboarding.allDone': 'Tudo pronto! Voce esta configurado.',\n 'dashboard.onboarding.dismiss': 'Dispensar',\n 'dashboard.onboarding.step': 'Passo',\n 'dashboard.onboarding.of': 'de',\n 'dashboard.settings.title': 'Painel',\n 'dashboard.settings.subtitle': 'Escolha quais metricas aparecem no seu painel',\n 'dashboard.settings.metricsVisibility': 'Metricas Visiveis',\n 'dashboard.settings.metricOrder': 'Ordem das Metricas',\n 'dashboard.settings.resetDefaults': 'Restaurar Padrao',\n 'dashboard.settings.saved': 'Preferencias do painel salvas',\n 'dashboard.empty.title': 'Bem-vindo!',\n 'dashboard.empty.subtitle': 'Seu painel mostrara metricas e informacoes importantes aqui.',\n}\n","import { en } from './en'\nimport { ptBR } from './pt-BR'\n\nexport const dashboardLocales: Record<string, Record<string, string>> = {\n en,\n 'pt-BR': ptBR,\n}\n","import * as React from 'react'\nimport type { DashboardWidgetDef } from '@fayz-ai/core'\nimport { WidgetGrid } from '@fayz-ai/ui'\nimport { metricsToWidgets, sectionsToWidgets } from '../lib/builders'\nimport type { DashboardMetric, DashboardSection } from '../types'\n\nexport interface DashboardPageProps {\n title?: string\n subtitle?: string\n metrics?: DashboardMetric[]\n sections?: DashboardSection[]\n currency?: { code?: string; locale?: string; symbol?: string }\n /** Render the in-content title/subtitle. Set false when the app shell owns\n * the page title (sidebar/GHL-style layouts). Default: true. */\n showHeader?: boolean\n}\n\n/**\n * Back-compat shim. The dashboard is now a widget registry (see DashboardCanvas),\n * but standalone callers can still render a fixed set of metrics/sections. This\n * converts them to widget definitions and renders them through the shared grid.\n */\nexport function DashboardPage({\n title = 'Dashboard', subtitle = 'Business overview', metrics = [], sections = [], currency, showHeader = true,\n}: DashboardPageProps) {\n const widgets: DashboardWidgetDef[] = React.useMemo(\n () => [...metricsToWidgets(metrics, currency), ...sectionsToWidgets(sections)],\n [metrics, sections, currency],\n )\n\n return (\n <div className=\"space-y-6 p-6\">\n {showHeader ? (\n <div>\n <h1 className=\"text-2xl font-semibold tracking-tight\">{title}</h1>\n <p className=\"mt-1 text-sm text-muted-foreground\">{subtitle}</p>\n </div>\n ) : null}\n <WidgetGrid widgets={widgets} surface=\"home\" />\n </div>\n )\n}\n","import React from 'react'\nimport type { PluginManifest, PluginScope, VerticalId, DashboardWidgetDef, DashboardLayoutConfig } from '@fayz-ai/core'\nimport { DashboardCanvas, type DashboardCanvasProps } from '@fayz-ai/ui'\nimport { DashboardPage } from './views/DashboardPage'\nimport { metricsToWidgets, sectionsToWidgets, onboardingToWidget } from './lib/builders'\nimport { dashboardLocales } from './locales'\nimport type { DashboardMetric, DashboardSection, OnboardingStep } from './types'\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\nexport interface DashboardPluginLabels {\n pageTitle: string\n pageSubtitle: string\n kpiTitle: string\n onboardingTitle: string\n onboardingSubtitle: string\n settingsTitle: string\n}\n\nexport interface DashboardPluginOptions {\n /** KPI metrics to show on the dashboard */\n metrics?: DashboardMetric[]\n /** Custom sections injected by the consumer app */\n sections?: DashboardSection[]\n /** Onboarding steps for the getting-started checklist */\n onboardingSteps?: OnboardingStep[]\n /** Label overrides */\n labels?: Partial<DashboardPluginLabels>\n /** Currency config for metrics that use 'currency' format */\n currency?: { code?: string; locale?: string; symbol?: string }\n /** Plugin scope */\n scope?: PluginScope\n /** Vertical ID */\n verticalId?: VerticalId\n /** Whether to show onboarding module. Default: true if onboardingSteps provided */\n showOnboarding?: boolean\n /** Nav position (default: 0 — first item) */\n navPosition?: number\n /** Nav section (default: 'main') */\n navSection?: 'main' | 'secondary'\n /** Navigation icon override (default: 'LayoutDashboard') */\n navIcon?: string\n /** Skip adding a navigation entry (use when the consumer app provides its own page entry for '/') */\n skipNavigation?: boolean\n /** Render the in-content title/subtitle. Set false when the app shell owns the\n * page title (sidebar/GHL-style layouts). Default: true. */\n showHeader?: boolean\n /** Show the \"Customize\" menu (choose which widgets appear). Set false for a\n * clean, chrome-free B2C home. Default: true. */\n customizable?: boolean\n /** App-level curation of the home surface — which widgets show, order, span.\n * Applied on top of every plugin's registered defaults. */\n layout?: DashboardLayoutConfig\n /** Custom widgets the consumer app contributes directly to the home surface. */\n customWidgets?: DashboardWidgetDef[]\n /** Show the shared, sticky time-range control on the home. Pass `true` for\n * defaults (7d/30d/90d) or an options object. Widgets read it via\n * useDashboardRange(); provide `onChange` to drive app-level refetching. */\n range?: DashboardCanvasProps['range']\n}\n\n// ---------------------------------------------------------------------------\n// Defaults\n// ---------------------------------------------------------------------------\n\nconst DEFAULT_LABELS: DashboardPluginLabels = {\n pageTitle: 'Dashboard',\n pageSubtitle: 'Business overview',\n kpiTitle: 'Key Metrics',\n onboardingTitle: 'Getting Started',\n onboardingSubtitle: 'Complete these steps to set up your business',\n settingsTitle: 'Dashboard',\n}\n\n// ---------------------------------------------------------------------------\n// Factory\n// ---------------------------------------------------------------------------\n\nexport function createDashboardPlugin(options?: DashboardPluginOptions): PluginManifest {\n const labels: DashboardPluginLabels = { ...DEFAULT_LABELS, ...options?.labels }\n const onboardingSteps = options?.onboardingSteps ?? []\n const showOnboarding = options?.showOnboarding ?? onboardingSteps.length > 0\n\n // Everything the dashboard plugin owns flows through the widget registry:\n // legacy metrics/sections, the onboarding checklist, and app custom widgets.\n const dashboardWidgets: DashboardWidgetDef[] = [\n ...metricsToWidgets(options?.metrics ?? [], options?.currency),\n ...sectionsToWidgets(options?.sections ?? []),\n ...(showOnboarding && onboardingSteps.length > 0\n ? [onboardingToWidget(onboardingSteps, { title: labels.onboardingTitle, subtitle: labels.onboardingSubtitle })]\n : []),\n ...(options?.customWidgets ?? []),\n ]\n\n const PageComponent: React.ComponentType<unknown> = () =>\n React.createElement(DashboardCanvas, {\n surface: 'home',\n title: labels.pageTitle,\n subtitle: labels.pageSubtitle,\n showHeader: options?.showHeader,\n customizable: options?.customizable,\n appLayout: options?.layout,\n range: options?.range,\n })\n\n return {\n id: 'dashboard',\n name: labels.pageTitle,\n icon: 'LayoutDashboard',\n version: '1.0.0',\n scope: options?.scope ?? 'universal',\n verticalId: options?.verticalId,\n defaultEnabled: true,\n dependencies: [],\n declaredFeatures: [\n { id: 'dashboard', label: labels.pageTitle, group: 'Core' },\n ],\n\n navigation: options?.skipNavigation ? [] : [\n {\n section: options?.navSection ?? 'main',\n position: options?.navPosition ?? 0,\n label: labels.pageTitle,\n route: '/',\n icon: options?.navIcon ?? 'LayoutDashboard',\n },\n ],\n\n routes: [\n {\n path: '/',\n component: PageComponent,\n },\n ],\n\n widgets: [],\n dashboardWidgets,\n\n aiTools: [\n {\n id: 'dashboard.kpi-summary',\n name: 'getKpiSummary',\n description: 'Returns a summary of all KPI metrics for the current dashboard, including trends and comparisons.',\n icon: 'BarChart3',\n mode: 'read' as const,\n category: 'Dashboard',\n parameters: {\n type: 'object' as const,\n properties: {\n category: {\n type: 'string' as const,\n description: 'Filter by metric category',\n enum: ['revenue', 'operations', 'clients', 'custom', 'all'],\n },\n },\n },\n suggestions: [\n { label: 'How is my business doing today?' },\n { label: \"What's my revenue today?\" },\n { label: 'Give me a summary of today' },\n ],\n },\n ],\n\n locales: dashboardLocales,\n }\n}\n\n// ---------------------------------------------------------------------------\n// Re-exports\n// ---------------------------------------------------------------------------\n\nexport { DashboardPage } from './views/DashboardPage'\nexport {\n DashboardCanvas,\n DashboardNavigateProvider,\n useDashboardNavigate,\n resolveDashboardLayout,\n useDashboardPreferences,\n type DashboardCanvasProps,\n type LaidOutWidget,\n type DashboardPreferencesState,\n} from '@fayz-ai/ui'\nexport {\n metricsToWidgets,\n sectionsToWidgets,\n onboardingToWidget,\n} from './lib/builders'\n\nexport type {\n DashboardMetric,\n MetricValue,\n MetricCategory,\n MetricFormat,\n ResolvedMetric,\n DashboardSection,\n DashboardSectionProps,\n DashboardZone,\n OnboardingStep,\n OnboardingProgress,\n DashboardPreferences,\n} from './types'\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DashboardWidgetDef } from '@fayz-ai/core';
|
|
2
2
|
import { type KpiCurrency } from '@fayz-ai/ui';
|
|
3
|
-
import type { DashboardMetric, DashboardSection, OnboardingStep } from '
|
|
3
|
+
import type { DashboardMetric, DashboardSection, OnboardingStep } from '../types';
|
|
4
4
|
/** Legacy DashboardMetric[] → KPI widgets (async compute via the shared KpiCard). */
|
|
5
5
|
export declare function metricsToWidgets(metrics: DashboardMetric[], currency?: KpiCurrency): DashboardWidgetDef[];
|
|
6
6
|
/** Legacy DashboardSection[] → full-width custom widgets. */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../src/lib/builders.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,EAOL,KAAK,WAAW,EAEjB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAIjF,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,QAAQ,CAAC,EAAE,WAAW,GAAG,kBAAkB,EAAE,CAsBzG;AAED,6DAA6D;AAC7D,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,kBAAkB,EAAE,CAqBpF;AAED,4EAA4E;AAC5E,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,cAAc,EAAE,EACvB,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC1C,kBAAkB,CA6BpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardPage.d.ts","sourceRoot":"","sources":["../../src/views/DashboardPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEjE,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,eAAe,EAAE,CAAA;IAC3B,QAAQ,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC7B,QAAQ,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC9D;qEACiE;IACjE,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAmB,EAAE,QAA8B,EAAE,OAAY,EAAE,QAAa,EAAE,QAAQ,EAAE,UAAiB,GAC9G,EAAE,kBAAkB,qBAiBpB"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"fayz": {
|
|
4
4
|
"status": "preview"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.9.
|
|
6
|
+
"version": "0.9.1",
|
|
7
7
|
"description": "[experimental] Fayz SDK — plugin-dashboard plugin",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"sideEffects": false,
|
|
@@ -12,14 +12,12 @@
|
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
|
-
"source": "./src/index.ts",
|
|
16
15
|
"types": "./dist/index.d.ts",
|
|
17
16
|
"import": "./dist/index.js"
|
|
18
17
|
}
|
|
19
18
|
},
|
|
20
19
|
"files": [
|
|
21
|
-
"dist"
|
|
22
|
-
"src"
|
|
20
|
+
"dist"
|
|
23
21
|
],
|
|
24
22
|
"peerDependencies": {
|
|
25
23
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -28,8 +26,8 @@
|
|
|
28
26
|
"lucide-react": ">=0.400.0 <1.0.0"
|
|
29
27
|
},
|
|
30
28
|
"dependencies": {
|
|
31
|
-
"@fayz-ai/core": "^0.
|
|
32
|
-
"@fayz-ai/ui": "^0.
|
|
29
|
+
"@fayz-ai/core": "^0.10.0",
|
|
30
|
+
"@fayz-ai/ui": "^0.10.0"
|
|
33
31
|
},
|
|
34
32
|
"devDependencies": {
|
|
35
33
|
"@types/react": "^18.3.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardPage.d.ts","sourceRoot":"","sources":["../src/DashboardPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAEhE,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,eAAe,EAAE,CAAA;IAC3B,QAAQ,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC7B,QAAQ,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC9D;qEACiE;IACjE,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAmB,EAAE,QAA8B,EAAE,OAAY,EAAE,QAAa,EAAE,QAAQ,EAAE,UAAiB,GAC9G,EAAE,kBAAkB,qBAiBpB"}
|
package/dist/builders.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../src/builders.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,EAOL,KAAK,WAAW,EAEjB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAIhF,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,QAAQ,CAAC,EAAE,WAAW,GAAG,kBAAkB,EAAE,CAsBzG;AAED,6DAA6D;AAC7D,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,kBAAkB,EAAE,CAqBpF;AAED,4EAA4E;AAC5E,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,cAAc,EAAE,EACvB,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC1C,kBAAkB,CA6BpB"}
|
package/src/DashboardPage.tsx
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import type { DashboardWidgetDef } from '@fayz-ai/core'
|
|
3
|
-
import { WidgetGrid } from '@fayz-ai/ui'
|
|
4
|
-
import { metricsToWidgets, sectionsToWidgets } from './builders'
|
|
5
|
-
import type { DashboardMetric, DashboardSection } from './types'
|
|
6
|
-
|
|
7
|
-
export interface DashboardPageProps {
|
|
8
|
-
title?: string
|
|
9
|
-
subtitle?: string
|
|
10
|
-
metrics?: DashboardMetric[]
|
|
11
|
-
sections?: DashboardSection[]
|
|
12
|
-
currency?: { code?: string; locale?: string; symbol?: string }
|
|
13
|
-
/** Render the in-content title/subtitle. Set false when the app shell owns
|
|
14
|
-
* the page title (sidebar/GHL-style layouts). Default: true. */
|
|
15
|
-
showHeader?: boolean
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Back-compat shim. The dashboard is now a widget registry (see DashboardCanvas),
|
|
20
|
-
* but standalone callers can still render a fixed set of metrics/sections. This
|
|
21
|
-
* converts them to widget definitions and renders them through the shared grid.
|
|
22
|
-
*/
|
|
23
|
-
export function DashboardPage({
|
|
24
|
-
title = 'Dashboard', subtitle = 'Business overview', metrics = [], sections = [], currency, showHeader = true,
|
|
25
|
-
}: DashboardPageProps) {
|
|
26
|
-
const widgets: DashboardWidgetDef[] = React.useMemo(
|
|
27
|
-
() => [...metricsToWidgets(metrics, currency), ...sectionsToWidgets(sections)],
|
|
28
|
-
[metrics, sections, currency],
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<div className="space-y-6 p-6">
|
|
33
|
-
{showHeader ? (
|
|
34
|
-
<div>
|
|
35
|
-
<h1 className="text-2xl font-semibold tracking-tight">{title}</h1>
|
|
36
|
-
<p className="mt-1 text-sm text-muted-foreground">{subtitle}</p>
|
|
37
|
-
</div>
|
|
38
|
-
) : null}
|
|
39
|
-
<WidgetGrid widgets={widgets} surface="home" />
|
|
40
|
-
</div>
|
|
41
|
-
)
|
|
42
|
-
}
|
package/src/builders.tsx
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import type { DashboardWidgetDef } from '@fayz-ai/core'
|
|
3
|
-
import {
|
|
4
|
-
KpiCard,
|
|
5
|
-
OnboardingWidget,
|
|
6
|
-
defineKpiWidget,
|
|
7
|
-
defineCustomWidget,
|
|
8
|
-
defineOnboardingWidget,
|
|
9
|
-
useDashboardNavigate,
|
|
10
|
-
type KpiCurrency,
|
|
11
|
-
type OnboardingStepInput,
|
|
12
|
-
} from '@fayz-ai/ui'
|
|
13
|
-
import type { DashboardMetric, DashboardSection, OnboardingStep } from './types'
|
|
14
|
-
|
|
15
|
-
const DOMAIN = 'dashboard'
|
|
16
|
-
|
|
17
|
-
/** Legacy DashboardMetric[] → KPI widgets (async compute via the shared KpiCard). */
|
|
18
|
-
export function metricsToWidgets(metrics: DashboardMetric[], currency?: KpiCurrency): DashboardWidgetDef[] {
|
|
19
|
-
return metrics.map((metric, i) =>
|
|
20
|
-
defineKpiWidget({
|
|
21
|
-
id: `dashboard.kpi.${metric.id}`,
|
|
22
|
-
title: metric.label,
|
|
23
|
-
icon: metric.icon,
|
|
24
|
-
domain: DOMAIN,
|
|
25
|
-
defaultVisible: metric.defaultVisible,
|
|
26
|
-
defaultOrder: metric.defaultOrder ?? i,
|
|
27
|
-
component: () => (
|
|
28
|
-
<KpiCard
|
|
29
|
-
label={metric.label}
|
|
30
|
-
icon={metric.icon}
|
|
31
|
-
compute={metric.compute}
|
|
32
|
-
format={metric.format}
|
|
33
|
-
currency={currency}
|
|
34
|
-
goal={metric.goal}
|
|
35
|
-
accent={metric.accent}
|
|
36
|
-
/>
|
|
37
|
-
),
|
|
38
|
-
}),
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** Legacy DashboardSection[] → full-width custom widgets. */
|
|
43
|
-
export function sectionsToWidgets(sections: DashboardSection[]): DashboardWidgetDef[] {
|
|
44
|
-
return sections.map((section) => {
|
|
45
|
-
const SectionComponent = section.component
|
|
46
|
-
const Wrapped = () => {
|
|
47
|
-
const navigate = useDashboardNavigate()
|
|
48
|
-
return <SectionComponent onNavigate={navigate} />
|
|
49
|
-
}
|
|
50
|
-
return defineCustomWidget({
|
|
51
|
-
id: `dashboard.section.${section.id}`,
|
|
52
|
-
title: section.title,
|
|
53
|
-
icon: section.icon,
|
|
54
|
-
domain: DOMAIN,
|
|
55
|
-
// Half-width by default (guide/section cards like "Agenda de Hoje" should
|
|
56
|
-
// sit beside others, not dominate the row). Sections can opt into full
|
|
57
|
-
// width with `span: 4`.
|
|
58
|
-
span: section.span ?? 2,
|
|
59
|
-
defaultOrder: 100 + section.order,
|
|
60
|
-
verticalId: section.verticalId,
|
|
61
|
-
component: Wrapped,
|
|
62
|
-
})
|
|
63
|
-
})
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/** Onboarding steps → a single "first steps to set up" checklist widget. */
|
|
67
|
-
export function onboardingToWidget(
|
|
68
|
-
steps: OnboardingStep[],
|
|
69
|
-
labels: { title: string; subtitle: string },
|
|
70
|
-
): DashboardWidgetDef {
|
|
71
|
-
const sorted = [...steps].sort((a, b) => a.order - b.order)
|
|
72
|
-
// Built once, outside the component: OnboardingWidget keys its async check
|
|
73
|
-
// effect on the `steps` identity, so rebuilding this array on every render
|
|
74
|
-
// restarted (and cancelled) the in-flight checks every time an ancestor
|
|
75
|
-
// re-rendered — the checklist could sit on its skeleton forever and re-issue
|
|
76
|
-
// one query per step per render while it did.
|
|
77
|
-
const items: OnboardingStepInput[] = sorted.map((s) => ({
|
|
78
|
-
id: s.id,
|
|
79
|
-
title: s.title,
|
|
80
|
-
description: s.description,
|
|
81
|
-
icon: s.icon,
|
|
82
|
-
check: s.check,
|
|
83
|
-
action: s.action,
|
|
84
|
-
}))
|
|
85
|
-
const Onboarding = () => {
|
|
86
|
-
const navigate = useDashboardNavigate()
|
|
87
|
-
return <OnboardingWidget title={labels.title} subtitle={labels.subtitle} steps={items} onNavigate={navigate} />
|
|
88
|
-
}
|
|
89
|
-
return defineOnboardingWidget({
|
|
90
|
-
id: 'dashboard.onboarding',
|
|
91
|
-
title: labels.title,
|
|
92
|
-
domain: DOMAIN,
|
|
93
|
-
// Half-width (2 of 4 cols) so the getting-started guide sits beside other
|
|
94
|
-
// content rather than dominating the row.
|
|
95
|
-
span: 2,
|
|
96
|
-
defaultOrder: 50,
|
|
97
|
-
component: Onboarding,
|
|
98
|
-
})
|
|
99
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import type { PluginManifest, PluginScope, VerticalId, DashboardWidgetDef, DashboardLayoutConfig } from '@fayz-ai/core'
|
|
3
|
-
import { DashboardCanvas, type DashboardCanvasProps } from '@fayz-ai/ui'
|
|
4
|
-
import { DashboardPage } from './DashboardPage'
|
|
5
|
-
import { metricsToWidgets, sectionsToWidgets, onboardingToWidget } from './builders'
|
|
6
|
-
import { dashboardLocales } from './locales'
|
|
7
|
-
import type { DashboardMetric, DashboardSection, OnboardingStep } from './types'
|
|
8
|
-
|
|
9
|
-
// ---------------------------------------------------------------------------
|
|
10
|
-
// Public types
|
|
11
|
-
// ---------------------------------------------------------------------------
|
|
12
|
-
|
|
13
|
-
export interface DashboardPluginLabels {
|
|
14
|
-
pageTitle: string
|
|
15
|
-
pageSubtitle: string
|
|
16
|
-
kpiTitle: string
|
|
17
|
-
onboardingTitle: string
|
|
18
|
-
onboardingSubtitle: string
|
|
19
|
-
settingsTitle: string
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface DashboardPluginOptions {
|
|
23
|
-
/** KPI metrics to show on the dashboard */
|
|
24
|
-
metrics?: DashboardMetric[]
|
|
25
|
-
/** Custom sections injected by the consumer app */
|
|
26
|
-
sections?: DashboardSection[]
|
|
27
|
-
/** Onboarding steps for the getting-started checklist */
|
|
28
|
-
onboardingSteps?: OnboardingStep[]
|
|
29
|
-
/** Label overrides */
|
|
30
|
-
labels?: Partial<DashboardPluginLabels>
|
|
31
|
-
/** Currency config for metrics that use 'currency' format */
|
|
32
|
-
currency?: { code?: string; locale?: string; symbol?: string }
|
|
33
|
-
/** Plugin scope */
|
|
34
|
-
scope?: PluginScope
|
|
35
|
-
/** Vertical ID */
|
|
36
|
-
verticalId?: VerticalId
|
|
37
|
-
/** Whether to show onboarding module. Default: true if onboardingSteps provided */
|
|
38
|
-
showOnboarding?: boolean
|
|
39
|
-
/** Nav position (default: 0 — first item) */
|
|
40
|
-
navPosition?: number
|
|
41
|
-
/** Nav section (default: 'main') */
|
|
42
|
-
navSection?: 'main' | 'secondary'
|
|
43
|
-
/** Navigation icon override (default: 'LayoutDashboard') */
|
|
44
|
-
navIcon?: string
|
|
45
|
-
/** Skip adding a navigation entry (use when the consumer app provides its own page entry for '/') */
|
|
46
|
-
skipNavigation?: boolean
|
|
47
|
-
/** Render the in-content title/subtitle. Set false when the app shell owns the
|
|
48
|
-
* page title (sidebar/GHL-style layouts). Default: true. */
|
|
49
|
-
showHeader?: boolean
|
|
50
|
-
/** Show the "Customize" menu (choose which widgets appear). Set false for a
|
|
51
|
-
* clean, chrome-free B2C home. Default: true. */
|
|
52
|
-
customizable?: boolean
|
|
53
|
-
/** App-level curation of the home surface — which widgets show, order, span.
|
|
54
|
-
* Applied on top of every plugin's registered defaults. */
|
|
55
|
-
layout?: DashboardLayoutConfig
|
|
56
|
-
/** Custom widgets the consumer app contributes directly to the home surface. */
|
|
57
|
-
customWidgets?: DashboardWidgetDef[]
|
|
58
|
-
/** Show the shared, sticky time-range control on the home. Pass `true` for
|
|
59
|
-
* defaults (7d/30d/90d) or an options object. Widgets read it via
|
|
60
|
-
* useDashboardRange(); provide `onChange` to drive app-level refetching. */
|
|
61
|
-
range?: DashboardCanvasProps['range']
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// ---------------------------------------------------------------------------
|
|
65
|
-
// Defaults
|
|
66
|
-
// ---------------------------------------------------------------------------
|
|
67
|
-
|
|
68
|
-
const DEFAULT_LABELS: DashboardPluginLabels = {
|
|
69
|
-
pageTitle: 'Dashboard',
|
|
70
|
-
pageSubtitle: 'Business overview',
|
|
71
|
-
kpiTitle: 'Key Metrics',
|
|
72
|
-
onboardingTitle: 'Getting Started',
|
|
73
|
-
onboardingSubtitle: 'Complete these steps to set up your business',
|
|
74
|
-
settingsTitle: 'Dashboard',
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// ---------------------------------------------------------------------------
|
|
78
|
-
// Factory
|
|
79
|
-
// ---------------------------------------------------------------------------
|
|
80
|
-
|
|
81
|
-
export function createDashboardPlugin(options?: DashboardPluginOptions): PluginManifest {
|
|
82
|
-
const labels: DashboardPluginLabels = { ...DEFAULT_LABELS, ...options?.labels }
|
|
83
|
-
const onboardingSteps = options?.onboardingSteps ?? []
|
|
84
|
-
const showOnboarding = options?.showOnboarding ?? onboardingSteps.length > 0
|
|
85
|
-
|
|
86
|
-
// Everything the dashboard plugin owns flows through the widget registry:
|
|
87
|
-
// legacy metrics/sections, the onboarding checklist, and app custom widgets.
|
|
88
|
-
const dashboardWidgets: DashboardWidgetDef[] = [
|
|
89
|
-
...metricsToWidgets(options?.metrics ?? [], options?.currency),
|
|
90
|
-
...sectionsToWidgets(options?.sections ?? []),
|
|
91
|
-
...(showOnboarding && onboardingSteps.length > 0
|
|
92
|
-
? [onboardingToWidget(onboardingSteps, { title: labels.onboardingTitle, subtitle: labels.onboardingSubtitle })]
|
|
93
|
-
: []),
|
|
94
|
-
...(options?.customWidgets ?? []),
|
|
95
|
-
]
|
|
96
|
-
|
|
97
|
-
const PageComponent: React.ComponentType<unknown> = () =>
|
|
98
|
-
React.createElement(DashboardCanvas, {
|
|
99
|
-
surface: 'home',
|
|
100
|
-
title: labels.pageTitle,
|
|
101
|
-
subtitle: labels.pageSubtitle,
|
|
102
|
-
showHeader: options?.showHeader,
|
|
103
|
-
customizable: options?.customizable,
|
|
104
|
-
appLayout: options?.layout,
|
|
105
|
-
range: options?.range,
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
return {
|
|
109
|
-
id: 'dashboard',
|
|
110
|
-
name: labels.pageTitle,
|
|
111
|
-
icon: 'LayoutDashboard',
|
|
112
|
-
version: '1.0.0',
|
|
113
|
-
scope: options?.scope ?? 'universal',
|
|
114
|
-
verticalId: options?.verticalId,
|
|
115
|
-
defaultEnabled: true,
|
|
116
|
-
dependencies: [],
|
|
117
|
-
declaredFeatures: [
|
|
118
|
-
{ id: 'dashboard', label: labels.pageTitle, group: 'Core' },
|
|
119
|
-
],
|
|
120
|
-
|
|
121
|
-
navigation: options?.skipNavigation ? [] : [
|
|
122
|
-
{
|
|
123
|
-
section: options?.navSection ?? 'main',
|
|
124
|
-
position: options?.navPosition ?? 0,
|
|
125
|
-
label: labels.pageTitle,
|
|
126
|
-
route: '/',
|
|
127
|
-
icon: options?.navIcon ?? 'LayoutDashboard',
|
|
128
|
-
},
|
|
129
|
-
],
|
|
130
|
-
|
|
131
|
-
routes: [
|
|
132
|
-
{
|
|
133
|
-
path: '/',
|
|
134
|
-
component: PageComponent,
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
|
|
138
|
-
widgets: [],
|
|
139
|
-
dashboardWidgets,
|
|
140
|
-
|
|
141
|
-
aiTools: [
|
|
142
|
-
{
|
|
143
|
-
id: 'dashboard.kpi-summary',
|
|
144
|
-
name: 'getKpiSummary',
|
|
145
|
-
description: 'Returns a summary of all KPI metrics for the current dashboard, including trends and comparisons.',
|
|
146
|
-
icon: 'BarChart3',
|
|
147
|
-
mode: 'read' as const,
|
|
148
|
-
category: 'Dashboard',
|
|
149
|
-
parameters: {
|
|
150
|
-
type: 'object' as const,
|
|
151
|
-
properties: {
|
|
152
|
-
category: {
|
|
153
|
-
type: 'string' as const,
|
|
154
|
-
description: 'Filter by metric category',
|
|
155
|
-
enum: ['revenue', 'operations', 'clients', 'custom', 'all'],
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
suggestions: [
|
|
160
|
-
{ label: 'How is my business doing today?' },
|
|
161
|
-
{ label: "What's my revenue today?" },
|
|
162
|
-
{ label: 'Give me a summary of today' },
|
|
163
|
-
],
|
|
164
|
-
},
|
|
165
|
-
],
|
|
166
|
-
|
|
167
|
-
locales: dashboardLocales,
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// ---------------------------------------------------------------------------
|
|
172
|
-
// Re-exports
|
|
173
|
-
// ---------------------------------------------------------------------------
|
|
174
|
-
|
|
175
|
-
export { DashboardPage } from './DashboardPage'
|
|
176
|
-
export {
|
|
177
|
-
DashboardCanvas,
|
|
178
|
-
DashboardNavigateProvider,
|
|
179
|
-
useDashboardNavigate,
|
|
180
|
-
resolveDashboardLayout,
|
|
181
|
-
useDashboardPreferences,
|
|
182
|
-
type DashboardCanvasProps,
|
|
183
|
-
type LaidOutWidget,
|
|
184
|
-
type DashboardPreferencesState,
|
|
185
|
-
} from '@fayz-ai/ui'
|
|
186
|
-
export {
|
|
187
|
-
metricsToWidgets,
|
|
188
|
-
sectionsToWidgets,
|
|
189
|
-
onboardingToWidget,
|
|
190
|
-
} from './builders'
|
|
191
|
-
|
|
192
|
-
export type {
|
|
193
|
-
DashboardMetric,
|
|
194
|
-
MetricValue,
|
|
195
|
-
MetricCategory,
|
|
196
|
-
MetricFormat,
|
|
197
|
-
ResolvedMetric,
|
|
198
|
-
DashboardSection,
|
|
199
|
-
DashboardSectionProps,
|
|
200
|
-
DashboardZone,
|
|
201
|
-
OnboardingStep,
|
|
202
|
-
OnboardingProgress,
|
|
203
|
-
DashboardPreferences,
|
|
204
|
-
} from './types'
|
package/src/locales/en.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export const en: Record<string, string> = {
|
|
2
|
-
'dashboard.title': 'Dashboard',
|
|
3
|
-
'dashboard.subtitle': 'Business overview',
|
|
4
|
-
'dashboard.kpi.title': 'Key Metrics',
|
|
5
|
-
'dashboard.kpi.noData': 'No metrics configured',
|
|
6
|
-
'dashboard.kpi.error': 'Failed to load',
|
|
7
|
-
'dashboard.kpi.refresh': 'Refresh',
|
|
8
|
-
'dashboard.onboarding.title': 'Getting Started',
|
|
9
|
-
'dashboard.onboarding.subtitle': 'Complete these steps to set up your business',
|
|
10
|
-
'dashboard.onboarding.completed': 'Completed',
|
|
11
|
-
'dashboard.onboarding.allDone': "All done! You're all set.",
|
|
12
|
-
'dashboard.onboarding.dismiss': 'Dismiss',
|
|
13
|
-
'dashboard.onboarding.step': 'Step',
|
|
14
|
-
'dashboard.onboarding.of': 'of',
|
|
15
|
-
'dashboard.settings.title': 'Dashboard',
|
|
16
|
-
'dashboard.settings.subtitle': 'Choose which metrics appear on your dashboard',
|
|
17
|
-
'dashboard.settings.metricsVisibility': 'Visible Metrics',
|
|
18
|
-
'dashboard.settings.metricOrder': 'Metric Order',
|
|
19
|
-
'dashboard.settings.resetDefaults': 'Reset to Defaults',
|
|
20
|
-
'dashboard.settings.saved': 'Dashboard preferences saved',
|
|
21
|
-
'dashboard.empty.title': 'Welcome!',
|
|
22
|
-
'dashboard.empty.subtitle': 'Your dashboard will show key metrics and information here.',
|
|
23
|
-
}
|
package/src/locales/index.ts
DELETED
package/src/locales/pt-BR.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export const ptBR: Record<string, string> = {
|
|
2
|
-
'dashboard.title': 'Painel',
|
|
3
|
-
'dashboard.subtitle': 'Visao geral do seu negocio',
|
|
4
|
-
'dashboard.kpi.title': 'Metricas',
|
|
5
|
-
'dashboard.kpi.noData': 'Nenhuma metrica configurada',
|
|
6
|
-
'dashboard.kpi.error': 'Falha ao carregar',
|
|
7
|
-
'dashboard.kpi.refresh': 'Atualizar',
|
|
8
|
-
'dashboard.onboarding.title': 'Primeiros Passos',
|
|
9
|
-
'dashboard.onboarding.subtitle': 'Complete estes passos para configurar seu negocio',
|
|
10
|
-
'dashboard.onboarding.completed': 'Concluido',
|
|
11
|
-
'dashboard.onboarding.allDone': 'Tudo pronto! Voce esta configurado.',
|
|
12
|
-
'dashboard.onboarding.dismiss': 'Dispensar',
|
|
13
|
-
'dashboard.onboarding.step': 'Passo',
|
|
14
|
-
'dashboard.onboarding.of': 'de',
|
|
15
|
-
'dashboard.settings.title': 'Painel',
|
|
16
|
-
'dashboard.settings.subtitle': 'Escolha quais metricas aparecem no seu painel',
|
|
17
|
-
'dashboard.settings.metricsVisibility': 'Metricas Visiveis',
|
|
18
|
-
'dashboard.settings.metricOrder': 'Ordem das Metricas',
|
|
19
|
-
'dashboard.settings.resetDefaults': 'Restaurar Padrao',
|
|
20
|
-
'dashboard.settings.saved': 'Preferencias do painel salvas',
|
|
21
|
-
'dashboard.empty.title': 'Bem-vindo!',
|
|
22
|
-
'dashboard.empty.subtitle': 'Seu painel mostrara metricas e informacoes importantes aqui.',
|
|
23
|
-
}
|
package/src/types.ts
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import type React from 'react'
|
|
2
|
-
import type { VerticalId } from '@fayz-ai/core'
|
|
3
|
-
|
|
4
|
-
// ---------------------------------------------------------------------------
|
|
5
|
-
// KPI Metric system
|
|
6
|
-
// ---------------------------------------------------------------------------
|
|
7
|
-
|
|
8
|
-
export type MetricCategory = 'revenue' | 'operations' | 'clients' | 'custom'
|
|
9
|
-
export type MetricFormat = 'number' | 'currency' | 'percent' | 'duration'
|
|
10
|
-
|
|
11
|
-
export interface MetricValue {
|
|
12
|
-
/** Primary numeric value */
|
|
13
|
-
value: number
|
|
14
|
-
/** Comparison value for trend (e.g., yesterday, last week) */
|
|
15
|
-
previousValue?: number
|
|
16
|
-
/** Unit suffix (e.g., 'min', 'BRL') */
|
|
17
|
-
unit?: string
|
|
18
|
-
/** Trend direction for visual indicator */
|
|
19
|
-
trend?: 'up' | 'down' | 'neutral'
|
|
20
|
-
/** Optional series (oldest → newest) rendered as an inline sparkline. */
|
|
21
|
-
spark?: number[]
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface DashboardMetric {
|
|
25
|
-
/** Unique metric ID, e.g. 'revenue-today' */
|
|
26
|
-
id: string
|
|
27
|
-
/** i18n key or plain label */
|
|
28
|
-
label: string
|
|
29
|
-
/** Tooltip description */
|
|
30
|
-
description?: string
|
|
31
|
-
/** Lucide icon name */
|
|
32
|
-
icon: string
|
|
33
|
-
/** Grouping category */
|
|
34
|
-
category: MetricCategory
|
|
35
|
-
/** Async function that computes the current value */
|
|
36
|
-
compute: () => Promise<MetricValue>
|
|
37
|
-
/** Whether visible by default (before user customization) */
|
|
38
|
-
defaultVisible: boolean
|
|
39
|
-
/** Default display order (lower = first) */
|
|
40
|
-
defaultOrder: number
|
|
41
|
-
/** How to format the value */
|
|
42
|
-
format?: MetricFormat
|
|
43
|
-
/** Render the card as a radial gauge toward this goal value. */
|
|
44
|
-
goal?: number
|
|
45
|
-
/** Accent color for the gauge/sparkline. Defaults to a trend-aware color. */
|
|
46
|
-
accent?: string
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface ResolvedMetric extends DashboardMetric {
|
|
50
|
-
/** Current computed value (null while loading) */
|
|
51
|
-
currentValue: MetricValue | null
|
|
52
|
-
/** Whether this metric is currently loading */
|
|
53
|
-
loading: boolean
|
|
54
|
-
/** Error message if compute() failed */
|
|
55
|
-
error?: string
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// ---------------------------------------------------------------------------
|
|
59
|
-
// Section system
|
|
60
|
-
// ---------------------------------------------------------------------------
|
|
61
|
-
|
|
62
|
-
export type DashboardZone = 'main' | 'sidebar' | 'bottom-right'
|
|
63
|
-
|
|
64
|
-
export interface DashboardSectionProps {
|
|
65
|
-
tenantId?: string
|
|
66
|
-
onNavigate?: (path: string) => void
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface DashboardSection {
|
|
70
|
-
/** Unique section ID */
|
|
71
|
-
id: string
|
|
72
|
-
/** i18n key or plain title */
|
|
73
|
-
title: string
|
|
74
|
-
/** Lucide icon name */
|
|
75
|
-
icon?: string
|
|
76
|
-
/** Zone placement on the dashboard */
|
|
77
|
-
zone: DashboardZone
|
|
78
|
-
/** Column span on the 4-col grid (1–4). Default: 2 (half width). */
|
|
79
|
-
span?: 1 | 2 | 3 | 4
|
|
80
|
-
/** Sort order within zone (lower = first) */
|
|
81
|
-
order: number
|
|
82
|
-
/** React component to render */
|
|
83
|
-
component: React.ComponentType<DashboardSectionProps>
|
|
84
|
-
/** Only show for specific verticals */
|
|
85
|
-
verticalId?: VerticalId
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// ---------------------------------------------------------------------------
|
|
89
|
-
// Onboarding system
|
|
90
|
-
// ---------------------------------------------------------------------------
|
|
91
|
-
|
|
92
|
-
export interface OnboardingStep {
|
|
93
|
-
/** Unique step ID, e.g. 'add-first-client' */
|
|
94
|
-
id: string
|
|
95
|
-
/** i18n key or plain title */
|
|
96
|
-
title: string
|
|
97
|
-
/** i18n key or plain description */
|
|
98
|
-
description: string
|
|
99
|
-
/** Lucide icon name */
|
|
100
|
-
icon: string
|
|
101
|
-
/** Async check: returns true if this step is already completed */
|
|
102
|
-
check: () => Promise<boolean>
|
|
103
|
-
/** Route path to navigate to, or a callback */
|
|
104
|
-
action: string | (() => void)
|
|
105
|
-
/** Sort order (lower = first) */
|
|
106
|
-
order: number
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export interface OnboardingProgress {
|
|
110
|
-
stepId: string
|
|
111
|
-
completedAt: string | null
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// ---------------------------------------------------------------------------
|
|
115
|
-
// Preferences (DB-backed per-tenant)
|
|
116
|
-
// ---------------------------------------------------------------------------
|
|
117
|
-
|
|
118
|
-
export interface DashboardPreferences {
|
|
119
|
-
id: string
|
|
120
|
-
tenantId: string
|
|
121
|
-
/** Ordered list of metric IDs the user wants visible */
|
|
122
|
-
visibleMetrics: string[]
|
|
123
|
-
/** Full metric ordering (visible + hidden) */
|
|
124
|
-
metricOrder: string[]
|
|
125
|
-
createdAt: string
|
|
126
|
-
updatedAt: string
|
|
127
|
-
}
|