@hivegpt/hiveai-angular 0.0.570 → 0.0.572

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.
@@ -1736,9 +1736,9 @@
1736
1736
  this.isUserSpeakingSubject.next(false);
1737
1737
  this.audioLevelsSubject.next([]);
1738
1738
  };
1739
- VoiceAgentService.prototype.connect = function (apiUrl, token, botId, conversationId, apiKey, eventToken, eventUrl, domainAuthority, usersApiUrl) {
1739
+ VoiceAgentService.prototype.connect = function (apiUrl, token, botId, conversationId, apiKey, eventToken, eventId, eventUrl, domainAuthority, usersApiUrl) {
1740
1740
  return __awaiter(this, void 0, void 0, function () {
1741
- var accessToken, ensured, _a_1, postUrl, res, json, wsUrl, e_1;
1741
+ var accessToken, ensured, _a_1, base, postUrl, eventIdHeader, res, json, wsUrl, e_1;
1742
1742
  var _this = this;
1743
1743
  return __generator(this, function (_b) {
1744
1744
  switch (_b.label) {
@@ -1769,7 +1769,9 @@
1769
1769
  _a_1 = _b.sent();
1770
1770
  return [3 /*break*/, 5];
1771
1771
  case 5:
1772
+ base = (apiUrl || '').replace(/\/+$/, '');
1772
1773
  postUrl = "https://1356-103-210-33-236.ngrok-free.app/ai/ask-voice";
1774
+ eventIdHeader = (eventId && String(eventId).trim()) || '';
1773
1775
  return [4 /*yield*/, fetch(postUrl, {
1774
1776
  method: 'POST',
1775
1777
  headers: {
@@ -1780,6 +1782,7 @@
1780
1782
  eventurl: eventUrl,
1781
1783
  'hive-bot-id': botId,
1782
1784
  'x-api-key': apiKey,
1785
+ eventId: eventIdHeader,
1783
1786
  },
1784
1787
  body: JSON.stringify({
1785
1788
  bot_id: botId,
@@ -1938,6 +1941,7 @@
1938
1941
  this.close = new i0.EventEmitter();
1939
1942
  this.apiKey = '';
1940
1943
  this.eventToken = '';
1944
+ this.eventId = '';
1941
1945
  this.eventUrl = '';
1942
1946
  this.domainAuthority = 'prod-lite';
1943
1947
  this.agentName = 'AI Assistant';
@@ -1961,7 +1965,7 @@
1961
1965
  }
1962
1966
  VoiceAgentModalComponent.prototype.ngOnInit = function () {
1963
1967
  var _this = this;
1964
- var _a, _b, _c, _d, _e, _f, _g;
1968
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1965
1969
  // When opened via Overlay, config is provided by injection
1966
1970
  this.injectedConfig = this.injector.get(VOICE_MODAL_CONFIG, null);
1967
1971
  this.onCloseCallback = this.injector.get(VOICE_MODAL_CLOSE_CALLBACK, null);
@@ -1972,12 +1976,13 @@
1972
1976
  this.conversationId = this.injectedConfig.conversationId;
1973
1977
  this.apiKey = (_a = this.injectedConfig.apiKey) !== null && _a !== void 0 ? _a : '';
1974
1978
  this.eventToken = (_b = this.injectedConfig.eventToken) !== null && _b !== void 0 ? _b : '';
1975
- this.eventUrl = (_c = this.injectedConfig.eventUrl) !== null && _c !== void 0 ? _c : '';
1976
- this.domainAuthority = (_d = this.injectedConfig.domainAuthority) !== null && _d !== void 0 ? _d : 'prod-lite';
1977
- this.agentName = (_e = this.injectedConfig.agentName) !== null && _e !== void 0 ? _e : this.agentName;
1978
- this.agentRole = (_f = this.injectedConfig.agentRole) !== null && _f !== void 0 ? _f : this.agentRole;
1979
+ this.eventId = (_c = this.injectedConfig.eventId) !== null && _c !== void 0 ? _c : '';
1980
+ this.eventUrl = (_d = this.injectedConfig.eventUrl) !== null && _d !== void 0 ? _d : '';
1981
+ this.domainAuthority = (_e = this.injectedConfig.domainAuthority) !== null && _e !== void 0 ? _e : 'prod-lite';
1982
+ this.agentName = (_f = this.injectedConfig.agentName) !== null && _f !== void 0 ? _f : this.agentName;
1983
+ this.agentRole = (_g = this.injectedConfig.agentRole) !== null && _g !== void 0 ? _g : this.agentRole;
1979
1984
  this.agentAvatar = this.injectedConfig.agentAvatar;
1980
- this.usersApiUrl = (_g = this.injectedConfig.usersApiUrl) !== null && _g !== void 0 ? _g : this.usersApiUrl;
1985
+ this.usersApiUrl = (_h = this.injectedConfig.usersApiUrl) !== null && _h !== void 0 ? _h : this.usersApiUrl;
1981
1986
  }
1982
1987
  // Subscribe to observables
1983
1988
  this.subscriptions.push(this.voiceAgentService.callState$.subscribe(function (state) {
@@ -2016,21 +2021,21 @@
2016
2021
  VoiceAgentModalComponent.prototype.startCall = function () {
2017
2022
  return __awaiter(this, void 0, void 0, function () {
2018
2023
  var error_1;
2019
- return __generator(this, function (_h) {
2020
- switch (_h.label) {
2024
+ return __generator(this, function (_j) {
2025
+ switch (_j.label) {
2021
2026
  case 0:
2022
2027
  if (this.isConnecting || (this.callState !== 'idle' && this.callState !== 'ended'))
2023
2028
  return [2 /*return*/];
2024
2029
  this.isConnecting = true;
2025
- _h.label = 1;
2030
+ _j.label = 1;
2026
2031
  case 1:
2027
- _h.trys.push([1, 3, 4, 5]);
2028
- return [4 /*yield*/, this.voiceAgentService.connect(this.apiUrl, this.token, this.botId, this.conversationId, this.apiKey, this.eventToken, this.eventUrl, this.domainAuthority, this.usersApiUrl || undefined)];
2032
+ _j.trys.push([1, 3, 4, 5]);
2033
+ return [4 /*yield*/, this.voiceAgentService.connect(this.apiUrl, this.token, this.botId, this.conversationId, this.apiKey, this.eventToken, this.eventId, this.eventUrl, this.domainAuthority, this.usersApiUrl || undefined)];
2029
2034
  case 2:
2030
- _h.sent();
2035
+ _j.sent();
2031
2036
  return [3 /*break*/, 5];
2032
2037
  case 3:
2033
- error_1 = _h.sent();
2038
+ error_1 = _j.sent();
2034
2039
  console.error('Failed to connect voice agent:', error_1);
2035
2040
  return [3 /*break*/, 5];
2036
2041
  case 4:
@@ -2043,11 +2048,11 @@
2043
2048
  };
2044
2049
  VoiceAgentModalComponent.prototype.disconnect = function () {
2045
2050
  return __awaiter(this, void 0, void 0, function () {
2046
- return __generator(this, function (_h) {
2047
- switch (_h.label) {
2051
+ return __generator(this, function (_j) {
2052
+ switch (_j.label) {
2048
2053
  case 0: return [4 /*yield*/, this.voiceAgentService.disconnect()];
2049
2054
  case 1:
2050
- _h.sent();
2055
+ _j.sent();
2051
2056
  return [2 /*return*/];
2052
2057
  }
2053
2058
  });
@@ -2119,6 +2124,7 @@
2119
2124
  conversationId: [{ type: i0.Input }],
2120
2125
  apiKey: [{ type: i0.Input }],
2121
2126
  eventToken: [{ type: i0.Input }],
2127
+ eventId: [{ type: i0.Input }],
2122
2128
  eventUrl: [{ type: i0.Input }],
2123
2129
  domainAuthority: [{ type: i0.Input }],
2124
2130
  agentName: [{ type: i0.Input }],
@@ -5594,7 +5600,7 @@
5594
5600
  };
5595
5601
  ChatDrawerComponent.prototype.openVoiceModal = function () {
5596
5602
  var _this = this;
5597
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
5603
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
5598
5604
  var conversationId = (_b = (_a = this.conversationKey) !== null && _a !== void 0 ? _a : this.conversationService.getKey(this.botId, false, this.eventId)) !== null && _b !== void 0 ? _b : '';
5599
5605
  this.voiceModalConversationId = conversationId;
5600
5606
  this.setupVoiceTranscripts();
@@ -5611,12 +5617,13 @@
5611
5617
  conversationId: conversationId,
5612
5618
  apiKey: (_g = this.apiKey) !== null && _g !== void 0 ? _g : '',
5613
5619
  eventToken: (_h = this.eventToken) !== null && _h !== void 0 ? _h : '',
5614
- eventUrl: (_j = this.eventUrl) !== null && _j !== void 0 ? _j : '',
5615
- domainAuthority: (_k = this.domainAuthorityValue) !== null && _k !== void 0 ? _k : 'prod-lite',
5620
+ eventId: (_j = this.eventId) !== null && _j !== void 0 ? _j : '',
5621
+ eventUrl: (_k = this.eventUrl) !== null && _k !== void 0 ? _k : '',
5622
+ domainAuthority: (_l = this.domainAuthorityValue) !== null && _l !== void 0 ? _l : 'prod-lite',
5616
5623
  agentName: this.botName || 'AI Assistant',
5617
5624
  agentRole: this.botSkills || 'AI Agent Specialist',
5618
5625
  agentAvatar: this.botIcon,
5619
- usersApiUrl: (_m = (_l = this.environment) === null || _l === void 0 ? void 0 : _l.USERS_API) !== null && _m !== void 0 ? _m : '',
5626
+ usersApiUrl: (_o = (_m = this.environment) === null || _m === void 0 ? void 0 : _m.USERS_API) !== null && _o !== void 0 ? _o : '',
5620
5627
  };
5621
5628
  var closeCallback = function () {
5622
5629
  if (_this.voiceModalOverlayRef) {