@hivegpt/hiveai-angular 0.0.264 → 0.0.266

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.
@@ -1807,7 +1807,7 @@
1807
1807
  if (res) {
1808
1808
  _this.isDocInEditMode = true;
1809
1809
  _this.documentContent = res;
1810
- console.log('Get API callled');
1810
+ console.log('Get API callled success');
1811
1811
  console.log(res);
1812
1812
  }
1813
1813
  _this.cdr.markForCheck();
@@ -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,29 @@
2229
2230
  }
2230
2231
  BotHtmlEditorComponent.prototype.ngOnInit = function () {
2231
2232
  this.environment = prod_environment;
2233
+ if (this.isDocInEditMode) {
2234
+ console.log('In Edit mode');
2235
+ this.filldataInForm();
2236
+ }
2237
+ else {
2238
+ console.log('In save mode');
2239
+ }
2240
+ };
2241
+ BotHtmlEditorComponent.prototype.filldataInForm = function () {
2242
+ var _a, _b;
2243
+ if (this.documentContent) {
2244
+ this.documentName = (_a = this.documentContent) === null || _a === void 0 ? void 0 : _a.name;
2245
+ this.editorContent = (_b = this.documentContent) === null || _b === void 0 ? void 0 : _b.content;
2246
+ this.cdr.detectChanges();
2247
+ }
2232
2248
  };
2233
2249
  BotHtmlEditorComponent.prototype.saveContent = function () {
2234
- this.saveContent_http().subscribe();
2250
+ if (!this.isDocInEditMode) {
2251
+ this.saveContent_http().subscribe();
2252
+ }
2253
+ else {
2254
+ this.saveContent_http().subscribe();
2255
+ }
2235
2256
  };
2236
2257
  BotHtmlEditorComponent.prototype.saveContent_http = function () {
2237
2258
  var _this = this;
@@ -2256,6 +2277,29 @@
2256
2277
  return rxjs.of(null);
2257
2278
  }));
2258
2279
  };
2280
+ BotHtmlEditorComponent.prototype.updateContent_http = function () {
2281
+ var _this = this;
2282
+ console.log('API call function');
2283
+ var url = this.environment.AGENTS_API + "/ConversationDocuments/rename?conversationId=" + this.conversationId + "&botId=" + this.botId;
2284
+ var headers = new http.HttpHeaders({
2285
+ 'Content-Type': 'application/json',
2286
+ apiKey: 'WIz/qAm+EEmfOkFaUA/weA==',
2287
+ });
2288
+ var data = {
2289
+ name: this.documentName,
2290
+ content: this.editorContent,
2291
+ };
2292
+ return this.http.put(url, data, { headers: headers }).pipe(operators.switchMap(function (res) {
2293
+ if (res) {
2294
+ alert('Updated Successfully');
2295
+ }
2296
+ _this.cdr.markForCheck();
2297
+ return rxjs.of(res);
2298
+ }), operators.catchError(function (error) {
2299
+ console.error('Error fetching chatbot config: ', error);
2300
+ return rxjs.of(null);
2301
+ }));
2302
+ };
2259
2303
  return BotHtmlEditorComponent;
2260
2304
  }());
2261
2305
  BotHtmlEditorComponent.decorators = [