ttp-agent-sdk 2.40.0 → 2.43.0
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/dist/agent-widget.dev.js +1220 -891
- package/dist/agent-widget.dev.js.map +1 -1
- package/dist/agent-widget.esm.js +1 -1
- package/dist/agent-widget.esm.js.map +1 -1
- package/dist/agent-widget.js +1 -1
- package/dist/agent-widget.js.map +1 -1
- package/dist/audio-processor.js +4 -0
- package/dist/demos/test-ecommerce.html +1 -1
- package/dist/demos/test-tour.html +0 -1
- package/dist/demos/widget-customization-dev.html +8 -14
- package/dist/demos/widget-customization.html +42 -10
- package/dist/examples/test-ecommerce.html +1 -1
- package/dist/examples/test-restaurant.html +16 -15
- package/dist/examples/test-text-chat.html +18 -9
- package/dist/examples/test-tour.html +0 -1
- package/dist/examples/widget-customization-dev.html +8 -14
- package/dist/examples/widget-customization.html +42 -10
- package/examples/test-ecommerce.html +1 -1
- package/examples/test-restaurant.html +16 -15
- package/examples/test-text-chat.html +18 -9
- package/examples/test-tour.html +0 -1
- package/examples/widget-customization-dev.html +8 -14
- package/examples/widget-customization.html +42 -10
- package/package.json +1 -1
|
@@ -94,11 +94,15 @@
|
|
|
94
94
|
font-size: 13px;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
select, input[type="text"], input[type="number"], input[type="color"] {
|
|
97
|
+
select, input[type="text"], input[type="number"], input[type="color"], textarea {
|
|
98
98
|
font-size: 16px; /* Prevents iOS zoom on focus */
|
|
99
99
|
padding: 10px 12px;
|
|
100
100
|
min-height: 44px;
|
|
101
101
|
}
|
|
102
|
+
|
|
103
|
+
textarea {
|
|
104
|
+
min-height: 100px;
|
|
105
|
+
}
|
|
102
106
|
|
|
103
107
|
input[type="color"] {
|
|
104
108
|
min-width: 50px;
|
|
@@ -188,7 +192,8 @@
|
|
|
188
192
|
background: #4B5563;
|
|
189
193
|
}
|
|
190
194
|
|
|
191
|
-
label {
|
|
195
|
+
/* Scope form labels — global `label { flex-direction: column }` can break in-widget flex rows when useShadowDOM is false */
|
|
196
|
+
.customization-container label {
|
|
192
197
|
display: flex;
|
|
193
198
|
flex-direction: column;
|
|
194
199
|
gap: 4px;
|
|
@@ -196,7 +201,7 @@
|
|
|
196
201
|
color: #374151;
|
|
197
202
|
}
|
|
198
203
|
|
|
199
|
-
select, input[type="text"], input[type="number"], input[type="color"] {
|
|
204
|
+
select, input[type="text"], input[type="number"], input[type="color"], textarea {
|
|
200
205
|
padding: 8px 12px;
|
|
201
206
|
border: 1px solid #D1D5DB;
|
|
202
207
|
border-radius: 6px;
|
|
@@ -206,7 +211,12 @@
|
|
|
206
211
|
color: #111827;
|
|
207
212
|
}
|
|
208
213
|
|
|
209
|
-
|
|
214
|
+
textarea {
|
|
215
|
+
resize: vertical;
|
|
216
|
+
min-height: 80px;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
select:focus, input:focus, textarea:focus {
|
|
210
220
|
outline: none;
|
|
211
221
|
border-color: #667eea;
|
|
212
222
|
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
|
@@ -844,7 +854,7 @@
|
|
|
844
854
|
} else {
|
|
845
855
|
initializeUI();
|
|
846
856
|
}
|
|
847
|
-
|
|
857
|
+
|
|
848
858
|
// Clear hover color (set to empty to test no hover color behavior)
|
|
849
859
|
function clearHoverColor() {
|
|
850
860
|
const hoverColorInput = document.getElementById('buttonHoverColor');
|
|
@@ -931,7 +941,6 @@
|
|
|
931
941
|
|
|
932
942
|
icon: {
|
|
933
943
|
type: 'custom',
|
|
934
|
-
customImage: 'https://talktopc.com/logo192.png',
|
|
935
944
|
size: document.getElementById('buttonSize').value,
|
|
936
945
|
backgroundColor: document.getElementById('buttonBgColor').value || '#FFFFFF' // Widget default: white
|
|
937
946
|
},
|
|
@@ -1050,7 +1059,7 @@
|
|
|
1050
1059
|
textCardIcon: document.getElementById('landingTextIcon').value
|
|
1051
1060
|
}
|
|
1052
1061
|
};
|
|
1053
|
-
|
|
1062
|
+
|
|
1054
1063
|
// Only include hoverColor if user has set a custom value (not default #7C3AED)
|
|
1055
1064
|
// If hoverColor is not included, widget will keep original color on hover
|
|
1056
1065
|
const hoverColorInput = document.getElementById('buttonHoverColor');
|
|
@@ -1098,8 +1107,8 @@
|
|
|
1098
1107
|
// Skip if already has listener
|
|
1099
1108
|
if (elementsWithListeners.has(element)) return;
|
|
1100
1109
|
|
|
1101
|
-
// For text inputs - apply on every keystroke (input event) with debounce
|
|
1102
|
-
if (element.type === 'text' || element.tagName === 'TEXTAREA') {
|
|
1110
|
+
// For text inputs and textareas - apply on every keystroke (input event) with debounce
|
|
1111
|
+
if (element.type === 'text' || element.type === 'textarea' || element.tagName === 'TEXTAREA') {
|
|
1103
1112
|
let timeout;
|
|
1104
1113
|
element.addEventListener('input', function() {
|
|
1105
1114
|
// Debounce for text inputs to avoid too many updates
|
package/examples/test-tour.html
CHANGED
|
@@ -1366,7 +1366,6 @@
|
|
|
1366
1366
|
},
|
|
1367
1367
|
icon: {
|
|
1368
1368
|
type: 'custom',
|
|
1369
|
-
customImage: 'https://talktopc.com/logo192.png',
|
|
1370
1369
|
size: 'medium',
|
|
1371
1370
|
backgroundColor: '#FFFFFF'
|
|
1372
1371
|
},
|
|
@@ -1538,7 +1537,7 @@
|
|
|
1538
1537
|
const iconConfig = widgetConfig.icon;
|
|
1539
1538
|
button.innerHTML = ''; // Clear previous content
|
|
1540
1539
|
|
|
1541
|
-
if (iconConfig.type === 'custom' && iconConfig.customImage) {
|
|
1540
|
+
if (iconConfig.type === 'custom' && iconConfig.customImage != null && String(iconConfig.customImage).trim() !== '') {
|
|
1542
1541
|
const img = document.createElement('img');
|
|
1543
1542
|
img.src = iconConfig.customImage;
|
|
1544
1543
|
img.alt = 'Chat Assistant';
|
|
@@ -1559,15 +1558,12 @@
|
|
|
1559
1558
|
<path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/>
|
|
1560
1559
|
</svg>`;
|
|
1561
1560
|
} else {
|
|
1562
|
-
|
|
1563
|
-
const
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
img.style.height = iconSize + 'px';
|
|
1569
|
-
img.style.objectFit = 'contain';
|
|
1570
|
-
button.appendChild(img);
|
|
1561
|
+
/* custom with no URL (or other types): match SDK — default mic icon for circle launcher */
|
|
1562
|
+
const iconSize = Math.floor(getSizeValue(config.size) * 0.5);
|
|
1563
|
+
button.innerHTML = `<svg viewBox="0 0 24 24" style="width: ${iconSize}px; height: ${iconSize}px; fill: #7C3AED;">
|
|
1564
|
+
<path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/>
|
|
1565
|
+
<path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/>
|
|
1566
|
+
</svg>`;
|
|
1571
1567
|
}
|
|
1572
1568
|
|
|
1573
1569
|
// Make button highlightable
|
|
@@ -2453,7 +2449,7 @@
|
|
|
2453
2449
|
</div>
|
|
2454
2450
|
<div class="control-item" id="iconCustomImageControl" style="display: ${widgetConfig.icon.type === 'custom' ? 'block' : 'none'};">
|
|
2455
2451
|
<label>Image URL</label>
|
|
2456
|
-
<input type="text" id="iconCustomImage" value="${widgetConfig.icon.customImage || '
|
|
2452
|
+
<input type="text" id="iconCustomImage" value="${widgetConfig.icon.customImage || ''}" placeholder="Optional image URL (empty = default icon)">
|
|
2457
2453
|
</div>
|
|
2458
2454
|
<div class="control-item" id="iconEmojiControl" style="display: ${widgetConfig.icon.type === 'emoji' ? 'block' : 'none'};">
|
|
2459
2455
|
<label>Emoji</label>
|
|
@@ -3690,7 +3686,6 @@
|
|
|
3690
3686
|
},
|
|
3691
3687
|
icon: {
|
|
3692
3688
|
type: 'custom',
|
|
3693
|
-
customImage: 'https://talktopc.com/logo192.png',
|
|
3694
3689
|
size: 'medium',
|
|
3695
3690
|
backgroundColor: '#FFFFFF'
|
|
3696
3691
|
},
|
|
@@ -4192,7 +4187,6 @@
|
|
|
4192
4187
|
},
|
|
4193
4188
|
icon: {
|
|
4194
4189
|
type: 'custom',
|
|
4195
|
-
customImage: 'https://talktopc.com/logo192.png',
|
|
4196
4190
|
size: 'medium',
|
|
4197
4191
|
backgroundColor: '#FFFFFF'
|
|
4198
4192
|
},
|
|
@@ -816,6 +816,33 @@
|
|
|
816
816
|
line-height: 1;
|
|
817
817
|
}
|
|
818
818
|
|
|
819
|
+
/* Match SDK default pill: waveform in frosted circle */
|
|
820
|
+
.mock-pill-icon.mock-pill-icon--wave {
|
|
821
|
+
background: rgba(255, 255, 255, 0.15);
|
|
822
|
+
}
|
|
823
|
+
.mock-pill-waveform {
|
|
824
|
+
display: flex;
|
|
825
|
+
align-items: center;
|
|
826
|
+
gap: 2px;
|
|
827
|
+
height: 16px;
|
|
828
|
+
}
|
|
829
|
+
.mock-pill-waveform .bar {
|
|
830
|
+
width: 2px;
|
|
831
|
+
background: #fff;
|
|
832
|
+
border-radius: 1px;
|
|
833
|
+
animation: mockPillWaveAnim 0.8s ease-in-out infinite;
|
|
834
|
+
transform-origin: center bottom;
|
|
835
|
+
}
|
|
836
|
+
.mock-pill-waveform .bar:nth-child(1) { height: 5px; animation-delay: 0s; }
|
|
837
|
+
.mock-pill-waveform .bar:nth-child(2) { height: 10px; animation-delay: 0.1s; }
|
|
838
|
+
.mock-pill-waveform .bar:nth-child(3) { height: 16px; animation-delay: 0.2s; }
|
|
839
|
+
.mock-pill-waveform .bar:nth-child(4) { height: 8px; animation-delay: 0.3s; }
|
|
840
|
+
.mock-pill-waveform .bar:nth-child(5) { height: 12px; animation-delay: 0.4s; }
|
|
841
|
+
@keyframes mockPillWaveAnim {
|
|
842
|
+
0%, 100% { transform: scaleY(0.4); }
|
|
843
|
+
50% { transform: scaleY(1); }
|
|
844
|
+
}
|
|
845
|
+
|
|
819
846
|
.mock-pill-text {
|
|
820
847
|
display: flex;
|
|
821
848
|
flex-direction: column;
|
|
@@ -1815,8 +1842,10 @@
|
|
|
1815
1842
|
<div class="mock-prompt-bubble" id="mockPromptBubble" style="display: none;"></div>
|
|
1816
1843
|
<div class="mock-pulse-rings" id="mockPulseRings" style="display: none;"></div>
|
|
1817
1844
|
<button class="mock-pill-launcher" id="mockButton" data-element-type="button">
|
|
1818
|
-
<div class="mock-pill-icon" id="mockPillIcon">
|
|
1819
|
-
<
|
|
1845
|
+
<div class="mock-pill-icon mock-pill-icon--wave" id="mockPillIcon">
|
|
1846
|
+
<div class="mock-pill-waveform" aria-hidden="true">
|
|
1847
|
+
<span class="bar"></span><span class="bar"></span><span class="bar"></span><span class="bar"></span><span class="bar"></span>
|
|
1848
|
+
</div>
|
|
1820
1849
|
</div>
|
|
1821
1850
|
<div class="mock-pill-text" id="mockPillText">
|
|
1822
1851
|
<span class="mock-pill-title" id="mockPillTitle">Chat Assistant</span>
|
|
@@ -1977,7 +2006,6 @@
|
|
|
1977
2006
|
},
|
|
1978
2007
|
icon: {
|
|
1979
2008
|
type: 'custom',
|
|
1980
|
-
customImage: 'https://talktopc.com/logo192.png',
|
|
1981
2009
|
size: 'medium',
|
|
1982
2010
|
backgroundColor: '#FFFFFF'
|
|
1983
2011
|
},
|
|
@@ -2175,17 +2203,23 @@
|
|
|
2175
2203
|
const iconConfig = widgetConfig.icon;
|
|
2176
2204
|
const headerConfig = widgetConfig.header;
|
|
2177
2205
|
|
|
2178
|
-
// Update pill icon
|
|
2206
|
+
// Update pill icon (SDK: custom URL → image; else animated waveform like mobile FAB)
|
|
2179
2207
|
const pillIcon = document.getElementById('mockPillIcon');
|
|
2180
2208
|
if (pillIcon) {
|
|
2181
|
-
|
|
2209
|
+
const hasCustomUrl = iconConfig.type === 'custom' && iconConfig.customImage != null && String(iconConfig.customImage).trim() !== '';
|
|
2210
|
+
if (hasCustomUrl) {
|
|
2211
|
+
pillIcon.className = 'mock-pill-icon';
|
|
2182
2212
|
pillIcon.innerHTML = `<img src="${iconConfig.customImage}" alt="" style="width:22px;height:22px;border-radius:50%;object-fit:cover;">`;
|
|
2213
|
+
pillIcon.style.backgroundColor = iconConfig.backgroundColor || '#ffffff';
|
|
2183
2214
|
} else if (iconConfig.type === 'emoji') {
|
|
2215
|
+
pillIcon.className = 'mock-pill-icon';
|
|
2184
2216
|
pillIcon.innerHTML = `<span class="pill-emoji">${iconConfig.emoji || '🤖'}</span>`;
|
|
2217
|
+
pillIcon.style.backgroundColor = iconConfig.backgroundColor || '#ffffff';
|
|
2185
2218
|
} else {
|
|
2186
|
-
pillIcon.
|
|
2219
|
+
pillIcon.className = 'mock-pill-icon mock-pill-icon--wave';
|
|
2220
|
+
pillIcon.innerHTML = '<div class="mock-pill-waveform" aria-hidden="true"><span class="bar"></span><span class="bar"></span><span class="bar"></span><span class="bar"></span><span class="bar"></span></div>';
|
|
2221
|
+
pillIcon.style.backgroundColor = '';
|
|
2187
2222
|
}
|
|
2188
|
-
pillIcon.style.backgroundColor = iconConfig.backgroundColor || '#ffffff';
|
|
2189
2223
|
}
|
|
2190
2224
|
|
|
2191
2225
|
// Update pill title and status
|
|
@@ -3179,7 +3213,7 @@
|
|
|
3179
3213
|
</div>
|
|
3180
3214
|
<div class="control-item" id="iconCustomImageControl" style="display: ${widgetConfig.icon.type === 'custom' ? 'block' : 'none'};">
|
|
3181
3215
|
<label>Image URL</label>
|
|
3182
|
-
<input type="text" id="iconCustomImage" value="${widgetConfig.icon.customImage || '
|
|
3216
|
+
<input type="text" id="iconCustomImage" value="${widgetConfig.icon.customImage || ''}" placeholder="Optional image URL — leave empty for waveform">
|
|
3183
3217
|
</div>
|
|
3184
3218
|
<div class="control-item" id="iconEmojiControl" style="display: ${widgetConfig.icon.type === 'emoji' ? 'block' : 'none'};">
|
|
3185
3219
|
<label>Emoji</label>
|
|
@@ -4518,7 +4552,6 @@
|
|
|
4518
4552
|
},
|
|
4519
4553
|
icon: {
|
|
4520
4554
|
type: 'custom',
|
|
4521
|
-
customImage: 'https://talktopc.com/logo192.png',
|
|
4522
4555
|
size: 'medium',
|
|
4523
4556
|
backgroundColor: '#FFFFFF'
|
|
4524
4557
|
},
|
|
@@ -5240,7 +5273,6 @@
|
|
|
5240
5273
|
},
|
|
5241
5274
|
icon: {
|
|
5242
5275
|
type: 'custom',
|
|
5243
|
-
customImage: 'https://talktopc.com/logo192.png',
|
|
5244
5276
|
size: 'medium',
|
|
5245
5277
|
backgroundColor: '#FFFFFF'
|
|
5246
5278
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ttp-agent-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.43.0",
|
|
4
4
|
"description": "Comprehensive Voice Agent SDK with Customizable Widget - Real-time audio, WebSocket communication, React components, and extensive customization options",
|
|
5
5
|
"main": "dist/agent-widget.js",
|
|
6
6
|
"module": "dist/agent-widget.esm.js",
|