@magemetrics/ai 0.8.2 → 0.9.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.
- package/dist/react/ai.js +13276 -12892
- package/dist/react/index.d.ts +86 -176
- package/dist/styles.css +1 -1
- package/dist/web-component/index.d.ts +86 -176
- package/dist/web-component/web-component.es.js +50914 -48789
- package/package.json +10 -9
package/dist/react/index.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ import { ExternalAuthProvider } from '@magemetrics/core';
|
|
|
8
8
|
import { ExternalAuthProviderConfig } from '@magemetrics/core';
|
|
9
9
|
import { FetchNextPageOptions } from '@tanstack/react-query';
|
|
10
10
|
import { ForwardRefExoticComponent } from 'react';
|
|
11
|
-
import { GenerateInsightParam } from '@magemetrics/core';
|
|
12
11
|
import { InfiniteData } from '@tanstack/react-query';
|
|
13
12
|
import { InfiniteQueryObserverResult } from '@tanstack/react-query';
|
|
14
13
|
import { MageMetricsClient } from '@magemetrics/core';
|
|
@@ -21,6 +20,7 @@ import { SortingState as SortingState_2 } from '@tanstack/react-table';
|
|
|
21
20
|
import { UseMutateAsyncFunction } from '@tanstack/react-query';
|
|
22
21
|
import { UseMutateFunction } from '@tanstack/react-query';
|
|
23
22
|
import { UseMutationOptions } from '@tanstack/react-query';
|
|
23
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
24
24
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
25
25
|
import { z } from 'zod';
|
|
26
26
|
|
|
@@ -53,6 +53,25 @@ export { AuthState }
|
|
|
53
53
|
*/
|
|
54
54
|
export declare type BrandColors = PrimaryColorOption & SecondaryColorOption;
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* A standalone authenticated Canvas component that renders a canvas by its ID.
|
|
58
|
+
* This is useful for displaying saved canvases without the chat interface.
|
|
59
|
+
* @param root0 props for the component
|
|
60
|
+
* @param root0.canvasId The UUID of the canvas to display
|
|
61
|
+
* @returns the canvas component
|
|
62
|
+
* @example
|
|
63
|
+
* ```tsx
|
|
64
|
+
* import { Canvas } from "@magemetrics/ai";
|
|
65
|
+
*
|
|
66
|
+
* const SavedCanvasView = ({ canvasId }: { canvasId: string }) => {
|
|
67
|
+
* return <Canvas canvasId={canvasId} />;
|
|
68
|
+
* };
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export declare const Canvas: React.FC<{
|
|
72
|
+
canvasId: string;
|
|
73
|
+
}>;
|
|
74
|
+
|
|
56
75
|
export declare type CellContentProps = {
|
|
57
76
|
formattedValue: FormattedData | undefined;
|
|
58
77
|
unit?: string;
|
|
@@ -128,6 +147,10 @@ export declare interface Components {
|
|
|
128
147
|
}) => default_2.ReactNode;
|
|
129
148
|
avatar?: default_2.ReactNode;
|
|
130
149
|
getCanvasShareableLink?: (canvasId: string) => string;
|
|
150
|
+
canvasPanelActions?: (props: {
|
|
151
|
+
canvas: FrontendCanvas;
|
|
152
|
+
flowId: string;
|
|
153
|
+
}) => default_2.ReactNode;
|
|
131
154
|
}
|
|
132
155
|
|
|
133
156
|
export declare const ConfigurableChat: ConfigurableChatComponent;
|
|
@@ -243,15 +266,6 @@ export { ExternalAuthProvider }
|
|
|
243
266
|
|
|
244
267
|
export { ExternalAuthProviderConfig }
|
|
245
268
|
|
|
246
|
-
declare type ExtractInsightResponse = z.infer<typeof ExtractInsightResponseSchema>;
|
|
247
|
-
|
|
248
|
-
declare const ExtractInsightResponseSchema: z.ZodUnion<[z.ZodObject<{
|
|
249
|
-
type: z.ZodLiteral<"text">;
|
|
250
|
-
insight: z.ZodString;
|
|
251
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
252
|
-
type: z.ZodLiteral<"missing">;
|
|
253
|
-
}, z.core.$strip>]>;
|
|
254
|
-
|
|
255
269
|
/**
|
|
256
270
|
* This module handles the formatting and normalization of table cell values for display and sorting.
|
|
257
271
|
*
|
|
@@ -279,6 +293,16 @@ declare type FormattedData = {
|
|
|
279
293
|
sortValue: string | number | Date | null;
|
|
280
294
|
};
|
|
281
295
|
|
|
296
|
+
declare type FrontendCanvas = z.infer<typeof FrontendCanvasSchema>;
|
|
297
|
+
|
|
298
|
+
declare const FrontendCanvasSchema: z.ZodObject<{
|
|
299
|
+
title: z.ZodNullable<z.ZodString>;
|
|
300
|
+
id: z.ZodUUID;
|
|
301
|
+
nodes: z.ZodArray<z.ZodAny>;
|
|
302
|
+
edges: z.ZodArray<z.ZodAny>;
|
|
303
|
+
is_public: z.ZodBoolean;
|
|
304
|
+
}, z.core.$strip>;
|
|
305
|
+
|
|
282
306
|
declare type FrontendReport = z.infer<typeof FrontendReportSchema>;
|
|
283
307
|
|
|
284
308
|
declare type FrontendReportColumns = z.infer<typeof FrontendReportColumnsSchema>;
|
|
@@ -287,6 +311,15 @@ declare const FrontendReportColumnsSchema: z.ZodArray<z.ZodObject<{
|
|
|
287
311
|
dataType: z.ZodString;
|
|
288
312
|
renderType: z.ZodOptional<z.ZodString>;
|
|
289
313
|
unit: z.ZodOptional<z.ZodString>;
|
|
314
|
+
canonicalDataType: z.ZodOptional<z.ZodEnum<{
|
|
315
|
+
boolean: "boolean";
|
|
316
|
+
array: "array";
|
|
317
|
+
text: "text";
|
|
318
|
+
json: "json";
|
|
319
|
+
other: "other";
|
|
320
|
+
datetime: "datetime";
|
|
321
|
+
numeric: "numeric";
|
|
322
|
+
}>>;
|
|
290
323
|
name: z.ZodString;
|
|
291
324
|
data_type: z.ZodString;
|
|
292
325
|
}, z.core.$strip>>;
|
|
@@ -443,8 +476,6 @@ declare const FrontendVisualizationSchema: z.ZodObject<{
|
|
|
443
476
|
}, z.core.$strip>>;
|
|
444
477
|
}, z.core.$strip>;
|
|
445
478
|
|
|
446
|
-
export { GenerateInsightParam }
|
|
447
|
-
|
|
448
479
|
export declare const InfiniteDataTableUI: React.FC<InfiniteDataTableUIProps>;
|
|
449
480
|
|
|
450
481
|
declare type InfiniteDataTableUIProps = {
|
|
@@ -707,7 +738,47 @@ declare type StartOptions = DisplayControlProps & {
|
|
|
707
738
|
enableSpeechToText?: boolean;
|
|
708
739
|
};
|
|
709
740
|
|
|
710
|
-
declare type TableFilters = Record<string,
|
|
741
|
+
declare type TableFilters = Record<string, TableFilterValue>;
|
|
742
|
+
|
|
743
|
+
declare type TableFilterValue = z.infer<typeof TableFilterValueSchema>;
|
|
744
|
+
|
|
745
|
+
declare const TableFilterValueSchema: z.ZodObject<{
|
|
746
|
+
operator: z.ZodEnum<{
|
|
747
|
+
endsWith: "endsWith";
|
|
748
|
+
startsWith: "startsWith";
|
|
749
|
+
contains: "contains";
|
|
750
|
+
eq: "eq";
|
|
751
|
+
gt: "gt";
|
|
752
|
+
gte: "gte";
|
|
753
|
+
lt: "lt";
|
|
754
|
+
lte: "lte";
|
|
755
|
+
neq: "neq";
|
|
756
|
+
regex: "regex";
|
|
757
|
+
between: "between";
|
|
758
|
+
}>;
|
|
759
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>]>;
|
|
760
|
+
}, z.core.$strip>;
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Hook to fetch a canvas by its ID.
|
|
764
|
+
* @param canvasId - The UUID of the canvas to fetch
|
|
765
|
+
* @param options - Optional react-query options
|
|
766
|
+
* @returns Query result with the canvas data
|
|
767
|
+
* @example
|
|
768
|
+
* ```tsx
|
|
769
|
+
* const { data: canvas, isLoading } = useCanvas(canvasId);
|
|
770
|
+
* if (canvas) {
|
|
771
|
+
* console.log(canvas.title, canvas.is_public);
|
|
772
|
+
* }
|
|
773
|
+
* ```
|
|
774
|
+
*/
|
|
775
|
+
export declare const useCanvas: (canvasId: string | undefined | null, options?: Omit<UseQueryOptions<FrontendCanvas, unknown>, "queryKey" | "queryFn">) => UseQueryResult< {
|
|
776
|
+
title: string | null;
|
|
777
|
+
id: string;
|
|
778
|
+
nodes: any[];
|
|
779
|
+
edges: any[];
|
|
780
|
+
is_public: boolean;
|
|
781
|
+
}, unknown>;
|
|
711
782
|
|
|
712
783
|
export declare const useChatContext: () => ChatContextValue;
|
|
713
784
|
|
|
@@ -838,6 +909,7 @@ export declare const useDataReport: (reportId: FrontendReport["id"]) => {
|
|
|
838
909
|
dataType: string;
|
|
839
910
|
renderType?: string;
|
|
840
911
|
unit?: string;
|
|
912
|
+
canonicalDataType?: "numeric" | "boolean" | "datetime" | "text" | "array" | "json" | "other";
|
|
841
913
|
}[] | undefined;
|
|
842
914
|
isPendingColumns: boolean;
|
|
843
915
|
isPendingData: boolean;
|
|
@@ -975,169 +1047,6 @@ export declare const useDownloadReportData: (options?: UseMutationOptions<Export
|
|
|
975
1047
|
mutateAsync: UseMutateAsyncFunction<ExportReportDataResult, Error, ExportReportDataParams, unknown>;
|
|
976
1048
|
};
|
|
977
1049
|
|
|
978
|
-
export declare const useGenerateContextualInsight: (options?: UseMutationOptions<ExtractInsightResponse, Error, GenerateInsightParam>) => {
|
|
979
|
-
generateInsight: UseMutateFunction< {
|
|
980
|
-
type: "text";
|
|
981
|
-
insight: string;
|
|
982
|
-
} | {
|
|
983
|
-
type: "missing";
|
|
984
|
-
}, Error, GenerateInsightParam, unknown>;
|
|
985
|
-
generateInsightAsync: UseMutateAsyncFunction< {
|
|
986
|
-
type: "text";
|
|
987
|
-
insight: string;
|
|
988
|
-
} | {
|
|
989
|
-
type: "missing";
|
|
990
|
-
}, Error, GenerateInsightParam, unknown>;
|
|
991
|
-
data: undefined;
|
|
992
|
-
variables: undefined;
|
|
993
|
-
error: null;
|
|
994
|
-
isError: false;
|
|
995
|
-
isIdle: true;
|
|
996
|
-
isPending: false;
|
|
997
|
-
isSuccess: false;
|
|
998
|
-
status: "idle";
|
|
999
|
-
mutate: UseMutateFunction< {
|
|
1000
|
-
type: "text";
|
|
1001
|
-
insight: string;
|
|
1002
|
-
} | {
|
|
1003
|
-
type: "missing";
|
|
1004
|
-
}, Error, GenerateInsightParam, unknown>;
|
|
1005
|
-
reset: () => void;
|
|
1006
|
-
context: unknown;
|
|
1007
|
-
failureCount: number;
|
|
1008
|
-
failureReason: Error | null;
|
|
1009
|
-
isPaused: boolean;
|
|
1010
|
-
submittedAt: number;
|
|
1011
|
-
mutateAsync: UseMutateAsyncFunction< {
|
|
1012
|
-
type: "text";
|
|
1013
|
-
insight: string;
|
|
1014
|
-
} | {
|
|
1015
|
-
type: "missing";
|
|
1016
|
-
}, Error, GenerateInsightParam, unknown>;
|
|
1017
|
-
} | {
|
|
1018
|
-
generateInsight: UseMutateFunction< {
|
|
1019
|
-
type: "text";
|
|
1020
|
-
insight: string;
|
|
1021
|
-
} | {
|
|
1022
|
-
type: "missing";
|
|
1023
|
-
}, Error, GenerateInsightParam, unknown>;
|
|
1024
|
-
generateInsightAsync: UseMutateAsyncFunction< {
|
|
1025
|
-
type: "text";
|
|
1026
|
-
insight: string;
|
|
1027
|
-
} | {
|
|
1028
|
-
type: "missing";
|
|
1029
|
-
}, Error, GenerateInsightParam, unknown>;
|
|
1030
|
-
data: undefined;
|
|
1031
|
-
variables: GenerateInsightParam;
|
|
1032
|
-
error: null;
|
|
1033
|
-
isError: false;
|
|
1034
|
-
isIdle: false;
|
|
1035
|
-
isPending: true;
|
|
1036
|
-
isSuccess: false;
|
|
1037
|
-
status: "pending";
|
|
1038
|
-
mutate: UseMutateFunction< {
|
|
1039
|
-
type: "text";
|
|
1040
|
-
insight: string;
|
|
1041
|
-
} | {
|
|
1042
|
-
type: "missing";
|
|
1043
|
-
}, Error, GenerateInsightParam, unknown>;
|
|
1044
|
-
reset: () => void;
|
|
1045
|
-
context: unknown;
|
|
1046
|
-
failureCount: number;
|
|
1047
|
-
failureReason: Error | null;
|
|
1048
|
-
isPaused: boolean;
|
|
1049
|
-
submittedAt: number;
|
|
1050
|
-
mutateAsync: UseMutateAsyncFunction< {
|
|
1051
|
-
type: "text";
|
|
1052
|
-
insight: string;
|
|
1053
|
-
} | {
|
|
1054
|
-
type: "missing";
|
|
1055
|
-
}, Error, GenerateInsightParam, unknown>;
|
|
1056
|
-
} | {
|
|
1057
|
-
generateInsight: UseMutateFunction< {
|
|
1058
|
-
type: "text";
|
|
1059
|
-
insight: string;
|
|
1060
|
-
} | {
|
|
1061
|
-
type: "missing";
|
|
1062
|
-
}, Error, GenerateInsightParam, unknown>;
|
|
1063
|
-
generateInsightAsync: UseMutateAsyncFunction< {
|
|
1064
|
-
type: "text";
|
|
1065
|
-
insight: string;
|
|
1066
|
-
} | {
|
|
1067
|
-
type: "missing";
|
|
1068
|
-
}, Error, GenerateInsightParam, unknown>;
|
|
1069
|
-
data: undefined;
|
|
1070
|
-
error: Error;
|
|
1071
|
-
variables: GenerateInsightParam;
|
|
1072
|
-
isError: true;
|
|
1073
|
-
isIdle: false;
|
|
1074
|
-
isPending: false;
|
|
1075
|
-
isSuccess: false;
|
|
1076
|
-
status: "error";
|
|
1077
|
-
mutate: UseMutateFunction< {
|
|
1078
|
-
type: "text";
|
|
1079
|
-
insight: string;
|
|
1080
|
-
} | {
|
|
1081
|
-
type: "missing";
|
|
1082
|
-
}, Error, GenerateInsightParam, unknown>;
|
|
1083
|
-
reset: () => void;
|
|
1084
|
-
context: unknown;
|
|
1085
|
-
failureCount: number;
|
|
1086
|
-
failureReason: Error | null;
|
|
1087
|
-
isPaused: boolean;
|
|
1088
|
-
submittedAt: number;
|
|
1089
|
-
mutateAsync: UseMutateAsyncFunction< {
|
|
1090
|
-
type: "text";
|
|
1091
|
-
insight: string;
|
|
1092
|
-
} | {
|
|
1093
|
-
type: "missing";
|
|
1094
|
-
}, Error, GenerateInsightParam, unknown>;
|
|
1095
|
-
} | {
|
|
1096
|
-
generateInsight: UseMutateFunction< {
|
|
1097
|
-
type: "text";
|
|
1098
|
-
insight: string;
|
|
1099
|
-
} | {
|
|
1100
|
-
type: "missing";
|
|
1101
|
-
}, Error, GenerateInsightParam, unknown>;
|
|
1102
|
-
generateInsightAsync: UseMutateAsyncFunction< {
|
|
1103
|
-
type: "text";
|
|
1104
|
-
insight: string;
|
|
1105
|
-
} | {
|
|
1106
|
-
type: "missing";
|
|
1107
|
-
}, Error, GenerateInsightParam, unknown>;
|
|
1108
|
-
data: {
|
|
1109
|
-
type: "text";
|
|
1110
|
-
insight: string;
|
|
1111
|
-
} | {
|
|
1112
|
-
type: "missing";
|
|
1113
|
-
};
|
|
1114
|
-
error: null;
|
|
1115
|
-
variables: GenerateInsightParam;
|
|
1116
|
-
isError: false;
|
|
1117
|
-
isIdle: false;
|
|
1118
|
-
isPending: false;
|
|
1119
|
-
isSuccess: true;
|
|
1120
|
-
status: "success";
|
|
1121
|
-
mutate: UseMutateFunction< {
|
|
1122
|
-
type: "text";
|
|
1123
|
-
insight: string;
|
|
1124
|
-
} | {
|
|
1125
|
-
type: "missing";
|
|
1126
|
-
}, Error, GenerateInsightParam, unknown>;
|
|
1127
|
-
reset: () => void;
|
|
1128
|
-
context: unknown;
|
|
1129
|
-
failureCount: number;
|
|
1130
|
-
failureReason: Error | null;
|
|
1131
|
-
isPaused: boolean;
|
|
1132
|
-
submittedAt: number;
|
|
1133
|
-
mutateAsync: UseMutateAsyncFunction< {
|
|
1134
|
-
type: "text";
|
|
1135
|
-
insight: string;
|
|
1136
|
-
} | {
|
|
1137
|
-
type: "missing";
|
|
1138
|
-
}, Error, GenerateInsightParam, unknown>;
|
|
1139
|
-
};
|
|
1140
|
-
|
|
1141
1050
|
export declare const useMageMetricsApiUrl: () => string;
|
|
1142
1051
|
|
|
1143
1052
|
export declare const useMageMetricsClient: () => MageMetricsClient;
|
|
@@ -1156,6 +1065,7 @@ export declare const usePaginatedDataReport: (reportId: FrontendReport["id"], op
|
|
|
1156
1065
|
dataType: string;
|
|
1157
1066
|
renderType?: string;
|
|
1158
1067
|
unit?: string;
|
|
1068
|
+
canonicalDataType?: "numeric" | "boolean" | "datetime" | "text" | "array" | "json" | "other";
|
|
1159
1069
|
}[] | undefined;
|
|
1160
1070
|
isPendingColumns: boolean;
|
|
1161
1071
|
isPendingData: boolean;
|