guideai-app 0.3.1 → 0.3.2

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/README.md CHANGED
@@ -1,310 +1,202 @@
1
- # GuideAI - AI-Powered Guide Component
1
+ # Guide AI
2
2
 
3
- A React component that provides an AI-powered guide assistant for any webpage. Features voice and text conversation, element highlighting, and conversation persistence.
3
+ A React component that provides AI-powered guidance with voice interaction, text input, and element highlighting capabilities.
4
4
 
5
- ## 🚀 Quick Start
6
-
7
- ### 1. Install the Package
5
+ ## Installation
8
6
 
9
7
  ```bash
10
8
  npm install guideai-app
9
+ # or
10
+ yarn add guideai-app
11
11
  ```
12
12
 
13
- ### 2. Basic Usage
13
+ ## Usage
14
14
 
15
15
  ```jsx
16
- import React from 'react';
17
16
  import GuideAI from 'guideai-app';
18
17
 
19
18
  function App() {
20
19
  return (
21
20
  <div>
22
- <h1>My Website</h1>
23
- <p>Welcome to my site!</p>
24
-
25
21
  <GuideAI
26
22
  organizationKey="your-organization-key"
27
- onError={(error, context) => console.error('GuideAI Error:', error, context)}
23
+ position={{ bottom: '2rem', right: '2rem' }}
24
+ onError={(error) => console.error(error)}
28
25
  />
29
26
  </div>
30
27
  );
31
28
  }
32
29
  ```
33
30
 
34
- ### 3. Advanced Configuration
31
+ ## Props
35
32
 
36
- ```jsx
37
- import React from 'react';
38
- import GuideAI from 'guideai-app';
33
+ | Prop | Type | Required | Description |
34
+ |------|------|----------|-------------|
35
+ | `organizationKey` | `string` | Yes | Your organization key for workflows |
36
+ | `position` | `object` | No | Positioning configuration for the component |
37
+ | `onError` | `function` | No | Error handler callback |
38
+ | `transcript` | `object` | No | Transcript feature configuration |
39
+ | `input` | `object` | No | Input mode configuration (voice/text) |
39
40
 
40
- function App() {
41
- return (
42
- <div>
43
- <h1>My Website</h1>
44
-
45
- <GuideAI
46
- organizationKey="your-organization-key"
47
- position={{
48
- bottom: '20px',
49
- right: '20px'
50
- }}
51
- onError={(error, context) => console.error('GuideAI Error:', error, context)}
52
- transcript={{
53
- enabled: true,
54
- showToggleButton: true
55
- }}
56
- input={{
57
- defaultMode: 'voice', // 'voice' or 'text'
58
- enableTextInput: true,
59
- placeholder: "Type your message..."
60
- }}
61
- metadata={{
62
- initialUserData: {
63
- userId: 'user123',
64
- organizationKey: 'your-org',
65
- userType: 'customer'
66
- },
67
- config: {
68
- trackVisits: true,
69
- trackInteractions: true
70
- }
71
- }}
72
- />
73
- </div>
74
- );
41
+ ### Position Object
42
+
43
+ The `position` prop accepts an object with CSS positioning properties:
44
+
45
+ ```typescript
46
+ position?: {
47
+ top?: string;
48
+ right?: string;
49
+ bottom?: string;
50
+ left?: string;
51
+ marginTop?: string;
52
+ marginRight?: string;
53
+ marginBottom?: string;
54
+ marginLeft?: string;
55
+ transform?: string;
75
56
  }
