@magemetrics/ai 0.5.4 → 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.
- package/dist/react/ai.js +10277 -9849
- package/dist/react/index.d.ts +200 -7
- package/dist/styles.css +1 -1
- package/dist/web-component/index.d.ts +200 -7
- package/dist/web-component/web-component.es.js +25720 -25266
- package/package.json +3 -3
|
@@ -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<
|
|
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,25 @@ 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
|
+
|
|
73
151
|
/** @deprecated This type is no longer used and will be removed in a future version. */
|
|
74
152
|
declare type ControlledModalProps = {
|
|
75
153
|
visible: boolean;
|
|
@@ -85,6 +163,7 @@ declare interface ConversationContentProps {
|
|
|
85
163
|
topBar?: React.ReactNode;
|
|
86
164
|
disableCanvas?: boolean;
|
|
87
165
|
enableSpeechToText?: boolean;
|
|
166
|
+
children?: React.ReactNode;
|
|
88
167
|
}
|
|
89
168
|
|
|
90
169
|
export { CreateFlowParam }
|
|
@@ -129,6 +208,8 @@ declare type DataTableState = {
|
|
|
129
208
|
filters: TableFilters;
|
|
130
209
|
};
|
|
131
210
|
|
|
211
|
+
export { DirectAuthProvider }
|
|
212
|
+
|
|
132
213
|
declare type DisplayControlProps = {
|
|
133
214
|
/** Whether to display the recommendations section when the input is active */
|
|
134
215
|
showRecommendations?: boolean;
|
|
@@ -140,9 +221,7 @@ declare type DisplayControlProps = {
|
|
|
140
221
|
|
|
141
222
|
export declare const DomWrapper: React.FC<PropsWithChildren<DomWrapperProps>>;
|
|
142
223
|
|
|
143
|
-
declare type DomWrapperProps =
|
|
144
|
-
display?: string;
|
|
145
|
-
};
|
|
224
|
+
declare type DomWrapperProps = InternalColorSwatchProps;
|
|
146
225
|
|
|
147
226
|
export declare const DownloadDataReportButton: React.FC<{
|
|
148
227
|
reportId: number;
|
|
@@ -159,6 +238,10 @@ declare type ExportReportDataResult = {
|
|
|
159
238
|
data: Blob | string;
|
|
160
239
|
};
|
|
161
240
|
|
|
241
|
+
export { ExternalAuthProvider }
|
|
242
|
+
|
|
243
|
+
export { ExternalAuthProviderConfig }
|
|
244
|
+
|
|
162
245
|
declare type ExtractInsightResponse = z.infer<typeof ExtractInsightResponseSchema>;
|
|
163
246
|
|
|
164
247
|
declare const ExtractInsightResponseSchema: z.ZodUnion<[z.ZodObject<{
|
|
@@ -283,6 +366,16 @@ declare const FrontendReportSchema: z.ZodObject<{
|
|
|
283
366
|
null_count: z.ZodNullable<z.ZodNumber>;
|
|
284
367
|
unique_count: z.ZodNullable<z.ZodNumber>;
|
|
285
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>>;
|
|
286
379
|
}, z.core.$loose>>;
|
|
287
380
|
}, z.core.$loose>;
|
|
288
381
|
bookmarked: z.ZodBoolean;
|
|
@@ -363,6 +456,21 @@ declare type InfiniteDataTableUIProps = {
|
|
|
363
456
|
totalRows: number;
|
|
364
457
|
};
|
|
365
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
|
+
|
|
366
474
|
export declare const logout: () => void;
|
|
367
475
|
|
|
368
476
|
export { MageMetricsClient }
|
|
@@ -395,7 +503,7 @@ declare type MageMetricsPublicContextProviderProps = PropsWithChildren<Pick<Mage
|
|
|
395
503
|
|
|
396
504
|
export declare const ManagedModal: React.FC<ManagedModalProps>;
|
|
397
505
|
|
|
398
|
-
declare
|
|
506
|
+
declare type ManagedModalBaseProps = ModalProps & {
|
|
399
507
|
/** API key for authenticating with the MageMetrics service */
|
|
400
508
|
apiKey: string;
|
|
401
509
|
/** External JWT token for user authentication */
|
|
@@ -412,12 +520,36 @@ declare interface ManagedModalProps extends ModalProps {
|
|
|
412
520
|
components?: Components;
|
|
413
521
|
/** Application name to associate with flows created through this modal */
|
|
414
522
|
applicationName?: string;
|
|
523
|
+
/**
|
|
524
|
+
* Appearance configuration for customizing the visual style.
|
|
525
|
+
* Includes brand colors and modal-specific styling options.
|
|
526
|
+
*/
|
|
527
|
+
appearance?: AppearanceConfig;
|
|
415
528
|
/** Callbacks for various events */
|
|
416
529
|
callbacks?: {
|
|
417
530
|
/** Callback fired when the conversation modal is opened */
|
|
418
531
|
onConversationOpen?: () => void;
|
|
419
532
|
};
|
|
420
|
-
}
|
|
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
|
+
};
|
|
421
553
|
|
|
422
554
|
declare interface ModalProps {
|
|
423
555
|
/**
|
|
@@ -462,12 +594,44 @@ declare type PaginatedDataTableUIProps = {
|
|
|
462
594
|
|
|
463
595
|
declare type PersistenceOptions = "queryParam" | "none";
|
|
464
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
|
+
|
|
465
621
|
export declare const PublicCanvas: React.FC<React.ComponentProps<typeof PublicCanvasPanel>>;
|
|
466
622
|
|
|
467
623
|
declare const PublicCanvasPanel: default_2.FC<{
|
|
468
624
|
canvasId: string;
|
|
469
625
|
}>;
|
|
470
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
|
+
|
|
471
635
|
/**
|
|
472
636
|
* This component is not bounded in height and must be wrapped in a container to properly work
|
|
473
637
|
* @param props - props
|
|
@@ -492,9 +656,33 @@ declare type ReportDataFilters = {
|
|
|
492
656
|
cursor?: number;
|
|
493
657
|
};
|
|
494
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
|
+
|
|
495
683
|
declare type SortingState = ColumnSort[];
|
|
496
684
|
|
|
497
|
-
export declare const StandaloneConversationModal:
|
|
685
|
+
export declare const StandaloneConversationModal: default_2.FC<StandaloneConversationModalProps>;
|
|
498
686
|
|
|
499
687
|
declare type StandaloneConversationModalProps = {
|
|
500
688
|
opened: boolean;
|
|
@@ -502,6 +690,7 @@ declare type StandaloneConversationModalProps = {
|
|
|
502
690
|
disableCanvas?: boolean;
|
|
503
691
|
showDataFreshness?: boolean;
|
|
504
692
|
onOpenChange?: (open: boolean) => void;
|
|
693
|
+
appearance?: AppearanceConfig;
|
|
505
694
|
};
|
|
506
695
|
|
|
507
696
|
declare type StartOptions = DisplayControlProps & {
|
|
@@ -517,6 +706,10 @@ declare type StartOptions = DisplayControlProps & {
|
|
|
517
706
|
|
|
518
707
|
declare type TableFilters = Record<string, string | number>;
|
|
519
708
|
|
|
709
|
+
export declare const useChatContext: () => ChatContextValue;
|
|
710
|
+
|
|
711
|
+
export declare const useChatInputContext: () => ChatInputContextValue;
|
|
712
|
+
|
|
520
713
|
export declare const useCreateFlow: (options?: UseMutationOptions<{
|
|
521
714
|
flowId: string;
|
|
522
715
|
}, Error, CreateFlowParam>) => {
|