@aintela/bi 0.2.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.
Files changed (175) hide show
  1. package/README.md +299 -0
  2. package/dist/BiClientProvider-CWJochvi.js +219 -0
  3. package/dist/BiClientProvider-CWJochvi.js.map +1 -0
  4. package/dist/ChartCardDefaultsContext-Cl5T25H0.js +32 -0
  5. package/dist/ChartCardDefaultsContext-Cl5T25H0.js.map +1 -0
  6. package/dist/ChartContext-C_f_6khG.js +14 -0
  7. package/dist/ChartContext-C_f_6khG.js.map +1 -0
  8. package/dist/DashboardParametersContext-Clv--79U.js +39 -0
  9. package/dist/DashboardParametersContext-Clv--79U.js.map +1 -0
  10. package/dist/cards/ChartCard.d.ts +62 -0
  11. package/dist/cards/DataTableCard.d.ts +55 -0
  12. package/dist/cards/GaugeCard.d.ts +20 -0
  13. package/dist/cards/GaugeGroup.d.ts +12 -0
  14. package/dist/cards/MapBubbles.d.ts +35 -0
  15. package/dist/cards/MapConnections.d.ts +28 -0
  16. package/dist/cards/MetricCard.d.ts +15 -0
  17. package/dist/cards/MetricGroupCard.d.ts +10 -0
  18. package/dist/cards/TreeMapCard.d.ts +15 -0
  19. package/dist/cards/geoLayers.d.ts +23 -0
  20. package/dist/cards/index.d.ts +24 -0
  21. package/dist/cards/licenseGuard.d.ts +9 -0
  22. package/dist/cards/mapUtils.d.ts +23 -0
  23. package/dist/cards/useContainerRectangle.d.ts +9 -0
  24. package/dist/cards/worldMapPath.d.ts +7 -0
  25. package/dist/cards.d.ts +2 -0
  26. package/dist/cards.js +28 -0
  27. package/dist/cards.js.map +1 -0
  28. package/dist/client/BiClient.d.ts +160 -0
  29. package/dist/client/BiClientProvider.d.ts +21 -0
  30. package/dist/client/index.d.ts +4 -0
  31. package/dist/client.d.ts +2 -0
  32. package/dist/client.js +11 -0
  33. package/dist/client.js.map +1 -0
  34. package/dist/composer/environment/environmentDom.d.ts +31 -0
  35. package/dist/composer/environment/types.d.ts +67 -0
  36. package/dist/composer/icons/cardTypeIcons.d.ts +31 -0
  37. package/dist/composer/index.d.ts +66 -0
  38. package/dist/composer/llm/ExampleCardSketch.d.ts +22 -0
  39. package/dist/composer/llm/ExamplePad.d.ts +18 -0
  40. package/dist/composer/llm/PrototypePad.d.ts +13 -0
  41. package/dist/composer/llm/useDashboardPad.d.ts +25 -0
  42. package/dist/composer/models/catalog.d.ts +33 -0
  43. package/dist/composer/models/sketchModels.d.ts +102 -0
  44. package/dist/composer/models/utils.d.ts +9 -0
  45. package/dist/composer/pad/CardSketch.d.ts +25 -0
  46. package/dist/composer/pad/ClonedComponent.d.ts +13 -0
  47. package/dist/composer/pad/DashboardPad.d.ts +38 -0
  48. package/dist/composer/pad/DashboardPadEditor.d.ts +35 -0
  49. package/dist/composer/pad/DashboardPadSketch.d.ts +31 -0
  50. package/dist/composer/pad/DatasetParameterizationControls.d.ts +34 -0
  51. package/dist/composer/pad/FilterSketch.d.ts +10 -0
  52. package/dist/composer/pad/HoverButton.d.ts +12 -0
  53. package/dist/composer/pad/TitleSketch.d.ts +19 -0
  54. package/dist/composer/pad/ToolBox.d.ts +11 -0
  55. package/dist/composer/store/ComposerProvider.d.ts +36 -0
  56. package/dist/composer/store/createComposerStore.d.ts +107 -0
  57. package/dist/composer/store/drafts.d.ts +20 -0
  58. package/dist/composer/view/ComposerChatBinding.d.ts +10 -0
  59. package/dist/composer/view/ComposerView.d.ts +49 -0
  60. package/dist/composer/view/DashboardPin.d.ts +3 -0
  61. package/dist/composer/view/DashboardSidePanel.d.ts +10 -0
  62. package/dist/composer/view/DrawablePrompt.d.ts +22 -0
  63. package/dist/composer/view/EntryEmptyState.d.ts +22 -0
  64. package/dist/composer/view/SpotlightOverlay.d.ts +21 -0
  65. package/dist/composer/view/composerAnimations.d.ts +11 -0
  66. package/dist/composer/view/composerTypes.d.ts +18 -0
  67. package/dist/composer/view/data/suggestions.d.ts +10 -0
  68. package/dist/composer/view/data/templates.d.ts +33 -0
  69. package/dist/composer/view/surfaces.d.ts +19 -0
  70. package/dist/composer/view/useComposerChatBridge.d.ts +43 -0
  71. package/dist/composer.d.ts +2 -0
  72. package/dist/composer.js +99 -0
  73. package/dist/composer.js.map +1 -0
  74. package/dist/createBiTheme-TyUv_UHM.js +93 -0
  75. package/dist/createBiTheme-TyUv_UHM.js.map +1 -0
  76. package/dist/data/ChartCardDefaultsContext.d.ts +43 -0
  77. package/dist/data/dataUtils.d.ts +152 -0
  78. package/dist/data/index.d.ts +5 -0
  79. package/dist/data/queryModel.d.ts +23 -0
  80. package/dist/data.d.ts +2 -0
  81. package/dist/data.js +37 -0
  82. package/dist/data.js.map +1 -0
  83. package/dist/dataUtils-CAUE5uZY.js +372 -0
  84. package/dist/dataUtils-CAUE5uZY.js.map +1 -0
  85. package/dist/filters/VizAutoComplete.d.ts +23 -0
  86. package/dist/filters/VizDatePicker.d.ts +9 -0
  87. package/dist/filters/VizDateRangePicker.d.ts +14 -0
  88. package/dist/filters/VizSelect.d.ts +12 -0
  89. package/dist/filters/VizTextField.d.ts +8 -0
  90. package/dist/filters/VizTriggerButton.d.ts +9 -0
  91. package/dist/filters/filterFactory.d.ts +30 -0
  92. package/dist/filters/friendlyName.d.ts +4 -0
  93. package/dist/filters/index.d.ts +15 -0
  94. package/dist/filters.d.ts +2 -0
  95. package/dist/filters.js +15 -0
  96. package/dist/filters.js.map +1 -0
  97. package/dist/grid/BiErrorBoundary.d.ts +24 -0
  98. package/dist/grid/ChartContext.d.ts +14 -0
  99. package/dist/grid/GridCard.d.ts +45 -0
  100. package/dist/grid/GridCardPlaceHolder.d.ts +8 -0
  101. package/dist/grid/GridLayout.d.ts +147 -0
  102. package/dist/grid/gridModels.d.ts +33 -0
  103. package/dist/grid/index.d.ts +14 -0
  104. package/dist/grid/types.d.ts +23 -0
  105. package/dist/grid/useGridConfigTranslator.d.ts +72 -0
  106. package/dist/grid.d.ts +2 -0
  107. package/dist/grid.js +20 -0
  108. package/dist/grid.js.map +1 -0
  109. package/dist/hooks/DashboardParametersContext.d.ts +32 -0
  110. package/dist/hooks/index.d.ts +8 -0
  111. package/dist/hooks/useDashboardData.d.ts +20 -0
  112. package/dist/hooks/useDashboardLazyData.d.ts +79 -0
  113. package/dist/hooks.d.ts +2 -0
  114. package/dist/hooks.js +16 -0
  115. package/dist/hooks.js.map +1 -0
  116. package/dist/index-BYc79sSy.js +131 -0
  117. package/dist/index-BYc79sSy.js.map +1 -0
  118. package/dist/index-C6JQ6770.js +4545 -0
  119. package/dist/index-C6JQ6770.js.map +1 -0
  120. package/dist/index-CZbCaXMC.js +15 -0
  121. package/dist/index-CZbCaXMC.js.map +1 -0
  122. package/dist/index-D3OoOPjl.js +259 -0
  123. package/dist/index-D3OoOPjl.js.map +1 -0
  124. package/dist/index-D7Oo_dC-.js +94 -0
  125. package/dist/index-D7Oo_dC-.js.map +1 -0
  126. package/dist/index-D7tVPX8d.js +347 -0
  127. package/dist/index-D7tVPX8d.js.map +1 -0
  128. package/dist/index-DGyvUtY3.js +494 -0
  129. package/dist/index-DGyvUtY3.js.map +1 -0
  130. package/dist/index-DOpx0R4Y.js +41 -0
  131. package/dist/index-DOpx0R4Y.js.map +1 -0
  132. package/dist/index-wtSLspPh.js +1065 -0
  133. package/dist/index-wtSLspPh.js.map +1 -0
  134. package/dist/index.d.ts +12 -0
  135. package/dist/index.js +236 -0
  136. package/dist/index.js.map +1 -0
  137. package/dist/inline/Chart.d.ts +29 -0
  138. package/dist/inline/IFrame.d.ts +19 -0
  139. package/dist/inline/Metric.d.ts +16 -0
  140. package/dist/inline/MetricGroup.d.ts +11 -0
  141. package/dist/inline/index.d.ts +9 -0
  142. package/dist/inline/parseKnownNumbers.d.ts +11 -0
  143. package/dist/inline.d.ts +2 -0
  144. package/dist/inline.js +9 -0
  145. package/dist/inline.js.map +1 -0
  146. package/dist/runtime/IDashboardDefinition.d.ts +22 -0
  147. package/dist/runtime/biModuleSurface.d.ts +2 -0
  148. package/dist/runtime/createBiUiTools.d.ts +74 -0
  149. package/dist/runtime/index.d.ts +9 -0
  150. package/dist/runtime/loadDashboardBundle.d.ts +32 -0
  151. package/dist/runtime/registerBiModules.d.ts +36 -0
  152. package/dist/runtime/version.d.ts +6 -0
  153. package/dist/runtime.d.ts +2 -0
  154. package/dist/runtime.js +19 -0
  155. package/dist/runtime.js.map +1 -0
  156. package/dist/style.css +1 -0
  157. package/dist/theme/BiThemeBridge.d.ts +32 -0
  158. package/dist/theme/biPalette.d.ts +23 -0
  159. package/dist/theme/createBiTheme.d.ts +25 -0
  160. package/dist/theme/index.d.ts +5 -0
  161. package/dist/theme.d.ts +2 -0
  162. package/dist/theme.js +15 -0
  163. package/dist/theme.js.map +1 -0
  164. package/dist/version-DnqajORq.js +83 -0
  165. package/dist/version-DnqajORq.js.map +1 -0
  166. package/dist/viewer/ScriptDashboardViewer.d.ts +82 -0
  167. package/dist/viewer/ScriptDashboardViewerVertical.d.ts +24 -0
  168. package/dist/viewer/cardMetadata.d.ts +15 -0
  169. package/dist/viewer/index.d.ts +8 -0
  170. package/dist/viewer/models.d.ts +67 -0
  171. package/dist/viewer/useDashboardBundle.d.ts +73 -0
  172. package/dist/viewer.d.ts +2 -0
  173. package/dist/viewer.js +9 -0
  174. package/dist/viewer.js.map +1 -0
  175. package/package.json +196 -0
