@feedmepos/mf-remy-panel 0.11.1 → 0.12.0-dev.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.
@@ -29,6 +29,41 @@ export interface ChartActionCardResult {
29
29
  axes?: ChartAxis[];
30
30
  summary: string;
31
31
  }
32
+ export interface RcaInsightDriver {
33
+ label: string;
34
+ type: 'demand' | 'aov' | 'mix' | 'refund' | 'discount' | 'operations' | 'inventory' | 'loyalty' | 'menu';
35
+ rank: 'primary' | 'secondary' | 'contributing' | 'unconfirmed';
36
+ confidence: 'high' | 'medium' | 'low';
37
+ evidence: string[];
38
+ }
39
+ export interface RcaInsightCardResult {
40
+ type: 'rca_insight';
41
+ targetMetric: 'revenue' | 'order_count' | 'aov';
42
+ headline: string;
43
+ status: 'explained' | 'partially_explained' | 'inconclusive' | 'no_data';
44
+ periodLabel: string;
45
+ baselineLabel: string;
46
+ metricDelta: {
47
+ current: number;
48
+ baseline: number;
49
+ deltaAbs: number;
50
+ deltaPct: number;
51
+ };
52
+ decomposition: {
53
+ orderCount?: {
54
+ current: number;
55
+ baseline: number;
56
+ deltaPct: number;
57
+ };
58
+ aov?: {
59
+ current: number;
60
+ baseline: number;
61
+ deltaPct: number;
62
+ };
63
+ };
64
+ drivers: RcaInsightDriver[];
65
+ gaps: string[];
66
+ }
32
67
  export interface ExcelExportActionCardResult {
33
68
  type: 'excel';
34
69
  title: string;
@@ -78,6 +113,39 @@ export type ReportSection = {
78
113
  label: string;
79
114
  }>;
80
115
  rows: Array<Record<string, unknown>>;
116
+ } | {
117
+ id?: string;
118
+ type: 'rca-insight';
119
+ targetMetric: 'revenue' | 'order_count' | 'aov';
120
+ headline: string;
121
+ status: 'explained' | 'partially_explained' | 'inconclusive' | 'no_data';
122
+ periodLabel: string;
123
+ baselineLabel: string;
124
+ metricDelta: {
125
+ current: number;
126
+ baseline: number;
127
+ deltaAbs: number;
128
+ deltaPct: number;
129
+ };
130
+ decomposition: {
131
+ orderCount?: {
132
+ current: number;
133
+ baseline: number;
134
+ deltaPct: number;
135
+ };
136
+ aov?: {
137
+ current: number;
138
+ baseline: number;
139
+ deltaPct: number;
140
+ };
141
+ };
142
+ drivers: Array<{
143
+ label: string;
144
+ rank: 'primary' | 'secondary' | 'contributing' | 'unconfirmed';
145
+ confidence: 'high' | 'medium' | 'low';
146
+ evidence: string[];
147
+ }>;
148
+ gaps: string[];
81
149
  };
82
150
  export interface ReportArtifact {
83
151
  id: string;
@@ -0,0 +1,18 @@
1
+ import type { ReportSection } from '@/types/chat';
2
+ export type RcaMetric = 'revenue' | 'order_count' | 'aov';
3
+ type RcaInsightSection = Extract<ReportSection, {
4
+ type: 'rca-insight';
5
+ }>;
6
+ export declare function formatPct(pct: number): string;
7
+ export declare function formatSignedPct(pct: number): string;
8
+ export declare function formatCurrency(value: number): string;
9
+ export declare function formatCount(value: number): string;
10
+ export declare function metricLabel(metric: RcaMetric): string;
11
+ export declare function formatMetricDeltaAbs(metric: RcaMetric, value: number): string;
12
+ export declare function formatSignedMetricDelta(metric: RcaMetric, value: number): string;
13
+ export declare function buildRcaDecompositionRows(section: RcaInsightSection): Array<{
14
+ metric: string;
15
+ change: string;
16
+ values: string;
17
+ }>;
18
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-remy-panel",
3
- "version": "0.11.1",
3
+ "version": "0.12.0-dev.1",
4
4
  "files": [
5
5
  "dist"
6
6
  ],