@burdenoff/microfe-bigconsole 2026.1121.4 → 2026.1122.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.
@@ -43,3 +43,4 @@ export { useExportDataSink, type ExportDataSinkOptions, type UseExportDataSinkRe
43
43
  export { useImportDataSink, type ImportDataSinkInfo, type ImportDataSinkValidationError, type ImportDataSinkValidationResult, type ImportDataSinkResult, type ImportDataSinkOptions, type UseImportDataSinkResult, default as useImportDataSinkDefault, } from './useImportDataSink';
44
44
  export { useWidgetNarrative, type UseWidgetNarrativeResult, type WidgetNarrative, default as useWidgetNarrativeDefault, } from './useWidgetNarrative';
45
45
  export { useDashboardDigest, type DashboardNarrative, type UseDashboardDigestResult, default as useDashboardDigestDefault, } from './useDashboardDigest';
46
+ export { useKpiChange, type KpiChangeExplanation, type UseKpiChangeResult, default as useKpiChangeDefault, } from './useKpiChange';
@@ -37,4 +37,5 @@ import w from "./useExportDataSink.js";
37
37
  import T from "./useImportDataSink.js";
38
38
  import "./useWidgetNarrative.js";
39
39
  import "./useDashboardDigest.js";
40
+ import "./useKpiChange.js";
40
41
  export { n as formatTimeUntilRefresh, p as useBoardMigrationPreview, s as useDashboardOperations, _ as useDashboardSharing, v as useDashboardViews, m as useDataSinkOperations, l as useDrilldown, u as useDrilldownOperations, d as useExportDashboard, w as useExportDataSink, S as useExportParser, b as useFilterPresets, y as useFilterUrlSync, g as useGlobalFilters, f as useImportDashboard, T as useImportDataSink, C as useImportParser, x as usePageOperations, h as useParserOperations, r as useWidgetAutoRefresh, a as useWidgetComments, t as useWidgetCompareData, o as useWidgetConfigPersist, e as useWidgetData, c as useWidgetExport, i as useWidgetOperations };
@@ -0,0 +1,14 @@
1
+ import { KpiChangeExplanationFieldsFragment } from '../../generated/wspace-operations';
2
+ export type KpiChangeExplanation = KpiChangeExplanationFieldsFragment;
3
+ export interface UseKpiChangeResult {
4
+ explanation: KpiChangeExplanation | null;
5
+ loading: boolean;
6
+ error: string | null;
7
+ /** The last run was refused for quota or billing: retrying cannot succeed. */
8
+ quotaRefused: boolean;
9
+ /** Run the analysis. `dimension` overrides the automatically detected one. */
10
+ explain: (dimension?: string | null) => Promise<KpiChangeExplanation | null>;
11
+ reset: () => void;
12
+ }
13
+ export declare function useKpiChange(widgetId: string): UseKpiChangeResult;
14
+ export default useKpiChange;
@@ -0,0 +1,60 @@
1
+ import { ExplainKpiChangeDocument as e } from "../../generated/wspace-operations.js";
2
+ import { useBigConsole as t } from "../context/BigConsoleContext.js";
3
+ import "../context/index.js";
4
+ import { describeKpiChangeError as n } from "../components/kpi-change/kpiChangeModel.js";
5
+ import { classifyBigConsoleQuotaError as r, reportBigConsoleQuotaError as i } from "../utils/quota.js";
6
+ import { useCallback as a, useEffect as o, useRef as s, useState as c } from "react";
7
+ import { useApolloClient as l } from "@apollo/client/react";
8
+ // src/bigconsole/hooks/useKpiChange.ts
9
+ function u(u) {
10
+ let d = l(), { workspaceId: f } = t(), [p, m] = c(null), [h, g] = c(!1), [_, v] = c(null), [y, b] = c(!1), x = s(0), S = s(f);
11
+ return o(() => {
12
+ S.current !== f && (S.current = f, x.current += 1, m(null), v(null), b(!1), g(!1));
13
+ }, [f]), {
14
+ explanation: p,
15
+ loading: h,
16
+ error: _,
17
+ quotaRefused: y,
18
+ explain: a(async (t) => {
19
+ let a = ++x.current;
20
+ m(null), g(!0), v(null), b(!1);
21
+ try {
22
+ let n = await d.query({
23
+ query: e,
24
+ variables: {
25
+ widgetId: u,
26
+ input: t ? { dimension: t } : null
27
+ },
28
+ fetchPolicy: "network-only",
29
+ errorPolicy: "none",
30
+ context: {
31
+ requiredWorkspaceAuth: !0,
32
+ requiredWorkspaceId: f,
33
+ queryDeduplication: !1
34
+ }
35
+ });
36
+ if (a !== x.current) return null;
37
+ let r = n.data?.explainKpiChange ?? null;
38
+ if (!r) throw Error("The change explanation returned no result.");
39
+ return m(r), r;
40
+ } catch (e) {
41
+ if (a === x.current) {
42
+ m(null);
43
+ let t = r(e, "command") !== null;
44
+ t && i(e, "command"), b(t), v(n(e));
45
+ }
46
+ return null;
47
+ } finally {
48
+ a === x.current && g(!1);
49
+ }
50
+ }, [
51
+ d,
52
+ u,
53
+ f
54
+ ]),
55
+ reset: a(() => {
56
+ x.current += 1, m(null), v(null), b(!1), g(!1);
57
+ }, [])
58
+ };
59
+ }
60
+ export { u as default, u as useKpiChange };
@@ -598,6 +598,69 @@ export type BigConsoleInstantiateDashboardTemplateInput = {
598
598
  /** Dashboard visibility */
599
599
  visibility?: BigConsoleDashboardVisibility | null | undefined;
600
600
  };
601
+ /** How strongly the evidence supports a finding as an explanation of the movement. */
602
+ export type BigConsoleKpiChangeConfidence =
603
+ /** The evidence establishes the cause of the movement. */
604
+ 'CONFIRMED'
605
+ /** The event happened in the comparison window; the evidence does not establish that it caused the movement. */
606
+ | 'CORRELATION'
607
+ /** There is not enough evidence to say anything about this lane. */
608
+ | 'INSUFFICIENT_EVIDENCE'
609
+ /** The evidence strongly suggests the finding contributed, but its share is not quantified. */
610
+ | 'LIKELY';
611
+ /** How a contribution to the movement was derived. */
612
+ export type BigConsoleKpiChangeContributionKind =
613
+ /** The additive change of one dimension member (or of the metric itself). */
614
+ 'ADDITIVE'
615
+ /** The part of the movement caused by the mix between dimension members. */
616
+ | 'MIX'
617
+ /** The part of the movement caused by the level change inside dimension members. */
618
+ | 'RATE';
619
+ /** Which way the metric moved. */
620
+ export type BigConsoleKpiChangeDirection = 'DOWN' | 'FLAT' | 'UP';
621
+ /** What kind of record backs a finding. */
622
+ export type BigConsoleKpiChangeEvidenceKind =
623
+ /** The DataSink the card reads from. */
624
+ 'DATA_SOURCE'
625
+ /** A definition change: a parser edit, a pipeline rewrite or a saved dashboard version. */
626
+ | 'DEFINITION_CHANGE'
627
+ /** One member of the dimension the change was broken down by. */
628
+ | 'DIMENSION_MEMBER'
629
+ /** An ingestion batch of the DataSink behind the card. */
630
+ | 'INGEST_BATCH'
631
+ /** A pipeline execution that feeds the DataSink behind the card. */
632
+ | 'PIPELINE_EXECUTION';
633
+ /** Optional overrides for the analysis. Everything is detected when omitted. */
634
+ export type BigConsoleKpiChangeInput = {
635
+ /** The dimension to break the change down by, e.g. "region". Detected automatically when omitted. */
636
+ dimension?: string | null | undefined;
637
+ };
638
+ /** Which kind of cause a finding belongs to. */
639
+ export type BigConsoleKpiChangeLane =
640
+ /** A real change in the business: the data changed for operational reasons. */
641
+ 'BUSINESS'
642
+ /** Something went wrong with the data: ingestion failed, was late, was duplicated or was backfilled. */
643
+ | 'DATA_INCIDENT'
644
+ /** The definition behind the number changed: a parser, a pipeline or a saved dashboard version. */
645
+ | 'DEFINITION';
646
+ /** How the explanation ended. */
647
+ export type BigConsoleKpiChangeStatus =
648
+ /** The analysis could not run (no bound DataSink, stale or errored source, missing history). */
649
+ 'DECLINED'
650
+ /** The movement was measured and at least one lane produced a finding. */
651
+ | 'EXPLAINED'
652
+ /** The movement was measured, but the available evidence cannot establish a cause. */
653
+ | 'INCONCLUSIVE'
654
+ /** The movement was measured, but the evidence only covers part of it. */
655
+ | 'PARTIAL'
656
+ /** The metric did not meaningfully move between the two windows. */
657
+ | 'UNCHANGED';
658
+ /** Whether the human-readable explanation was written by the model or assembled deterministically. */
659
+ export type BigConsoleKpiChangeSummarySource =
660
+ /** Assembled from the verified findings without calling the model. */
661
+ 'DETERMINISTIC'
662
+ /** Written by the model from the verified findings only. */
663
+ | 'MODEL';
601
664
  export type BigConsoleKpiReconciliationFieldKind = 'BOOLEAN' | 'DATE' | 'MIXED' | 'NUMBER' | 'STRING';
602
665
  /** A record filter, applied to a card's records before the period (AND). */
603
666
  export type BigConsoleKpiReconciliationFilterInput = {
@@ -5378,6 +5441,234 @@ export type GetFilterPresetsQuery = {
5378
5441
  updatedAt: string;
5379
5442
  }>;
5380
5443
  };
5444
+ export type KpiChangeExplanationFieldsFragment = {
5445
+ status: Types.BigConsoleKpiChangeStatus;
5446
+ widgetId: string;
5447
+ widgetTitle: string;
5448
+ dataSinkId: string | null;
5449
+ metricName: string;
5450
+ explainedPercent: number | null;
5451
+ limitations: Array<string>;
5452
+ confidence: Types.BigConsoleKpiChangeConfidence;
5453
+ summary: string;
5454
+ summarySource: Types.BigConsoleKpiChangeSummarySource;
5455
+ declineReason: string | null;
5456
+ computedAt: string;
5457
+ movement: {
5458
+ metricName: string;
5459
+ unit: string | null;
5460
+ previousValue: number | null;
5461
+ currentValue: number | null;
5462
+ absoluteChange: number | null;
5463
+ percentChange: number | null;
5464
+ direction: Types.BigConsoleKpiChangeDirection;
5465
+ comparisonBasis: string;
5466
+ previousWindow: {
5467
+ label: string;
5468
+ version: number | null;
5469
+ committedAt: string | null;
5470
+ };
5471
+ currentWindow: {
5472
+ label: string;
5473
+ version: number | null;
5474
+ committedAt: string | null;
5475
+ };
5476
+ } | null;
5477
+ businessFindings: Array<{
5478
+ id: string;
5479
+ lane: Types.BigConsoleKpiChangeLane;
5480
+ title: string;
5481
+ detail: string;
5482
+ confidence: Types.BigConsoleKpiChangeConfidence;
5483
+ confidenceReason: string;
5484
+ contributions: Array<{
5485
+ kind: Types.BigConsoleKpiChangeContributionKind;
5486
+ label: string;
5487
+ absolute: number | null;
5488
+ percentOfMovement: number | null;
5489
+ }>;
5490
+ evidence: Array<{
5491
+ kind: Types.BigConsoleKpiChangeEvidenceKind;
5492
+ referenceId: string | null;
5493
+ label: string;
5494
+ detail: string | null;
5495
+ route: string | null;
5496
+ occurredAt: string | null;
5497
+ }>;
5498
+ }>;
5499
+ dataIncidentFindings: Array<{
5500
+ id: string;
5501
+ lane: Types.BigConsoleKpiChangeLane;
5502
+ title: string;
5503
+ detail: string;
5504
+ confidence: Types.BigConsoleKpiChangeConfidence;
5505
+ confidenceReason: string;
5506
+ contributions: Array<{
5507
+ kind: Types.BigConsoleKpiChangeContributionKind;
5508
+ label: string;
5509
+ absolute: number | null;
5510
+ percentOfMovement: number | null;
5511
+ }>;
5512
+ evidence: Array<{
5513
+ kind: Types.BigConsoleKpiChangeEvidenceKind;
5514
+ referenceId: string | null;
5515
+ label: string;
5516
+ detail: string | null;
5517
+ route: string | null;
5518
+ occurredAt: string | null;
5519
+ }>;
5520
+ }>;
5521
+ definitionFindings: Array<{
5522
+ id: string;
5523
+ lane: Types.BigConsoleKpiChangeLane;
5524
+ title: string;
5525
+ detail: string;
5526
+ confidence: Types.BigConsoleKpiChangeConfidence;
5527
+ confidenceReason: string;
5528
+ contributions: Array<{
5529
+ kind: Types.BigConsoleKpiChangeContributionKind;
5530
+ label: string;
5531
+ absolute: number | null;
5532
+ percentOfMovement: number | null;
5533
+ }>;
5534
+ evidence: Array<{
5535
+ kind: Types.BigConsoleKpiChangeEvidenceKind;
5536
+ referenceId: string | null;
5537
+ label: string;
5538
+ detail: string | null;
5539
+ route: string | null;
5540
+ occurredAt: string | null;
5541
+ }>;
5542
+ }>;
5543
+ };
5544
+ export type KpiChangeFindingFieldsFragment = {
5545
+ id: string;
5546
+ lane: Types.BigConsoleKpiChangeLane;
5547
+ title: string;
5548
+ detail: string;
5549
+ confidence: Types.BigConsoleKpiChangeConfidence;
5550
+ confidenceReason: string;
5551
+ contributions: Array<{
5552
+ kind: Types.BigConsoleKpiChangeContributionKind;
5553
+ label: string;
5554
+ absolute: number | null;
5555
+ percentOfMovement: number | null;
5556
+ }>;
5557
+ evidence: Array<{
5558
+ kind: Types.BigConsoleKpiChangeEvidenceKind;
5559
+ referenceId: string | null;
5560
+ label: string;
5561
+ detail: string | null;
5562
+ route: string | null;
5563
+ occurredAt: string | null;
5564
+ }>;
5565
+ };
5566
+ export type ExplainKpiChangeQueryVariables = Exact<{
5567
+ widgetId: string | number;
5568
+ input?: Types.BigConsoleKpiChangeInput | null | undefined;
5569
+ }>;
5570
+ export type ExplainKpiChangeQuery = {
5571
+ explainKpiChange: {
5572
+ status: Types.BigConsoleKpiChangeStatus;
5573
+ widgetId: string;
5574
+ widgetTitle: string;
5575
+ dataSinkId: string | null;
5576
+ metricName: string;
5577
+ explainedPercent: number | null;
5578
+ limitations: Array<string>;
5579
+ confidence: Types.BigConsoleKpiChangeConfidence;
5580
+ summary: string;
5581
+ summarySource: Types.BigConsoleKpiChangeSummarySource;
5582
+ declineReason: string | null;
5583
+ computedAt: string;
5584
+ movement: {
5585
+ metricName: string;
5586
+ unit: string | null;
5587
+ previousValue: number | null;
5588
+ currentValue: number | null;
5589
+ absoluteChange: number | null;
5590
+ percentChange: number | null;
5591
+ direction: Types.BigConsoleKpiChangeDirection;
5592
+ comparisonBasis: string;
5593
+ previousWindow: {
5594
+ label: string;
5595
+ version: number | null;
5596
+ committedAt: string | null;
5597
+ };
5598
+ currentWindow: {
5599
+ label: string;
5600
+ version: number | null;
5601
+ committedAt: string | null;
5602
+ };
5603
+ } | null;
5604
+ businessFindings: Array<{
5605
+ id: string;
5606
+ lane: Types.BigConsoleKpiChangeLane;
5607
+ title: string;
5608
+ detail: string;
5609
+ confidence: Types.BigConsoleKpiChangeConfidence;
5610
+ confidenceReason: string;
5611
+ contributions: Array<{
5612
+ kind: Types.BigConsoleKpiChangeContributionKind;
5613
+ label: string;
5614
+ absolute: number | null;
5615
+ percentOfMovement: number | null;
5616
+ }>;
5617
+ evidence: Array<{
5618
+ kind: Types.BigConsoleKpiChangeEvidenceKind;
5619
+ referenceId: string | null;
5620
+ label: string;
5621
+ detail: string | null;
5622
+ route: string | null;
5623
+ occurredAt: string | null;
5624
+ }>;
5625
+ }>;
5626
+ dataIncidentFindings: Array<{
5627
+ id: string;
5628
+ lane: Types.BigConsoleKpiChangeLane;
5629
+ title: string;
5630
+ detail: string;
5631
+ confidence: Types.BigConsoleKpiChangeConfidence;
5632
+ confidenceReason: string;
5633
+ contributions: Array<{
5634
+ kind: Types.BigConsoleKpiChangeContributionKind;
5635
+ label: string;
5636
+ absolute: number | null;
5637
+ percentOfMovement: number | null;
5638
+ }>;
5639
+ evidence: Array<{
5640
+ kind: Types.BigConsoleKpiChangeEvidenceKind;
5641
+ referenceId: string | null;
5642
+ label: string;
5643
+ detail: string | null;
5644
+ route: string | null;
5645
+ occurredAt: string | null;
5646
+ }>;
5647
+ }>;
5648
+ definitionFindings: Array<{
5649
+ id: string;
5650
+ lane: Types.BigConsoleKpiChangeLane;
5651
+ title: string;
5652
+ detail: string;
5653
+ confidence: Types.BigConsoleKpiChangeConfidence;
5654
+ confidenceReason: string;
5655
+ contributions: Array<{
5656
+ kind: Types.BigConsoleKpiChangeContributionKind;
5657
+ label: string;
5658
+ absolute: number | null;
5659
+ percentOfMovement: number | null;
5660
+ }>;
5661
+ evidence: Array<{
5662
+ kind: Types.BigConsoleKpiChangeEvidenceKind;
5663
+ referenceId: string | null;
5664
+ label: string;
5665
+ detail: string | null;
5666
+ route: string | null;
5667
+ occurredAt: string | null;
5668
+ }>;
5669
+ }>;
5670
+ };
5671
+ };
5381
5672
  export type PreviewBoardMigrationQueryVariables = Exact<{
5382
5673
  source: Types.BigConsoleBoardMigrationSource;
5383
5674
  boardJson: Record<string, unknown>;
@@ -8953,6 +9244,8 @@ export declare const DataSinkPageInfoFieldsFragmentDoc: DocumentNode<DataSinkPag
8953
9244
  export declare const QueryRelationFieldsFragmentDoc: DocumentNode<QueryRelationFieldsFragment, unknown>;
8954
9245
  export declare const QueryGrantFieldsFragmentDoc: DocumentNode<QueryGrantFieldsFragment, unknown>;
8955
9246
  export declare const FilterPresetFieldsFragmentDoc: DocumentNode<FilterPresetFieldsFragment, unknown>;
9247
+ export declare const KpiChangeFindingFieldsFragmentDoc: DocumentNode<KpiChangeFindingFieldsFragment, unknown>;
9248
+ export declare const KpiChangeExplanationFieldsFragmentDoc: DocumentNode<KpiChangeExplanationFieldsFragment, unknown>;
8956
9249
  export declare const NarrativeFieldsFragmentDoc: DocumentNode<NarrativeFieldsFragment, unknown>;
8957
9250
  export declare const ParserPageInfoFieldsFragmentDoc: DocumentNode<ParserPageInfoFieldsFragment, unknown>;
8958
9251
  export declare const ParserCoreFieldsFragmentDoc: DocumentNode<ParserCoreFieldsFragment, unknown>;
@@ -9101,6 +9394,7 @@ export declare const UpdateFilterPresetDocument: DocumentNode<UpdateFilterPreset
9101
9394
  export declare const GetDefaultFilterPresetDocument: DocumentNode<GetDefaultFilterPresetQuery, GetDefaultFilterPresetQueryVariables>;
9102
9395
  export declare const GetFilterPresetDocument: DocumentNode<GetFilterPresetQuery, GetFilterPresetQueryVariables>;
9103
9396
  export declare const GetFilterPresetsDocument: DocumentNode<GetFilterPresetsQuery, GetFilterPresetsQueryVariables>;
9397
+ export declare const ExplainKpiChangeDocument: DocumentNode<ExplainKpiChangeQuery, ExplainKpiChangeQueryVariables>;
9104
9398
  export declare const PreviewBoardMigrationDocument: DocumentNode<PreviewBoardMigrationQuery, PreviewBoardMigrationQueryVariables>;
9105
9399
  export declare const ExplainDashboardDocument: DocumentNode<ExplainDashboardQuery, ExplainDashboardQueryVariables>;
9106
9400
  export declare const ExplainWidgetDocument: DocumentNode<ExplainWidgetQuery, ExplainWidgetQueryVariables>;