guideai-app 0.4.1 → 0.4.2-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/API_DATA_CONTRACTS.md +516 -0
- package/API_SESSIONID_TESTING.md +215 -0
- package/PII_HASHING_EPIC.md +886 -0
- package/PII_HASHING_STORIES_SUMMARY.md +275 -0
- package/README.md +69 -254
- package/SESSION_ID_VERIFICATION.md +122 -0
- package/VISIT_COUNT_TESTING.md +453 -0
- package/dist/GuideAI.js +1 -1
- package/dist/GuideAI.js.LICENSE.txt +20 -0
- package/dist/GuideAI.js.map +1 -1
- package/dist/components/TranscriptBox.d.ts +4 -0
- package/dist/index.d.ts +3 -0
- package/dist/metric/index.d.ts +0 -2
- package/dist/metric/metadata-tracker.d.ts +1 -2
- package/dist/styles/GuideAI.styles.d.ts +1 -1
- package/dist/types/GuideAI.types.d.ts +3 -1
- package/dist/types/metadata.types.d.ts +2 -0
- package/dist/utils/api.d.ts +5 -0
- package/dist/utils/constants.d.ts +0 -2
- package/dist/utils/elementInteractions.d.ts +92 -0
- package/dist/utils/gemini.d.ts +3 -0
- package/dist/utils/goToAElmLink.d.ts +1 -0
- package/dist/utils/highlightThenClick.d.ts +1 -0
- package/dist/utils/hoverThenClick.d.ts +1 -0
- package/dist/utils/logger.d.ts +1 -5
- package/dist/utils/session.d.ts +23 -0
- package/dist/utils/ui.d.ts +1 -1
- package/dist/visualContext/VisualContextScheduler.d.ts +43 -0
- package/dist/visualContext/VisualContextStore.d.ts +11 -0
- package/dist/visualContext/debug-overlay.d.ts +10 -0
- package/dist/visualContext/defaultProvider.d.ts +15 -0
- package/dist/visualContext/index.d.ts +5 -0
- package/dist/visualContext/types.d.ts +45 -0
- package/index.d.ts +5 -1
- package/jest.config.js +26 -0
- package/jest.setup.js +21 -0
- package/metadata-tracking-example.md +11 -11
- package/package.json +14 -3
- package/dist/metric/event-listner.d.ts +0 -141
- package/dist/utils/highlightAndClick.d.ts +0 -3
- package/dist/utils/hoverAndClick.d.ts +0 -4
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
# PII Hashing - Story Summary
|
|
2
|
+
|
|
3
|
+
**Epic Goal:** Implement client-side PII hashing to prevent sensitive data from appearing in logs, monitoring tools, and backend systems.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Frontend Stories (Guide AI Package)
|
|
8
|
+
|
|
9
|
+
### ✅ FE-1: Create PII Hashing Utility
|
|
10
|
+
**Points:** 3 | **Priority:** P0 | **Dependencies:** None
|
|
11
|
+
|
|
12
|
+
Create `src/utils/pii.ts` with:
|
|
13
|
+
- `hashEmail()` - Hash email using SHA-256
|
|
14
|
+
- `hashPII()` - Generic PII hashing function
|
|
15
|
+
- `isHashed()` - Check if value is already hashed
|
|
16
|
+
- TypeScript types and JSDoc
|
|
17
|
+
- Works with Web Crypto API
|
|
18
|
+
|
|
19
|
+
**Deliverables:**
|
|
20
|
+
- New file: `src/utils/pii.ts`
|
|
21
|
+
- TypeScript types for hashed data
|
|
22
|
+
- Documentation
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
### ✅ FE-2: Update UserMetadataTracker to Hash Emails
|
|
27
|
+
**Points:** 5 | **Priority:** P0 | **Dependencies:** FE-1
|
|
28
|
+
|
|
29
|
+
Update `src/metric/metadata-tracker.tsx`:
|
|
30
|
+
- Hash emails in `updateUserInfo()`
|
|
31
|
+
- Hash emails in `trackLogin()`
|
|
32
|
+
- Hash emails in all `trackVisit*()` methods
|
|
33
|
+
- Hash emails in `trackCustomEvent()`
|
|
34
|
+
- Store hashed emails in localStorage
|
|
35
|
+
- Add migration logic for existing data
|
|
36
|
+
- Graceful error handling
|
|
37
|
+
|
|
38
|
+
**Deliverables:**
|
|
39
|
+
- Modified: `src/metric/metadata-tracker.tsx`
|
|
40
|
+
- All emails hashed before storage/transmission
|
|
41
|
+
- Backward compatible
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
### ✅ FE-3: Update API Layer for Hashed Identifiers
|
|
46
|
+
**Points:** 3 | **Priority:** P0 | **Dependencies:** FE-1, FE-2
|
|
47
|
+
|
|
48
|
+
Update API types and validation:
|
|
49
|
+
- Add `emailHash` field to `UserMetadata` type
|
|
50
|
+
- Deprecate `email` field (keep for backward compatibility)
|
|
51
|
+
- Add validation in `sendMetadataUpdates()` (dev mode)
|
|
52
|
+
- Ensure no plain-text emails in API calls
|
|
53
|
+
- Update JSDoc comments
|
|
54
|
+
|
|
55
|
+
**Deliverables:**
|
|
56
|
+
- Modified: `src/types/metadata.types.ts`
|
|
57
|
+
- Modified: `src/utils/api.ts`
|
|
58
|
+
- API request validation
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
### ✅ FE-4: Add Privacy Configuration Options
|
|
63
|
+
**Points:** 2 | **Priority:** P1 | **Dependencies:** FE-1, FE-2
|
|
64
|
+
|
|
65
|
+
Add config options to `MetadataConfig`:
|
|
66
|
+
- `enablePIIHashing: boolean` (default: true)
|
|
67
|
+
- `piiFields: string[]` (default: ['email'])
|
|
68
|
+
- `allowPlainTextFallback: boolean` (default: false)
|
|
69
|
+
|
|
70
|
+
**Deliverables:**
|
|
71
|
+
- Modified: `src/types/metadata.types.ts`
|
|
72
|
+
- Configuration documentation
|
|
73
|
+
- Usage examples
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### ✅ FE-5: Add Unit & Integration Tests
|
|
78
|
+
**Points:** 5 | **Priority:** P0 | **Dependencies:** FE-1, FE-2, FE-3
|
|
79
|
+
|
|
80
|
+
Create comprehensive test coverage:
|
|
81
|
+
- Unit tests for `pii.ts` utilities
|
|
82
|
+
- Unit tests for metadata tracker hashing
|
|
83
|
+
- Integration tests for end-to-end flow
|
|
84
|
+
- Test error handling and edge cases
|
|
85
|
+
- Verify no plain-text in API calls
|
|
86
|
+
|
|
87
|
+
**Deliverables:**
|
|
88
|
+
- New file: `src/utils/pii.test.ts`
|
|
89
|
+
- New file: `src/metric/metadata-tracker.pii.test.ts`
|
|
90
|
+
- 90%+ code coverage
|
|
91
|
+
- All tests passing in CI
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Backend Stories (High Level - Other Repo)
|
|
96
|
+
|
|
97
|
+
### 🔧 BE-1: Update API Endpoints for Hashed Email Handling
|
|
98
|
+
**Points:** 8 | **Priority:** P0
|
|
99
|
+
|
|
100
|
+
**What:**
|
|
101
|
+
- Update `/initialize-session` endpoint to accept `emailHash`
|
|
102
|
+
- Update `/metadata-updates` endpoint to process `emailHash`
|
|
103
|
+
- Add hash format validation (64 hex chars)
|
|
104
|
+
- Ensure backward compatibility during migration
|
|
105
|
+
- Update API documentation
|
|
106
|
+
|
|
107
|
+
**Technical Notes:**
|
|
108
|
+
- Accept both `email` and `emailHash` during transition
|
|
109
|
+
- Validate hash format: `/^[a-f0-9]{64}$/i`
|
|
110
|
+
- No plain-text emails in logs
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
### 🔧 BE-2: Create Email Hash Mapping System
|
|
115
|
+
**Points:** 13 | **Priority:** P0
|
|
116
|
+
|
|
117
|
+
**What:**
|
|
118
|
+
- Create `email_mappings` table
|
|
119
|
+
- Store: `emailHash → encryptedEmail`
|
|
120
|
+
- Implement encryption at rest (AES-256-GCM)
|
|
121
|
+
- Use KMS for key management
|
|
122
|
+
- Add Redis cache for frequently accessed mappings
|
|
123
|
+
- Implement audit logging
|
|
124
|
+
- Create internal API for email lookup
|
|
125
|
+
|
|
126
|
+
**Database Schema:**
|
|
127
|
+
```sql
|
|
128
|
+
email_mappings (
|
|
129
|
+
email_hash: VARCHAR(64) PRIMARY KEY,
|
|
130
|
+
encrypted_email: BYTEA,
|
|
131
|
+
encryption_key_id: VARCHAR(50),
|
|
132
|
+
organization_key: VARCHAR(100),
|
|
133
|
+
first_seen: TIMESTAMP,
|
|
134
|
+
last_seen: TIMESTAMP
|
|
135
|
+
)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
### 🔧 BE-3: Update Database Schema
|
|
141
|
+
**Points:** 5 | **Priority:** P0
|
|
142
|
+
|
|
143
|
+
**What:**
|
|
144
|
+
- Add `email_hash` column to relevant tables
|
|
145
|
+
- Migrate existing plain-text emails to hashes
|
|
146
|
+
- Create indexes on `email_hash`
|
|
147
|
+
- Update all queries to use `email_hash`
|
|
148
|
+
- Keep `email` column temporarily for backward compatibility
|
|
149
|
+
|
|
150
|
+
**Migration Strategy:**
|
|
151
|
+
1. Add new column
|
|
152
|
+
2. Backfill hashes (incremental)
|
|
153
|
+
3. Create indexes
|
|
154
|
+
4. Update application code
|
|
155
|
+
5. (Future) Drop old email column
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
### 🔧 BE-4: Add Email Retrieval & Notification Logic
|
|
160
|
+
**Points:** 8 | **Priority:** P1
|
|
161
|
+
|
|
162
|
+
**What:**
|
|
163
|
+
- Create service for secure email retrieval
|
|
164
|
+
- Implement notification service using email lookup
|
|
165
|
+
- Add authentication/authorization
|
|
166
|
+
- Implement audit logging for email access
|
|
167
|
+
- Add rate limiting
|
|
168
|
+
- Monitoring/alerts for suspicious access
|
|
169
|
+
|
|
170
|
+
**Access Control:**
|
|
171
|
+
- Only notification service can retrieve emails
|
|
172
|
+
- Service-to-service authentication
|
|
173
|
+
- Rate limit: 100 lookups/minute per service
|
|
174
|
+
- IP whitelisting
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Story Point Summary
|
|
179
|
+
|
|
180
|
+
| Team | Total Points | Stories |
|
|
181
|
+
|------|--------------|---------|
|
|
182
|
+
| **Frontend** | **18 points** | 5 stories |
|
|
183
|
+
| **Backend** | **34 points** | 4 stories |
|
|
184
|
+
| **TOTAL** | **52 points** | 9 stories |
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Sprint Allocation (Example)
|
|
189
|
+
|
|
190
|
+
### Sprint 1: Core Implementation
|
|
191
|
+
- FE-1: Create PII Hashing Utility (3 pts)
|
|
192
|
+
- FE-2: Update UserMetadataTracker (5 pts)
|
|
193
|
+
- BE-1: Update API Endpoints (8 pts)
|
|
194
|
+
- **Total: 16 points**
|
|
195
|
+
|
|
196
|
+
### Sprint 2: Integration & Mapping
|
|
197
|
+
- FE-3: Update API Layer (3 pts)
|
|
198
|
+
- FE-4: Add Privacy Config (2 pts)
|
|
199
|
+
- BE-2: Email Hash Mapping System (13 pts)
|
|
200
|
+
- **Total: 18 points**
|
|
201
|
+
|
|
202
|
+
### Sprint 3: Testing & Deployment
|
|
203
|
+
- FE-5: Tests (5 pts)
|
|
204
|
+
- BE-3: Database Schema (5 pts)
|
|
205
|
+
- BE-4: Email Retrieval Logic (8 pts)
|
|
206
|
+
- **Total: 18 points**
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Critical Path
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
FE-1 (PII Utils)
|
|
214
|
+
↓
|
|
215
|
+
FE-2 (Metadata Tracker) + BE-1 (API Endpoints)
|
|
216
|
+
↓
|
|
217
|
+
FE-3 (API Layer) + BE-2 (Email Mapping)
|
|
218
|
+
↓
|
|
219
|
+
FE-5 (Tests) + BE-3 (DB Schema) + BE-4 (Email Retrieval)
|
|
220
|
+
↓
|
|
221
|
+
Integration Testing
|
|
222
|
+
↓
|
|
223
|
+
Production Deployment
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Quick Checklist
|
|
229
|
+
|
|
230
|
+
**Before Starting:**
|
|
231
|
+
- [ ] Product approval for privacy changes
|
|
232
|
+
- [ ] Security review of approach
|
|
233
|
+
- [ ] Backend team capacity confirmed
|
|
234
|
+
- [ ] Database migration plan reviewed
|
|
235
|
+
|
|
236
|
+
**During Development:**
|
|
237
|
+
- [ ] Daily syncs between FE/BE teams
|
|
238
|
+
- [ ] Test in staging after each story
|
|
239
|
+
- [ ] Security scanning of new code
|
|
240
|
+
- [ ] Performance testing
|
|
241
|
+
|
|
242
|
+
**Before Production:**
|
|
243
|
+
- [ ] All tests passing
|
|
244
|
+
- [ ] Privacy audit completed
|
|
245
|
+
- [ ] Rollback plan documented
|
|
246
|
+
- [ ] Monitoring configured
|
|
247
|
+
- [ ] Team trained on new system
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Key Decisions Needed
|
|
252
|
+
|
|
253
|
+
1. **Migration Timeline:** How long to support both `email` and `emailHash`?
|
|
254
|
+
2. **Rollout Strategy:** Big bang or gradual rollout?
|
|
255
|
+
3. **Old Data:** Migrate existing emails in DB or only new data?
|
|
256
|
+
4. **Other PII:** Should we hash other fields (userId, customerLicense)?
|
|
257
|
+
5. **Encryption Keys:** Where to store? AWS KMS? Vault?
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## Success Criteria
|
|
262
|
+
|
|
263
|
+
✅ No plain-text emails in server logs
|
|
264
|
+
✅ No plain-text emails in API requests
|
|
265
|
+
✅ All notifications still work
|
|
266
|
+
✅ < 50ms latency impact
|
|
267
|
+
✅ 99.9% uptime during migration
|
|
268
|
+
✅ Privacy audit passed
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
**Created:** [Date]
|
|
273
|
+
**Owner:** [Name]
|
|
274
|
+
**Status:** Ready for Planning
|
|
275
|
+
|
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.
|