@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.
@@ -1398,6 +1398,7 @@ class ChatDrawerComponent {
1398
1398
  }
1399
1399
  }
1400
1400
  openOuterEditor() {
1401
+ this.fetchEditorContent();
1401
1402
  this.editorsDrawer.open();
1402
1403
  this.isDrawerOpen = true;
1403
1404
  this.cdr.detectChanges();
@@ -1731,9 +1732,24 @@ class BotHtmlEditorComponent {
1731
1732
  }
1732
1733
  ngOnInit() {
1733
1734
  this.environment = prod_environment;
1735
+ if (this.isDocInEditMode) {
1736
+ this.filldataInForm();
1737
+ }
1738
+ }
1739
+ filldataInForm() {
1740
+ var _a, _b;
1741
+ if (this.documentContent) {
1742
+ this.documentName = (_a = this.documentContent) === null || _a === void 0 ? void 0 : _a.name;
1743
+ this.editorContent = (_b = this.documentContent) === null || _b === void 0 ? void 0 : _b.content;
1744
+ }
1734
1745
  }
1735
1746
  saveContent() {
1736
- this.saveContent_http().subscribe();
1747
+ if (!this.isDocInEditMode) {
1748
+ this.saveContent_http().subscribe();
1749
+ }
1750
+ else {
1751
+ this.saveContent_http().subscribe();
1752
+ }
1737
1753
  }
1738
1754
  saveContent_http() {
1739
1755
  console.log('API call function');
@@ -1757,6 +1773,28 @@ class BotHtmlEditorComponent {
1757
1773
  return of(null);
1758
1774
  }));
1759
1775
  }
1776
+ updateContent_http() {
1777
+ console.log('API call function');
1778
+ const url = `${this.environment.AGENTS_API}/ConversationDocuments/rename?conversationId=${this.conversationId}&botId=${this.botId}`;
1779
+ const headers = new HttpHeaders({
1780
+ 'Content-Type': 'application/json',
1781
+ apiKey: 'WIz/qAm+EEmfOkFaUA/weA==',
1782
+ });
1783
+ let data = {
1784
+ name: this.documentName,
1785
+ content: this.editorContent,
1786
+ };
1787
+ return this.http.put(url, data, { headers }).pipe(switchMap((res) => {
1788
+ if (res) {
1789
+ alert('Updated Successfully');
1790
+ }
1791
+ this.cdr.markForCheck();
1792
+ return of(res);
1793
+ }), catchError((error) => {
1794
+ console.error('Error fetching chatbot config: ', error);
1795
+ return of(null);
1796
+ }));
1797
+ }
1760
1798
  }
1761
1799
  BotHtmlEditorComponent.decorators = [
1762
1800
  { type: Component, args: [{