@epam/statgpt-conversation-view 0.7.0-dev.8 → 0.7.0-dev.9

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 (38) hide show
  1. package/components/AdvancedView/Filters/FiltersModal/filter-settings-controller.d.ts +47 -0
  2. package/components/AdvancedView/Filters/hooks/use-filter-apply.d.ts +36 -0
  3. package/components/AdvancedView/Filters/hooks/use-filter-constraints.d.ts +59 -0
  4. package/components/AdvancedView/Filters/hooks/use-filter-initialization.d.ts +40 -0
  5. package/components/AdvancedView/Filters/hooks/use-filter-modal-state.d.ts +49 -0
  6. package/components/AdvancedView/Filters/hooks/use-filter-system-message.d.ts +35 -0
  7. package/components/AdvancedView/Filters/hooks/use-filter-values-loading.d.ts +5 -0
  8. package/components/AdvancedView/Filters/hooks/use-filters.d.ts +49 -0
  9. package/components/AdvancedView/Filters/hooks/use-single-dataset-filters.d.ts +7 -0
  10. package/components/AdvancedView/Filters/hooks/use-single-filter-strategy.d.ts +22 -0
  11. package/components/AdvancedView/MultiDatasetFilters/hooks/use-multi-dataset-display-data-queries.d.ts +3 -0
  12. package/components/AdvancedView/MultiDatasetFilters/hooks/use-multi-dataset-filters.d.ts +7 -0
  13. package/components/AdvancedView/MultiDatasetFilters/hooks/use-multi-filter-strategy.d.ts +27 -0
  14. package/components/Attachments/GridCellRenderers/helpers/get-observation-metadata-content.d.ts +2 -2
  15. package/components/Attachments/useViewModeScrollAnchor.d.ts +27 -0
  16. package/components/ConversationView/hooks/use-conversation-lifecycle.d.ts +20 -0
  17. package/components/ConversationView/hooks/use-conversation-loader.d.ts +24 -0
  18. package/components/ConversationView/hooks/use-conversation-saver.d.ts +13 -0
  19. package/components/ConversationView/hooks/use-conversation-streaming.d.ts +35 -0
  20. package/components/ConversationView/hooks/use-conversation-view.d.ts +43 -0
  21. package/components/ConversationView/hooks/use-message-feedback.d.ts +19 -0
  22. package/components/ConversationView/hooks/use-message-mutations.d.ts +17 -0
  23. package/components/ConversationView/hooks/use-onboarding-sync.d.ts +11 -0
  24. package/components/ConversationView/types.d.ts +45 -0
  25. package/constants/grid.d.ts +3 -0
  26. package/index.d.ts +12 -1
  27. package/index.js +9 -11
  28. package/index.mjs +10664 -19287
  29. package/models/attachments-styles.d.ts +1 -1
  30. package/models/filters.d.ts +1 -0
  31. package/package.json +20 -21
  32. package/utils/attachments/charting/cross-dataset-chart-data.d.ts +14 -0
  33. package/utils/attachments/cross-dataset-grid/build-cross-dataset-grid-attachment.d.ts +19 -0
  34. package/utils/attachments/python-attachment.d.ts +11 -1
  35. package/utils/attachments/replace-python-attachment.d.ts +4 -1
  36. package/utils/query-filters.d.ts +11 -1
  37. package/utils/single-dataset-filters.d.ts +24 -0
  38. package/LICENSE +0 -21
