ttp-agent-sdk 2.34.4 → 2.34.6
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
CHANGED
|
@@ -12744,6 +12744,7 @@ var TTPChatWidget = /*#__PURE__*/function () {
|
|
|
12744
12744
|
onAudioStartPlaying: this.config.onAudioStartPlaying,
|
|
12745
12745
|
onAudioStoppedPlaying: this.config.onAudioStoppedPlaying,
|
|
12746
12746
|
onSubtitleDisplay: this.config.onSubtitleDisplay,
|
|
12747
|
+
onVoiceCallButtonClick: this.config.onVoiceCallButtonClick,
|
|
12747
12748
|
// Callback when call ends - show landing screen (only in unified mode)
|
|
12748
12749
|
// BUT: Don't return to landing if we're showing a domain error
|
|
12749
12750
|
onCallEnd: function onCallEnd() {
|
|
@@ -13185,6 +13186,7 @@ var TTPChatWidget = /*#__PURE__*/function () {
|
|
|
13185
13186
|
onAudioStartPlaying: userConfig.onAudioStartPlaying,
|
|
13186
13187
|
onAudioStoppedPlaying: userConfig.onAudioStoppedPlaying,
|
|
13187
13188
|
onSubtitleDisplay: userConfig.onSubtitleDisplay,
|
|
13189
|
+
onVoiceCallButtonClick: userConfig.onVoiceCallButtonClick,
|
|
13188
13190
|
// Legacy support (for backward compatibility)
|
|
13189
13191
|
primaryColor: primaryColor
|
|
13190
13192
|
}, typeof userConfig.position === 'string' ? {
|
|
@@ -13669,6 +13671,17 @@ var TTPChatWidget = /*#__PURE__*/function () {
|
|
|
13669
13671
|
console.log('⚠️ Call already starting, ignoring duplicate click');
|
|
13670
13672
|
return _context.a(2);
|
|
13671
13673
|
case 1:
|
|
13674
|
+
// Call the callback if provided
|
|
13675
|
+
if (typeof _this6.config.onVoiceCallButtonClick === 'function') {
|
|
13676
|
+
try {
|
|
13677
|
+
_this6.config.onVoiceCallButtonClick({
|
|
13678
|
+
timestamp: Date.now(),
|
|
13679
|
+
widgetState: 'start'
|
|
13680
|
+
});
|
|
13681
|
+
} catch (error) {
|
|
13682
|
+
console.error('Error in onVoiceCallButtonClick callback:', error);
|
|
13683
|
+
}
|
|
13684
|
+
}
|
|
13672
13685
|
_this6.isStartingCall = true;
|
|
13673
13686
|
_context.p = 2;
|
|
13674
13687
|
// Show voice interface first (needed for UI state)
|
|
@@ -14533,6 +14546,7 @@ var TTPChatWidget = /*#__PURE__*/function () {
|
|
|
14533
14546
|
mergedConfig.onAudioStartPlaying = newConfig.onAudioStartPlaying !== undefined ? newConfig.onAudioStartPlaying : this.config.onAudioStartPlaying;
|
|
14534
14547
|
mergedConfig.onAudioStoppedPlaying = newConfig.onAudioStoppedPlaying !== undefined ? newConfig.onAudioStoppedPlaying : this.config.onAudioStoppedPlaying;
|
|
14535
14548
|
mergedConfig.onSubtitleDisplay = newConfig.onSubtitleDisplay !== undefined ? newConfig.onSubtitleDisplay : this.config.onSubtitleDisplay;
|
|
14549
|
+
mergedConfig.onVoiceCallButtonClick = newConfig.onVoiceCallButtonClick !== undefined ? newConfig.onVoiceCallButtonClick : this.config.onVoiceCallButtonClick;
|
|
14536
14550
|
|
|
14537
14551
|
// Merge useShadowDOM if provided
|
|
14538
14552
|
if (newConfig.useShadowDOM !== undefined) {
|
|
@@ -14541,7 +14555,7 @@ var TTPChatWidget = /*#__PURE__*/function () {
|
|
|
14541
14555
|
|
|
14542
14556
|
// Merge any other top-level properties
|
|
14543
14557
|
Object.keys(newConfig).forEach(function (key) {
|
|
14544
|
-
if (!['panel', 'button', 'header', 'footer', 'icon', 'messages', 'direction', 'voice', 'text', 'animation', 'behavior', 'accessibility', 'language', 'tooltips', 'landing', 'primaryColor', 'useShadowDOM', 'onConversationStart', 'onConversationEnd', 'onBargeIn', 'onAudioStartPlaying', 'onAudioStoppedPlaying', 'onSubtitleDisplay'].includes(key)) {
|
|
14558
|
+
if (!['panel', 'button', 'header', 'footer', 'icon', 'messages', 'direction', 'voice', 'text', 'animation', 'behavior', 'accessibility', 'language', 'tooltips', 'landing', 'primaryColor', 'useShadowDOM', 'onConversationStart', 'onConversationEnd', 'onBargeIn', 'onAudioStartPlaying', 'onAudioStoppedPlaying', 'onSubtitleDisplay', 'onVoiceCallButtonClick'].includes(key)) {
|
|
14545
14559
|
mergedConfig[key] = newConfig[key];
|
|
14546
14560
|
}
|
|
14547
14561
|
});
|
|
@@ -16076,7 +16090,7 @@ var VoiceInterface = /*#__PURE__*/function () {
|
|
|
16076
16090
|
value: (function () {
|
|
16077
16091
|
var _proceedWithVoiceCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
16078
16092
|
var _this3 = this;
|
|
16079
|
-
var isResumeCall, panel, header, toggleText, _voiceInterface, originalSection, compactSection, idleState, _panel, fallbackPanel, sampleRate, mediaStream, floatingButton, fallbackButton, _idleState, _panel2, _fallbackPanel, deviceInfo, _idleState2, activeState, voiceInterface, signedUrl, connected, serverRejected, originalOnError, originalOnDisconnected, attempts, _this$sdk$voiceSDK, error, _idleState3, _panel3, _fallbackPanel2, _floatingButton, _fallbackButton, _idleState4, _panel4, _fallbackPanel3, _floatingButton2, _fallbackButton2, _deviceInfo, _t2, _t3, _t4, _t5, _t6, _t7;
|
|
16093
|
+
var isResumeCall, panel, header, toggleText, _voiceInterface, originalSection, compactSection, idleState, _panel, fallbackPanel, sampleRate, mediaStream, floatingButton, fallbackButton, _idleState, _panel2, _fallbackPanel, deviceInfo, _idleState2, activeState, voiceInterface, signedUrl, connected, serverRejected, originalOnError, originalOnDisconnected, attempts, _this$sdk$voiceSDK, error, _idleState3, _panel3, _fallbackPanel2, _floatingButton, _fallbackButton, updateTimer, _idleState4, _panel4, _fallbackPanel3, _floatingButton2, _fallbackButton2, _updateTimer, _deviceInfo, _t2, _t3, _t4, _t5, _t6, _t7;
|
|
16080
16094
|
return _regenerator().w(function (_context5) {
|
|
16081
16095
|
while (1) switch (_context5.p = _context5.n) {
|
|
16082
16096
|
case 0:
|
|
@@ -16473,7 +16487,9 @@ var VoiceInterface = /*#__PURE__*/function () {
|
|
|
16473
16487
|
case 29:
|
|
16474
16488
|
// Start timer
|
|
16475
16489
|
this.callStartTime = Date.now();
|
|
16476
|
-
|
|
16490
|
+
|
|
16491
|
+
// Timer update function - updates all timer elements
|
|
16492
|
+
updateTimer = function updateTimer() {
|
|
16477
16493
|
var elapsed = Date.now() - _this3.callStartTime;
|
|
16478
16494
|
var minutes = Math.floor(elapsed / 60000);
|
|
16479
16495
|
var seconds = Math.floor(elapsed % 60000 / 1000);
|
|
@@ -16484,12 +16500,19 @@ var VoiceInterface = /*#__PURE__*/function () {
|
|
|
16484
16500
|
if (timerEl) {
|
|
16485
16501
|
timerEl.textContent = timerText;
|
|
16486
16502
|
}
|
|
16487
|
-
// Update timer in compact or old layout
|
|
16503
|
+
// Update timer in compact or old layout (update both independently)
|
|
16488
16504
|
var compactTimerText = _this3.shadowRoot.getElementById('compactTimerText');
|
|
16489
16505
|
var desktopTimerText = _this3.shadowRoot.getElementById('desktopTimerText');
|
|
16490
|
-
|
|
16491
|
-
|
|
16492
|
-
|
|
16506
|
+
|
|
16507
|
+
// Debug logging
|
|
16508
|
+
if (!compactTimerText && !desktopTimerText) {
|
|
16509
|
+
console.warn('⚠️ Timer elements not found - compactTimerText:', !!compactTimerText, 'desktopTimerText:', !!desktopTimerText);
|
|
16510
|
+
}
|
|
16511
|
+
if (compactTimerText) {
|
|
16512
|
+
compactTimerText.textContent = timerText;
|
|
16513
|
+
}
|
|
16514
|
+
if (desktopTimerText) {
|
|
16515
|
+
desktopTimerText.textContent = timerText;
|
|
16493
16516
|
}
|
|
16494
16517
|
|
|
16495
16518
|
// Update mobile duration badge
|
|
@@ -16499,7 +16522,10 @@ var VoiceInterface = /*#__PURE__*/function () {
|
|
|
16499
16522
|
if (mobileDurationText) mobileDurationText.textContent = timerText;
|
|
16500
16523
|
if (mobileHeaderDuration) mobileHeaderDuration.textContent = timerText;
|
|
16501
16524
|
}
|
|
16502
|
-
}
|
|
16525
|
+
}; // Update immediately (don't wait for first interval)
|
|
16526
|
+
updateTimer();
|
|
16527
|
+
// Then update every second
|
|
16528
|
+
this.callTimerInterval = setInterval(updateTimer, 1000);
|
|
16503
16529
|
_context5.n = 38;
|
|
16504
16530
|
break;
|
|
16505
16531
|
case 30:
|
|
@@ -16602,7 +16628,9 @@ var VoiceInterface = /*#__PURE__*/function () {
|
|
|
16602
16628
|
case 37:
|
|
16603
16629
|
// Start timer
|
|
16604
16630
|
this.callStartTime = Date.now();
|
|
16605
|
-
|
|
16631
|
+
|
|
16632
|
+
// Timer update function - updates all timer elements
|
|
16633
|
+
_updateTimer = function _updateTimer() {
|
|
16606
16634
|
var elapsed = Date.now() - _this3.callStartTime;
|
|
16607
16635
|
var minutes = Math.floor(elapsed / 60000);
|
|
16608
16636
|
var seconds = Math.floor(elapsed % 60000 / 1000);
|
|
@@ -16613,12 +16641,19 @@ var VoiceInterface = /*#__PURE__*/function () {
|
|
|
16613
16641
|
if (timerEl) {
|
|
16614
16642
|
timerEl.textContent = timerText;
|
|
16615
16643
|
}
|
|
16616
|
-
// Update timer in compact or old layout
|
|
16644
|
+
// Update timer in compact or old layout (update both independently)
|
|
16617
16645
|
var compactTimerText = _this3.shadowRoot.getElementById('compactTimerText');
|
|
16618
16646
|
var desktopTimerText = _this3.shadowRoot.getElementById('desktopTimerText');
|
|
16619
|
-
|
|
16620
|
-
|
|
16621
|
-
|
|
16647
|
+
|
|
16648
|
+
// Debug logging
|
|
16649
|
+
if (!compactTimerText && !desktopTimerText) {
|
|
16650
|
+
console.warn('⚠️ Timer elements not found - compactTimerText:', !!compactTimerText, 'desktopTimerText:', !!desktopTimerText);
|
|
16651
|
+
}
|
|
16652
|
+
if (compactTimerText) {
|
|
16653
|
+
compactTimerText.textContent = timerText;
|
|
16654
|
+
}
|
|
16655
|
+
if (desktopTimerText) {
|
|
16656
|
+
desktopTimerText.textContent = timerText;
|
|
16622
16657
|
}
|
|
16623
16658
|
|
|
16624
16659
|
// Update mobile duration badge
|
|
@@ -16628,7 +16663,10 @@ var VoiceInterface = /*#__PURE__*/function () {
|
|
|
16628
16663
|
if (mobileDurationText) mobileDurationText.textContent = timerText;
|
|
16629
16664
|
if (mobileHeaderDuration) mobileHeaderDuration.textContent = timerText;
|
|
16630
16665
|
}
|
|
16631
|
-
}
|
|
16666
|
+
}; // Update immediately (don't wait for first interval)
|
|
16667
|
+
_updateTimer();
|
|
16668
|
+
// Then update every second
|
|
16669
|
+
this.callTimerInterval = setInterval(_updateTimer, 1000);
|
|
16632
16670
|
case 38:
|
|
16633
16671
|
console.log('✅ Voice call started successfully');
|
|
16634
16672
|
_context5.n = 44;
|
|
@@ -17119,7 +17157,19 @@ var VoiceInterface = /*#__PURE__*/function () {
|
|
|
17119
17157
|
var activeState = this.shadowRoot.getElementById('voiceActiveState');
|
|
17120
17158
|
if (activeState) activeState.style.display = 'none';
|
|
17121
17159
|
|
|
17122
|
-
// Call the callback if provided (for
|
|
17160
|
+
// Call the public callback if provided (for user tracking/analytics)
|
|
17161
|
+
if (typeof this.config.onVoiceCallButtonClick === 'function') {
|
|
17162
|
+
try {
|
|
17163
|
+
this.config.onVoiceCallButtonClick({
|
|
17164
|
+
timestamp: Date.now(),
|
|
17165
|
+
widgetState: 'end'
|
|
17166
|
+
});
|
|
17167
|
+
} catch (error) {
|
|
17168
|
+
console.error('Error in onVoiceCallButtonClick callback:', error);
|
|
17169
|
+
}
|
|
17170
|
+
}
|
|
17171
|
+
|
|
17172
|
+
// Call the internal callback if provided (for unified mode - shows landing screen)
|
|
17123
17173
|
// Otherwise show idle state (for voice-only mode or backward compatibility)
|
|
17124
17174
|
if (this.config.onCallEnd) {
|
|
17125
17175
|
this.config.onCallEnd();
|