@meyicloud/meyi-cost-ui 1.2.2 → 1.4.0

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 CHANGED
@@ -1,8 +1,8 @@
1
1
  # Meyi Insight Cost UI
2
2
 
3
3
  Reusable React UI package for AWS cost overview, monthly/yearly trends,
4
- service/account/region breakdowns, standard and comparison reports, CSV/PDF
5
- exports, budgets, and budget status.
4
+ service/account/region breakdowns, standard and comparison reports, scheduled
5
+ AI report history and downloads plus standard CSV/PDF cost exports.
6
6
 
7
7
  The package is intended to run inside an authenticated host application. It
8
8
  does not contain AWS credentials, query AWS directly, perform login, or decide
@@ -24,7 +24,7 @@ flowchart LR
24
24
  Host[External React application] --> Route[Authenticated /cost/* route]
25
25
  Route --> Page[CostPage]
26
26
  Page --> Router[Package router]
27
- Router --> Features[Overview / Reports / Budgets]
27
+ Router --> Features[Overview / AI Analysis / Reports / Sources]
28
28
  Features --> Hooks[Feature hooks]
29
29
  Hooks --> Service[costService]
30
30
  Service --> API[Configured Axios client]
@@ -39,7 +39,6 @@ src/
39
39
  |-- features/
40
40
  | |-- overview/ Dashboard, cards, charts, and loading state
41
41
  | |-- reports/ Filters, standard/compare reports, tables, export
42
- | `-- budgets/ Budget form, list, and hooks
43
42
  |-- services/cost.ts Backend API boundary
44
43
  |-- api.ts Axios configuration and auth interceptor helper
45
44
  |-- CostPage.tsx Public embeddable component
@@ -91,7 +90,7 @@ For a local package installation test:
91
90
 
92
91
  ```bash
93
92
  npm pack
94
- npm install /path/to/meyicloud-meyi-cost-ui-1.2.2.tgz
93
+ npm install /path/to/meyicloud-meyi-cost-ui-1.3.0.tgz
95
94
  ```
96
95
 
97
96
  ## Publish to npm
@@ -140,7 +139,7 @@ Build the UI package before building the host when using a file dependency.
140
139
 
141
140
  ### 1. Add an authenticated wildcard route
142
141
 
143
- The route must accept child paths such as `/cost/reports` and `/cost/budgets`.
142
+ The route must accept child paths such as `/cost/reports` and `/cost/analysis`.
144
143
  The exact wildcard syntax depends on the host router.
145
144
 
146
145
  ```tsx
@@ -189,7 +188,8 @@ apply authentication and tenant resolution before the cost endpoints.
189
188
 
190
189
  ### 4. Add navigation and plugin enablement
191
190
 
192
- The package exports `costNavItems` for Overview, Reports, and Budgets. The host
191
+ The package exports `costNavItems` for Overview, AI Analysis, Reports, Sources,
192
+ and CUR Discovery. The host
193
193
  may map these entries into its sidebar. Tenant-level installation, role checks,
194
194
  and dynamic menu visibility remain host responsibilities.
195
195
 
@@ -200,7 +200,7 @@ and dynamic menu visibility remain host responsibilities.
200
200
  | `apiBase` | Yes | None | Base API prefix. `/cost` is appended automatically. |
201
201
  | `basePath` | No | `/cost` | Router base path where the host mounts the UI. |
202
202
  | `token` | No | None | Bearer token added to cost API requests. |
203
- | `userRole` | No | `admin` | Compatibility property for the current host role. The present package does not use it for authorization; the host must enforce access and menu visibility. |
203
+ | `userRole` | No | `user` | Controls visibility of AI report schedule settings. The server independently requires the admin role when saving. |
204
204
 
205
205
  ## Environment variables
206
206
 
@@ -236,7 +236,6 @@ The UI consumes these routes below `${apiBase}/cost`:
236
236
  - `GET /reports`
237
237
  - `GET /tags`
238
238
  - `GET /analysis/status`, `GET /analysis/latest`, and `POST /analysis`
239
- - `GET /budgets`, `POST /budgets`, and `DELETE /budgets/:id`
240
239
  - `GET /budget-alert-dismissals` and `POST /budget-alert-dismissals`
241
240
 
242
241
  Use the matching cost server version whenever API response contracts change.
@@ -253,7 +252,7 @@ Use the matching cost server version whenever API response contracts change.
253
252
  2. Install or refresh the package in the host.
254
253
  3. Build the host frontend.
255
254
  4. Verify direct navigation and refresh for `/cost`, `/cost/reports`, and
256
- `/cost/budgets`.
255
+ `/cost/analysis`.
257
256
  5. Verify authenticated requests reach `/api/v1/cost` with the correct tenant.
258
257
  6. Test loading, empty, error, monthly/yearly, graph/list, report filters,
259
258
  compare mode, pagination, and PDF/CSV export states.
@@ -0,0 +1,2 @@
1
+ export declare const CostRoleProvider: import('react').Provider<string>;
2
+ export declare const useCostRole: () => string;
@@ -0,0 +1,10 @@
1
+ import { CostAnalysisSchedule } from '../../../types.js';
2
+ interface Props {
3
+ open: boolean;
4
+ schedule: CostAnalysisSchedule;
5
+ saving: boolean;
6
+ onClose: () => void;
7
+ onSave: (schedule: Omit<CostAnalysisSchedule, "nextRunAt" | "lastRunAt">) => Promise<void>;
8
+ }
9
+ export declare function ScheduleDialog({ open, schedule, saving, onClose, onSave }: Props): import("react").JSX.Element | null;
10
+ export {};
@@ -1,21 +1,13 @@
1
- import { CostAnalysis, CostAnalysisStatus, CurDataStatus } from '../../../types.js';
2
- export type AnalysisRangeKey = "current_month" | "last_month" | "last_3_months";
3
- export declare function resolveAnalysisRange(key: AnalysisRangeKey, now?: Date): {
4
- start: string;
5
- end: string;
6
- };
1
+ import { CostAnalysisReport, CostAnalysisSchedule, CostAnalysisStatus, CurDataStatus } from '../../../types.js';
7
2
  export declare function useCostAnalysis(): {
8
3
  status: CostAnalysisStatus | null;
9
4
  dataStatus: CurDataStatus | null;
10
- analysis: CostAnalysis | null;
11
- rangeKey: AnalysisRangeKey;
12
- setRangeKey: import('react').Dispatch<import('react').SetStateAction<AnalysisRangeKey>>;
13
- range: {
14
- start: string;
15
- end: string;
16
- };
17
- initialLoading: boolean;
18
- generating: boolean;
5
+ schedule: CostAnalysisSchedule | null;
6
+ reports: CostAnalysisReport[];
7
+ loading: boolean;
8
+ saving: boolean;
19
9
  error: string | null;
20
- generate: (force?: boolean) => Promise<void>;
10
+ load: (quiet?: boolean) => Promise<void>;
11
+ saveSchedule: (next: Omit<CostAnalysisSchedule, "nextRunAt" | "lastRunAt">) => Promise<void>;
12
+ download: (report: CostAnalysisReport) => Promise<void>;
21
13
  };
@@ -5,7 +5,7 @@ export declare function useCostReports(): {
5
5
  mode: ReportMode;
6
6
  start: string;
7
7
  end: string;
8
- granularity: "monthly" | "daily";
8
+ granularity: "daily" | "monthly";
9
9
  reportTagKey: string;
10
10
  options: CostFilterOptions;
11
11
  draftFilters: Filters;
@@ -24,7 +24,7 @@ export declare function useCostReports(): {
24
24
  };
25
25
  setStart: import('react').Dispatch<import('react').SetStateAction<string>>;
26
26
  setEnd: import('react').Dispatch<import('react').SetStateAction<string>>;
27
- setGranularity: import('react').Dispatch<import('react').SetStateAction<"monthly" | "daily">>;
27
+ setGranularity: import('react').Dispatch<import('react').SetStateAction<"daily" | "monthly">>;
28
28
  setReportTagKey: import('react').Dispatch<import('react').SetStateAction<string>>;
29
29
  setDraftFilters: import('react').Dispatch<import('react').SetStateAction<Filters>>;
30
30
  changeGroup: (value: ReportGroup) => void;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { CostPage, type CostPageProps } from './CostPage.js';
2
2
  export { configureApi, attachAuthInterceptors, api } from './api.js';
3
3
  export { createRouteTree, createCostRouter } from './router.js';
4
- export type { CostOverview, CostBreakdownItem, CostReport, CostBudget, CostTrend, CostSummary, CostPeriod, CostProvider, CurDataStatus, CostAwsSource, CostAnalysis, CostAnalysisStatus, CostAnalysisFacts, } from './types.js';
4
+ export type { CostOverview, CostBreakdownItem, CostReport, CostTrend, CostPeriod, CostProvider, CurDataStatus, CostAwsSource, CostAnalysis, CostAnalysisStatus, CostAnalysisFacts, CostAnalysisSchedule, CostAnalysisReport, CostAnalysisFrequency, } from './types.js';
5
5
  export declare const costNavItems: {
6
6
  title: string;
7
7
  url: string;