guideai-app 0.3.0 → 0.3.3
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 +257 -138
- package/dist/GuideAI.js +1 -1
- package/dist/GuideAI.js.map +1 -1
- package/dist/components/TranscriptBox.d.ts +1 -1
- package/dist/metric/metadata-tracker.d.ts +4 -1
- package/dist/utils/api.d.ts +1 -3
- package/package.json +1 -1
- package/components/Styles.d.ts +0 -3
- package/metadata-tracking-example.md +0 -324
- package/obfuscate.js +0 -40
- package/obfuscator.prod.json +0 -24
- package/structure.md +0 -128
- package/text-input-usage.md +0 -321
- package/transcript-toggle-usage.md +0 -267
- package/types/index.d.ts +0 -24
package/README.md
CHANGED
|
@@ -1,202 +1,321 @@
|
|
|
1
|
-
# Guide
|
|
1
|
+
# GuideAI - AI-Powered Guide Component
|
|
2
2
|
|
|
3
|
-
A React component that provides AI-powered
|
|
3
|
+
A React component that provides an AI-powered guide assistant for any webpage. Features voice and text conversation, element highlighting, and conversation persistence.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 🚀 Quick Start
|
|
6
|
+
|
|
7
|
+
### 1. Install the Package
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
10
|
npm install guideai-app
|
|
9
|
-
# or
|
|
10
|
-
yarn add guideai-app
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
### 2. Environment Variables (Optional)
|
|
14
|
+
|
|
15
|
+
If you plan to use Gemini AI features, set the following environment variable:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# In your .env file or environment
|
|
19
|
+
GEMINI_API_KEY=your_gemini_api_key_here
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Note**: The package will work without this key, but some AI features may be limited.
|
|
23
|
+
|
|
24
|
+
### 3. Basic Usage
|
|
14
25
|
|
|
15
26
|
```jsx
|
|
27
|
+
import React from 'react';
|
|
16
28
|
import GuideAI from 'guideai-app';
|
|
17
29
|
|
|
18
30
|
function App() {
|
|
19
31
|
return (
|
|
20
32
|
<div>
|
|
33
|
+
<h1>My Website</h1>
|
|
34
|
+
<p>Welcome to my site!</p>
|
|
35
|
+
|
|
21
36
|
<GuideAI
|
|
22
37
|
organizationKey="your-organization-key"
|
|
23
|
-
|
|
24
|
-
onError={(error) => console.error(error)}
|
|
38
|
+
onError={(error, context) => console.error('GuideAI Error:', error, context)}
|
|
25
39
|
/>
|
|
26
40
|
</div>
|
|
27
41
|
);
|
|
28
42
|
}
|
|
29
43
|
```
|
|
30
44
|
|
|
31
|
-
|
|
32
|
-
|
|
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) |
|
|
45
|
+
### 4. Advanced Configuration
|
|
40
46
|
|
|
41
|
-
|
|
47
|
+
```jsx
|
|
48
|
+
import React from 'react';
|
|
49
|
+
import GuideAI from 'guideai-app';
|
|
42
50
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
function App() {
|
|
52
|
+
return (
|
|
53
|
+
<div>
|
|
54
|
+
<h1>My Website</h1>
|
|
55
|
+
|
|
56
|
+
<GuideAI
|
|
57
|
+
organizationKey="your-organization-key"
|
|
58
|
+
position={{
|
|
59
|
+
bottom: '20px',
|
|
60
|
+
right: '20px'
|
|
61
|
+
}}
|
|
62
|
+
onError={(error, context) => console.error('GuideAI Error:', error, context)}
|
|
63
|
+
transcript={{
|
|
64
|
+
enabled: true,
|
|
65
|
+
showToggleButton: true
|
|
66
|
+
}}
|
|
67
|
+
input={{
|
|
68
|
+
defaultMode: 'voice', // 'voice' or 'text'
|
|
69
|
+
enableTextInput: true,
|
|
70
|
+
placeholder: "Type your message..."
|
|
71
|
+
}}
|
|
72
|
+
metadata={{
|
|
73
|
+
initialUserData: {
|
|
74
|
+
userId: 'user123',
|
|
75
|
+
organizationKey: 'your-org',
|
|
76
|
+
userType: 'customer'
|
|
77
|
+
},
|
|
78
|
+
config: {
|
|
79
|
+
trackVisits: true,
|
|
80
|
+
trackInteractions: true
|
|
81
|
+
}
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
85
|
+
);
|
|
56
86
|
}
|
|
57
87
|
```
|
|
58
88
|
|
|
59
|
-
|
|
89
|
+
## 📋 Props Reference
|
|
60
90
|
|
|
61
|
-
|
|
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
|
-
}
|
|
67
|
-
```
|
|
91
|
+
### Required Props
|
|
68
92
|
|
|
69
|
-
|
|
93
|
+
| Prop | Type | Description |
|
|
94
|
+
|------|------|-------------|
|
|
95
|
+
| `organizationKey` | `string` | Your organization's unique identifier |
|
|
70
96
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
97
|
+
### Optional Props
|
|
98
|
+
|
|
99
|
+
| Prop | Type | Default | Description |
|
|
100
|
+
|------|------|---------|-------------|
|
|
101
|
+
| `position` | `object` | `{ bottom: '20px', right: '20px' }` | CSS positioning for the component |
|
|
102
|
+
| `onError` | `function` | `console.error` | Error handler function |
|
|
103
|
+
| `transcript` | `object` | `{ enabled: true, showToggleButton: true }` | Transcript display options |
|
|
104
|
+
| `input` | `object` | `{ defaultMode: 'voice', enableTextInput: true }` | Input mode configuration |
|
|
105
|
+
| `metadata` | `object` | `{}` | User metadata and tracking options |
|
|
106
|
+
|
|
107
|
+
### Position Object
|
|
108
|
+
|
|
109
|
+
```jsx
|
|
110
|
+
position={{
|
|
111
|
+
top?: string, // e.g., '20px'
|
|
112
|
+
right?: string, // e.g., '20px'
|
|
113
|
+
bottom?: string, // e.g., '20px'
|
|
114
|
+
left?: string, // e.g., '20px'
|
|
115
|
+
marginTop?: string, // e.g., '10px'
|
|
116
|
+
marginRight?: string,
|
|
117
|
+
marginBottom?: string,
|
|
118
|
+
marginLeft?: string,
|
|
119
|
+
transform?: string // e.g., 'translateY(-50%)'
|
|
120
|
+
}}
|
|
78
121
|
```
|
|
79
122
|
|
|
80
|
-
###
|
|
123
|
+
### Transcript Options
|
|
81
124
|
|
|
82
|
-
**Basic usage:**
|
|
83
125
|
```jsx
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
126
|
+
transcript={{
|
|
127
|
+
enabled: boolean, // Show transcript by default
|
|
128
|
+
showToggleButton: boolean // Show toggle button for transcript
|
|
129
|
+
}}
|
|
88
130
|
```
|
|
89
131
|
|
|
90
|
-
|
|
132
|
+
### Input Options
|
|
133
|
+
|
|
91
134
|
```jsx
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
input
|
|
96
|
-
|
|
97
|
-
placeholder: "Ask me anything..."
|
|
98
|
-
}}
|
|
99
|
-
/>
|
|
135
|
+
input={{
|
|
136
|
+
defaultMode: 'voice' | 'text', // Default input mode
|
|
137
|
+
enableTextInput: boolean, // Enable text input option
|
|
138
|
+
placeholder: string // Text input placeholder
|
|
139
|
+
}}
|
|
100
140
|
```
|
|
101
141
|
|
|
102
|
-
|
|
142
|
+
### Metadata Options
|
|
143
|
+
|
|
103
144
|
```jsx
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}}
|
|
116
|
-
onError={(error) => console.error(error)}
|
|
117
|
-
/>
|
|
145
|
+
metadata={{
|
|
146
|
+
initialUserData: {
|
|
147
|
+
userId: string, // User identifier
|
|
148
|
+
organizationKey: string, // Organization key
|
|
149
|
+
userType: string // User type (e.g., 'customer', 'admin')
|
|
150
|
+
},
|
|
151
|
+
config: {
|
|
152
|
+
trackVisits: boolean, // Track page visits
|
|
153
|
+
trackInteractions: boolean // Track user interactions
|
|
154
|
+
}
|
|
155
|
+
}}
|
|
118
156
|
```
|
|
119
157
|
|
|
120
|
-
##
|
|
158
|
+
## 🎯 Features
|
|
121
159
|
|
|
122
|
-
|
|
160
|
+
### Voice & Text Conversation
|
|
161
|
+
- **Voice Mode**: Click the microphone to start voice conversation
|
|
162
|
+
- **Text Mode**: Type messages directly in the text input
|
|
163
|
+
- **Toggle**: Switch between voice and text modes
|
|
123
164
|
|
|
124
|
-
###
|
|
165
|
+
### Conversation Persistence
|
|
166
|
+
- Conversations are automatically saved and restored on page refresh
|
|
167
|
+
- Messages persist for 30 minutes by default
|
|
168
|
+
- Seamless conversation continuation
|
|
125
169
|
|
|
126
|
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
129
|
-
-
|
|
130
|
-
- **Keyboard Shortcuts**: Press Enter to send messages quickly
|
|
131
|
-
- **Auto-enabled**: Text input is enabled by default for better accessibility
|
|
170
|
+
### Element Highlighting
|
|
171
|
+
- AI can highlight and interact with page elements
|
|
172
|
+
- Visual cursor guidance for user actions
|
|
173
|
+
- Support for CSS selectors and XPath
|
|
132
174
|
|
|
133
|
-
###
|
|
175
|
+
### Transcript Display
|
|
176
|
+
- Real-time conversation transcript
|
|
177
|
+
- Toggle visibility with the transcript button
|
|
178
|
+
- Message timestamps and sender identification
|
|
134
179
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
180
|
+
### User Tracking
|
|
181
|
+
- Visit tracking and analytics
|
|
182
|
+
- User interaction monitoring
|
|
183
|
+
- Metadata collection and syncing
|
|
184
|
+
|
|
185
|
+
## 🔧 API Methods
|
|
186
|
+
|
|
187
|
+
The component exposes several methods through the global `window.GuideAI` object:
|
|
188
|
+
|
|
189
|
+
### Transcript Control
|
|
190
|
+
```javascript
|
|
191
|
+
// Toggle transcript visibility
|
|
192
|
+
window.GuideAI.transcript.toggle();
|
|
193
|
+
|
|
194
|
+
// Show transcript
|
|
195
|
+
window.GuideAI.transcript.show();
|
|
196
|
+
|
|
197
|
+
// Hide transcript
|
|
198
|
+
window.GuideAI.transcript.hide();
|
|
199
|
+
|
|
200
|
+
// Check if transcript is visible
|
|
201
|
+
const isVisible = window.GuideAI.transcript.isVisible();
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Metadata Tracking
|
|
205
|
+
```javascript
|
|
206
|
+
// Track user login
|
|
207
|
+
window.GuideAI.metadata.trackLogin({
|
|
208
|
+
userId: 'user123',
|
|
209
|
+
userType: 'customer'
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
// Update user information
|
|
213
|
+
window.GuideAI.metadata.updateUserInfo({
|
|
214
|
+
userId: 'user123',
|
|
215
|
+
preferences: { theme: 'dark' }
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
// Track custom events
|
|
219
|
+
window.GuideAI.metadata.trackCustomEvent('button_click', {
|
|
220
|
+
buttonId: 'submit',
|
|
221
|
+
page: 'checkout'
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
// Get current metadata
|
|
225
|
+
const metadata = window.GuideAI.metadata.getMetadata();
|
|
226
|
+
|
|
227
|
+
// Force sync metadata
|
|
228
|
+
await window.GuideAI.metadata.syncMetadata();
|
|
229
|
+
|
|
230
|
+
// Reset session tracking (call on login)
|
|
231
|
+
window.GuideAI.metadata.resetSessionVisitTracking();
|
|
232
|
+
|
|
233
|
+
// Manually track a visit
|
|
234
|
+
window.GuideAI.metadata.trackVisitManually();
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## 🎨 Styling
|
|
238
|
+
|
|
239
|
+
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.
|
|
240
|
+
|
|
241
|
+
### Custom Positioning Examples
|
|
242
|
+
|
|
243
|
+
```jsx
|
|
244
|
+
// Top-right corner
|
|
245
|
+
<GuideAI
|
|
246
|
+
organizationKey="your-key"
|
|
247
|
+
position={{ top: '20px', right: '20px' }}
|
|
248
|
+
/>
|
|
141
249
|
|
|
142
|
-
|
|
250
|
+
// Bottom-left corner
|
|
251
|
+
<GuideAI
|
|
252
|
+
organizationKey="your-key"
|
|
253
|
+
position={{ bottom: '20px', left: '20px' }}
|
|
254
|
+
/>
|
|
143
255
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
256
|
+
// Centered on the right
|
|
257
|
+
<GuideAI
|
|
258
|
+
organizationKey="your-key"
|
|
259
|
+
position={{
|
|
260
|
+
top: '50%',
|
|
261
|
+
right: '20px',
|
|
262
|
+
transform: 'translateY(-50%)'
|
|
263
|
+
}}
|
|
264
|
+
/>
|
|
265
|
+
```
|
|
149
266
|
|
|
150
|
-
|
|
267
|
+
## 🚨 Error Handling
|
|
151
268
|
|
|
152
|
-
|
|
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
|
|
269
|
+
The component includes comprehensive error handling:
|
|
156
270
|
|
|
157
|
-
|
|
271
|
+
```jsx
|
|
272
|
+
<GuideAI
|
|
273
|
+
organizationKey="your-key"
|
|
274
|
+
onError={(error, context) => {
|
|
275
|
+
console.error('GuideAI Error:', error);
|
|
276
|
+
console.log('Context:', context);
|
|
277
|
+
|
|
278
|
+
// Send to your error tracking service
|
|
279
|
+
// analytics.track('guideai_error', { error, context });
|
|
280
|
+
}}
|
|
281
|
+
/>
|
|
282
|
+
```
|
|
158
283
|
|
|
159
|
-
|
|
284
|
+
## 🔒 Security
|
|
160
285
|
|
|
161
|
-
|
|
286
|
+
- All API calls are made to secure endpoints
|
|
287
|
+
- User data is handled according to privacy standards
|
|
288
|
+
- No sensitive information is logged or stored locally
|
|
289
|
+
- Conversations are encrypted in transit
|
|
162
290
|
|
|
163
|
-
|
|
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
|
|
291
|
+
## 📱 Browser Support
|
|
169
292
|
|
|
170
|
-
|
|
293
|
+
- Chrome 88+
|
|
294
|
+
- Firefox 85+
|
|
295
|
+
- Safari 14+
|
|
296
|
+
- Edge 88+
|
|
171
297
|
|
|
172
|
-
|
|
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
|
|
298
|
+
## 🛠️ Development
|
|
178
299
|
|
|
179
|
-
###
|
|
300
|
+
### Building from Source
|
|
180
301
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
302
|
+
```bash
|
|
303
|
+
git clone <repository>
|
|
304
|
+
cd guide-ai-package
|
|
305
|
+
npm install
|
|
306
|
+
npm run build
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Testing
|
|
186
310
|
|
|
187
|
-
|
|
311
|
+
```bash
|
|
312
|
+
npm run dev # Start development server
|
|
313
|
+
```
|
|
188
314
|
|
|
189
|
-
|
|
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
|
|
315
|
+
## 📄 License
|
|
194
316
|
|
|
195
|
-
|
|
317
|
+
ISC License
|
|
196
318
|
|
|
197
|
-
|
|
319
|
+
## 🤝 Support
|
|
198
320
|
|
|
199
|
-
|
|
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
|
|
321
|
+
For support and questions, please refer to the documentation or contact the development team.
|