ttp-agent-sdk 2.34.4 → 2.34.5

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.
@@ -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
  });
@@ -17119,7 +17133,19 @@ var VoiceInterface = /*#__PURE__*/function () {
17119
17133
  var activeState = this.shadowRoot.getElementById('voiceActiveState');
17120
17134
  if (activeState) activeState.style.display = 'none';
17121
17135
 
17122
- // Call the callback if provided (for unified mode - shows landing screen)
17136
+ // Call the public callback if provided (for user tracking/analytics)
17137
+ if (typeof this.config.onVoiceCallButtonClick === 'function') {
17138
+ try {
17139
+ this.config.onVoiceCallButtonClick({
17140
+ timestamp: Date.now(),
17141
+ widgetState: 'end'
17142
+ });
17143
+ } catch (error) {
17144
+ console.error('Error in onVoiceCallButtonClick callback:', error);
17145
+ }
17146
+ }
17147
+
17148
+ // Call the internal callback if provided (for unified mode - shows landing screen)
17123
17149
  // Otherwise show idle state (for voice-only mode or backward compatibility)
17124
17150
  if (this.config.onCallEnd) {
17125
17151
  this.config.onCallEnd();