reactbridge-sdk 0.2.1 → 0.2.3

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.
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import type { DirectiveActionCallback } from '../../types/analytics';
3
+ import type { Theme } from '../../types';
4
+ export interface AnalyticsDashboardProps {
5
+ onDirectiveAction: DirectiveActionCallback;
6
+ className?: string;
7
+ showRefresh?: boolean;
8
+ autoRefreshInterval?: number;
9
+ theme?: Theme;
10
+ }
11
+ export declare function AnalyticsDashboard({ onDirectiveAction, className, showRefresh, autoRefreshInterval, theme: customTheme, }: AnalyticsDashboardProps): React.JSX.Element;
12
+ //# sourceMappingURL=AnalyticsDashboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnalyticsDashboard.d.ts","sourceRoot":"","sources":["../../../src/components/analytics/AnalyticsDashboard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAKnD,OAAO,KAAK,EAAsB,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACzF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,WAAW,uBAAuB;IACtC,iBAAiB,EAAE,uBAAuB,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,wBAAgB,kBAAkB,CAAC,EACjC,iBAAiB,EACjB,SAAc,EACd,WAAkB,EAClB,mBAAuB,EACvB,KAAK,EAAE,WAAW,GACnB,EAAE,uBAAuB,qBAygBzB"}
package/dist/index.d.ts CHANGED
@@ -13,6 +13,8 @@ export { AnalyticsWidget } from './components/analytics/AnalyticsWidget';
13
13
  export type { AnalyticsWidgetProps } from './components/analytics/AnalyticsWidget';
14
14
  export { AnalyticsReport } from './components/analytics/AnalyticsReport';
15
15
  export type { AnalyticsReportProps } from './components/analytics/AnalyticsReport';
16
+ export { AnalyticsDashboard } from './components/analytics/AnalyticsDashboard';
17
+ export type { AnalyticsDashboardProps } from './components/analytics/AnalyticsDashboard';
16
18
  export { MetricsPanel } from './components/analytics/MetricsPanel';
17
19
  export type { MetricsPanelProps } from './components/analytics/MetricsPanel';
18
20
  export { DirectivesPanel } from './components/analytics/DirectivesPanel';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5F,YAAY,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAG/E,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,YAAY,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,YAAY,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAG7E,YAAY,EACV,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,UAAU,EACV,cAAc,EACd,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,KAAK,EACL,WAAW,EACX,YAAY,EACZ,cAAc,EACd,SAAS,EACT,WAAW,EACX,WAAW,GACZ,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAG9E,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAG3E,OAAO,EAAE,eAAe,EAAE,MAAM,wCAA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AM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG1E,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,YAAY,EACV,eAAe,EACf,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC"}
package/dist/index.esm.js CHANGED
@@ -2151,5 +2151,285 @@ const AnalyticsWidget = ({ position = 'bottom-right', theme: customTheme, onDire
2151
2151
  isOpen && (React.createElement(AnalyticsDrawer, { isOpen: isOpen, onClose: () => setIsOpen(false), configs: configs, isLoading: isLoading, theme: theme, onDirectiveAction: onDirectiveAction }))));
2152
2152
  };
2153
2153
 