@@ -0,0 +1,34 @@
1
+ import { default as React } from 'react';
2
+ export interface DatasetOption {
3
+ /** The BigQuery dataset id (`BI_Acme`). */
4
+ dataSetId: string;
5
+ name: string;
6
+ isTemplate?: boolean;
7
+ }
8
+ export interface AgentOption {
9
+ id: string;
10
+ name: string;
11
+ }
12
+ export interface DatasetParameterizationControlsProps {
13
+ /** `'row'` packs the controls inline (the V1 header); `'column'` stacks them (the V2 rail). */
14
+ orientation?: 'row' | 'column';
15
+ /** Datasets the default-dataset picker offers (include the template dataset). */
16
+ datasets: DatasetOption[];
17
+ /** Dataset preselected when the toggle is switched on and none is stored yet. */
18
+ defaultTemplateDataset?: string;
19
+ /** Agents for the agent picker. Omit `agents` to hide the picker. */
20
+ agents?: AgentOption[];
21
+ /** The live agent id (the host's `agentContext.agentConfig.id`). */
22
+ agentId?: string;
23
+ /** Recommended agent while the host has not picked one — shown, never written. */
24
+ recommendedAgentId?: (isDatasetParameterized: boolean) => string | undefined;
25
+ onAgentChange?: (agent: AgentOption) => void;
26
+ }
27
+ /**
28
+ * The admin block: "DataSet Dinâmico" toggle (writes `isDatasetParameterized`
29
+ * / `defaultDatasetName` on the sketch), the default-dataset picker, and the
30
+ * agent picker (host state — the composer never chooses an agent itself).
31
+ * Render it only for admins; it does not check permissions.
32
+ */
33
+ export declare const DatasetParameterizationControls: React.FC<DatasetParameterizationControlsProps>;
34
+ export default DatasetParameterizationControls;
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ import { SketchedFilter } from '../models/sketchModels';
3
+ export interface FilterSketchProps {
4
+ filter: SketchedFilter;
5
+ onEdit: (filter: SketchedFilter) => void;
6
+ onDelete: (filterId: string) => void;
7
+ }
8
+ /** One sketched filter chip: icon, click-to-rename, mandatory / multi-select toggle, delete. */
9
+ export declare const FilterSketch: React.FC<FilterSketchProps>;
10
+ export default FilterSketch;
@@ -0,0 +1,12 @@
1
+ import { default as React } from 'react';
2
+ export interface HoverButtonProps {
3
+ onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
4
+ icon: React.ReactNode | (() => React.ReactNode);
5
+ /** Always show the label (instead of revealing it on hover). */
6
+ fixed?: boolean;
7
+ label: string;
8
+ maxWidth?: number;
9
+ }
10
+ /** Icon button whose label slides out on hover — the pad toolbar's action style. */
11
+ export declare const HoverButton: React.FC<HoverButtonProps>;
12
+ export default HoverButton;
@@ -0,0 +1,19 @@
1
+ import { default as React } from 'react';
2
+ export interface TitleSketchProps {
3
+ onEdit: (text: string) => void;
4
+ multiline?: boolean;
5
+ text: string;
6
+ placeHolderText: string;
7
+ /** Font size of the label / input (px). The V1 pad used 14.4 (0.9rem), the V2 rail 12. */
8
+ fontSize?: number;
9
+ }
10
+ /**
11
+ * Click-to-edit text (the dashboard name, the notes). Enter commits, Escape
12
+ * reverts, blur commits. Was `TitleSkath.tsx` / `TitleSkathV2.tsx`.
13
+ */
14
+ export declare const TitleSketch: React.FC<TitleSketchProps>;
15
+ /** @deprecated legacy spelling — use {@link TitleSketch}. */
16
+ export declare const TextSketh: React.FC<TitleSketchProps>;
17
+ /** @deprecated legacy spelling — use {@link TitleSketch}. */
18
+ export declare const TitleSkath: React.FC<TitleSketchProps>;
19
+ export default TitleSketch;
@@ -0,0 +1,11 @@
1
+ import { default as React } from 'react';
2
+ import { CardCategory, CardSpecificType, FilterType } from '../models/sketchModels';
3
+ export interface ToolBoxProps {
4
+ onAddGeneric: () => void;
5
+ onAddTyped: (category: CardCategory, specificType: CardSpecificType, label: string) => void;
6
+ /** When omitted the "Filtro" button is not rendered. */
7
+ onAddFilter?: (filterType: FilterType) => void;
8
+ }
9
+ /** The pad's toolbar: drag-to-add handle, "+ Card" (with a typed dropdown) and "Filtro". */
10
+ export declare const ToolBox: React.FC<ToolBoxProps>;
11
+ export default ToolBox;
@@ -0,0 +1,36 @@
1
+ import { default as React } from 'react';
2
+ import { BiClient } from '../../client';
3
+ import { DashboardEnvironment } from '../environment/types';
4
+ import { ComposerState, ComposerStoreApi, CreateComposerStoreOptions } from './createComposerStore';
5
+ export interface ComposerProviderProps extends Omit<CreateComposerStoreOptions, 'client'> {
6
+ /** Autosave client. Defaults to the ambient `BiClientProvider`; `null` disables autosave. */
7
+ client?: BiClient | null;
8
+ /** Bring your own store (tests, or sharing one composer across two mount points). */
9
+ store?: ComposerStoreApi;
10
+ children: React.ReactNode;
11
+ }
12
+ /**
13
+ * Owns one composer store. Everything under it — `ComposerView`,
14
+ * `DashboardPad`, `useComposer()`, `useComposerEnvironment()` — reads that
15
+ * store; a second `ComposerProvider` elsewhere on the page is fully independent.
16
+ */
17
+ export declare const ComposerProvider: React.FC<ComposerProviderProps>;
18
+ /** The store API (`getState()` / `setState()` / `subscribe()`) — for handlers that must read the latest state without subscribing. */
19
+ export declare function useComposerStore(): ComposerStoreApi;
20
+ /** Same as {@link useComposerStore} but `null` instead of throwing. */
21
+ export declare function useComposerStoreOptional(): ComposerStoreApi | null;
22
+ /**
23
+ * Subscribe to the ambient composer store. Select a primitive whenever you
24
+ * can: the live definition is re-allocated on every agent partial.
25
+ */
26
+ export declare function useComposer(): ComposerState;
27
+ export declare function useComposer<T>(selector: (state: ComposerState) => T): T;
28
+ /**
29
+ * The `DashboardEnvironment` bound to this composer — pass it to the chat
30
+ * library's `EnvironmentProvider` and to `createBiUiTools({ environment })`.
31
+ * Shallow-stable: the actions are store methods, so the object only changes
32
+ * when the store does.
33
+ */
34
+ export declare function useComposerEnvironment(): DashboardEnvironment;
35
+ /** Build the environment object from a store outside React (tests, the bridge). */
36
+ export declare function environmentFromStore(api: ComposerStoreApi): DashboardEnvironment;
@@ -0,0 +1,107 @@
1
+ import { StoreApi } from 'zustand/vanilla';
2
+ import { TodoItem } from '@aintela/chat/models';
3
+ import { BiClient } from '../../client';
4
+ import { ComposerDashboard, SimplePadDefinition } from '../models/sketchModels';
5
+ import { CloneComponentOptions, CloneComponentResult, EnvironmentTarget, GuideOptions, GuideStep, HighlightOptions } from '../environment/types';
6
+ /**
7
+ * How long the viewer waits after the most-recent sketch edit before
8
+ * catching up to the live state. Generous by design — a sketch drag /
9
+ * resize / rename must not cascade into the heavy dashboard viewer.
10
+ */
11
+ export declare const VIEWER_COMMIT_DEBOUNCE_MS = 3000;
12
+ /** Autosave debounce after the last `updateDashboard`. */
13
+ export declare const DRAFT_SAVE_DEBOUNCE_MS = 800;
14
+ /** `showGuide` publishes its steps after this delay so the DOM can settle first. */
15
+ export declare const GUIDE_SHOW_DELAY_MS = 500;
16
+ export type ComposerViewType = 'Sketch' | 'Generated';
17
+ export interface ComposerViewport {
18
+ width: number;
19
+ height: number;
20
+ }
21
+ export interface ComposerState {
22
+ /** The live sketch the pad edits. */
23
+ dashboardDefinition: ComposerDashboard | null;
24
+ /**
25
+ * "Published" snapshot read-only surfaces (the side panel's viewer)
26
+ * render from. Advances on a debounced timer after edits (skipped while
27
+ * a turn is open), immediately on `commitForSend()`, and at hydration /
28
+ * agent boundaries.
29
+ */
30
+ publishedDashboard: ComposerDashboard | null;
31
+ /** Snapshot at the last real send — the "queued changes" chip diffs against it. */
32
+ lastSentDashboard: ComposerDashboard | null;
33
+ dashboardId: string | null;
34
+ viewType: ComposerViewType;
35
+ scriptLoadOnMount: boolean;
36
+ /** Bumped when the bundle CODE changes (generated / loaded / refreshed) — the viewer's `codeGeneration`. */
37
+ renderGeneration: number;
38
+ turnOpen: boolean;
39
+ currentSessionId: string | null;
40
+ /** Bumped on viewer commits, refreshes and agent updates — the viewer's `llmRenderCount`. */
41
+ llmCounter: number;
42
+ /** Bumped ONLY when the agent touched the sketch (`updateDashboardPad`, `dashboardGenerated`). */
43
+ agentPulseTick: number;
44
+ todosByCardKey: Record<string, {
45
+ todo: TodoItem;
46
+ turnOpen: boolean;
47
+ }>;
48
+ sketchExpanded: boolean;
49
+ hasCompletedOnce: boolean;
50
+ producedDashboardId: string | null;
51
+ viewport: ComposerViewport;
52
+ guideSteps: GuideStep[] | null;
53
+ guideOptions: GuideOptions | null;
54
+ _client: BiClient | null;
55
+ _draftSaveTimer: ReturnType<typeof setTimeout> | null;
56
+ _draftSavePromise: Promise<void> | null;
57
+ _viewerCommitTimer: ReturnType<typeof setTimeout> | null;
58
+ _guideShowTimer: ReturnType<typeof setTimeout> | null;
59
+ setClient: (client: BiClient | null) => void;
60
+ flushDraft: () => Promise<void>;
61
+ /** Agent tool events (`dashboardGenerated`, `todolistUpdated`) — the chat bridge forwards them here. */
62
+ ingestToolEvent: (eventName: string, eventData: string) => void;
63
+ setTurnOpen: (open: boolean) => void;
64
+ onTurnOpened: () => void;
65
+ onTurnClosed: () => void;
66
+ setDashboardId: (id: string | null) => void;
67
+ setCurrentSessionId: (sessionId: string | null) => void;
68
+ setViewType: (v: ComposerViewType) => void;
69
+ /** Merge `fields` into the live sketch; `undefined` wipes it (and both snapshots). */
70
+ updateDashboard: (fields?: Partial<ComposerDashboard>) => void;
71
+ loadDashboard: (dashboard: ComposerDashboard) => void;
72
+ /** One entry into the per-turn `clientSideChanges` hint (last write per key wins). Does not trigger a save. */
73
+ recordSketchChange: (key: string, text: string) => void;
74
+ clearClientSideChanges: () => void;
75
+ /** The user is sending: both snapshots advance, the pending viewer commit is cancelled. */
76
+ commitForSend: () => void;
77
+ /** A layout edit made inside the preview viewer: align `publishedDashboard` now, keep `lastSentDashboard`. */
78
+ commitDashboardLayout: () => void;
79
+ setSketchExpanded: (next: boolean | ((prev: boolean) => boolean)) => void;
80
+ setHasCompletedOnce: (next: boolean) => void;
81
+ setProducedDashboardId: (id: string | null) => void;
82
+ setViewport: (viewport: ComposerViewport) => void;
83
+ highlightComponent: (target: EnvironmentTarget, options?: HighlightOptions) => number;
84
+ cloneComponent: (target: EnvironmentTarget, options?: CloneComponentOptions) => CloneComponentResult | null;
85
+ createDashboardPad: (dashboard: ComposerDashboard | SimplePadDefinition) => void;
86
+ updateDashboardPad: (dashboard: ComposerDashboard | SimplePadDefinition) => void;
87
+ refreshDashboard: () => void;
88
+ showGuide: (steps: GuideStep[], options?: GuideOptions) => void;
89
+ dismissGuide: () => void;
90
+ /** Reset for a (possibly different) dashboard, or to an empty composer. */
91
+ openComposer: (dashboard?: ComposerDashboard) => void;
92
+ }
93
+ export type ComposerStoreApi = StoreApi<ComposerState>;
94
+ export interface CreateComposerStoreOptions {
95
+ /** Autosave transport. `null` disables the debounced draft save (the pad still works). */
96
+ client?: BiClient | null;
97
+ viewerCommitDebounceMs?: number;
98
+ draftSaveDebounceMs?: number;
99
+ /** Called when the autosave POST fails (default: `console.warn`). */
100
+ onDraftSaveError?: (error: unknown) => void;
101
+ }
102
+ /**
103
+ * One composer = one store. `ComposerProvider` calls this per instance;
104
+ * nothing here is module-level, so two composers on one page (or two tests)
105
+ * never share state.
106
+ */
107
+ export declare function createComposerStore(options?: CreateComposerStoreOptions): ComposerStoreApi;
@@ -0,0 +1,20 @@
1
+ import { BiClient } from '../../client';
2
+ import { ComposerDashboard, SketchCardItem, SketchedFilter } from '../models/sketchModels';
3
+ /**
4
+ * The upsert body the server expects: document metadata at the top level,
5
+ * the editable part under `draft`. `clientSideChanges` is the transient
6
+ * per-turn hint and never leaves the client.
7
+ */
8
+ export declare function toDraftPayload(dashboard: ComposerDashboard): Record<string, unknown>;
9
+ /** Flattens the server's `{ ...metadata, draft | committed }` document back into a `ComposerDashboard`. */
10
+ export declare function fromUpsertResponse(resp: unknown): ComposerDashboard;
11
+ /** POST the draft; resolves to the server's flattened document. */
12
+ export declare function upsertDashboardDraft(client: BiClient, dashboard: ComposerDashboard): Promise<ComposerDashboard>;
13
+ export interface DraftSeed {
14
+ name?: string;
15
+ cards?: SketchCardItem[];
16
+ filters?: SketchedFilter[];
17
+ layoutType?: 'Naked' | 'Boxed';
18
+ }
19
+ /** A fresh server-side draft bound to `sessionId` (the `originalSessionId` autosave needs). */
20
+ export declare function createDashboardDraft(client: BiClient, sessionId: string, seed?: DraftSeed & Partial<ComposerDashboard>): Promise<ComposerDashboard>;
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ /**
3
+ * Optional glue, mounted INSIDE the host's `AiChatProvider`: mirrors the live
4
+ * chat session id into the composer store and forwards the gateway's tool
5
+ * events (`dashboardGenerated`, `todolistUpdated`). A host that prefers to
6
+ * wire these itself uses `useComposerChatBridge().setSessionId` /
7
+ * `.ingestToolEvent` instead.
8
+ */
9
+ export declare const ComposerChatBinding: React.FC;
10
+ export default ComposerChatBinding;
@@ -0,0 +1,49 @@
1
+ import { default as React } from 'react';
2
+ import { EnvironmentTarget } from '../environment/types';
3
+ import { RecentSessionItem } from './composerTypes';
4
+ import { ComposerSuggestion } from './data/suggestions';
5
+ import { ComposerTemplate } from './data/templates';
6
+ export interface ComposerProgressPanelArgs {
7
+ hasDashboard: boolean;
8
+ dashboardCollapsed: boolean;
9
+ turnOpen: boolean;
10
+ }
11
+ export interface ComposerViewProps {
12
+ /** The live chat session id (the host's AiChat store). `null` until the handshake binds one. */
13
+ sessionId?: string | null;
14
+ /** The session in the route (`/composer/:sessionId`) — hydrates the dashboard bound to it and skips the splash. */
15
+ routeSessionId?: string;
16
+ /** The transcript — the host renders `<AiChatV2Pane hideHeader />` (or its own). */
17
+ chatPane: React.ReactNode;
18
+ /** The right-hand activity panel (`RunProgressPanelV2`), sized by the host from the args. */
19
+ renderProgressPanel?: (args: ComposerProgressPanelArgs) => React.ReactNode;
20
+ /** Rendered under the prompt on the splash (`RunProgressStripV2`). */
21
+ progressStrip?: React.ReactNode;
22
+ /** Runs before every send, after the view ensured a server draft exists. */
23
+ onBeforeSend?: (text: string) => void | Promise<void>;
24
+ /** Spotlight target resolver (default: first visible `data-env-*` / selector match). */
25
+ resolveGuideElement?: (target: EnvironmentTarget) => HTMLElement | null;
26
+ suggestions?: readonly ComposerSuggestion[];
27
+ templates?: readonly ComposerTemplate[];
28
+ /** Recent sessions for the splash. When omitted (and a client is in scope) the view lists dashboards itself. */
29
+ recentSessions?: RecentSessionItem[];
30
+ onSelectSession?: (sessionId: string) => void;
31
+ onSearchAllSessions?: () => void;
32
+ /** The sketch's name (or `null` when there is none) — for a breadcrumb. */
33
+ onDashboardNameChange?: (name: string | null) => void;
34
+ /** The admin dataset / agent block in the rail (`<DatasetParameterizationControls orientation="column" …/>`). */
35
+ datasetControls?: React.ReactNode;
36
+ /** Card description renderer (Markdown in the legacy app). */
37
+ renderDescription?: (text: string) => React.ReactNode;
38
+ /** Side panel width when expanded (default `'70%'`). */
39
+ sidePanelWidth?: string;
40
+ /** Chat column width when a dashboard is showing (default `'80%'`). */
41
+ chatColumnWidthWithDashboard?: string;
42
+ }
43
+ /**
44
+ * The composer screen. Mount it under `ComposerProvider`, `BiClientProvider`
45
+ * (for drafts) and the host's `AiChatProvider` + `EnvironmentProvider`; the
46
+ * host wires `useComposerChatBridge()` into that provider.
47
+ */
48
+ export declare const ComposerView: React.FC<ComposerViewProps>;
49
+ export default ComposerView;
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ export declare const DashboardPin: React.NamedExoticComponent<{}>;
3
+ export default DashboardPin;
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ export interface DashboardSidePanelProps {
3
+ /** Share of the execution layout when expanded (`'70%'`). */
4
+ width: string;
5
+ defaultCollapsed?: boolean;
6
+ onCollapseChange?: (collapsed: boolean) => void;
7
+ }
8
+ /** memo — the panel reads its own store fields, so parent re-renders must not re-mount the heavy viewer. */
9
+ export declare const DashboardSidePanel: React.NamedExoticComponent<DashboardSidePanelProps>;
10
+ export default DashboardSidePanel;
@@ -0,0 +1,22 @@
1
+ import { default as React } from 'react';
2
+ export interface DrawablePromptProps {
3
+ /** The "+ Adicionar sketch" CTA — the view creates a server draft. */
4
+ onCreateSketch?: () => void;
5
+ zoomLevel: number;
6
+ /** Runs before `PromptV2` sends (the view ensures a draft exists). */
7
+ onBeforeSend?: (text: string) => void | Promise<void>;
8
+ /** Controlled expand / collapse. */
9
+ sketchExpanded?: boolean;
10
+ onSketchExpandedChange?: (next: boolean) => void;
11
+ /** Fills the textarea (no auto-send). */
12
+ seedDraft?: string | null;
13
+ /** Compact textarea (execution layout). */
14
+ compact?: boolean;
15
+ bottomSlot?: React.ReactNode;
16
+ /** Rendered at the bottom of the rail (the admin dataset / agent block). */
17
+ datasetControls?: React.ReactNode;
18
+ renderDescription?: (text: string) => React.ReactNode;
19
+ }
20
+ /** The composer's prompt: `PromptV2` with the sketch pad riding in its `topSlot`. Needs `ComposerProvider` and the host's `AiChatProvider`. */
21
+ export declare const DrawablePrompt: React.MemoExoticComponent<React.ForwardRefExoticComponent<DrawablePromptProps & React.RefAttributes<HTMLDivElement>>>;
22
+ export default DrawablePrompt;
@@ -0,0 +1,22 @@
1
+ import { default as React } from 'react';
2
+ import { ComposerSuggestion } from './data/suggestions';
3
+ import { ComposerTemplate } from './data/templates';
4
+ import { RecentSessionItem } from './composerTypes';
5
+ export interface EntryEmptyStateProps {
6
+ /** A suggestion click drops its `prompt` here (no auto-send). */
7
+ onDraftPromptChange: (next: string) => void;
8
+ onApplyTemplate: (template: ComposerTemplate) => void;
9
+ /** The prompt node (the parent wraps it in a `motion.div` with the shared `layoutId`). */
10
+ composerSlot: React.ReactNode;
11
+ /** Wrapper for the ambient blocks (hero / suggestions / templates) — the morph injects motion variants here. */
12
+ ambientWrapper?: (children: React.ReactNode, key: string) => React.ReactNode;
13
+ recentSessions?: RecentSessionItem[];
14
+ onSelectSession?: (sessionId: string) => void;
15
+ /** "Buscar todas as sessões" — the host opens its own search. Hidden when omitted. */
16
+ onSearchAllSessions?: () => void;
17
+ suggestions?: readonly ComposerSuggestion[];
18
+ templates?: readonly ComposerTemplate[];
19
+ }
20
+ /** The composer's splash: hero, the prompt, suggestions + recent sessions, starter templates. */
21
+ export declare const EntryEmptyState: React.FC<EntryEmptyStateProps>;
22
+ export default EntryEmptyState;
@@ -0,0 +1,21 @@
1
+ import { default as React } from 'react';
2
+ import { GuideStep } from '../environment/types';
3
+ export interface SpotlightOverlayProps {
4
+ steps: GuideStep[];
5
+ /** Backdrop opacity (default 0.6). */
6
+ overlayOpacity?: number;
7
+ /** Let clicks through the backdrop to the page. */
8
+ allowInteraction?: boolean;
9
+ onComplete?: () => void;
10
+ onDismiss: () => void;
11
+ /** Target → element. Defaults to the package resolver (first visible `data-env-*` / selector match). */
12
+ resolveElement?: (target: GuideStep['target']) => HTMLElement | null;
13
+ }
14
+ /**
15
+ * The guided tour `env.showGuide()` drives: a dimmed backdrop with a
16
+ * cut-out around the current target, an accent ring, and a tooltip with
17
+ * Anterior / Próximo / Concluir. → / Enter advance, ← retreats, Esc closes.
18
+ * A target that never resolves within 3 s is skipped (logged), not fatal.
19
+ */
20
+ export declare const SpotlightOverlay: React.FC<SpotlightOverlayProps>;
21
+ export default SpotlightOverlay;
@@ -0,0 +1,11 @@
1
+ import { Transition, Variants } from 'framer-motion';
2
+ /** Hero + suggestions + templates fade. Storyboard 0–180 ms. */
3
+ export declare const ambientVariants: Variants;
4
+ /** Right-side activity panel slide-in. Storyboard 220–320 ms. */
5
+ export declare const activityPanelVariants: Variants;
6
+ /** The shared-`layoutId` morph of the prompt between the centred and the docked position. Storyboard 0–280 ms. */
7
+ export declare const composerLayoutTransition: Transition;
8
+ /** Reduced-motion fallbacks — flat 150 ms cross-fades, no transforms. */
9
+ export declare const ambientVariantsReduced: Variants;
10
+ export declare const activityPanelVariantsReduced: Variants;
11
+ export declare const composerLayoutTransitionReduced: Transition;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Visible state of `ComposerView`.
3
+ *
4
+ * - `'empty'` Nothing submitted yet: hero + suggestions + templates
5
+ * around the centred prompt (the pad is available).
6
+ * - `'generating'` A turn is open: prompt docked, transcript + progress visible.
7
+ * - `'done-text'` The agent finished without producing a dashboard.
8
+ * - `'done-dashboard'` The agent finished and produced a dashboard (side panel shows it).
9
+ */
10
+ export type ComposerMode = 'empty' | 'generating' | 'done-text' | 'done-dashboard';
11
+ export interface RecentSessionItem {
12
+ /** Chat session that produced the dashboard — what `onSelectSession` receives. */
13
+ sessionId: string;
14
+ name: string;
15
+ cardCount: number;
16
+ /** Epoch ms. */
17
+ updatedAt?: number;
18
+ }
@@ -0,0 +1,10 @@
1
+ /** One splash suggestion: the short label shown, and the fuller prompt a click drops into the textarea. */
2
+ export interface ComposerSuggestion {
3
+ label: string;
4
+ prompt: string;
5
+ }
6
+ /**
7
+ * The product's default suggestions (Portuguese, travel BI). Pass your own
8
+ * through `ComposerView.suggestions` / `EntryEmptyState.suggestions`.
9
+ */
10
+ export declare const defaultComposerSuggestions: readonly ComposerSuggestion[];
@@ -0,0 +1,33 @@
1
+ import { CardCategory, CardSpecificType, SketchCardItem } from '../../models/sketchModels';
2
+ export type TemplateCardKind = 'kpi' | 'line' | 'bars' | 'table' | 'donut' | 'heatmap';
3
+ /** Template card kind → the sketch's category / specific type. */
4
+ export declare const TEMPLATE_KIND_TO_SKETCH: Record<TemplateCardKind, {
5
+ category: CardCategory;
6
+ specificType: CardSpecificType;
7
+ }>;
8
+ /** One template cell; `x/y/w/h` are 12-column grid units, as the pad uses them. */
9
+ export interface TemplateCellSeed {
10
+ name: string;
11
+ kind: TemplateCardKind;
12
+ description: string;
13
+ x: number;
14
+ y: number;
15
+ w: number;
16
+ h: number;
17
+ }
18
+ export interface ComposerTemplate {
19
+ id: string;
20
+ name: string;
21
+ desc: string;
22
+ /** Highlighted as the recommended pick. */
23
+ recommended?: boolean;
24
+ /** Empty → "start blank": no draft is created, the layout just switches to execution mode. */
25
+ cells: TemplateCellSeed[];
26
+ }
27
+ export declare function templateKinds(t: ComposerTemplate): TemplateCardKind[];
28
+ /** Convert a template into ready-to-store `SketchCardItem`s. */
29
+ export declare function seedFromTemplate(template: ComposerTemplate, idPrefix?: string): SketchCardItem[];
30
+ /** The product's default starter templates (Portuguese). Replace through `ComposerView.templates`. */
31
+ export declare const defaultComposerTemplates: readonly ComposerTemplate[];
32
+ /** @deprecated legacy name — use {@link defaultComposerTemplates}. */
33
+ export declare const STARTER_TEMPLATES: readonly ComposerTemplate[];
@@ -0,0 +1,19 @@
1
+ import { Theme } from '@mui/material/styles';
2
+ /** The few extra surface tokens the composer chrome uses beyond MUI's standard palette. */
3
+ export interface ComposerSurfaces {
4
+ /** Raised chip / popover surface. */
5
+ raised: string;
6
+ /** Hover wash. */
7
+ hover: string;
8
+ /** Soft border between rail sections. */
9
+ borderSoft: string;
10
+ /** Monospace family for counters. */
11
+ fontFamilyMono: string;
12
+ }
13
+ /**
14
+ * Reads the chat library's v2 theme extension (`palette.surface`,
15
+ * `palette.border`, `typography.fontFamilyMono`) when the host theme
16
+ * carries it, and falls back to standard MUI tokens when it does not — so
17
+ * the composer renders the same under a plain `createTheme()`.
18
+ */
19
+ export declare function resolveComposerSurfaces(theme: Theme): ComposerSurfaces;
@@ -0,0 +1,43 @@
1
+ import { DashboardEnvironment } from '../environment/types';
2
+ /** Same constants the pad uses to project sketch w/h to pixels for the agent. */
3
+ export declare const GRID_ROW_HEIGHT_PX = 20;
4
+ /** The subset of the chat library's `Interaction` the bridge reads — structurally compatible with the real one. */
5
+ export interface TurnCompleteInfo {
6
+ artifactData?: ReadonlyArray<{
7
+ type?: string;
8
+ id?: string;
9
+ } | null | undefined>;
10
+ }
11
+ export interface ComposerPromptEnvelope {
12
+ /** What the transcript shows for the user's message. */
13
+ promptAsString: string;
14
+ /** The JSON the agent receives (`PromptDashboardContainer`). */
15
+ json: string;
16
+ }
17
+ export interface ComposerChatBridge {
18
+ /** `AiChatProvider.onRenderPrompt` — wraps the text in the dashboard envelope and drains `clientSideChanges`. */
19
+ onRenderPrompt: (prompt: string) => ComposerPromptEnvelope;
20
+ /** `AiChatProvider.onTurnOpen`. */
21
+ onTurnOpen: () => void;
22
+ /** `AiChatProvider.onTurnComplete`. */
23
+ onTurnComplete: (interaction: TurnCompleteInfo) => void;
24
+ /** Agent tool events (`eventBusService.gatewayOnToolEvent`). */
25
+ ingestToolEvent: (eventName: string, eventData: string) => void;
26
+ /** The live chat session id — call when the host's AiChat session binds / changes. */
27
+ setSessionId: (sessionId: string | null) => void;
28
+ /** For `EnvironmentProvider value={…}` and `createBiUiTools({ environment })`. */
29
+ environment: DashboardEnvironment;
30
+ }
31
+ /**
32
+ * Everything the host wires between its `AiChatProvider` and the composer
33
+ * store. The composer never mounts the chat itself; the host does, and
34
+ * passes these handlers:
35
+ *
36
+ * const bridge = useComposerChatBridge();
37
+ * <AiChatProvider onRenderPrompt={bridge.onRenderPrompt} onTurnOpen={bridge.onTurnOpen}
38
+ * onTurnComplete={bridge.onTurnComplete} uiTools={uiTools} hidePromptInput …>
39
+ * <EnvironmentProvider value={bridge.environment}>
40
+ * <ComposerChatBinding /> {/* or wire sessionId + tool events by hand *\/}
41
+ * <ComposerView … />
42
+ */
43
+ export declare function useComposerChatBridge(): ComposerChatBridge;
@@ -0,0 +1,2 @@
1
+ export * from './composer/index'
2
+ export {}
@@ -0,0 +1,99 @@
1
+ import { C as e, a as t, c as o, d as r, e as n, f as i, g as d, h as C, i as E, j as m, D as S, k as p, l, m as T, n as _, o as P, p as c, q as I, r as D, E as h, s as u, t as A, u as v, v as R, w as O, F as k, x as g, y as L, G as y, z as N, H as b, P as f, A as F, B as G, S as H, I as M, J as V, M as x, T as B, N as Y, O as U, Q as w, R as z, V as K, U as W, W as q, X as J, Y as X, Z as j, _ as Q, $ as Z, a1 as $, a2 as aa, a3 as sa, a4 as ea, a5 as ta, a6 as oa, a7 as ra, a8 as na, a9 as ia, aa as da, ac as Ca, ag as Ea, ah as ma, ak as Sa, al as pa, am as la, ao as Ta, ap as _a, aq as Pa, as as ca, at as Ia, au as Da, av as ha, aw as ua, ay as Aa, az as va, aA as Ra, aB as Oa, aC as ka, aD as ga, aE as La, aF as ya, aG as Na, aH as ba, aI as fa, aJ as Fa, aK as Ga, aM as Ha, aN as Ma } from "./index-C6JQ6770.js";
2
+ import { EnvironmentProvider as xa, InertEnvironmentProvider as Ba, useEnvironment as Ya, useEnvironmentOptional as Ua } from "@aintela/chat/components";
3
+ export {
4
+ e as CARD_TYPE_CATALOG,
5
+ t as CATEGORY_ICONS,
6
+ o as COLOR_MAP,
7
+ r as CardScketch,
8
+ n as CardSketch,
9
+ i as CardTypeIconsProvider,
10
+ d as ClonedComponent,
11
+ C as ComposerChatBinding,
12
+ E as ComposerProvider,
13
+ m as ComposerView,
14
+ S as DEFAULT_PAD_HEIGHT_PX,
15
+ p as DRAFT_SAVE_DEBOUNCE_MS,
16
+ l as DashboardPad,
17
+ T as DashboardPadEditor,
18
+ _ as DashboardPadSketch,
19
+ P as DashboardPin,
20
+ c as DashboardSidePanel,
21
+ I as DatasetParameterizationControls,
22
+ D as DrawablePrompt,
23
+ h as ENV_HIGHLIGHT_CLASS,
24
+ u as EntryEmptyState,
25
+ xa as EnvironmentProvider,
26
+ A as ExampleCardSkath,
27
+ v as ExampleCardSketch,
28
+ R as ExampleCardSketh,
29
+ O as ExamplePad,
30
+ k as FILTER_TYPE_CATALOG,
31
+ g as FILTER_TYPE_ICONS,
32
+ L as FilterSketch,
33
+ y as GRID_ROW_HEIGHT_PX,
34
+ N as GUIDE_SHOW_DELAY_MS,
35
+ b as HoverButton,
36
+ Ba as InertEnvironmentProvider,
37
+ f as PAD_INTERNAL_CLASSES,
38
+ F as PAD_INTERNAL_IDS,
39
+ G as PrototypePad,
40
+ H as SPECIFIC_TYPE_ICONS,
41
+ M as SPECIFIC_TYPE_ICON_NAMES,
42
+ V as STARTER_TEMPLATES,
43
+ x as SpotlightOverlay,
44
+ B as TEMPLATE_KIND_TO_SKETCH,
45
+ Y as TextSketh,
46
+ U as TitleSkath,
47
+ w as TitleSketch,
48
+ z as ToolBox,
49
+ K as VIEWER_COMMIT_DEBOUNCE_MS,
50
+ W as activityPanelVariants,
51
+ q as activityPanelVariantsReduced,
52
+ J as ambientVariants,
53
+ X as ambientVariantsReduced,
54
+ j as autoComplete,
55
+ Q as c,
56
+ Z as categoryPrefix,
57
+ $ as composerLayoutTransition,
58
+ aa as composerLayoutTransitionReduced,
59
+ sa as createComposerStore,
60
+ ea as createDashboardDraft,
61
+ ta as datePicker,
62
+ oa as dateRange,
63
+ ra as defaultCardTypeIcons,
64
+ na as defaultComposerSuggestions,
65
+ ia as defaultComposerTemplates,
66
+ da as environmentFromStore,
67
+ Ca as fromUpsertResponse,
68
+ Ea as groupCardCatalog,
69
+ ma as guideStepsRequireSketch,
70
+ Sa as isElementVisible,
71
+ pa as isSimplePadDefinition,
72
+ la as joinClientSideChanges,
73
+ Ta as padConfigToDashboard,
74
+ _a as pickBestElement,
75
+ Pa as randomId,
76
+ ca as resolveComposerSurfaces,
77
+ Ia as resolveEnvironmentElements,
78
+ Da as resolveGuideElement,
79
+ ha as sanitizeToJsVariable,
80
+ ua as seedFromTemplate,
81
+ Aa as sketchCardItemComparer,
82
+ va as sketchFilterComparer,
83
+ Ra as targetSuggestsPadInternal,
84
+ Oa as templateKinds,
85
+ ka as toDraftPayload,
86
+ ga as toSelectorList,
87
+ La as upsertDashboardDraft,
88
+ ya as useCardTypeIcons,
89
+ Na as useComposer,
90
+ ba as useComposerChatBridge,
91
+ fa as useComposerEnvironment,
92
+ Fa as useComposerStore,
93
+ Ga as useComposerStoreOptional,
94
+ Ha as useDashboardPad,
95
+ Ya as useEnvironment,
96
+ Ua as useEnvironmentOptional,
97
+ Ma as validateSketch
98
+ };
99
+ //# sourceMappingURL=composer.js.map