guideai-app 0.4.2 → 0.4.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 +69 -254
- package/dist/GuideAI.js +1 -1
- package/dist/GuideAI.js.map +1 -1
- package/dist/components/Microphone.d.ts +17 -0
- package/dist/components/TranscriptBox.d.ts +4 -1
- package/dist/components/TranscriptMessages.d.ts +8 -0
- package/dist/components/TranscriptTextInput.d.ts +10 -0
- package/dist/components/TranscriptToggle.d.ts +10 -0
- package/dist/index.d.ts +1 -1
- package/dist/metric/event-listner.d.ts +143 -0
- package/dist/styles/GuideAI.styles.d.ts +1 -1
- package/dist/types/GuideAI.types.d.ts +17 -13
- package/dist/utils/api.d.ts +4 -3
- package/dist/utils/constants.d.ts +5 -2
- package/dist/utils/elementInteractions.d.ts +6 -2
- package/dist/utils/gemini.d.ts +3 -1
- package/dist/utils/highlightAndClick.d.ts +3 -0
- package/dist/utils/highlightThenClick.d.ts +2 -1
- package/dist/utils/hoverAndClick.d.ts +4 -0
- package/dist/utils/hoverThenClick.d.ts +2 -1
- package/dist/utils/logger.d.ts +6 -5
- package/dist/utils/ui.d.ts +1 -1
- package/package.json +13 -1
- package/API_DATA_CONTRACTS.md +0 -516
- package/API_SESSIONID_TESTING.md +0 -215
- package/GuideAI.d.ts +0 -19
- package/GuideAI.js +0 -1
- package/GuideAI.js.LICENSE.txt +0 -16
- package/GuideAI.js.map +0 -1
- package/PII_HASHING_EPIC.md +0 -886
- package/PII_HASHING_STORIES_SUMMARY.md +0 -275
- package/SESSION_ID_VERIFICATION.md +0 -122
- package/VISIT_COUNT_TESTING.md +0 -453
- package/index.d.ts +0 -7
- package/jest.config.js +0 -26
- package/jest.setup.js +0 -21
- package/metadata-tracking-example.md +0 -324
- package/obfuscate.js +0 -40
- package/obfuscator.prod.json +0 -24
- package/rollup.config.js +0 -34
- package/structure.md +0 -128
- package/text-input-usage.md +0 -321
- package/transcript-toggle-usage.md +0 -267
- package/visit-tracking-usage.md +0 -134
- package/webpack.config.js +0 -55
- package/workflow-trigger-usage.md +0 -398
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Guide AI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An AI-powered voice assistant component for React applications. Guide AI provides intelligent voice interactions, helping users navigate and complete tasks within your application.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -10,29 +10,11 @@ npm install guideai-app
|
|
|
10
10
|
yarn add guideai-app
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
### Basic Usage
|
|
16
|
-
|
|
17
|
-
```jsx
|
|
18
|
-
import GuideAI from 'guideai-app';
|
|
19
|
-
|
|
20
|
-
function App() {
|
|
21
|
-
return (
|
|
22
|
-
<div>
|
|
23
|
-
<GuideAI
|
|
24
|
-
organizationKey="your-organization-key"
|
|
25
|
-
position={{ bottom: '2rem', right: '2rem' }}
|
|
26
|
-
onError={(error) => console.error(error)}
|
|
27
|
-
/>
|
|
28
|
-
</div>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### With Workflow Triggers
|
|
13
|
+
## Basic Usage
|
|
34
14
|
|
|
35
15
|
```jsx
|
|
16
|
+
import React from 'react';
|
|
17
|
+
import ReactDOM from 'react-dom';
|
|
36
18
|
import GuideAI from 'guideai-app';
|
|
37
19
|
|
|
38
20
|
function App() {
|
|
@@ -40,8 +22,9 @@ function App() {
|
|
|
40
22
|
<div>
|
|
41
23
|
<GuideAI
|
|
42
24
|
organizationKey="your-organization-key"
|
|
43
|
-
|
|
44
|
-
|
|
25
|
+
React={React}
|
|
26
|
+
ReactDOM={ReactDOM}
|
|
27
|
+
position={{ bottom: '20px', right: '20px' }}
|
|
45
28
|
onError={(error) => console.error(error)}
|
|
46
29
|
/>
|
|
47
30
|
</div>
|
|
@@ -53,16 +36,15 @@ function App() {
|
|
|
53
36
|
|
|
54
37
|
| Prop | Type | Required | Description |
|
|
55
38
|
|------|------|----------|-------------|
|
|
56
|
-
| `organizationKey` | `string` | Yes | Your organization key
|
|
57
|
-
| `
|
|
58
|
-
| `
|
|
59
|
-
| `
|
|
60
|
-
| `
|
|
61
|
-
| `input` | `object` | No | Input mode configuration (voice/text) |
|
|
39
|
+
| `organizationKey` | `string` | Yes | Your unique organization key |
|
|
40
|
+
| `React` | `React` | Yes | React instance from your application |
|
|
41
|
+
| `ReactDOM` | `ReactDOM` | Yes | ReactDOM instance from your application |
|
|
42
|
+
| `position` | `object` | No | CSS positioning for the component (see below) |
|
|
43
|
+
| `onError` | `function` | No | Error handler callback: `(error: string \| Error) => void` |
|
|
62
44
|
|
|
63
|
-
|
|
45
|
+
## Position Object
|
|
64
46
|
|
|
65
|
-
The `position` prop accepts an object with CSS positioning properties:
|
|
47
|
+
The `position` prop accepts an object with CSS positioning properties to control where the Guide AI button appears on your page:
|
|
66
48
|
|
|
67
49
|
```typescript
|
|
68
50
|
position?: {
|
|
@@ -78,254 +60,87 @@ position?: {
|
|
|
78
60
|
}
|
|
79
61
|
```
|
|
80
62
|
|
|
81
|
-
###
|
|
82
|
-
|
|
83
|
-
```typescript
|
|
84
|
-
transcript?: {
|
|
85
|
-
enabled?: boolean; // Show transcript (default: true)
|
|
86
|
-
showToggleButton?: boolean; // Show transcript toggle (default: true)
|
|
87
|
-
position?: 'right' | 'left' | 'top' | 'bottom'; // Transcript position
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### Input Configuration Object
|
|
63
|
+
### Position Examples
|
|
92
64
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
65
|
+
**Bottom-right corner:**
|
|
66
|
+
```jsx
|
|
67
|
+
<GuideAI
|
|
68
|
+
organizationKey="your-org-key"
|
|
69
|
+
React={React}
|
|
70
|
+
ReactDOM={ReactDOM}
|
|
71
|
+
position={{ bottom: '20px', right: '20px' }}
|
|
72
|
+
/>
|
|
100
73
|
```
|
|
101
74
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
**Basic usage:**
|
|
75
|
+
**Bottom-left corner:**
|
|
105
76
|
```jsx
|
|
106
77
|
<GuideAI
|
|
107
78
|
organizationKey="your-org-key"
|
|
108
|
-
|
|
79
|
+
React={React}
|
|
80
|
+
ReactDOM={ReactDOM}
|
|
81
|
+
position={{ bottom: '20px', left: '20px' }}
|
|
109
82
|
/>
|
|
110
83
|
```
|
|
111
84
|
|
|
112
|
-
**
|
|
85
|
+
**Centered at bottom:**
|
|
113
86
|
```jsx
|
|
114
87
|
<GuideAI
|
|
115
88
|
organizationKey="your-org-key"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
89
|
+
React={React}
|
|
90
|
+
ReactDOM={ReactDOM}
|
|
91
|
+
position={{
|
|
92
|
+
bottom: '20px',
|
|
93
|
+
left: '50%',
|
|
94
|
+
transform: 'translateX(-50%)'
|
|
120
95
|
}}
|
|
121
96
|
/>
|
|
122
97
|
```
|
|
123
98
|
|
|
124
|
-
**
|
|
99
|
+
**Top-right corner:**
|
|
125
100
|
```jsx
|
|
126
101
|
<GuideAI
|
|
127
|
-
organizationKey="your-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
showToggleButton: true
|
|
132
|
-
}}
|
|
133
|
-
input={{
|
|
134
|
-
enableTextInput: true,
|
|
135
|
-
defaultMode: 'voice',
|
|
136
|
-
placeholder: "Type your message..."
|
|
137
|
-
}}
|
|
138
|
-
onError={(error) => console.error(error)}
|
|
102
|
+
organizationKey="your-org-key"
|
|
103
|
+
React={React}
|
|
104
|
+
ReactDOM={ReactDOM}
|
|
105
|
+
position={{ top: '20px', right: '20px' }}
|
|
139
106
|
/>
|
|
140
107
|
```
|
|
141
108
|
|
|
142
|
-
##
|
|
143
|
-
|
|
144
|
-
GuideAI now supports both voice and text input modes, giving users flexible ways to interact with the AI assistant.
|
|
145
|
-
|
|
146
|
-
### Features
|
|
147
|
-
|
|
148
|
-
- **Dual Input Modes**: Switch seamlessly between voice and text input
|
|
149
|
-
- **Text Input Interface**: Clean text area integrated into the transcript box
|
|
150
|
-
- **Input Mode Toggle**: Dedicated button to switch between voice and text modes
|
|
151
|
-
- **Real-time Text Chat**: Type messages and receive AI responses instantly
|
|
152
|
-
- **Keyboard Shortcuts**: Press Enter to send messages quickly
|
|
153
|
-
- **Auto-enabled**: Text input is enabled by default for better accessibility
|
|
154
|
-
|
|
155
|
-
### Input Props
|
|
156
|
-
|
|
157
|
-
| Prop | Type | Default | Description |
|
|
158
|
-
|------|------|---------|-------------|
|
|
159
|
-
| `enableTextInput` | boolean | `true` | Enable text input functionality |
|
|
160
|
-
| `showInputToggle` | boolean | `true` | Show the voice/text mode toggle button |
|
|
161
|
-
| `defaultMode` | `'voice' \| 'text'` | `'voice'` | Default input mode when conversation starts |
|
|
162
|
-
| `placeholder` | string | `"Type your message..."` | Placeholder text for the text input field |
|
|
163
|
-
|
|
164
|
-
### How to Use Text Input
|
|
165
|
-
|
|
166
|
-
1. **Start a Conversation**: Click the GuideAI button to begin
|
|
167
|
-
2. **Switch to Text Mode**: Click the toggle button next to the main GuideAI button
|
|
168
|
-
3. **Type Your Message**: Use the text area at the bottom of the transcript box
|
|
169
|
-
4. **Send Message**: Press Enter or click the send button
|
|
170
|
-
5. **Switch Back**: Click the toggle button again to return to voice mode
|
|
171
|
-
|
|
172
|
-
### Accessibility Features
|
|
173
|
-
|
|
174
|
-
- **Keyboard Navigation**: Full keyboard support for text input
|
|
175
|
-
- **Default Enabled**: Text input works out of the box without configuration
|
|
176
|
-
- **Fallback Support**: Automatically enables text mode if microphone access is denied
|
|
177
|
-
- **Visual Indicators**: Clear visual feedback for active input mode
|
|
178
|
-
|
|
179
|
-
## Transcript Feature
|
|
109
|
+
## Complete Example
|
|
180
110
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
- **Glassmorphism Design**: Transparent background with backdrop blur effects
|
|
186
|
-
- **Apple-style Interface**: Clean, modern design inspired by Apple's UI principles
|
|
187
|
-
- **Real-time Updates**: Messages appear as they're exchanged
|
|
188
|
-
- **Timestamps**: Each message shows when it was sent
|
|
189
|
-
- **Auto-scroll**: Automatically scrolls to the latest messages
|
|
190
|
-
- **Responsive**: Works perfectly on all device sizes
|
|
191
|
-
|
|
192
|
-
### How to Use
|
|
193
|
-
|
|
194
|
-
1. Start a conversation with GuideAI by clicking the microphone button
|
|
195
|
-
2. The transcript automatically appears as an overlay when the conversation begins
|
|
196
|
-
3. The transcript shows all messages with clear visual distinction between user and AI messages
|
|
197
|
-
4. Messages appear in real-time as the conversation progresses
|
|
198
|
-
5. Click the "×" button or click outside the transcript to close it
|
|
199
|
-
6. The transcript automatically closes when the conversation ends
|
|
200
|
-
|
|
201
|
-
### Transcript Interface
|
|
202
|
-
|
|
203
|
-
The transcript interface includes:
|
|
204
|
-
- **Header**: Shows "Conversation Transcript" with a close button
|
|
205
|
-
- **Messages**: Chat-like interface with different styles for user and AI messages
|
|
206
|
-
- **Timestamps**: Each message displays the time it was sent
|
|
207
|
-
- **Footer**: Shows the total number of messages in the conversation
|
|
208
|
-
|
|
209
|
-
### Styling
|
|
210
|
-
|
|
211
|
-
The transcript uses modern CSS features including:
|
|
212
|
-
- `backdrop-filter: blur()` for the glassmorphism effect
|
|
213
|
-
- CSS animations for smooth transitions
|
|
214
|
-
- Responsive design that adapts to different screen sizes
|
|
215
|
-
- Custom scrollbar styling for a polished look
|
|
216
|
-
|
|
217
|
-
## Element Interaction Features
|
|
218
|
-
|
|
219
|
-
GuideAI includes powerful element interaction capabilities that allow the AI to guide users by highlighting, hovering over, and clicking elements on the page.
|
|
220
|
-
|
|
221
|
-
### Features
|
|
222
|
-
|
|
223
|
-
- **Element Highlighting**: AI can highlight and click on specific page elements
|
|
224
|
-
- **Hover Interactions**: AI can hover over elements with visual feedback
|
|
225
|
-
- **Position Tracking**: Cursor follows elements that move or expand during interactions
|
|
226
|
-
- **Multiple Selector Support**: Supports CSS selectors, XPath, and text-based selectors
|
|
227
|
-
- **Extended Visual Feedback**: 3-second highlighting with enhanced animations
|
|
228
|
-
|
|
229
|
-
### Supported Selector Types
|
|
230
|
-
|
|
231
|
-
| Selector Type | Format | Example |
|
|
232
|
-
|---------------|--------|---------|
|
|
233
|
-
| **ID** | `#elementId` | `#sidebarMenu-button-goals` |
|
|
234
|
-
| **Class** | `.className` | `.submit-button` |
|
|
235
|
-
| **Attribute** | `[attribute="value"]` | `[data-testid="submit"]` |
|
|
236
|
-
| **Complex CSS** | Any valid CSS | `button.primary[aria-label="Save"]` |
|
|
237
|
-
| **Text-based** | `text:cssSelector:textContent` | `text:.MuiListItemText-root:Goal Sets` |
|
|
238
|
-
| **XPath** | `//xpath` | `//button[contains(text(), 'Submit')]` |
|
|
239
|
-
|
|
240
|
-
### Available Tools
|
|
241
|
-
|
|
242
|
-
#### `highlight` Tool
|
|
243
|
-
- **Purpose**: Moves cursor to elements and clicks them
|
|
244
|
-
- **Use Case**: Guiding users through workflows by clicking interactive elements
|
|
245
|
-
- **Visual Effect**: Blue cursor with click animations and visual feedback
|
|
246
|
-
|
|
247
|
-
#### `hoverThenHighlight` Tool
|
|
248
|
-
- **Purpose**: Moves cursor to elements and hovers over them
|
|
249
|
-
- **Use Case**: Demonstrating or highlighting elements without triggering clicks
|
|
250
|
-
- **Visual Effect**: Orange hover effects with position tracking for dynamic elements
|
|
251
|
-
|
|
252
|
-
### How It Works
|
|
253
|
-
|
|
254
|
-
1. **AI Detection**: The AI analyzes user requests and determines which elements to interact with
|
|
255
|
-
2. **Element Finding**: Uses advanced selector logic to locate elements on the page
|
|
256
|
-
3. **Visual Animation**: Animated cursor moves from viewport center to target elements
|
|
257
|
-
4. **Interaction**: Performs click or hover action with appropriate visual feedback
|
|
258
|
-
5. **Position Tracking**: For hover actions, tracks element position changes for 3 seconds
|
|
259
|
-
|
|
260
|
-
### Example Usage
|
|
261
|
-
|
|
262
|
-
The AI can respond to user requests like:
|
|
263
|
-
- "Click the save button" → Uses `highlight` tool to click elements
|
|
264
|
-
- "Show me the navigation menu" → Uses `hoverThenHighlight` tool to highlight elements
|
|
265
|
-
- "Test hover on the goals section" → Triggers predefined test sequence
|
|
266
|
-
|
|
267
|
-
### Technical Implementation
|
|
268
|
-
|
|
269
|
-
- **Files**: `selectElementAndClick.ts` (clicking) and `hoverAndHighlight.ts` (hovering)
|
|
270
|
-
- **State Management**: Separate state tracking for click and hover operations
|
|
271
|
-
- **Error Handling**: Graceful fallback when elements are not found
|
|
272
|
-
- **Performance**: Optimized with 50ms position tracking intervals
|
|
273
|
-
|
|
274
|
-
## Migration from Voice-Only Versions
|
|
275
|
-
|
|
276
|
-
If you're upgrading from a voice-only version:
|
|
277
|
-
|
|
278
|
-
- **No Breaking Changes**: Existing implementations continue to work unchanged
|
|
279
|
-
- **Text Input Enabled**: Text input is now available by default
|
|
280
|
-
- **Disable if Needed**: Set `input={{ enableTextInput: false }}` to disable text input
|
|
281
|
-
- **Voice Still Default**: Voice mode remains the default interaction method
|
|
282
|
-
|
|
283
|
-
## Workflow Trigger Feature
|
|
284
|
-
|
|
285
|
-
GuideAI now supports workflow triggers based on trigger words detected in user messages. This feature allows you to create dynamic workflows that are activated when specific keywords or phrases are mentioned by users.
|
|
286
|
-
|
|
287
|
-
### Features
|
|
288
|
-
|
|
289
|
-
- **Trigger Word Detection**: Automatically detect trigger words in user messages
|
|
290
|
-
- **Workflow Integration**: Seamlessly integrate with your backend workflow system
|
|
291
|
-
- **Dynamic Prompts**: Workflow-specific prompts from the initialize-session API
|
|
292
|
-
- **Tool-based Triggers**: AI can call workflow triggers through function calls
|
|
293
|
-
- **Configurable**: Support for multiple workflow keys and trigger patterns
|
|
294
|
-
|
|
295
|
-
### How It Works
|
|
111
|
+
```jsx
|
|
112
|
+
import React from 'react';
|
|
113
|
+
import ReactDOM from 'react-dom';
|
|
114
|
+
import GuideAI from 'guideai-app';
|
|
296
115
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
116
|
+
function App() {
|
|
117
|
+
const handleError = (error) => {
|
|
118
|
+
console.error('GuideAI Error:', error);
|
|
119
|
+
// Add your custom error handling here
|
|
120
|
+
};
|
|
300
121
|
|
|
301
|
-
|
|
122
|
+
return (
|
|
123
|
+
<div className="app">
|
|
124
|
+
<h1>My Application</h1>
|
|
125
|
+
|
|
126
|
+
<GuideAI
|
|
127
|
+
organizationKey="your-organization-key"
|
|
128
|
+
React={React}
|
|
129
|
+
ReactDOM={ReactDOM}
|
|
130
|
+
position={{ bottom: '40px', right: '40px' }}
|
|
131
|
+
onError={handleError}
|
|
132
|
+
/>
|
|
133
|
+
</div>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
302
136
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
**Technical Support**: Trigger words like "error", "bug", "crash", "not working"
|
|
137
|
+
export default App;
|
|
138
|
+
```
|
|
306
139
|
|
|
307
|
-
|
|
140
|
+
## Getting Your Organization Key
|
|
308
141
|
|
|
309
|
-
|
|
142
|
+
To use Guide AI, you'll need an organization key. Contact the Guide AI team to get your key and set up your organization.
|
|
310
143
|
|
|
311
|
-
|
|
312
|
-
{
|
|
313
|
-
"id": "conversation-uuid",
|
|
314
|
-
"ephemeralToken": "openai-realtime-token",
|
|
315
|
-
"prompt": "organization-prompt",
|
|
316
|
-
"workflows": [
|
|
317
|
-
{
|
|
318
|
-
"id": "workflow-uuid",
|
|
319
|
-
"name": "Customer Support Workflow",
|
|
320
|
-
"triggers": ["help", "support", "customer service"],
|
|
321
|
-
"organizationKey": "org-key-123",
|
|
322
|
-
"prompt": "You are a helpful customer support agent...",
|
|
323
|
-
"archived": false,
|
|
324
|
-
"createdAt": "2024-01-01T00:00:00.000Z",
|
|
325
|
-
"updatedAt": "2024-01-01T00:00:00.000Z"
|
|
326
|
-
}
|
|
327
|
-
]
|
|
328
|
-
}
|
|
329
|
-
```
|
|
144
|
+
## Support
|
|
330
145
|
|
|
331
|
-
For
|
|
146
|
+
For questions, issues, or feature requests, please contact the Guide AI team or visit our documentation.
|