2154
- export { AnalyticsAPI, AnalyticsReport, AnalyticsWidget, DirectivesPanel, MetricsPanel, ObservationsPanel, ReactBridgeAPI, ReactBridgeChatbox, ReactBridgeProvider, ReactBridgeSearch, WebSpeechSTTProvider, WebSpeechTTSProvider, createCustomTheme, darkTheme, getTheme, lightTheme, useAnalyticsConfigs, useAnalyticsResult, useDirectiveAction, useReactBridge, useReactBridgeContext };
2154
+ function AnalyticsDashboard({ onDirectiveAction, className = '', showRefresh = true, autoRefreshInterval = 0, theme: customTheme, }) {
2155
+ const { theme: contextTheme } = useReactBridgeContext();
2156
+ const theme = customTheme || contextTheme;
2157
+ const [selectedAnalytics, setSelectedAnalytics] = useState(null);
2158
+ const [directiveFilter, setDirectiveFilter] = useState('all');
2159
+ // Fetch analytics configurations
2160
+ const { configs, isLoading: configsLoading, error: configsError, refetch: refetchConfigs, } = useAnalyticsConfigs();
2161
+ // Fetch latest result for selected analytics
2162
+ const { result, isLoading: resultLoading, error: resultError, refetch: refetchResult, } = useAnalyticsResult(selectedAnalytics);
2163
+ // Handle directive actions
2164
+ const { handleAction, isProcessing } = useDirectiveAction(onDirectiveAction);
2165
+ // Auto-select first analytics if none selected
2166
+ useEffect(() => {
2167
+ if (configs && configs.length > 0 && !selectedAnalytics) {
2168
+ setSelectedAnalytics(configs[0].analyticsType);
2169
+ }
2170
+ }, [configs, selectedAnalytics]);
2171
+ // Auto-refresh
2172
+ useEffect(() => {
2173
+ if (autoRefreshInterval > 0) {
2174
+ const interval = setInterval(() => {
2175
+ refetchConfigs();
2176
+ if (selectedAnalytics) {
2177
+ refetchResult();
2178
+ }
2179
+ }, autoRefreshInterval * 1000);
2180
+ return () => clearInterval(interval);
2181
+ }
2182
+ }, [autoRefreshInterval, selectedAnalytics, refetchConfigs, refetchResult]);
2183
+ const handleRefresh = () => {
2184
+ refetchConfigs();
2185
+ if (selectedAnalytics) {
2186
+ refetchResult();
2187
+ }
2188
+ };
2189
+ const handleDirectiveAction = (directive, action) => __awaiter(this, void 0, void 0, function* () {
2190
+ yield handleAction(directive, action);
2191
+ // Refetch result to get updated directive statuses
2192
+ refetchResult();
2193
+ });
2194
+ const filteredDirectives = (result === null || result === void 0 ? void 0 : result.directives.filter(d => {
2195
+ if (directiveFilter === 'all')
2196
+ return true;
2197
+ return d.status === directiveFilter;
2198
+ })) || [];
2199
+ const selectedConfig = configs === null || configs === void 0 ? void 0 : configs.find(c => c.analyticsType === selectedAnalytics);
2200
+ const proposedCount = (result === null || result === void 0 ? void 0 : result.directives.filter(d => d.status === 'proposed').length) || 0;
2201
+ const executedCount = (result === null || result === void 0 ? void 0 : result.directives.filter(d => d.status === 'executed').length) || 0;
2202
+ const declinedCount = (result === null || result === void 0 ? void 0 : result.directives.filter(d => d.status === 'declined').length) || 0;
2203
+ const containerStyle = {
2204
+ display: 'flex',
2205
+ gap: theme.spacing.lg,
2206
+ width: '100%',
2207
+ minHeight: '540px',
2208
+ backgroundColor: theme.colors.background,
2209
+ color: theme.colors.text,
2210
+ border: `1px solid ${theme.colors.border}`,
2211
+ borderRadius: theme.borderRadius,
2212
+ boxShadow: theme.boxShadow,
2213
+ padding: theme.spacing.lg,
2214
+ };
2215
+ const sidebarStyle = {
2216
+ width: '320px',
2217
+ borderRight: `1px solid ${theme.colors.border}`,
2218
+ paddingRight: theme.spacing.lg,
2219
+ display: 'flex',
2220
+ flexDirection: 'column',
2221
+ gap: theme.spacing.sm,
2222
+ };
2223
+ const listItemStyle = (isActive, isDisabled) => ({
2224
+ width: '100%',
2225
+ textAlign: 'left',
2226
+ padding: theme.spacing.md,
2227
+ backgroundColor: isActive ? theme.colors.primary : theme.colors.surface,
2228
+ color: isActive ? '#fff' : theme.colors.text,
2229
+ border: `1px solid ${isActive ? theme.colors.primary : theme.colors.border}`,
2230
+ borderRadius: theme.borderRadius,
2231
+ cursor: isDisabled ? 'not-allowed' : 'pointer',
2232
+ opacity: isDisabled ? 0.6 : 1,
2233
+ transition: 'transform 0.15s ease, box-shadow 0.15s ease',
2234
+ boxShadow: isActive ? theme.boxShadow : 'none',
2235
+ });
2236
+ const pillStyle = (bg) => ({
2237
+ fontSize: theme.fontSizes.xs,
2238
+ padding: '2px 8px',
2239
+ borderRadius: '999px',
2240
+ backgroundColor: bg,
2241
+ color: '#fff',
2242
+ fontWeight: 600,
2243
+ });
2244
+ const placeholderStyle = {
2245
+ flex: 1,
2246
+ minHeight: '420px',
2247
+ display: 'flex',
2248
+ flexDirection: 'column',
2249
+ alignItems: 'center',
2250
+ justifyContent: 'center',
2251
+ gap: theme.spacing.sm,
2252
+ color: theme.colors.textSecondary,
2253
+ textAlign: 'center',
2254
+ };
2255
+ const cardStyle = {
2256
+ backgroundColor: theme.colors.surface,
2257
+ border: `1px solid ${theme.colors.border}`,
2258
+ borderRadius: theme.borderRadius,
2259
+ padding: theme.spacing.md,
2260
+ };
2261
+ const statusBadgeStyle = (status) => {
2262
+ const colors = {
2263
+ proposed: { bg: theme.colors.primary, text: '#fff' },
2264
+ executed: { bg: theme.colors.success, text: '#fff' },
2265
+ declined: { bg: theme.colors.error, text: '#fff' },
2266
+ ok: { bg: '#d1fae5', text: '#065f46' },
2267
+ warning: { bg: '#fef3c7', text: '#92400e' },
2268
+ critical: { bg: '#fee2e2', text: '#991b1b' },
2269
+ high: { bg: '#fee2e2', text: '#991b1b' },
2270
+ medium: { bg: '#fef3c7', text: '#92400e' },
2271
+ low: { bg: '#e0ecff', text: '#1e3a8a' },
2272
+ };
2273
+ const palette = colors[status] || { bg: theme.colors.surface, text: theme.colors.text };
2274
+ return {
2275
+ fontSize: theme.fontSizes.xs,
2276
+ padding: '2px 8px',
2277
+ borderRadius: '999px',
2278
+ backgroundColor: palette.bg,
2279
+ color: palette.text,
2280
+ fontWeight: 700,
2281
+ textTransform: 'capitalize',
2282
+ };
2283
+ };
2284
+ const directiveCardStyle = (status) => (Object.assign(Object.assign({}, cardStyle), { borderLeft: `4px solid ${status === 'executed'
2285
+ ? theme.colors.success
2286
+ : status === 'declined'
2287
+ ? theme.colors.error
2288
+ : theme.colors.primary}`, display: 'flex', flexDirection: 'column', gap: theme.spacing.sm }));
2289
+ return (React.createElement("div", { className: className, style: containerStyle },
2290
+ React.createElement("div", { style: sidebarStyle },
2291
+ React.createElement("div", { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },
2292
+ React.createElement("h3", { style: { margin: 0, fontSize: theme.fontSizes.lg } }, "Analytics"),
2293
+ showRefresh && (React.createElement("button", { type: "button", onClick: handleRefresh, disabled: configsLoading, style: {
2294
+ border: `1px solid ${theme.colors.border}`,
2295
+ backgroundColor: theme.colors.surface,
2296
+ color: theme.colors.text,
2297
+ padding: `${theme.spacing.xs} ${theme.spacing.sm}`,
2298
+ borderRadius: theme.borderRadius,
2299
+ cursor: configsLoading ? 'not-allowed' : 'pointer',
2300
+ } }, configsLoading ? 'Refreshing...' : 'Refresh'))),
2301
+ configsLoading && (React.createElement("div", { style: placeholderStyle }, "Loading analytics...")),
2302
+ configsError && (React.createElement("div", { style: placeholderStyle },
2303
+ "Error loading analytics: ",
2304
+ configsError.message)),
2305
+ configs && configs.length === 0 && (React.createElement("div", { style: placeholderStyle }, "No analytics configured. Configure analytics in your DirectivSys dashboard.")),
2306
+ configs && configs.length > 0 && (React.createElement("div", { style: { display: 'flex', flexDirection: 'column', gap: theme.spacing.sm } }, configs.map((config) => {
2307
+ const isActive = selectedAnalytics === config.analyticsType;
2308
+ return (React.createElement("button", { key: config.configId, type: "button", onClick: () => config.isEnabled && setSelectedAnalytics(config.analyticsType), style: listItemStyle(isActive, !config.isEnabled), disabled: !config.isEnabled },
2309
+ React.createElement("div", { style: {
2310
+ display: 'flex',
2311
+ justifyContent: 'space-between',
2312
+ alignItems: 'center',
2313
+ marginBottom: theme.spacing.xs,
2314
+ width: '100%',
2315
+ } },
2316
+ React.createElement("span", { style: { fontSize: theme.fontSizes.md, fontWeight: 600 } }, config.analyticsType),
2317
+ !config.isEnabled && React.createElement("span", { style: pillStyle(theme.colors.textSecondary) }, "Disabled")),
2318
+ React.createElement("div", { style: {
2319
+ fontSize: theme.fontSizes.sm,
2320
+ color: isActive ? 'rgba(255,255,255,0.9)' : theme.colors.textSecondary,
2321
+ marginBottom: theme.spacing.xs,
2322
+ } }, config.templateDescription),
2323
+ React.createElement("div", { style: {
2324
+ display: 'flex',
2325
+ justifyContent: 'space-between',
2326
+ width: '100%',
2327
+ fontSize: theme.fontSizes.xs,
2328
+ color: isActive ? 'rgba(255,255,255,0.8)' : theme.colors.textSecondary,
2329
+ } },
2330
+ React.createElement("span", { style: { textTransform: 'capitalize' } }, config.frequency),
2331
+ config.lastExecutedAt && (React.createElement("span", null,
2332
+ "Last: ",
2333
+ new Date(config.lastExecutedAt).toLocaleDateString())))));
2334
+ })))),
2335
+ React.createElement("div", { style: { flex: 1, display: 'flex', flexDirection: 'column', gap: theme.spacing.lg } },
2336
+ !selectedAnalytics && (React.createElement("div", { style: placeholderStyle },
2337
+ React.createElement("h3", { style: { margin: 0, color: theme.colors.text } }, "No analytics selected"),
2338
+ React.createElement("p", { style: { margin: 0 } }, "Select an analytics type from the left to view results."))),
2339
+ selectedAnalytics && resultLoading && (React.createElement("div", { style: placeholderStyle }, "Loading results...")),
2340
+ selectedAnalytics && resultError && (React.createElement("div", { style: placeholderStyle },
2341
+ "Error loading results: ",
2342
+ resultError.message)),
2343
+ selectedAnalytics && !resultLoading && !result && (React.createElement("div", { style: placeholderStyle },
2344
+ React.createElement("h3", { style: { margin: 0, color: theme.colors.text } }, "No results yet"),
2345
+ React.createElement("p", { style: { margin: 0 } }, "This analytics has not run yet. Results will appear after the first run."))),
2346
+ selectedAnalytics && result && (React.createElement("div", { style: { display: 'flex', flexDirection: 'column', gap: theme.spacing.lg } },
2347
+ React.createElement("div", { style: { display: 'flex', flexDirection: 'column', gap: theme.spacing.xs } },
2348
+ React.createElement("h2", { style: { margin: 0, fontSize: theme.fontSizes.xl, color: theme.colors.text } }, selectedConfig === null || selectedConfig === void 0 ? void 0 : selectedConfig.analyticsType),
2349
+ React.createElement("p", { style: { margin: 0, color: theme.colors.textSecondary, fontSize: theme.fontSizes.sm } },
2350
+ "Generated: ",
2351
+ new Date(result.createdAt).toLocaleString())),
2352
+ result.metrics && result.metrics.length > 0 && (React.createElement("div", { style: { display: 'flex', flexDirection: 'column', gap: theme.spacing.md } },
2353
+ React.createElement("h3", { style: { margin: 0, fontSize: theme.fontSizes.lg } }, "Metrics"),
2354
+ React.createElement("div", { style: {
2355
+ display: 'grid',
2356
+ gridTemplateColumns: 'repeat(auto-fill, minmax(220px, 1fr))',
2357
+ gap: theme.spacing.md,
2358
+ } }, result.metrics.map((metric, index) => (React.createElement("div", { key: index, style: Object.assign(Object.assign({}, cardStyle), { borderLeft: `4px solid ${metric.status === 'ok'
2359
+ ? theme.colors.success
2360
+ : metric.status === 'warning'
2361
+ ? '#f59e0b'
2362
+ : theme.colors.error}` }) },
2363
+ React.createElement("div", { style: {
2364
+ display: 'flex',
2365
+ justifyContent: 'space-between',
2366
+ alignItems: 'center',
2367
+ marginBottom: theme.spacing.xs,
2368
+ } },
2369
+ React.createElement("span", { style: { fontWeight: 600 } }, metric.name),
2370
+ React.createElement("span", { style: statusBadgeStyle(metric.status) }, metric.status)),
2371
+ React.createElement("div", { style: { fontSize: theme.fontSizes.xl, fontWeight: 700 } },
2372
+ metric.value,
2373
+ " ",
2374
+ metric.unit),
2375
+ React.createElement("div", { style: { color: theme.colors.textSecondary, fontSize: theme.fontSizes.sm } }, metric.explanation))))))),
2376
+ result.observations && result.observations.length > 0 && (React.createElement("div", { style: { display: 'flex', flexDirection: 'column', gap: theme.spacing.md } },
2377
+ React.createElement("h3", { style: { margin: 0, fontSize: theme.fontSizes.lg } }, "Observations"),
2378
+ React.createElement("div", { style: { display: 'flex', flexDirection: 'column', gap: theme.spacing.sm } }, result.observations.map((observation, index) => (React.createElement("div", { key: index, style: Object.assign(Object.assign({}, cardStyle), { borderLeft: `4px solid ${observation.severity === 'high'
2379
+ ? theme.colors.error
2380
+ : observation.severity === 'medium'
2381
+ ? '#f59e0b'
2382
+ : theme.colors.primary}`, display: 'flex', flexDirection: 'column', gap: theme.spacing.xs }) },
2383
+ React.createElement("div", { style: { display: 'flex', gap: theme.spacing.sm, alignItems: 'center' } },
2384
+ React.createElement("span", { style: statusBadgeStyle(observation.severity) }, observation.severity),
2385
+ React.createElement("span", { style: { color: theme.colors.textSecondary, fontSize: theme.fontSizes.sm } }, observation.scope)),
2386
+ React.createElement("div", { style: { color: theme.colors.text, fontSize: theme.fontSizes.sm } }, observation.text))))))),
2387
+ result.directives && result.directives.length > 0 && (React.createElement("div", { style: { display: 'flex', flexDirection: 'column', gap: theme.spacing.md } },
2388
+ React.createElement("div", { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },
2389
+ React.createElement("h3", { style: { margin: 0, fontSize: theme.fontSizes.lg } }, "Recommended actions"),
2390
+ React.createElement("div", { style: { display: 'flex', gap: theme.spacing.xs } },
2391
+ React.createElement("button", { type: "button", onClick: () => setDirectiveFilter('all'), style: Object.assign(Object.assign({}, pillStyle(directiveFilter === 'all' ? theme.colors.primary : theme.colors.surface)), { border: `1px solid ${theme.colors.border}`, color: directiveFilter === 'all' ? '#fff' : theme.colors.text }) },
2392
+ "All (",
2393
+ result.directives.length,
2394
+ ")"),
2395
+ React.createElement("button", { type: "button", onClick: () => setDirectiveFilter('proposed'), style: Object.assign(Object.assign({}, pillStyle(directiveFilter === 'proposed' ? theme.colors.primary : theme.colors.surface)), { border: `1px solid ${theme.colors.border}`, color: directiveFilter === 'proposed' ? '#fff' : theme.colors.text }) },
2396
+ "Proposed (",
2397
+ proposedCount,
2398
+ ")"),
2399
+ React.createElement("button", { type: "button", onClick: () => setDirectiveFilter('executed'), style: Object.assign(Object.assign({}, pillStyle(directiveFilter === 'executed' ? theme.colors.primary : theme.colors.surface)), { border: `1px solid ${theme.colors.border}`, color: directiveFilter === 'executed' ? '#fff' : theme.colors.text }) },
2400
+ "Executed (",
2401
+ executedCount,
2402
+ ")"),
2403
+ React.createElement("button", { type: "button", onClick: () => setDirectiveFilter('declined'), style: Object.assign(Object.assign({}, pillStyle(directiveFilter === 'declined' ? theme.colors.primary : theme.colors.surface)), { border: `1px solid ${theme.colors.border}`, color: directiveFilter === 'declined' ? '#fff' : theme.colors.text }) },
2404
+ "Declined (",
2405
+ declinedCount,
2406
+ ")"))),
2407
+ filteredDirectives.length === 0 && (React.createElement("div", { style: placeholderStyle }, "No directives match the selected filter.")),
2408
+ React.createElement("div", { style: { display: 'flex', flexDirection: 'column', gap: theme.spacing.sm } }, filteredDirectives.map((directive) => (React.createElement("div", { key: directive.directiveId, style: directiveCardStyle(directive.status) },
2409
+ React.createElement("div", { style: {
2410
+ display: 'flex',
2411
+ justifyContent: 'space-between',
2412
+ alignItems: 'center',
2413
+ gap: theme.spacing.sm,
2414
+ flexWrap: 'wrap',
2415
+ } },
2416
+ React.createElement("div", { style: { display: 'flex', flexDirection: 'column', gap: theme.spacing.xs } },
2417
+ React.createElement("span", { style: { fontWeight: 700 } }, directive.action),
2418
+ React.createElement("span", { style: { color: theme.colors.textSecondary, fontSize: theme.fontSizes.sm } },
2419
+ "Priority: ",
2420
+ directive.priority)),
2421
+ React.createElement("span", { style: statusBadgeStyle(directive.status) }, directive.status)),
2422
+ React.createElement("div", { style: { color: theme.colors.text, fontSize: theme.fontSizes.sm } }, directive.rationale),
2423
+ directive.parameters && directive.parameters.length > 0 && (React.createElement("div", { style: { color: theme.colors.textSecondary, fontSize: theme.fontSizes.sm } },
2424
+ React.createElement("strong", { style: { color: theme.colors.text } }, "Parameters:"),
2425
+ React.createElement("ul", { style: { margin: `${theme.spacing.xs} 0 0 16px`, padding: 0 } }, directive.parameters.map((param, index) => (React.createElement("li", { key: index, style: { marginBottom: theme.spacing.xs } },
2426
+ React.createElement("code", null, param.name),
2427
+ ": ",
2428
+ param.value)))))),
2429
+ directive.status === 'proposed' && (React.createElement("div", { style: { display: 'flex', gap: theme.spacing.sm } },
2430
+ React.createElement("button", { type: "button", onClick: () => handleDirectiveAction(directive, 'execute'), disabled: isProcessing, style: Object.assign(Object.assign({}, pillStyle(theme.colors.success)), { border: 'none', cursor: isProcessing ? 'not-allowed' : 'pointer' }) }, isProcessing ? 'Processing...' : 'Execute'),
2431
+ React.createElement("button", { type: "button", onClick: () => handleDirectiveAction(directive, 'decline'), disabled: isProcessing, style: Object.assign(Object.assign({}, pillStyle(theme.colors.error)), { border: 'none', cursor: isProcessing ? 'not-allowed' : 'pointer' }) }, "Decline"))))))))))))));
2432
+ }
2433
+
2434
+ export { AnalyticsAPI, AnalyticsDashboard, AnalyticsReport, AnalyticsWidget, DirectivesPanel, MetricsPanel, ObservationsPanel, ReactBridgeAPI, ReactBridgeChatbox, ReactBridgeProvider, ReactBridgeSearch, WebSpeechSTTProvider, WebSpeechTTSProvider, createCustomTheme, darkTheme, getTheme, lightTheme, useAnalyticsConfigs, useAnalyticsResult, useDirectiveAction, useReactBridge, useReactBridgeContext };
2155
2435
  //# sourceMappingURL=index.esm.js.map