@magemetrics/ai 0.5.3 → 0.6.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.
@@ -1,7 +1,11 @@
1
+ import { AuthProvider } from '@magemetrics/core';
1
2
  import { AuthState } from '@magemetrics/core';
2
3
  import { CreateFlowParam } from '@magemetrics/core';
3
4
  import { default as default_2 } from 'react';
5
+ import { DirectAuthProvider } from '@magemetrics/core';
4
6
  import { Dispatch } from 'react';
7
+ import { ExternalAuthProvider } from '@magemetrics/core';
8
+ import { ExternalAuthProviderConfig } from '@magemetrics/core';
5
9
  import { FetchNextPageOptions } from '@tanstack/react-query';
6
10
  import { ForwardRefExoticComponent } from 'react';
7
11
  import { GenerateInsightParam } from '@magemetrics/core';
@@ -20,21 +24,76 @@ import { UseMutationOptions } from '@tanstack/react-query';
20
24
  import { UseQueryResult } from '@tanstack/react-query';
21
25
  import { z } from 'zod';
22
26
 
27
+ /**
28
+ * Appearance configuration for visual customization of the `@magemetrics/ai` package.
29
+ */
30
+ export declare type AppearanceConfig = {
31
+ /**
32
+ * Brand colors used throughout the UI (buttons, accents, interactive elements).
33
+ */
34
+ colors?: BrandColors;
35
+ /**
36
+ * Modal-specific appearance settings.
37
+ */
38
+ modal?: ModalAppearance;
39
+ };
40
+
23
41
  declare type AssemblyAIMicrophoneController = {
24
42
  status: "idle" | "starting" | "recording";
25
43
  startRecording: (onTranscript: (text: string) => void) => Promise<void>;
26
44
  stopRecording: () => Promise<void>;
27
45
  };
28
46
 
47
+ export { AuthProvider }
48
+
29
49
  export { AuthState }
30
50
 
51
+ /**
52
+ * Brand colors configuration for the appearance prop.
53
+ */
54
+ export declare type BrandColors = PrimaryColorOption & SecondaryColorOption;
55
+
31
56
  export declare type CellContentProps = {
32
57
  formattedValue: FormattedData | undefined;
33
58
  unit?: string;
34
59
  renderType?: string;
35
60
  };
36
61
 
37
- export declare const Chat: React.FC<ConversationContentProps>;
62
+ export declare const Chat: React.FC<PublicChatProps>;
63
+
64
+ declare const Chat_2: ChatComponent;
65
+
66
+ declare interface ChatComponent extends default_2.MemoExoticComponent<(props: ChatProps) => default_2.JSX.Element> {
67
+ Messages: typeof MessagesContainer;
68
+ Input: typeof InputContainer & {
69
+ Default: typeof ChatInputDefault;
70
+ };
71
+ }
72
+
73
+ export declare interface ChatContextValue {
74
+ flowId: string | undefined | null;
75
+ enableSpeechToText?: boolean;
76
+ }
77
+
78
+ export declare interface ChatInputContextValue {
79
+ flowId: string | undefined;
80
+ isLoading: boolean;
81
+ isStreaming: boolean;
82
+ isError: boolean;
83
+ onRetry?: () => void;
84
+ onStop?: () => void;
85
+ sendMessage: (text: string, isEditing: boolean) => void;
86
+ lastUserMessage?: string;
87
+ enableSpeechToText?: boolean;
88
+ }
89
+
90
+ declare const ChatInputDefault: default_2.FC;
91
+
92
+ declare interface ChatProps {
93
+ flowId: string | undefined | null;
94
+ enableSpeechToText?: boolean;
95
+ children?: default_2.ReactNode;
96
+ }
38
97
 
