ttp-agent-sdk 2.34.5 → 2.34.7
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
|
@@ -15865,6 +15865,48 @@ var VoiceInterface = /*#__PURE__*/function () {
|
|
|
15865
15865
|
return defaults[key] || '';
|
|
15866
15866
|
}
|
|
15867
15867
|
|
|
15868
|
+
/**
|
|
15869
|
+
* Update all timer elements with the given time text
|
|
15870
|
+
* Always updates both desktop and compact timers to ensure consistency
|
|
15871
|
+
*/
|
|
15872
|
+
}, {
|
|
15873
|
+
key: "_updateTimerElements",
|
|
15874
|
+
value: function _updateTimerElements(timerText, elapsed) {
|
|
15875
|
+
// Update legacy desktop timer if it exists
|
|
15876
|
+
var timerEl = this.shadowRoot.getElementById('voiceTimer');
|
|
15877
|
+
if (timerEl) {
|
|
15878
|
+
timerEl.textContent = timerText;
|
|
15879
|
+
}
|
|
15880
|
+
|
|
15881
|
+
// Always update BOTH timer elements - the visibility optimization was causing bugs
|
|
15882
|
+
// where the collapsed view timer wasn't updating
|
|
15883
|
+
var desktopTimerText = this.shadowRoot.getElementById('desktopTimerText');
|
|
15884
|
+
var compactTimerText = this.shadowRoot.getElementById('compactTimerText');
|
|
15885
|
+
if (desktopTimerText) {
|
|
15886
|
+
desktopTimerText.textContent = timerText;
|
|
15887
|
+
}
|
|
15888
|
+
if (compactTimerText) {
|
|
15889
|
+
compactTimerText.textContent = timerText;
|
|
15890
|
+
}
|
|
15891
|
+
|
|
15892
|
+
// Debug logging (only in first 2 seconds)
|
|
15893
|
+
if (!compactTimerText && !desktopTimerText && elapsed < 2000) {
|
|
15894
|
+
console.warn('⚠️ Timer elements not found - compactTimerText:', !!compactTimerText, 'desktopTimerText:', !!desktopTimerText, 'elapsed:', elapsed);
|
|
15895
|
+
var allTimers = this.shadowRoot.querySelectorAll('[id*="Timer"], [id*="timer"]');
|
|
15896
|
+
console.log('Found timer-like elements:', Array.from(allTimers).map(function (el) {
|
|
15897
|
+
return el.id;
|
|
15898
|
+
}));
|
|
15899
|
+
}
|
|
15900
|
+
|
|
15901
|
+
// Update mobile duration badge
|
|
15902
|
+
if (this.isMobile) {
|
|
15903
|
+
var mobileDurationText = document.getElementById('mobileDurationText');
|
|
15904
|
+
var mobileHeaderDuration = document.getElementById('mobileHeaderDuration');
|
|
15905
|
+
if (mobileDurationText) mobileDurationText.textContent = timerText;
|
|
15906
|
+
if (mobileHeaderDuration) mobileHeaderDuration.textContent = timerText;
|
|
15907
|
+
}
|
|
15908
|
+
}
|
|
15909
|
+
|
|
15868
15910
|
/**
|
|
15869
15911
|
* Generate HTML for voice interface
|
|
15870
15912
|
* Delegates to templates module
|
|
@@ -16090,7 +16132,7 @@ var VoiceInterface = /*#__PURE__*/function () {
|
|
|
16090
16132
|
value: (function () {
|
|
16091
16133
|
var _proceedWithVoiceCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
16092
16134
|
var _this3 = this;
|
|
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, _idleState4, _panel4, _fallbackPanel3, _floatingButton2, _fallbackButton2, _deviceInfo, _t2, _t3, _t4, _t5, _t6, _t7;
|
|
16135
|
+
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;
|
|
16094
16136
|
return _regenerator().w(function (_context5) {
|
|
16095
16137
|
while (1) switch (_context5.p = _context5.n) {
|
|
16096
16138
|
case 0:
|
|
@@ -16487,33 +16529,27 @@ var VoiceInterface = /*#__PURE__*/function () {
|
|
|
16487
16529
|
case 29:
|
|
16488
16530
|
// Start timer
|
|
16489
16531
|
this.callStartTime = Date.now();
|
|
16490
|
-
|
|
16532
|
+
console.log('⏱️ Starting call timer at', new Date(this.callStartTime).toISOString());
|
|
16533
|
+
|
|
16534
|
+
// Timer update function - updates all timer elements
|
|
16535
|
+
updateTimer = function updateTimer() {
|
|
16536
|
+
if (!_this3.callStartTime) {
|
|
16537
|
+
console.warn('⚠️ Timer update called but callStartTime is not set');
|
|
16538
|
+
return;
|
|
16539
|
+
}
|
|
16491
16540
|
var elapsed = Date.now() - _this3.callStartTime;
|
|
16492
16541
|
var minutes = Math.floor(elapsed / 60000);
|
|
16493
16542
|
var seconds = Math.floor(elapsed % 60000 / 1000);
|
|
16494
16543
|
var timerText = "".concat(minutes.toString().padStart(2, '0'), ":").concat(seconds.toString().padStart(2, '0'));
|
|
16495
|
-
|
|
16496
|
-
|
|
16497
|
-
|
|
16498
|
-
|
|
16499
|
-
|
|
16500
|
-
|
|
16501
|
-
//
|
|
16502
|
-
|
|
16503
|
-
|
|
16504
|
-
var timerElement = compactTimerText || desktopTimerText;
|
|
16505
|
-
if (timerElement) {
|
|
16506
|
-
timerElement.textContent = timerText;
|
|
16507
|
-
}
|
|
16508
|
-
|
|
16509
|
-
// Update mobile duration badge
|
|
16510
|
-
if (_this3.isMobile) {
|
|
16511
|
-
var mobileDurationText = document.getElementById('mobileDurationText');
|
|
16512
|
-
var mobileHeaderDuration = document.getElementById('mobileHeaderDuration');
|
|
16513
|
-
if (mobileDurationText) mobileDurationText.textContent = timerText;
|
|
16514
|
-
if (mobileHeaderDuration) mobileHeaderDuration.textContent = timerText;
|
|
16515
|
-
}
|
|
16516
|
-
}, 1000);
|
|
16544
|
+
_this3._updateTimerElements(timerText, elapsed);
|
|
16545
|
+
}; // Wait a tiny bit for DOM to be ready, then start timer
|
|
16546
|
+
setTimeout(function () {
|
|
16547
|
+
console.log('⏱️ Starting timer interval');
|
|
16548
|
+
// Update immediately (don't wait for first interval)
|
|
16549
|
+
updateTimer();
|
|
16550
|
+
// Then update every second
|
|
16551
|
+
_this3.callTimerInterval = setInterval(updateTimer, 1000);
|
|
16552
|
+
}, 100);
|
|
16517
16553
|
_context5.n = 38;
|
|
16518
16554
|
break;
|
|
16519
16555
|
case 30:
|
|
@@ -16616,33 +16652,27 @@ var VoiceInterface = /*#__PURE__*/function () {
|
|
|
16616
16652
|
case 37:
|
|
16617
16653
|
// Start timer
|
|
16618
16654
|
this.callStartTime = Date.now();
|
|
16619
|
-
|
|
16655
|
+
console.log('⏱️ Starting call timer at', new Date(this.callStartTime).toISOString());
|
|
16656
|
+
|
|
16657
|
+
// Timer update function - updates all timer elements
|
|
16658
|
+
_updateTimer = function _updateTimer() {
|
|
16659
|
+
if (!_this3.callStartTime) {
|
|
16660
|
+
console.warn('⚠️ Timer update called but callStartTime is not set');
|
|
16661
|
+
return;
|
|
16662
|
+
}
|
|
16620
16663
|
var elapsed = Date.now() - _this3.callStartTime;
|
|
16621
16664
|
var minutes = Math.floor(elapsed / 60000);
|
|
16622
16665
|
var seconds = Math.floor(elapsed % 60000 / 1000);
|
|
16623
16666
|
var timerText = "".concat(minutes.toString().padStart(2, '0'), ":").concat(seconds.toString().padStart(2, '0'));
|
|
16624
|
-
|
|
16625
|
-
|
|
16626
|
-
|
|
16627
|
-
|
|
16628
|
-
|
|
16629
|
-
|
|
16630
|
-
//
|
|
16631
|
-
|
|
16632
|
-
|
|
16633
|
-
var timerElement = compactTimerText || desktopTimerText;
|
|
16634
|
-
if (timerElement) {
|
|
16635
|
-
timerElement.textContent = timerText;
|
|
16636
|
-
}
|
|
16637
|
-
|
|
16638
|
-
// Update mobile duration badge
|
|
16639
|
-
if (_this3.isMobile) {
|
|
16640
|
-
var mobileDurationText = document.getElementById('mobileDurationText');
|
|
16641
|
-
var mobileHeaderDuration = document.getElementById('mobileHeaderDuration');
|
|
16642
|
-
if (mobileDurationText) mobileDurationText.textContent = timerText;
|
|
16643
|
-
if (mobileHeaderDuration) mobileHeaderDuration.textContent = timerText;
|
|
16644
|
-
}
|
|
16645
|
-
}, 1000);
|
|
16667
|
+
_this3._updateTimerElements(timerText, elapsed);
|
|
16668
|
+
}; // Wait a tiny bit for DOM to be ready, then start timer
|
|
16669
|
+
setTimeout(function () {
|
|
16670
|
+
console.log('⏱️ Starting timer interval');
|
|
16671
|
+
// Update immediately (don't wait for first interval)
|
|
16672
|
+
_updateTimer();
|
|
16673
|
+
// Then update every second
|
|
16674
|
+
_this3.callTimerInterval = setInterval(_updateTimer, 1000);
|
|
16675
|
+
}, 100);
|
|
16646
16676
|
case 38:
|
|
16647
16677
|
console.log('✅ Voice call started successfully');
|
|
16648
16678
|
_context5.n = 44;
|
|
@@ -26063,10 +26093,25 @@ var VoiceSDK_v2 = /*#__PURE__*/function (_EventEmitter) {
|
|
|
26063
26093
|
/**
|
|
26064
26094
|
* Send hello message with format negotiation
|
|
26065
26095
|
*/
|
|
26096
|
+
/**
|
|
26097
|
+
* Detect browser language from navigator
|
|
26098
|
+
* @returns {Object} Object with language and fullLocale properties
|
|
26099
|
+
*/
|
|
26066
26100
|
)
|
|
26101
|
+
}, {
|
|
26102
|
+
key: "detectBrowserLocale",
|
|
26103
|
+
value: function detectBrowserLocale() {
|
|
26104
|
+
var _navigator$languages, _fullLocale$split$;
|
|
26105
|
+
var fullLocale = navigator.language || ((_navigator$languages = navigator.languages) === null || _navigator$languages === void 0 ? void 0 : _navigator$languages[0]) || 'en-US';
|
|
26106
|
+
var language = ((_fullLocale$split$ = fullLocale.split('-')[0]) === null || _fullLocale$split$ === void 0 ? void 0 : _fullLocale$split$.toLowerCase()) || 'en';
|
|
26107
|
+
return {
|
|
26108
|
+
language: language,
|
|
26109
|
+
fullLocale: fullLocale
|
|
26110
|
+
};
|
|
26111
|
+
}
|
|
26067
26112
|
}, {
|
|
26068
26113
|
key: "sendHelloMessage",
|
|
26069
|
-
value:
|
|
26114
|
+
value: function () {
|
|
26070
26115
|
var _sendHelloMessage = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
26071
26116
|
var inputFormat, requestedOutputFormat, inputError, outputError, helloMessage;
|
|
26072
26117
|
return _regenerator().w(function (_context3) {
|
|
@@ -26140,6 +26185,10 @@ var VoiceSDK_v2 = /*#__PURE__*/function (_EventEmitter) {
|
|
|
26140
26185
|
helloMessage.agentSettingsOverride = this.config.agentSettingsOverride;
|
|
26141
26186
|
}
|
|
26142
26187
|
|
|
26188
|
+
// Automatically detect browser language
|
|
26189
|
+
helloMessage.locale = this.detectBrowserLocale();
|
|
26190
|
+
console.log('🌍 VoiceSDK v2: Auto-detected locale:', helloMessage.locale);
|
|
26191
|
+
|
|
26143
26192
|
// Optional: Variables (Map<String, String>)
|
|
26144
26193
|
console.log('🔍 VoiceSDK v2: Checking variables:', {
|
|
26145
26194
|
hasVariables: !!this.config.variables,
|
|
@@ -26209,7 +26258,6 @@ var VoiceSDK_v2 = /*#__PURE__*/function (_EventEmitter) {
|
|
|
26209
26258
|
/**
|
|
26210
26259
|
* Handle incoming WebSocket message
|
|
26211
26260
|
*/
|
|
26212
|
-
)
|
|
26213
26261
|
}, {
|
|
26214
26262
|
key: "handleMessage",
|
|
26215
26263
|
value: function handleMessage(event) {
|