-
-
+
-
+
{{ faqkb?.createdAt | amDateFormat: 'LLL'}}
-
-
-
+
+
+
-
+
edit
-
- content_copy
-
+
+ content_copy
+
-
-
-
-
+
+ matTooltip="{{ 'BotsPage.tooltipDeleteBot' | translate }}" #tooltip="matTooltip"
+ matTooltipPosition='below' matTooltipHideDelay="100">
close
diff --git a/src/app/bots/bots-list/bots-list.component.scss b/src/app/bots/bots-list/bots-list.component.scss
index 465ea03b1ea2..213572438e60 100755
--- a/src/app/bots/bots-list/bots-list.component.scss
+++ b/src/app/bots/bots-list/bots-list.component.scss
@@ -346,18 +346,26 @@ input[type="checkbox"]:disabled {
color: #fff;
}
-
-.no-bot-tr-msg-wpr:hover {
- background-color: #fff !important;
+.no-bot-tr-msg-wpr {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ flex-direction: row;
}
+// .no-bot-tr-msg-wpr:hover {
+// background-color: #fff !important;
+// }
+
.no-bot-msg {
font-size: 18px;
margin-bottom: 0px;
- color: #353f45;
+ color: var(--text-color);
font-weight: 400;
- font-family: 'Poppins';
- margin-top: 25px;
+ font-family: var(--header-font-family);
+ margin-top: 60px;
+ text-align: center;
+ line-height: 1.7em;
}
.btn---link {
@@ -367,4 +375,267 @@ input[type="checkbox"]:disabled {
.btn---link:hover {
text-decoration: underline;
-}
\ No newline at end of file
+}
+
+/* New chatbot table
+/* ************************************* */
+// .page-title--wrapper {
+// justify-content: space-between;
+// display: flex;
+// flex-flow: row;
+// margin: 15px 26px;
+// }
+// .page-title--wrapper .title--header {
+// font-size: var(--title--header-font-size);
+// font-weight: var(--title--header-font-weight);
+// font-style: normal;
+// font-stretch: normal;
+// line-height: normal;
+// letter-spacing: 0px;
+// color: var(--text-color);
+// margin-bottom: 0;
+// cursor: default;
+// display: flex;
+// align-items: center;
+// font-family: var(--header-font-family) ;
+// text-transform: var(--title--header-text-transform);
+// }
+
+// .page-title--wrapper .page--actions {
+// display: flex;
+// align-items: center;
+// }
+
+// .page--actions > .order-by-label {
+// margin-right: 12px;
+// font-weight: var(--order-by-label-font-weight);
+// font-family: var(--header-font-family);
+// color: var(--secondary-text-color) ;
+// font-size: var(--order-by-label-font-size);
+// }
+
+// .order-by-selected-value {
+// color: var(--text-color);
+// font-weight:var(--order-by-selectet-value-font-weight);
+// font-family: var(--header-font-family);
+// font-size: var(--order-by-selectet-value-font-size)
+// }
+
+// .dropdown-caret {
+// color: var(--text-color)!important;
+// }
+
+// .caret-rotate-0 {
+// transform: rotate(0deg);
+// }
+
+// .caret-rotate-180 {
+// transform: rotate(180deg);
+// }
+
+
+// .cl-card {
+// align-items: center;
+// display: flex;
+// height: 100px;
+// justify-content: space-between;
+// letter-spacing: 0px;
+// margin: 10px 26px 0px;
+// padding: 0px;
+// border-radius: var(--cl-card-border-radius);
+// box-shadow: var(--card-elevation);
+// border: 1px solid transparent;
+// background-color: var(--card-background-color);
+// transition: transform .2s cubic-bezier(.4, 1, .75, .9), box-shadow .2s cubic-bezier(.4, 1, .75, .9);
+// -webkit-font-smoothing: antialiased;
+// text-rendering: optimizeLegibility;
+// cursor: pointer;
+// }
+
+// .cl-card:hover {
+// box-shadow: var(--card-deep-elevation)
+// }
+
+// .cl-card-content{
+// display: flex;
+// justify-content: space-between;
+// flex: 1 1 0%;
+// min-width: 0px;
+// padding: 10px 10px 10px 0px;
+// }
+
+// .cl-card-first-column {
+// display: flex;
+// align-items: center;
+// }
+
+// .bot-list-type-logo-img-wpr {
+// width: 18px;
+// height: 18px;
+// position: absolute;
+// top: -37px;
+// left: 13px;
+// border-radius: 50%;
+// border: 1px solid #eee;
+// background: #fff;
+// }
+
+// .cl-card-img-wpr {
+// // background-color: #f7b6a7;
+// border-radius: var(--cl-card-img-wpr-border-radius);
+// height: 64px;
+// width: 64px;
+// display: flex;
+// align-items: center;
+// justify-content: center;
+// overflow: hidden;
+// margin-left: 20px;
+// border: var(--cl-card-img-wpr-border)
+// }
+
+// // .cl-card-img-wpr>img {
+// // vertical-align: middle;
+// // width: 52px;
+// // height: 52px;
+// // border-radius: 50%;
+// // border: 1px solid #eee;
+// // object-fit: cover;
+// // }
+
+// .cl-card-info-wpr {
+// margin-left: 20px;
+// display: flex;
+// flex-flow: column;
+// flex: 1 1 0%;
+// min-width: 0px;
+// }
+
+// .cl-card-item-name-wpr {
+// display: flex;
+// flex-direction: row;
+// }
+
+// .cl-card-item-name {
+// font-size: var(--cl-card-item-name-font-size);
+// letter-spacing: 0px;
+// font-weight: var(--cl-card-item-name-font-weight);
+// // text-transform: uppercase;
+// white-space: nowrap;
+// overflow: hidden;
+// text-overflow: ellipsis;
+// word-wrap: normal;
+// font-family: var(--header-font-family);
+// color: var(--text-color);
+// }
+
+// .cl-card-item-description-wpr {
+// font-size: var(--cl-card-item-description-wpr-font-size);
+// font-weight: var(--cl-card-item-description-wpr-font-weight);
+// margin-top: 4px;
+// display: table;
+// table-layout: fixed;
+// width: 90%;
+// }
+
+// .cl-card-item-description-wpr > .cl-card-item-description {
+// display: table-cell;
+// white-space: nowrap;
+// text-overflow: ellipsis;
+// overflow: hidden;
+// margin-left: 24px;
+// }
+
+// .cl-card-item-info {
+// font-size: var(--cl-card-item-info-font-size);
+// color: var(--secondary-text-color);
+// letter-spacing: 0px;
+// opacity: var(--cl-card-item-info-opacity);
+// font-family: var(--content-font-family);
+// font-weight: var(--cl-card-item-info-font-weight);
+// // margin-bottom: 4px;
+// }
+
+// .cl-card-second-column {
+// display: flex;
+// align-items: center;
+// }
+
+// .cl-card-stats-wpr {
+// display: flex;
+// flex-flow: row;
+// }
+
+// // .bot-card-stats-wpr-draft-bot {
+// // margin-right: 26px;
+// // }
+
+// .cl-card-item-stats {
+// margin-left: 10px;
+// padding-right: 10px;
+// display: flex;
+// flex-flow: column;
+// justify-content: center;
+// align-items: center;
+// border-right: 1px solid rgba(131, 134, 158, .2);
+// min-width: 70px;
+// }
+
+// .card-list-item-stats:last-child {
+// border-right: 0;
+// }
+
+// .cl-card-item-stats-title{
+// font-size: var(--cl-card-item-stats-title-font-size);
+// letter-spacing: 0px;
+// text-transform: var(--cl-card-item-stats-title-text-transform);
+// color: var(--text-color);
+// font-family: var(--header-font-family);
+// font-weight: var(--cl-card-item-stats-title-font-weight);
+// }
+
+// .cl-card-item-stats-values {
+// font-size: var(--cl-card-item-stats-values-font-size);
+// font-weight: var(--cl-card-item-stats-values-font-weight);
+// letter-spacing: 0px;
+// color: var(--text-color);
+// }
+
+// .cl-card-item-stats-values>.bot-published-icon {
+// color: #4caf50;
+// font-size: 16px;
+// position: relative;
+// top: 2px;
+// }
+
+// .cl-card-item-stats-values>.bot-unpublished-icon {
+// color: #f44336;
+// font-size: 16px;
+// position: relative;
+// top: 2px;
+// }
+
+// .cl-card-action-group {
+// margin-left: 20px;
+// margin-right: 20px;
+// display: inline-flex;
+// gap: 12px;
+// }
+
+// .cl-card-action-btn-wpr {
+// display: flex;
+// flex: 1 1 auto;
+// }
+// .mat-icon-button {
+// color: var(--icon-color)
+// }
+
+// .mat-icon-button:hover {
+// background-color: var(--mat-icon-button-hover-background-color);
+// border-radius: 50%;
+// color: var(--icon-hover-color)
+// }
+
+// .mat-menu-btn>mat-icon {
+// font-size: var(--mat-icon-font-size) !important;
+// margin-top: 4px !important;
+// }
\ No newline at end of file
diff --git a/src/app/bots/bots-list/bots-list.component.ts b/src/app/bots/bots-list/bots-list.component.ts
index 5c03cc07785b..baf619506570 100755
--- a/src/app/bots/bots-list/bots-list.component.ts
+++ b/src/app/bots/bots-list/bots-list.component.ts
@@ -1,9 +1,8 @@
import { Component, isDevMode, OnInit, OnDestroy } from '@angular/core';
import { FaqKbService } from '../../services/faq-kb.service';
-import { FaqKb } from '../../models/faq_kb-model';
-import { Router, RoutesRecognized } from '@angular/router';
+import { Chatbot, FaqKb } from '../../models/faq_kb-model';
+import { Router } from '@angular/router';
import { FaqService } from '../../services/faq.service';
-
import { Project } from '../../models/project-model';
import { AuthService } from '../../core/auth.service';
import { Location } from '@angular/common';
@@ -11,22 +10,22 @@ import { NotifyService } from '../../core/notify.service';
import { TranslateService } from '@ngx-translate/core';
import { AppConfigService } from '../../services/app-config.service';
import { DepartmentService } from '../../services/department.service';
-// import brand from 'assets/brand/brand.json';
import { BrandService } from '../../services/brand.service';
import { LoggerService } from '../../services/logger/logger.service';
import { ProjectService } from 'app/services/project.service';
import { BotLocalDbService } from 'app/services/bot-local-db.service';
import { MatDialog } from '@angular/material/dialog';
import { CloneBotComponent } from './clone-bot/clone-bot.component';
-// import { goToCDSVersion } from 'app/utils/util';
import { CHATBOT_MAX_NUM, goToCDSVersion, PLAN_NAME } from 'app/utils/util';
import { ProjectPlanService } from 'app/services/project-plan.service';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators'
import { UsersService } from 'app/services/users.service';
import { ChatbotModalComponent } from './chatbot-modal/chatbot-modal.component';
-import { BotsBaseComponent } from '../bots-base/bots-base.component';
import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.component';
+import {Clipboard} from '@angular/cdk/clipboard';
+import {MatSnackBar} from '@angular/material/snack-bar';
+import { MessagesStatsModalComponent } from 'app/components/modals/messages-stats-modal/messages-stats-modal.component';
const swal = require('sweetalert');
@Component({
@@ -44,8 +43,6 @@ export class BotListComponent extends PricingBaseComponent implements OnInit, On
faqkbList: FaqKb[];
myChatbotAllCount: number;
navigationBaseUrl: string;
-
-
// set to none the property display of the modal
display = 'none'; // NO MORE USED (IS THE OLD MODAL USED TO DELETE THE BOT)
displayDeleteBotModal = 'none'; // THE NEW MODAL USED TO DELETE THE BOT
@@ -53,7 +50,9 @@ export class BotListComponent extends PricingBaseComponent implements OnInit, On
SHOW_CIRCULAR_SPINNER = false;
id_toDelete: string;
-
+ botIdToRename: string = '';
+ botToRename: any;
+ newBotName:string;
faqKbId: string;
faq_faqKbId: string;
@@ -99,10 +98,10 @@ export class BotListComponent extends PricingBaseComponent implements OnInit, On
customerSatisfactionBotsCount: number;
myChatbotOtherCount: number;
increaseSalesBotsCount: number;
-
+
customerSatisfactionBots: any;
increaseSalesBots: any;
-
+
route: string
dev_mode: boolean;
isPanelRoute: boolean = false;
@@ -127,7 +126,18 @@ export class BotListComponent extends PricingBaseComponent implements OnInit, On
public contactUs: string;
learnMoreAboutDefaultRoles: string;
agentsCannotManageChatbots: string;
- salesEmail:string;
+ salesEmail: string;
+ WIDGET_BASE_URL: string;
+ defaultDeptId: string;
+ is0penDropDown: boolean = false
+ isOpen: boolean;
+
+ orderBylastUpdated: boolean = true;
+ orderByCreationDate: boolean = false;
+ orderByChatbotName: boolean = false;
+ pageName: string;
+
+ // editBotName: boolean = false;
constructor(
private faqKbService: FaqKbService,
private router: Router,
@@ -144,7 +154,9 @@ export class BotListComponent extends PricingBaseComponent implements OnInit, On
private botLocalDbService: BotLocalDbService,
public dialog: MatDialog,
public prjctPlanService: ProjectPlanService,
- public usersService: UsersService
+ public usersService: UsersService,
+ private clipboard: Clipboard,
+ private _snackBar: MatSnackBar
) {
super(prjctPlanService, notify);
const brand = brandService.getBrand();
@@ -171,6 +183,7 @@ export class BotListComponent extends PricingBaseComponent implements OnInit, On
this.getNavigationBaseUrl()
this.getProjectPlan();
this.getUserRole();
+ this.getDefaultDeptId();
}
ngOnDestroy() {
@@ -270,10 +283,107 @@ export class BotListComponent extends PricingBaseComponent implements OnInit, On
});
}
- duplicateChatbot(bot_id, bot_name) {
- this.logger.log('[BOTS-LIST] duplicateChatbot chatBotCount ', this.chatBotCount, ' chatBotLimit ', this.chatBotLimit, ' USER_ROLE ', this.USER_ROLE, ' profile_name ', this.profile_name)
+ renameChatbot(bot) {
+ this.botIdToRename = bot._id;
+ this.logger.log('[BOTS-LIST] botIdToRename' , this.botIdToRename)
+ this.botToRename = bot
+ this.logger.log('[BOTS-LIST] botToRename' , this.botToRename)
+ // this.editBotName = true;
+ }
+
+ onPressEnterUpdateChatBotName(event) {
+ this.logger.log('[BOTS-LIST] onPressEnterUpdateChatBotName event ', event )
+ if (event.code === 'Enter' || event.which === 13) {
+ this.updateChatbot()
+ }
+ }
+
+ changeChatBotName(event) {
+ this.logger.log('[BOTS-LIST] changeChatBotName event ', event )
+ this.newBotName = event
+ }
+
+
+
+ shareWithLink(botid, botname) {
+ this.logger.log('[BOTS-LIST] - UPDATED CHATBOT - shareWithLink botid', botid);
+ this.logger.log('[BOTS-LIST] - UPDATED CHATBOT - shareWithLink botname', botname);
+ // https://widget.tiledesk.com/v6/assets/twp/chatbot-panel.html?tiledesk_projectid=64959b8a6998ee001399056e&tiledesk_participants=bot_65bc881f4bc2250013ca8832&tiledesk_departmentID=64959b8a6998ee0013990572&tiledesk_hideHeaderCloseButton=true&tiledesk_widgetTitle=Showcase%20Deals&tiledesk_preChatForm=false&td_draft=true
+ // https://widget-pre.tiledesk.com/v5/assets/twp/chatbot-panel.html?tiledesk_projectid=65cb48c7b6343a002fce77de&tiledesk_participants=bot_65cb48d5b6343a002fce7845&tiledesk_departmentID=65cb48c7b6343a002fce77e2&tiledesk_hideHeaderCloseButton=true&tiledesk_widgetTitle=Nikola&tiledesk_preChatForm=false&td_draft=true
+ // WIDGET_BASE_URL = 'https://widget.tiledesk.com/v6/' (prod)
+ // WIDGET_BASE_URL = ''https://widget-pre.tiledesk.com/v5/' (pre)
+ this.WIDGET_BASE_URL = this.appConfigService.getConfig().WIDGET_BASE_URL;
+ const botLink = this.WIDGET_BASE_URL + "assets/twp/chatbot-panel.html?tiledesk_projectid=" +this.currentProjectId+ "&tiledesk_participants=bot_" + botid + "&tiledesk_departmentID="+ this.defaultDeptId + "&tiledesk_hideHeaderCloseButton=true&tiledesk_widgetTitle="+botname + "&tiledesk_preChatForm=false&td_draft=true"
+ this.clipboard.copy(botLink)
+ this._snackBar.open(" Copied to clipboard", null, {
+ duration: 3000,
+ verticalPosition: 'top',
+ panelClass:'success-snackbar'
+ });
+ }
+
+ openTestSiteInPopupWindow(botid) {
+ // https://widget.tiledesk.com/v6/assets/twp/chatbot-panel.html?tiledesk_projectid=63d7911ca7b3d3001a4a9404&tiledesk_participants=bot_65605e3dfb23780013b92711&tiledesk_departmentID=63d7911ca7b3d3001a4a9408
+ // this.logger.log('openTestSiteInPopupWindow TESTSITE_BASE_URL', this.TESTSITE_BASE_URL)
+ this.WIDGET_BASE_URL = this.appConfigService.getConfig().WIDGET_BASE_URL;
+
+ const testItOutUrl = this.WIDGET_BASE_URL + "assets/twp/chatbot-panel.html?tiledesk_projectid=" + this.currentProjectId + '&tiledesk_participants=bot_' + botid + "&tiledesk_departmentID=" + this.defaultDeptId
+ // this.logger.log('openTestSiteInPopupWindow testItOutUrl ', testItOutUrl)
+ let left = (screen.width - 830) / 2;
+ let top = (screen.height - 727) / 4;
+ let params = `toolbar=no,menubar=no,width=830,height=727,left=${left},top=${top}`;
+ window.open(testItOutUrl, '_blank', params);
+ }
+
+ // --------------------------------------------------------------------------------------
+ // Export chatbot to JSON
+ // --------------------------------------------------------------------------------------
+ exportChatbotToJSON(faqkb) {
+ // const exportFaqToJsonBtnEl =
document.querySelector('.export-chatbot-to-json-btn');
+ // exportFaqToJsonBtnEl.blur();
+ this.faqService.exportChatbotToJSON(faqkb._id).subscribe((faq: any) => {
+ // this.logger.log('[TILEBOT] - EXPORT CHATBOT TO JSON - FAQS', faq)
+ // this.logger.log('[TILEBOT] - EXPORT FAQ TO JSON - FAQS INTENTS', faq.intents)
+ if (faq) {
+ this.downloadObjectAsJson(faq, faq.name);
+ }
+ }, (error) => {
+ this.logger.error('[BOTS-LIST] - EXPORT BOT TO JSON - ERROR', error);
+ }, () => {
+ this.logger.log('[BOTS-LIST] - EXPORT BOT TO JSON - COMPLETE');
+ });
+ }
+
+ downloadObjectAsJson(exportObj, exportName) {
+ var dataStr = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(exportObj));
+ var downloadAnchorNode = document.createElement('a');
+ downloadAnchorNode.setAttribute("href", dataStr);
+ downloadAnchorNode.setAttribute("download", exportName + ".json");
+ document.body.appendChild(downloadAnchorNode); // required for firefox
+ downloadAnchorNode.click();
+ downloadAnchorNode.remove();
+ }
+
+
+ updateChatbot() {
+ this.botToRename.name = this.newBotName
+ this.faqKbService.updateChatbot(this.botToRename)
+ .subscribe((chatbot: any) => {
+ this.logger.log('[BOTS-LIST] - UPDATED CHATBOT - RES ', chatbot);
+ }, (error) => {
+ this.logger.error('[BOTS-LIST] - UPDATED CHATBOT - ERROR ', error);
+ // self.notify.showWidgetStyleUpdateNotification(this.create_label_error, 4, 'report_problem');
+ }, () => {
+ this.logger.log('[BOTS-LIST] - UPDATED CHATBOT * COMPLETE *');
+ this.botIdToRename = '';
+ this.botToRename = null;
+ });
+ }
+
+ duplicateChatbot(bot_id, bot_name) {
+ this.logger.log('[BOTS-LIST] duplicateChatbot chatBotCount ', this.chatBotCount, ' chatBotLimit ', this.chatBotLimit, ' USER_ROLE ', this.USER_ROLE, ' profile_name ', this.profile_name)
if (this.USER_ROLE !== 'agent') {
if (this.chatBotLimit) {
if (this.chatBotCount < this.chatBotLimit) {
@@ -372,10 +482,10 @@ export class BotListComponent extends PricingBaseComponent implements OnInit, On
this.logger.log('[BOTS-LIST] IMAGE STORAGE ', this.storageBucket, 'usecase Firebase')
} else {
this.UPLOAD_ENGINE_IS_FIREBASE = false;
- // this.baseUrl = this.appConfigService.getConfig().SERVER_BASE_URL;
+
this.baseUrl = this.appConfigService.getConfig().baseImageUrl;
-
+
this.logger.log('[BOTS-LIST] IMAGE STORAGE ', this.baseUrl, 'usecase native')
}
}
@@ -394,6 +504,54 @@ export class BotListComponent extends PricingBaseComponent implements OnInit, On
});
}
+
+
+ openBotMsgsStats(bot) {
+ this.logger.log('[BOTS-LIST] openBotStats ')
+
+ const statsDialogRef = this.dialog.open(MessagesStatsModalComponent, {
+ width: '800px',
+ backdropClass: 'cdk-overlay-transparent-backdrop',
+ hasBackdrop: true,
+ data: { agent: bot },
+ });
+
+ this.logger.log('[BOTS-LIST] openBotStats statsDialogRef ', statsDialogRef)
+
+ statsDialogRef.afterClosed().subscribe(agentId => {
+ this.logger.log(`[BOTS-LIST] Dialog afterClosed agentId: ${agentId}`);
+ if (agentId) {
+ const statBtnEl = document.querySelector('#btn-' + `${agentId}`);
+ this.logger.log('[BOTS-LIST] Dialog afterClosed statBtnEl', statBtnEl);
+ statBtnEl.blur()
+ }
+ });
+ }
+
+ isOpenDropdown(_is0penDropDown) {
+ this.is0penDropDown = _is0penDropDown
+ this.logger.log('[BOTS-LIST] this.is0penDropDown ',this.is0penDropDown)
+ }
+ orderBy(sortfor) {
+ this.logger.log('[BOTS-LIST] - orderBy', sortfor);
+ if (sortfor === 'lastUpdates') {
+ this.orderBylastUpdated = true;
+ this.orderByCreationDate = false;
+ this.orderByChatbotName = false;
+ this.getFaqKbByProjectId()
+ } else if (sortfor === 'creationDate') {
+ this.orderBylastUpdated = false;
+ this.orderByCreationDate = true;
+ this.orderByChatbotName = false;
+ this.getFaqKbByProjectId()
+ } else if (sortfor === 'botname') {
+ this.orderBylastUpdated = false;
+ this.orderByCreationDate = false;
+ this.orderByChatbotName = true;
+ this.getFaqKbByProjectId()
+ }
+ }
+
/**
* GETS ONLY THE FAQ-KB WITH THE CURRENT PROJECT ID
* NOTE: THE CURRENT PROJECT-ID IS OBTAINED IN THE FAQ-KB SERVICE
@@ -407,13 +565,77 @@ export class BotListComponent extends PricingBaseComponent implements OnInit, On
this.faqkbList = faqKb;
this.chatBotCount = this.faqkbList.length;
+ this.myChatbotOtherCount = faqKb.length
+
+ if (this.orderBylastUpdated) {
+ this.logger.log('[BOTS-LIST] - orderBylastUpdated Here yes');
+ this.faqkbList.sort(function compare(a: Chatbot, b: Chatbot) {
+ if (a['updatedAt'] > b['updatedAt']) {
+ return -1;
+ }
+ if (a['updatedAt'] < b['updatedAt']) {
+ return 1;
+ }
+ return 0;
+ });
+ }
+
+
+ if (this.orderByCreationDate) {
+ this.logger.log('[BOTS-LIST] - orderByCreationDate Here yes');
+ this.faqkbList.sort(function compare(a: Chatbot, b: Chatbot) {
+ if (a['createdAt'] > b['createdAt']) {
+ return -1;
+ }
+ if (a['createdAt'] < b['createdAt']) {
+ return 1;
+ }
+ return 0;
+ });
+ }
+
+ if (this.orderByChatbotName) {
+ this.logger.log('[BOTS-LIST] - orderByChatbotName Here yes');
+ this.faqkbList.sort(function compare(a: Chatbot, b: Chatbot) {
+ if (a['name'].toLowerCase() < b['name'].toLowerCase()) {
+ return -1;
+ }
+ if (a['name'].toLowerCase() > b['name'].toLowerCase()) {
+ return 1;
+ }
+ return 0;
+ });
+ }
+
this.faqkbList.forEach(bot => {
this.logger.log('[BOTS-LIST] getFaqKbByProjectId bot ', bot)
+ if (bot && bot.url) {
+ this.logger.log('[BOTS-LIST] getFaqKbByProjectId bot url', bot.url)
+
+ let parts = bot.url.split("/");
+ let botId_FromDeployUrl = parts[parts.length - 1];
+ this.logger.log('[BOTS-LIST] getFaqKbByProjectId botIdFromDeployUrl ', botId_FromDeployUrl)
+ let botId = bot._id;
+ this.logger.log('[BOTS-LIST] getFaqKbByProjectId botId ', botId)
+ if (botId_FromDeployUrl === botId) {
+ this.logger.log('The bot has not been published')
+ bot['published'] = false
+
+ } else if (botId_FromDeployUrl !== botId) {
+ this.logger.log('The bot has been published')
+ bot['published'] = true
+ }
+ } else {
+ this.logger.error('[BOTS-LIST] bot not has url ' ,bot )
+ }
+
this.getBotProfileImage(bot)
+ this.logger.log('[BOTS-LIST] - orderBylastUpdated', this.orderBylastUpdated);
+ this.logger.log('[BOTS-LIST] - orderByCreationDate', this.orderByCreationDate);
});
- this.myChatbotOtherCount = faqKb.length
+
// ---------------------------------------------------------------------
// Bot forked from Customer Satisfaction templates
@@ -443,11 +665,14 @@ export class BotListComponent extends PricingBaseComponent implements OnInit, On
this.route = this.router.url
if (this.route.indexOf('/bots/my-chatbots/all') !== -1) {
this.faqkbList = this.faqkbList
+ this.pageName ="ALL MY CHATBOTS"
this.logger.log('[BOTS-LIST] ROUTE my-chatbots/all');
} else if (this.route.indexOf('/bots/my-chatbots/customer-satisfaction') !== -1) {
this.faqkbList = this.customerSatisfactionBots
+ this.pageName ="CUSTOMER SATISFACTION CHATBOTS"
this.logger.log('[BOTS-LIST] ROUTE my-chatbots/customer-satisfaction faqkbList ', this.faqkbList);
} else if (this.route.indexOf('/bots/my-chatbots/increase-sales') !== -1) {
+ this.pageName ="INCREASE SALES CHATBOTS"
this.faqkbList = this.increaseSalesBots
this.logger.log('[BOTS-LIST] ROUTE my-chatbots/increase-sales faqkbList ', this.faqkbList);
}
@@ -656,8 +881,26 @@ export class BotListComponent extends PricingBaseComponent implements OnInit, On
this.bot_name_to_delete = bot_name;
}
+ getDefaultDeptId() {
+ this.departmentService.getDeptsByProjectId().subscribe((depts: any) => {
+ this.logger.log('[BOTS-LIST] - GET DEPTS RES', depts);
+
- getDepartments(selectedBotId) {
+ depts.forEach(dept => {
+ if (dept.default === true) {
+ this.defaultDeptId = dept._id
+ }
+ });
+
+ }, error => {
+ this.logger.error('[BOTS-LIST] - GET DEPTS - ERROR: ', error);
+ }, () => {
+ this.logger.log('[BOTS-LIST] - GET DEPTS * COMPLETE *')
+ });
+
+ }
+
+ getDepartments(selectedBotId?: string) {
this.departmentService.getDeptsByProjectId().subscribe((_departments: any) => {
this.logger.log('[BOTS-LIST] ON MODAL DELETE OPEN - GET DEPTS RES', _departments);
// this.departments = _departments
@@ -930,7 +1173,7 @@ export class BotListComponent extends PricingBaseComponent implements OnInit, On
// this.router.navigate(['project/' + this.project._id + '/tilebot/intents/', idFaqKb, _botType]);
// this.router.navigate(['project/' + this.project._id + '/createfaq', idFaqKb, _botType, 'en']);
this.goToCDS(faqkb)
-
+
} else if (faqkb.type === 'tiledesk-ai') {
_botType = 'tiledesk-ai'
// this.router.navigate(['project/' + this.project._id + '/tilebot/intents/', idFaqKb, _botType]);
diff --git a/src/app/bots/bots-list/bots-sidebar/bots-sidebar.component.html b/src/app/bots/bots-list/bots-sidebar/bots-sidebar.component.html
index 03090a7dbadf..cfaec99d9fea 100644
--- a/src/app/bots/bots-list/bots-sidebar/bots-sidebar.component.html
+++ b/src/app/bots/bots-list/bots-sidebar/bots-sidebar.component.html
@@ -7,235 +7,258 @@
chevron_right