76
57
  ```
77
58
 
78
- ## 📋 Props Reference
79
-
80
- ### Required Props
59
+ ### Transcript Configuration Object
81
60
 
82
- | Prop | Type | Description |
83
- |------|------|-------------|
84
- | `organizationKey` | `string` | Your organization's unique identifier |
85
-
86
- ### Optional Props
87
-
88
- | Prop | Type | Default | Description |
89
- |------|------|---------|-------------|
90
- | `position` | `object` | `{ bottom: '20px', right: '20px' }` | CSS positioning for the component |
91
- | `onError` | `function` | `console.error` | Error handler function |
92
- | `transcript` | `object` | `{ enabled: true, showToggleButton: true }` | Transcript display options |
93
- | `input` | `object` | `{ defaultMode: 'voice', enableTextInput: true }` | Input mode configuration |
94
- | `metadata` | `object` | `{}` | User metadata and tracking options |
95
-
96
- ### Position Object
97
-
98
- ```jsx
99
- position={{
100
- top?: string, // e.g., '20px'
101
- right?: string, // e.g., '20px'
102
- bottom?: string, // e.g., '20px'
103
- left?: string, // e.g., '20px'
104
- marginTop?: string, // e.g., '10px'
105
- marginRight?: string,
106
- marginBottom?: string,
107
- marginLeft?: string,
108
- transform?: string // e.g., 'translateY(-50%)'
109
- }}
61
+ ```typescript
62
+ transcript?: {
63
+ enabled?: boolean; // Show transcript (default: true)
64
+ showToggleButton?: boolean; // Show transcript toggle (default: true)
65
+ position?: 'right' | 'left' | 'top' | 'bottom'; // Transcript position
66
+ }
110
67
  ```
111
68
 
112
- ### Transcript Options
69
+ ### Input Configuration Object
113
70
 
114
- ```jsx
115
- transcript={{
116
- enabled: boolean, // Show transcript by default
117
- showToggleButton: boolean // Show toggle button for transcript
118
- }}
71
+ ```typescript
72
+ input?: {
73
+ enableTextInput?: boolean; // Enable text input (default: true)
74
+ showInputToggle?: boolean; // Show mode toggle button (default: true)
75
+ defaultMode?: 'voice' | 'text'; // Default input mode (default: 'voice')
76
+ placeholder?: string; // Text input placeholder
77
+ }
119
78
  ```
120
79
 
121
- ### Input Options
80
+ ### Examples
122
81
 
82
+ **Basic usage:**
123
83
  ```jsx
124
- input={{
125
- defaultMode: 'voice' | 'text', // Default input mode
126
- enableTextInput: boolean, // Enable text input option
127
- placeholder: string // Text input placeholder
128
- }}
84
+ <GuideAI
85
+ organizationKey="your-org-key"
86
+ position={{ bottom: '4rem', left: '50%', marginLeft: '-30px' }}
87
+ />
129
88
  ```
130
89
 
131
- ### Metadata Options
132
-
90
+ **With text input enabled by default:**
133
91
  ```jsx
134
- metadata={{
135
- initialUserData: {
136
- userId: string, // User identifier
137
- organizationKey: string, // Organization key
138
- userType: string // User type (e.g., 'customer', 'admin')
139
- },
140
- config: {
141
- trackVisits: boolean, // Track page visits
142
- trackInteractions: boolean // Track user interactions
143
- }
144
- }}
92
+ <GuideAI
93
+ organizationKey="your-org-key"
94
+ position={{ top: '20px', right: '20px' }}
95
+ input={{
96
+ defaultMode: 'text',
97
+ placeholder: "Ask me anything..."
98
+ }}
99
+ />
145
100
  ```
146
101
 
147
- ## 🎯 Features
148
-
149
- ### Voice & Text Conversation
150
- - **Voice Mode**: Click the microphone to start voice conversation
151
- - **Text Mode**: Type messages directly in the text input
152
- - **Toggle**: Switch between voice and text modes
153
-
154
- ### Conversation Persistence
155
- - Conversations are automatically saved and restored on page refresh
156
- - Messages persist for 30 minutes by default
157
- - Seamless conversation continuation
158
-
159
- ### Element Highlighting
160
- - AI can highlight and interact with page elements
161
- - Visual cursor guidance for user actions
162
- - Support for CSS selectors and XPath
163
-
164
- ### Transcript Display
165
- - Real-time conversation transcript
166
- - Toggle visibility with the transcript button
167
- - Message timestamps and sender identification
168
-
169
- ### User Tracking
170
- - Visit tracking and analytics
171
- - User interaction monitoring
172
- - Metadata collection and syncing
173
-
174
- ## 🔧 API Methods
175
-
176
- The component exposes several methods through the global `window.GuideAI` object:
177
-
178
- ### Transcript Control
179
- ```javascript
180
- // Toggle transcript visibility
181
- window.GuideAI.transcript.toggle();
182
-
183
- // Show transcript
184
- window.GuideAI.transcript.show();
185
-
186
- // Hide transcript
187
- window.GuideAI.transcript.hide();
188
-
189
- // Check if transcript is visible
190
- const isVisible = window.GuideAI.transcript.isVisible();
102
+ **Full configuration:**
103
+ ```jsx
104
+ <GuideAI
105
+ organizationKey="your-organization-key"
106
+ position={{ bottom: '2rem', right: '2rem' }}
107
+ transcript={{
108
+ enabled: true,
109
+ showToggleButton: true
110
+ }}
111
+ input={{
112
+ enableTextInput: true,
113
+ defaultMode: 'voice',
114
+ placeholder: "Type your message..."
115
+ }}
116
+ onError={(error) => console.error(error)}
117
+ />
191
118
  ```
