guideai-app 0.3.3 → 0.3.5
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 +138 -257
- package/dist/GuideAI.js +1 -1
- package/dist/GuideAI.js.map +1 -1
- package/dist/metric/event-listner.d.ts +19 -0
- package/dist/metric/metadata-tracker.d.ts +8 -0
- package/dist/utils/constants.d.ts +1 -1
- package/metadata-tracking-example.md +324 -0
- package/obfuscate.js +40 -0
- package/obfuscator.prod.json +24 -0
- package/package.json +1 -1
- package/structure.md +128 -0
- package/text-input-usage.md +321 -0
- package/transcript-toggle-usage.md +267 -0
- package/visit-tracking-usage.md +134 -0
package/README.md
CHANGED
|
@@ -1,321 +1,202 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Guide AI
|
|
2
2
|
|
|
3
|
-
A React component that provides
|
|
3
|
+
A React component that provides AI-powered guidance with voice interaction, text input, and element highlighting capabilities.
|
|
4
4
|
|
|
5
|
-
##
|
|
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
|
-
|
|
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
|
|
13
|
+
## Usage
|
|
25
14
|
|
|
26
15
|
```jsx
|
|
27
|
-
import React from 'react';
|
|
28
16
|
import GuideAI from 'guideai-app';
|
|
29
17
|
|
|
30
18
|
function App() {
|
|
31
19
|
return (
|
|
32
20
|
<div>
|
|
33
|
-
<h1>My Website</h1>
|
|
34
|
-
<p>Welcome to my site!</p>
|
|
35
|
-
|
|
36
21
|
<GuideAI
|
|
37
22
|
organizationKey="your-organization-key"
|
|
38
|
-
|
|
23
|
+
position={{ bottom: '2rem', right: '2rem' }}
|
|
24
|
+
onError={(error) => console.error(error)}
|
|
39
25
|
/>
|
|
40
26
|
</div>
|
|
41
27
|
);
|
|
42
28
|
}
|
|
43
29
|
```
|
|
44
30
|
|
|
45
|
-
|
|
31
|
+
## Props
|
|
46
32
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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) |
|
|
50
40
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
);
|
|
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;
|
|
86
56
|
}
|
|
87
57
|
```
|
|
88
58
|
|
|
89
|
-
|
|
59
|
+
### Transcript Configuration Object
|
|
90
60
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
|
96
|
-
|
|
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
|
-
}}
|
|
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
|
+
}
|
|
121
67
|
```
|
|
122
68
|
|
|
123
|
-
###
|
|
69
|
+
### Input Configuration Object
|
|
124
70
|
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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
|
+
}
|
|
130
78
|
```
|
|
131
79
|
|
|
132
|
-
###
|
|
80
|
+
### Examples
|
|
133
81
|
|
|
82
|
+
**Basic usage:**
|
|
134
83
|
```jsx
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}}
|
|
84
|
+
<GuideAI
|
|
85
|
+
organizationKey="your-org-key"
|
|
86
|
+
position={{ bottom: '4rem', left: '50%', marginLeft: '-30px' }}
|
|
87
|
+
/>
|
|
140
88
|
```
|
|
141
89
|
|
|
142
|
-
|
|
143
|
-
|
|
90
|
+
**With text input enabled by default:**
|
|
144
91
|
```jsx
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
trackInteractions: boolean // Track user interactions
|
|
154
|
-
}
|
|
155
|
-
}}
|
|
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
|
+
/>
|
|
156
100
|
```
|
|
157
101
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
### Transcript Display
|
|
176
|
-
- Real-time conversation transcript
|
|
177
|
-
- Toggle visibility with the transcript button
|
|
178
|
-
- Message timestamps and sender identification
|
|
179
|
-
|
|
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();
|
|
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
|
+
/>
|
|
202
118
|
```
|
|
203
119
|
|
|
204
|
-
|
|
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
|
-
```
|
|
120
|
+
## Text Input Feature
|
|
236
121
|
|
|
237
|
-
|
|
122
|
+
GuideAI now supports both voice and text input modes, giving users flexible ways to interact with the AI assistant.
|
|
238
123
|
|
|
239
|
-
|
|
124
|
+
### Features
|
|
240
125
|
|
|
241
|
-
|
|
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
|
|
242
132
|
|
|
243
|
-
|
|
244
|
-
// Top-right corner
|
|
245
|
-
<GuideAI
|
|
246
|
-
organizationKey="your-key"
|
|
247
|
-
position={{ top: '20px', right: '20px' }}
|
|
248
|
-
/>
|
|
133
|
+
### Input Props
|
|
249
134
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
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 |
|
|
255
141
|
|
|
256
|
-
|
|
257
|
-
<GuideAI
|
|
258
|
-
organizationKey="your-key"
|
|
259
|
-
position={{
|
|
260
|
-
top: '50%',
|
|
261
|
-
right: '20px',
|
|
262
|
-
transform: 'translateY(-50%)'
|
|
263
|
-
}}
|
|
264
|
-
/>
|
|
265
|
-
```
|
|
142
|
+
### How to Use Text Input
|
|
266
143
|
|
|
267
|
-
|
|
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
|
|
268
149
|
|
|
269
|
-
|
|
150
|
+
### Accessibility Features
|
|
270
151
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
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
|
-
```
|
|
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
|
|
283
156
|
|
|
284
|
-
##
|
|
157
|
+
## Transcript Feature
|
|
285
158
|
|
|
286
|
-
|
|
287
|
-
- User data is handled according to privacy standards
|
|
288
|
-
- No sensitive information is logged or stored locally
|
|
289
|
-
- 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.
|
|
290
160
|
|
|
291
|
-
|
|
161
|
+
### Features
|
|
292
162
|
|
|
293
|
-
-
|
|
294
|
-
-
|
|
295
|
-
-
|
|
296
|
-
-
|
|
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
|
|
297
169
|
|
|
298
|
-
|
|
170
|
+
### How to Use
|
|
299
171
|
|
|
300
|
-
|
|
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
|
|
301
178
|
|
|
302
|
-
|
|
303
|
-
git clone <repository>
|
|
304
|
-
cd guide-ai-package
|
|
305
|
-
npm install
|
|
306
|
-
npm run build
|
|
307
|
-
```
|
|
179
|
+
### Transcript Interface
|
|
308
180
|
|
|
309
|
-
|
|
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
|
|
310
186
|
|
|
311
|
-
|
|
312
|
-
npm run dev # Start development server
|
|
313
|
-
```
|
|
187
|
+
### Styling
|
|
314
188
|
|
|
315
|
-
|
|
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
|
|
316
194
|
|
|
317
|
-
|
|
195
|
+
## Migration from Voice-Only Versions
|
|
318
196
|
|
|
319
|
-
|
|
197
|
+
If you're upgrading from a voice-only version:
|
|
320
198
|
|
|
321
|
-
|
|
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
|