ttp-agent-sdk 2.34.6 → 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
|
|
@@ -16487,45 +16529,27 @@ var VoiceInterface = /*#__PURE__*/function () {
|
|
|
16487
16529
|
case 29:
|
|
16488
16530
|
// Start timer
|
|
16489
16531
|
this.callStartTime = Date.now();
|
|
16532
|
+
console.log('⏱️ Starting call timer at', new Date(this.callStartTime).toISOString());
|
|
16490
16533
|
|
|
16491
16534
|
// Timer update function - updates all timer elements
|
|
16492
16535
|
updateTimer = function updateTimer() {
|
|
16536
|
+
if (!_this3.callStartTime) {
|
|
16537
|
+
console.warn('⚠️ Timer update called but callStartTime is not set');
|
|
16538
|
+
return;
|
|
16539
|
+
}
|
|
16493
16540
|
var elapsed = Date.now() - _this3.callStartTime;
|
|
16494
16541
|
var minutes = Math.floor(elapsed / 60000);
|
|
16495
16542
|
var seconds = Math.floor(elapsed % 60000 / 1000);
|
|
16496
16543
|
var timerText = "".concat(minutes.toString().padStart(2, '0'), ":").concat(seconds.toString().padStart(2, '0'));
|
|
16497
|
-
|
|
16498
|
-
|
|
16499
|
-
|
|
16500
|
-
|
|
16501
|
-
|
|
16502
|
-
|
|
16503
|
-
//
|
|
16504
|
-
|
|
16505
|
-
|
|
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;
|
|
16516
|
-
}
|
|
16517
|
-
|
|
16518
|
-
// Update mobile duration badge
|
|
16519
|
-
if (_this3.isMobile) {
|
|
16520
|
-
var mobileDurationText = document.getElementById('mobileDurationText');
|
|
16521
|
-
var mobileHeaderDuration = document.getElementById('mobileHeaderDuration');
|
|
16522
|
-
if (mobileDurationText) mobileDurationText.textContent = timerText;
|
|
16523
|
-
if (mobileHeaderDuration) mobileHeaderDuration.textContent = timerText;
|
|
16524
|
-
}
|
|
16525
|
-
}; // Update immediately (don't wait for first interval)
|
|
16526
|
-
updateTimer();
|
|
16527
|
-
// Then update every second
|
|
16528
|
-
this.callTimerInterval = setInterval(updateTimer, 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);
|
|
16529
16553
|
_context5.n = 38;
|
|
16530
16554
|
break;
|
|
16531
16555
|
case 30:
|
|
@@ -16628,45 +16652,27 @@ var VoiceInterface = /*#__PURE__*/function () {
|
|
|
16628
16652
|
case 37:
|
|
16629
16653
|
// Start timer
|
|
16630
16654
|
this.callStartTime = Date.now();
|
|
16655
|
+
console.log('⏱️ Starting call timer at', new Date(this.callStartTime).toISOString());
|
|
16631
16656
|
|
|
16632
16657
|
// Timer update function - updates all timer elements
|
|
16633
16658
|
_updateTimer = function _updateTimer() {
|
|
16659
|
+
if (!_this3.callStartTime) {
|
|
16660
|
+
console.warn('⚠️ Timer update called but callStartTime is not set');
|
|
16661
|
+
return;
|
|
16662
|
+
}
|
|
16634
16663
|
var elapsed = Date.now() - _this3.callStartTime;
|
|
16635
16664
|
var minutes = Math.floor(elapsed / 60000);
|
|
16636
16665
|
var seconds = Math.floor(elapsed % 60000 / 1000);
|
|
16637
16666
|
var timerText = "".concat(minutes.toString().padStart(2, '0'), ":").concat(seconds.toString().padStart(2, '0'));
|
|
16638
|
-
|
|
16639
|
-
|
|
16640
|
-
|
|
16641
|
-
|
|
16642
|
-
|
|
16643
|
-
|
|
16644
|
-
//
|
|
16645
|
-
|
|
16646
|
-
|
|
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;
|
|
16657
|
-
}
|
|
16658
|
-
|
|
16659
|
-
// Update mobile duration badge
|
|
16660
|
-
if (_this3.isMobile) {
|
|
16661
|
-
var mobileDurationText = document.getElementById('mobileDurationText');
|
|
16662
|
-
var mobileHeaderDuration = document.getElementById('mobileHeaderDuration');
|
|
16663
|
-
if (mobileDurationText) mobileDurationText.textContent = timerText;
|
|
16664
|
-
if (mobileHeaderDuration) mobileHeaderDuration.textContent = timerText;
|
|
16665
|
-
}
|
|
16666
|
-
}; // Update immediately (don't wait for first interval)
|
|
16667
|
-
_updateTimer();
|
|
16668
|
-
// Then update every second
|
|
16669
|
-
this.callTimerInterval = setInterval(_updateTimer, 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);
|
|
16670
16676
|
case 38:
|
|
16671
16677
|
console.log('✅ Voice call started successfully');
|
|
16672
16678
|
_context5.n = 44;
|
|
@@ -26087,10 +26093,25 @@ var VoiceSDK_v2 = /*#__PURE__*/function (_EventEmitter) {
|
|
|
26087
26093
|
/**
|
|
26088
26094
|
* Send hello message with format negotiation
|
|
26089
26095
|
*/
|
|
26096
|
+
/**
|
|
26097
|
+
* Detect browser language from navigator
|
|
26098
|
+
* @returns {Object} Object with language and fullLocale properties
|
|
26099
|
+
*/
|
|
26090
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
|
+
}
|
|
26091
26112
|
}, {
|
|
26092
26113
|
key: "sendHelloMessage",
|
|
26093
|
-
value:
|
|
26114
|
+
value: function () {
|
|
26094
26115
|
var _sendHelloMessage = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
26095
26116
|
var inputFormat, requestedOutputFormat, inputError, outputError, helloMessage;
|
|
26096
26117
|
return _regenerator().w(function (_context3) {
|
|
@@ -26164,6 +26185,10 @@ var VoiceSDK_v2 = /*#__PURE__*/function (_EventEmitter) {
|
|
|
26164
26185
|
helloMessage.agentSettingsOverride = this.config.agentSettingsOverride;
|
|
26165
26186
|
}
|
|
26166
26187
|
|
|
26188
|
+
// Automatically detect browser language
|
|
26189
|
+
helloMessage.locale = this.detectBrowserLocale();
|
|
26190
|
+
console.log('🌍 VoiceSDK v2: Auto-detected locale:', helloMessage.locale);
|
|
26191
|
+
|
|
26167
26192
|
// Optional: Variables (Map<String, String>)
|
|
26168
26193
|
console.log('🔍 VoiceSDK v2: Checking variables:', {
|
|
26169
26194
|
hasVariables: !!this.config.variables,
|
|
@@ -26233,7 +26258,6 @@ var VoiceSDK_v2 = /*#__PURE__*/function (_EventEmitter) {
|
|
|
26233
26258
|
/**
|
|
26234
26259
|
* Handle incoming WebSocket message
|
|
26235
26260
|
*/
|
|
26236
|
-
)
|
|
26237
26261
|
}, {
|
|
26238
26262
|
key: "handleMessage",
|
|
26239
26263
|
value: function handleMessage(event) {
|