@@ -0,0 +1,47 @@
1
+ import { DataConstraints, Hierarchy, StructuralData } from '../../../../../../sdmx-toolkit/src/index';
2
+ import { DataQuery, TimeRangeOptions } from '../../../../../../shared-toolkit/src/index';
3
+ import { Dispatch, ReactNode, SetStateAction } from 'react';
4
+ import { Filter, FiltersModalProps, HierarchyState } from '../../../../models/filters';
5
+ export interface FilterSettingsState {
6
+ filtersList: Filter[];
7
+ selectedFilter?: Filter;
8
+ isDisableValues?: boolean;
9
+ isValuesLoading?: boolean;
10
+ selectedTimeOption?: string | number;
11
+ disabledDatasetUrns: Set<string>;
12
+ timeSeriesCount?: string;
13
+ }
14
+ export interface FilterSettingsOptions {
15
+ locale?: string;
16
+ timeRangeOptions?: TimeRangeOptions[];
17
+ modalProps?: FiltersModalProps;
18
+ initialConstraints?: DataConstraints[];
19
+ initialConstraintsMap?: Map<string, DataConstraints[] | undefined>;
20
+ datasetIcon?: ReactNode;
21
+ structuresMap?: Map<string, StructuralData | undefined>;
22
+ dataQueries?: DataQuery[];
23
+ }
24
+ export interface FilterSettingsHandlers {
25
+ setSelectedFilter: Dispatch<SetStateAction<Filter | undefined>>;
26
+ onSelectDisplayMode: (filter?: Filter, displayMode?: string) => void;
27
+ onDeleteFilter?: (filter?: Filter) => void;
28
+ onClearAllFilters?: () => void;
29
+ updateSelectedFilterValues?: (filter?: Filter) => void;
30
+ onTimePeriodChange?: (value: string | number) => void;
31
+ onToggleDataset: (urn: string, enabled: boolean) => void;
32
+ onClearAllDatasets: () => void;
33
+ }
34
+ export interface FilterSettingsHierarchy {
35
+ hierarchyStateMap?: Map<string, HierarchyState>;
36
+ onSelectHierarchy?: (filter?: Filter, hierarchy?: Hierarchy | null) => void;
37
+ onExpandHierarchyNode?: (filterKey: string, nodeId: string) => void;
38
+ }
39
+ /**
40
+ * The single structured prop the orchestration passes to `FilterSettings`.
41
+ */
42
+ export interface FilterSettingsController {
43
+ state: FilterSettingsState;
44
+ options: FilterSettingsOptions;
45
+ handlers: FilterSettingsHandlers;
46
+ hierarchy: FilterSettingsHierarchy;
47
+ }
@@ -0,0 +1,36 @@
1
+ import { Filter } from '../../../../models/filters';
2
+ /** Filters passed to the system message: flat (single) or per-dataset (multi). */
3
+ export type SystemMessageFilters = Filter[] | Map<string, Filter[]>;
4
+ /**
5
+ * Mode-specific apply behavior injected into the shared {@link useFilterApply}
6
+ * skeleton. `runApply` performs the mode's `onFiltersChange` side effect and
7
+ * returns the next applied filters plus the filters to persist on the system
8
+ * message; `getIsFiltersUnchanged` powers the Apply-disabled state.
9
+ */
10
+ export interface FilterApplyStrategy {
11
+ getIsFiltersUnchanged: (modalFilters: Filter[], appliedFilters: Filter[], disabledDatasetUrns: Set<string>, appliedDisabledUrns: Set<string>) => boolean;
12
+ runApply: (modalFilters: Filter[], disabledDatasetUrns: Set<string>) => {
13
+ appliedFilters: Filter[];
14
+ systemMessageFilters: SystemMessageFilters;
15
+ };
16
+ }
17
+ interface UseFilterApplyParams {
18
+ apply: FilterApplyStrategy;
19
+ modalFilters: Filter[];
20
+ appliedFilters: Filter[];
21
+ disabledDatasetUrns: Set<string>;
22
+ appliedDisabledUrns: Set<string>;
23
+ setAppliedFilters: (filters: Filter[]) => void;
24
+ closeModal: () => void;
25
+ addSystemMessage: (filters: SystemMessageFilters, disabledDatasetUrns: Set<string>) => Promise<void>;
26
+ }
27
+ /**
28
+ * Shared apply control flow for both filter modes: compute the unchanged state,
29
+ * and on apply run the mode-specific change, persist applied filters, close the
30
+ * modal and write the system message off the render path.
31
+ */
32
+ export declare const useFilterApply: ({ apply, modalFilters, appliedFilters, disabledDatasetUrns, appliedDisabledUrns, setAppliedFilters, closeModal, addSystemMessage, }: UseFilterApplyParams) => {
33
+ isFiltersUnchanged: boolean;
34
+ onApply: () => void;
35
+ };
36
+ export {};
@@ -0,0 +1,59 @@
1
+ import { DataConstraints } from '../../../../../../sdmx-toolkit/src/index';
2
+ import { DataQuery } from '../../../../../../shared-toolkit/src/index';
3
+ import { Dispatch, SetStateAction } from 'react';
4
+ import { Filter } from '../../../../models/filters';
5
+ type SetFilters = (filters: Filter[]) => void;
6
+ type SetBooleanLoading = (isLoading: boolean) => void;
7
+ /**
8
+ * Mode-specific constraint operations injected into the shared
9
+ * {@link useFilterConstraints} skeleton. The single-dataset flow works on a
10
+ * flat `DataConstraints[]`; the multi-dataset flow works on a per-dataset map.
11
+ * `TResult` is the opaque per-call constraints payload each mode produces.
12
+ */
13
+ export interface FilterConstraintsStrategy<TResult> {
14
+ /**
15
+ * Fire the constraint request(s) for `filters`. `shouldTrackLoading` drives
16
+ * the shared loading counter. `targetDataQueries` narrows the request set on
17
+ * the delete path (multi-dataset only; ignored by single-dataset).
18
+ */
19
+ startFetch: (filters: Filter[], targetDataQueries?: DataQuery[]) => {
20
+ promise: Promise<TResult>;
21
+ shouldTrackLoading: boolean;
22
+ };
23
+ /** Constraints payload to use when a request fails. */
24
+ fallbackResult: (filters: Filter[]) => TResult;
25
+ /** Drop values no longer supported by the fetched constraints. */
26
+ cleanIncompatible: (filters: Filter[], result: TResult, changedFilter: Filter) => {
27
+ filters: Filter[];
28
+ changed: boolean;
29
+ };
30
+ /** Fill `filters` with the fetched constraints. */
31
+ fill: (filters: Filter[], result: TResult) => Filter[];
32
+ /** Persist the fetched constraints into the mode-specific ref. */
33
+ commit: (result: TResult) => void;
34
+ /** Constraints to rebuild the hierarchy tree with after a change. */
35
+ getRebuildConstraints: (changedFilter: Filter, result: TResult) => DataConstraints[] | undefined;
36
+ }
37
+ interface UseFilterConstraintsParams<TResult> {
38
+ strategy: FilterConstraintsStrategy<TResult>;
39
+ modalFilters: Filter[];
40
+ setModalFilters: SetFilters;
41
+ setSelectedFilter: Dispatch<SetStateAction<Filter | undefined>>;
42
+ rebuildHierarchyTree: (filter: Filter, constraints?: DataConstraints[]) => void;
43
+ }
44
+ /**
45
+ * Shared constraint-fetching control flow for both filter modes. The async
46
+ * skeleton (request → optionally clean-and-recurse → fill/commit → catch/finally)
47
+ * is identical across single- and multi-dataset; the mode-specific primitives
48
+ * arrive through `strategy`.
49
+ */
50
+ export declare const useFilterConstraints: <TResult>({ strategy, modalFilters, setModalFilters, setSelectedFilter, rebuildHierarchyTree, }: UseFilterConstraintsParams<TResult>) => {
51
+ isConstraintsLoading: boolean | undefined;
52
+ isDisableFilterValues: boolean | undefined;
53
+ isFilterValuesLoading: boolean;
54
+ setIsConstraintsLoading: Dispatch<SetStateAction<boolean | undefined>>;
55
+ handleFiltersWithConstraints: (filters: Filter[], setFilters: SetFilters, setLoading?: SetBooleanLoading, changedFilter?: Filter) => void;
56
+ handleFiltersDelete: (filtersToUpdate: Filter[], targetDataQueries?: DataQuery[]) => void;
57
+ updateSelectedFilterValues: (filter?: Filter) => void;
58
+ };
59
+ export {};
@@ -0,0 +1,40 @@
1
+ import { Filter } from '../../../../models/filters';
2
+ type SetFilters = (filters: Filter[]) => void;
3
+ type SetBooleanLoading = (isLoading: boolean) => void;
4
+ /**
5
+ * Outcome of a mode's initialization check:
6
+ * - `ready` — preselect now with `filters`;
7
+ * - `pending` — structure data not ready yet, show loading and wait;
8
+ * - `skip` — nothing to do (e.g. already initialized, or no structure).
9
+ */
10
+ export type FilterInitResult = {
11
+ status: 'ready';
12
+ filters: Filter[];
13
+ } | {
14
+ status: 'pending';
15
+ } | {
16
+ status: 'skip';
17
+ };
18
+ /**
19
+ * Mode-specific initialization behavior injected into the shared
20
+ * {@link useFilterInitialization} skeleton. `prepareInit` computes the preselected
21
+ * filters (or signals pending/skip); `markInitialized` lets a one-shot mode
22
+ * (single-dataset) record that it has run.
23
+ */
24
+ export interface FilterInitStrategy {
25
+ prepareInit: () => FilterInitResult;
26
+ markInitialized?: () => void;
27
+ }
28
+ interface UseFilterInitializationParams {
29
+ init: FilterInitStrategy;
30
+ setAppliedFilters: SetFilters;
31
+ setIsConstraintsLoading: SetBooleanLoading;
32
+ handleFiltersWithConstraints: (filters: Filter[], setFilters: SetFilters, setLoading?: SetBooleanLoading) => void;
33
+ }
34
+ /**
35
+ * Shared initial preselect for both filter modes. Re-runs whenever the mode's
36
+ * `prepareInit` identity changes (i.e., its inputs change); the mode decides via
37
+ * the returned status whether to preselect, wait, or skip.
38
+ */
39
+ export declare const useFilterInitialization: ({ init, setAppliedFilters, setIsConstraintsLoading, handleFiltersWithConstraints, }: UseFilterInitializationParams) => void;
40
+ export {};
@@ -0,0 +1,49 @@
1
+ import { PopUpState } from '../../../../../../ui-components/src/index';
2
+ import { Dispatch, SetStateAction } from 'react';
3
+ import { Filter, FilterMode, FiltersProps, HierarchyState } from '../../../../models/filters';
4
+ interface UseFilterModalStateParams {
5
+ mode: FilterMode;
6
+ modalState: PopUpState;
7
+ dataQueries?: FiltersProps['dataQueries'];
8
+ hierarchyStateMap: Map<string, HierarchyState>;
9
+ loadAvailableHierarchies: (filter: Filter) => void | Promise<void>;
10
+ }
11
+ export interface UseFilterModalStateResult {
12
+ modalFilters: Filter[];
13
+ setModalFilters: Dispatch<SetStateAction<Filter[]>>;
14
+ appliedFilters: Filter[];
15
+ setAppliedFilters: Dispatch<SetStateAction<Filter[]>>;
16
+ selectedFilter: Filter | undefined;
17
+ setSelectedFilter: Dispatch<SetStateAction<Filter | undefined>>;
18
+ selectedFilterValues: Filter[];
19
+ selectedTimeOption: string | number | undefined;
20
+ disabledDatasetUrns: Set<string>;
21
+ appliedDisabledUrns: Set<string>;
22
+ onSelectDisplayMode: (filter?: Filter, displayMode?: string) => void;
23
+ onClearAllDatasets: () => void;
24
+ onToggleDataset: (urn: string, enabled: boolean) => void;
25
+ onTimePeriodChange: (value: string | number) => void;
26
+ }
27
+ /**
28
+ * Modal state shared by both filter modes (modal/applied filters, selected
29
+ * filter, time option). The two modes are identical except for two `multi`-only
30
+ * concerns: the dataset-disable sets, and resetting `selectedTimeOption` when
31
+ * the modal opens — single-dataset keeps the last time option across reopens.
32
+ */
33
+ export declare const useFilterModalState: ({ mode, modalState, dataQueries, hierarchyStateMap, loadAvailableHierarchies, }: UseFilterModalStateParams) => {
34
+ modalFilters: Filter[];
35
+ setModalFilters: Dispatch<SetStateAction<Filter[]>>;
36
+ appliedFilters: Filter[];
37
+ setAppliedFilters: Dispatch<SetStateAction<Filter[]>>;
38
+ selectedFilter: Filter | undefined;
39
+ setSelectedFilter: Dispatch<SetStateAction<Filter | undefined>>;
40
+ selectedFilterValues: Filter[];
41
+ selectedTimeOption: string | number | undefined;
42
+ disabledDatasetUrns: Set<string>;
43
+ appliedDisabledUrns: Set<string>;
44
+ onSelectDisplayMode: (filter?: Filter, displayMode?: string) => void;
45
+ onClearAllDatasets: () => void;
46
+ onToggleDataset: (urn: string, enabled: boolean) => void;
47
+ onTimePeriodChange: (value: string | number) => void;
48
+ };
49
+ export {};
@@ -0,0 +1,35 @@
1
+ import { Conversation } from '@epam/ai-dial-shared';
2
+ import { DataQuery } from '../../../../../../shared-toolkit/src/index';
3
+ import { FiltersProps } from '../../../../models/filters';
4
+ import { SystemMessageFilters } from './use-filter-apply';
5
+ /**
6
+ * Mode-specific system-message builder injected into the shared
7
+ * {@link useFilterSystemMessage} skeleton. Given the current conversation and the
8
+ * applied filters, it returns the conversation updated with the new system message
9
+ * (or `null` when there is no conversation) plus the data queries to persist. The
10
+ * single-dataset flow works on a flat `Filter[]`; the multi-dataset flow works on
11
+ * a per-dataset map and additionally folds in `disabledDatasetUrns`.
12
+ */
13
+ export interface FilterSystemMessageStrategy {
14
+ buildSystemMessage: (conversation: Conversation | null, systemMessageFilters: SystemMessageFilters, disabledDatasetUrns: Set<string>) => {
15
+ conversation: Conversation | null;
16
+ nextDataQueries: DataQuery[];
17
+ };
18
+ }
19
+ interface UseFilterSystemMessageParams {
20
+ buildSystemMessage: FilterSystemMessageStrategy['buildSystemMessage'];
21
+ conversation?: FiltersProps['conversation'];
22
+ conversationKey: string;
23
+ setConversation?: FiltersProps['setConversation'];
24
+ updateConversation: FiltersProps['updateConversation'];
25
+ updateDataQueries?: FiltersProps['updateDataQueries'];
26
+ }
27
+ /**
28
+ * Shared system-message persistence for both filter modes: snapshot the current
29
+ * conversation off a ref, delegate message + data-query construction to the
30
+ * mode-specific `buildSystemMessage`, then persist the result (local conversation
31
+ * state, data queries, and the remote conversation). No per-mode branching lives
32
+ * here — all of it is encapsulated in `buildSystemMessage`.
33
+ */
34
+ export declare const useFilterSystemMessage: ({ buildSystemMessage, conversation, conversationKey, setConversation, updateConversation, updateDataQueries, }: UseFilterSystemMessageParams) => (systemMessageFilters: SystemMessageFilters, disabledDatasetUrns?: Set<string>) => Promise<void>;
35
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare const useFilterValuesLoading: () => {
2
+ isLoading: boolean;
3
+ startLoading: () => void;
4
+ finishLoading: () => void;
5
+ };
@@ -0,0 +1,49 @@
1
+ import { DataConstraints } from '../../../../../../sdmx-toolkit/src/index';
2
+ import { DataQuery } from '../../../../../../shared-toolkit/src/index';
3
+ import { Filter, FilterMode, FiltersProps } from '../../../../models/filters';
4
+ import { FilterSettingsOptions } from '../FiltersModal/filter-settings-controller';
5
+ import { FiltersModalShellProps } from '../FiltersModal/FiltersModalShell';
6
+ import { FilterApplyStrategy } from './use-filter-apply';
7
+ import { FilterConstraintsStrategy } from './use-filter-constraints';
8
+ import { FilterInitStrategy } from './use-filter-initialization';
9
+ import { FilterSystemMessageStrategy } from './use-filter-system-message';
10
+ /**
11
+ * Everything mode-specific about a filter flow, bundled behind one object so the
12
+ * shared {@link useFilters} orchestration stays mode-agnostic. Built per mode by
13
+ * `useSingleFilterStrategy` / `useMultiFilterStrategy`.
14
+ */
15
+ export interface FilterStrategy<TResult> {
16
+ mode: FilterMode;
17
+ /** Constraint operations consumed by the shared constraints skeleton. */
18
+ constraints: FilterConstraintsStrategy<TResult>;
19
+ /** Apply operations consumed by the shared apply skeleton. */
20
+ apply: FilterApplyStrategy;
21
+ /**
22
+ * Builds the mode-specific system message + persisted data queries, consumed
23
+ * by the shared system-message skeleton on apply.
24
+ */
25
+ buildSystemMessage: FilterSystemMessageStrategy['buildSystemMessage'];
26
+ /** Initialization behavior consumed by the shared init skeleton. */
27
+ init: FilterInitStrategy;
28
+ getConstraintsForFilter: (filter: Filter) => DataConstraints[] | undefined;
29
+ getCodelistUrnForFilter: (filter: Filter) => string | undefined;
30
+ getSourceArtefactUrn: (filter: Filter) => string | undefined;
31
+ remember: () => void;
32
+ restore: () => void;
33
+ /** Data queries whose constraints to refresh when a single filter is deleted. */
34
+ getDeleteTargets: (filter: Filter | undefined, dataQueries?: DataQuery[]) => DataQuery[] | undefined;
35
+ /** Data queries whose constraints to refresh when all filters are cleared. */
36
+ getClearTargets: (dataQueries?: DataQuery[]) => DataQuery[] | undefined;
37
+ /** Mode-specific `FilterSettings` options (merged with the common ones). */
38
+ controllerOptions: Partial<FilterSettingsOptions>;
39
+ /** Total timeseries count (single-dataset only). */
40
+ timeSeriesCount?: number;
41
+ }
42
+ /**
43
+ * Shared orchestration for both filter modes: wires hierarchy, modal state,
44
+ * constraint fetching, initialization, system-message persistence and apply,
45
+ * then assembles the `FiltersModalShell` props. All mode-specific behavior is
46
+ * provided by `strategy`, so this hook contains no per-mode branching beyond a
47
+ * couple of tiny gates keyed on `strategy.mode`.
48
+ */
49
+ export declare const useFilters: <TResult>({ actions, buttonProps, modalProps, dataQueries, locale, timeRangeOptions, conversationKey, conversation, setConversation, updateConversation, updateDataQueries, limitMessages, filterIconClassName, }: FiltersProps, strategy: FilterStrategy<TResult>) => FiltersModalShellProps;
@@ -0,0 +1,7 @@
1
+ import { FiltersProps } from '../../../../models/filters';
2
+ import { FiltersModalShellProps } from '../FiltersModal/FiltersModalShell';
3
+ /**
4
+ * Single-dataset (attachment-scoped) filter flow. Builds the single-dataset
5
+ * strategy and delegates orchestration to the shared {@link useFilters} hook.
6
+ */
7
+ export declare const useSingleDatasetFilters: (props: FiltersProps) => FiltersModalShellProps;
@@ -0,0 +1,22 @@
1
+ import { DataConstraints } from '../../../../../../sdmx-toolkit/src/index';
2
+ import { FiltersProps } from '../../../../models/filters';
3
+ import { FilterStrategy } from './use-filters';
4
+ interface UseSingleFilterStrategyParams {
5
+ actions?: FiltersProps['actions'];
6
+ attachmentsDataQuery?: FiltersProps['attachmentsDataQuery'];
7
+ dataQueries?: FiltersProps['dataQueries'];
8
+ dimensions?: FiltersProps['dimensions'];
9
+ structureDimensions?: FiltersProps['structureDimensions'];
10
+ structures?: FiltersProps['structures'];
11
+ initialConstraints?: DataConstraints[];
12
+ locale?: string;
13
+ onFiltersChange?: FiltersProps['onFiltersChange'];
14
+ }
15
+ /**
16
+ * Single-dataset filter strategy. Owns the flat `DataConstraints[]` ref and
17
+ * provides the array-shaped constraint, apply and init primitives the shared
18
+ * {@link useFilters} orchestration injects, plus the hierarchy getters and
19
+ * the modal remember/restore snapshot.
20
+ */
21
+ export declare const useSingleFilterStrategy: ({ actions, attachmentsDataQuery, dataQueries, dimensions, structureDimensions, structures, initialConstraints, locale, onFiltersChange, }: UseSingleFilterStrategyParams) => FilterStrategy<DataConstraints[]>;
22
+ export {};
@@ -0,0 +1,3 @@
1
+ import { FiltersProps } from '../../../../models/filters';
2
+ import { StructureDataMaps } from '../../../../models/structure-data';
3
+ export declare const useMultiDatasetDisplayDataQueries: (dataQueries?: FiltersProps["dataQueries"], structuresMap?: StructureDataMaps["structuresMap"], locale?: string) => import('../../../../../../shared-toolkit/src/index').DataQuery[] | undefined;
@@ -0,0 +1,7 @@
1
+ import { FiltersProps } from '../../../../models/filters';
2
+ import { FiltersModalShellProps } from '../../Filters/FiltersModal/FiltersModalShell';
3
+ /**
4
+ * Multi-dataset (cross-dataset) filter flow. Builds the multi-dataset strategy
5
+ * and delegates orchestration to the shared {@link useFilters} hook.
6
+ */
7
+ export declare const useMultiDatasetFilters: (props: FiltersProps) => FiltersModalShellProps;
@@ -0,0 +1,27 @@
1
+ import { DataConstraints, DatasetDimensionsMetadataMap } from '../../../../../../sdmx-toolkit/src/index';
2
+ import { Filter, FiltersProps } from '../../../../models/filters';
3
+ import { StructureDataMaps } from '../../../../models/structure-data';
4
+ import { FilterStrategy } from '../../Filters/hooks/use-filters';
5
+ type ConstraintsMap = Map<string, DataConstraints[] | undefined>;
6
+ export interface MultiConstraintsResult {
7
+ filtersMap: Map<string, Filter[]>;
8
+ constraints: ConstraintsMap;
9
+ structureDataMaps: StructureDataMaps;
10
+ }
11
+ interface UseMultiFilterStrategyParams {
12
+ actions?: FiltersProps['actions'];
13
+ dataQueries?: FiltersProps['dataQueries'];
14
+ datasetDimensionsMetadataMap?: DatasetDimensionsMetadataMap;
15
+ structureDataMaps?: StructureDataMaps;
16
+ datasetIcon?: FiltersProps['datasetIcon'];
17
+ locale?: string;
18
+ onMultipleDataFiltersChange?: FiltersProps['onMultipleDataFiltersChange'];
19
+ }
20
+ /**
21
+ * Multi-dataset (cross-dataset) filter strategy. Owns the per-dataset
22
+ * constraints map ref and provides the map-shaped constraint, apply and init
23
+ * primitives the shared {@link useFilters} orchestration injects, plus the
24
+ * hierarchy getters and the modal remember/restore snapshot.
25
+ */
26
+ export declare const useMultiFilterStrategy: ({ actions, dataQueries, datasetDimensionsMetadataMap, structureDataMaps, datasetIcon, locale, onMultipleDataFiltersChange, }: UseMultiFilterStrategyParams) => FilterStrategy<MultiConstraintsResult>;
27
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { getObsAttributesFromParams } from '../../../../utils/attachments/metadata';
2
2
  import { ICellRendererParams } from 'ag-grid-community';
