@databrainhq/plugin 0.14.18 → 0.14.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { EmbeddedMetricCreationProps } from '@/types';
3
+ export declare const GenerateMetric: ({ clientId, companyId, externalDashboardId, isLiveMode, isShowMetricCreateModal, setShowMetricCreateModal, userProvidedDashboardId, workspaceId, chartColors, metric, metricData, variant, }: EmbeddedMetricCreationProps) => React.JSX.Element;
@@ -26,6 +26,8 @@ export declare const DASHBOARD_DATASET_METRIC_PATH: string;
26
26
  export declare const DASHBOARD_DATASET_METRIC_MUTATION = "datasetMetricCreation";
27
27
  export declare const DASHBOARD_PREVIEW_TABLE_PATH: string;
28
28
  export declare const DASHBOARD_PREVIEW_TABLE_MUTATION = "previewTable";
29
+ export declare const DASHBOARD_GEN_METRIC_DATA_PATH: string;
30
+ export declare const DASHBOARD_GEN_METRIC_DATA_MUTATION = "/generatetMetricData";
29
31
  export declare const METRIC_QUERY_PATH: string;
30
32
  export declare const METRIC_QUERY_QUERY = "query";
31
33
  export declare const METRIC_RAW_DOWNLOAD_SETTINGS_PATH: string;
@@ -35,6 +35,9 @@ export interface DashboardProps extends HTMLAttributes<HTMLElement> {
35
35
  disableFullscreen?: boolean;
36
36
  optionsIcon?: 'kebab-menu-vertical' | 'download';
37
37
  adminThemeOptions?: AdminThemeOptionsType;
38
+ customMessages?: {
39
+ tokenExpire?: string;
40
+ };
38
41
  }
39
42
  /**
40
43
  * @name Dashboard - A react component to display the dashboard.
@@ -48,4 +51,4 @@ export interface DashboardProps extends HTMLAttributes<HTMLElement> {
48
51
  * @prop {boolean} enableMultiMetricFilters (optional) - Whether to allow multiple metric filters in metric card.
49
52
  * @prop {object} theme (optional) - A theme object to customize the theme.
50
53
  */
51
- export declare const Dashboard: ({ token, options, theme, dashboardId, isHideChartSettings, isHideTablePreview, enableDownloadCsv, enableEmailCsv, enableMultiMetricFilters, disableFullscreen, optionsIcon, adminThemeOptions, }: DashboardProps) => React.JSX.Element;
54
+ export declare const Dashboard: ({ token, options, theme, dashboardId, isHideChartSettings, isHideTablePreview, enableDownloadCsv, enableEmailCsv, enableMultiMetricFilters, disableFullscreen, optionsIcon, adminThemeOptions, customMessages, }: DashboardProps) => React.JSX.Element;
@@ -19,5 +19,8 @@ export interface EmbeddedDashboardProps {
19
19
  };
20
20
  theme?: ThemeType;
21
21
  adminThemeOption?: AdminThemeOptionsType;
22
+ customMessages?: {
23
+ tokenExpire?: string;
24
+ };
22
25
  }
23
- export declare const EmbeddedDashboard: React.MemoExoticComponent<({ options, theme, adminThemeOption }: EmbeddedDashboardProps) => React.JSX.Element>;
26
+ export declare const EmbeddedDashboard: React.MemoExoticComponent<({ options, theme, adminThemeOption, customMessages, }: EmbeddedDashboardProps) => React.JSX.Element>;
@@ -16,5 +16,8 @@ export interface EmbeddedMetricProps {
16
16
  metricFilterPosition?: 'outside' | 'inside';
17
17
  disableFullscreen?: boolean;
18
18
  optionsIcon?: 'kebab-menu-vertical' | 'download';
19
+ customMessages?: {
20
+ tokenExpire?: string;
21
+ };
19
22
  }
20
- export declare const EmbeddedMetric: React.MemoExoticComponent<({ token, chartColors, metricId, chartRendererType, variant, onMinimize, isHideChartSettings, isHideTablePreview, enableDownloadCsv, enableEmailCsv, metricFilterOptions, enableMultiMetricFilters, metricFilterPosition, disableFullscreen, optionsIcon, }: EmbeddedMetricProps) => React.JSX.Element>;
23
+ export declare const EmbeddedMetric: React.MemoExoticComponent<({ token, chartColors, metricId, chartRendererType, variant, onMinimize, isHideChartSettings, isHideTablePreview, enableDownloadCsv, enableEmailCsv, metricFilterOptions, enableMultiMetricFilters, metricFilterPosition, disableFullscreen, optionsIcon, customMessages, }: EmbeddedMetricProps) => React.JSX.Element>;
@@ -34,6 +34,9 @@ export interface MetricProps extends HTMLAttributes<HTMLElement> {
34
34
  metricFilterPosition?: 'outside' | 'inside';
35
35
  disableFullscreen?: boolean;
36
36
  optionsIcon?: 'kebab-menu-vertical' | 'download';
37
+ customMessages?: {
38
+ tokenExpire?: string;
39
+ };
37
40
  }
