@hivegpt/hiveai-angular 0.0.213 → 0.0.215

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.
@@ -687,6 +687,7 @@
687
687
  this.closeBot = new i0.EventEmitter();
688
688
  this.connectWithUser = new i0.EventEmitter();
689
689
  this.scheduleMeeting = new i0.EventEmitter();
690
+ this.refreshToken = new i0.EventEmitter();
690
691
  this.autogenKey = "Autogen_eDJTtEU-NB0RtIpzq1w";
691
692
  this.addToMyAgendaAction = "add_to_my_agenda";
692
693
  this.myUpcomingSessionAction = "my_upcomming_session";
@@ -767,6 +768,21 @@
767
768
  // this.isIOSDevice = true;
768
769
  // }
769
770
  }
771
+ ChatDrawerComponent.prototype.ngOnChanges = function (changes) {
772
+ if (changes.s27Token) {
773
+ if (changes.s27Token.currentValue != changes.s27Token.previousValue) {
774
+ this.s27Token = changes.s27Token.currentValue;
775
+ if (this.is401) {
776
+ if (this.isFetchDataFor) {
777
+ this.fetchDataFor(this.msg, this.chat);
778
+ }
779
+ else {
780
+ this.fetchData();
781
+ }
782
+ }
783
+ }
784
+ }
785
+ };
770
786
  ChatDrawerComponent.prototype.ngOnInit = function () {
771
787
  var _this = this;
772
788
  this.environment = this.isDev ? dev_environment : prod_environment;
@@ -1120,6 +1136,7 @@
1120
1136
  method: 'POST',
1121
1137
  headers: {
1122
1138
  'Content-Type': 'application/json',
1139
+ 'Authorization': this.s27Token,
1123
1140
  'x-api-key': this.apiKey,
1124
1141
  },
1125
1142
  body: JSON.stringify({
@@ -1130,6 +1147,18 @@
1130
1147
  agents: this.agents.filter(function (p) { return p.selected; }).map(function (p) { return p.id; }),
1131
1148
  conversation_id: this.conversationKey,
1132
1149
  }),
1150
+ })
1151
+ .then(function (response) {
1152
+ if (response.status === 401) {
1153
+ _this.is401 = true;
1154
+ _this.refreshToken.emit();
1155
+ }
1156
+ return response.json(); // Continue processing the response
1157
+ })
1158
+ .then(function (data) {
1159
+ // Handle the response data
1160
+ _this.is401 = false;
1161
+ console.log(data);
1133
1162
  })
1134
1163
  .catch(function (err) {
1135
1164
  console.error('Error: ', err);
@@ -1165,6 +1194,7 @@
1165
1194
  method: 'POST',
1166
1195
  headers: {
1167
1196
  'Content-Type': 'application/json',
1197
+ 'Authorization': this.s27Token,
1168
1198
  'x-api-key': this.apiKey,
1169
1199
  },
1170
1200
  body: JSON.stringify({
@@ -1175,6 +1205,21 @@
1175
1205
  agents: this.agents.filter(function (p) { return p.selected; }).map(function (p) { return p.id; }),
1176
1206
  conversation_id: this.conversationKey,
1177
1207
  }),
1208
+ })
1209
+ .then(function (response) {
1210
+ if (response.status === 401) {
1211
+ _this.msg = msg;
1212
+ _this.chat = chat;
1213
+ _this.is401 = true;
1214
+ _this.isFetchDataFor = true;
1215
+ _this.refreshToken.emit();
1216
+ }
1217
+ return response.json(); // Continue processing the response
1218
+ })
1219
+ .then(function (data) {
1220
+ // Handle the response data
1221
+ _this.is401 = false;
1222
+ console.log(data);
1178
1223
  })
1179
1224
  .catch(function (err) {
1180
1225
  console.error('Error: ', err);
@@ -1779,7 +1824,7 @@
1779
1824
  dateTimeColor: [{ type: i0.Input }],
1780
1825
  dateTextColor: [{ type: i0.Input }],
1781
1826
  eventId: [{ type: i0.Input }],
1782
- s27UserToken: [{ type: i0.Input }],
1827
+ s27Token: [{ type: i0.Input }],
1783
1828
  eventName: [{ type: i0.Input }],
1784
1829
  botIcon: [{ type: i0.Input }],
1785
1830
  formFieldBgColor: [{ type: i0.Input }],
@@ -1808,7 +1853,8 @@
1808
1853
  sessionActions: [{ type: i0.Output }],
1809
1854
  closeBot: [{ type: i0.Output }],
1810
1855
  connectWithUser: [{ type: i0.Output }],
1811
- scheduleMeeting: [{ type: i0.Output }]
1856
+ scheduleMeeting: [{ type: i0.Output }],
1857
+ refreshToken: [{ type: i0.Output }]
1812
1858
  };
1813
1859
 
1814
1860
  var ChatBotComponent = /** @class */ (function () {