aizek-chatbot 1.0.10 → 1.0.11

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/index.d.mts CHANGED
@@ -9,10 +9,115 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
9
9
 
10
10
  declare const Button: React$1.ForwardRefExoticComponent<ButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
11
11
 
12
+ interface UITextField {
13
+ type: "text";
14
+ value: string;
15
+ }
16
+ interface UIImageField {
17
+ type: "image";
18
+ src: string;
19
+ alt?: string;
20
+ }
21
+ interface UILinkField {
22
+ type: "link";
23
+ label: string;
24
+ href: string;
25
+ }
26
+ interface UIBadgeField {
27
+ type: "badge";
28
+ label: string;
29
+ tone?: "success" | "warning" | "danger" | "info" | "neutral";
30
+ }
31
+ interface UIListField {
32
+ type: "list";
33
+ items: UIField[];
34
+ }
35
+ type UIField = UITextField | UIImageField | UILinkField | UIBadgeField | UIListField;
36
+ type UIComponentType = "form" | "buttons" | "table" | "card";
37
+ interface UIFormField {
38
+ id: string;
39
+ name: string;
40
+ label: string;
41
+ placeholder?: string;
42
+ type: "text" | "select" | "number";
43
+ required?: boolean;
44
+ validation?: string;
45
+ options?: {
46
+ label: string;
47
+ value: string;
48
+ }[];
49
+ value?: string | number;
50
+ min?: number;
51
+ max?: number;
52
+ }
53
+ interface UIFormData {
54
+ id: string;
55
+ title?: string;
56
+ fields: UIFormField[];
57
+ submitLabel?: string;
58
+ }
59
+ interface UIButtonData {
60
+ label: string;
61
+ value: string;
62
+ variant?: "primary" | "secondary" | "danger";
63
+ }
64
+ interface UITableColumn {
65
+ id?: string;
66
+ key?: string;
67
+ label: string;
68
+ type?: "image" | "text" | "badge";
69
+ }
70
+ interface UITableData {
71
+ caption?: string;
72
+ columns: UITableColumn[] | string[];
73
+ rows: Array<Record<string, UIField | string>> | string[][];
74
+ }
75
+ interface UICardItem {
76
+ id?: string;
77
+ title?: string;
78
+ subtitle?: string;
79
+ image?: string;
80
+ label?: string;
81
+ value?: string;
82
+ }
83
+ interface UICardField {
84
+ label: string;
85
+ value: string;
86
+ }
87
+ interface UICardData {
88
+ title?: string;
89
+ description?: string;
90
+ image?: string;
91
+ status?: string;
92
+ subtitle?: string;
93
+ fields?: UICardField[];
94
+ attributes?: UICardField[];
95
+ items?: UICardItem[];
96
+ [key: string]: any;
97
+ }
98
+ interface UIComponentBase {
99
+ id?: string;
100
+ type: UIComponentType;
101
+ }
102
+ type UIComponent = (UIComponentBase & {
103
+ type: "form";
104
+ data: UIFormData;
105
+ }) | (UIComponentBase & {
106
+ type: "buttons";
107
+ data: UIButtonData[];
108
+ }) | (UIComponentBase & {
109
+ type: "table";
110
+ data: UITableData;
111
+ }) | (UIComponentBase & {
112
+ type: "card";
113
+ data: UICardData;
114
+ });
115
+
12
116
  interface Message {
13
117
  id: string;
14
- content: string;
15
- role: 'user' | 'assistant';
118
+ text?: string;
119
+ ui?: UIComponent[];
120
+ role: 'user' | 'assistant' | 'approval';
16
121
  timestamp: Date;
17
122
  isTyping?: boolean;
18
123
  }