38
41
  /**
39
42
  * @name Metric - A react component to display a single metric card.
@@ -0,0 +1,37 @@
1
+ /// <reference types="react" />
2
+ import { FieldValues } from 'react-hook-form';
3
+ import EChartsReact from 'echarts-for-react';
4
+ import { ColumnSizingState } from '@tanstack/react-table';
5
+ import { ChartSettingsType, ConfigType, GenerateMetricState } from '@/types';
6
+ declare const useGenerateMetric: (config: ConfigType) => {
7
+ isDisableSaveBtn: boolean;
8
+ setChartSettings: import("react").Dispatch<import("react").SetStateAction<ChartSettingsType>>;
9
+ setShowSaveMetricModal: import("react").Dispatch<import("react").SetStateAction<boolean>>;
10
+ isShowSaveMetricModal: boolean;
11
+ register: import("react-hook-form").UseFormRegister<FieldValues>;
12
+ errors: import("react-hook-form").FieldErrors<FieldValues>;
13
+ onSubmitQuery: (e?: import("react").BaseSyntheticEvent<object, any, any> | undefined) => Promise<void>;
14
+ generateMetricState: GenerateMetricState;
15
+ chartTabType: "CHART" | "ERROR" | "LOADING" | "INIT";
16
+ chartSettings: ChartSettingsType;
17
+ chartRef: import("react").RefObject<EChartsReact>;
18
+ onColumnSizingChange: (columnSizing: ColumnSizingState) => void;
19
+ watch: import("react-hook-form").UseFormWatch<FieldValues>;
20
+ createExternalMetric: (data: FieldValues) => void;
21
+ saveError: string;
22
+ updateExternalMetric: (data: FieldValues) => void;
23
+ clientSubsetData: any;
24
+ previewTable: import("react-query").UseMutateFunction<{
25
+ data: unknown;
26
+ }, unknown, {
27
+ data: import("../types/queryTypes").UsePreviewTableMutationInputType;
28
+ token: string;
29
+ }, unknown>;
30
+ token: string | undefined;
31
+ dashboardOptions: {
32
+ value: any;
33
+ label: any;
34
+ }[];
35
+ isCreatingMetric: boolean;
36
+ };
37
+ export default useGenerateMetric;
@@ -1,4 +1,4 @@
1
- import { UseCreateMetricMutationInputType, UseDatatsetMetricMutationInputType, UseDeleteDashboardScheduleReportMutationInputType, UseGenerateMetricMutationInputType, UsePreviewTableMutationInputType, UseSaveDashboardLayoutMutationInputType, UseSaveDashboardScheduleReportMutationInputType, UseUpdateAdminMetricMutationInputType, UseUpdateMetricMutationInputType } from '@/types/queryTypes';
1
+ import { UseCreateMetricMutationInputType, UseDatatsetMetricMutationInputType, UseDeleteDashboardScheduleReportMutationInputType, UseGenerateMetricDataMutationInputType, UseGenerateMetricMutationInputType, UsePreviewTableMutationInputType, UseSaveDashboardLayoutMutationInputType, UseSaveDashboardScheduleReportMutationInputType, UseUpdateAdminMetricMutationInputType, UseUpdateMetricMutationInputType } from '@/types/queryTypes';
2
2
  export declare const useSaveDashboardLayoutMutation: () => import("react-query").UseMutationResult<{
3
3
  data: unknown;
4
4
  }, unknown, UseSaveDashboardLayoutMutationInputType, unknown>;
@@ -47,3 +47,9 @@ export declare const usePreviewTableMutation: () => import("react-query").UseMut
47
47
  data: UsePreviewTableMutationInputType;
48
48
  token: string;
49
49
  }, unknown>;
50
+ export declare const useGenerateMetricDataMutation: () => import("react-query").UseMutationResult<{
51
+ data: unknown;
52
+ }, unknown, {
53
+ data: UseGenerateMetricDataMutationInputType;
54
+ token: string;
55
+ }, unknown>;
@@ -324,6 +324,26 @@ export type ConfigType = {
324
324
  metric: ExternalMetrics | undefined;
325
325
  metricData: Record<string, any>[] | undefined;
326
326
  };
327
+ export type GenerateConfigType = {
328
+ clientId: string;
329
+ companyId: string;
330
+ isLiveMode: boolean;
331
+ externalDashboardId: string;
332
+ userProvidedDashboardId: string;
333
+ chartColors: string[] | undefined;
334
+ isShowMetricCreateModal: boolean;
335
+ setShowMetricCreateModal: React.Dispatch<React.SetStateAction<boolean>>;
336
+ metric: ExternalMetrics | undefined;
337
+ metricData: Record<string, any>[] | undefined;
338
+ workspaceId: string;
339
+ variant: 'static' | 'floating' | undefined;
340
+ };
341
+ export type GenerateMetricState = {
342
+ data: Record<string, any>[];
343
+ error: string;
344
+ query: string;
345
+ isLoading: boolean;
346
+ };
327
347
  export type DatasetConfig = {
328
348
  clientSubsetData: any;
329
349
  clientId: string;
@@ -166,6 +166,9 @@ export type UsePreviewTableMutationInputType = {
166
166
  integrationId?: string;
167
167
  integrationName?: string;
168
168
  };
169
+ export type UseGenerateMetricDataMutationInputType = {
170
+ questionString: string;
171
+ };
169
172
  export type UseGenerateMetricMutationInputType = {
170
173
  userInputs?: any;
171
174
  integrationName?: string;