192
119
 
193
- ### Metadata Tracking
194
- ```javascript
195
- // Track user login
196
- window.GuideAI.metadata.trackLogin({
197
- userId: 'user123',
198
- userType: 'customer'
199
- });
200
-
201
- // Update user information
202
- window.GuideAI.metadata.updateUserInfo({
203
- userId: 'user123',
204
- preferences: { theme: 'dark' }
205
- });
206
-
207
- // Track custom events
208
- window.GuideAI.metadata.trackCustomEvent('button_click', {
209
- buttonId: 'submit',
210
- page: 'checkout'
211
- });
212
-
213
- // Get current metadata
214
- const metadata = window.GuideAI.metadata.getMetadata();
215
-
216
- // Force sync metadata
217
- await window.GuideAI.metadata.syncMetadata();
218
-
219
- // Reset session tracking (call on login)
220
- window.GuideAI.metadata.resetSessionVisitTracking();
221
-
222
- // Manually track a visit
223
- window.GuideAI.metadata.trackVisitManually();
224
- ```
120
+ ## Text Input Feature
225
121
 
226
- ## 🎨 Styling
122
+ GuideAI now supports both voice and text input modes, giving users flexible ways to interact with the AI assistant.
227
123
 
228
- The component includes its own styles and will automatically inject them. The component uses fixed positioning by default and will appear in the bottom-right corner.
124
+ ### Features
229
125
 
230
- ### Custom Positioning Examples
126
+ - **Dual Input Modes**: Switch seamlessly between voice and text input
127
+ - **Text Input Interface**: Clean text area integrated into the transcript box
128
+ - **Input Mode Toggle**: Dedicated button to switch between voice and text modes
129
+ - **Real-time Text Chat**: Type messages and receive AI responses instantly
130
+ - **Keyboard Shortcuts**: Press Enter to send messages quickly
131
+ - **Auto-enabled**: Text input is enabled by default for better accessibility
231
132
 
232
- ```jsx
233
- // Top-right corner
234
- <GuideAI
235
- organizationKey="your-key"
236
- position={{ top: '20px', right: '20px' }}
237
- />
133
+ ### Input Props
238
134
 
239
- // Bottom-left corner
240
- <GuideAI
241
- organizationKey="your-key"
242
- position={{ bottom: '20px', left: '20px' }}
243
- />
135
+ | Prop | Type | Default | Description |
136
+ |------|------|---------|-------------|
137
+ | `enableTextInput` | boolean | `true` | Enable text input functionality |
138
+ | `showInputToggle` | boolean | `true` | Show the voice/text mode toggle button |
139
+ | `defaultMode` | `'voice' \| 'text'` | `'voice'` | Default input mode when conversation starts |
140
+ | `placeholder` | string | `"Type your message..."` | Placeholder text for the text input field |
244
141
 
245
- // Centered on the right
246
- <GuideAI
247
- organizationKey="your-key"
248
- position={{
249
- top: '50%',
250
- right: '20px',
251
- transform: 'translateY(-50%)'
252
- }}
253
- />
254
- ```
142
+ ### How to Use Text Input
255
143
 