@@ -47,8 +152,11 @@ interface UseChatbotOptions {
47
152
  declare const useChatbot: (options?: UseChatbotOptions) => {
48
153
  messages: Message[];
49
154
  isLoading: boolean;
50
- sendMessage: (message: string) => Promise<void>;
51
- addMessage: (content: string, role: "user" | "assistant") => Message;
155
+ sendMessage: (message: string, approval?: boolean) => Promise<void>;
156
+ addMessage: (payload: {
157
+ text?: string;
158
+ ui?: UIComponent[];
159
+ }, role: "user" | "assistant" | "approval") => Message;
52
160
  };
53
161
 
54
162
  export { AizekChatBot, type AizekChatBotProps, type BackendConfig, Button, type ButtonProps, type ButtonSize, type ButtonVariant, type Message, type UseChatbotOptions, useChatbot };
package/dist/index.d.ts CHANGED
@@ -9,10 +9,115 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
9
9
 
10
10
  declare const Button: React$1.ForwardRefExoticComponent<ButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
11
11
 
12
+ interface UITextField {
13
+ type: "text";
14
+ value: string;
15
+ }
16
+ interface UIImageField {
17
+ type: "image";
18
+ src: string;
19
+ alt?: string;
20
+ }
21
+ interface UILinkField {
22
+ type: "link";
23
+ label: string;
24
+ href: string;
25
+ }
26
+ interface UIBadgeField {
27
+ type: "badge";
28
+ label: string;
29
+ tone?: "success" | "warning" | "danger" | "info" | "neutral";
30
+ }
31
+ interface UIListField {
32
+ type: "list";
33
+ items: UIField[];
34
+ }
35
+ type UIField = UITextField | UIImageField | UILinkField | UIBadgeField | UIListField;
36
+ type UIComponentType = "form" | "buttons" | "table" | "card";
37
+ interface UIFormField {
38
+ id: string;
39
+ name: string;
40
+ label: string;
41
+ placeholder?: string;
42
+ type: "text" | "select" | "number";
43
+ required?: boolean;
44
+ validation?: string;
45
+ options?: {
46
+ label: string;
47
+ value: string;
48
+ }[];
49
+ value?: string | number;
50
+ min?: number;
51
+ max?: number;
52
+ }
53
+ interface UIFormData {
54
+ id: string;
55
+ title?: string;
56
+ fields: UIFormField[];
57
+ submitLabel?: string;
58
+ }
59
+ interface UIButtonData {
60
+ label: string;
61
+ value: string;
62
+ variant?: "primary" | "secondary" | "danger";
63
+ }
64
+ interface UITableColumn {
65
+ id?: string;
66
+ key?: string;
67
+ label: string;
68
+ type?: "image" | "text" | "badge";
69
+ }
70
+ interface UITableData {
71
+ caption?: string;
72
+ columns: UITableColumn[] | string[];
73
+ rows: Array<Record<string, UIField | string>> | string[][];
74
+ }
75
+ interface UICardItem {
76
+ id?: string;
77
+ title?: string;
78
+ subtitle?: string;
79
+ image?: string;
80
+ label?: string;
81
+ value?: string;
82
+ }
83
+ interface UICardField {
84
+ label: string;
85
+ value: string;
86
+ }
87
+ interface UICardData {
88
+ title?: string;
89
+ description?: string;
90
+ image?: string;
91
+ status?: string;
92
+ subtitle?: string;
93
+ fields?: UICardField[];
94
+ attributes?: UICardField[];
95
+ items?: UICardItem[];
96
+ [key: string]: any;
97
+ }
98
+ interface UIComponentBase {
99
+ id?: string;
100
+ type: UIComponentType;
101
+ }
102
+ type UIComponent = (UIComponentBase & {
103
+ type: "form";
104
+ data: UIFormData;
105
+ }) | (UIComponentBase & {
106
+ type: "buttons";
107
+ data: UIButtonData[];
108
+ }) | (UIComponentBase & {
109
+ type: "table";
110
+ data: UITableData;
111
+ }) | (UIComponentBase & {
112
+ type: "card";
113
+ data: UICardData;
114
+ });
115
+
12
116
  interface Message {
13
117
  id: string;
14
- content: string;
15
- role: 'user' | 'assistant';
118
+ text?: string;
119
+ ui?: UIComponent[];
120
+ role: 'user' | 'assistant' | 'approval';
16
121
  timestamp: Date;
17
122
  isTyping?: boolean;
18
123
  }
@@ -47,8 +152,11 @@ interface UseChatbotOptions {
47
152
  declare const useChatbot: (options?: UseChatbotOptions) => {
48
153
  messages: Message[];
49
154
  isLoading: boolean;
50
- sendMessage: (message: string) => Promise<void>;
51
- addMessage: (content: string, role: "user" | "assistant") => Message;
155
+ sendMessage: (message: string, approval?: boolean) => Promise<void>;
156
+ addMessage: (payload: {
157
+ text?: string;
158
+ ui?: UIComponent[];
159
+ }, role: "user" | "assistant" | "approval") => Message;
52
160
  };
53
161
 
54
162
  export { AizekChatBot, type AizekChatBotProps, type BackendConfig, Button, type ButtonProps, type ButtonSize, type ButtonVariant, type Message, type UseChatbotOptions, useChatbot };