@hivegpt/hiveai-angular 0.0.264 → 0.0.265

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.
@@ -1887,6 +1887,7 @@
1887
1887
  }
1888
1888
  };
1889
1889
  ChatDrawerComponent.prototype.openOuterEditor = function () {
1890
+ this.fetchEditorContent();
1890
1891
  this.editorsDrawer.open();
1891
1892
  this.isDrawerOpen = true;
1892
1893
  this.cdr.detectChanges();
@@ -2229,9 +2230,24 @@
2229
2230
  }
2230
2231
  BotHtmlEditorComponent.prototype.ngOnInit = function () {
2231
2232
  this.environment = prod_environment;
2233
+ if (this.isDocInEditMode) {
2234
+ this.filldataInForm();
2235
+ }
2236
+ };
2237
+ BotHtmlEditorComponent.prototype.filldataInForm = function () {
2238
+ var _a, _b;
2239
+ if (this.documentContent) {
2240
+ this.documentName = (_a = this.documentContent) === null || _a === void 0 ? void 0 : _a.name;
2241
+ this.editorContent = (_b = this.documentContent) === null || _b === void 0 ? void 0 : _b.content;
2242
+ }
2232
2243
  };
2233
2244
  BotHtmlEditorComponent.prototype.saveContent = function () {
2234
- this.saveContent_http().subscribe();
2245
+ if (!this.isDocInEditMode) {
2246
+ this.saveContent_http().subscribe();
2247
+ }
2248
+ else {
2249
+ this.saveContent_http().subscribe();
2250
+ }
2235
2251
  };
2236
2252
  BotHtmlEditorComponent.prototype.saveContent_http = function () {
2237
2253
  var _this = this;
@@ -2256,6 +2272,29 @@
2256
2272
  return rxjs.of(null);
2257
2273
  }));
2258
2274
  };
2275
+ BotHtmlEditorComponent.prototype.updateContent_http = function () {
2276
+ var _this = this;
2277
+ console.log('API call function');
2278
+ var url = this.environment.AGENTS_API + "/ConversationDocuments/rename?conversationId=" + this.conversationId + "&botId=" + this.botId;
2279
+ var headers = new http.HttpHeaders({
2280
+ 'Content-Type': 'application/json',
2281
+ apiKey: 'WIz/qAm+EEmfOkFaUA/weA==',
2282
+ });
2283
+ var data = {
2284
+ name: this.documentName,
2285
+ content: this.editorContent,
2286
+ };
2287
+ return this.http.put(url, data, { headers: headers }).pipe(operators.switchMap(function (res) {
2288
+ if (res) {
2289
+ alert('Updated Successfully');
2290
+ }
2291
+ _this.cdr.markForCheck();
2292
+ return rxjs.of(res);
2293
+ }), operators.catchError(function (error) {
2294
+ console.error('Error fetching chatbot config: ', error);
2295
+ return rxjs.of(null);
2296
+ }));
2297
+ };
2259
2298
  return BotHtmlEditorComponent;
2260
2299
  }());
2261
2300
  BotHtmlEditorComponent.decorators = [