3
- import { StructuralData } from '../../../../../../sdmx-toolkit/src/index';
3
+ import { Dataflow, StructuralData } from '../../../../../../sdmx-toolkit/src/index';
4
4
  import { MetadataSettings } from '../../../../models/metadata';
5
5
  import { ConversationViewTitles } from '../../../../index';
6
6
  export interface ObservationValueCellRendererParams extends ICellRendererParams {
@@ -11,7 +11,7 @@ export interface ObservationValueCellRendererParams extends ICellRendererParams
11
11
  titles?: ConversationViewTitles;
12
12
  }
13
13
  export type ObservationMetadataContent = ReturnType<typeof getObservationMetadataContent>;
14
- export declare const getObservationMetadataContent: (params: ObservationValueCellRendererParams, obsAttributes: NonNullable<ReturnType<typeof getObsAttributesFromParams>>) => {
14
+ export declare const getObservationMetadataContent: (params: ObservationValueCellRendererParams, obsAttributes: NonNullable<ReturnType<typeof getObsAttributesFromParams>>, getDatasetLastUpdated?: (dataset: Dataflow | null | undefined) => string | undefined) => {
15
15
  metadata: (import('../../../../index').StructureComponentValue | {
16
16
  title: string;
17
17
  value: string | undefined;
@@ -0,0 +1,27 @@
1
+ import { RefObject } from 'react';
2
+ /**
3
+ * Keeps the conversation content and the attachment's tabs/buttons row fixed on
4
+ * screen while the user switches the visualization (e.g. grid ↔ chart) and the
5
+ * new content has a different height.
6
+ *
7
+ * Call {@link captureAnchor} synchronously right before triggering the switch.
8
+ * It simply locks `scrollTop` for a short settle window:
9
+ *
10
+ * - **Taller / same-size new view** → `scrollTop` is valid throughout, so the
11
+ * view stays exactly put (no jump), even while the chart builds.
12
+ * - **Shorter new view** → holding the old `scrollTop` is only clamped by the
13
+ * browser when it now exceeds the maximum, which happens exactly when the user
14
+ * was at the very bottom of the taller view. In that case the content settles
15
+ * down by the height difference (the one allowed movement); otherwise it still
16
+ * stays put.
17
+ *
18
+ * Native scroll anchoring is suspended during the window (its heuristic is
19
+ * unreliable for the last message / at the bottom), and re-enabled afterwards.
20
+ * A manual scroll (wheel / touch) hands control back to the user immediately.
21
+ *
22
+ * No-op when `enabled` is false (e.g. advanced view has no such scroll
23
+ * container).
24
+ */
25
+ export declare function useViewModeScrollAnchor<T extends HTMLElement>(anchorRef: RefObject<T | null>, enabled: boolean): {
26
+ captureAnchor: () => void;
27
+ };
@@ -0,0 +1,20 @@
1
+ import { Conversation, ConversationInfo } from '@epam/ai-dial-shared';
2
+ import { ConversationViewActions } from '../../../models/actions';
3
+ export interface UseConversationLifecycleArgs {
4
+ actions: ConversationViewActions;
5
+ conversation: Conversation | null;
6
+ locale: string;
7
+ conversationsRoute?: string;
8
+ openUrl: (url: string) => void;
9
+ setConversations: (conversations: ConversationInfo[]) => void;
10
+ }
11
+ /**
12
+ * Conversation-level actions: duplicating the current (read-only) conversation
13
+ * — copying its attachments when the file actions are available, then creating
14
+ * the copy, refreshing the conversation list and navigating to it — and opening
15
+ * a fresh conversation from the onboarding footer.
16
+ */
17
+ export declare const useConversationLifecycle: ({ actions, conversation, locale, conversationsRoute, openUrl, setConversations, }: UseConversationLifecycleArgs) => {
18
+ handleOpeningOfNewConversation: () => void;
19
+ duplicateConversation: () => Promise<void>;
20
+ };
@@ -0,0 +1,24 @@
1
+ import { Conversation } from '@epam/ai-dial-shared';
2
+ import { Dispatch, SetStateAction } from 'react';
3
+ import { ConversationViewActions } from '../../../models/actions';
4
+ export interface UseConversationLoaderArgs {
5
+ conversationKey: string;
6
+ actions: ConversationViewActions;
7
+ setConversation: Dispatch<SetStateAction<Conversation | null>>;
8
+ setCrossDatasetAttachmentsState: () => void;
9
+ sendMessageToConversation: (content: string, data: Conversation | null, customChoiceId?: string) => void;
10
+ onConversationNotFound?: () => void;
11
+ }
12
+ /**
13
+ * Loads the conversation for the current `conversationKey`, derives its
14
+ * read-only flag, and sends the stored `prompt` to start the first turn when
15
+ * there are no user messages yet (an empty conversation, or one holding only a
16
+ * seed assistant message). Owns the `isLoading` / `isReadonlyConversation` UI
17
+ * state and clears the request cache around each load. On failure it marks the
18
+ * conversation read-only and calls `onConversationNotFound`. Re-fetches only
19
+ * when `conversationKey` changes.
20
+ */
21
+ export declare const useConversationLoader: ({ conversationKey, actions, setConversation, setCrossDatasetAttachmentsState, sendMessageToConversation, onConversationNotFound, }: UseConversationLoaderArgs) => {
22
+ isLoading: boolean;
23
+ isReadonlyConversation: boolean;
24
+ };
@@ -0,0 +1,13 @@
1
+ import { Conversation } from '@epam/ai-dial-shared';
2
+ import { ConversationViewActions } from '../../../models/actions';
3
+ export interface UseConversationSaverArgs {
4
+ actions: ConversationViewActions;
5
+ conversationKey: string;
6
+ }
7
+ /**
8
+ * Persists the conversation back to the DIAL API via `actions.updateConversation`
9
+ * — only `name`, `messages` and `customViewState` are sent. Failures are logged
10
+ * and swallowed (the local state is left untouched). Shared by the streaming and
11
+ * message-feedback flows, which both flush local edits to the server.
12
+ */
13
+ export declare const useConversationSaver: ({ actions, conversationKey, }: UseConversationSaverArgs) => (updatedConversation: Conversation) => Promise<void>;
@@ -0,0 +1,35 @@
1
+ import { Conversation } from '@epam/ai-dial-shared';
2
+ import { Message } from '../../../../../dial-toolkit/src/index';
3
+ import { HttpError } from '../../../../../shared-toolkit/src/index';
4
+ import { Dispatch, SetStateAction } from 'react';
5
+ import { StatusMessages } from '../../../types/texts';
6
+ export interface UseConversationStreamingArgs {
7
+ conversation: Conversation | null;
8
+ setConversation: Dispatch<SetStateAction<Conversation | null>>;
9
+ saveConversation: (conversation: Conversation) => Promise<void>;
10
+ updateAssistantMessage: (assistantMessage: Message, partialMessage: Partial<Message>) => Message | undefined;
11
+ addUserMessageToConversation: (userMessage: Message) => void;
12
+ initializeAssistantMessage: () => Message;
13
+ isStreaming: boolean;
14
+ setIsStreaming: (isStreaming: boolean) => void;
15
+ statusMessages: StatusMessages;
16
+ isCrossDatasetModeOn: boolean;
17
+ token?: string | null;
18
+ handleInvalidStreaming?: (error: HttpError) => void;
19
+ }
20
+ /**
21
+ * The SSE streaming engine: starting/aborting a stream, merging partials,
22
+ * mapping transport errors to user-facing messages, persisting the finalized
23
+ * conversation, and the send / regenerate / edit entry points. Decoupled from
24
+ * the `conversation` prop for its core flow — every entry point receives the
25
+ * conversation as an explicit `data` argument; the prop is only read to derive
26
+ * the "retry last failed message" affordance.
27
+ */
28
+ export declare const useConversationStreaming: ({ conversation, setConversation, saveConversation, updateAssistantMessage, addUserMessageToConversation, initializeAssistantMessage, isStreaming, setIsStreaming, statusMessages, isCrossDatasetModeOn, token, handleInvalidStreaming, }: UseConversationStreamingArgs) => {
29
+ sendMessageToConversation: (content: string, data: Conversation | null, customChoiceId?: string) => Promise<void>;
30
+ regenerateMessage: (message: Message, data: Conversation | null) => Promise<void>;
31
+ editMessage: (message: Message, data: Conversation | null) => Promise<void>;
32
+ onStopStreaming: () => void;
33
+ isLastMessageFailed: boolean;
34
+ regenerateLastMessage: (() => Promise<void>) | undefined;
35
+ };
@@ -0,0 +1,43 @@
1
+ import { CustomViewState } from '../../../../../dial-toolkit/src/index';
2
+ import { ConversationViewProps } from '../types';
3
+ /**
4
+ * Orchestrates the ConversationView feature: reads the shared contexts once and
5
+ * composes the focused sub-hooks — saver → message mutations → streaming →
6
+ * feedback → lifecycle → loader, plus the standalone `useOnboardingSync`
7
+ * effects — then returns a flat view-model object consumed by the presentational
8
+ * layout. Mirrors the `useFilters` orchestration pattern. The only hard ordering
9
+ * constraint is that streaming is wired before the loader, since the loader
10
+ * auto-sends the first message via `sendMessageToConversation`.
11
+ */
12
+ export declare const useConversationView: (props: ConversationViewProps) => {
13
+ isLoading: boolean;
14
+ isReadonlyConversation: boolean;
15
+ isStreaming: boolean;
16
+ isOpenedAdvancedView: boolean;
17
+ isShowOnboarding: boolean | undefined;
18
+ isAgentAvailable: boolean;
19
+ statusMessages: import('../../../types/texts').StatusMessages;
20
+ conversationViewState: CustomViewState | undefined;
21
+ messageServerActions: {
22
+ getFile: import('../../../types/actions').GetAttachmentContent;
23
+ putOnboardingFile: import('../../../types/actions').PutOnboardingFile;
24
+ getDataSet: import('../../../types/actions').GetDatasetDetails;
25
+ getDataSetData: import('../../../types/actions').GetDatasetData;
26
+ getConstraints: import('../../../types/actions').getConstraints;
27
+ updateCurrentDataQuery: (dataQuery?: import('../../../../../shared-toolkit/src/index').DataQuery) => void;
28
+ updateDataQueries: (dataQueries?: import('../../../../../shared-toolkit/src/index').DataQuery[]) => void;
29
+ updateDatasets: (datasets?: import('../../../../../sdmx-toolkit/src/index').Dataflow[]) => void;
30
+ downloadDataSet: import('../../../../../download-panel/src/types/actions').DownloadDatasetAction;
31
+ };
32
+ sendMessageToConversation: (content: string, data: import('@epam/ai-dial-shared').Conversation | null, customChoiceId?: string) => Promise<void>;
33
+ regenerateMessage: (message: import('../../../../../dial-toolkit/src/index').Message, data: import('@epam/ai-dial-shared').Conversation | null) => Promise<void>;
34
+ editMessage: (message: import('../../../../../dial-toolkit/src/index').Message, data: import('@epam/ai-dial-shared').Conversation | null) => Promise<void>;
35
+ onStopStreaming: () => void;
36
+ isLastMessageFailed: boolean;
37
+ regenerateLastMessage: (() => Promise<void>) | undefined;
38
+ rateResponse: (id: string, rate: import('@epam/ai-dial-shared').LikeState) => void;
39
+ handleCodeAttachmentUpdated: (messageId: string, newRawAttachment: import('@epam/ai-dial-shared').Attachment) => void;
40
+ duplicateConversation: () => Promise<void>;
41
+ handleOpeningOfNewConversation: () => void;
42
+ };
43
+ export type ConversationViewModel = ReturnType<typeof useConversationView>;
@@ -0,0 +1,19 @@
1
+ import { Attachment, Conversation, LikeState } from '@epam/ai-dial-shared';
2
+ import { Dispatch, SetStateAction } from 'react';
3
+ import { ConversationViewActions } from '../../../models/actions';
4
+ export interface UseMessageFeedbackArgs {
5
+ actions: ConversationViewActions;
6
+ conversation: Conversation | null;
7
+ setConversation: Dispatch<SetStateAction<Conversation | null>>;
8
+ saveConversation: (conversation: Conversation) => Promise<void>;
9
+ }
10
+ /**
11
+ * Per-message feedback actions: rating a response (thumbs up/down) and
12
+ * replacing a Python code attachment after an in-place edit. Both persist the
13
+ * resulting conversation. `rateResponse` mutates `conversation.messages` in
14
+ * place — preserved as-is from the original component.
15
+ */
16
+ export declare const useMessageFeedback: ({ actions, conversation, setConversation, saveConversation, }: UseMessageFeedbackArgs) => {
17
+ handleCodeAttachmentUpdated: (messageId: string, newRawAttachment: Attachment) => void;
18
+ rateResponse: (id: string, rate: LikeState) => void;
19
+ };
@@ -0,0 +1,17 @@
1
+ import { Conversation } from '@epam/ai-dial-shared';
2
+ import { Message } from '../../../../../dial-toolkit/src/index';
3
+ import { Dispatch, SetStateAction } from 'react';
4
+ export interface UseMessageMutationsArgs {
5
+ setConversation: Dispatch<SetStateAction<Conversation | null>>;
6
+ }
7
+ /**
8
+ * Local message-state mutations on the in-memory conversation: appending the
9
+ * user message, seeding an empty assistant message, and merging updates
10
+ * (streamed partials, or an error message) into that assistant message by id.
11
+ * Touches React state only — no persistence or network.
12
+ */
13
+ export declare const useMessageMutations: ({ setConversation, }: UseMessageMutationsArgs) => {
14
+ addUserMessageToConversation: (userMessage: Message) => void;
15
+ initializeAssistantMessage: () => Message;
16
+ updateAssistantMessage: (assistantMessage: Message, partialMessage: Partial<Message>) => Message | undefined;
17
+ };