39
98
  declare interface ColumnSort {
40
99
  desc: boolean;
@@ -70,6 +129,26 @@ export declare interface Components {
70
129
  getCanvasShareableLink?: (canvasId: string) => string;
71
130
  }
72
131
 
132
+ export declare const ConfigurableChat: ConfigurableChatComponent;
133
+
134
+ declare interface ConfigurableChatComponent extends default_2.FC<ConfigurableChatComponentProps> {
135
+ Messages: typeof Chat_2.Messages;
136
+ Input: typeof Chat_2.Input;
137
+ }
138
+
139
+ declare type ConfigurableChatComponentProps = {
140
+ flowId: string | undefined | null;
141
+ enableSpeechToText?: boolean;
142
+ disableCanvas?: boolean;
143
+ children?: default_2.ReactNode;
144
+ /**
145
+ * Appearance configuration for customizing the visual style.
146
+ * Includes brand colors and modal-specific styling options.
147
+ */
148
+ appearance?: AppearanceConfig;
149
+ };
150
+
151
+ /** @deprecated This type is no longer used and will be removed in a future version. */
73
152
  declare type ControlledModalProps = {
74
153
  visible: boolean;
75
154
  onClose: () => void;
@@ -84,6 +163,7 @@ declare interface ConversationContentProps {
84
163
  topBar?: React.ReactNode;
85
164
  disableCanvas?: boolean;
86
165
  enableSpeechToText?: boolean;
166
+ children?: React.ReactNode;
87
167
  }
88
168
 
89
169
  export { CreateFlowParam }
@@ -128,6 +208,8 @@ declare type DataTableState = {
128
208
  filters: TableFilters;
129
209
  };
130
210
 
211
+ export { DirectAuthProvider }
212
+
131
213
  declare type DisplayControlProps = {
132
214
  /** Whether to display the recommendations section when the input is active */
133
215
  showRecommendations?: boolean;
@@ -139,9 +221,7 @@ declare type DisplayControlProps = {
139
221
 
140
222
  export declare const DomWrapper: React.FC<PropsWithChildren<DomWrapperProps>>;
141
223
 
142
- declare type DomWrapperProps = {
143
- display?: string;
144
- };
224
+ declare type DomWrapperProps = InternalColorSwatchProps;
145
225
 
146
226
  export declare const DownloadDataReportButton: React.FC<{
147
227
  reportId: number;
@@ -158,6 +238,10 @@ declare type ExportReportDataResult = {
158
238
  data: Blob | string;
159
239
  };
160
240
 
241
+ export { ExternalAuthProvider }
242
+
243
+ export { ExternalAuthProviderConfig }
244
+
161
245
  declare type ExtractInsightResponse = z.infer<typeof ExtractInsightResponseSchema>;
162
246
 
163
247
  declare const ExtractInsightResponseSchema: z.ZodUnion<[z.ZodObject<{
@@ -209,7 +293,6 @@ declare const FrontendReportColumnsSchema: z.ZodArray<z.ZodObject<{
209
293
  declare type FrontendReportExplainability = z.infer<typeof FrontendReportExplainabilitySchema>;
210
294
 
211
295
  declare const FrontendReportExplainabilitySchema: z.ZodObject<{
212
- flow_data_id: z.ZodNumber;
213
296
  sql_explanation: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
214
297
  chunk_title: z.ZodString;
215
298
  chunk_explanation: z.ZodString;
@@ -257,6 +340,7 @@ declare const FrontendReportExplainabilitySchema: z.ZodObject<{
257
340
  assumptions_score_reason: z.ZodOptional<z.ZodString>;
258
341
  friendliness_score: z.ZodOptional<z.ZodNumber>;
259
342
  friendliness_score_reason: z.ZodOptional<z.ZodString>;
343
+ flow_data_id: z.ZodNumber;
260
344
  }, z.core.$strip>;
261
345
 
262
346
  declare const FrontendReportSchema: z.ZodObject<{
@@ -267,7 +351,14 @@ declare const FrontendReportSchema: z.ZodObject<{
267
351
  created_at: z.ZodString;
268
352
  is_removed: z.ZodBoolean;
269
353
  flow_id: z.ZodString;
270
- bookmarked: z.ZodBoolean;
354
+ is_materialized: z.ZodNullable<z.ZodBoolean>;
355
+ last_materialized_at: z.ZodNullable<z.ZodString>;
356
+ materialized_error_message: z.ZodNullable<z.ZodString>;
357
+ materialized_status: z.ZodNullable<z.ZodEnum<{
358
+ running: "running";
359
+ completed: "completed";
360
+ failed: "failed";
361
+ }>>;
271
362
  data_summary: z.ZodObject<{
272
363
  columns: z.ZodRecord<z.ZodString, z.ZodObject<{
273
364
  position: z.ZodOptional<z.ZodNumber>;
@@ -275,8 +366,19 @@ declare const FrontendReportSchema: z.ZodObject<{
275
366
  null_count: z.ZodNullable<z.ZodNumber>;
276
367
  unique_count: z.ZodNullable<z.ZodNumber>;
277
368
  unique_percentage: z.ZodNullable<z.ZodNumber>;
369
+ min_value: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
370
+ max_value: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
371
+ avg_value: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
372
+ median_value: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
373
+ std_value: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
374
+ min_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
375
+ max_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
376
+ min_length: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
377
+ max_length: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
378
+ avg_length: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
278
379
  }, z.core.$loose>>;
279
380
  }, z.core.$loose>;
381
+ bookmarked: z.ZodBoolean;
280
382
  }, z.core.$strip>;
281
383
 
282
384
  declare type FrontendVisualization = z.output<typeof FrontendVisualizationSchema>;
@@ -284,8 +386,18 @@ declare type FrontendVisualization = z.output<typeof FrontendVisualizationSchema
284
386
  declare const FrontendVisualizationSchema: z.ZodObject<{
285
387
  id: z.ZodNumber;
286
388
  created_at: z.ZodString;
287
- flow_data_id: z.ZodNumber;
288
389
  bookmarked: z.ZodBoolean;
390
+ flow_data_id: z.ZodNumber;
391
+ flow_data: z.ZodOptional<z.ZodObject<{
392
+ is_materialized: z.ZodNullable<z.ZodBoolean>;
393
+ last_materialized_at: z.ZodNullable<z.ZodString>;
394
+ materialized_error_message: z.ZodNullable<z.ZodString>;
395
+ materialized_status: z.ZodNullable<z.ZodEnum<{
396
+ running: "running";
397
+ completed: "completed";
398
+ failed: "failed";
399
+ }>>;
400
+ }, z.core.$strip>>;
289
401
  configuration: z.ZodDiscriminatedUnion<[z.ZodObject<{
290
402
  config_version: z.ZodLiteral<2>;
291
403
  xAxisLabel: z.ZodString;
@@ -344,6 +456,21 @@ declare type InfiniteDataTableUIProps = {
344
456
  totalRows: number;
345
457
  };
346
458
 
459
+ declare const InputContainer: default_2.FC<{
460
+ children?: default_2.ReactNode | ((context: ChatInputContextValue) => default_2.ReactNode);
461
+ }>;
462
+
463
+ /**
464
+ * Internal/relaxed type for passing color props through component trees.
465
+ * Use this for internal components; use ColorSwatchOptions for external APIs.
466
+ */
467
+ declare type InternalColorSwatchProps = {
468
+ primaryColor?: string;
469
+ primarySwatch?: PrimaryColorSwatch;
470
+ secondaryColor?: string;
471
+ secondarySwatch?: SecondaryColorSwatch;
472
+ };
473
+
347
474
  export declare const logout: () => void;
348
475
 
349
476
  export { MageMetricsClient }
@@ -376,7 +503,7 @@ declare type MageMetricsPublicContextProviderProps = PropsWithChildren<Pick<Mage
376
503
 
377
504
  export declare const ManagedModal: React.FC<ManagedModalProps>;
378
505
 
379
- declare interface ManagedModalProps extends ModalProps {
506
+ declare type ManagedModalBaseProps = ModalProps & {
380
507
  /** API key for authenticating with the MageMetrics service */
381
508
  apiKey: string;
382
509
  /** External JWT token for user authentication */
@@ -393,10 +520,42 @@ declare interface ManagedModalProps extends ModalProps {
393
520
  components?: Components;
394
521
  /** Application name to associate with flows created through this modal */
395
522
  applicationName?: string;
396
- }
523
+ /**
524
+ * Appearance configuration for customizing the visual style.
525
+ * Includes brand colors and modal-specific styling options.
526
+ */
527
+ appearance?: AppearanceConfig;
528
+ /** Callbacks for various events */
529
+ callbacks?: {
530
+ /** Callback fired when the conversation modal is opened */
531
+ onConversationOpen?: () => void;
532
+ };
533
+ };
534
+
535
+ /**
536
+ * Props for ManagedModal component.
537
+ */
538
+ declare type ManagedModalProps = ManagedModalBaseProps;
539
+
540
+ declare const MessagesContainer: default_2.FC;
541
+
542
+ /**
543
+ * Modal-specific appearance configuration.
544
+ */
545
+ export declare type ModalAppearance = {
546
+ /**
547
+ * Primary color for modal background gradient.
548
+ * Used to customize the mesh gradient background in conversation modals.
549
+ * Can be any CSS color (hex, rgb, hsl, oklch, etc.).
550
+ */
551
+ backgroundPrimary?: string;
552
+ };
397
553
 
398
554
  declare interface ModalProps {
399
- /** Control modal visibility and close behavior externally */
555
+ /**
556
+ * @deprecated This prop is no longer used and will be removed in a future version.
557
+ * Control modal visibility and close behavior externally
558
+ */
400
559
  modal?: ControlledModalProps;
401
560
  /** Configuration options for the start modal (chat launcher, recommendations, etc.) */
402
561
  startOptions?: StartOptions;
@@ -435,12 +594,44 @@ declare type PaginatedDataTableUIProps = {
435
594
 
436
595
  declare type PersistenceOptions = "queryParam" | "none";
437
596
 
597
+ /**
598
+ * Primary color shade stops used in the UI.
599
+ */
600
+ declare const PRIMARY_SHADE_STOPS: readonly ["50", "400", "500", "600", "650", "750", "900"];
601
+
602
+ /**
603
+ * Primary color options - mutually exclusive: use either primaryColor OR primarySwatch, not both.
604
+ */
605
+ declare type PrimaryColorOption = {
606
+ primaryColor: string;
607
+ primarySwatch?: never;
608
+ } | {
609
+ primaryColor?: never;
610
+ primarySwatch: PrimaryColorSwatch;
611
+ } | {
612
+ primaryColor?: never;
613
+ primarySwatch?: never;
614
+ };
615
+
616
+ declare type PrimaryColorShade = (typeof PRIMARY_SHADE_STOPS)[number];
617
+
618
+ /** Complete primary swatch (7 shades required) */
619
+ export declare type PrimaryColorSwatch = Record<PrimaryColorShade, string>;
620
+
438
621
  export declare const PublicCanvas: React.FC<React.ComponentProps<typeof PublicCanvasPanel>>;
439
622
 
440
623
  declare const PublicCanvasPanel: default_2.FC<{
441
624
  canvasId: string;
442
625
  }>;
443
626
 
627
+ export declare type PublicChatProps = Omit<ConversationContentProps, "children"> & {
628
+ /**
629
+ * Appearance configuration for customizing the visual style.
630
+ * Includes brand colors and modal-specific styling options.
631
+ */
632
+ appearance?: AppearanceConfig;
633
+ };
634
+
444
635
  /**
445
636
  * This component is not bounded in height and must be wrapped in a container to properly work
446
637
  * @param props - props
@@ -465,9 +656,33 @@ declare type ReportDataFilters = {
465
656
  cursor?: number;
466
657
  };
467
658
 
659
+ /**
660
+ * Secondary color shade stops used in the UI.
661
+ */
662
+ declare const SECONDARY_SHADE_STOPS: readonly ["500", "600", "700"];
663
+
664
+ /**
665
+ * Secondary color options - mutually exclusive: use either secondaryColor OR secondarySwatch, not both.
666
+ */
667
+ declare type SecondaryColorOption = {
668
+ secondaryColor: string;
669
+ secondarySwatch?: never;
670
+ } | {
671
+ secondaryColor?: never;
672
+ secondarySwatch: SecondaryColorSwatch;
673
+ } | {
674
+ secondaryColor?: never;
675
+ secondarySwatch?: never;
676
+ };
677
+
678
+ declare type SecondaryColorShade = (typeof SECONDARY_SHADE_STOPS)[number];
679
+
680
+ /** Complete secondary swatch (3 shades required) */
681
+ export declare type SecondaryColorSwatch = Record<SecondaryColorShade, string>;
682
+
468
683
  declare type SortingState = ColumnSort[];
469
684
 
470
- export declare const StandaloneConversationModal: React.FC<StandaloneConversationModalProps>;
685
+ export declare const StandaloneConversationModal: default_2.FC<StandaloneConversationModalProps>;
471
686
 
472
687
  declare type StandaloneConversationModalProps = {
473
688
  opened: boolean;
@@ -475,6 +690,7 @@ declare type StandaloneConversationModalProps = {
475
690
  disableCanvas?: boolean;
476
691
  showDataFreshness?: boolean;
477
692
  onOpenChange?: (open: boolean) => void;
693
+ appearance?: AppearanceConfig;
478
694
  };
479
695
 
480
696
  declare type StartOptions = DisplayControlProps & {
@@ -490,6 +706,10 @@ declare type StartOptions = DisplayControlProps & {
490
706
 
491
707
  declare type TableFilters = Record<string, string | number>;
492
708
 
709
+ export declare const useChatContext: () => ChatContextValue;
710
+
711
+ export declare const useChatInputContext: () => ChatInputContextValue;
712
+
493
713
  export declare const useCreateFlow: (options?: UseMutationOptions<{
494
714
  flowId: string;
495
715
  }, Error, CreateFlowParam>) => {
@@ -1008,8 +1228,18 @@ declare type V1FrontendVisualization = z.output<typeof V1FrontendVisualizationSc
1008
1228
  declare const V1FrontendVisualizationSchema: z.ZodObject<{
1009
1229
  id: z.ZodNumber;
1010
1230
  created_at: z.ZodString;
1011
- flow_data_id: z.ZodNumber;
1012
1231
  bookmarked: z.ZodBoolean;
1232
+ flow_data_id: z.ZodNumber;
1233
+ flow_data: z.ZodOptional<z.ZodObject<{
1234
+ is_materialized: z.ZodNullable<z.ZodBoolean>;
1235
+ last_materialized_at: z.ZodNullable<z.ZodString>;
1236
+ materialized_error_message: z.ZodNullable<z.ZodString>;
1237
+ materialized_status: z.ZodNullable<z.ZodEnum<{
1238
+ running: "running";
1239
+ completed: "completed";
1240
+ failed: "failed";
1241
+ }>>;
1242
+ }, z.core.$strip>>;
1013
1243
  configuration: z.ZodDiscriminatedUnion<[z.ZodObject<{
1014
1244
  xAxisLabel: z.ZodString;
1015
1245
  yAxisLabel: z.ZodString;