guideai-app 0.2.9 → 0.3.1
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 +246 -138
- package/dist/GuideAI.js +1 -1
- package/dist/GuideAI.js.map +1 -1
- package/dist/utils/api.d.ts +1 -3
- package/package.json +1 -1
- 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/README.md
CHANGED
|
@@ -1,202 +1,310 @@
|
|
|
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. Basic Usage
|
|
14
14
|
|
|
15
15
|
```jsx
|
|
16
|
+
import React from 'react';
|
|
16
17
|
import GuideAI from 'guideai-app';
|
|
17
18
|
|
|
18
19
|
function App() {
|
|
19
20
|
return (
|
|
20
21
|
<div>
|
|
22
|
+
<h1>My Website</h1>
|
|
23
|
+
<p>Welcome to my site!</p>
|
|
24
|
+
|
|
21
25
|
<GuideAI
|
|
22
26
|
organizationKey="your-organization-key"
|
|
23
|
-
|
|
24
|
-
onError={(error) => console.error(error)}
|
|
27
|
+
onError={(error, context) => console.error('GuideAI Error:', error, context)}
|
|
25
28
|
/>
|
|
26
29
|
</div>
|
|
27
30
|
);
|
|
28
31
|
}
|
|
29
32
|
```
|
|
30
33
|
|
|
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) |
|
|
34
|
+
### 3. Advanced Configuration
|
|
40
35
|
|
|
41
|
-
|
|
36
|
+
```jsx
|
|
37
|
+
import React from 'react';
|
|
38
|
+
import GuideAI from 'guideai-app';
|
|
42
39
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
+
);
|
|
56
75
|
}
|
|
57
76
|
```
|
|
58
77
|
|
|
59
|
-
|
|
78
|
+
## 📋 Props Reference
|
|
60
79
|
|
|
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
|
-
```
|
|
80
|
+
### Required Props
|
|
68
81
|
|
|
69
|
-
|
|
82
|
+
| Prop | Type | Description |
|
|
83
|
+
|------|------|-------------|
|
|
84
|
+
| `organizationKey` | `string` | Your organization's unique identifier |
|
|
70
85
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
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
|
+
}}
|
|
78
110
|
```
|
|
79
111
|
|
|
80
|
-
###
|
|
112
|
+
### Transcript Options
|
|
81
113
|
|
|
82
|
-
**Basic usage:**
|
|
83
114
|
```jsx
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
115
|
+
transcript={{
|
|
116
|
+
enabled: boolean, // Show transcript by default
|
|
117
|
+
showToggleButton: boolean // Show toggle button for transcript
|
|
118
|
+
}}
|
|
88
119
|
```
|
|
89
120
|
|
|
90
|
-
|
|
121
|
+
### Input Options
|
|
122
|
+
|
|
91
123
|
```jsx
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
input
|
|
96
|
-
|
|
97
|
-
placeholder: "Ask me anything..."
|
|
98
|
-
}}
|
|
99
|
-
/>
|
|
124
|
+
input={{
|
|
125
|
+
defaultMode: 'voice' | 'text', // Default input mode
|
|
126
|
+
enableTextInput: boolean, // Enable text input option
|
|
127
|
+
placeholder: string // Text input placeholder
|
|
128
|
+
}}
|
|
100
129
|
```
|
|
101
130
|
|
|
102
|
-
|
|
131
|
+
### Metadata Options
|
|
132
|
+
|
|
103
133
|
```jsx
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}}
|
|
116
|
-
onError={(error) => console.error(error)}
|
|
117
|
-
/>
|
|
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
|
+
}}
|
|
118
145
|
```
|
|
119
146
|
|
|
120
|
-
##
|
|
147
|
+
## 🎯 Features
|
|
121
148
|
|
|
122
|
-
|
|
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
|
|
123
153
|
|
|
124
|
-
###
|
|
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
|
|
125
158
|
|
|
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
|
|
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
|
|
132
163
|
|
|
133
|
-
###
|
|
164
|
+
### Transcript Display
|
|
165
|
+
- Real-time conversation transcript
|
|
166
|
+
- Toggle visibility with the transcript button
|
|
167
|
+
- Message timestamps and sender identification
|
|
134
168
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
| `defaultMode` | `'voice' \| 'text'` | `'voice'` | Default input mode when conversation starts |
|
|
140
|
-
| `placeholder` | string | `"Type your message..."` | Placeholder text for the text input field |
|
|
169
|
+
### User Tracking
|
|
170
|
+
- Visit tracking and analytics
|
|
171
|
+
- User interaction monitoring
|
|
172
|
+
- Metadata collection and syncing
|
|
141
173
|
|
|
142
|
-
|
|
174
|
+
## 🔧 API Methods
|
|
143
175
|
|
|
144
|
-
|
|
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
|
|
176
|
+
The component exposes several methods through the global `window.GuideAI` object:
|
|
149
177
|
|
|
150
|
-
###
|
|
178
|
+
### Transcript Control
|
|
179
|
+
```javascript
|
|
180
|
+
// Toggle transcript visibility
|
|
181
|
+
window.GuideAI.transcript.toggle();
|
|
151
182
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
- **Fallback Support**: Automatically enables text mode if microphone access is denied
|
|
155
|
-
- **Visual Indicators**: Clear visual feedback for active input mode
|
|
183
|
+
// Show transcript
|
|
184
|
+
window.GuideAI.transcript.show();
|
|
156
185
|
|
|
157
|
-
|
|
186
|
+
// Hide transcript
|
|
187
|
+
window.GuideAI.transcript.hide();
|
|
158
188
|
|
|
159
|
-
|
|
189
|
+
// Check if transcript is visible
|
|
190
|
+
const isVisible = window.GuideAI.transcript.isVisible();
|
|
191
|
+
```
|
|
192
|
+
|
|
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
|
+
```
|
|
160
225
|
|
|
161
|
-
|
|
226
|
+
## 🎨 Styling
|
|
162
227
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
-
|
|
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.
|
|
229
|
+
|
|
230
|
+
### Custom Positioning Examples
|
|
231
|
+
|
|
232
|
+
```jsx
|
|
233
|
+
// Top-right corner
|
|
234
|
+
<GuideAI
|
|
235
|
+
organizationKey="your-key"
|
|
236
|
+
position={{ top: '20px', right: '20px' }}
|
|
237
|
+
/>
|
|
169
238
|
|
|
170
|
-
|
|
239
|
+
// Bottom-left corner
|
|
240
|
+
<GuideAI
|
|
241
|
+
organizationKey="your-key"
|
|
242
|
+
position={{ bottom: '20px', left: '20px' }}
|
|
243
|
+
/>
|
|
171
244
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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
|
+
```
|
|
178
255
|
|
|
179
|
-
|
|
256
|
+
## 🚨 Error Handling
|
|
180
257
|
|
|
181
|
-
The
|
|
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
|
|
258
|
+
The component includes comprehensive error handling:
|
|
186
259
|
|
|
187
|
-
|
|
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
|
+
```
|
|
272
|
+
|
|
273
|
+
## 🔒 Security
|
|
274
|
+
|
|
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
|
|
279
|
+
|
|
280
|
+
## 📱 Browser Support
|
|
281
|
+
|
|
282
|
+
- Chrome 88+
|
|
283
|
+
- Firefox 85+
|
|
284
|
+
- Safari 14+
|
|
285
|
+
- Edge 88+
|
|
286
|
+
|
|
287
|
+
## 🛠️ Development
|
|
288
|
+
|
|
289
|
+
### Building from Source
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
git clone <repository>
|
|
293
|
+
cd guide-ai-package
|
|
294
|
+
npm install
|
|
295
|
+
npm run build
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Testing
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
npm run dev # Start development server
|
|
302
|
+
```
|
|
188
303
|
|
|
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
|
|
304
|
+
## 📄 License
|
|
194
305
|
|
|
195
|
-
|
|
306
|
+
ISC License
|
|
196
307
|
|
|
197
|
-
|
|
308
|
+
## 🤝 Support
|
|
198
309
|
|
|
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
|
|
310
|
+
For support and questions, please refer to the documentation or contact the development team.
|