256
- ## 🚨 Error Handling
144
+ 1. **Start a Conversation**: Click the GuideAI button to begin
145
+ 2. **Switch to Text Mode**: Click the toggle button next to the main GuideAI button
146
+ 3. **Type Your Message**: Use the text area at the bottom of the transcript box
147
+ 4. **Send Message**: Press Enter or click the send button
148
+ 5. **Switch Back**: Click the toggle button again to return to voice mode
257
149
 
258
- The component includes comprehensive error handling:
150
+ ### Accessibility Features
259
151
 
260
- ```jsx
261
- <GuideAI
262
- organizationKey="your-key"
263
- onError={(error, context) => {
264
- console.error('GuideAI Error:', error);
265
- console.log('Context:', context);
266
-
267
- // Send to your error tracking service
268
- // analytics.track('guideai_error', { error, context });
269
- }}
270
- />
271
- ```
152
+ - **Keyboard Navigation**: Full keyboard support for text input
153
+ - **Default Enabled**: Text input works out of the box without configuration
154
+ - **Fallback Support**: Automatically enables text mode if microphone access is denied
155
+ - **Visual Indicators**: Clear visual feedback for active input mode
272
156
 
273
- ## 🔒 Security
157
+ ## Transcript Feature
274
158
 
275
- - All API calls are made to secure endpoints
276
- - User data is handled according to privacy standards
277
- - No sensitive information is logged or stored locally
278
- - Conversations are encrypted in transit
159
+ GuideAI includes a beautiful transcript interface that displays conversations between users and the AI in a transparent Apple-style box.
279
160
 
280
- ## 📱 Browser Support
161
+ ### Features
281
162
 
282
- - Chrome 88+
283
- - Firefox 85+
284
- - Safari 14+
285
- - Edge 88+
163
+ - **Glassmorphism Design**: Transparent background with backdrop blur effects
164
+ - **Apple-style Interface**: Clean, modern design inspired by Apple's UI principles
165
+ - **Real-time Updates**: Messages appear as they're exchanged
166
+ - **Timestamps**: Each message shows when it was sent
167
+ - **Auto-scroll**: Automatically scrolls to the latest messages
168
+ - **Responsive**: Works perfectly on all device sizes
286
169
 
287
- ## 🛠️ Development
170
+ ### How to Use
288
171
 
289
- ### Building from Source
172
+ 1. Start a conversation with GuideAI by clicking the microphone button
173
+ 2. The transcript automatically appears as an overlay when the conversation begins
174
+ 3. The transcript shows all messages with clear visual distinction between user and AI messages
175
+ 4. Messages appear in real-time as the conversation progresses
176
+ 5. Click the "×" button or click outside the transcript to close it
177
+ 6. The transcript automatically closes when the conversation ends
290
178
 
291
- ```bash
292
- git clone <repository>
293
- cd guide-ai-package
294
- npm install
295
- npm run build
296
- ```
179
+ ### Transcript Interface
297
180
 
298
- ### Testing
181
+ The transcript interface includes:
182
+ - **Header**: Shows "Conversation Transcript" with a close button
183
+ - **Messages**: Chat-like interface with different styles for user and AI messages
184
+ - **Timestamps**: Each message displays the time it was sent
185
+ - **Footer**: Shows the total number of messages in the conversation
299
186
 
300
- ```bash
301
- npm run dev # Start development server
302
- ```
187
+ ### Styling
303
188
 
304
- ## 📄 License
189
+ The transcript uses modern CSS features including:
190
+ - `backdrop-filter: blur()` for the glassmorphism effect
191
+ - CSS animations for smooth transitions
192
+ - Responsive design that adapts to different screen sizes
193
+ - Custom scrollbar styling for a polished look
305
194
 
306
- ISC License
195
+ ## Migration from Voice-Only Versions
307
196
 
308
- ## 🤝 Support
197
+ If you're upgrading from a voice-only version:
309
198
 
310
- For support and questions, please refer to the documentation or contact the development team.
199
+ - **No Breaking Changes**: Existing implementations continue to work unchanged
200
+ - **Text Input Enabled**: Text input is now available by default
201
+ - **Disable if Needed**: Set `input={{ enableTextInput: false }}` to disable text input
202
+ - **Voice Still Default**: Voice mode remains the default interaction method