reactbridge-sdk 0.2.7 → 0.2.8
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 +85 -1
- package/dist/components/reports/DataQualityAutomation.d.ts.map +1 -1
- package/dist/components/reports/DateRangeSelector.d.ts +1 -1
- package/dist/components/reports/DateRangeSelector.d.ts.map +1 -1
- package/dist/components/reports/ExecutionAuditTrail.d.ts.map +1 -1
- package/dist/components/reports/ExecutiveDashboard.d.ts.map +1 -1
- package/dist/components/reports/PortfolioHealth.d.ts.map +1 -1
- package/dist/components/reports/ReportLayout.d.ts.map +1 -1
- package/dist/components/reports/SupplyChainRisk.d.ts.map +1 -1
- package/dist/hooks/analytics/useReportData.d.ts +4 -2
- package/dist/hooks/analytics/useReportData.d.ts.map +1 -1
- package/dist/index.esm.js +208 -89
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +208 -89
- package/dist/index.js.map +1 -1
- package/dist/utils/request-cache.d.ts +32 -0
- package/dist/utils/request-cache.d.ts.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,8 @@ A flexible React SDK for building intelligent conversational interfaces with LLM
|
|
|
10
10
|
🤖 **Intelligent Context** - Automatic context diffing and injection
|
|
11
11
|
⚡ **Two-Step Orchestration** - Seamless action execution and feedback loop
|
|
12
12
|
📦 **TypeScript First** - Full type safety and IntelliSense support
|
|
13
|
-
📈 **Analytics Admin UI** - Widgets, reports, and dashboards for AI-generated insights
|
|
13
|
+
📈 **Analytics Admin UI** - Widgets, reports, and dashboards for AI-generated insights
|
|
14
|
+
📊 **Business Intelligence Reports** - 5 comprehensive REST endpoints for analytics (Executive Dashboard, Supply Chain Risk, Execution Audit Trail, Portfolio Health, Data Quality & Automation)
|
|
14
15
|
|
|
15
16
|
## Installation
|
|
16
17
|
|
|
@@ -265,6 +266,89 @@ await api.updateDirectiveStatus(directiveId, 'executed');
|
|
|
265
266
|
- Detailed components and hooks: [ANALYTICS_README.md](ANALYTICS_README.md)
|
|
266
267
|
- Full dashboard guide: [ANALYTICS_DASHBOARD_README.md](ANALYTICS_DASHBOARD_README.md)
|
|
267
268
|
|
|
269
|
+
## Business Intelligence Reports
|
|
270
|
+
|
|
271
|
+
The SDK includes 5 comprehensive REST endpoints for investor-ready analytics with date range filtering and 1-hour caching.
|
|
272
|
+
|
|
273
|
+
### Available Reports
|
|
274
|
+
|
|
275
|
+
```tsx
|
|
276
|
+
import {
|
|
277
|
+
ReactBridgeProvider,
|
|
278
|
+
ExecutiveDashboard,
|
|
279
|
+
SupplyChainRisk,
|
|
280
|
+
ExecutionAuditTrail,
|
|
281
|
+
PortfolioHealth,
|
|
282
|
+
DataQualityAutomation
|
|
283
|
+
} from 'reactbridge-sdk';
|
|
284
|
+
|
|
285
|
+
function ReportsPage() {
|
|
286
|
+
return (
|
|
287
|
+
<ReactBridgeProvider apiKey="your-api-key">
|
|
288
|
+
{/* High-level metrics and trends */}
|
|
289
|
+
<ExecutiveDashboard />
|
|
290
|
+
|
|
291
|
+
{/* Supply chain risk analysis */}
|
|
292
|
+
<SupplyChainRisk />
|
|
293
|
+
|
|
294
|
+
{/* Execution history and audit */}
|
|
295
|
+
<ExecutionAuditTrail />
|
|
296
|
+
|
|
297
|
+
{/* Portfolio metric health */}
|
|
298
|
+
<PortfolioHealth />
|
|
299
|
+
|
|
300
|
+
{/* Data quality & automation opportunities */}
|
|
301
|
+
<DataQualityAutomation />
|
|
302
|
+
</ReactBridgeProvider>
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Reports via Hooks
|
|
308
|
+
|
|
309
|
+
```tsx
|
|
310
|
+
import { useReactBridgeContext } from 'reactbridge-sdk';
|
|
311
|
+
|
|
312
|
+
function CustomReport() {
|
|
313
|
+
const { api } = useReactBridgeContext();
|
|
314
|
+
|
|
315
|
+
// Fetch Executive Dashboard
|
|
316
|
+
const dashboard = await api.getExecutiveDashboard({
|
|
317
|
+
startDate: '2026-01-06',
|
|
318
|
+
endDate: '2026-02-05'
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
// Fetch Supply Chain Risk
|
|
322
|
+
const risk = await api.getSupplyChainRisk();
|
|
323
|
+
|
|
324
|
+
// Fetch Execution Audit with filter
|
|
325
|
+
const audit = await api.getExecutionAuditTrail({
|
|
326
|
+
directiveType: 'inventory-rebalance'
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
// Fetch Portfolio Health
|
|
330
|
+
const health = await api.getPortfolioHealth();
|
|
331
|
+
|
|
332
|
+
// Fetch Data Quality Assessment
|
|
333
|
+
const quality = await api.getDataQualityAutomation();
|
|
334
|
+
}
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### Reports Documentation
|
|
338
|
+
|
|
339
|
+
- Full API reference: [REPORTS_API.md](REPORTS_API.md)
|
|
340
|
+
- Provider pattern guide: [REPORTS_PROVIDER_PATTERN.md](REPORTS_PROVIDER_PATTERN.md)
|
|
341
|
+
|
|
342
|
+
### Authentication
|
|
343
|
+
|
|
344
|
+
All reports use **X-API-Key** header authentication. Simply pass your API key to `ReactBridgeProvider` and it's automatically used by all endpoints:
|
|
345
|
+
|
|
346
|
+
```tsx
|
|
347
|
+
<ReactBridgeProvider apiKey="your-api-key-here">
|
|
348
|
+
<YourReportsApp />
|
|
349
|
+
</ReactBridgeProvider>
|
|
350
|
+
```
|
|
351
|
+
|
|
268
352
|
## Voice Input/Output
|
|
269
353
|
|
|
270
354
|
The SDK supports voice input (Speech-to-Text) and voice output (Text-to-Speech) for a fully conversational experience.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataQualityAutomation.d.ts","sourceRoot":"","sources":["../../../src/components/reports/DataQualityAutomation.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,WAAW,0BAA0B;IACzC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,gBAAgB,CAAC,EACb,WAAW,GACX,YAAY,GACZ,eAAe,GACf,eAAe,GACf,WAAW,CAAC;CACjB;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,
|
|
1
|
+
{"version":3,"file":"DataQualityAutomation.d.ts","sourceRoot":"","sources":["../../../src/components/reports/DataQualityAutomation.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,WAAW,0BAA0B;IACzC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,gBAAgB,CAAC,EACb,WAAW,GACX,YAAY,GACZ,eAAe,GACf,eAAe,GACf,WAAW,CAAC;CACjB;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAqUtE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateRangeSelector.d.ts","sourceRoot":"","sources":["../../../src/components/reports/DateRangeSelector.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAoB,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,WAAW,sBAAsB;IACrC,cAAc,EAAE,eAAe,CAAC;IAChC,QAAQ,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IAC5C,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"DateRangeSelector.d.ts","sourceRoot":"","sources":["../../../src/components/reports/DateRangeSelector.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAoB,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,WAAW,sBAAsB;IACrC,cAAc,EAAE,eAAe,CAAC;IAChC,QAAQ,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IAC5C,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA0C9D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExecutionAuditTrail.d.ts","sourceRoot":"","sources":["../../../src/components/reports/ExecutionAuditTrail.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAYxC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,gBAAgB,CAAC,EACb,WAAW,GACX,YAAY,GACZ,eAAe,GACf,eAAe,GACf,WAAW,CAAC;CACjB;AAED,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,
|
|
1
|
+
{"version":3,"file":"ExecutionAuditTrail.d.ts","sourceRoot":"","sources":["../../../src/components/reports/ExecutionAuditTrail.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAYxC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,gBAAgB,CAAC,EACb,WAAW,GACX,YAAY,GACZ,eAAe,GACf,eAAe,GACf,WAAW,CAAC;CACjB;AAED,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CA0NlE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExecutiveDashboard.d.ts","sourceRoot":"","sources":["../../../src/components/reports/ExecutiveDashboard.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,WAAW,uBAAuB;IACtC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,gBAAgB,CAAC,EACb,WAAW,GACX,YAAY,GACZ,eAAe,GACf,eAAe,GACf,WAAW,CAAC;CACjB;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,
|
|
1
|
+
{"version":3,"file":"ExecutiveDashboard.d.ts","sourceRoot":"","sources":["../../../src/components/reports/ExecutiveDashboard.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,WAAW,uBAAuB;IACtC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,gBAAgB,CAAC,EACb,WAAW,GACX,YAAY,GACZ,eAAe,GACf,eAAe,GACf,WAAW,CAAC;CACjB;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAoLhE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PortfolioHealth.d.ts","sourceRoot":"","sources":["../../../src/components/reports/PortfolioHealth.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,gBAAgB,CAAC,EACb,WAAW,GACX,YAAY,GACZ,eAAe,GACf,eAAe,GACf,WAAW,CAAC;CACjB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"PortfolioHealth.d.ts","sourceRoot":"","sources":["../../../src/components/reports/PortfolioHealth.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,gBAAgB,CAAC,EACb,WAAW,GACX,YAAY,GACZ,eAAe,GACf,eAAe,GACf,WAAW,CAAC;CACjB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA8P1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReportLayout.d.ts","sourceRoot":"","sources":["../../../src/components/reports/ReportLayout.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"ReportLayout.d.ts","sourceRoot":"","sources":["../../../src/components/reports/ReportLayout.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,eAAe,CAAC;IACnC,iBAAiB,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IACrD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA2FpD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupplyChainRisk.d.ts","sourceRoot":"","sources":["../../../src/components/reports/SupplyChainRisk.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,gBAAgB,CAAC,EACb,WAAW,GACX,YAAY,GACZ,eAAe,GACf,eAAe,GACf,WAAW,CAAC;CACjB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"SupplyChainRisk.d.ts","sourceRoot":"","sources":["../../../src/components/reports/SupplyChainRisk.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,gBAAgB,CAAC,EACb,WAAW,GACX,YAAY,GACZ,eAAe,GACf,eAAe,GACf,WAAW,CAAC;CACjB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAyV1D,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* useReportData Hook
|
|
3
3
|
* Fetches and manages report data with error handling
|
|
4
|
+
* Implements caching to prevent duplicate requests
|
|
4
5
|
*/
|
|
5
6
|
export interface UseReportDataOptions {
|
|
6
7
|
enabled?: boolean;
|
|
8
|
+
ttl?: number;
|
|
7
9
|
}
|
|
8
10
|
export interface UseReportDataReturn<T> {
|
|
9
11
|
data: T | null;
|
|
@@ -13,10 +15,10 @@ export interface UseReportDataReturn<T> {
|
|
|
13
15
|
}
|
|
14
16
|
/**
|
|
15
17
|
* Generic hook for fetching report data
|
|
16
|
-
*
|
|
18
|
+
* Implements caching and deduplication to prevent infinite requests
|
|
17
19
|
* @param fetchFn - Async function to fetch report data
|
|
18
20
|
* @param dependencies - Dependencies that trigger refetch when changed
|
|
19
|
-
* @param options - Hook options (enabled flag)
|
|
21
|
+
* @param options - Hook options (enabled flag, cache TTL)
|
|
20
22
|
*/
|
|
21
23
|
export declare function useReportData<T>(fetchFn: () => Promise<T>, dependencies?: React.DependencyList, options?: UseReportDataOptions): UseReportDataReturn<T>;
|
|
22
24
|
//# sourceMappingURL=useReportData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReportData.d.ts","sourceRoot":"","sources":["../../../src/hooks/analytics/useReportData.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"useReportData.d.ts","sourceRoot":"","sources":["../../../src/hooks/analytics/useReportData.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACzB,YAAY,GAAE,KAAK,CAAC,cAAmB,EACvC,OAAO,GAAE,oBAAyB,GACjC,mBAAmB,CAAC,CAAC,CAAC,CAqFxB"}
|