diff --git a/CHANGELOG.md b/CHANGELOG.md index b9ea40d6c0de..e87d8771dce0 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # tiledesk-dashboard +### 2.7.61-rc2 +- Improves redirect handling for plans with expired trial +- Adds a tooltip to the history page to explain the "Include chatbot-only conversations" checkbox +- Display a message in the right bar of chat conversation details when the plan trial period has expired +- Improves the "Reassign Conversation to chatbot" modal window displayed in chat + +### 2.7.61-rc1 +- Redirect to pricing page if trial has expired + ### 2.7.60 - Improves the UI - Bug fixing @@ -7,9 +16,19 @@ ### 2.7.59 - Improves and fixes the conversations report in Analytics > Metrics > Conversations +### 2.7.59-rc2 +- Improves the UI +- Bug fixing + +### 2.7.59-rc1 +- Minor improvements and bug fixing + ### 2.7.58 - Minor improvements and bug fixing +### 2.7.58-rc1 +- Improve the conversations report in Analytics > Metrics > Conversations + ### 2.7.57 - Improves the Changelog notifications @@ -20,18 +39,42 @@ - Adds the ability to filter by custom range the tag graph - Allows to search for conversations by tags not present in the tag list on the "History" page +### 2.7.54 +- Fixes the bug: Knowledge base table update date is incorrect + ### 2.7.53 - Minor improvements +### 2.7.52 +- Improves KB table + +### 2.7.51 +- Adds the ability to filter by custom range the tag graph + +### 2.7.50-rc2 +- Fixes the bug: voice quota limit is not calculated correctly + +### 2.7.50-rc1 +- Adds the ability to select the refresh rate for URL(s) type contents + ### 2.7.49 - Improves the conversations graph and analytics overview on the home page +### 2.7.49-rc1 +- Adds voice quota usage count + ### 2.7.48 - Implements a widget to notify customers about Tiledesk updates +### 2.7.48-rc1 +- Implements a widget to notify customers about Tiledesk updates + ### 2.7.47 - Fixes the bug: Knowledge Base menu item displays with a delay +### 2.7.47-rc1 +- Fixes the bug: Knowledge Base menu item displays with a delay + ### 2.7.46 - Adds in Analytics > Metrics the conversations tags graph - Improves the UI of the sidebar @@ -40,6 +83,21 @@ - Adds in Analytics > Metrics the conversations tags graph - Improves the UI of the sidebar +### 2.7.46-rc5 +- Bug fixing + +### 2.7.46-rc4 +- Improves remove conversation tag method + +### 2.7.46-rc3 +- Sends a "post" message to the parent when the user resolves a conversation + +### 2.7.46-rc2 +- Adds in Analytics > Metrics the conversations tags graph + +### 2.7.46-rc1 +- Improves the add FAQs dialog window + ### 2.7.45 - Improves the app store @@ -50,12 +108,30 @@ ### 2.7.43 - Adds the "Twilio voice" integration +### 2.7.43-rc1 +- Refactors dashboard UI + ### 2.7.42 - Adds the ability to add the webhook subscriptions "Request Abandoned" and "Request Fully Abandoned" ### 2.7.41 - Fixes the bug: onboarding content is not visible on small height screens +### 2.7.41-rc5 +- Refactors dashboard UI (work in progress) + +### 2.7.41-rc4 +- Fixes bugs on "Twilio voice" integration + +### 2.7.41-rc3 +- Improves the "Twilio voice" integration + +### 2.7.41-rc2 +- Adds the "Twilio voice" integration + +### 2.7.41-rc1 +- Adds the ability to add the webhook subscriptions "Request Abandoned" and "Request Fully Abandoned" + ### 2.7.40 - Minor improvements and bug fixing @@ -71,6 +147,9 @@ ### 2.7.37 - Adds checks to validate Widget footer branding +### 2.7.38-rc2 +- Fix chatbot import validation from json + ### 2.7.36 - Adds the ability to filter for abandoned conversations in the "Non-real-time conversations" page - Adds "Guard Role" @@ -114,7 +193,24 @@ ### 2.7.33 - Adds, on the History page, the ability to filter by conversation duration -### 2.7.32 +### 2.7.34-rc4 +- Refactors table in Monitor page +- Improves handling of alert windows display + +### 2.7.34-rc3 +- AI settings and KB preview bug fixing + +### 2.7.34-rc2 +- Minor improvements + +### 2.7.34-rc1 +- Adds the ability to select the indexing type for Knowledge Base URL contents +- Adds to AI models used by knowledge bases the ability to add an advanced context and to visualize the contents sources + +### 2.7.33-rc1 +- Adds, on the History page, the ability to filter by conversation duration + +### 2.7.32-rc1 - Moves the menu item "Apps" from the sidebar to the setting sidebar ### 2.7.31 @@ -159,9 +255,15 @@ - Adds the ability to select the launch block when a conversation is manually assigned to a chatbot - Improves the method to get the number of conversations in the monitor page +### 2.7.19-rc1 +- Adds the ability to select the launch block when a conversation is manually assigned to a chatbot + ### 2.7.18 - Minor improvements and bug fixing +### 2.7.18-rc1 +- Improves the method to get the number of conversations in the monitor page + ### 2.7.17 - Removes the ability to customize the quotas email template - Implements the icons for the SMS channel @@ -210,6 +312,9 @@ - Deploys in production - Adds the knowledge base walkthrough on the knowledge base page +### 2.7.7-rc1 +- Adds the knowledge base walkthrough on the knowledge base page + ### 2.7.6 - Deploys in production - Adds a warning banner to the home page that displays when the user has used up one or more of his monthly resources @@ -221,10 +326,21 @@ ### 2.7.4 - Added Time Slots in Operating Hours page +### 2.7.4-rc1 +- Fix saving operation hours bug + ### 2.7.3 - Adds the ability, during onboarding, to create a chatbot that automatically answers questions based on the contents of the Knowledge Base - Improves the knowledge base page +### 2.7.3-rc2 +- Adds the ability, during onboarding, to create a chatbot that automatically answers questions based on the contents of the Knowledge Base +- Improves the knowledge base page +- Improves time slots UI + +### 2.7.3-rc1 +- Kb onboarding + ### 2.7.2 - Deploys in production - Adds GPT-4o mini language model @@ -238,24 +354,61 @@ - Adds the ability to edit the "Quota checkpoint notification" email template - Adds Twilio SMS channel integration +### 2.6.45-rc2 +- Improves time slots UI +- Added translations for time slots + +### 2.6.45-rc1 +- Added time slots in Operating Hours + ### 2.6.44 - Deploys in production - Adds the option "Teammates can only see their own conversations" in the Project Settings > Advanced tab - Improvements and bug fixing +### 2.6.44-rc4 +- Improvements and bug fixing + +### 2.6.44-rc3 +- Adds the option "Teammates can only see their own conversations" in the Project Settings > Advanced tab + +### 2.6.44-rc2 +- Fix vxml voice integration visibility + +### 2.6.44-rc1 +- Added vxml voice integration +- Added twilio sms integration + ### 2.6.43 - Deploys in production - Improves the quota usage widget - Minor improvements +### 2.6.43-rc2 +- Improves Knowledge Bases page + +### 2.6.43-rc1 +- Improves quotes widget +- Added voice-vxml and sms-twilio channel in analytics + ### 2.6.42 - Deploys in production - Displays all the indexed chunks of a content on the "Manage your Knowledge Bases" page +### 2.6.42-rc1 +- Displays all the indexed chunks of a content on the "Manage your Knowledge Bases" page + ### 2.6.41 - Deploys in production - Displays information about the Voice channel +### 2.6.41-rc2 +- Adds the Voice Channel integration + +### 2.6.41-rc1 +- Deploys in production +- Displays information about the Voice channel + ### 2.6.40 - Deploys in production - Displays a dialog box that allows to update the plan when the knowledge bases limit is reached diff --git a/package-lock.json b/package-lock.json index ac481f4ab347..f787f6838e7a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@tiledesk/tiledesk-dashboard", - "version": "2.7.60", + "version": "2.7.61-rc2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index bc008e95cdf4..cf9541cc9b6a 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tiledesk/tiledesk-dashboard", - "version": "2.7.60", + "version": "2.7.61-rc2", "scripts": { "ng": "ng", "start": "ng serve --aot", diff --git a/src/app/activities/activities.component.ts b/src/app/activities/activities.component.ts index c20532e7b0d1..63ec94c0cdb1 100755 --- a/src/app/activities/activities.component.ts +++ b/src/app/activities/activities.component.ts @@ -18,6 +18,7 @@ import { ActivitiesService } from './activities-service/activities.service'; import { FormGroup, FormControl } from '@angular/forms'; import { goToCDSVersion } from 'app/utils/util'; import { AppConfigService } from 'app/services/app-config.service'; +import { ProjectUser } from 'app/models/project-user'; import { RoleService } from 'app/services/role.service'; @Component({ selector: 'appdashboard-activities', @@ -392,12 +393,12 @@ export class ActivitiesComponent implements OnInit, OnDestroy { activity['closed_by_label'] = storedTeammate['firstname'] + ' ' + storedTeammate['lastname'] } else { this.usersService.getProjectUserByUserId(activity.actor.id) - .subscribe((projectUser: any) => { + .subscribe((projectUser: ProjectUser) => { - if (projectUser && projectUser[0] && projectUser[0].id_user) { - this.usersLocalDbService.saveMembersInStorage(projectUser[0].id_user._id, projectUser[0].id_user, 'activities'); + if (projectUser && projectUser.id_user) { + this.usersLocalDbService.saveMembersInStorage(projectUser.id_user._id, projectUser.id_user, 'activities'); this.logger.log('ActivitiesComponent] GET projectUser by USER-ID projectUser id', projectUser); - activity['closed_by_label'] = projectUser[0].id_user.firstname + ' ' + projectUser[0].id_user.lastname + activity['closed_by_label'] = projectUser.id_user.firstname + ' ' + projectUser.id_user.lastname } else { activity['closed_by_label'] = activity.target.object.userFullname diff --git a/src/app/analytics/analytics.module.ts b/src/app/analytics/analytics.module.ts index ddfc047f5d69..51e12cdbe899 100644 --- a/src/app/analytics/analytics.module.ts +++ b/src/app/analytics/analytics.module.ts @@ -28,6 +28,10 @@ import { MatIconModule } from '@angular/material/icon'; import { MatButtonModule } from '@angular/material/button'; import { MatNativeDateModule } from '@angular/material/core'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; +import { MomentDateAdapter } from '@angular/material-moment-adapter'; + +// import { MAT_DATE_RANGE_SELECTION_STRATEGY } from '@angular/material/datepicker'; +// import { Max7DaysDateRangeSelectionStrategy } from './metrics/tags-analytics/max7-days-date-range-selection-strategy'; const routes: Routes = [ { path: "", component: AnalyticsComponent}, @@ -66,7 +70,14 @@ const routes: Routes = [ MatButtonModule, MatNativeDateModule, MatProgressSpinnerModule + // MomentDateAdapter ], + // providers: [ + // { + // provide: MAT_DATE_RANGE_SELECTION_STRATEGY, + // useClass: Max7DaysDateRangeSelectionStrategy, + // }, + // ], exports: [ RouterModule ] diff --git a/src/app/analytics/metrics/tags-analytics/tags-analytics.component.ts b/src/app/analytics/metrics/tags-analytics/tags-analytics.component.ts index 64ea011d7e23..4f81b882491d 100644 --- a/src/app/analytics/metrics/tags-analytics/tags-analytics.component.ts +++ b/src/app/analytics/metrics/tags-analytics/tags-analytics.component.ts @@ -91,11 +91,11 @@ export class TagsAnalyticsComponent implements OnInit { getUserChartTypePreference(currentUserId: string) { let storedChartTypeUserPreference = localStorage.getItem(`chartStackedColumns-${currentUserId}`) - this.logger.log('[TAG-ANALYTICS] STORED CHART TYPE PREFERENCE', storedChartTypeUserPreference) + console.log('[TAG-ANALYTICS] STORED CHART TYPE PREFERENCE', storedChartTypeUserPreference) if (!storedChartTypeUserPreference) { this.chartStackedColumns = true; this.chartBasicColumns = false; - this.logger.log('[TAG-ANALYTICS] NO STORED CHART TYPE PREFERENCE chartStackedColumns', this.chartStackedColumns, 'chartBasicColumns ', this.chartBasicColumns) + console.log('[TAG-ANALYTICS] NO STORED CHART TYPE PREFERENCE chartStackedColumns', this.chartStackedColumns, 'chartBasicColumns ', this.chartBasicColumns) } else { if (storedChartTypeUserPreference === 'false') { this.chartStackedColumns = false; diff --git a/src/app/app-store/app-store.component.ts b/src/app/app-store/app-store.component.ts index 99bd79e1cc22..6571c6d1a1ef 100644 --- a/src/app/app-store/app-store.component.ts +++ b/src/app/app-store/app-store.component.ts @@ -17,7 +17,8 @@ import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.comp import { FaqKbService } from 'app/services/faq-kb.service'; import { ChatbotModalComponent } from 'app/bots/bots-list/chatbot-modal/chatbot-modal.component'; import { MatDialog } from '@angular/material/dialog'; -// const swal = require('sweetalert'); +import { ProjectUser } from 'app/models/project-user'; +const swal = require('sweetalert'); const Swal = require('sweetalert2') @Component({ selector: 'appdashboard-app-store', @@ -269,16 +270,12 @@ export class AppStoreComponent extends PricingBaseComponent implements OnInit, O } getProjectUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.logger.log('[APP-STORE] - GET PROJECT-USER ROLE ', user_role); - if (user_role) { - this.USER_ROLE = user_role; - } - }); + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + this.logger.log('[APP-STORE] - GET PROJECT-USER ROLE ', projectUser); + if (projectUser) { + this.USER_ROLE = projectUser.role; + } + }); } diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 4892732bab81..707b9b05b71e 100755 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -32,7 +32,7 @@ import { BrandService } from './services/brand.service'; import { ScriptService } from './services/script/script.service'; import { LoggerService } from './services/logger/logger.service'; import { NotifyService } from './core/notify.service'; -import { avatarPlaceholder, getColorBck } from './utils/util'; +import { avatarPlaceholder, freePlanLimitDate, getColorBck } from './utils/util'; import { LocalDbService } from './services/users-local-db.service'; import { ProjectService } from './services/project.service'; import { HttpClient } from '@angular/common/http'; @@ -114,9 +114,36 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy { ) { this.router.events.subscribe((event) => { if (event instanceof NavigationEnd) { - // this.logger.log('NavigationEnd event ', event) + console.log('[APP-COMPONENT] - NavigationEnd event ', event) gtag('config', 'G-3DMYV3HG61', { 'page_path': event.urlAfterRedirects }); + if (event.urlAfterRedirects !== '/projects' && event.urlAfterRedirects !== '/login' && event.urlAfterRedirects !== '/signup' && event.urlAfterRedirects !== '/create-new-project') { + console.log('[APP-COMPONENT] ------> calling GET CURRENT PROJECT ') + this.getCurrentProject(event.urlAfterRedirects) + } + + // if (this.router.url.indexOf('/request-for-panel') !== -1) { + // const CHAT_PANEL_MODE = true + // console.log('[APP-COMPONENT] ------> CHAT_PANEL_MODE 1 ', CHAT_PANEL_MODE) + // console.log('[APP-COMPONENT] ------> calling GET CURRENT PROJECT ') + + + // } else if (this.router.url.indexOf('/request-for-panel') === -1) { + // const CHAT_PANEL_MODE = false + // console.log('[APP-COMPONENT] ------> CHAT_PANEL_MODE 2 ', CHAT_PANEL_MODE) + // if (event.urlAfterRedirects !== '/projects' && event.urlAfterRedirects !== '/login' && event.urlAfterRedirects !== '/signup') { + // console.log('[APP-COMPONENT] ------> calling GET CURRENT PROJECT ') + // this.getCurrentProject(event.urlAfterRedirects, CHAT_PANEL_MODE) + // } + // } + + + + + + + + const grecaptchaBadgeEl = document.querySelector('.grecaptcha-badge'); if (event.url !== '/signup') { // this.logger.log('[APP-COMPONENT] grecaptchaBadgeEl ', grecaptchaBadgeEl) @@ -244,7 +271,8 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy { this.subscription = router.events.subscribe((event) => { if (event instanceof NavigationStart) { browserRefresh = !router.navigated; - this.logger.log('APP-COMP browserRefresh ', browserRefresh) + this.logger.log('[APP-COMPONENT] browserRefresh ', browserRefresh) + this.logger.log('[APP-COMPONENT] browserRefresh ', event) if (browserRefresh === true) { window.addEventListener('load', () => { this.logger.log('Page fully loaded'); @@ -252,8 +280,6 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy { // Check if there is the sleelplan chagenlog live announcemnt popup this.checkSPPopupIframeWithRetries(5, 1000); // Retry 5 times with a 1-second delay }); - - } } }); @@ -268,7 +294,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy { const checkForIframe = () => { attempts++; - this.logger.log(`Attempt ${attempts} to find the iframe...`); + this.logger.log(`Attempt ${attempts} to find the iframe...`); const wrapper = document.getElementById('sleek-widget-wrap'); this.logger.log('wrapper 1', wrapper) @@ -435,24 +461,123 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy { - // getCurrentProject() { - // this.auth.project_bs.subscribe((project) => { - // if (project) { - // this.logger.log('[APP-COMPONENT] project from $ubscription ', project) - // // this.current_selected_prjct = project - // this.projectService.getProjects().subscribe((projects: any) => { - // this.logger.log('[APP-COMPONENT] getProjects projects ', projects) - // if (projects) { - // this.current_selected_prjct_user = projects.find(prj => prj.id_project.id === project._id); - // this.logger.log('[APP-COMPONENT] current_selected_prjct_user ', this.current_selected_prjct_user) + getCurrentProject(url) { + // console.log('[APP-COMPONENT] calling --- GET CURRENT PROJECT ---- - url 1', url) + console.log('[APP-COMPONENT] calling --- GET CURRENT PROJECT ---- - this.auth.user_bs.value 1 ', this.auth.user_bs.value) + this.auth.project_bs.subscribe((project) => { + if (project) { + console.log('[APP-COMPONENT] -->> project from $ubscription 1 ', project) + // this.current_selected_prjct = project + this.projectService.getProjects().subscribe((projects: any) => { + this.logger.log('[APP-COMPONENT] getProjects projects ', projects) + if (projects) { + this.current_selected_prjct_user = projects.find(prj => prj.id_project.id === project._id); + console.log('[APP-COMPONENT] -->> current_selected_prjct_user 1', this.current_selected_prjct_user) + if (this.current_selected_prjct_user) { + // console.log('[APP-COMPONENT] xxxxx 1 -->> url.indexOf(/request-for-panel', url.indexOf('/request-for-panel') !== -1) + // console.log('[APP-COMPONENT] xxxxx -->> url', url) + // if(CHAT_PANEL_MODE === false) { + + this.redirectToPricing(this.current_selected_prjct_user) + + // } else if(CHAT_PANEL_MODE === true) { + // this.redirectToPricingFromChat(this.current_selected_prjct_user) + // } + } + // this.router.navigate(['project/' + project._id + '/pricing']); + // this.USER_ROLE = this.current_selected_prjct_user.role + // this.logger.log('[APP-COMPONENT] USER_ROLE ', this.USER_ROLE) + } + }) + } else { + console.log('[APP-COMPONENT] calling --- GET CURRENT PROJECT ---- - url 2', url) + console.log('[APP-COMPONENT] calling --- GET CURRENT PROJECT ---- - project 2 ', project) + console.log('[APP-COMPONENT] calling --- GET CURRENT PROJECT ---- - this.auth.user_bs.value 2 ', this.auth.user_bs.value) + console.log('[APP-COMPONENT] calling --- GET CURRENT PROJECT ---- - this.auth.hasChangedProject.value 2 ', this.auth.hasChangedProject.value) + if (!project && this.auth.user_bs.value && this.auth.hasChangedProject.value === false) { + const url_segments = url.split('/'); + const nav_project_id = url_segments[2]; + console.log('[APP-COMPONENT] -->> project from $ubscription 2 nav_project_id', nav_project_id) + // console.log('[APP-COMPONENT] project from $ubscription 2 nav_project_id', nav_project_id) + + const navProjectIdContainsNumber = this.containsNumber(nav_project_id) + console.log('[APP-COMPONENT] -->> project from $ubscription 2 projectIdIsNumber', navProjectIdContainsNumber) + + if (navProjectIdContainsNumber === true) { + this.projectService.getProjects().subscribe((projects: any) => { + this.logger.log('[APP-COMPONENT] getProjects projects ', projects) + if (projects) { + this.current_selected_prjct_user = projects.find(prj => prj.id_project.id === nav_project_id); + console.log('[APP-COMPONENT] current_selected_prjct_user 2', this.current_selected_prjct_user) + console.log('[APP-COMPONENT] calling --- GET CURRENT PROJECT ---- - this.auth.user_bs.value 3 ', this.auth.user_bs.value) + if (this.current_selected_prjct_user) { + this.redirectToPricing(this.current_selected_prjct_user) + } + } + }) + } + } + } + }); + } + + redirectToPricing(projectUser) { + console.log('[APP-COMPONENT] REDIRECT TO PRICING - projectUser ', projectUser) + + const role = projectUser.role; + const project = projectUser.id_project; + console.log('[APP-COMPONENT] REDIRECT TO PRICING - project ', project) + + + // const dateLimit = new Date('2025-01-16T00:00:00'); + // const dateLimit = new Date('2022-07-04T00:00:00') // for test purpose + // console.log('[APP-COMPONENT] REDIRECT TO PRICING - dateLimit ', dateLimit) + console.log('[APP-COMPONENT] REDIRECT TO PRICING - freePlanLimitDate ', freePlanLimitDate) + + + if (project) { + + const projectCreationDate = new Date(project.createdAt); + console.log('[APP-COMPONENT] REDIRECT TO PRICING - projectCreationDate ', projectCreationDate) + console.log('[APP-COMPONENT] REDIRECT TO PRICING - project.profile.type ', project.profile.type) + console.log('[APP-COMPONENT] REDIRECT TO PRICING - project.trialExpired ', project.trialExpired) + + if (projectCreationDate >= freePlanLimitDate) { + console.log('[APP-COMPONENT] REDIRECT TO PRICING - projectCreationDate > dateLimit ') + + + if (project.profile.type === 'free' && project.trialExpired === true) { + if (role === 'owner') { + + this.router.navigate(['project/' + project._id + '/pricing/te']); + // } else if (CHAT_PANEL_MODE) { + // this.router.navigate(['project/' + project._id + '/unauthorized-to-upgrade/cm']); + // } + + } else { + // if (!CHAT_PANEL_MODE) { + this.router.navigate(['project/' + project._id + '/unauthorized-to-upgrade']); + // } else if (CHAT_PANEL_MODE) { + // this.router.navigate(['project/' + project._id + '/unauthorized-to-upgrade/cm']); + // } + } + } + } else { + console.log('[APP-COMPONENT] REDIRECT TO PRICING - projectCreationDate < dateLimit ') + } + } + } + + + redirectToPricingFromChat(projectUser) { + const project = projectUser.id_project; + console.log('[APP-COMPONENT] redirectToPricingFromChat') + this.router.navigate(['project/' + project._id + '/unauthorized-to-upgrade']); + } - // this.USER_ROLE = this.current_selected_prjct_user.role - // this.logger.log('[APP-COMPONENT] USER_ROLE ', this.USER_ROLE) - // } - // }) - // } - // }); - // } + containsNumber(str: string): boolean { + return /\d/.test(str); + } listenToSwPostMessage() { this.logger.log('[APP-COMPONENT] listenToNotificationCLick - CALLED: ') @@ -1118,8 +1243,8 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy { (this.route.indexOf('/cds') !== -1) || (this.route.indexOf('/desktop-access') !== -1) || (this.route.indexOf('/desktop--access') !== -1) || - (this.route.indexOf('/projects') !== -1) - + (this.route.indexOf('/projects') !== -1) || + (this.route.indexOf('/pricing') !== -1) ) { elemFooter.setAttribute('style', 'display:none;'); // this.logger.log('DETECT LOGIN PAGE') diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 6e6db52f12f3..72a6c9f41a5c 100755 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -406,6 +406,8 @@ import { SleekplanSsoService } from './services/sleekplan-sso.service'; import { SleekplanService } from './services/sleekplan.service'; import { SleekplanApiService } from './services/sleekplan-api.service'; import { LogoutModalComponent } from './auth/logout-modal/logout-modal.component'; +import { UnauthorizedToUpgradeComponent } from './auth/unauthorized-to-upgrade/unauthorized-to-upgrade.component'; + // import { ModalAddContentComponent } from './modal-add-content/modal-add-content.component'; // import { PasswordStrengthModule } from './auth/signup/password-strength/password-strength.module'; @@ -723,6 +725,7 @@ const appInitializerFn = (appConfig: AppConfigService, brandService: BrandServic KnowledgeBasesAlertComponent, CnpSelectTemplatesOrKbComponent, LogoutModalComponent, + UnauthorizedToUpgradeComponent, // ModalAddContentComponent, // ModalChatbotReassignmentComponent, // ModalAddNamespaceComponent, diff --git a/src/app/app.routing.ts b/src/app/app.routing.ts index 3bd13889a25b..f54f2ff16a36 100755 --- a/src/app/app.routing.ts +++ b/src/app/app.routing.ts @@ -8,7 +8,6 @@ import { Routes, RouterModule } from '@angular/router'; import { UserProfileComponent } from './user-profile/user-profile.component'; import { AuthGuard } from './core/auth.guard'; -import { AdminGuard } from './core/admin.guard'; import { ProjectProfileGuard } from './core/project-profile.guard'; import { PendingChangesGuard } from './core/pending-changes.guard'; import { CoreModule } from './core/core.module'; @@ -151,6 +150,7 @@ import { CnpIsMobileComponent } from './create-new-project/cnp-is-mobile/cnp-is- import { CnpTemplatesComponent } from './create-new-project/cnp-templates/cnp-templates.component'; import { OnboardingWelcomeComponent } from './create-new-project/onboarding-welcome/onboarding-welcome.component'; import { RoleGuard } from './core/role.guard'; +import { UnauthorizedToUpgradeComponent } from './auth/unauthorized-to-upgrade/unauthorized-to-upgrade.component'; // import { AutomationsComponent } from './automations/automations.component'; // now lazy @@ -247,6 +247,15 @@ const routes: Routes = [ canActivate: [AuthGuard, RoleGuard], data: [{ roles: ['owner'] }] }, + + // Pricing trial expired + { + path: 'project/:projectid/pricing/te', + loadChildren: () => import('app/pricing/pricing.module').then(m => m.PricingModule), + canActivate: [AuthGuard, RoleGuard], + data: [{ roles: ['owner'] }] + }, + // { path: 'project/:projectid/pricing', component: PricingComponent, canActivate: [AuthGuard] }, // now Lazy { path: 'project/:projectid/chat-pricing', @@ -1167,7 +1176,8 @@ const routes: Routes = [ { path: 'unauthorized', component: UnauthorizedComponent }, { path: 'project/:projectid/unauthorized-access', component: UnauthorizedForPricingComponent }, { path: 'project/:projectid/unauthorized_access', component: UnauthorizedForProjectComponent }, - + { path: 'project/:projectid/unauthorized-to-upgrade', component: UnauthorizedToUpgradeComponent }, + @@ -1289,6 +1299,6 @@ const routes: Routes = [ RouterModule.forRoot(routes) ], exports: [RouterModule], - providers: [AuthGuard, AdminGuard, ProjectProfileGuard, RoleGuard] + providers: [AuthGuard, ProjectProfileGuard, PendingChangesGuard] }) export class AppRoutingModule { } diff --git a/src/app/auth/autologin/autologin.component.ts b/src/app/auth/autologin/autologin.component.ts index df34a2fc764b..a95dc2e2e292 100755 --- a/src/app/auth/autologin/autologin.component.ts +++ b/src/app/auth/autologin/autologin.component.ts @@ -13,6 +13,8 @@ import { ProjectService } from '../../services/project.service'; import { LoggerService } from '../../services/logger/logger.service'; import { LocalDbService } from 'app/services/users-local-db.service'; import { UsersService } from 'app/services/users.service'; +import { NotifyService } from 'app/core/notify.service'; +import { ProjectUser } from 'app/models/project-user'; @Component({ selector: 'appdashboard-autologin', @@ -39,7 +41,8 @@ export class AutologinComponent implements OnInit { private projectService: ProjectService, private logger: LoggerService, private localDbService: LocalDbService, - private usersService: UsersService + private usersService: UsersService, + public notify: NotifyService, ) { this.user = auth.user_bs.value; @@ -70,11 +73,12 @@ export class AutologinComponent implements OnInit { } getUserRole() { - this.usersService.project_user_role_bs - .subscribe((userRole) => { - this.logger.log('[AUTOLOGIN] - $UBSCRIPTION TO USER ROLE »»» ', userRole) - this.USER_ROLE = userRole; - }) + this.usersService.projectUser_bs.subscribe((projectUser: ProjectUser) => { + this.logger.log('[AUTOLOGIN] - $UBSCRIPTION TO USER ROLE »»» ', projectUser) + if(projectUser){ + this.USER_ROLE = projectUser.role; + } + }) } @@ -168,11 +172,11 @@ export class AutologinComponent implements OnInit { this.logger.log('[AUTOLOGIN] SSO - ssoLogin routeSegments ', routeSegments); const projectIDGetFromRoute = routeSegments[2] - + this.logger.log('[AUTOLOGIN] SSO - ssoLogin projectIDGetFromRoute ', projectIDGetFromRoute); - + this.getProject(projectIDGetFromRoute) - + this.router.navigate([route]); @@ -198,13 +202,14 @@ export class AutologinComponent implements OnInit { }, (error) => { this.logger.error('[AUTOLOGIN] SSO - ssoLogin getCurrentAuthenticatedUser error', error); - // console.log('[AUTOLOGIN] SSO error.error ', error.error); - // console.log('[AUTOLOGIN] SSO error.status ', error.status); + // this.logger.log('[AUTOLOGIN] SSO error.error ', error.error); + // this.logger.log('[AUTOLOGIN] SSO error.status ', error.status); if (error && error.status && error.status === 401) { this.router.navigate(['invalid-token']) } + }, () => { this.logger.log('[AUTOLOGIN] SSO - ssoLogin getCurrentAuthenticatedUser * COMPLETE *'); @@ -222,7 +227,7 @@ export class AutologinComponent implements OnInit { }); } - + getProject(projectIDGetFromRouteIsNumber) { @@ -240,7 +245,7 @@ export class AutologinComponent implements OnInit { }) } - + @@ -300,6 +305,11 @@ export class AutologinComponent implements OnInit { }, (error) => { this.logger.error('[AUTOLOGIN] - GET PROJECT BY ID - ERROR ', error); + this.logger.log(error.error) + if (error.error.msg === 'you dont belong to the project.') { + this.notify.presentModalYouDontBelongToTheProject() + } + }, () => { this.logger.log('[AUTOLOGIN] - GET PROJECT BY ID - COMPLETE '); diff --git a/src/app/auth/signin/signin.component.ts b/src/app/auth/signin/signin.component.ts index a5deb55d51f0..7f3a76e8a7ac 100755 --- a/src/app/auth/signin/signin.component.ts +++ b/src/app/auth/signin/signin.component.ts @@ -105,7 +105,7 @@ export class SigninComponent implements OnInit { getStoredRoute() { this.storedRoute = this.localDbService.getFromStorage('wannago') - this.logger.log('[SIGN-IN] storedRoute ', this.storedRoute) + console.log('[SIGN-IN] storedRoute ', this.storedRoute) if (this.storedRoute) { this.EXIST_STORED_ROUTE = true } else { diff --git a/src/app/auth/signup/signup.component.ts b/src/app/auth/signup/signup.component.ts index b2771acedc8d..796dbba6077e 100755 --- a/src/app/auth/signup/signup.component.ts +++ b/src/app/auth/signup/signup.component.ts @@ -20,6 +20,7 @@ declare const grecaptcha: any; import { WidgetSetUpBaseComponent } from 'app/widget_components/widget-set-up/widget-set-up-base/widget-set-up-base.component'; import { WidgetService } from 'app/services/widget.service'; import { UsersService } from 'app/services/users.service'; +import { ProjectUser } from 'app/models/project-user'; type UserFields = 'email' | 'password' | 'firstName' | 'lastName' | 'terms'; type FormErrors = { [u in UserFields]: string }; @@ -177,11 +178,12 @@ export class SignupComponent extends WidgetSetUpBaseComponent implements OnInit, } getUserRole() { - this.usersService.project_user_role_bs - .subscribe((userRole) => { - this.logger.log('[SIGN-UP] - $UBSCRIPTION TO USER ROLE »»» ', userRole) - this.USER_ROLE = userRole; - }) + this.usersService.projectUser_bs.subscribe((projectUser: ProjectUser) => { + this.logger.log('[SIGN-UP] - $UBSCRIPTION TO USER ROLE »»» ', projectUser) + if(projectUser){ + this.USER_ROLE = projectUser.role; + } + }) } ngAfterViewInit() { @@ -246,10 +248,10 @@ export class SignupComponent extends WidgetSetUpBaseComponent implements OnInit, } const form = this.userForm; - // console.log('[SIGN-UP] pswrd change ', this.userForm.value.password) + // this.logger.log('[SIGN-UP] pswrd change ', this.userForm.value.password) // const regex = /[$-/:-?{-~!"^@#`\[\]]/g; // const hasPassedSymbolTest = regex.test(this.userForm.value.password); - // console.log('[SIGN-UP] pswrd change hasPassedSymbolTest', hasPassedSymbolTest) + // this.logger.log('[SIGN-UP] pswrd change hasPassedSymbolTest', hasPassedSymbolTest) diff --git a/src/app/auth/unauthorized-to-upgrade/unauthorized-to-upgrade.component.html b/src/app/auth/unauthorized-to-upgrade/unauthorized-to-upgrade.component.html new file mode 100644 index 000000000000..c3446906a318 --- /dev/null +++ b/src/app/auth/unauthorized-to-upgrade/unauthorized-to-upgrade.component.html @@ -0,0 +1,71 @@ +
+
+
+
+
+
+ +
+
+ + + + + + + +
+
+ +
+
+ + + {{'Pricing.YourTrialHasEnded' | translate}} +
+
+
+
+ + {{ 'TrialExpirationDate' | translate: {expiration_date: trialExpirationDate} }}. + + {{'Pricing.ContactTheProjectOwner' | translate}}. + +
+
+
+
+ +
+ {{'GoToYourProjects' | translate}} +
+
+
+ +
+
+ +
+ {{ 'Pricing.UpgradePlan' | translate }} +
+
+ {{ 'ContactUs' | translate }} +
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/src/app/auth/unauthorized-to-upgrade/unauthorized-to-upgrade.component.scss b/src/app/auth/unauthorized-to-upgrade/unauthorized-to-upgrade.component.scss new file mode 100644 index 000000000000..f6ac416ec834 --- /dev/null +++ b/src/app/auth/unauthorized-to-upgrade/unauthorized-to-upgrade.component.scss @@ -0,0 +1,144 @@ +.unauthorized-to-upgrade-container { + padding: 16px; + height: 100vh; + width: 100vw; +} + + +.unauthorized-to-upgrade-main{ + height: 100%; + width: 100%; + padding-bottom: 30px; + overflow-y: auto; +} + +.unauthorized-to-upgrade-spacing { + flex: 3 1 0%; + text-align: center; + min-height: 45px; +} + +.unauthorized-to-upgrade-content-wpr { + display: flex; + -webkit-box-align: center; + align-items: center; + -webkit-box-pack: center; + justify-content: center; +} + + +.unauthorized-to-upgrade-content { + padding-top: 25vh; +} + +.unauthorized-to-upgrade-inner-content { + display: flex; + -webkit-box-align: center; + align-items: center; + flex-direction: column; + -webkit-box-pack: center; + justify-content: center; +} + +.unauthorized-to-upgrade-logo-container { + border-radius: 50%; + // min-height: 82px; + // min-width: 82px; + min-height: 60px; + min-width: 60px; + // box-shadow: rgba(17, 49, 96, 0.16) 0px 8px 16px 0px, rgba(17, 49, 96, 0.06) 0px 0px 0px 1px; + /* background-image: linear-gradient(rgba(19, 33, 68, 0.85), rgb(19, 33, 68)); */ + margin-bottom: 51px; + margin-top: -80px; +} + +.unauthorized-to-upgrade-logo-svg-wpr { + transition: opacity 0.15s ease 0s, background 0.15s ease 0s, color 0.15s ease 0s, transform 0.15s ease 0s; + box-sizing: content-box; + // width: 82px; + // height: 82px; + width: 60px; + height: 60px; + color: rgb(255, 255, 255); + // background: transparent; + background: rgba(183, 57, 74, .2); + border-radius: 9999px; + display: flex; + justify-content: center; + align-content: center; + flex-wrap: wrap; +} + + +.unauthorized-to-upgrade-title-wpr { + color: var(--text-color); + font-weight: 600; + font-size: 28px; + text-align: center; + margin-bottom: 16px; + font-family: var(--header-font-family); +} + +.unauthorized-to-upgrade-title { + color: #b7394a; + font-weight: 600; + font-size: 18px; + text-align: center; + margin-bottom: 16px; + font-family: var(--header-font-family); + line-height: 1.5em; +} + +.unauthorized-to-upgrade-title.panel-mode { + max-width: 260px; +} + +.unauthorized-to-upgrade-subtitle { + width: 370px; + margin-bottom: 40px; + color: var(--secondary-text-color); + line-height: 1.47; + text-align: center; + font-weight: 400; + font-size: 16px; +} + +.unauthorized-to-upgrade-subtitle.panel-mode { + max-width: 260px; +} + +.unauthorized-to-upgrade-btn-wpr { + display: flex; + -webkit-box-align: center; + align-items: center; + -webkit-box-pack: center; + justify-content: center; +} + +.unauthorized-to-upgrade-btn-wpr > button { + border-radius: var(--btn-border-radius) !important; + height: 55px !important; + padding: 9px 35px !important; +} + + +.unauthorized-to-upgrade-go-to-project { + cursor: pointer; + font-size: 14px; + font-weight: 400; + color: var(--blue-20); + font-family: var(--header-font-family); +} + +.unauthorized-to-upgrade-go-to-project:hover { + text-decoration: underline; +} + + + +@media (max-width: 668px){ + .unauthorized-to-upgrade-subtitle { + width: 340px; + font-size: 14px; + } +} \ No newline at end of file diff --git a/src/app/auth/unauthorized-to-upgrade/unauthorized-to-upgrade.component.spec.ts b/src/app/auth/unauthorized-to-upgrade/unauthorized-to-upgrade.component.spec.ts new file mode 100644 index 000000000000..8d9720aa70a7 --- /dev/null +++ b/src/app/auth/unauthorized-to-upgrade/unauthorized-to-upgrade.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { UnauthorizedToUpgradeComponent } from './unauthorized-to-upgrade.component'; + +describe('UnauthorizedToUpgradeComponent', () => { + let component: UnauthorizedToUpgradeComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ UnauthorizedToUpgradeComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(UnauthorizedToUpgradeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/auth/unauthorized-to-upgrade/unauthorized-to-upgrade.component.ts b/src/app/auth/unauthorized-to-upgrade/unauthorized-to-upgrade.component.ts new file mode 100644 index 000000000000..20c0ca94abf3 --- /dev/null +++ b/src/app/auth/unauthorized-to-upgrade/unauthorized-to-upgrade.component.ts @@ -0,0 +1,136 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +import { BrandService } from 'app/services/brand.service'; +import { LoggerService } from 'app/services/logger/logger.service'; +import { ProjectPlanService } from 'app/services/project-plan.service'; +import { Subscription } from 'rxjs'; +import moment from "moment"; +import { AppConfigService } from 'app/services/app-config.service'; + +@Component({ + selector: 'appdashboard-unauthorized-to-upgrade', + templateUrl: './unauthorized-to-upgrade.component.html', + styleUrls: ['./unauthorized-to-upgrade.component.scss'] +}) +export class UnauthorizedToUpgradeComponent implements OnInit { + + company_name: string; + companyNameParams: any + subscription: Subscription; + trialExpirationDate: string + public_Key: string; + isVisiblePAY: boolean; + CHAT_MODE: boolean; + userRole: string; + dshbrdBaseUrl: string; + id_project: string; + salesEmail: string; + + constructor( + private router: Router, + public brandService: BrandService, + private prjctPlanService: ProjectPlanService, + private logger: LoggerService, + public appConfigService: AppConfigService, + ) { + const brand = brandService.getBrand(); + this.company_name = brand['BRAND_NAME']; + // console.log('[ON-BOARDING-WELCOME company_name]' , this.company_name) + this.companyNameParams = { 'BRAND_NAME': this.company_name } + this.salesEmail = brand['CONTACT_SALES_EMAIL']; + } + + ngOnInit(): void { + this.getProjectPlan() + this.getOSCODE(); + + + this.CHAT_MODE = window.self !== window.top; + console.log('[UNAUTHORIZED-TO-UPGRADE] Is in iframe (CHAT_MODE) :', this.CHAT_MODE); + + } + + getOSCODE() { + this.public_Key = this.appConfigService.getConfig().t2y12PruGU9wUtEGzBJfolMIgK; + this.logger.log('[UNAUTHORIZED-TO-UPGRADE] AppConfigService getAppConfig public_Key', this.public_Key); + + let keys = this.public_Key.split("-"); + this.logger.log('[UNAUTHORIZED-TO-UPGRADE] PUBLIC-KEY - public_Key keys', keys) + + keys.forEach(key => { + + if (key.includes("PAY")) { + + let pay = key.split(":"); + + if (pay[1] === "F") { + this.isVisiblePAY = false; + this.logger.log('[UNAUTHORIZED-TO-UPGRADE] isVisiblePAY', this.isVisiblePAY) + } else { + this.isVisiblePAY = true; + this.logger.log('[UNAUTHORIZED-TO-UPGRADE] isVisiblePAY', this.isVisiblePAY) + } + } + + }); + + + if (!this.public_Key.includes("PAY")) { + this.isVisiblePAY = false; + } + + } + + getProjectPlan() { + this.subscription = this.prjctPlanService.projectPlan$.subscribe((projectProfileData: any) => { + console.log('[UNAUTHORIZED-TO-UPGRADE] - getProjectPlan - project Profile Data ', projectProfileData) + + if (projectProfileData) { + this.userRole = projectProfileData.user_role + this.id_project = projectProfileData._id; + console.log('[UNAUTHORIZED-TO-UPGRADE] - getProjectPlan - userRole ', this.userRole) + + if (projectProfileData.profile_type === 'free' && projectProfileData.trial_expired === true) { + + this.trialExpirationDate = moment(projectProfileData.createdAt).add(14, 'days').format('LL');; + console.log('[UNAUTHORIZED-TO-UPGRADE] - trialExpirationDate', this.trialExpirationDate); // Outputs the new date as an ISO string + } + } + }, error => { + + this.logger.error('[UNAUTHORIZED-TO-UPGRADE] - getProjectPlan - ERROR', error); + }, () => { + + // console.log('[PRICING] - getProjectPlan * COMPLETE *') + + }); + } + + ngOnDestroy() { + this.subscription.unsubscribe(); + } + + + goToYourProjects() { + this.router.navigate(['/projects']); + } + + goToPricingFromChat() { + if (this.isVisiblePAY) { + + const href = window.location.href; + this.logger.log('[UNAUTHORIZED-TO-UPGRADE] href ', href) + + const hrefArray = href.split('/#/'); + this.dshbrdBaseUrl = hrefArray[0] + const pricingUrl = this.dshbrdBaseUrl + '/#/project/' + this.id_project + '/pricing/te'; + window.open(pricingUrl, '_blank'); + + } + } + + contactUs() { + window.open(`mailto:${this.salesEmail}?subject=Upgrade plan`); + } + +} diff --git a/src/app/bots/bot-create/bot-create.component.ts b/src/app/bots/bot-create/bot-create.component.ts index 3a040b86fac4..e5eaf1289f71 100755 --- a/src/app/bots/bot-create/bot-create.component.ts +++ b/src/app/bots/bot-create/bot-create.component.ts @@ -35,6 +35,7 @@ import { ProjectPlanService } from 'app/services/project-plan.service'; import { UsersService } from 'app/services/users.service'; import { MatDialog } from '@angular/material/dialog'; import { ChatbotModalComponent } from '../bots-list/chatbot-modal/chatbot-modal.component'; +import { ProjectUser } from 'app/models/project-user'; @Component({ selector: 'bot-create', @@ -188,15 +189,12 @@ export class BotCreateComponent extends PricingBaseComponent implements OnInit { } getUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((userRole) => { - - this.logger.log('[BOT-CREATE] - SUBSCRIPTION TO USER ROLE »»» ', userRole) - this.USER_ROLE = userRole; - }) + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + this.logger.log('[BOT-CREATE] - SUBSCRIPTION TO USER ROLE »»» ', projectUser) + if(projectUser){ + this.USER_ROLE = projectUser.role; + } + }) } @@ -350,7 +348,7 @@ export class BotCreateComponent extends PricingBaseComponent implements OnInit { const jsonString = JSON.stringify(json) // Check for XSS patterns if (containsXSS(jsonString)) { - // console.log("Potential XSS attack detected!"); + this.logger.log("Potential XSS attack detected!"); this.notify.showToast(this.translationMap.get('UploadedFileMayContainsDangerousCode'), 4, 'report_problem') return; } diff --git a/src/app/bots/bots-list/bots-list.component.ts b/src/app/bots/bots-list/bots-list.component.ts index f22d59621f62..2e350cef98b0 100755 --- a/src/app/bots/bots-list/bots-list.component.ts +++ b/src/app/bots/bots-list/bots-list.component.ts @@ -27,6 +27,7 @@ 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'; import { KnowledgeBaseService } from 'app/services/knowledge-base.service'; +import { ProjectUser } from 'app/models/project-user'; const swal = require('sweetalert'); const Swal = require('sweetalert2') @@ -210,15 +211,12 @@ export class BotListComponent extends PricingBaseComponent implements OnInit, On // } getUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((userRole) => { - - this.logger.log('[BOTS-LIST] - SUBSCRIPTION TO USER ROLE »»» ', userRole) - this.USER_ROLE = userRole; - }) + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + this.logger.log('[BOTS-LIST] - SUBSCRIPTION TO USER ROLE »»» ', projectUser) + if(projectUser){ + this.USER_ROLE = projectUser.role; + } + }) } getNavigationBaseUrl() { diff --git a/src/app/bots/bots-list/chatbot-alert/chatbot-alert.component.ts b/src/app/bots/bots-list/chatbot-alert/chatbot-alert.component.ts index 12305b2e66aa..f43d4c9ba73f 100644 --- a/src/app/bots/bots-list/chatbot-alert/chatbot-alert.component.ts +++ b/src/app/bots/bots-list/chatbot-alert/chatbot-alert.component.ts @@ -13,6 +13,7 @@ import { AuthService } from 'app/core/auth.service'; import { Project } from 'app/models/project-model'; import { takeUntil } from 'rxjs/operators' import { Subject } from 'rxjs'; +import { ProjectUser } from 'app/models/project-user'; @Component({ @@ -82,9 +83,11 @@ export class ChatbotAlertComponent extends PricingBaseComponent implements OnIni } getProjectUserRole() { - this.usersService.project_user_role_bs.subscribe((user_role) => { - this.USER_ROLE = user_role - this.logger.log('[CHATBOT-ALERT] - GET PROJECT USER ROLE - USER_ROLE : ', this.USER_ROLE) + this.usersService.projectUser_bs.subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.USER_ROLE = projectUser.role + this.logger.log('[CHATBOT-ALERT] - GET PROJECT USER ROLE - USER_ROLE : ', this.USER_ROLE) + } }) } diff --git a/src/app/bots/faq/faq.component.html b/src/app/bots/faq/faq.component.html index 3b8a6aea0332..d8e89818a0b3 100755 --- a/src/app/bots/faq/faq.component.html +++ b/src/app/bots/faq/faq.component.html @@ -140,6 +140,7 @@

+
diff --git a/src/app/bots/native-bot-sidebar/native-bot-sidebar.component.ts b/src/app/bots/native-bot-sidebar/native-bot-sidebar.component.ts index b119f07b9f83..7af421846f4e 100755 --- a/src/app/bots/native-bot-sidebar/native-bot-sidebar.component.ts +++ b/src/app/bots/native-bot-sidebar/native-bot-sidebar.component.ts @@ -10,6 +10,7 @@ import { UsersService } from 'app/services/users.service' import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { FaqKbService } from 'app/services/faq-kb.service' +import { ProjectUser } from 'app/models/project-user' @Component({ selector: 'appdashboard-native-bot-sidebar', templateUrl: './native-bot-sidebar.component.html', @@ -124,14 +125,12 @@ export class NativeBotSidebarComponent implements OnInit, OnChanges { } getUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((userRole) => { + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ // console.log('[SETTINGS-SIDEBAR]] - SUBSCRIPTION TO USER ROLE »»» ', userRole) - this.USER_ROLE = userRole; - }) + this.USER_ROLE = projectUser.role; + } + }) } diff --git a/src/app/bots/templates/community-template-dtls/community-template-dtls.component.ts b/src/app/bots/templates/community-template-dtls/community-template-dtls.component.ts index 8380cfef7568..b1066c79897b 100644 --- a/src/app/bots/templates/community-template-dtls/community-template-dtls.component.ts +++ b/src/app/bots/templates/community-template-dtls/community-template-dtls.component.ts @@ -16,6 +16,7 @@ import { ChatbotModalComponent } from 'app/bots/bots-list/chatbot-modal/chatbot- import { MatDialog } from '@angular/material/dialog'; import { NotifyService } from 'app/core/notify.service'; import { TranslateService } from '@ngx-translate/core'; +import { ProjectUser } from 'app/models/project-user'; @Component({ selector: 'appdashboard-community-template-dtls', @@ -104,11 +105,12 @@ export class CommunityTemplateDtlsComponent extends PricingBaseComponent impleme } getUserRole() { - this.usersService.project_user_role_bs - .subscribe((userRole) => { - this.logger.log('[COMMUNITY-TEMPLATE-DTLS] - SUBSCRIPTION TO USER ROLE »»» ', userRole) - this.USER_ROLE = userRole; - }) + this.usersService.projectUser_bs.subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.logger.log('[COMMUNITY-TEMPLATE-DTLS] - SUBSCRIPTION TO USER ROLE »»» ', projectUser) + this.USER_ROLE = projectUser.role; + } + }) } getProfileImageStorage() { diff --git a/src/app/bots/templates/template-detail/template-detail.component.ts b/src/app/bots/templates/template-detail/template-detail.component.ts index 3b712cc70808..1d7339cd3bd9 100644 --- a/src/app/bots/templates/template-detail/template-detail.component.ts +++ b/src/app/bots/templates/template-detail/template-detail.component.ts @@ -20,6 +20,7 @@ import { ProjectPlanService } from 'app/services/project-plan.service'; import { NotifyService } from 'app/core/notify.service'; import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.component'; import { TranslateService } from '@ngx-translate/core'; +import { ProjectUser } from 'app/models/project-user'; @Component({ selector: 'appdashboard-template-detail', templateUrl: './template-detail.component.html', @@ -230,13 +231,12 @@ export class TemplateDetailComponent extends PricingBaseComponent implements OnI getProjectUserRole() { - this.usersService.project_user_role_bs - .subscribe((user_role) => { - if (user_role) { - this.USER_ROLE = user_role - // this.logger.log('[TEMPLATE DETAIL] user_role ', user_role); - } - }); + this.usersService.projectUser_bs.subscribe((projectUser: ProjectUser) => { + if (projectUser) { + this.USER_ROLE = projectUser.role + // this.logger.log('[TEMPLATE DETAIL] user_role ', user_role); + } + }); } getTestSiteUrl() { diff --git a/src/app/bots/templates/templates.component.ts b/src/app/bots/templates/templates.component.ts index 27f97cfce1b5..afffa4ddf601 100644 --- a/src/app/bots/templates/templates.component.ts +++ b/src/app/bots/templates/templates.component.ts @@ -15,6 +15,7 @@ import { NotifyService } from 'app/core/notify.service'; import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.component'; import { TranslateService } from '@ngx-translate/core'; import { KnowledgeBaseService } from 'app/services/knowledge-base.service'; +import { ProjectUser } from 'app/models/project-user'; @@ -154,14 +155,12 @@ export class TemplatesComponent extends PricingBaseComponent implements OnInit { } getUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((userRole) => { - this.logger.log('[BOTS-TEMPLATES] - SUBSCRIPTION TO USER ROLE »»» ', userRole) - this.USER_ROLE = userRole; - }) + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.logger.log('[BOTS-TEMPLATES] - SUBSCRIPTION TO USER ROLE »»» ', projectUser) + this.USER_ROLE = projectUser.role; + } + }) } getProfileImageStorage() { diff --git a/src/app/bots/tilebot-sidebar/tilebot-sidebar.component.ts b/src/app/bots/tilebot-sidebar/tilebot-sidebar.component.ts index 46ba394015fd..a182770035dd 100755 --- a/src/app/bots/tilebot-sidebar/tilebot-sidebar.component.ts +++ b/src/app/bots/tilebot-sidebar/tilebot-sidebar.component.ts @@ -10,6 +10,7 @@ import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { FaqKbService } from 'app/services/faq-kb.service' import { DomSanitizer } from '@angular/platform-browser'; +import { ProjectUser } from 'app/models/project-user'; @Component({ selector: 'appdashboard-tilebot-sidebar', @@ -118,14 +119,12 @@ export class TilebotSidebarComponent implements OnInit , OnChanges{ } getUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((userRole) => { + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ // console.log('[SETTINGS-SIDEBAR]] - SUBSCRIPTION TO USER ROLE »»» ', userRole) - this.USER_ROLE = userRole; - }) + this.USER_ROLE = projectUser.role; + } + }) } @HostListener('window:resize', ['$event']) diff --git a/src/app/chatbot-design-studio/cds-sidebar/cds-sidebar.component.ts b/src/app/chatbot-design-studio/cds-sidebar/cds-sidebar.component.ts index d485de2af870..00f7cb5f7400 100644 --- a/src/app/chatbot-design-studio/cds-sidebar/cds-sidebar.component.ts +++ b/src/app/chatbot-design-studio/cds-sidebar/cds-sidebar.component.ts @@ -5,6 +5,7 @@ import { LoggerService } from 'app/services/logger/logger.service'; import { UsersService } from 'app/services/users.service'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; +import { ProjectUser } from 'app/models/project-user'; @Component({ selector: 'cds-sidebar', @@ -35,10 +36,12 @@ export class CdsSidebarComponent implements OnInit { getUserRole() { - this.usersService.project_user_role_bs.pipe( takeUntil(this.unsubscribe$)).subscribe((userRole) => { + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ // console.log('[CDS-SIDEBAR] - SUBSCRIPTION TO USER ROLE »»» ', userRole) - this.USER_ROLE = userRole; - }) + this.USER_ROLE = projectUser.role; + } + }) } listenSidebarIsOpened() { diff --git a/src/app/components/components.module.ts b/src/app/components/components.module.ts index 14c7b2e62428..e95ccba2deb2 100755 --- a/src/app/components/components.module.ts +++ b/src/app/components/components.module.ts @@ -7,8 +7,7 @@ import { NavbarComponent } from './navbar/navbar.component'; import { SidebarComponent } from './sidebar/sidebar.component'; import { TranslateModule } from '@ngx-translate/core'; import { SmallSidebarComponent } from './small-sidebar/small-sidebar.component'; -import { NavbarForPanelComponent } from './navbar-for-panel/navbar-for-panel.component'; -import { NavbarForPanelService } from './navbar-for-panel/navbar-for-panel.service'; + import { MatTooltipModule } from '@angular/material/tooltip'; import { MatSnackBarModule } from '@angular/material/snack-bar'; import { MatSlideToggleModule } from '@angular/material/slide-toggle'; @@ -42,7 +41,6 @@ import { LoadingSpinnerComponent } from 'app/ui/loading-spinner/loading-spinner. NavbarComponent, SidebarComponent, SmallSidebarComponent, - NavbarForPanelComponent, SidebarUserDetailsComponent, ], exports: [ @@ -51,11 +49,9 @@ import { LoadingSpinnerComponent } from 'app/ui/loading-spinner/loading-spinner. SidebarComponent, SidebarUserDetailsComponent, SmallSidebarComponent, - NavbarForPanelComponent, TranslateModule ], providers: [ - NavbarForPanelService ] }) diff --git a/src/app/components/modals/messages-stats-modal/messages-stats-modal.component.ts b/src/app/components/modals/messages-stats-modal/messages-stats-modal.component.ts index 74c76287171f..dd11748c25e0 100644 --- a/src/app/components/modals/messages-stats-modal/messages-stats-modal.component.ts +++ b/src/app/components/modals/messages-stats-modal/messages-stats-modal.component.ts @@ -11,6 +11,7 @@ import { takeUntil } from 'rxjs/operators' import { Router } from '@angular/router'; import { AuthService } from 'app/core/auth.service'; import { AnalyticsService } from 'app/services/analytics.service'; +import { ProjectUser } from 'app/models/project-user'; @Component({ selector: 'appdashboard-messages-stats-modal', @@ -89,13 +90,11 @@ export class MessagesStatsModalComponent implements OnInit { } getUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((userRole) => { - this.USER_ROLE = userRole; - }) + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.USER_ROLE = projectUser.role; + } + }) } getCurrentProject() { diff --git a/src/app/components/navbar-for-panel/navbar-for-panel.component.html b/src/app/components/navbar-for-panel/navbar-for-panel.component.html deleted file mode 100755 index 97ab1755a3a7..000000000000 --- a/src/app/components/navbar-for-panel/navbar-for-panel.component.html +++ /dev/null @@ -1,97 +0,0 @@ -
-
-
- -
-
- - {{user.firstname}} {{user.lastname}} - - -
-
- -
- - access_time - - -
-
- -
-
{{ user.firstname }} {{ user.lastname }}
-
{{ user.email }}
-
-
-
- - - -
-
- - - - \ No newline at end of file diff --git a/src/app/components/navbar-for-panel/navbar-for-panel.component.scss b/src/app/components/navbar-for-panel/navbar-for-panel.component.scss deleted file mode 100755 index ff7df6675b79..000000000000 --- a/src/app/components/navbar-for-panel/navbar-for-panel.component.scss +++ /dev/null @@ -1,133 +0,0 @@ -.panel-left-sidebar-toolbar-a { - flex-direction: row; - box-sizing: border-box; - display: flex; - background-color: #1e2129 !important; -} - -.panel-left-sidebar-toolbar-b { - flex: 1 1 0%; - box-sizing: border-box; - flex-direction: row; - display: flex; - place-content: center space-between; - align-items: center; -} - -.panel-left-sidebar-toolbar-d { - flex-direction: row; - box-sizing: border-box; - display: flex; - place-content: center flex-start; - align-items: center; -} - -.panel-left-sidebar-logged-in-user { - flex-direction: row; - box-sizing: border-box; - display: flex; - place-content: center flex-start; - align-items: center; -} - -.panel-left-sidebar-avatar-wrapper { - position: relative; -} - -.panel-left-sidebar-avatar { - width: 42px; - min-width: 42px; - height: 42px; - line-height: 42px; - margin: 0 8px 0 0; - border-radius: 50%; - font-size: 17px; - font-weight: 600; - text-align: center; - // margin-right: 16px; - // margin-left: 4px; - margin-right: 9px; - margin-left: 9px; - margin-top: 6px; - margin-bottom: 6px; -} - -.panel-left-sidebar-logged-in-user-status { - position: absolute; - // width: 14px; - // height: 14px; - // bottom: 8px; - // left: 43px; - width: 12px; - height: 12px; - bottom: 8px; - left: 35px; - border: 1px solid #2d323e; - border-radius: 50%; -} - -.logged-in-user-status-online { - background-color: #4caf50; -} - -.logged-in-user-status-offline { - background-color: #f44336; -} - -.panel-left-sidebar-logged-in-user-name { - color: #fff; -} - -.panel-left-sidebar-logged-in-user-email { - color: rgba(255, 255, 255, 0.5); - font-size: 12px; -} -// .dark-style-icon{ -// color: #dbddde; -// background-color: rgba(255, 255, 255, 0.1); -// border-radius: 50%; -// padding: 6px; -// margin-right: 6px; -// height: 36px; -// width: 36px; -// } - -.dark-style-dropdown-menu { - background: #1e212a; -} - -.dark-style-dropdown-menu > li > a { - color: #e4e6eb; -} - -.dark-style-dropdown-menu li a:hover, -.dark-style-dropdown-menu li a:focus, -.dark-style-dropdown-menu li a:active { - background-color: unset; - // color: #FFFFFF; -} - -.dark-style-icon { - color: #dbddde; - background-color: rgba(255, 255, 255, 0.1); - border-radius: 50%; - padding: 6px; - margin-right: 6px; - height: 36px; - width: 36px; -} - -.dark-style-icon:hover { - background-color: rgba(45, 136, 255, 0.2); - color: #3491ff; -} - -.dark-style-icon-selected { - background-color: rgba(45, 136, 255, 0.2); - color: #3491ff; -} - -.icon-in-dropdown { - margin-left: -10px; - margin-right: 16px; -} diff --git a/src/app/components/navbar-for-panel/navbar-for-panel.component.spec.ts b/src/app/components/navbar-for-panel/navbar-for-panel.component.spec.ts deleted file mode 100755 index 00cc6a37613d..000000000000 --- a/src/app/components/navbar-for-panel/navbar-for-panel.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { NavbarForPanelComponent } from './navbar-for-panel.component'; - -describe('NavbarForPanelComponent', () => { - let component: NavbarForPanelComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ NavbarForPanelComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(NavbarForPanelComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/components/navbar-for-panel/navbar-for-panel.component.ts b/src/app/components/navbar-for-panel/navbar-for-panel.component.ts deleted file mode 100755 index 916fc057d944..000000000000 --- a/src/app/components/navbar-for-panel/navbar-for-panel.component.ts +++ /dev/null @@ -1,328 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { AuthService } from '../../core/auth.service'; -import { UsersService } from '../../services/users.service'; -import { AppConfigService } from '../../services/app-config.service'; -import { takeUntil } from 'rxjs/operators'; -import { Subject } from 'rxjs'; -import { Router, NavigationEnd, NavigationStart } from '@angular/router'; -import { LocalDbService } from '../../services/users-local-db.service'; -import { NavbarForPanelService } from './navbar-for-panel.service'; -import { WsRequestsService } from './../../services/websocket/ws-requests.service'; -import { LoggerService } from './../../services/logger/logger.service'; -@Component({ - selector: 'appdashboard-navbar-for-panel', - templateUrl: './navbar-for-panel.component.html', - styleUrls: ['./navbar-for-panel.component.scss'] -}) -export class NavbarForPanelComponent implements OnInit { - user: any; - currentUserId: string; - IS_AVAILABLE: boolean; - IS_BUSY: boolean; - USER_ROLE: string; - projectId: string; - - userProfileImageExist: boolean; - userImageHasBeenUploaded: boolean; - userProfileImageurl: string; - storageBucket: string; - timeStamp: any; - PROJECT_USER_ID: string; - IS_PROJECTS_X_PANEL_ROUTE: boolean; - dkmode: string; - private unsubscribe$: Subject = new Subject(); - - constructor( - private auth: AuthService, - private usersService: UsersService, - public appConfigService: AppConfigService, - private router: Router, - public usersLocalDbService: LocalDbService, - public navbarForPanelService: NavbarForPanelService, - public wsRequestsService: WsRequestsService, - private logger: LoggerService - - ) { - this.getCurrentRoute(); - } - - ngOnInit() { - - this.getLoggedUser(); - this.getCurrentProject(); - this.getStorageBucket(); - this.checkUserImageExist(); - // this.getUserAvailability(); - // this.getUserUserIsBusy(); - - this.setInitialDisplayPreferences(); - } - - - - - getCurrentRoute() { - this.router.events - .subscribe((e) => { - if (e instanceof NavigationEnd) { - this.logger.log('NAVBAR-X-PANEL - ROUTE params e ', e); - this.logger.log('NAVBAR-X-PANEL - ROUTE params e.url ', e.url); - - const current_url = e.url; - if (current_url === '/projects-for-panel') { - - // GENERA BUG: QUANDO DAL DETTAGLI PROGETTO (LISTA DELLE UNSERVED) SI TORNA ALLA LISTA DEI PROGETTI IL PROGETTO - // PER CUI SI è SELEZIONATO IL DETTAGLIO NON VISULAIZZA LO STATO DI DISPONIBILITA' - // this.usersService.unsubscriptionToWsCurrentUser(this.PROJECT_USER_ID) - - - this.IS_AVAILABLE = null; - this.IS_PROJECTS_X_PANEL_ROUTE = true; - this.logger.log('NAVBAR-X-PANEL ROUTE is', e.url, ' - IS AVAILABLE ', this.IS_AVAILABLE); - } else { - this.IS_PROJECTS_X_PANEL_ROUTE = false; - } - } - }) - } - - getStorageBucket() { - const firebase_conf = this.appConfigService.getConfig().firebase; - this.storageBucket = firebase_conf['storageBucket']; - this.logger.log('STORAGE-BUCKET NAVBAR-X-PANEL ', this.storageBucket) - } - - - getLoggedUser() { - this.auth.user_bs.subscribe((user) => { - this.logger.log('NAVBAR-X-PANEL - LOGGED USER ', user) - // tslint:disable-next-line:no-debugger - // debugger - this.user = user; - - if (user) { - this.currentUserId = user._id; - this.logger.log('NAVBAR-X-PANEL - CURRENT USER ID ', this.currentUserId); - - if (this.currentUserId) { - // this.getProjectUserByCurrentUserIdAndProjectId() - } - } - }); - } - - getCurrentProject() { - this.auth.project_bs.subscribe((project) => { - - if (project) { - this.projectId = project._id - this.logger.log('NAVBAR-X-PANEL - GET CURRENT PROJECT - PROJECT ID ', this.projectId) - - this.getProjectUser(); - } - }); - } - - - getProjectUser() { - this.logger.log('NAVBAR-X-PANEL CALL GET-PROJECT-USER') - this.usersService.getProjectUserByUserId(this.currentUserId).subscribe((projectUser: any) => { - this.logger.log('NAVBAR-X-PANEL GET BY USER-ID - PROJECT-ID ', this.projectId); - this.logger.log('NAVBAR-X-PANEL GET BY USER-ID - CURRENT-USER-ID ', this.user._id); - this.logger.log('NAVBAR-X-PANEL GET BY USER-ID - PROJECT USER ', projectUser); - this.logger.log('NAVBAR-X-PANEL GET BY USER-ID - PROJECT USER LENGTH', projectUser.length); - if ((projectUser) && (projectUser.length !== 0)) { - - - this.logger.log('NAVBAR-X-PANEL PROJECT-USER ID ', projectUser[0]._id) - this.logger.log('NAVBAR-X-PANEL USER IS AVAILABLE ', projectUser[0].user_available) - this.logger.log('NAVBAR-X-PANEL USER IS BUSY (from db)', projectUser[0].isBusy) - // this.user_is_available_bs = projectUser.user_available; - - this.PROJECT_USER_ID = projectUser[0]._id; - - this.subsTo_WsCurrentUser(projectUser[0]._id) - - if (projectUser[0].user_available !== undefined) { - this.usersService.user_availability(projectUser[0]._id, projectUser[0].user_available, projectUser[0].isBusy, projectUser[0] ) - } - - // ADDED 21 AGO - if (projectUser[0].role !== undefined) { - this.logger.log('NAVBAR-X-PANEL GET PROJECT USER ROLE FOR THE PROJECT ', this.projectId, ' »» ', projectUser[0].role); - - // ASSIGN THE projectUser[0].role VALUE TO USER_ROLE - this.USER_ROLE = projectUser[0].role; - - // SEND THE ROLE TO USER SERVICE THAT PUBLISH - this.usersService.user_role(projectUser[0].role); - - } - } else { - // this could be the case in which the current user was deleted as a member of the current project - this.logger.log('NAVBAR-X-PANEL PROJECT-USER UNDEFINED ') - } - - }, (error) => { - this.logger.error('NAVBAR-X-PANEL PROJECT-USER GET BY PROJECT-ID & CURRENT-USER-ID ', error); - }, () => { - this.logger.log('NAVBAR-X-PANEL PROJECT-USER GET BY PROJECT ID & CURRENT-USER-ID * COMPLETE *'); - }); - } - - - subsTo_WsCurrentUser(currentuserprjctuserid) { - this.logger.log('NAVBAR-X-PANEL - SUBSCRIBE TO WS CURRENT-USER AVAILABILITY prjct user id of current user ', currentuserprjctuserid); - // this.usersService.subscriptionToWsCurrentUser(currentuserprjctuserid); - this.wsRequestsService.subscriptionToWsCurrentUser(currentuserprjctuserid); - this.getWsCurrentUserAvailability$(); - this.getWsCurrentUserIsBusy$(); - } - - getWsCurrentUserAvailability$() { - // this.usersService.currentUserWsAvailability$ - this.wsRequestsService.currentUserWsAvailability$ - - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((currentuser_availability) => { - // this.logger.log('NAVBAR-X-PANEL - IS AVAILABLE (from SUBSCR) ', currentuser_availability); - if (currentuser_availability !== null) { - this.IS_AVAILABLE = currentuser_availability; - } - }, error => { - this.logger.error('NAVBAR-X-PANEL - GET WS CURRENT-USER AVAILABILITY * error * ', error) - }, () => { - this.logger.log('NAVBAR-X-PANEL - GET WS CURRENT-USER AVAILABILITY *** complete *** ') - }); - } - - getWsCurrentUserIsBusy$() { - // this.usersService.currentUserWsIsBusy$ - this.wsRequestsService.currentUserWsIsBusy$ - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((currentuser_isbusy) => { - // this.logger.log('NAVBAR-X-PANEL - GET WS CURRENT-USER - currentuser_isbusy? ', currentuser_isbusy); - if (currentuser_isbusy !== null) { - this.IS_BUSY = currentuser_isbusy; - // this.logger.log('NAVBAR-X-PANEL - GET WS CURRENT-USER (from ws)- this.IS_BUSY? ', this.IS_BUSY); - } - }, error => { - this.logger.error('NAVBAR-X-PANEL - GET WS CURRENT-USER IS BUSY * error * ', error) - }, () => { - this.logger.log('NAVBAR-X-PANEL - GET WS CURRENT-USER IS BUSY *** complete *** ') - }); - } - - - getUserAvailability() { - this.usersService.user_is_available_bs.subscribe((user_available) => { - this.IS_AVAILABLE = user_available; - this.logger.log('NAVBAR-X-PANEL - USER IS AVAILABLE ', this.IS_AVAILABLE); - }); - } - - getUserUserIsBusy() { - this.usersService.user_is_busy$.subscribe((user_isbusy) => { - this.IS_BUSY = user_isbusy; - // THE VALUE OF IS_BUSY IS THEN UPDATED WITH THE VALUE RETURNED FROM THE WEBSOCKET getWsCurrentUserIsBusy$() - // WHEN, FOR EXAMPLE IN PROJECT-SETTINGS > ADVANCED THE NUM OF MAX CHAT IS 3 AND THE - this.logger.log('!!! SIDEBAR - USER IS BUSY (from db)', this.IS_BUSY); - }); - } - - - - checkUserImageExist() { - this.usersService.userProfileImageExist.subscribe((image_exist) => { - this.logger.log('NAVBAR-X-PANEL - USER PROFILE EXIST ? ', image_exist); - this.userProfileImageExist = image_exist; - if (this.storageBucket && this.userProfileImageExist === true) { - this.logger.log('NAVBAR-X-PANEL - USER PROFILE EXIST - BUILD userProfileImageurl'); - this.setImageProfileUrl(this.storageBucket) - } - }); - } - - - - setImageProfileUrl(storageBucket) { - this.userProfileImageurl = 'https://firebasestorage.googleapis.com/v0/b/' + storageBucket + '/o/profiles%2F' + this.currentUserId + '%2Fphoto.jpg?alt=media'; - this.timeStamp = (new Date()).getTime(); - } - - getUserProfileImage() { - if (this.timeStamp) { - return this.userProfileImageurl + '&' + this.timeStamp; - } - return this.userProfileImageurl - } - - - changeAvailabilityState(IS_AVAILABLE, profilestatus) { - this.logger.log('SB - CHANGE STATUS - USER IS AVAILABLE ? ', IS_AVAILABLE); - // this.logger.log('SB - CHANGE STATUS - PROJECT USER ID: ', this.projectUser_id); - - - // this.usersService.updateProjectUser(this.projectUser_id, IS_AVAILABLE).subscribe((projectUser: any) => { - // DONE - WORKS NK-TO-TEST - da implementare quando viene implementato il servizio - serve per cambiare lo stato di disponibilità dell'utente corrente - // anche in USER & GROUP bisogna cambiare per la riga dell'utente corrente - this.usersService.updateCurrentUserAvailability(this.projectId, IS_AVAILABLE, profilestatus).subscribe((projectUser: any) => { // non - - this.logger.log('PROJECT-USER UPDATED ', projectUser) - - // NOTIFY TO THE USER SERVICE WHEN THE AVAILABLE / UNAVAILABLE BUTTON IS CLICKED - // this.usersService.availability_btn_clicked(true) - - }, (error) => { - this.logger.error('PROJECT-USER UPDATED ERR ', error); - // =========== NOTIFY ERROR =========== - // this.notify.showNotification('An error occurred while updating status', 4, 'report_problem'); - // this.notify.showWidgetStyleUpdateNotification(this.changeAvailabilityErrorNoticationMsg, 4, 'report_problem'); - - }, () => { - this.logger.log('PROJECT-USER UPDATED * COMPLETE *'); - - // =========== NOTIFY SUCCESS=========== - // this.notify.showNotification('status successfully updated', 2, 'done'); - // this.notify.showWidgetStyleUpdateNotification(this.changeAvailabilitySuccessNoticationMsg, 2, 'done'); - - - // this.getUserAvailability() - this.getProjectUser(); - }); - } - - - setInitialDisplayPreferences() { - this.dkmode = this.usersLocalDbService.getStoredAppearanceDisplayPreferences(); - this.logger.log('NAVBAR-X-PANEL - dkmode ', this.dkmode); - - if (this.dkmode === null) { - this.dkmode = 'true' - this.usersLocalDbService.storeAppearanceDisplayPreferences(this.dkmode) - } - } - - - selectAppearance(dkm) { - this.logger.log('NAVBAR-X-PANEL - dkm ', dkm); - // if (this.dkmode === 'true') { - this.dkmode = dkm; - this.navbarForPanelService.publishDisplayPreferences(dkm); - this.usersLocalDbService.storeAppearanceDisplayPreferences(dkm); - this.logger.log('NAVBAR-X-PANEL - dkmode ', this.dkmode); - // } - - // if (this.dkmode === 'false') { - // this.dkmode = 'true'; - // this.navbarForPanelService.publishDisplayPreferences(this.dkmode); - // this.usersLocalDbService.storeAppearanceDisplayPreferences(this.dkmode); - // } - - } - -} diff --git a/src/app/components/navbar-for-panel/navbar-for-panel.service.ts b/src/app/components/navbar-for-panel/navbar-for-panel.service.ts deleted file mode 100755 index c3cc531543ce..000000000000 --- a/src/app/components/navbar-for-panel/navbar-for-panel.service.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Injectable } from '@angular/core'; -import { BehaviorSubject } from 'rxjs'; -import { LoggerService } from '../../services/logger/logger.service'; - -@Injectable() - -export class NavbarForPanelService { - - public darkmode$: BehaviorSubject = new BehaviorSubject(null); - - constructor( - private logger: LoggerService - ) { } - - - publishDisplayPreferences(dkm) { - - this.logger.log('[NAVBAR-X-PANEL] publishDisplayPreferences dkm ', dkm) - - } -} diff --git a/src/app/components/navbar/navbar.component.html b/src/app/components/navbar/navbar.component.html index 1cd4f874b1a6..8610e623ab98 100755 --- a/src/app/components/navbar/navbar.component.html +++ b/src/app/components/navbar/navbar.component.html @@ -24,7 +24,6 @@ --> - -
@@ -293,41 +182,21 @@

-
-

{{requests_count | number:'1.0-0'}} / 

+

{{requests_count | number:'1.0-0'}} / 

-

{{requests_limit | number:'1.0-0'}}

+

{{requests_limit | number:'1.0-0'}}

- - - - - + + +
{{ requests_perc }}% @@ -348,7 +217,7 @@

AI Tokens

- +
@@ -357,8 +226,8 @@

AI Tokens

{{'TotalAITokensUsage' | translate}}

-

{{tokens_count | number:'1.0-0'}} / 

-

{{tokens_limit | number:'1.0-0'}}

+

{{tokens_count | number:'1.0-0'}} / 

+

{{tokens_limit | number:'1.0-0'}}

@@ -370,19 +239,21 @@

AI Tokens

stroke-dasharray="81.68140899333463" stroke-dashoffset="81.68140899333463" stroke-linecap="round"> --> -
{{ tokens_perc }}%
- +
- -
+ +
@@ -412,8 +283,8 @@

{{'Email' | translate}}

stroke-dasharray="81.68140899333463" stroke-dashoffset="81.68140899333463" stroke-linecap="round"> --> -
{{ email_perc }}%
@@ -422,6 +293,51 @@

{{'Email' | translate}}

+ + + +
+
+
+
+
+

{{'Voice' | translate}}

+ +
+ +
+
+
+

+ + {{'TotalVoiceUsage' | translate}} +

+
+

{{voice_count_min_sec}} / 

+

{{voice_limit | number:'1.0-0'}}m

+
+
+
+ + + +
{{ voice_perc }}%
+
+
+
+
+
+
@@ -441,6 +357,110 @@

{{'Email' | translate}}

+ + + + +
  • + + +
    + + + + + + +
    +
    + + {{ prjc_trial_days_left }} + + + 0 + +
    +
    +
    +
    + + +
  • +
    + + + + + + + + + + + + + + + +
  • + + + + + + + error_outline + + + + + {{ 'Pricing.SubscriptionPaymentProblem' | translate }} + + + {{ 'Pricing.ThePlanHasExpired' | translate }} + + + + +
  • +
    + diff --git a/src/app/components/navbar/navbar.component.scss b/src/app/components/navbar/navbar.component.scss index 7ddd8e55c26e..f9b04bc64afb 100755 --- a/src/app/components/navbar/navbar.component.scss +++ b/src/app/components/navbar/navbar.component.scss @@ -1037,7 +1037,7 @@ button.close.custom-hover:hover { .pie-red-stroke::ng-deep circle { // stroke: #ff0000 !important; - stroke: linear-gradient(90deg, rgba(0,128,0,1) 0%, rgba(255,255,0,1) 26%, rgba(255,165,0,1) 51%, rgba(255,165,0,1) 75%, rgba(255,0,0,1) 100%) !important; + stroke: linear-gradient(90deg, rgba(0, 128, 0, 1) 0%, rgba(255, 255, 0, 1) 26%, rgba(255, 165, 0, 1) 51%, rgba(255, 165, 0, 1) 75%, rgba(255, 0, 0, 1) 100%) !important; } // ::ng-deep .requests-circular-spinner circle { @@ -1076,6 +1076,10 @@ button.close.custom-hover:hover { stroke: #f55a4e !important; } +.mat-progress-spinner-voice-runned-out::ng-deep circle { + stroke: #f55a4e !important; +} + // .quote-container { // padding: 4px; // margin-bottom: 20px; @@ -1230,7 +1234,7 @@ button.close.custom-hover:hover { padding-top: 16px; } -.quota-section-main.last { +.quota-section-main.last { border-bottom: 1px solid rgb(255, 255, 255); } @@ -1269,7 +1273,7 @@ button.close.custom-hover:hover { align-items: center; } -.quota-title{ +.quota-title { margin-top: 0px; margin-bottom: 0px; font-weight: 500; @@ -1520,9 +1524,9 @@ button.close.custom-hover:hover { cursor: pointer !important; } -.quota-right-title.link:hover { +.quota-right-title.link:hover { text-decoration: underline; -} +} .quota-limit-wpr { display: flex; @@ -1552,24 +1556,42 @@ button.close.custom-hover:hover { .changelog-count { position: absolute; - right: 31px; - background: red; - font-size: 11px; - color: #fff; - width: 18px; - height: 18px; - text-align: center; - border-radius: 9999px; - top: 12px; - border: 1px solid #fff; - font-weight: bold; - font-family: arial; - line-height: 18px; - letter-spacing: 0; - opacity: 1; -} - -#upgrade-plan-btn-wpr > a { + right: 31px; + background: red; + font-size: 11px; + color: #fff; + width: 18px; + height: 18px; + text-align: center; + border-radius: 9999px; + top: 12px; + border: 1px solid #fff; + font-weight: bold; + font-family: arial; + line-height: 18px; + letter-spacing: 0; + opacity: 1; +} + +#upgrade-plan-btn-wpr>a { + right: 31px; + background: red; + font-size: 11px; + color: #fff; + width: 18px; + height: 18px; + text-align: center; + border-radius: 9999px; + top: 12px; + border: 1px solid #fff; + font-weight: bold; + font-family: arial; + line-height: 18px; + letter-spacing: 0; + opacity: 1; +} + +#upgrade-plan-btn-wpr>a { padding-top: 8px; padding-bottom: 0px; } @@ -1583,10 +1605,11 @@ button.close.custom-hover:hover { border: unset; } -#usage-stats > ::ng-deep button > span > span { - font-family: var( --header-font-family); + +#usage-stats> ::ng-deep button>span>span { + font-family: var(--header-font-family); font-weight: 400; - padding-left: 3px; + padding-left: 3px; } // .quota-resets { diff --git a/src/app/components/navbar/navbar.component.ts b/src/app/components/navbar/navbar.component.ts index 3a57e4287878..857637dc6eb7 100755 --- a/src/app/components/navbar/navbar.component.ts +++ b/src/app/components/navbar/navbar.component.ts @@ -44,6 +44,7 @@ import { APP_SUMO_PLAN_NAME, PLAN_NAME, URL_understanding_default_roles } from ' import { SleekplanApiService } from 'app/services/sleekplan-api.service'; import { LogoutModalComponent } from 'app/auth/logout-modal/logout-modal.component'; import { MatDialog } from '@angular/material/dialog'; +import { ProjectUser } from 'app/models/project-user'; const swal = require('sweetalert'); const Swal = require('sweetalert2') @@ -185,6 +186,12 @@ export class NavbarComponent extends PricingBaseComponent implements OnInit, Aft tokens_perc = 0; tokens_limit = 0; + voice_count = 0; + voice_perc = 0; + voice_limit = 0; + voice_limit_in_sec = 0; + voice_count_min_sec: any; + requestsPieStroke: string; requestsPieGreenStroke: boolean; requestsPieYellowStroke: boolean; @@ -200,6 +207,10 @@ export class NavbarComponent extends PricingBaseComponent implements OnInit, Aft conversationsRunnedOut: boolean = false; emailsRunnedOut: boolean = false; tokensRunnedOut: boolean = false; + voiceRunnedOut: boolean = false; + + diplayTwilioVoiceQuota: boolean; + diplayVXMLVoiceQuota: boolean; startSlot: string; endSlot: string; @@ -248,7 +259,6 @@ export class NavbarComponent extends PricingBaseComponent implements OnInit, Aft ngOnInit() { this.getCurrentProject(); - this.getProjectUserRole(); this.getProfileImageStorage(); // ------------------------------------------- @@ -269,7 +279,7 @@ export class NavbarComponent extends PricingBaseComponent implements OnInit, Aft // this.getUnservedRequestLenght_bs(); - this.getProjectUserId(); + this.getProjectUser(); this.getActiveRoute(); this.hidePendingEmailNotification(); @@ -283,7 +293,6 @@ export class NavbarComponent extends PricingBaseComponent implements OnInit, Aft this.getFromLocalStorageHasOpenedTheChat(); this.getFromNotifyServiceHasOpenedChat(); - this.getUserAvailability(); this.hasChangedAvailabilityStatusInSidebar(); this.hasChangedAvailabilityStatusInUsersComp(); // this.subscribeToLogoutPressedinSidebarNavMobile(); @@ -302,6 +311,7 @@ export class NavbarComponent extends PricingBaseComponent implements OnInit, Aft this.listenHasDeleteUserProfileImage(); + this.manageVoiceQuotaVisibility() this.listenSoundPreference() this.listenToLiveAnnouncementOpened() // this.listenToQuotasReachedInHome() @@ -353,12 +363,56 @@ export class NavbarComponent extends PricingBaseComponent implements OnInit, Aft // this.getQuotes(); // this.logger.log('[NAVBAR] -> OPERATING_HOURS_ACTIVE ', this.OPERATING_HOURS_ACTIVE); } - + this.getProjects() + } }); } + manageVoiceQuotaVisibility() { + this.prjctPlanService.projectPlan$.subscribe((projectProfileData: any) => { + this.logger.log('[NAVBAR] - manageVoiceQuotaVisibility getProjectPlan project Profile Data', projectProfileData) + if (projectProfileData) { + if (projectProfileData['customization']) { + + if (projectProfileData['customization'] && ((projectProfileData['customization']['voice-twilio'] !== undefined) || (projectProfileData['customization']['voice'] !== undefined) )) { + + this.logger.log('[NAVBAR] (manageVoiceQuotaVisibility) projectProfileData[customization] voice', projectProfileData['customization']['voice']) + this.logger.log('[NAVBAR] (manageVoiceQuotaVisibility) projectProfileData[customization] voice-twilio', projectProfileData['customization']['voice-twilio']) + if (projectProfileData['customization']['voice-twilio'] === true) { + this.diplayTwilioVoiceQuota = true + } else if (projectProfileData['customization']['voice-twilio'] === false) { + this.diplayTwilioVoiceQuota = false + } else if (projectProfileData['customization']['voice-twilio'] === undefined) { + this.diplayTwilioVoiceQuota = false + } + + if (projectProfileData['customization']['voice'] === true) { + this.diplayVXMLVoiceQuota = true + } else if (projectProfileData['customization']['voice'] === false) { + this.diplayVXMLVoiceQuota = false + } else if (projectProfileData['customization']['voice'] === undefined) { + this.diplayVXMLVoiceQuota = false + } + } + + } else { + + this.logger.log('[NAVBAR] (manageVoiceQuotaVisibility) projectProfileData[customization] (else) ', projectProfileData['customization']) + this.diplayTwilioVoiceQuota = false + this.diplayVXMLVoiceQuota = false + } + + } + + }, error => { + this.logger.error('[NAVBAR] - getProjectPlan - ERROR', error); + }, () => { + this.logger.log('[NAVBAR] - getProjectPlan - COMPLETE') + }); + } + onOpenQuoteMenu() { this.isOpenCurrentUsageMenu = true // this.logger.log('[NAVBAR] - on open quotes menu' ) @@ -385,7 +439,6 @@ export class NavbarComponent extends PricingBaseComponent implements OnInit, Aft getProjectQuotes() { this.quotesService.getProjectQuotes(this.projectId).then((response) => { this.logger.log("[NAVBAR] getProjectQuotes response: ", response); - this.logger.log("getProjectQuotes: ", response); this.project_limits = response; }).catch((err) => { this.logger.error("[NAVBAR] getProjectQuotes error: ", err); @@ -451,6 +504,8 @@ export class NavbarComponent extends PricingBaseComponent implements OnInit, Aft this.requests_limit = this.project_limits.requests; this.email_limit = this.project_limits.email; this.tokens_limit = this.project_limits.tokens; + this.voice_limit_in_sec = this.project_limits.voice_duration + this.voice_limit = Math.floor(this.project_limits.voice_duration / 60); } if (resp.quotes.requests.quote === null) { @@ -466,6 +521,10 @@ export class NavbarComponent extends PricingBaseComponent implements OnInit, Aft resp.quotes.tokens.quote = 0; } + if (resp.quotes.voice_duration.quote === null) { + resp.quotes.voice_duration.quote = 0; + } + this.logger.log('[NAVBAR] used requests', resp.quotes.requests.quote) this.logger.log('[NAVBAR] requests_limit', this.requests_limit) @@ -476,6 +535,9 @@ export class NavbarComponent extends PricingBaseComponent implements OnInit, Aft this.logger.log('[NAVBAR] used tokens', resp.quotes.tokens.quote) this.logger.log('[NAVBAR] tokens_limit', this.tokens_limit) + this.logger.log('[NAVBAR] used voice', resp.quotes.voice_duration.quote) + this.logger.log('[NAVBAR] voice_limit', this.voice_limit) + if (resp.quotes.requests.quote >= this.requests_limit) { this.conversationsRunnedOut = true; this.logger.log('[NAVBAR] conversationsRunnedOut', this.conversationsRunnedOut) @@ -500,11 +562,22 @@ export class NavbarComponent extends PricingBaseComponent implements OnInit, Aft this.logger.log('[NAVBAR] tokensRunnedOut', this.tokensRunnedOut) } + // if (120000 >= this.voice_limit) { + if (resp.quotes.voice_duration.quote >= this.voice_limit_in_sec) { + this.voiceRunnedOut = true; + this.logger.log('[NAVBAR] voiceRunnedOut', this.voiceRunnedOut) + } else { + this.voiceRunnedOut = false; + this.logger.log('[NAVBAR] voiceRunnedOut', this.voiceRunnedOut) + } + this.requests_perc = Math.min(100, Math.floor((resp.quotes.requests.quote / this.requests_limit) * 100)); this.messages_perc = Math.min(100, Math.floor((resp.quotes.messages.quote / this.messages_limit) * 100)); this.email_perc = Math.min(100, Math.floor((resp.quotes.email.quote / this.email_limit) * 100)); this.tokens_perc = Math.min(100, Math.floor((resp.quotes.tokens.quote / this.tokens_limit) * 100)); + this.voice_perc = Math.min(100, Math.floor((resp.quotes.voice_duration.quote / this.voice_limit_in_sec) * 100)); + // this.voice_perc = Math.min(100, Math.floor((120000 / this.voice_limit_in_sec) * 100)); this.logger.log('[NAVBAR] requests_perc', this.requests_perc) if (this.requests_perc <= 25) { @@ -530,15 +603,14 @@ export class NavbarComponent extends PricingBaseComponent implements OnInit, Aft this.requestsPieRedStroke = true; // 76% a 100% } - - - - - this.requests_count = resp.quotes.requests.quote; this.messages_count = resp.quotes.messages.quote; this.email_count = resp.quotes.email.quote; this.tokens_count = resp.quotes.tokens.quote; + this.voice_count = resp.quotes.voice_duration.quote + this.logger.log("[NAVBAR] getAllQuotes voice_count: ", this.voice_count) + this.voice_count_min_sec = this.secondsToMinutes_seconds(this.voice_count) + this.logger.log("[HOME] getAllQuotes voice_count_min_sec: ", this.voice_count_min_sec) }, (error) => { this.logger.error("get all quotes error: ", error) @@ -547,6 +619,12 @@ export class NavbarComponent extends PricingBaseComponent implements OnInit, Aft }) } + secondsToMinutes_seconds(seconds) { + let minutes = Math.floor(seconds / 60); + let remainingSeconds = seconds % 60; + return `${minutes}m ${remainingSeconds}s`; + } + goToHistoryOpenedConvs() { this.logger.log("[NAVBAR] goToHistoryOpenedConvs "); @@ -676,29 +754,6 @@ export class NavbarComponent extends PricingBaseComponent implements OnInit, Aft // this.logger.log('[NAVBAR] AppConfigService getAppConfig (NAVBAR) CHAT_BASE_URL', this.CHAT_BASE_URL); } - getProjectUserRole() { - // const user___role = this.usersService.project_user_role_bs.value; - // this.logger.log('[NAVBAR] % »»» WebSocketJs WF +++++ ws-requests--- navbar - USER ROLE 1 ', user___role); - - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.logger.log('[NAVBAR] - USER ROLE from $ubscription', user_role); - if (user_role) { - this.USER_ROLE = user_role - if (user_role === 'agent') { - this.ROLE_IS_AGENT = true; - - } else { - this.ROLE_IS_AGENT = false; - } - } - }); - } - - getProfileImageStorage() { if (this.appConfigService.getConfig().uploadEngine === 'firebase') { const firebase_conf = this.appConfigService.getConfig().firebase; @@ -804,13 +859,6 @@ export class NavbarComponent extends PricingBaseComponent implements OnInit, Aft this.logger.log('[NAVBAR] ===== BRS LANG ', this.browserLang) } - getUserAvailability() { - this.usersService.user_is_available_bs.subscribe((user_available) => { - this.IS_AVAILABLE = user_available; - this.logger.log('[NAVBAR]- USER IS AVAILABLE ', this.IS_AVAILABLE); - }); - } - hasChangedAvailabilityStatusInSidebar() { this.usersService.has_changed_availability_in_sidebar.subscribe((has_changed_availability) => { this.logger.log('[NAVBAR] SUBSCRIBES TO HAS CHANGED AVAILABILITY FROM THE SIDEBAR', has_changed_availability) @@ -1090,7 +1138,7 @@ export class NavbarComponent extends PricingBaseComponent implements OnInit, Aft }); } - + getTrialLeft() { this.prjctPlanService.projectPlan$.subscribe((projectProfileData: any) => { @@ -1178,12 +1226,31 @@ export class NavbarComponent extends PricingBaseComponent implements OnInit, Aft goToPricingPlanFree() { // if (this.ROLE_IS_AGENT === false) { - if (this.USER_ROLE === 'owner') { + // if (this.USER_ROLE === 'owner') { - this.router.navigate(['project/' + this.projectId + '/pricing']); - } else { + // this.router.navigate(['project/' + this.projectId + '/pricing']); + // } else { - this.presentModalOnlyOwnerCanManageTheAccountPlan() + // this.presentModalOnlyOwnerCanManageTheAccountPlan() + // } + + if (this.isVisiblePay) { + if (this.USER_ROLE === 'owner') { + + if (this.prjct_profile_type === 'payment') { + // this.notify._displayContactUsModal(true, 'upgrade_plan'); + this.notify._displayContactUsModal(true, 'upgrade_plan'); + } + else { + this.router.navigate(['project/' + this.projectId + '/pricing']); + + } + } else { + this.presentModalOnlyOwnerCanManageTheAccountPlan(); + } + } else { + this.notify._displayContactUsModal(true, 'upgrade_plan'); + // this.presentModalIncreaseMonltlResource() } } @@ -1964,10 +2031,21 @@ export class NavbarComponent extends PricingBaseComponent implements OnInit, Aft return 'Dashboard'; } - getProjectUserId() { - this.usersService.project_user_id_bs.subscribe((projectUser_id) => { - this.logger.log('[NAVBAR] - PROJECT-USER-ID ', projectUser_id); - this.projectUser_id = projectUser_id; + getProjectUser() { + this.usersService.projectUser_bs.subscribe((projectUser: ProjectUser) => { + this.logger.log('[NAVBAR] - PROJECT-USER-ID ', projectUser); + if(projectUser){ + this.projectUser_id = projectUser._id; + this.IS_AVAILABLE = projectUser.user_available; + + this.USER_ROLE = projectUser.role + if (this.USER_ROLE === 'agent') { + this.ROLE_IS_AGENT = true; + + } else { + this.ROLE_IS_AGENT = false; + } + } }); } diff --git a/src/app/components/settings-sidebar/settings-sidebar.component.ts b/src/app/components/settings-sidebar/settings-sidebar.component.ts index 10690d122336..5ba37f1b0cff 100755 --- a/src/app/components/settings-sidebar/settings-sidebar.component.ts +++ b/src/app/components/settings-sidebar/settings-sidebar.component.ts @@ -9,6 +9,7 @@ import { UsersService } from 'app/services/users.service' import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { KnowledgeBaseService } from 'app/services/knowledge-base.service' +import { ProjectUser } from 'app/models/project-user' @Component({ selector: 'appdashboard-settings-sidebar', templateUrl: './settings-sidebar.component.html', @@ -121,14 +122,12 @@ export class SettingsSidebarComponent implements OnInit { } getUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((userRole) => { + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ // this.logger.log('[SETTINGS-SIDEBAR]] - SUBSCRIPTION TO USER ROLE »»» ', userRole) - this.USER_ROLE = userRole; - }) + this.USER_ROLE = projectUser.role; + } + }) } listenSidebarIsOpened() { diff --git a/src/app/components/shared/contact-info/contact-info.component.ts b/src/app/components/shared/contact-info/contact-info.component.ts index e663c788a9e0..e49758420703 100644 --- a/src/app/components/shared/contact-info/contact-info.component.ts +++ b/src/app/components/shared/contact-info/contact-info.component.ts @@ -14,6 +14,7 @@ import { browserRefresh } from 'app/app.component'; import { LoggerService } from '../../../services/logger/logger.service'; import { TagsService } from 'app/services/tags.service'; import { UsersService } from 'app/services/users.service'; +import { ProjectUser } from 'app/models/project-user'; @Component({ selector: 'appdashboard-contact-info', templateUrl: './contact-info.component.html', @@ -102,15 +103,13 @@ export class ContactInfoComponent implements OnInit, OnChanges, OnDestroy, After // @ Subscribe to project user role // ------------------------------------------------------------- getProjectUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((userRole) => { - this.logger.log('[WS-REQUESTS-MSGS] - GET CURRENT PTOJECT-USER ROLE - userRole ', userRole) + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.logger.log('[WS-REQUESTS-MSGS] - GET CURRENT PTOJECT-USER ROLE - userRole ', projectUser) // used to display / hide 'WIDGET' and 'ANALITCS' in home.component.html - this.CURRENT_USER_ROLE = userRole; - }) + this.CURRENT_USER_ROLE = projectUser.role; + } + }) } detectBrowserRefresh() { diff --git a/src/app/components/sidebar-user-details/sidebar-user-details.component.ts b/src/app/components/sidebar-user-details/sidebar-user-details.component.ts index 239de71dd749..deeeaaef1446 100755 --- a/src/app/components/sidebar-user-details/sidebar-user-details.component.ts +++ b/src/app/components/sidebar-user-details/sidebar-user-details.component.ts @@ -22,6 +22,7 @@ import { UserModalComponent } from 'app/users/user-modal/user-modal.component'; import { BrandService } from 'app/services/brand.service'; import { Project } from 'app/models/project-model'; import { LogoutModalComponent } from 'app/auth/logout-modal/logout-modal.component'; +import { ProjectUser } from 'app/models/project-user'; // import { slideInOutAnimation } from '../../../_animations/index'; @Component({ selector: 'appdashboard-sidebar-user-details', @@ -365,16 +366,13 @@ export class SidebarUserDetailsComponent implements OnInit { getUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((userRole) => { - + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ // this.logger..log('[SIDEBAR-USER-DETAILS] - SUBSCRIPTION TO USER ROLE »»» ', userRole) // used to display / hide 'WIDGET' and 'ANALITCS' in home.component.html - this.USER_ROLE = userRole; - }) + this.USER_ROLE = projectUser.role; + } + }) } @@ -436,6 +434,8 @@ export class SidebarUserDetailsComponent implements OnInit { this.teammateStatus = this.teammateStatus.slice(0) this.logger.log('[SIDEBAR-USER-DETAILS] - PROFILE_STATUS selected option', this.teammateStatus[0].name); } + + } // this.teammateStatus = this.teammateStatus.slice(0) }); @@ -443,11 +443,13 @@ export class SidebarUserDetailsComponent implements OnInit { } getUserUserIsBusy() { - this.usersService.user_is_busy$.subscribe((user_isbusy) => { - this.IS_BUSY = user_isbusy; + this.usersService.projectUser_bs.subscribe((projectUser: ProjectUser) => { // THE VALUE OS IS_BUSY IS THEN UPDATED WITH THE VALUE RETURNED FROM THE WEBSOCKET getWsCurrentUserIsBusy$() // WHEN, FOR EXAMPLE IN PROJECT-SETTINGS > ADVANCED THE NUM OF MAX CHAT IS 3 AND THE // this.logger.log('[SIDEBAR-USER-DETAILS] - USER IS BUSY (from db)', this.IS_BUSY); + if(projectUser){ + this.IS_BUSY = projectUser.isBusy; + } }); } @@ -455,36 +457,31 @@ export class SidebarUserDetailsComponent implements OnInit { getProjectUser() { this.logger.log('[SIDEBAR-USER-DETAILS] !!! SIDEBAR CALL GET-PROJECT-USER') - this.usersService.getProjectUserByUserId(this.user._id).subscribe((projectUser: any) => { + this.usersService.getProjectUserByUserId(this.user._id).subscribe((projectUser: ProjectUser) => { this.logger.log('[SIDEBAR-USER-DETAILS] PROJECT-USER GET BY USER-ID - PROJECT-ID ', this.projectId); this.logger.log('[SIDEBAR-USER-DETAILS] PROJECT-USER GET BY USER-ID - CURRENT-USER-ID ', this.user._id); - // this.logger..log('[SIDEBAR-USER-DETAILS] PROJECT-USER GET BY USER-ID - PROJECT USER ', projectUser); - this.logger.log('[SIDEBAR-USER-DETAILS] PROJECT-USER GET BY USER-ID - PROJECT USER LENGTH', projectUser.length); - if ((projectUser) && (projectUser.length !== 0)) { - // this.logger.log('[SIDEBAR] PROJECT-USER ID ', projectUser[0]._id) - // this.logger.log('[SIDEBAR] USER IS AVAILABLE ', projectUser[0].user_available) - // this.logger.log('[SIDEBAR] USER IS BUSY (from db)', projectUser[0].isBusy) + console.log('[SIDEBAR-USER-DETAILS] PROJECT-USER GET BY USER-ID - PROJECT USER ', projectUser); + if (projectUser) { + // this.logger.log('[SIDEBAR] PROJECT-USER ID ', projectUser._id) + // this.logger.log('[SIDEBAR] USER IS AVAILABLE ', projectUser.user_available) + // this.logger.log('[SIDEBAR] USER IS BUSY (from db)', projectUser.isBusy) // this.user_is_available_bs = projectUser.user_available; - // NOTE_nk: comment this this.subsTo_WsCurrentUser(projectUser[0]._id) - this.subsTo_WsCurrentUser(projectUser[0]._id) - - if (projectUser[0].user_available !== undefined) { + // NOTE_nk: comment this this.subsTo_WsCurrentUser(projectUser._id) + this.subsTo_WsCurrentUser(projectUser._id) - this.usersService.user_availability(projectUser[0]._id, projectUser[0].user_available, projectUser[0].isBusy, projectUser[0]) + if (projectUser.user_available !== undefined) { + this.usersService.setProjectUser(projectUser) } // ADDED 21 AGO - if (projectUser[0].role !== undefined) { - this.logger.log('[SIDEBAR-USER-DETAILS] GET PROJECT USER ROLE FOR THE PROJECT ', this.projectId, ' »» ', projectUser[0].role); + if (projectUser.role !== undefined) { + this.logger.log('[SIDEBAR-USER-DETAILS] GET PROJECT USER ROLE FOR THE PROJECT ', this.projectId, ' »» ', projectUser.role); // ASSIGN THE projectUser[0].role VALUE TO USER_ROLE - this.USER_ROLE = projectUser[0].role; - - // SEND THE ROLE TO USER SERVICE THAT PUBLISH - this.usersService.user_role(projectUser[0].role); + this.USER_ROLE = projectUser.role; } } else { diff --git a/src/app/components/sidebar/sidebar.component.ts b/src/app/components/sidebar/sidebar.component.ts index 6ac51517565c..41f44ac8b850 100755 --- a/src/app/components/sidebar/sidebar.component.ts +++ b/src/app/components/sidebar/sidebar.component.ts @@ -45,6 +45,7 @@ import { getSteps as defaultSteps, defaultStepOptions } from './sidebar.tour.con import Step from 'shepherd.js/src/types/step'; import { environment } from 'environments/environment'; import { LogoutModalComponent } from 'app/auth/logout-modal/logout-modal.component'; +import { ProjectUser } from 'app/models/project-user'; declare const $: any; @@ -272,7 +273,7 @@ export class SidebarComponent implements OnInit, AfterViewInit { areVisibleChatbot: boolean; isVisibleKNB: boolean; ARE_NEW_KB: boolean; - kbNameSpaceid : string = ''; + kbNameSpaceid: string = ''; currentProjectUser: any; isVisibleSupportMenu: boolean; company_brand_color: string @@ -322,8 +323,6 @@ export class SidebarComponent implements OnInit, AfterViewInit { this.translateChangeAvailabilitySuccessMsg(); this.translateChangeAvailabilityErrorMsg(); this.getProfileImageStorage(); - this.getUserAvailability(); - this.getUserUserIsBusy(); this.getProjectUserId(); this.hasChangedAvailabilityStatusInUsersComp(); this.checkUserImageUploadIsComplete(); @@ -345,7 +344,7 @@ export class SidebarComponent implements OnInit, AfterViewInit { // this.getProjectPlan() this.getBaseUrlAndThenProjectPlan(); this.listenToKbVersion() - + // document.documentElement.style.setProperty('--sidebar-active-icon', this.company_brand_color); } @@ -356,7 +355,7 @@ export class SidebarComponent implements OnInit, AfterViewInit { if (this.company_brand_color) { // this.element.nativeElement.querySelector('.project_background').style.setProperty('--brandColor', this.company_brand_color) } - } + } // ngAfterContentInit(): void { @@ -408,7 +407,7 @@ export class SidebarComponent implements OnInit, AfterViewInit { if (kbnValue === 'T') { this.getProjectPlan() - + } else if (kbnValue === 'F') { this.isVisibleKNB = false; } @@ -519,10 +518,10 @@ export class SidebarComponent implements OnInit, AfterViewInit { } else if (projectProfileData['customization'] === undefined) { this.logger.log('[BOTS-SIDEBAR] manageknowledgeBasesVisibility USECASE C customization is ', projectProfileData['customization'], 'get value from FT') // if (this.public_Key.includes("KNB")) { - // this.logger.log('[BOTS-SIDEBAR] manageknowledgeBasesVisibility USECASE B (from FT) - EXIST KNB ', this.public_Key.includes("KNB")); + // this.logger.log('[BOTS-SIDEBAR] manageknowledgeBasesVisibility USECASE B (from FT) - EXIST KNB ', this.public_Key.includes("KNB")); - this.isVisibleKNB = this.getKnbValue() - this.logger.log('[BOTS-SIDEBAR] this.isVisibleKNB from FT ', this.isVisibleKNB) + this.isVisibleKNB = this.getKnbValue() + this.logger.log('[BOTS-SIDEBAR] this.isVisibleKNB from FT ', this.isVisibleKNB) } } @@ -725,7 +724,7 @@ export class SidebarComponent implements OnInit, AfterViewInit { getChatUrl() { this.CHAT_BASE_URL = this.appConfigService.getConfig().CHAT_BASE_URL; - // this.logger.log('[SIDEBAR] AppConfigService getAppConfig CHAT_BASE_URL', this.CHAT_BASE_URL); + this.logger.log('[SIDEBAR] AppConfigService getAppConfig CHAT_BASE_URL', this.CHAT_BASE_URL); } @@ -908,7 +907,7 @@ export class SidebarComponent implements OnInit, AfterViewInit { } } - + getCurrentRoute() { @@ -1257,7 +1256,7 @@ export class SidebarComponent implements OnInit, AfterViewInit { // this.logger.log('[SIDEBAR] NavigationEnd - EDIT_PROJECT_USER_ROUTE_IS_ACTIVE ', this.EDIT_PROJECT_USER_ROUTE_IS_ACTIVE); } - + if (event.url.substring(event.url.lastIndexOf('/') + 1) === 'wsrequests') { this.MONITOR_ROUTE_IS_ACTIVE = true; this.logger.log('[SIDEBAR] NavigationEnd - MONITOR_ROUTE_IS_ACTIVE ', this.MONITOR_ROUTE_IS_ACTIVE); @@ -1283,7 +1282,7 @@ export class SidebarComponent implements OnInit, AfterViewInit { // this.logger.log('[SIDEBAR] NavigationEnd - CONV_DEMO_ROUTE_IS_ACTIVE ', this.CONV_DEMO_ROUTE_IS_ACTIVE); } - + @@ -1329,7 +1328,7 @@ export class SidebarComponent implements OnInit, AfterViewInit { this.logger.log('[SIDEBAR] NavigationEnd - TRANSLATIONS_ROUTE_IS_ACTIVE ', this.TRANSLATIONS_ROUTE_IS_ACTIVE); } - + if (event.url.indexOf('/installation') !== -1) { this.INSTALLATION_ROUTE_IS_ACTIVE = true; @@ -1395,7 +1394,7 @@ export class SidebarComponent implements OnInit, AfterViewInit { // if (event.url.indexOf('/support') !== -1) { - if (event.url.substring(event.url.lastIndexOf('/') + 1) === 'support') { + if (event.url.substring(event.url.lastIndexOf('/') + 1) === 'support') { this.SUPPORT_ROUTE_IS_ACTIVE = true; this.logger.log('[SIDEBAR] NavigationEnd - SUPPORT_ROUTE_IS_ACTIVE; ', this.SUPPORT_ROUTE_IS_ACTIVE); } else { @@ -1403,9 +1402,9 @@ export class SidebarComponent implements OnInit, AfterViewInit { this.logger.log('[SIDEBAR] NavigationEnd - SUPPORT_ROUTE_IS_ACTIVE ', this.SUPPORT_ROUTE_IS_ACTIVE); } - if (event.url.indexOf('/home') !== -1) { - this.presentHelpCenterPopup() - } + // if (event.url.indexOf('/home') !== -1) { + // this.presentHelpCenterPopup() + // } } }); } @@ -1540,17 +1539,19 @@ export class SidebarComponent implements OnInit, AfterViewInit { getProjectUserId() { - this.usersService.project_user_id_bs.subscribe((projectUser_id) => { - this.logger.log('[SIDEBAR] - PROJECT-USER-ID ', projectUser_id); - - // if (this.projectUser_id) { - // this.logger.log('[SIDEBAR] - PROJECT-USER-ID (THIS) ', this.projectUser_id); - // this.logger.log('[SIDEBAR] - PROJECT-USER-ID ', projectUser_id); - - // this.usersService.unsubscriptionToWsCurrentUser(projectUser_id) - // } - if (projectUser_id) { - this.projectUser_id = projectUser_id; + this.usersService.projectUser_bs.subscribe((projectUser: ProjectUser) => { + this.logger.log('[SIDEBAR] - PROJECT-USER-ID ', projectUser); + if (projectUser) { + this.projectUser_id = projectUser._id; + this.IS_AVAILABLE = projectUser.user_available; + this.IS_BUSY = projectUser.isBusy; + + this.USER_ROLE = projectUser.role; + if (this.USER_ROLE) { + if (this.USER_ROLE === 'agent') { + this.SHOW_SETTINGS_SUBMENU = false; + } + } } }); } @@ -1562,22 +1563,6 @@ export class SidebarComponent implements OnInit, AfterViewInit { - the USER-SERVICE PUBLISH THE PROJECT-USER AVAILABILITY AND THE PROJECT-USER ID - the SIDEBAR (this component) SUBSCRIBES THESE VALUES */ - getUserAvailability() { - this.usersService.user_is_available_bs.subscribe((user_available) => { - this.IS_AVAILABLE = user_available; - // this.logger.log('[SIDEBAR] - USER IS AVAILABLE ', this.IS_AVAILABLE); - }); - } - - getUserUserIsBusy() { - this.usersService.user_is_busy$.subscribe((user_isbusy) => { - this.IS_BUSY = user_isbusy; - // THE VALUE OS IS_BUSY IS THEN UPDATED WITH THE VALUE RETURNED FROM THE WEBSOCKET getWsCurrentUserIsBusy$() - // WHEN, FOR EXAMPLE IN PROJECT-SETTINGS > ADVANCED THE NUM OF MAX CHAT IS 3 AND THE - // this.logger.log('[SIDEBAR] - USER IS BUSY (from db)', this.IS_BUSY); - }); - } - // changeAvailabilityState(IS_AVAILABLE, profilestatus) { // this.logger.log('[SIDEBAR] - CHANGE STATUS - USER IS AVAILABLE ? ', IS_AVAILABLE); @@ -1632,34 +1617,28 @@ export class SidebarComponent implements OnInit, AfterViewInit { // *** NOTE: THE SAME CALLBACK IS RUNNED IN THE HOME.COMP *** getProjectUser() { // this.logger.log('[SIDEBAR] !!! SIDEBAR CALL GET-PROJECT-USER') - this.usersService.getProjectUserByUserId(this.currentUserId).subscribe((projectUser: any) => { + this.usersService.getProjectUserByUserId(this.currentUserId).subscribe((projectUser: ProjectUser) => { this.logger.log('[SIDEBAR] PROJECT-USER GET BY USER-ID ', projectUser); this.logger.log('[SIDEBAR] PROJECT-USER GET BY USER-ID - PROJECT-ID ', this.projectId); this.logger.log('[SIDEBAR] PROJECT-USER GET BY USER-ID - CURRENT-USER-ID ', this.user._id); // this.logger.log('[SIDEBAR] PROJECT-USER GET BY USER-ID - PROJECT USER ', projectUser); - this.logger.log('[SIDEBAR] PROJECT-USER GET BY USER-ID - PROJECT USER LENGTH', projectUser.length); - if ((projectUser) && (projectUser.length !== 0)) { - // this.logger.log('[SIDEBAR] PROJECT-USER ID ', projectUser[0]._id) - // this.logger.log('[SIDEBAR] USER IS AVAILABLE ', projectUser[0].user_available) - // this.logger.log('[SIDEBAR] USER IS BUSY (from db)', projectUser[0].isBusy) + if (projectUser) { + // this.logger.log('[SIDEBAR] PROJECT-USER ID ', projectUser._id) + // this.logger.log('[SIDEBAR] USER IS AVAILABLE ', projectUser.user_available) + // this.logger.log('[SIDEBAR] USER IS BUSY (from db)', projectUser.isBusy) // this.user_is_available_bs = projectUser.user_available; - // NOTE_nk: comment this this.subsTo_WsCurrentUser(projectUser[0]._id) - this.subsTo_WsCurrentUser(projectUser[0]._id) + // NOTE_nk: comment this this.subsTo_WsCurrentUser(projectUser._id) + this.subsTo_WsCurrentUser(projectUser._id) - if (projectUser[0].user_available !== undefined) { - this.usersService.user_availability(projectUser[0]._id, projectUser[0].user_available, projectUser[0].isBusy, projectUser[0]) - } + this.usersService.setProjectUser(projectUser) // ADDED 21 AGO - if (projectUser[0].role !== undefined) { - this.logger.log('[SIDEBAR] GET PROJECT USER ROLE FOR THE PROJECT ', this.projectId, ' »» ', projectUser[0].role); + if (projectUser.role !== undefined) { + this.logger.log('[SIDEBAR] GET PROJECT USER ROLE FOR THE PROJECT ', this.projectId, ' »» ', projectUser.role); - // ASSIGN THE projectUser[0].role VALUE TO USER_ROLE - this.USER_ROLE = projectUser[0].role; - - // SEND THE ROLE TO USER SERVICE THAT PUBLISH - this.usersService.user_role(projectUser[0].role); + // ASSIGN THE projectUser.role VALUE TO USER_ROLE + this.USER_ROLE = projectUser.role; } } else { @@ -1775,10 +1754,10 @@ export class SidebarComponent implements OnInit, AfterViewInit { // FOR KB const storedNamespace = this.localDbService.getFromStorage(`last_kbnamespace-${this.project._id}`) this.logger.log('[BOTS-SIDEBAR] storedNamespace', storedNamespace); - if(storedNamespace) { + if (storedNamespace) { let storedNamespaceObjct = JSON.parse(storedNamespace) this.logger.log('[BOTS-SIDEBAR] storedNamespaceObjct', storedNamespaceObjct); - this.kbNameSpaceid= storedNamespaceObjct.id + this.kbNameSpaceid = storedNamespaceObjct.id } this.projectId = this.project._id @@ -1789,11 +1768,11 @@ export class SidebarComponent implements OnInit, AfterViewInit { if (projects) { this.currentProjectUser = projects.find(prj => prj.id_project.id === this.projectId); this.logger.log('[SIDEBAR] currentProjectUser ', this.currentProjectUser) + } }); - - this.getProjectUserRole(); + this.getProjectUserId(); this.getProjectUser(); // this.getFaqKbByProjectId() @@ -1803,6 +1782,8 @@ export class SidebarComponent implements OnInit, AfterViewInit { } + + getKnowledgeBaseSettings() { this.kbService.getKbSettingsPrev().subscribe((kbSettings: KbSettings) => { this.logger.log("[SIDEBAR] get kbSettings RES ", kbSettings); @@ -1839,21 +1820,6 @@ export class SidebarComponent implements OnInit, AfterViewInit { }); } - getProjectUserRole() { - this.usersService.project_user_role_bs.subscribe((user_role) => { - this.USER_ROLE = user_role; - this.logger.log('[SIDEBAR] - 1. SUBSCRIBE PROJECT_USER_ROLE_BS ', this.USER_ROLE); - if (this.USER_ROLE) { - // this.logger.log('[SIDEBAR] - PROJECT USER ROLE get from $ subsription', this.USER_ROLE); - if (this.USER_ROLE === 'agent') { - this.SHOW_SETTINGS_SUBMENU = false; - } - } - - }); - // } - } - round5(x) { // const percentageRounded = Math.ceil(x / 5) * 5; // this.logger.log('SIDEBAR project trial days left % rounded', percentageRounded); @@ -2135,7 +2101,7 @@ export class SidebarComponent implements OnInit, AfterViewInit { this.displayLogoutModal = 'none'; } - + removeChatBtnFocus() { this.notify.publishHasClickedChat(true); @@ -2174,8 +2140,51 @@ export class SidebarComponent implements OnInit, AfterViewInit { // } else { // this.openWindow('Tiledesk - Open Source Live Chat', url); // } + // this.redirectToPricing(this.currentProjectUser) } + redirectToPricing(projectUser) { + const role = projectUser.role; + const project = projectUser.id_project; + + const projectCreationDate = new Date(project.createdAt); + const dateLimit = new Date('2025-01-16T00:00:00'); + // const dateLimit = new Date('2022-07-04T00:00:00') // for test purpose + + console.log('[APP-COMPONENT] REDIRECT TO PRICING - projectUser ', projectUser) + console.log('[APP-COMPONENT] REDIRECT TO PRICING - project ', project) + console.log('[APP-COMPONENT] REDIRECT TO PRICING - projectCreationDate ', projectCreationDate) + console.log('[APP-COMPONENT] REDIRECT TO PRICING - dateLimit ', dateLimit) + console.log('[APP-COMPONENT] REDIRECT TO PRICING - project.profile.type ', project.profile.type) + console.log('[APP-COMPONENT] REDIRECT TO PRICING - project.trialExpired ', project.trialExpired) + + if (projectCreationDate >= dateLimit) { + console.log('[APP-COMPONENT] REDIRECT TO PRICING - projectCreationDate > dateLimit ') + if (project) { + if (project.profile.type === 'free' && project.trialExpired === true) { + if (role === 'owner') { + this.router.navigate(['project/' + project._id + '/pricing/te']); + } else { + this.router.navigate(['project/' + project._id + '/unauthorized-to-upgrade']); + } + } else { + this.goToChat() + } + } + + } else { + console.log('[APP-COMPONENT] REDIRECT TO PRICING - projectCreationDate < dateLimit ') + this.goToChat() + } + } + + goToChat() { + const url = this.CHAT_BASE_URL; + window.open(url, '_self'); + } + + + @HostListener('document:mousedown', ['$event']) onMouseDown(event) { // this.logger.log('mousedown event', event) diff --git a/src/app/components/widget-installations/magento-installation/magento-installation.component.html b/src/app/components/widget-installations/magento-installation/magento-installation.component.html index 4c2be73b713d..85e4481ed3c1 100644 --- a/src/app/components/widget-installations/magento-installation/magento-installation.component.html +++ b/src/app/components/widget-installations/magento-installation/magento-installation.component.html @@ -1,76 +1,75 @@
    + +
    +
    + + + 1 + + + + {{'WidgetInstallations.GenericStep1' | translate }} + +
    + + + + + + 2 + + + + {{'WidgetInstallations.MagentoStep2' | translate }} + +
    + + + + 3 + + + + {{'WidgetInstallations.MagentoStep3' | translate }} + +
    + + + + 4 + + + + {{'WidgetInstallations.MagentoStep4' | translate }} + +
    + + + + 5 + + + + {{'WidgetInstallations.MagentoStep5' | translate }} + +
    -
    -
    - - - 1 - - - - {{'WidgetInstallations.GenericStep1' | translate }} - -
    - - - - - - 2 - - - - {{'WidgetInstallations.MagentoStep2' | translate }} - -
    - - - - 3 - - - - {{'WidgetInstallations.MagentoStep3' | translate }} - -
    - - - - 4 - - - - {{'WidgetInstallations.MagentoStep4' | translate }} - -
    - - - - 5 - - - - {{'WidgetInstallations.MagentoStep5' | translate }} - -
    - - - - - -
    + + + + +
    \ No newline at end of file diff --git a/src/app/components/widget-installations/prestashop-installation/prestashop-installation.component.html b/src/app/components/widget-installations/prestashop-installation/prestashop-installation.component.html index 3825b6df3ad6..a6c850a51b14 100644 --- a/src/app/components/widget-installations/prestashop-installation/prestashop-installation.component.html +++ b/src/app/components/widget-installations/prestashop-installation/prestashop-installation.component.html @@ -1,107 +1,116 @@ -
    -
    - - - 1 - - - - {{'WidgetInstallations.GenericStep1' | translate }} - -
    +
    + + + 1 + + + + {{'WidgetInstallations.GenericStep1' | translate }} + +
    - + - - - 2 - - - - {{'WidgetInstallations.PrestashopStep2' | translate }} - -
    + + + 2 + + + + {{'WidgetInstallations.PrestashopStep2' | translate }} + +
    - - - 3 - - - - {{'WidgetInstallations.PrestashopStep3' | translate }} - {{'LearnMore' | translate }} + + + 3 + + + + {{'WidgetInstallations.PrestashopStep3' | translate }} + {{'LearnMore' | + translate }} - -
    +
    +
    - - - 4 - - - - {{'WidgetInstallations.PrestashopStep4' | translate }} - -
    + + + 4 + + + + {{'WidgetInstallations.PrestashopStep4' | translate }} + +
    - - - 5 - - - - {{'WidgetInstallations.PrestashopStep5' | translate }} - {{'FromHere' | translate }}. - -
    + + + 5 + + + + {{'WidgetInstallations.PrestashopStep5' | translate }} + {{'FromHere' | + translate }}. + +
    - - - 6 - - - - {{'WidgetInstallations.PrestashopStep6' | translate }} - -
    + + + 6 + + + + {{'WidgetInstallations.PrestashopStep6' | translate }} + +
    + + + + 7 + + + + {{'WidgetInstallations.PrestashopStep7' | translate }} + +
    + + +
    + + +
    + + + 8 + + + + {{'OnceYouHaveCompletedYourChanges' | translate}}. + {{'YourWidgetShouldAppearInTheBottomRightCorner' | translate}}. + +
    +
    - - - 7 - - - - {{'WidgetInstallations.PrestashopStep7' | translate }} - -
    + - -
    - - -
    - - - 8 - - - - {{'OnceYouHaveCompletedYourChanges' | translate}}. - {{'YourWidgetShouldAppearInTheBottomRightCorner' | translate}}. - -
    -
    - - -
    -
    + \ No newline at end of file diff --git a/src/app/contacts/contacts.component.ts b/src/app/contacts/contacts.component.ts index 1fcb867ecc85..8ec62ae1deb7 100755 --- a/src/app/contacts/contacts.component.ts +++ b/src/app/contacts/contacts.component.ts @@ -13,6 +13,7 @@ import { TranslateService } from '@ngx-translate/core'; import { ProjectPlanService } from '../services/project-plan.service'; import { Subscription } from 'rxjs'; import { LoggerService } from '../services/logger/logger.service'; +import { ProjectUser } from 'app/models/project-user'; declare const $: any; // const swal = require('sweetalert'); const Swal = require('sweetalert2') @@ -405,27 +406,29 @@ export class ContactsComponent implements OnInit, OnDestroy, AfterViewInit { } getProjectUserRole() { - this.usersService.project_user_role_bs.subscribe((user_role) => { - const current_user_role = user_role; - this.USER_ROLE = user_role; - this.logger.log('[CONTACTS-COMP] - SUBSCRIBE PROJECT_USER_ROLE_BS ', current_user_role); - if (current_user_role) { - this.logger.log('[CONTACTS-COMP] - PROJECT USER ROLE ', current_user_role); - if (current_user_role === 'agent') { - this.IS_CURRENT_USER_AGENT = true; - this.logger.log('[CONTACTS-COMP] - PROJECT USER ROLE - IS CURRENT USER AGENT? ', this.IS_CURRENT_USER_AGENT); - } else { - this.IS_CURRENT_USER_AGENT = false; - this.logger.log('[CONTACTS-COMP] - PROJECT USER ROLE - IS CURRENT USER AGENT? ', this.IS_CURRENT_USER_AGENT); - } + this.usersService.projectUser_bs.subscribe((projectUser: ProjectUser) => { + if(projectUser){ + const current_user_role = projectUser.role; + this.USER_ROLE = current_user_role; + this.logger.log('[CONTACTS-COMP] - SUBSCRIBE PROJECT_USER_ROLE_BS ', current_user_role); + if (current_user_role) { + this.logger.log('[CONTACTS-COMP] - PROJECT USER ROLE ', current_user_role); + if (current_user_role === 'agent') { + this.IS_CURRENT_USER_AGENT = true; + this.logger.log('[CONTACTS-COMP] - PROJECT USER ROLE - IS CURRENT USER AGENT? ', this.IS_CURRENT_USER_AGENT); + } else { + this.IS_CURRENT_USER_AGENT = false; + this.logger.log('[CONTACTS-COMP] - PROJECT USER ROLE - IS CURRENT USER AGENT? ', this.IS_CURRENT_USER_AGENT); + } - if (current_user_role === 'owner') { - this.IS_CURRENT_USER_OWNER = true; - this.logger.log('[CONTACTS-COMP] - PROJECT USER ROLE - IS CURRENT USER OWNER? ', this.IS_CURRENT_USER_OWNER); - } else { - this.IS_CURRENT_USER_OWNER = false; - this.logger.log('[CONTACTS-COMP] - PROJECT USER ROLE - IS CURRENT USER OWNER? ', this.IS_CURRENT_USER_OWNER); + if (current_user_role === 'owner') { + this.IS_CURRENT_USER_OWNER = true; + this.logger.log('[CONTACTS-COMP] - PROJECT USER ROLE - IS CURRENT USER OWNER? ', this.IS_CURRENT_USER_OWNER); + } else { + this.IS_CURRENT_USER_OWNER = false; + this.logger.log('[CONTACTS-COMP] - PROJECT USER ROLE - IS CURRENT USER OWNER? ', this.IS_CURRENT_USER_OWNER); + } } } }); diff --git a/src/app/core/admin.guard.ts b/src/app/core/admin.guard.ts deleted file mode 100755 index 7c7d781fff24..000000000000 --- a/src/app/core/admin.guard.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Router } from '@angular/router'; -import { UsersService } from '../services/users.service'; -import { AuthService } from '../core/auth.service'; -import { LoggerService } from '../services/logger/logger.service'; -// implements CanActivate -@Injectable() -export class AdminGuard { - - userRole: string; - projectId: string; - currentUserId: string - - constructor( - private router: Router, - private usersService: UsersService, - private auth: AuthService, - private logger: LoggerService - ) { - // this.checkRole(); - // this.getLoggedUser(); - // this.getCurrentProject(); - - } - - getLoggedUser() { - this.auth.user_bs.subscribe((user) => { - - if (user) { - this.currentUserId = user._id; - this.logger.log('[ADMIN-GUARD] - Current USER ID ', this.currentUserId) - - } - }); - } - - getCurrentProject() { - this.auth.project_bs.subscribe((project) => { - - if (project) { - this.projectId = project._id - this.logger.log('[ADMIN-GUARD] - PRJCT ID from AUTH SERV SUBSC ', this.projectId); - } - - }); - } - - checkRole() { - this.usersService.project_user_role_bs.subscribe((user_role) => { - if (user_role) { - - this.userRole = user_role; - // this.userRole = 'agent'; - this.logger.log('[ADMIN-GUARD] - CHECK ROLE (FROM SUBSCRIPTION) »»» ', this.userRole); - // if (user_role === 'agent' || user_role === undefined) { - // this.logger.log([ADMIN-GUARD] - CHECK ROLE (FROM SUBSCRIPTION) »»» ', user_role); - - // this.router.navigate(['unauthorized']); - - // } else { - // this.logger.log([ADMIN-GUARD] - CHECK ROLE (FROM SUBSCRIPTION) »»» ', user_role); - // } - } - }); - } - -} diff --git a/src/app/core/auth.guard.ts b/src/app/core/auth.guard.ts index e1074943fc26..7a01a7fb27cb 100755 --- a/src/app/core/auth.guard.ts +++ b/src/app/core/auth.guard.ts @@ -16,6 +16,7 @@ import { LocalDbService } from 'app/services/users-local-db.service'; import { MatSnackBar } from '@angular/material/snack-bar'; import { AppConfigService } from 'app/services/app-config.service'; import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { FaqKbService } from 'app/services/faq-kb.service'; // import { RequestsMsgsComponent } from '../requests-msgs/requests-msgs.component'; // import { HomeComponent } from '../home/home.component'; @@ -58,6 +59,7 @@ export class AuthGuard implements CanActivate { private usersService: UsersService, private logger: LoggerService, public localDbService: LocalDbService, + private faqKbService: FaqKbService, private _snackBar: MatSnackBar, public appConfigService: AppConfigService, private _httpClient: HttpClient, @@ -205,7 +207,7 @@ export class AuthGuard implements CanActivate { this.usersService.getAllUsersOfCurrentProjectAndSaveInStorage(); // GET AND SAVE ALL BOTS OF CURRENT PROJECT IN LOCAL STORAGE - this.usersService.getBotsByProjectIdAndSaveInStorage(); + this.faqKbService.getBotsByProjectIdAndSaveInStorage(); } else { this.logger.log('[AUTH-GUARD] - PROJECT OBJCT FILTERED FOR PROJECT ID !! NOT FOUND - GO TO UNAUTHORIZED PAGE '); @@ -217,11 +219,13 @@ export class AuthGuard implements CanActivate { this.logger.log('[AUTH-GUARD] error', error.error) if (error.error.msg === "you dont belong to the project.") { - this._snackBar.open("Oops! " + error.error.msg, null, { - duration: 5000, - verticalPosition: 'top', - panelClass: 'error-snackbar' - }); + this.notify.presentModalYouDontBelongToTheProject() + + // this._snackBar.open("Oops! " + error.error.msg, null, { + // duration: 5000, + // verticalPosition: 'top', + // panelClass: 'error-snackbar' + // }); } diff --git a/src/app/core/auth.service.ts b/src/app/core/auth.service.ts index 2c760e0cec8a..e6276582ec31 100755 --- a/src/app/core/auth.service.ts +++ b/src/app/core/auth.service.ts @@ -66,6 +66,7 @@ export class AuthService { public tilebotSidebarIsOpened: BehaviorSubject = new BehaviorSubject(null) public botsSidebarIsOpened: BehaviorSubject = new BehaviorSubject(null) public isChromeVerGreaterThan100: BehaviorSubject = new BehaviorSubject(null) + public hasChangedProject: BehaviorSubject = new BehaviorSubject(false) show_ExpiredSessionPopup: boolean @@ -713,6 +714,7 @@ export class AuthService { this.logger.log('[Auth-SERV] sleekplanSso response ', response) this.logger.log('[Auth-SERV] sleekplanSso response token', response['token']) this.logger.log('[Auth-SERV] sleekplanSso response $sleek', window['$sleek']) + // Configure Sleekplan with SSO // window['Sleekplan'] = { // id: 'YOUR_SLEEKPLAN_ID', @@ -883,7 +885,12 @@ export class AuthService { // } hasClickedGoToProjects() { - this.project_bs.next(null) + console.log('[AUTH-SERV] - HAS CLICKED GO TO PROJECT') + this.hasChangedProject.next(true) + console.log('[AUTH-SERV] After Update:', this.hasChangedProject.value); // Debugging + this.project_bs.next(null); + + this.logger.log('[AUTH-SERV] - HAS CLICKED GO TO PROJECT - PUBLISH PRJCT = ', this.project_bs.next(null)) this.logger.log('[AUTH-SERV] - HAS CLICKED GO TO PROJECT - PRJCT VALUE = ', this.project_bs.value) // this.logger.log('!!C-U »»»»» AUTH SERV - HAS BEEN CALLED "HAS CLICKED GOTO PROJECTS" - PUBLISH PRJCT = ', this.project_bs.next(null)) diff --git a/src/app/core/core.module.ts b/src/app/core/core.module.ts index fbbf4c9e6799..c2d876d6729a 100755 --- a/src/app/core/core.module.ts +++ b/src/app/core/core.module.ts @@ -1,7 +1,6 @@ import { NgModule } from '@angular/core'; import { AuthService } from './auth.service'; -import { AdminGuard } from './admin.guard'; import { NotifyService } from './notify.service'; import { SsoService } from './sso.service'; @@ -11,7 +10,6 @@ import { SsoService } from './sso.service'; providers: [ AuthService, NotifyService, - AdminGuard, SsoService ], }) diff --git a/src/app/core/notify.service.ts b/src/app/core/notify.service.ts index 1d427856a6ff..1f62052edaa5 100755 --- a/src/app/core/notify.service.ts +++ b/src/app/core/notify.service.ts @@ -89,10 +89,10 @@ export class NotifyService { this.salesEmail = brand['CONTACT_SALES_EMAIL']; this.logger.log('[NOTIFY-SERVICE] salesEmail ', this.salesEmail) this.hideHelpLink = brand['DOCS']; - + } - + // Not Used presentContactUsModalToUpgradePlan(displayModal: boolean) { @@ -125,7 +125,7 @@ export class NotifyService { this._prjctPlanName = prjctPlanName; Swal.fire({ title: this.translate.instant("Pricing.SubscriptionPaymentProblem"), - text: this.translate.instant('Pricing.WeWereUnableToAutomaticallyRenewYourSubscription') + '. ' + this.translate.instant("Pricing.PleaseContactUs") + ' ' + this.translate.instant("Pricing.ToUpdateYourPaymentInformation")+ '.', + text: this.translate.instant('Pricing.WeWereUnableToAutomaticallyRenewYourSubscription') + '. ' + this.translate.instant("Pricing.PleaseContactUs") + ' ' + this.translate.instant("Pricing.ToUpdateYourPaymentInformation") + '.', icon: "warning", showCloseButton: true, showCancelButton: false, @@ -134,14 +134,14 @@ export class NotifyService { focusConfirm: false, // reverseButtons: true, // cancelButtonColor: "var(--red-color)", - - - }).then((result) => { + + + }).then((result) => { if (result.isConfirmed) { - this.logger.log('[NOTIFY-SERVICE] displaySubscripionHasExpiredModal result.isConfirmed', result.isConfirmed) + this.logger.log('[NOTIFY-SERVICE] displaySubscripionHasExpiredModal result.isConfirmed', result.isConfirmed) window.open(`mailto:${this.salesEmail}?subject=Upgrade plan`); } - + }); @@ -151,15 +151,15 @@ export class NotifyService { this.logger.log('[NOTIFY-SERVICE] - HasExpiredModal subHasExpired ', subHasExpired); this.logger.log('[NOTIFY-SERVICE] - HasExpiredModal prjctPlanName ', prjctPlanName); this.logger.log('[NOTIFY-SERVICE] - HasExpiredModal prjctPlanSubsEndDate ', prjctPlanSubsEndDate); - - + + } - - + + // "{{'YourTrialHasEnded' | translate }}" // "{{'UpgradeNowToKeepOurAmazingFeatures' | translate}}" - displayTrialHasExpiredModal(projectId, yourTrialHasEnded, upgradeNowToKeepOurAmazingFeatures , upgrade) { - this.logger.log('displayTrialHasExpiredModal yourTrialHasEnded' , yourTrialHasEnded, 'upgradeNowToKeepOurAmazingFeatures ', upgradeNowToKeepOurAmazingFeatures ) + displayTrialHasExpiredModal(projectId, yourTrialHasEnded, upgradeNowToKeepOurAmazingFeatures, upgrade) { + this.logger.log('displayTrialHasExpiredModal yourTrialHasEnded', yourTrialHasEnded, 'upgradeNowToKeepOurAmazingFeatures ', upgradeNowToKeepOurAmazingFeatures) Swal.fire({ title: yourTrialHasEnded, // "Your 14-days free trial has expired", text: upgradeNowToKeepOurAmazingFeatures, //"Upgrade now to keep our amazing features", @@ -171,7 +171,7 @@ export class NotifyService { // cancelButtonColor: "var(--red-color)", focusConfirm: false, // reverseButtons: true, - }).then((result) => { + }).then((result) => { if (result.isConfirmed) { this.router.navigate(['project/' + projectId + '/pricing']); } @@ -191,7 +191,7 @@ export class NotifyService { this.prjct_profile_name = prjctPlanName // + ' plan' Swal.fire({ title: this.prjct_profile_name + ' ' + this.translate.instant('Pricing.HasExpired'), - text: this.translate.instant('Pricing.PleaseContactUs') + ' ' + this.translate.instant("Pricing.ToUpdateYourPaymentInformation"), + text: this.translate.instant('Pricing.PleaseContactUs') + ' ' + this.translate.instant("Pricing.ToUpdateYourPaymentInformation"), icon: "warning", showCloseButton: true, showCancelButton: false, @@ -199,12 +199,12 @@ export class NotifyService { // confirmButtonColor: "var(--blue-light)", focusConfirm: false, // reverseButtons: true, - }).then((result) => { + }).then((result) => { if (result.isConfirmed) { - this.logger.log('[NOTIFY-SERVICE] displayModalEnterpiseSubsExpired result.isConfirmed', result.isConfirmed) + this.logger.log('[NOTIFY-SERVICE] displayModalEnterpiseSubsExpired result.isConfirmed', result.isConfirmed) window.open(`mailto:${this.salesEmail}?subject=Upgrade plan (${this.prjct_profile_name} expired)`); } - + }); } @@ -242,17 +242,17 @@ export class NotifyService { let contentText = "" if (reason === 'upgrade_plan') { contentText = this.translate.instant('Pricing.ContactUsViaEmailToUpgradeYourPricingPlan') - } - else if (reason === 'seats_limit_exceed' ) { - contentText = this.translate.instant("Pricing.TheSeatsNumberExceedsTheAllowed" ) + '. ' + this.translate.instant('Pricing.ContactUsViaEmailToUpgradeYourPricingPlan') } - else if (reason === 'seats_limit_reached' ) { - contentText = this.translate.instant("Pricing.YouCurrentlyAreUsingAllActiveOperatorSeats" ) + '. ' + this.translate.instant('Pricing.ContactUsViaEmailToUpgradeYourPricingPlan') + else if (reason === 'seats_limit_exceed') { + contentText = this.translate.instant("Pricing.TheSeatsNumberExceedsTheAllowed") + '. ' + this.translate.instant('Pricing.ContactUsViaEmailToUpgradeYourPricingPlan') + } + else if (reason === 'seats_limit_reached') { + contentText = this.translate.instant("Pricing.YouCurrentlyAreUsingAllActiveOperatorSeats") + '. ' + this.translate.instant('Pricing.ContactUsViaEmailToUpgradeYourPricingPlan') } Swal.fire({ - title: this.translate.instant('Pricing.PlanChange'), - text: contentText, + title: this.translate.instant('Pricing.PlanChange'), + text: contentText, // html: `contentText`, icon: "warning", showCloseButton: true, @@ -261,7 +261,7 @@ export class NotifyService { // confirmButtonColor: "var(--blue-light)", focusConfirm: false, // reverseButtons: true, - }).then((result) => { + }).then((result) => { if (result.isConfirmed) { window.open(`mailto:${this.salesEmail}?subject=Upgrade plan`); } @@ -282,16 +282,16 @@ export class NotifyService { if (reason === 'seats_limit_reached') { // this.showSubtitleAllOperatorsSeatsUsed = true; // this.showSubtitleSeatsNumberExceed = false; - el.innerHTML = this.translate.instant("Pricing.YouCurrentlyAreUsingAllActiveOperatorSeats") + '. ' + this.translate.instant("Pricing.OnlyOwnerCanManageSeatsNumber") + '. ' + '
    ' + this.translate.instant("Pricing.ContactTheProjectOwner") + '.' + el.innerHTML = this.translate.instant("Pricing.YouCurrentlyAreUsingAllActiveOperatorSeats") + '. ' + this.translate.instant("Pricing.OnlyOwnerCanManageSeatsNumber") + '. ' + '
    ' + this.translate.instant("Pricing.ContactTheProjectOwner") + '.' } else if (reason === 'seats_limit_exceed') { // this.showSubtitleSeatsNumberExceed = true; // this.showSubtitleAllOperatorsSeatsUsed = false; - el.innerHTML = this.translate.instant("Pricing.TheSeatsNumberExceedsTheAllowed") + '. ' + this.translate.instant("Pricing.OnlyOwnerCanManageSeatsNumber") + '. ' + '
    ' + this.translate.instant("Pricing.ContactTheProjectOwner") + '.' + el.innerHTML = this.translate.instant("Pricing.TheSeatsNumberExceedsTheAllowed") + '. ' + this.translate.instant("Pricing.OnlyOwnerCanManageSeatsNumber") + '. ' + '
    ' + this.translate.instant("Pricing.ContactTheProjectOwner") + '.' } else if (reason === 'upgrade_plan') { // this.showSubtitleAllOperatorsSeatsUsed = false; // this.showSubtitleSeatsNumberExceed = false; - el.innerHTML = this.translate.instant("Pricing.OnlyOwnerCanManageSeatsNumber") + '. ' + '
    ' + this.translate.instant("Pricing.ContactTheProjectOwner") + '.' + el.innerHTML = this.translate.instant("Pricing.OnlyOwnerCanManageSeatsNumber") + '. ' + '
    ' + this.translate.instant("Pricing.ContactTheProjectOwner") + '.' } Swal.fire({ @@ -630,7 +630,7 @@ export class NotifyService { icon_bckgrnd_color = '#d2291c' } else if (notificationColor === 2) { icon_bckgrnd_color = '#449d48' - } else if(notificationColor === 3){ + } else if (notificationColor === 3) { icon_bckgrnd_color = '#ffecb5' } this.notify = $.notify({ @@ -888,7 +888,24 @@ export class NotifyService { // }, // dangerMode: false, }) + } + + presentModalYouDontBelongToTheProject() { + Swal.fire({ + title: this.translate.instant('AccessDenied') + '!', + text: this.translate.instant('ItLooksLikeYouAreNotTeammateOfThisProject') + '. ' + this.translate.instant('ContactTheProjectAdministratorToGrantYouTheAccess') + '.', + icon: "warning", + showCloseButton: false, + showCancelButton: false, + confirmButtonText: this.translate.instant('Ok'), + confirmButtonColor: "var(--blue-light)", + focusConfirm: true, + }).then((result) => { + if (result.isConfirmed) { + this.router.navigate(['/login']); + } + }); } presentModalOnlyOwnerCanManageTSMTPsettings(onlyOwnerCanManageSMTPSettings: string, learnMoreAboutDefaultRoles: string) { diff --git a/src/app/core/project-profile.guard.ts b/src/app/core/project-profile.guard.ts index bca030740dd9..87b99b85f028 100755 --- a/src/app/core/project-profile.guard.ts +++ b/src/app/core/project-profile.guard.ts @@ -60,10 +60,10 @@ export class ProjectProfileGuard implements CanActivate { const isActiveSubscription = project['isActiveSubscription']; const trialExpired = project['trialExpired']; - // console.log('[PROJECT-PROFILE-GUARD] (NEW WF) Plan * type * ', type); - // console.log('[PROJECT-PROFILE-GUARD] (NEW WF) Plan * planName * ', planName); - // console.log('[PROJECT-PROFILE-GUARD] (NEW WF) Plan * isActiveSubscription * ', isActiveSubscription); - // console.log('[PROJECT-PROFILE-GUARD] (NEW WF) Plan * trialExpired * ', trialExpired); + console.log('[PROJECT-PROFILE-GUARD] (NEW WF) Plan * type * ', type); + console.log('[PROJECT-PROFILE-GUARD] (NEW WF) Plan * planName * ', planName); + console.log('[PROJECT-PROFILE-GUARD] (NEW WF) Plan * isActiveSubscription * ', isActiveSubscription); + console.log('[PROJECT-PROFILE-GUARD] (NEW WF) Plan * trialExpired * ', trialExpired); if (type === 'free') { diff --git a/src/app/create-project-wizard/activate-appsumo-product/activate-appsumo-product.component.ts b/src/app/create-project-wizard/activate-appsumo-product/activate-appsumo-product.component.ts index e078bb547c1b..d96903cf4738 100644 --- a/src/app/create-project-wizard/activate-appsumo-product/activate-appsumo-product.component.ts +++ b/src/app/create-project-wizard/activate-appsumo-product/activate-appsumo-product.component.ts @@ -11,6 +11,7 @@ import { WidgetSetUpBaseComponent } from 'app/widget_components/widget-set-up/wi import { WidgetService } from 'app/services/widget.service'; import { NotifyService } from 'app/core/notify.service'; import { UsersService } from 'app/services/users.service'; +import { ProjectUser } from 'app/models/project-user'; const swal = require('sweetalert'); @Component({ @@ -92,11 +93,10 @@ export class ActivateAppsumoProductComponent extends WidgetSetUpBaseComponent im } getProjectUserRole() { - this.usersService.project_user_role_bs - .subscribe((user_role) => { + this.usersService.projectUser_bs.subscribe((projectUser: ProjectUser) => { // this.logger.log('[ACTIVATE-APPSUMO-PRODUCT] - USER ROLE ', user_role); - if (user_role) { - this.USER_ROLE = user_role + if (projectUser) { + this.USER_ROLE = projectUser.role } }); } diff --git a/src/app/create-project-wizard/get-start-chatbot-fork/get-start-chatbot-fork.component.ts b/src/app/create-project-wizard/get-start-chatbot-fork/get-start-chatbot-fork.component.ts index 30fc80422900..65e1e4f3d9fc 100644 --- a/src/app/create-project-wizard/get-start-chatbot-fork/get-start-chatbot-fork.component.ts +++ b/src/app/create-project-wizard/get-start-chatbot-fork/get-start-chatbot-fork.component.ts @@ -18,6 +18,7 @@ import { ChatbotModalComponent } from 'app/bots/bots-list/chatbot-modal/chatbot- import { MatDialog } from '@angular/material/dialog'; import { TranslateService } from '@ngx-translate/core'; import { CacheService } from 'app/services/cache.service'; +import { ProjectUser } from 'app/models/project-user'; const swal = require('sweetalert'); const Swal = require('sweetalert2') @@ -113,12 +114,12 @@ export class GetStartChatbotForkComponent implements OnInit { } getUserRole() { - this.usersService.project_user_role_bs - .subscribe((userRole) => { - - this.logger.log('[GET START CHATBOT FORK] - SUBSCRIPTION TO USER ROLE »»» ', userRole) - this.USER_ROLE = userRole; - }) + this.usersService.projectUser_bs.subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.logger.log('[GET START CHATBOT FORK] - SUBSCRIPTION TO USER ROLE »»» ', projectUser) + this.USER_ROLE = projectUser.role; + } + }) } // getCurrentProject() { diff --git a/src/app/create-project-wizard/install-template/install-template.component.ts b/src/app/create-project-wizard/install-template/install-template.component.ts index 2e4ed7045e0d..d46908facbfe 100644 --- a/src/app/create-project-wizard/install-template/install-template.component.ts +++ b/src/app/create-project-wizard/install-template/install-template.component.ts @@ -22,6 +22,7 @@ import { ProjectPlanService } from 'app/services/project-plan.service'; import { UsersService } from 'app/services/users.service'; import { NotifyService } from 'app/core/notify.service'; import { ChatbotModalComponent } from 'app/bots/bots-list/chatbot-modal/chatbot-modal.component'; +import { ProjectUser } from 'app/models/project-user'; @Component({ selector: 'appdashboard-install-template', templateUrl: './install-template.component.html', @@ -136,12 +137,12 @@ export class InstallTemplateComponent extends PricingBaseComponent implements On } getUserRole() { - this.usersService.project_user_role_bs - .subscribe((userRole) => { - - this.logger.log('[INSTALL-TEMPLATE] - SUBSCRIPTION TO USER ROLE »»» ', userRole) - this.USER_ROLE = userRole; - }) + this.usersService.projectUser_bs.subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.logger.log('[INSTALL-TEMPLATE] - SUBSCRIPTION TO USER ROLE »»» ', projectUser) + this.USER_ROLE = projectUser.role; + } + }) } getParamsTemplatesAndProjects() { diff --git a/src/app/department-edit-add/department-edit-add.component.ts b/src/app/department-edit-add/department-edit-add.component.ts index 516c8bcbe6d5..a8c77c1a479d 100755 --- a/src/app/department-edit-add/department-edit-add.component.ts +++ b/src/app/department-edit-add/department-edit-add.component.ts @@ -22,6 +22,7 @@ import { takeUntil } from 'rxjs/operators' import { FaqKb } from 'app/models/faq_kb-model'; import { ProjectPlanService } from 'app/services/project-plan.service'; import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.component'; +import { ProjectUser } from 'app/models/project-user'; import { RoleService } from 'app/services/role.service'; declare const $: any; const swal = require('sweetalert'); @@ -426,16 +427,13 @@ export class DepartmentEditAddComponent extends PricingBaseComponent implements getUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((userRole) => { - - this.logger.log('[DEPT-EDIT-ADD] - SUBSCRIPTION TO USER ROLE »»» ', userRole) + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.logger.log('[DEPT-EDIT-ADD] - SUBSCRIPTION TO USER ROLE »»» ', projectUser) // used to display / hide 'WIDGET' and 'ANALITCS' in home.component.html - this.USER_ROLE = userRole; - }) + this.USER_ROLE = projectUser.role; + } + }) } getBrowserVersion() { @@ -1365,12 +1363,12 @@ export class DepartmentEditAddComponent extends PricingBaseComponent implements getProjectuserbyUseridAndGoToEditProjectuser(member_id: string) { - this.usersService.getProjectUserByUserId(member_id).subscribe((projectUser: any) => { + this.usersService.getProjectUserByUserId(member_id).subscribe((projectUser: ProjectUser) => { this.logger.log('[DEPT-EDIT-ADD] GET projectUser by USER-ID ', projectUser) if (projectUser) { - this.logger.log('[DEPT-EDIT-ADD] - GET projectUser by USER-ID > projectUser id', projectUser[0]._id); + this.logger.log('[DEPT-EDIT-ADD] - GET projectUser by USER-ID > projectUser id', projectUser._id); - this.router.navigate(['project/' + this.project._id + '/user/edit/' + projectUser[0]._id]); + this.router.navigate(['project/' + this.project._id + '/user/edit/' + projectUser._id]); } }, (error) => { this.logger.error('[DEPT-EDIT-ADD] GET projectUser by USER-ID - ERROR ', error); diff --git a/src/app/home-components/home-analytics-indicator/home-analytics-indicator.component.ts b/src/app/home-components/home-analytics-indicator/home-analytics-indicator.component.ts index b1f59774cd6c..6f8b89684633 100644 --- a/src/app/home-components/home-analytics-indicator/home-analytics-indicator.component.ts +++ b/src/app/home-components/home-analytics-indicator/home-analytics-indicator.component.ts @@ -9,6 +9,7 @@ import { ContactsService } from 'app/services/contacts.service'; import { LoggerService } from 'app/services/logger/logger.service'; import { AppConfigService } from 'app/services/app-config.service'; import { AnalyticsService } from 'app/services/analytics.service'; +import { ProjectUser } from 'app/models/project-user'; @Component({ selector: 'appdashboard-home-analytics-indicator', templateUrl: './home-analytics-indicator.component.html', @@ -97,13 +98,11 @@ export class HomeAnalyticsIndicatorComponent implements OnInit { getUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((userRole) => { - this.USER_ROLE = userRole; - }) + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.USER_ROLE = projectUser.role; + } + }) } getActiveContactsCount() { diff --git a/src/app/home-components/home-cds/home-cds.component.ts b/src/app/home-components/home-cds/home-cds.component.ts index 821f0b318ca7..76233e0b0142 100644 --- a/src/app/home-components/home-cds/home-cds.component.ts +++ b/src/app/home-components/home-cds/home-cds.component.ts @@ -8,6 +8,7 @@ import { NotifyService } from 'app/core/notify.service'; import { ModalChatbotNameComponent } from 'app/knowledge-bases/modals/modal-chatbot-name/modal-chatbot-name.component'; import { ModalHookBotComponent } from 'app/knowledge-bases/modals/modal-hook-bot/modal-hook-bot.component'; import { Chatbot } from 'app/models/faq_kb-model'; +import { ProjectUser } from 'app/models/project-user'; import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.component'; import { AppConfigService } from 'app/services/app-config.service'; import { DepartmentService } from 'app/services/department.service'; @@ -225,14 +226,12 @@ export class HomeCdsComponent extends PricingBaseComponent implements OnInit, On getUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((userRole) => { - this.logger.log('[HOME-CDS] - SUBSCRIPTION TO USER ROLE »»» ', userRole) - this.USER_ROLE = userRole; - }) + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.logger.log('[HOME-CDS] - SUBSCRIPTION TO USER ROLE »»» ', projectUser) + this.USER_ROLE = projectUser.role; + } + }) } diff --git a/src/app/home-components/home-convs-graph/home-convs-graph.component.ts b/src/app/home-components/home-convs-graph/home-convs-graph.component.ts index 0de0af3adc3a..6d2ffd564923 100644 --- a/src/app/home-components/home-convs-graph/home-convs-graph.component.ts +++ b/src/app/home-components/home-convs-graph/home-convs-graph.component.ts @@ -13,6 +13,8 @@ import { LoggerService } from 'app/services/logger/logger.service'; import { AppConfigService } from 'app/services/app-config.service'; import { AnalyticsService } from 'app/services/analytics.service'; import { forkJoin } from 'rxjs'; +import { ProjectUser } from 'app/models/project-user'; + @Component({ selector: 'appdashboard-home-convs-graph', templateUrl: './home-convs-graph.component.html', @@ -233,13 +235,11 @@ export class HomeConvsGraphComponent implements OnInit, OnChanges { getUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((userRole) => { - this.USER_ROLE = userRole; - }) + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.USER_ROLE = projectUser.role; + } + }) } getMonthsName() { diff --git a/src/app/home-components/home-create-chatbot/home-create-chatbot.component.ts b/src/app/home-components/home-create-chatbot/home-create-chatbot.component.ts index 8ea5b8f2eed8..45ec7484b382 100644 --- a/src/app/home-components/home-create-chatbot/home-create-chatbot.component.ts +++ b/src/app/home-components/home-create-chatbot/home-create-chatbot.component.ts @@ -21,6 +21,7 @@ import { NotifyService } from 'app/core/notify.service'; import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.component'; import { TranslateService } from '@ngx-translate/core'; import { BrandService } from 'app/services/brand.service'; +import { ProjectUser } from 'app/models/project-user'; @Component({ selector: 'appdashboard-home-create-chatbot', @@ -258,15 +259,12 @@ export class HomeCreateChatbotComponent extends PricingBaseComponent implements getUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((userRole) => { - - this.logger.log('[HOME-CREATE-CHATBOT] - SUBSCRIPTION TO USER ROLE »»» ', userRole) - this.USER_ROLE = userRole; - }) + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.logger.log('[HOME-CREATE-CHATBOT] - SUBSCRIPTION TO USER ROLE »»» ', projectUser) + this.USER_ROLE = projectUser.role; + } + }) } getCurrentProjectAndPrjctBots() { diff --git a/src/app/home-components/home-create-teammate/home-create-teammate.component.ts b/src/app/home-components/home-create-teammate/home-create-teammate.component.ts index 7a7602480153..9149d7e1e6a1 100644 --- a/src/app/home-components/home-create-teammate/home-create-teammate.component.ts +++ b/src/app/home-components/home-create-teammate/home-create-teammate.component.ts @@ -16,6 +16,7 @@ import { HomeInviteTeammateErrorModalComponent } from './home-invite-teammate-er import { TranslateService } from '@ngx-translate/core'; import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.component'; import { BrandService } from 'app/services/brand.service'; +import { ProjectUser } from 'app/models/project-user'; @Component({ selector: 'appdashboard-home-create-teammate', @@ -172,15 +173,12 @@ export class HomeCreateTeammateComponent extends PricingBaseComponent implements getUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((userRole) => { - - this.logger.log('[HOME-CREATE-TEAMMATE] - SUBSCRIPTION TO USER ROLE »»» ', userRole) - this.USER_ROLE = userRole; - }) + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.logger.log('[HOME-CREATE-TEAMMATE] - SUBSCRIPTION TO USER ROLE »»» ', projectUser) + this.USER_ROLE = projectUser.role; + } + }) } getLoggedUser() { @@ -586,12 +584,12 @@ export class HomeCreateTeammateComponent extends PricingBaseComponent implements getProjectuserbyUseridAndGoToEditProjectuser(member_id: string) { this.usersService.getProjectUserByUserId(member_id) - .subscribe((projectUser: any) => { + .subscribe((projectUser: ProjectUser) => { this.logger.log('[HOME-CREATE-TEAMMATE] - GET projectUser by USER-ID ', projectUser) if (projectUser) { - this.logger.log('[HOME-CREATE-TEAMMATE] - GET projectUser > projectUser id', projectUser[0]._id); + this.logger.log('[HOME-CREATE-TEAMMATE] - GET projectUser > projectUser id', projectUser._id); - this.router.navigate(['project/' + this.projectId + '/user/edit/' + projectUser[0]._id]); + this.router.navigate(['project/' + this.projectId + '/user/edit/' + projectUser._id]); } }, (error) => { this.logger.error('[HOME-CREATE-TEAMMATE] - GET projectUser by USER-ID - ERROR ', error); diff --git a/src/app/home-components/home-kb/home-kb.component.ts b/src/app/home-components/home-kb/home-kb.component.ts index dca5224e56b6..cac66ea59889 100644 --- a/src/app/home-components/home-kb/home-kb.component.ts +++ b/src/app/home-components/home-kb/home-kb.component.ts @@ -22,6 +22,7 @@ import { FaqService } from 'app/services/faq.service'; import { ModalHookBotComponent } from 'app/knowledge-bases/modals/modal-hook-bot/modal-hook-bot.component'; import { DepartmentService } from 'app/services/department.service'; import { ModalChatbotNameComponent } from 'app/knowledge-bases/modals/modal-chatbot-name/modal-chatbot-name.component'; +import { ProjectUser } from 'app/models/project-user'; const Swal = require('sweetalert2') @Component({ selector: 'appdashboard-home-kb', @@ -100,14 +101,12 @@ export class HomeKbComponent extends PricingBaseComponent implements OnInit { getUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((userRole) => { - this.logger.log('[HOME-KB] - SUBSCRIPTION TO USER ROLE »»» ', userRole) - this.USER_ROLE = userRole; - }) + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.logger.log('[HOME-KB] - SUBSCRIPTION TO USER ROLE »»» ', projectUser) + this.USER_ROLE = projectUser.role; + } + }) } getCurrentProject() { diff --git a/src/app/home-components/home-whatsapp-account/home-whatsapp-account.component.ts b/src/app/home-components/home-whatsapp-account/home-whatsapp-account.component.ts index 1853ff3bccce..c388adb56d85 100644 --- a/src/app/home-components/home-whatsapp-account/home-whatsapp-account.component.ts +++ b/src/app/home-components/home-whatsapp-account/home-whatsapp-account.component.ts @@ -13,6 +13,7 @@ import { Subscription } from 'rxjs'; import { takeUntil } from 'rxjs/operators' import { Subject } from 'rxjs'; import { ProjectService } from 'app/services/project.service'; +import { ProjectUser } from 'app/models/project-user'; const swal = require('sweetalert'); const Swal = require('sweetalert2') @@ -134,16 +135,14 @@ export class HomeWhatsappAccountComponent implements OnInit, OnChanges { } getProjectUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.logger.log('[HOME-WA] - GET PROJECT-USER ROLE ', user_role); - if (user_role) { - this.USER_ROLE = user_role; + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.logger.log('[HOME-WA] - GET PROJECT-USER ROLE ', projectUser); + if (projectUser.role) { + this.USER_ROLE = projectUser.role; } - }); + } + }); } translateLabels() { diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index f1cc3179b7a7..09d920021e0d 100755 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -248,7 +248,7 @@
    + [ngClass]="{'home-quota-banner-alert': conversationsRunnedOut || emailsRunnedOut || tokensRunnedOut || voiceRunnedOut }"> + + +
    + +
    +

    + {{'Voice' | translate}} +

    +
    {{voice_count_min_sec}} / {{voice_limit | number:'1.0-0'}}m
    +
    + You run out of voice +
    +
    + +
    + + + +
    + {{ voice_perc }} + % +
    +
    +
    +
    - @@ -70,17 +68,16 @@

    {{ 'KbPage.titleUrls' | t - + {{ tag }} - @@ -101,10 +98,10 @@

    {{ 'KbPage.titleUrls' | t cancel - @@ -113,40 +110,83 @@

    {{ 'KbPage.titleUrls' | t - +
    {{ 'KbPage.titleTextareaUrls' | translate }} + placeholder="{{'KbPage.placeholderUrls' | translate}}" (input)="onChangeInput($event)" + rows="4"> - {{ - 'KbPage.YouCanAddKBUrlsLimit' | translate }} {{KB_LIMIT_CONTENT}} + + {{'KbPage.YouCanAddKBUrlsLimit' | translate }} {{KB_LIMIT_CONTENT}} + {{ 'KbPage.InfoSitemapList' | translate }} - {{KB_LIMIT_CONTENT}} + {{KB_LIMIT_CONTENT}} +
    - + + + + +
    +
    + + + {{'KbPage.RefreshRate' | translate}} + -
    - - - -
    + + + + + {{'KbPage.URLsSyncFrequency' | translate}} + +
    + + +
    + + +
    +
    +
    + + + +
    \ No newline at end of file diff --git a/src/app/knowledge-bases/modals/modal-urls-knowledge-base/modal-urls-knowledge-base.component.scss b/src/app/knowledge-bases/modals/modal-urls-knowledge-base/modal-urls-knowledge-base.component.scss index 69bde6b44692..a95cecd7b5c2 100644 --- a/src/app/knowledge-bases/modals/modal-urls-knowledge-base/modal-urls-knowledge-base.component.scss +++ b/src/app/knowledge-bases/modals/modal-urls-knowledge-base/modal-urls-knowledge-base.component.scss @@ -237,15 +237,14 @@ .input-label { - font-family: 'Poppins'; + font-family: var(--header-font-family); font-weight: 400; font-size: 13px; - font-weight: normal; padding-bottom: 0; } -.textarea-label { - font-family: 'Poppins'; +.input-label-on-bottom { + font-family: var(--header-font-family); font-weight: 400; font-size: 14px; font-weight: normal; @@ -359,4 +358,40 @@ mat-expansion-panel ::ng-deep { ::ng-deep.custom--expansion-panel { padding: 0px 10px; +} + +.refresh-rate-wpr { + display: flex; + flex-direction: row; + align-items: center; + // justify-content: space-between; + margin-bottom: 14px; + gap: 24px +} + + +.btn--get-feature-no-boxshadow { + margin-top: 0px; + font-size: 12px; + letter-spacing: 1px; + background: transparent; + border: 1px solid #d1d9e0; + color: var(--btn-get-feature-color); + font-weight: 400; + box-shadow: unset !important; + text-transform: none !important; + padding: 6px 15px !important; + border-radius: var(--btn-border-radius) +} + +.btn--get-feature-no-boxshadow:hover { + background-color: #eff2f6; + border: 1px solid #acb8cb; + color: #333; +} + +.get--feature-upgrade-plan-icon { + vertical-align: middle; + color: var(--btn-get-feature-color); + font-size: 21px; } \ No newline at end of file diff --git a/src/app/knowledge-bases/modals/modal-urls-knowledge-base/modal-urls-knowledge-base.component.ts b/src/app/knowledge-bases/modals/modal-urls-knowledge-base/modal-urls-knowledge-base.component.ts index 1dc24ed21a69..b4453f9f6f27 100644 --- a/src/app/knowledge-bases/modals/modal-urls-knowledge-base/modal-urls-knowledge-base.component.ts +++ b/src/app/knowledge-bases/modals/modal-urls-knowledge-base/modal-urls-knowledge-base.component.ts @@ -6,6 +6,7 @@ import { COMMA, ENTER } from '@angular/cdk/keycodes'; import { MatChipInputEvent } from '@angular/material/chips'; import { LoggerService } from 'app/services/logger/logger.service'; + @Component({ selector: 'modal-urls-knowledge-base', templateUrl: './modal-urls-knowledge-base.component.html', @@ -31,17 +32,41 @@ export class ModalUrlsKnowledgeBaseComponent implements OnInit { // { name: "Headless (Text Only)", value: 3 }, { name: "Advanced", value: 4 }, ]; - + selectedScrapeType = 2; extract_tags = []; unwanted_tags = []; unwanted_classnames = []; + // --------------------- + // Refressh rate + // --------------------- + refresh_rate: Array = [ + { name: "Never", value: 'never' }, + { name: "Daily", value: 'daily' }, + { name: "Weekly", value: 'weekly' }, + { name: "Monthly", value: 'monthly'} + ] + + // selectedRefreshRate = 0; + selectedRefreshRate: any; + isAvailableRefreshRateFeature: boolean; + t_params: any; + constructor( @Inject(MAT_DIALOG_DATA) public data: any, public dialogRef: MatDialogRef, - private logger: LoggerService - ) { } + private logger: LoggerService, + ) { + this.selectedRefreshRate = this.refresh_rate[0].value; + this.logger.log("[MODALS-URLS] data: ", data); + if (data ) { + this.isAvailableRefreshRateFeature = data.isAvailableRefreshRateFeature + this.t_params = data.t_params + this.logger.log("[MODALS-URLS] data > t_params: ", this.t_params); + this.logger.log("[MODALS-URLS] data > isAvailableRefreshRateFeature: ", this.isAvailableRefreshRateFeature); + } + } /** */ ngOnInit(): void { @@ -75,6 +100,12 @@ export class ModalUrlsKnowledgeBaseComponent implements OnInit { this.countSitemap = listSitesOfSitemap.length; } + + + onSelectRefreshRate(refreshRateSelected) { + this.logger.log("[MODALS-URLS] onSelectRefreshRate: ", refreshRateSelected); + } + /** */ onSaveKnowledgeBase(){ //const arrayURLS = this.content.split('\n'); @@ -84,6 +115,7 @@ export class ModalUrlsKnowledgeBaseComponent implements OnInit { let body: any = { list: arrayURLS, scrape_type: this.selectedScrapeType, + refresh_rate: this.selectedRefreshRate } if (this.selectedScrapeType === 4) { @@ -148,6 +180,12 @@ export class ModalUrlsKnowledgeBaseComponent implements OnInit { } + goToPricing() { + // this.onCloseBaseModal() + let body: any = { upgrade_plan: true} + this.dialogRef.close(body); + } + /** */ onCloseBaseModal() { this.countSitemap = 0; diff --git a/src/app/models/project-user.ts b/src/app/models/project-user.ts index 0da119226c69..6995e4399e83 100755 --- a/src/app/models/project-user.ts +++ b/src/app/models/project-user.ts @@ -4,6 +4,7 @@ export interface ProjectUser { createdAt?: any; id_project?: string; user_available?: boolean; + profileStatus?: string; role?: string; createdBy?: string; is_group_member?: boolean; diff --git a/src/app/pricing/pricing-base/pricing-base.component.ts b/src/app/pricing/pricing-base/pricing-base.component.ts index c924c9dfa32a..e7c90eb73b45 100644 --- a/src/app/pricing/pricing-base/pricing-base.component.ts +++ b/src/app/pricing/pricing-base/pricing-base.component.ts @@ -15,6 +15,7 @@ import { APPSUMO_PLAN_SEATS, APP_SUMO_PLAN_NAME, CHATBOT_MAX_NUM, KB_MAX_NUM, PL styles: [ ] }) + export class PricingBaseComponent implements OnInit { PLAN_NAME = PLAN_NAME; PLAN_SEATS = PLAN_SEATS; diff --git a/src/app/pricing/pricing.component.html b/src/app/pricing/pricing.component.html index 3377a0cab073..8c58eb921ca4 100755 --- a/src/app/pricing/pricing.component.html +++ b/src/app/pricing/pricing.component.html @@ -2,7 +2,7 @@
    + min-height: calc(100% - 53px);margin-top: 0px; padding: 0px" *ngIf="!CHAT_PANEL_MODE"> +
    + {{ 'TrialExpirationDate' | translate: {expiration_date: trialExpirationDate} }} +
    + + +
    - -
    @@ -398,6 +396,8 @@

    + + @@ -406,6 +406,80 @@

    +
    +
    +
    +
    +
    +
    + +
    +
    + + + + + + + +
    +
    + +
    +
    + + + {{'Pricing.YourTrialHasEnded' | translate}} +
    +
    +
    +
    + + {{ 'TrialExpirationDate' | translate: {expiration_date: trialExpirationDate} }}. + + {{'Pricing.ContactTheProjectOwner' | translate}}. + +
    +
    +
    +
    + +
    + {{'GoToYourProjects' | translate}} +
    +
    +
    + +
    +
    + +
    + {{ 'Pricing.UpgradePlan' | translate }} +
    +
    + {{ 'ContactUs' | translate }} +
    +
    +
    +
    +
    +
    +
    +
    + + + diff --git a/src/app/pricing/pricing.component.scss b/src/app/pricing/pricing.component.scss index e8caed18ae87..a7565cf93c61 100755 --- a/src/app/pricing/pricing.component.scss +++ b/src/app/pricing/pricing.component.scss @@ -485,7 +485,7 @@ li:before { -webkit-box-align: center; gap: 0px; align-items: flex-start; - margin-top: 40px; + margin-top: 11px; min-height: 78px; } @@ -512,7 +512,7 @@ li:before { .pricing-page-header-title-text { -webkit-box-flex: 1; flex-grow: 1; - font-family: "Poppins", "Roboto", "Arial", sans-serif; + font-family: var(--header-font-family); } .pricing-page-header-period-switch-wpr { @@ -562,7 +562,7 @@ li:before { font-weight: 500; cursor: pointer; background-color: rgb(255, 255, 255); - color: rgb(5, 102, 255); + color: var(--blue-20); box-shadow: rgb(0 27 71 / 8%) 0px 3px 8px; } @@ -613,9 +613,9 @@ li:before { font-weight: 500; cursor: pointer; background-color: rgb(255, 255, 255); - color: rgb(5, 102, 255); + color: var(--blue-20); box-shadow: rgb(0 27 71 / 8%) 0px 3px 8px; - font-family: Poppins, Roboto, Arial, sans-serif; + font-family: var(--header-font-family); } .span-24 { @@ -636,7 +636,7 @@ li:before { align-items: stretch; -webkit-box-pack: justify; justify-content: space-between; - border-radius: 8px; + border-radius: var(--card-border-radius); border: 2px solid rgb(239, 242, 246); gap: 40px; } @@ -653,7 +653,7 @@ li:before { line-height: 31px; letter-spacing: -0.01em; color: rgb(8, 15, 26); - font-family: "Poppins", "Roboto", "Arial", sans-serif; + font-family: var(--header-font-family); } .span-8 { @@ -835,7 +835,7 @@ li:before { text-transform: unset; font-weight: 400; box-shadow: unset; - font-family: "Poppins", "Roboto", "Arial", sans-serif; + font-family: var(--header-font-family); } .btn-new { @@ -910,5 +910,572 @@ li:before { font-weight: 400; /* text-align: center; */ font-size: 16px; - font-family: Poppins, Roboto, Arial, sans-serif; -} \ No newline at end of file + font-family: var(--header-font-family); +} + + +.trial-has-expired-date { + margin-bottom: 18px; + margin-top: -28px; + padding: 12px 20px; + background-color: rgb(255, 204, 207); + color: rgb(183, 57, 74); + width: 100%; + text-align: center; + border-radius: var(--card-border-radius); + font-weight: 400; + font-family: var(--header-font-family); +} + +/* new +/* -------------------------------------------------- */ + +.pricing-cards-container { + display: grid; + place-items: center; + background-color: rgb(255, 255, 255); + padding-top: 40px; + padding: 32px 40px; +} + +.pricing-cards-wpr { + width: max-content; + max-width: none; + display: grid; + gap: 0px 12px; + grid-auto-flow: row; + // grid-template-columns: 238px 238px 238px 238px; + grid-template-columns: 280px 280px 280px 280px; + padding: 0px; +} + +.pricing-card-wpr { + // display: contents; + border: 2px solid rgb(239, 242, 246); + padding: 0 20px 12px; + border-radius: 12px; + background-color: rgb(255, 255, 255); +} + + +// .css-rhox5h +.pricing-card-plan-name-container { + background-color: rgb(255, 255, 255); + padding-top: 30px; + // padding: 30px 20px 2px; + // border-left: 2px solid rgb(239, 242, 246); + // border-right: 2px solid rgb(239, 242, 246); + text-align: center; + -webkit-box-align: center; + align-items: center; + display: flex; + flex-direction: column; + -webkit-box-pack: center; + justify-content: center; + order: 1001; + // border-radius: 12px 12px 0px 0px; + // border-top: 2px solid rgb(239, 242, 246); + position: relative; +} + +// .css-1gcxp0x +.pricing-card-plan-name-wpr { + display: flex; + flex-direction: row; + -webkit-box-pack: start; + justify-content: flex-start; + -webkit-box-align: center; + align-items: center; +} + +.pricing-card-plan-name { + margin-top: 0px; + margin-bottom: 0px; + font-weight: 500; + font-size: 20px; + line-height: 26px; + letter-spacing: -0.01em; +} + +// css-e7fjbw +.pricing-card-plan-description-wpr { + padding: 16px 0px 21px 0px; + // background-color: rgb(255, 255, 255); + // padding: 0px 20px 16px; + // border-left: 2px solid rgb(239, 242, 246); + // border-right: 2px solid rgb(239, 242, 246); + text-align: center; + -webkit-box-align: center; + align-items: center; + display: flex; + flex-direction: column; + -webkit-box-pack: center; + justify-content: center; + order: 2001; +} + +// css-1insqna +.pricing-card-plan-description { + margin-top: 0px; + margin-bottom: 0px; + font-weight: 400; + font-size: 12px; + line-height: 16px; +} + +.pricing-card-spacer { + // background-color: rgb(255, 255, 255); + // padding: 0px 20px; + // border-left: 2px solid rgb(239, 242, 246); + // border-right: 2px solid rgb(239, 242, 246); + text-align: center; + -webkit-box-align: center; + align-items: center; + display: flex; + flex-direction: column; + -webkit-box-pack: end; + justify-content: flex-end; + order: 3001; +} + +.pricing-card-plan-price-container { + // background-color: rgb(255, 255, 255); + // padding: 0px 20px 16px; + // border-left: 2px solid rgb(239, 242, 246); + // border-right: 2px solid rgb(239, 242, 246); + text-align: center; + -webkit-box-align: center; + align-items: center; + display: flex; + flex-direction: column; + -webkit-box-pack: center; + justify-content: center; + order: 4001; +} + +// css-l89afa +.pricing-card-plan-price { + height: auto; + position: relative; + font-size: 40px; + line-height: 52px; + letter-spacing: -0.02em; + color: rgb(8, 15, 26); + font-weight: 500; +} + +.pricing-card-plan-price .currency { + position: absolute; + top: 7px; + margin-left: 8px; + font-size: 14px; + line-height: 18px; + letter-spacing: -0.01em; + font-weight: 500; +} + +// css-hu8sar +.pricing-card-plan-price-period { + font-size: 14px; + line-height: 18px; + letter-spacing: -0.01em; + color: rgb(8, 15, 26); + font-weight: 500; + margin-left: 8px; +} + +// css-18k7bez +.pricing-card-plan-price-annually-billed { + margin-top: 0px; + margin-bottom: 0px; + font-weight: 400; + font-size: 12px; + line-height: 16px; + letter-spacing: -0.01em; + color: rgb(100, 116, 145); + text-align: center; +} + +// css-1ps4l9y +.pricing-card-btn-container { + // background-color: rgb(255, 255, 255); + // padding: 0px 20px 24px; + // border-left: 2px solid rgb(239, 242, 246); + // border-right: 2px solid rgb(239, 242, 246); + text-align: center; + -webkit-box-align: center; + align-items: center; + display: flex; + flex-direction: column; + -webkit-box-pack: center; + justify-content: center; + order: 6001; + padding-bottom: 24px; + padding-top: 8px; +} + +// css-86twz3 +.pricing-card-brn-wpr { + display: flex; + -webkit-box-align: center; + align-items: center; + -webkit-box-flex: 1; + flex-grow: 1; + width: 100%; + justify-content: center; +} + +// css-xcqs6d +.pricing-card-feature-cointainer { + // background-color: rgb(255, 255, 255); + // padding: 0px 20px 12px; + // border-left: 2px solid rgb(239, 242, 246); + // border-right: 2px solid rgb(239, 242, 246); + padding-bottom: 12px; + text-align: center; + -webkit-box-align: center; + display: flex; + flex-direction: column; + -webkit-box-pack: center; + justify-content: center; + align-items: flex-start; + order: 8001; +} + +// css-u49bkm +.pricing-card-feature-wpr { + display: flex; + flex-direction: row; + -webkit-box-pack: start; + justify-content: flex-start; + -webkit-box-align: center; + align-items: center; +} + +// css-3jo2zp +.pricing-card-feature-ckeck-icon-wpr { + width: 20px; + height: 20px; + display: flex; + border-radius: 50%; + -webkit-box-align: center; + align-items: center; + -webkit-box-pack: center; + justify-content: center; + background-color: rgb(220, 233, 255); + flex-shrink: 0; +} + +// css-zbzjbd +.pricing-card-feature-ckeck-icon { + fill: rgb(5, 102, 255); + color: rgb(5, 102, 255); +} + +// css-1nrqn2o + +.pricing-card-feature { + margin-top: 0px; + margin-bottom: 0px; + font-weight: 400; + font-size: 12px; + line-height: 16px; + letter-spacing: -0.01em; + text-align: left; +} + +// css-12d1nl4 +.most-popular-badge-container { + position: absolute; + top: -14px; + left: 50%; + transform: translateX(-50%); + text-transform: uppercase; + white-space: nowrap; +} + +// css-7ap2wb +.most-popular-badge-wpr { + display: flex; + flex-direction: row; + -webkit-box-pack: start; + justify-content: flex-start; + -webkit-box-align: center; + align-items: center; + padding: 4px 8px; + border-radius: 4px; + gap: 4px; + background-color: rgb(204, 241, 213); +} + +// css-lavrgf +.most-popular-badge { + width: 12px; + height: 12px; + border-radius: 6px; + background-color: rgb(52, 184, 87); + display: flex; + -webkit-box-pack: center; + justify-content: center; + -webkit-box-align: center; + align-items: center; +} + +.most-popular-badge svg { + width: 10px; + height: 10px; + fill: rgb(255, 255, 255); + color: rgb(255, 255, 255); +} + +// css-156q7kr +.most-popular-badge-text { + margin-top: 0px; + margin-bottom: 0px; + font-weight: 500; + font-size: 12px; + line-height: 16px; + letter-spacing: -0.01em; + color: rgb(13, 45, 22); +} + +// Above the card +.most-popular-badge--container { + position: absolute; + top: -39px; + left: 50%; + transform: translate(-50%); + text-transform: uppercase; + white-space: nowrap; + width: 280px; + text-align: center; + border: 2px solid rgb(239, 242, 246); + border-bottom: unset; + border-top-left-radius: 12px; + border-top-right-radius: 12px; +} + +// css-7ap2wb +.most-popular-badge--wpr { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + padding: 10px 8px; + /* border-radius: 12px; */ + gap: 4px; + // background-color: #ccf1d5; + background-color: var(--blue-20); + border-top-left-radius: 10px; + border-top-right-radius: 10px; +} + +.most-popular--badge { + width: 12px; + height: 12px; + border-radius: 6px; + // background-color: rgb(52, 184, 87); + // background-color: var(--blue-20); + display: flex; + -webkit-box-pack: center; + justify-content: center; + -webkit-box-align: center; + align-items: center; +} + +.most-popular--badge svg { + width: 10px; + height: 10px; + fill: rgb(255, 255, 255); + color: rgb(255, 255, 255); +} + +// css-156q7kr +.most-popular-badge--text { + margin-top: 0px; + margin-bottom: 0px; + font-weight: 500; + font-size: 14px; + line-height: 16px; + letter-spacing: -0.01em; + color: rgb(13, 45, 22); + color: #fff; +} + + +.pricing-card-starts-at-wpr { + // padding: 0px 20px; + padding-left: 20px; + padding-right: 20px; + // padding-top: 8px; + // border-left: 2px solid rgb(239, 242, 246); + // border-right: 2px solid rgb(239, 242, 246); + text-align: center; + -webkit-box-align: center; + align-items: center; + display: flex; + flex-direction: column; + -webkit-box-pack: end; + justify-content: flex-end; + // background-color: rgb(28, 43, 69); + // color: rgb(255, 255, 255); +} + +.pricing-card-starts-at-wpr>p { + margin-top: 0px; + margin-bottom: 0px; + font-weight: 400; + font-size: 12px; + line-height: 16px; + letter-spacing: -0.01em; + color: rgb(100, 116, 145); +} + +/* +/* When the pricing plan is displayed in the iframe +/* *************************************************** */ + +.unauthorized-to-upgrade-container { + padding: 16px; + height: 100vh; + width: 100vw; +} + + +.unauthorized-to-upgrade-main{ + height: 100%; + width: 100%; + padding-bottom: 30px; + overflow-y: auto; +} + +.unauthorized-to-upgrade-spacing { + flex: 3 1 0%; + text-align: center; + min-height: 45px; +} + +.unauthorized-to-upgrade-content-wpr { + display: flex; + -webkit-box-align: center; + align-items: center; + -webkit-box-pack: center; + justify-content: center; +} + + +.unauthorized-to-upgrade-content { + padding-top: 25vh; +} + +.unauthorized-to-upgrade-inner-content { + display: flex; + -webkit-box-align: center; + align-items: center; + flex-direction: column; + -webkit-box-pack: center; + justify-content: center; +} + +.unauthorized-to-upgrade-logo-container { + border-radius: 50%; + // min-height: 82px; + // min-width: 82px; + min-height: 60px; + min-width: 60px; + // box-shadow: rgba(17, 49, 96, 0.16) 0px 8px 16px 0px, rgba(17, 49, 96, 0.06) 0px 0px 0px 1px; + /* background-image: linear-gradient(rgba(19, 33, 68, 0.85), rgb(19, 33, 68)); */ + margin-bottom: 51px; + margin-top: -80px; +} + +.unauthorized-to-upgrade-logo-svg-wpr { + transition: opacity 0.15s ease 0s, background 0.15s ease 0s, color 0.15s ease 0s, transform 0.15s ease 0s; + box-sizing: content-box; + // width: 82px; + // height: 82px; + width: 60px; + height: 60px; + color: rgb(255, 255, 255); + // background: transparent; + background: rgba(183, 57, 74, .2); + border-radius: 9999px; + display: flex; + justify-content: center; + align-content: center; + flex-wrap: wrap; +} + + +.unauthorized-to-upgrade-title-wpr { + color: var(--text-color); + font-weight: 600; + font-size: 28px; + text-align: center; + margin-bottom: 16px; + font-family: var(--header-font-family); +} + +.unauthorized-to-upgrade-title { + color: #b7394a; + font-weight: 600; + font-size: 18px; + text-align: center; + margin-bottom: 16px; + font-family: var(--header-font-family); + line-height: 1.5em; +} + +.unauthorized-to-upgrade-title.panel-mode { + max-width: 260px; +} + +.unauthorized-to-upgrade-subtitle { + width: 370px; + margin-bottom: 40px; + color: var(--secondary-text-color); + line-height: 1.47; + text-align: center; + font-weight: 400; + font-size: 16px; +} + +.unauthorized-to-upgrade-subtitle.panel-mode { + max-width: 260px; +} + +.unauthorized-to-upgrade-btn-wpr { + display: flex; + -webkit-box-align: center; + align-items: center; + -webkit-box-pack: center; + justify-content: center; +} + +.unauthorized-to-upgrade-btn-wpr > button { + border-radius: var(--btn-border-radius) !important; + height: 55px !important; + padding: 9px 35px !important; +} + + +.unauthorized-to-upgrade-go-to-project { + cursor: pointer; + font-size: 14px; + font-weight: 400; + color: var(--blue-20); + font-family: var(--header-font-family); +} + +.unauthorized-to-upgrade-go-to-project:hover { + text-decoration: underline; +} + + + +@media (max-width: 668px){ + .unauthorized-to-upgrade-subtitle { + width: 340px; + font-size: 14px; + } +} diff --git a/src/app/pricing/pricing.component.ts b/src/app/pricing/pricing.component.ts index 0c0cbbb61c6a..0fa9d12a9b1e 100755 --- a/src/app/pricing/pricing.component.ts +++ b/src/app/pricing/pricing.component.ts @@ -14,6 +14,8 @@ import { AppConfigService } from '../services/app-config.service'; import { TranslateService } from '@ngx-translate/core'; import { additionalFeaturesPlanD, additionalFeaturesPlanE, additionalFeaturesPlanEE, featuresPlanA, featuresPlanB, featuresPlanC, featuresPlanD, featuresPlanE, featuresPlanEE, featuresPlanF, highlightedFeaturesPlanA, highlightedFeaturesPlanB, highlightedFeaturesPlanC, highlightedFeaturesPlanD, highlightedFeaturesPlanE, highlightedFeaturesPlanEE, highlightedFeaturesPlanF, PLAN_NAME } from 'app/utils/util'; import { NotifyService } from 'app/core/notify.service'; +import moment from "moment"; +import { ProjectUser } from 'app/models/project-user'; declare var Stripe: any; @@ -35,7 +37,8 @@ enum MONTHLY_PRICE { Basic = "15", Premium = "100", Team = "299", - Custom = 'Starting at 500€' + // Custom = 'Starting at 500€', + Custom = '500', } enum ANNUAL_PRICE { @@ -45,7 +48,8 @@ enum ANNUAL_PRICE { Basic = "150", Premium = "1,000", Team = "2,990", - Custom = 'Starting at 500€' + // Custom = 'Starting at 500€' + Custom = '500', } @@ -62,7 +66,35 @@ export class PricingComponent implements OnInit, OnDestroy { planName: string; planDecription: string; profileType: string; + trialExpired: boolean; planFeatures: Array; + + planDFeatures: Array; // for new pricing + planEFeatures: Array; // for new pricing + planEEFeatures: Array; // for new pricing + planFFeatures: Array; // for new pricing + + planDMonthlyPrice:string // for new pricing + planEMonthlyPrice:string // for new pricing + planEEMonthlyPrice:string // for new pricing + planFMonthlyPrice:string // for new pricing + + planDAnnualPrice:string // for new pricing + planEAnnualPrice:string // for new pricing + planEEAnnualPrice:string // for new pricing + planFAnnualPrice:string // for new pricing + + planDAnnualPricePerMonth:any // for new pricing + planEAnnualPricePerMonth:any // for new pricing + planEEAnnualPricePerMonth:any // for new pricing + planFAnnualPricePerMonth:any // for new pricing + + planDDecription : string; + planEDecription : string; + planEEDecription : string; + planFDecription : string; + + additionalFeatures: Array; annualPrice: string; monthlyPrice: string; @@ -151,6 +183,12 @@ export class PricingComponent implements OnInit, OnDestroy { learnMoreAboutDefaultRoles: string; salesEmail: string; + trialHasExpired: boolean; + trialExpirationDate: string + + CHAT_PANEL_MODE: boolean; + isVisiblePAY: boolean; + public_Key: string; constructor( public location: Location, @@ -171,6 +209,22 @@ export class PricingComponent implements OnInit, OnDestroy { this.company_name = brand['BRAND_NAME']; this.contactUsEmail = brand['CONTACT_US_EMAIL']; this.salesEmail = brand['CONTACT_SALES_EMAIL']; + + this.CHAT_PANEL_MODE = window.self !== window.top; + console.log('[PRICING] Is in iframe (CHAT_PANEL_MODE) :', this.CHAT_PANEL_MODE); + + + console.log('[PRICING] .router.url ' , this.router.url) + // this.CHAT_PANEL_MODE = false + + // if (this.router.url.indexOf('/request-for-panel') !== -1) { + // this.CHAT_PANEL_MODE = true; + // console.log('[PRICING] CHAT_PANEL_MODE ', this.CHAT_PANEL_MODE ) + // } else { + + // this.CHAT_PANEL_MODE = false; + // console.log('[PRICING] CHAT_PANEL_MODE ', this.CHAT_PANEL_MODE ) + // } } /** @@ -190,12 +244,12 @@ export class PricingComponent implements OnInit, OnDestroy { ngOnInit() { - // this.auth.checkRoleForCurrentProjectAndRedirectAdminAndAgent(); // redirect admin and ahent -- only owner has access to payment + // this.auth.checkRoleForCurrentProjectAndRedirectAdminAndAgent(); // redirect admin and agent -- only owner has access to payment this.getCurrentProject(); this.selectedPlanName = 'pro' this.getBaseUrl() // this.getAllUsersOfCurrentProject(); - this.getNoOfProjectUsersAndPendingInvitations(); + // this.getNoOfProjectUsersAndPendingInvitations(); this.getProjectPlan(); this.setPlansPKandCode(); this.setpaymentLinks() @@ -204,6 +258,7 @@ export class PricingComponent implements OnInit, OnDestroy { this.getProjectUserRole(); this.translateString(); this.getBrowserLanguage(); + this.getOSCODE(); this.planName = PLAN_NAME.D; // PLAN_NAME.A this.planDecription = PLAN_DESC[PLAN_NAME.D]; //PLAN_DESC[PLAN_NAME.A] @@ -214,18 +269,116 @@ export class PricingComponent implements OnInit, OnDestroy { this.annualPeriod = false; this.monthlyPrice = MONTHLY_PRICE[PLAN_NAME.D] // MONTHLY_PRICE[PLAN_NAME.A] + // For new pricing + this.planDFeatures = featuresPlanD; + this.planEFeatures = featuresPlanE; + this.planEEFeatures = featuresPlanEE; + this.planFFeatures = featuresPlanF; + + this.planDMonthlyPrice = MONTHLY_PRICE[PLAN_NAME.D]; + this.planEMonthlyPrice = MONTHLY_PRICE[PLAN_NAME.E]; + this.planEEMonthlyPrice = MONTHLY_PRICE[PLAN_NAME.EE]; + this.planFMonthlyPrice = MONTHLY_PRICE[PLAN_NAME.F]; + + + + this.planDAnnualPricePerMonth = +ANNUAL_PRICE[PLAN_NAME.D] / 12; + console.log('[PRICING] planDAnnualPricePerMonth ', this.planDAnnualPricePerMonth ) + + this.planEAnnualPricePerMonth = "" + // +ANNUAL_PRICE[PLAN_NAME.E] / 12; + this.planEEAnnualPricePerMonth = "" + // +ANNUAL_PRICE[PLAN_NAME.EE]/ 12; + + // +ANNUAL_PRICE[PLAN_NAME.F] / 12; + + this.planDAnnualPrice = ANNUAL_PRICE[PLAN_NAME.D]; + this.planEAnnualPrice = ANNUAL_PRICE[PLAN_NAME.E]; + this.planEEAnnualPrice = ANNUAL_PRICE[PLAN_NAME.EE]; + this.planFAnnualPrice = ANNUAL_PRICE[PLAN_NAME.F]; + + + this.planDDecription = PLAN_DESC[PLAN_NAME.D]; + this.planEDecription = PLAN_DESC[PLAN_NAME.E]; + this.planEEDecription = PLAN_DESC[PLAN_NAME.EE]; + this.planFDecription= PLAN_DESC[PLAN_NAME.F]; + + + + // console.log('[PRICING] ROUTER URL ', this.router.url) const current_url = this.router.url; // console.log('[PRICING] current_url ', current_url) var n = current_url.lastIndexOf('/'); var valueAfterLastString = current_url.substring(n + 1); - // console.log('[PRICING] valueAfterLastString ', valueAfterLastString) - if (valueAfterLastString === 'pricing') { + console.log('[PRICING] valueAfterLastString ', valueAfterLastString) + // if (valueAfterLastString === 'pricing') { + if (valueAfterLastString === 'chat-pricing') { + this.displayClosePricingPageBtn = false; + } else { this.displayClosePricingPageBtn = true; + } + + // if (valueAfterLastString === 'chat-pricing-te') { + // this.displayClosePricingPageBtn = false; + // this.trialHasExpired = true; + // } else { + // this.displayClosePricingPageBtn = true; + // this.trialHasExpired = false; + // } + + if (valueAfterLastString === 'te') { + this.trialHasExpired = true; } else { - this.displayClosePricingPageBtn = false; + this.trialHasExpired = false; + } + + console.log('[PRICING] trialHasExpired ', this.trialHasExpired ) + + } + + + getOSCODE() { + this.public_Key = this.appConfigService.getConfig().t2y12PruGU9wUtEGzBJfolMIgK; + this.logger.log('[PRICING] AppConfigService getAppConfig public_Key', this.public_Key); + + let keys = this.public_Key.split("-"); + this.logger.log('[PRICING] PUBLIC-KEY - public_Key keys', keys) + + keys.forEach(key => { + + if (key.includes("PAY")) { + + let pay = key.split(":"); + + if (pay[1] === "F") { + this.isVisiblePAY = false; + this.logger.log('[PRICING] isVisiblePAY', this.isVisiblePAY) + } else { + this.isVisiblePAY = true; + this.logger.log('[PRICING] isVisiblePAY', this.isVisiblePAY) + } + } + + }); + } + + goToPricingFromChat() { + if (this.isVisiblePAY) { + + const href = window.location.href; + this.logger.log('[UNAUTHORIZED-TO-UPGRADE] href ', href) + + const hrefArray = href.split('/#/'); + this.dshbrdBaseUrl = hrefArray[0] + const pricingUrl = this.dshbrdBaseUrl + '/#/project/' + this.projectId + '/pricing/te'; + window.open(pricingUrl, '_blank'); + } + } + contactSales() { + window.open(`mailto:${this.salesEmail}?subject=Upgrade plan`); } translateString() { @@ -243,19 +396,17 @@ export class PricingComponent implements OnInit, OnDestroy { getLoggedUser() { this.auth.user_bs.subscribe((user) => { - this.user = user; }) } getProjectUserRole() { - this.usersService.project_user_role_bs - .subscribe((user_role) => { - this.logger.log('[APP-STORE] - GET PROJECT-USER ROLE ', user_role); - if (user_role) { - this.USER_ROLE = user_role; - } - }); + this.usersService.projectUser_bs.subscribe((projectUser: ProjectUser) => { + this.logger.log('[APP-STORE] - GET PROJECT-USER ROLE ', projectUser); + if (projectUser) { + this.USER_ROLE = projectUser.role; + } + }); } getCurrentProject() { @@ -715,7 +866,7 @@ export class PricingComponent implements OnInit, OnDestroy { this.logger.log('[PRICING] GET ROUTE-PARAMS & APPID - APP ID: ', appID); this.route.queryParams.subscribe((params) => { - this.logger.log('[PRICING] - GET ROUTE-PARAMS & APPID - params: ', params) + console.log('[PRICING] - GET ROUTE-PARAMS & APPID - params: ', params) if (params.nk) { this.logger.log('[PRICING] - GET ROUTE-PARAMS & APPID - params.nk: ', params.nk) // if (params.nk === 'y' && appID === "1:92907897826:web:f255664014a7cc14ee2fbb") { @@ -760,16 +911,26 @@ export class PricingComponent implements OnInit, OnDestroy { getProjectPlan() { this.subscription = this.prjctPlanService.projectPlan$.subscribe((projectProfileData: any) => { - // console.log('[PRICING] - getProjectPlan - project Profile Data ', projectProfileData) + console.log('[PRICING] - getProjectPlan - project Profile Data ', projectProfileData) + console.log('[PRICING] - getProjectPlan - trialHasExpired ', this.trialHasExpired) if (projectProfileData) { this.subscription_id = projectProfileData.subscription_id; this.projectCurrenPlan = projectProfileData.profile_name this.profileType = projectProfileData.profile_type + this.trialExpired = projectProfileData.trial_expired + + console.log('[PRICING] - getProjectPlan > subscription_id ', this.subscription_id) + console.log('[PRICING] - getProjectPlan > projectCurrenPlan ', this.projectCurrenPlan) + console.log('[PRICING] - getProjectPlan > profileType ', this.profileType) + console.log('[PRICING] - getProjectPlan > trialExpired ', this.trialExpired) + - // console.log('[PRICING] - getProjectPlan > subscription_id ', this.subscription_id) - // console.log('[PRICING] - getProjectPlan > projectCurrenPlan ', this.projectCurrenPlan) - // console.log('[PRICING] - getProjectPlan > profileType ', this.profileType) + if (this.profileType === 'free' && this.trialExpired === true) { + + this.trialExpirationDate = moment(projectProfileData.createdAt).add(14, 'days').format('LL');; + console.log('[PRICING] - trialExpirationDate' , this.trialExpirationDate); // Outputs the new date as an ISO string + } } }, error => { @@ -905,7 +1066,13 @@ export class PricingComponent implements OnInit, OnDestroy { goBack() { - this.location.back(); + if (this.trialHasExpired) { + // this.auth.signOut('pricing'); + this.router.navigate(['/projects']); + } else { + this.location.back(); + } + } diff --git a/src/app/pricing/pricing.component_new.html b/src/app/pricing/pricing.component_new.html new file mode 100755 index 000000000000..48285df7de83 --- /dev/null +++ b/src/app/pricing/pricing.component_new.html @@ -0,0 +1,842 @@ + + + +
    + + + +
    + +
    + + clear + +
    + + + +
    +
    + +
    +
    +
    +

    +
    + Upgrade +
    +

    + + + + + +
    +
    + + + trialHasExpired > {{ trialHasExpired }} +
    + {{ 'TrialExpirationDate' | translate: {expiration_date: trialExpirationDate} }} +
    + + + +
    + + + + +
    + +
    +
    + + + {{monthlyPrice}} + {{annualPrice}} + EUR + + + /mo. + /yr. + + +
    + + +
    +
    + + +
    + + + + 2 months for free + + + + + + + +
    + +
    + +
    +

    + + {{planDecription}} + +

    + +
    +
    + + + + +
    +
    +

    + {{ planName }} +

    + + + +
    + +
    {{feature.feature}}
    +
    + +
    + + + +
    +
      + + +
    • +
      +
      + + + + +
      + +
      {{feature}}
      +
      +
    • +
    +
    + + + +
    +
    + Additional Features +
    +
      +
    • +
      +
      + + + + +
      + +
      {{feature}}
      +
      +
    • + +
    + +
    + + +
    +
    +
    +
    + + + {{monthlyPrice}} + {{annualPrice}} + EUR + + + /mo. + /yr. + + +
    + + +
    +
    + + +
    + + + + 2 months for free + + + + + + + +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +
    + + + + +
    + +
    + + + + +
    + +
    + + + + +
    + +
    + + + + +
    + +
    + + + + +
    + +
    + + + + +
    + +
    + + + + +
    + +
    + + + + +
    + +
    + + + + + + + +
    + +
    + + + + + +
    +
    + + + + + + +
    +
    +
    +

    {{PLAN_NAME.D}}

    +
    +
    +
    +

    + {{planDDecription}} +

    +
    +
    +
    +

    + Billed + + + {{planDAnnualPrice}} + EUR + + /yr. + +

    + + + {{planDMonthlyPrice}} + EUR + + /mo. + + +
    + +
    +
    + +
    +
    +
    +
    + + + + + + + +

    + {{feature}} +

    +
    +
    +
    + + + + +
    + +
    +
    +

    + + {{PLAN_NAME.E}} +

    +
    +
    +
    +

    + {{planEDecription}} +

    +
    +
    +
    +

    + Billed + + + {{planEAnnualPrice}} + EUR + + /yr. + +

    + + + {{planEMonthlyPrice}} + EUR + + /mo. + + +
    + +
    +
    + +
    +
    + +
    +
    + + + + + + + +

    {{feature}}

    +
    +
    +
    + + + + +
    +
    +
    +

    {{PLAN_NAME.EE}}

    +
    +
    +
    +

    + + {{planEEDecription}} +

    +
    +
    +

    + Billed + + + {{planEEAnnualPrice}} + EUR + + /yr. + +

    + +
    + + + {{planEEMonthlyPrice}} + EUR + + /mo. + + +
    + +
    +
    + +
    +
    +
    +
    + + + + + + + +

    {{feature}}

    +
    +
    +
    + + + + + +
    +
    +
    +

    + {{PLAN_NAME.F}} +

    +
    +
    + +
    +

    + {{planFDecription}} +

    +
    +
    +

    + Starts at +

    +
    +
    + + + {{planFMonthlyPrice}} + EUR + + /mo. + +
    +
    +
    +
    + +
    +
    +
    +
    + + + + + + + +

    + {{feature}} +

    +
    +
    + +
    +
    + +
    + +
    + +
    + + + + + +
    +
    + + +
    +
    + + + + + + + + + + + + \ No newline at end of file diff --git a/src/app/pricing/pricing.component_ols.html b/src/app/pricing/pricing.component_old_1.html similarity index 100% rename from src/app/pricing/pricing.component_ols.html rename to src/app/pricing/pricing.component_old_1.html diff --git a/src/app/project-edit-add/project-edit-add.component.ts b/src/app/project-edit-add/project-edit-add.component.ts index c1dc6c28aa50..eb6add194df5 100755 --- a/src/app/project-edit-add/project-edit-add.component.ts +++ b/src/app/project-edit-add/project-edit-add.component.ts @@ -28,6 +28,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { CreditCardValidators } from 'angular-cc-library'; import { ContactsService } from '../services/contacts.service'; import { CacheService } from 'app/services/cache.service'; +import { ProjectUser } from 'app/models/project-user'; import { RoleService } from 'app/services/role.service'; const swal = require('sweetalert'); @@ -428,17 +429,14 @@ export class ProjectEditAddComponent implements OnInit, OnDestroy { } getProjectUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.logger.log('[PRJCT-EDIT-ADD] - USER ROLE ', user_role); - if (user_role) { - this.USER_ROLE = user_role - + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.logger.log('[PRJCT-EDIT-ADD] - USER ROLE ', projectUser); + if(projectUser.role) { + this.USER_ROLE = projectUser.role } - }); + } + }); } translateStrings() { @@ -1293,6 +1291,7 @@ export class ProjectEditAddComponent implements OnInit, OnDestroy { getProjectPlan() { this.subscription = this.prjctPlanService.projectPlan$.subscribe((projectProfileData: any) => { // this.logger.log('[PRJCT-EDIT-ADD] - getProjectPlan project Profile Data', projectProfileData) + this.logger.log('[PRJCT-EDIT-ADD] - getProjectPlan project Profile Data', projectProfileData) if (projectProfileData) { this.prjct_name = projectProfileData.name; this.logger.log('[PRJCT-EDIT-ADD] - getProjectPlan prjct_name', this.prjct_name); diff --git a/src/app/projects/projects.component.ts b/src/app/projects/projects.component.ts index b5e76febfbdd..ec12e639e6d5 100755 --- a/src/app/projects/projects.component.ts +++ b/src/app/projects/projects.component.ts @@ -159,6 +159,7 @@ export class ProjectsComponent implements OnInit, AfterContentInit, OnDestroy { this.unsubscribe$.next(); this.unsubscribe$.complete(); } + getRouteParams() { this.route.queryParams.subscribe((params) => { this.logger.log('[PROJECTS] - GET ROUTE-PARAMS & APPID - params: ', params) diff --git a/src/app/services/faq-kb.service.ts b/src/app/services/faq-kb.service.ts index dc2a080c9d08..620542c7d368 100755 --- a/src/app/services/faq-kb.service.ts +++ b/src/app/services/faq-kb.service.ts @@ -8,6 +8,7 @@ import { AppConfigService } from '../services/app-config.service'; import { LoggerService } from '../services/logger/logger.service'; import { BehaviorSubject } from 'rxjs'; import { map } from 'rxjs/operators'; +import { BotLocalDbService } from './bot-local-db.service'; @Injectable() export class FaqKbService { @@ -26,6 +27,7 @@ export class FaqKbService { constructor( private auth: AuthService, public appConfigService: AppConfigService, + private botLocalDbService: BotLocalDbService, private _httpClient: HttpClient, private logger: LoggerService ) { @@ -412,6 +414,28 @@ export class FaqKbService { .delete(url, httpOptions) } + // GET AND SAVE ALL BOTS OF CURRENT PROJECT IN LOCAL STORAGE + public getBotsByProjectIdAndSaveInStorage() { + this.getFaqKbByProjectId().subscribe((bots: any) => { + this.logger.log('[USER-SERV] - GET BOT BY PROJECT ID AND SAVE IN STORAGE - bots ', bots); + if (bots && bots !== null) { + + bots.forEach(bot => { + this.logger.log('[USER-SERV] - GET BOT BY PROJECT ID AND SAVE IN STORAGE - BOT', bot); + this.logger.log('[USER-SERV] - GET BOT BY PROJECT ID AND SAVE IN STORAGE - BOT-ID', bot._id); + this.botLocalDbService.saveBotsInStorage(bot._id, bot); + }); + + } + }, (error) => { + this.logger.error('[USER-SERV] - GET BOT BY PROJECT ID AND SAVE IN STORAGE - ERROR ', error); + }, () => { + this.logger.log('[USER-SERV] - GET BOT BY PROJECT ID AND SAVE IN STORAGE * COMPLETE'); + + }); + + } + /** * @param name * @param urlfaqkb diff --git a/src/app/services/notification.service.ts b/src/app/services/notification.service.ts index 8cc24ae0c99c..c66a1b4298b6 100755 --- a/src/app/services/notification.service.ts +++ b/src/app/services/notification.service.ts @@ -21,7 +21,7 @@ export class NotificationService { private logger: LoggerService ) { this.user = auth.user_bs.value; - this.project_user_id = usersService.project_user_id_bs.value; + this.project_user_id = usersService.projectUser_bs.value._id; this.checkIfUserExistAndGetToken(); diff --git a/src/app/services/quotes.service.ts b/src/app/services/quotes.service.ts index c398bd34e4e7..62a68d8dc51d 100644 --- a/src/app/services/quotes.service.ts +++ b/src/app/services/quotes.service.ts @@ -145,6 +145,8 @@ export class QuotesService { } limits = PLANS_LIST[plan]; + // console.log('[Q-S] limits ', limits) + // console.log('[Q-S] PLANS_LIST[plan] ', PLANS_LIST[plan]) } else { if (project.trialExpired === true) { diff --git a/src/app/services/role.service.ts b/src/app/services/role.service.ts index 45ce7bc0fc17..92589021807d 100644 --- a/src/app/services/role.service.ts +++ b/src/app/services/role.service.ts @@ -34,11 +34,11 @@ export class RoleService { userId = storedUserObject._id this.logger.log('[ROLE-SERV] checkRoleForCurrentProject > userId ', userId) const currentProject = this.auth.project_bs.value - this.logger.log('[ROLE-SERV] checkRoleForCurrentProject currentProject ', currentProject) + console.log('[ROLE-SERV] checkRoleForCurrentProject currentProject ', currentProject) const projectId = currentProject._id - - const projectUserRole = this.usersService.project_user_role_bs.value + // console.log('[ROLE-SERV] checkRoleForCurrentProject is.usersService.projectUser_bs ', this.usersService.projectUser_bs) + const projectUserRole = this.usersService.projectUser_bs.value.role this.logger.log('[ROLE-SERV] checkRoleForCurrentProject projectUserRole ', projectUserRole) this.logger.log('[ROLE-SERV] checkRoleForCurrentProject > projectId ', projectId) if (projectUserRole) { diff --git a/src/app/services/tags.service.ts b/src/app/services/tags.service.ts index 0031fbf91244..dd1f499782b8 100755 --- a/src/app/services/tags.service.ts +++ b/src/app/services/tags.service.ts @@ -48,7 +48,7 @@ export class TagsService { } public geTagsForGraph(type, start_date, end_date): Observable<[any]> { - this.logger.log('[TAGS-SERV] start_date', start_date, 'end_date', end_date) + this.logger.log('[TAGS-SERV] GET TAG FOR GRAPH -->> start_date', start_date, '-->> end_date', end_date) const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json', diff --git a/src/app/services/users.service.ts b/src/app/services/users.service.ts index e65bbf6e0a2f..18cd85497f26 100755 --- a/src/app/services/users.service.ts +++ b/src/app/services/users.service.ts @@ -1,7 +1,7 @@ +import { ProjectUser } from 'app/models/project-user'; import { Injectable } from '@angular/core'; import { User } from '../models/user-model'; import { PendingInvitation } from '../models/pending-invitation-model'; -import { ProjectUser } from '../models/project-user'; import { Observable , BehaviorSubject} from 'rxjs'; import { AuthService } from '../core/auth.service'; import { HttpClient, HttpHeaders } from '@angular/common/http'; @@ -14,6 +14,7 @@ import { AppConfigService } from '../services/app-config.service'; import { WebSocketJs } from "../services/websocket/websocket-js"; import { avatarPlaceholder, getColorBck } from '../utils/util'; import { LoggerService } from '../services/logger/logger.service'; +import { map } from 'rxjs/operators'; interface NewUser { displayName: string; email: string; @@ -24,11 +25,7 @@ interface NewUser { export class UsersService { wsService: WebSocketJs; - public user_is_available_bs: BehaviorSubject = new BehaviorSubject(true); - public projectUser_bs: BehaviorSubject = new BehaviorSubject(''); - public user_is_busy$: BehaviorSubject = new BehaviorSubject(false); - public project_user_id_bs: BehaviorSubject = new BehaviorSubject(''); - public project_user_role_bs: BehaviorSubject = new BehaviorSubject(''); + public projectUser_bs: BehaviorSubject = new BehaviorSubject(null); public has_changed_availability_in_sidebar: BehaviorSubject = new BehaviorSubject(null); public has_changed_availability_in_users: BehaviorSubject = new BehaviorSubject(null); public userProfileImageExist: BehaviorSubject = new BehaviorSubject(null); @@ -67,8 +64,6 @@ export class UsersService { private auth: AuthService, private usersLocalDbService: LocalDbService, private router: Router, - private faqKbService: FaqKbService, - private botLocalDbService: BotLocalDbService, public appConfigService: AppConfigService, public webSocketJs: WebSocketJs, private logger: LoggerService, @@ -525,7 +520,7 @@ export class UsersService { * @param user_id * @returns */ - public getProjectUserByUserId(user_id: string): Observable { + public getProjectUserByUserId(user_id: string): Observable { const url = this.PROJECT_USER_URL + 'users/' + user_id; this.logger.log('[USER-SERV] - GET PROJECT-USER BY USER-ID - URL', url); @@ -540,7 +535,7 @@ export class UsersService { return this._httpClient - .get(url, httpOptions) + .get(url, httpOptions).pipe(map((res)=> res[0])); } public getProjectUserByUserIdPassingProjectId(user_id: string,project_id: string): Observable { @@ -587,47 +582,6 @@ export class UsersService { } - // ------------------------------------------------------------------------------------------------ - // TODO: TO REPLACE "getProjectUser()" USED BY THE SIDEBAR AND HOME COMPONENTS - CURRENTLY NOT USED - // ------------------------------------------------------------------------------------------------- - getProjectUserAvailabilityAndRole() { - this.getProjectUserByUserId(this.currentUserId).subscribe((projectUser: any) => { - // this.logger.log('!! USER SERVICE - PROJECT-USER GET BY PROJECT-ID ', this.project_id); - this.logger.log('[USER-SERV] - PROJECT-USER GET BY CURRENT-USER-ID - CURRENT USE ID ', this.currentUserId); - this.logger.log('[USER-SERV] - PROJECT-USER GET BY CURRENT-USER-ID - PROJECT-USER ', projectUser); - this.logger.log('[USER-SERV] - PROJECT-USER GET BY CURRENT-USER-ID - PROJECT-USER LENGTH', projectUser.length); - if ((projectUser) && (projectUser.length !== 0)) { - this.logger.log('[USER-SERV] - PROJECT-USER GET BY CURRENT-USER-ID - PROJECT-USER ID ', projectUser[0]._id) - this.logger.log('[USER-SERV] - PROJECT-USER GET BY CURRENT-USER-ID - USER IS AVAILABLE ', projectUser[0].user_available) - // this.user_is_available_bs = projectUser.user_available; - - if (projectUser[0].user_available !== undefined) { - this.user_availability(projectUser[0]._id, projectUser[0].user_available, projectUser[0].isBusy, projectUser[0]) - } - - // ADDED 21 AGO - if (projectUser[0].role !== undefined) { - this.logger.log('[USER-SERV] - PROJECT-USER GET BY CURRENT-USER-ID - CURRENT USER ROLE ', projectUser[0].role); - this.user_role(projectUser[0].role); - - // save the user role in storage - then the value is get by auth.service: - // the user with agent role can not access to the pages under the settings sub-menu - // this.auth.user_role(projectUser[0].role); - - this.usersLocalDbService.saveUserRoleInStorage(projectUser[0].role); - } - } else { - // this could be the case in which the current user was deleted as a member of the current project - this.logger.log('[USER-SERV] - PROJECT-USER GET BY CURRENT-USER-ID - PROJECT-USER UNDEFINED ') - } - - }, (error) => { - this.logger.error('[USER-SERV] - PROJECT-USER GET BY CURRENT-USER-ID - ERROR ', error); - }, () => { - this.logger.log('[USER-SERV] - PROJECT-USER GET BY CURRENT-USER-ID * COMPLETE *'); - }); - } - // ------------------------------------------------------------------------- // GET ALL PROJECT PROJECT-USERS AND SAVE IN STORAGE USERS AND PROJECT-USERS @@ -705,29 +659,6 @@ export class UsersService { } } - // GET AND SAVE ALL BOTS OF CURRENT PROJECT IN LOCAL STORAGE - getBotsByProjectIdAndSaveInStorage() { - this.faqKbService.getFaqKbByProjectId().subscribe((bots: any) => { - this.logger.log('[USER-SERV] - GET BOT BY PROJECT ID AND SAVE IN STORAGE - bots ', bots); - if (bots && bots !== null) { - - bots.forEach(bot => { - this.logger.log('[USER-SERV] - GET BOT BY PROJECT ID AND SAVE IN STORAGE - BOT', bot); - this.logger.log('[USER-SERV] - GET BOT BY PROJECT ID AND SAVE IN STORAGE - BOT-ID', bot._id); - this.botLocalDbService.saveBotsInStorage(bot._id, bot); - }); - - } - }, (error) => { - this.logger.error('[USER-SERV] - GET BOT BY PROJECT ID AND SAVE IN STORAGE - ERROR ', error); - }, () => { - this.logger.log('[USER-SERV] - GET BOT BY PROJECT ID AND SAVE IN STORAGE * COMPLETE'); - - }); - - } - - // ----------------------------------------------------------------------------------------------------- // PUBLISH: Project User ID, Availability; Busy - PUBLISH projectUser_id, user_available, isBusy // ----------------------------------------------------------------------------------------------------- @@ -740,15 +671,9 @@ export class UsersService { * @param user_available * @param user_isbusy */ - public user_availability(projectUser_id: string, user_available: boolean, user_isbusy: boolean, projctuser:any) { - this.logger.log('[USER-SERV] - PUBLISH PROJECT-USER-ID ', projectUser_id); - this.logger.log('[USER-SERV] - PUBLISH USER AVAILABLE ', user_available); - this.logger.log('[USER-SERV] - PUBLISH USER IS BUSY ', user_isbusy); - - this.project_user_id_bs.next(projectUser_id); - this.user_is_available_bs.next(user_available); - this.user_is_busy$.next(user_isbusy); - this.projectUser_bs.next(projctuser); + public setProjectUser(projctUser:ProjectUser) { + this.logger.log('[USER-SERV] - PUBLISH PROJECT_USER ', projctUser); + this.projectUser_bs.next(projctUser); } @@ -861,47 +786,6 @@ export class UsersService { } - /** - * PUBLISH PROJECT-USER ROLE AND CHECK THE ROLE (FOR THE CURRENT PROJECT) SAVED IN THE STORAGE - * NOTE: THE projectUser_role IS PASSED FROM HOME - SIDEBAR - NAVBAR-FOR-PANEL - * NOTE: IF THE USER ROLE STORED NOT MATCHES THE USER ROLE PUBLISHED IS RESET IN STORAGE THE PROJECT OBJCT - * @param projectUser_role - */ - public user_role(projectUser_role: string) { - this.logger.log('[USER-SERV] PUBLISH THE USER-ROLE >>', projectUser_role, '<< FOR THE PROJECT ID ', this.project_id); - - // PUBLISH THE USER ROLE - this.project_user_role_bs.next(projectUser_role); - - // COMPARE THE STORED ROLE WITH THE USER ROLE PUBLISHED - // const storedProjectJson = localStorage.getItem(this.project_id); - // if (storedProjectJson) { - // const projectObject = JSON.parse(storedProjectJson); - // const storedUserRole = projectObject['role']; - // const storedProjectName = projectObject['name']; - // const storedProjectId = projectObject['_id']; - // const storedProjectOH = projectObject['operatingHours']; - // this.logger.log('[USER-SERV] USER ROLE FROM STORAGE >>', storedUserRole, '<<'); - // this.logger.log('[USER-SERV] PROJECT NAME FROM STORAGE ', storedProjectName); - // this.logger.log('[USER-SERV] PROJECT ID FROM STORAGE ', storedProjectId); - - // if (storedUserRole !== projectUser_role) { - // this.logger.log('[USER-SERV] - USER ROLE STORED !!! NOT MATCHES USER ROLE PUBLISHED - RESET PROJECT IN STORAGE '); - - // // const projectForStorage: Project = { - // // _id: storedProjectId, - // // name: storedProjectName, - // // role: projectUser_role, - // // operatingHours: storedProjectOH - // // } - - // // RESET THE PROJECT IN THE STORAGE WITH THE UPDATED ROLE - // localStorage.setItem(storedProjectId, JSON.stringify(projectForStorage)); - // } - // } - } - - /** * UPDATE PROJECT-USER AVAILABILITY (PUT) * @param projectUser_id diff --git a/src/app/services/websocket/ws-requests.service.ts b/src/app/services/websocket/ws-requests.service.ts index cc9ae197f088..b4d71466b013 100755 --- a/src/app/services/websocket/ws-requests.service.ts +++ b/src/app/services/websocket/ws-requests.service.ts @@ -189,7 +189,6 @@ export class WsRequestsService implements OnDestroy { // this.webSocketJs.unsubscribe('/' + this.project_id + '/requests/' + this.subscribed_request_id); // WHEN CHANGING THE PROJECT I UNSUBSCRIBE FROM THE "REQUEST BY ID" TO WHICH IT IS POSSIBLY SUBSCRIBED // this.webSocketJs.unsubscribe('/' + this.project_id + '/requests/' + this.subscribed_request_id + '/messages'); // AS ABOVE BUT FOR MESSAGES // } - // unsuscribe requester presence al cambio progetto if (this.subscribed_requester_id) { this.webSocketJs.unsubscribe('/' + this.project_id + '/project_users/users/' + this.subscribed_requester_id); @@ -216,6 +215,7 @@ export class WsRequestsService implements OnDestroy { function (data, notification) { if (data) { + // console.log("[WS-REQUESTS-SERV] DSHB - Create - DATA ", data); // ------------------------------------------------ // @ Agents - pass in data agents get from snapshot // ------------------------------------------------ @@ -487,7 +487,7 @@ export class WsRequestsService implements OnDestroy { * @param id_request */ subscribeTo_wsRequestById(id_request) { - // this.logger.log("[WS-REQUESTS-SERV] - SUBSCR TO WS REQUEST-BY-ID (REF) id_request ", id_request); + this.logger.log("[WS-REQUESTS-SERV] - SUBSCR TO WS REQUEST-BY-ID (REF) id_request ", id_request); this.unsubscribePreviousRequestId() @@ -1251,7 +1251,10 @@ export class WsRequestsService implements OnDestroy { // const url = this.SERVER_BASE_PATH + 'modules/tilebot/ext/parameters/requests/' + id_request; const url = this.SERVER_BASE_PATH + this.project_id + '/requests/' + id_request + '/chatbot/parameters'; - // this.logger.log('[WS-REQUESTS-SERV] - GET CONVERSATION WITH BOT URL ', url); + // https://tiledesk-server-pre.herokuapp.com/62c3f10152dc7400352bab0d/requests/support-group-62c3f10152dc7400352bab0d-e81d9c55-wab-109639215462567-393484506627/chatbot/parameters + + + // console.log('[WS-REQUESTS-SERV] - GET CONVERSATION WITH BOT URL ', url); // 'Authorization': this.TOKEN, const httpOptions = { diff --git a/src/app/static-pages/activities-static/activities-static.component.ts b/src/app/static-pages/activities-static/activities-static.component.ts index 008591e8af4d..a363123aeb4b 100755 --- a/src/app/static-pages/activities-static/activities-static.component.ts +++ b/src/app/static-pages/activities-static/activities-static.component.ts @@ -14,6 +14,7 @@ import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.comp import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators' import { Location } from '@angular/common'; +import { ProjectUser } from 'app/models/project-user'; import { RoleService } from 'app/services/role.service'; const swal = require('sweetalert'); @@ -134,14 +135,12 @@ export class ActivitiesStaticComponent extends PricingBaseComponent implements O } getProjectUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.USER_ROLE = user_role; + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.USER_ROLE = projectUser.role; this.logger.log('[ACTIVITIES-STATIC] - PROJECT USER ROLE: ', this.USER_ROLE); - }); + } + }); } diff --git a/src/app/static-pages/analytics-static/analytics-static.component.ts b/src/app/static-pages/analytics-static/analytics-static.component.ts index caa79671cc51..3e410c62e65d 100755 --- a/src/app/static-pages/analytics-static/analytics-static.component.ts +++ b/src/app/static-pages/analytics-static/analytics-static.component.ts @@ -13,6 +13,7 @@ import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.comp import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators' import { Location } from '@angular/common'; +import { ProjectUser } from 'app/models/project-user'; import { RoleService } from 'app/services/role.service'; const swal = require('sweetalert'); @@ -158,15 +159,12 @@ export class AnalyticsStaticComponent extends PricingBaseComponent implements On } getProjectUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.USER_ROLE = user_role; + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.USER_ROLE = projectUser.role; this.logger.log('[ANALYTICS-STATIC] - PROJECT USER ROLE: ', this.USER_ROLE); - // this.hideNavigationElem(this.USER_ROLE) - }); + } + }); } hideNavigationElem(USER_ROLE) { diff --git a/src/app/static-pages/automation-static/automation-static.component.ts b/src/app/static-pages/automation-static/automation-static.component.ts index 29ebe5612851..53a1dd5adcae 100644 --- a/src/app/static-pages/automation-static/automation-static.component.ts +++ b/src/app/static-pages/automation-static/automation-static.component.ts @@ -13,6 +13,7 @@ import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators' import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.component'; import { Location } from '@angular/common'; +import { ProjectUser } from 'app/models/project-user'; import { RoleService } from 'app/services/role.service'; @Component({ selector: 'appdashboard-automation-static', @@ -140,14 +141,12 @@ export class AutomationStaticComponent extends PricingBaseComponent implements O getProjectUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.USER_ROLE = user_role; + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.USER_ROLE = projectUser.role; this.logger.log('[AUTOMATION-COMP-STATIC] - PROJECT USER ROLE: ', this.USER_ROLE); - }); + } + }); } getBrowserLang() { diff --git a/src/app/static-pages/bots-static/bots-static.component.ts b/src/app/static-pages/bots-static/bots-static.component.ts index b322223b5b60..431e1c61055a 100644 --- a/src/app/static-pages/bots-static/bots-static.component.ts +++ b/src/app/static-pages/bots-static/bots-static.component.ts @@ -3,6 +3,7 @@ import { Router } from '@angular/router'; import { TranslateService } from '@ngx-translate/core'; import { AuthService } from 'app/core/auth.service'; import { NotifyService } from 'app/core/notify.service'; +import { ProjectUser } from 'app/models/project-user'; import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.component'; import { LoggerService } from 'app/services/logger/logger.service'; import { ProjectPlanService } from 'app/services/project-plan.service'; @@ -77,13 +78,11 @@ export class BotsStaticComponent extends PricingBaseComponent implements OnInit } getProjectUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.USER_ROLE = user_role; - this.logger.log('[BOTS-STATIC] - PROJECT USER ROLE: ', this.USER_ROLE); + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.USER_ROLE = projectUser.role; + this.logger.log('[BOTS-STATIC] - PROJECT USER ROLE: ', this.USER_ROLE); + } }); } diff --git a/src/app/static-pages/canned-responses-static/canned-responses-static.component.ts b/src/app/static-pages/canned-responses-static/canned-responses-static.component.ts index 5df766293031..d12cf4d23a55 100644 --- a/src/app/static-pages/canned-responses-static/canned-responses-static.component.ts +++ b/src/app/static-pages/canned-responses-static/canned-responses-static.component.ts @@ -13,6 +13,7 @@ import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators' import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.component'; import { Location } from '@angular/common'; +import { ProjectUser } from 'app/models/project-user'; import { RoleService } from 'app/services/role.service'; @Component({ @@ -137,14 +138,12 @@ export class CannedResponsesStaticComponent extends PricingBaseComponent impleme } getProjectUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.USER_ROLE = user_role; + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.USER_ROLE = projectUser.role; this.logger.log('[CANNED-RES-STATIC] - PROJECT USER ROLE: ', this.USER_ROLE); - }); + } + }); } diff --git a/src/app/static-pages/contacts-static/contacts-static.component.ts b/src/app/static-pages/contacts-static/contacts-static.component.ts index 7ab714a8433a..cf3cc69ce578 100644 --- a/src/app/static-pages/contacts-static/contacts-static.component.ts +++ b/src/app/static-pages/contacts-static/contacts-static.component.ts @@ -13,6 +13,7 @@ import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.comp import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators' import { Location } from '@angular/common'; +import { ProjectUser } from 'app/models/project-user'; @Component({ selector: 'appdashboard-contacts-static', @@ -127,14 +128,12 @@ export class ContactsStaticComponent extends PricingBaseComponent implements OnI } getProjectUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.USER_ROLE = user_role; - this.logger.log('[CNTCTS-STATIC] - PROJECT USER ROLE: ', this.USER_ROLE); - }); + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.USER_ROLE = projectUser.role; + this.logger.log('[CNTCTS-STATIC] - PROJECT USER ROLE: ', this.USER_ROLE); + } + }); } getBrowserLang() { diff --git a/src/app/static-pages/departments-static/departments-static.component.ts b/src/app/static-pages/departments-static/departments-static.component.ts index 32cf3613cabc..27935cf9ec37 100755 --- a/src/app/static-pages/departments-static/departments-static.component.ts +++ b/src/app/static-pages/departments-static/departments-static.component.ts @@ -13,6 +13,7 @@ import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.comp import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators' import { Location } from '@angular/common'; +import { ProjectUser } from 'app/models/project-user'; import { RoleService } from 'app/services/role.service'; const swal = require('sweetalert'); @@ -149,14 +150,12 @@ export class DepartmentsStaticComponent extends PricingBaseComponent implements getProjectUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.USER_ROLE = user_role; + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.USER_ROLE = projectUser.role; this.logger.log('[DEPTS-STATIC] - PROJECT USER ROLE: ', this.USER_ROLE); - }); + } + }); } getBrowserLang() { diff --git a/src/app/static-pages/email-ticketing-static/email-ticketing-static.component.ts b/src/app/static-pages/email-ticketing-static/email-ticketing-static.component.ts index 3ff6923806d4..0b459b09f0e2 100644 --- a/src/app/static-pages/email-ticketing-static/email-ticketing-static.component.ts +++ b/src/app/static-pages/email-ticketing-static/email-ticketing-static.component.ts @@ -13,6 +13,7 @@ import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.comp import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { Location } from '@angular/common'; +import { ProjectUser } from 'app/models/project-user'; import { RoleService } from 'app/services/role.service'; @Component({ @@ -130,14 +131,12 @@ export class EmailTicketingStaticComponent extends PricingBaseComponent implemen } getProjectUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.USER_ROLE = user_role; + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.USER_ROLE = projectUser.role; this.logger.log('[EMAIL-TKTNG-STATIC] - PROJECT USER ROLE: ', this.USER_ROLE); - }); + } + }); } diff --git a/src/app/static-pages/groups-static/groups-static.component.ts b/src/app/static-pages/groups-static/groups-static.component.ts index b98a4693695a..254263ddb5e9 100755 --- a/src/app/static-pages/groups-static/groups-static.component.ts +++ b/src/app/static-pages/groups-static/groups-static.component.ts @@ -13,6 +13,7 @@ import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators' import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.component'; import { Location } from '@angular/common'; +import { ProjectUser } from 'app/models/project-user'; import { RoleService } from 'app/services/role.service'; const swal = require('sweetalert'); @@ -143,14 +144,12 @@ export class GroupsStaticComponent extends PricingBaseComponent implements OnIni } getProjectUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.USER_ROLE = user_role; + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.USER_ROLE = projectUser.role; this.logger.log('[GROUPS-STATIC] - PROJECT USER ROLE: ', this.USER_ROLE); - }); + } + }); } getBrowserLang() { diff --git a/src/app/static-pages/hours-static/hours-static.component.ts b/src/app/static-pages/hours-static/hours-static.component.ts index ffe9d2f0c625..2c0d3c190f8d 100755 --- a/src/app/static-pages/hours-static/hours-static.component.ts +++ b/src/app/static-pages/hours-static/hours-static.component.ts @@ -13,6 +13,7 @@ import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.comp import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { Location } from '@angular/common'; +import { ProjectUser } from 'app/models/project-user'; import { RoleService } from 'app/services/role.service'; const swal = require('sweetalert'); @@ -131,14 +132,12 @@ export class HoursStaticComponent extends PricingBaseComponent implements OnInit getProjectUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.USER_ROLE = user_role; + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.USER_ROLE = projectUser.role; this.logger.log('[HOURS-STATIC] - PROJECT USER ROLE: ', this.USER_ROLE); - }); + } + }); } goBack() { diff --git a/src/app/static-pages/trigger-static/trigger-static.component.ts b/src/app/static-pages/trigger-static/trigger-static.component.ts index 9424bacf0565..45d8d512f4d8 100755 --- a/src/app/static-pages/trigger-static/trigger-static.component.ts +++ b/src/app/static-pages/trigger-static/trigger-static.component.ts @@ -9,6 +9,7 @@ import { UsersService } from '../../services/users.service'; import { LoggerService } from '../../services/logger/logger.service'; import { AppConfigService } from 'app/services/app-config.service'; import { PLAN_NAME } from 'app/utils/util'; +import { ProjectUser } from 'app/models/project-user'; const swal = require('sweetalert'); @Component({ @@ -96,9 +97,11 @@ export class TriggerStaticComponent implements OnInit, OnDestroy { } getProjectUserRole() { - this.usersService.project_user_role_bs.subscribe((user_role) => { - this.USER_ROLE = user_role; - this.logger.log('[TRIGGER-STATIC] - PROJECT USER ROLE: ', this.USER_ROLE); + this.usersService.projectUser_bs.subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.USER_ROLE = projectUser.role; + this.logger.log('[TRIGGER-STATIC] - PROJECT USER ROLE: ', this.USER_ROLE); + } }); } diff --git a/src/app/static-pages/wsrequests-static/wsrequests-static.component.ts b/src/app/static-pages/wsrequests-static/wsrequests-static.component.ts index 4e37ddc472a0..bf6da237ea7a 100644 --- a/src/app/static-pages/wsrequests-static/wsrequests-static.component.ts +++ b/src/app/static-pages/wsrequests-static/wsrequests-static.component.ts @@ -14,6 +14,7 @@ import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators' import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.component'; import { Location } from '@angular/common'; +import { ProjectUser } from 'app/models/project-user'; @Component({ selector: 'appdashboard-wsrequests-static', templateUrl: './wsrequests-static.component.html', @@ -135,14 +136,12 @@ export class WsrequestsStaticComponent extends PricingBaseComponent implements O } getProjectUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.USER_ROLE = user_role; + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.USER_ROLE = projectUser.role; this.logger.log('[WSREQUEST-STATIC] - PROJECT USER ROLE: ', this.USER_ROLE); - }); + } + }); } diff --git a/src/app/ui/notification-message/notification-message.component.ts b/src/app/ui/notification-message/notification-message.component.ts index b7bd6f1295aa..1845e2aa5a3f 100755 --- a/src/app/ui/notification-message/notification-message.component.ts +++ b/src/app/ui/notification-message/notification-message.component.ts @@ -14,6 +14,7 @@ import { UsersService } from '../../services/users.service'; import { takeUntil } from 'rxjs/operators'; import { PLAN_NAME } from 'app/utils/util'; import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.component'; +import { ProjectUser } from 'app/models/project-user'; const swal = require('sweetalert'); @Component({ selector: 'notification-message', @@ -85,27 +86,18 @@ export class NotificationMessageComponent extends PricingBaseComponent implement // this.getProjectById(); this.translateMsgSubscriptionCanceledSuccessfully(); this.translateMsgSubscriptionCanceledError(); - this.getUserRole(); + this.getProjectUser(); this.getCurrentUser() this.getProjectPlan(); this.getWidgetUrl(); this.getChatUrl(); this.translateModalOnlyOwnerCanManageProjectAccount(); - this.getUserAvailability() } ngOnDestroy() { // this.subscription.unsubscribe(); } - getUserAvailability() { - this.usersService.user_is_available_bs.subscribe((user_available) => { - this.IS_AVAILABLE = user_available; - this.logger.log('[NAVBAR]- USER IS AVAILABLE ', this.IS_AVAILABLE); - }); - } - - translateModalOnlyOwnerCanManageProjectAccount() { this.translate.get('OnlyUsersWithTheOwnerRoleCanManageTheAccountPlan') .subscribe((translation: any) => { @@ -119,17 +111,17 @@ export class NotificationMessageComponent extends PricingBaseComponent implement } - getUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((userRole) => { + getProjectUser() { + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + this.logger.log('[NOTIFICATION-MSG] - SUBSCRIPTION TO USER ROLE »»» ', projectUser) + if(projectUser){ + // used to display / hide 'WIDGET' and 'ANALITCS' in home.component.html + this.USER_ROLE = projectUser.role; - this.logger.log('[NOTIFICATION-MSG] - SUBSCRIPTION TO USER ROLE »»» ', userRole) - // used to display / hide 'WIDGET' and 'ANALITCS' in home.component.html - this.USER_ROLE = userRole; - }) + this.IS_AVAILABLE = projectUser.user_available; + this.logger.log('[NAVBAR]- USER IS AVAILABLE ', this.IS_AVAILABLE); + } + }) } getChatUrl() { diff --git a/src/app/user-edit-add/user-edit-add.component.ts b/src/app/user-edit-add/user-edit-add.component.ts index 37fa4fd2973e..ae67ad375bf5 100755 --- a/src/app/user-edit-add/user-edit-add.component.ts +++ b/src/app/user-edit-add/user-edit-add.component.ts @@ -17,6 +17,7 @@ import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { LoggerService } from '../services/logger/logger.service'; import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.component'; +import { ProjectUser } from 'app/models/project-user'; const swal = require('sweetalert'); @Component({ @@ -311,11 +312,10 @@ export class UserEditAddComponent extends PricingBaseComponent implements OnInit } getUserRole() { - this.subscription = this.usersService.project_user_role_bs.subscribe((userRole) => { - - this.logger.log('[USER-EDIT-ADD] - PROJECT-USER DETAILS - CURRENT USER ROLE »»» ', userRole) + this.subscription = this.usersService.projectUser_bs.subscribe((projectUser: ProjectUser) => { + this.logger.log('[USER-EDIT-ADD] - PROJECT-USER DETAILS - CURRENT USER ROLE »»» ', projectUser) // used to display / hide 'WIDGET' and 'ANALITCS' in home.component.html - this.CURRENT_USER_ROLE = userRole; + this.CURRENT_USER_ROLE = projectUser.role; }) } diff --git a/src/app/user-profile/account-settings/account-settings.component.ts b/src/app/user-profile/account-settings/account-settings.component.ts index 02c54499a033..64baa3e2cd86 100755 --- a/src/app/user-profile/account-settings/account-settings.component.ts +++ b/src/app/user-profile/account-settings/account-settings.component.ts @@ -15,6 +15,7 @@ import { APP_SUMO_PLAN_NAME, PLAN_NAME } from 'app/utils/util'; import { NotifyService } from 'app/core/notify.service'; import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.component'; import { BrandService } from 'app/services/brand.service'; +import { ProjectUser } from 'app/models/project-user'; const swal = require('sweetalert'); const Swal = require('sweetalert2') @@ -160,16 +161,12 @@ export class AccountSettingsComponent extends PricingBaseComponent implements On getProjectUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.logger.log('[USER-PROFILE][ACCOUNT-SETTINGS] - USER ROLE ', user_role); - if (user_role) { - this.USER_ROLE = user_role - } - }); + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + this.logger.log('[USER-PROFILE][ACCOUNT-SETTINGS] - USER ROLE ', projectUser); + if (projectUser) { + this.USER_ROLE = projectUser.role + } + }); } diff --git a/src/app/user-profile/notification-settings/notification-settings.component.ts b/src/app/user-profile/notification-settings/notification-settings.component.ts index 0756f502094d..53a6f2b26afe 100755 --- a/src/app/user-profile/notification-settings/notification-settings.component.ts +++ b/src/app/user-profile/notification-settings/notification-settings.component.ts @@ -9,6 +9,7 @@ import { Location } from '@angular/common'; import { Component, OnInit } from '@angular/core'; import { LoggerService } from './../../services/logger/logger.service'; import { BrandService } from 'app/services/brand.service'; +import { ProjectUser } from 'app/models/project-user'; @Component({ selector: 'appdashboard-notification-settings', templateUrl: './notification-settings.component.html', @@ -119,10 +120,10 @@ export class NotificationSettingsComponent implements OnInit { } checkCurrentStatus() { - this.usersService.project_user_id_bs.subscribe((project_user_id) => { + this.usersService.projectUser_bs.subscribe((projectUser: ProjectUser) => { - this.logger.log("[USER-PROFILE][NOTIFICATION-SETTINGS] - CHECK NOTIFICATION checkCurrentStatus: ", project_user_id); - this.notificationService.checkNotificationsStatus(project_user_id).subscribe((result: any) => { + this.logger.log("[USER-PROFILE][NOTIFICATION-SETTINGS] - CHECK NOTIFICATION checkCurrentStatus: ", projectUser._id); + this.notificationService.checkNotificationsStatus(projectUser._id).subscribe((result: any) => { this.logger.log("[USER-PROFILE][NOTIFICATION-SETTINGS] - CHECK NOTIFICATION STATUS RESULT: ", result); if (result.settings) { diff --git a/src/app/user-profile/user-profile.component.ts b/src/app/user-profile/user-profile.component.ts index 7b3982e15c9b..bcf1fe8f1e40 100755 --- a/src/app/user-profile/user-profile.component.ts +++ b/src/app/user-profile/user-profile.component.ts @@ -21,6 +21,7 @@ import { ProjectPlanService } from 'app/services/project-plan.service'; import { DomSanitizer } from '@angular/platform-browser'; import { PricingBaseComponent } from 'app/pricing/pricing-base/pricing-base.component'; import { BrandService } from 'app/services/brand.service'; +import { ProjectUser } from 'app/models/project-user'; const swal = require('sweetalert'); const Swal = require('sweetalert2') @@ -513,16 +514,11 @@ export class UserProfileComponent extends PricingBaseComponent implements OnInit } getProjectUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.logger.log('[USER-PROFILE] - USER ROLE ', user_role); - if (user_role) { + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + this.logger.log('[USER-PROFILE] - USER ROLE ', projectUser); + if (projectUser) { // this.userRole = user_role - - this.translate.get(user_role) + this.translate.get(projectUser.role) .subscribe((text: string) => { this.userRole = text; }); diff --git a/src/app/users/users.component.ts b/src/app/users/users.component.ts index d273688d7ba0..2ddc59992aef 100755 --- a/src/app/users/users.component.ts +++ b/src/app/users/users.component.ts @@ -378,14 +378,12 @@ export class UsersComponent extends PricingBaseComponent implements OnInit, Afte } getProjectUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.USER_ROLE = user_role + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.USER_ROLE = projectUser.role this.logger.log('[USERS] - GET PROJECT USER ROLE - USER_ROLE : ', this.USER_ROLE) - }) + } + }) } getBrowserVersion() { diff --git a/src/app/utils/util.ts b/src/app/utils/util.ts index bd7a1115b266..29fa7bd7e35d 100755 --- a/src/app/utils/util.ts +++ b/src/app/utils/util.ts @@ -436,13 +436,21 @@ export enum KB_MAX_NUM { Custom = 1000 }; +// export const PLANS_LIST = { +// FREE_TRIAL: { requests: 200, messages: 0, tokens: 100000, email: 200, chatbots: 20, namespace: 3, kbs: 50 }, // same as PREMIUM +// Sandbox: { requests: 200, messages: 0, tokens: 100000, email: 200, chatbots: 2, namespace: 1, kbs: 50 }, +// Basic: { requests: 800, messages: 0, tokens: 2000000, email: 200, chatbots: 5, namespace: 1, kbs: 150 }, +// Premium: { requests: 3000, messages: 0, tokens: 5000000, email: 200, chatbots: 20, namespace: 3, kbs: 300 }, +// Team: { requests: 5000, messages: 0, tokens: 10000000, email: 200, chatbots: 50, namespace: 10, kbs: 1000 }, +// Custom: { requests: 5000, messages: 0, tokens: 10000000, email: 200, chatbots: 50, namespace: 10, kbs: 1000 } +// } export const PLANS_LIST = { - FREE_TRIAL: { requests: 200, messages: 0, tokens: 100000, email: 200, chatbots: 20, namespace: 3, kbs: 50 }, // same as PREMIUM - Sandbox: { requests: 200, messages: 0, tokens: 100000, email: 200, chatbots: 2, namespace: 1, kbs: 50 }, - Basic: { requests: 800, messages: 0, tokens: 2000000, email: 200, chatbots: 5, namespace: 1, kbs: 150 }, - Premium: { requests: 3000, messages: 0, tokens: 5000000, email: 200, chatbots: 20, namespace: 3, kbs: 300 }, - Team: { requests: 5000, messages: 0, tokens: 10000000, email: 200, chatbots: 50, namespace: 10, kbs: 1000 }, - Custom: { requests: 5000, messages: 0, tokens: 10000000, email: 200, chatbots: 50, namespace: 10, kbs: 1000 } + FREE_TRIAL: { requests: 200, messages: 0, tokens: 100000, voice_duration: 0, email: 200, chatbots: 20, namespace: 3, kbs: 50 }, // same as PREMIUM + Sandbox: { requests: 200, messages: 0, tokens: 100000, voice_duration: 0, email: 200, chatbots: 2, namespace: 1, kbs: 50 }, + Basic: { requests: 800, messages: 0, tokens: 2000000, voice_duration: 0, email: 200, chatbots: 5, namespace: 1, kbs: 150 }, + Premium: { requests: 3000, messages: 0, tokens: 5000000, voice_duration: 0, email: 200, chatbots: 20, namespace: 3, kbs: 300 }, + Team: { requests: 5000, messages: 0, tokens: 10000000, voice_duration: 0, email: 200, chatbots: 50, namespace: 10, kbs: 1000 }, + Custom: { requests: 5000, messages: 0, tokens: 10000000, voice_duration: 120000, email: 200, chatbots: 50, namespace: 10, kbs: 1000 }, } // Basic plan @@ -596,6 +604,8 @@ export function goToCDSVersion(router: any, chatbot: Chatbot, project_id, redire } } + + export function goToCDSSettings(router: any, chatbot: Chatbot, project_id, redirectBaseUrl: string) { // router.navigate(['project/' + project_id + '/cds/',chatbot._id, 'intent', '0']); @@ -876,6 +886,9 @@ export function isMaliciousHTML(input) { return false; // No XSS detected } +// Projects created after this date will no longer be able to use the free plan when the trial expires. +export const freePlanLimitDate: Date = new Date('2025-01-16T00:00:00'); + // Links to documentation export const URL_understanding_default_roles = 'https://gethelp.tiledesk.com/articles/understanding-default-roles/' // 'https://docs.tiledesk.com/knowledge-base/understanding-default-roles/' diff --git a/src/app/widget_components/widget-set-up/widget-set-up.component.scss b/src/app/widget_components/widget-set-up/widget-set-up.component.scss index cc5b7f069527..a6fa86104077 100755 --- a/src/app/widget_components/widget-set-up/widget-set-up.component.scss +++ b/src/app/widget_components/widget-set-up/widget-set-up.component.scss @@ -3052,7 +3052,6 @@ pre { .btn-get-feature-no-boxshadow { margin-top: 15px; - margin-bottom: 15px; font-size: 12px; letter-spacing: 1px; background: transparent; diff --git a/src/app/widget_components/widget-set-up/widget-set-up.component.ts b/src/app/widget_components/widget-set-up/widget-set-up.component.ts index 53072582b479..61bea1a2aa56 100755 --- a/src/app/widget_components/widget-set-up/widget-set-up.component.ts +++ b/src/app/widget_components/widget-set-up/widget-set-up.component.ts @@ -37,6 +37,7 @@ import { isDevMode } from '@angular/core'; import { SelectOptionsTranslatePipe } from '../../selectOptionsTranslate.pipe'; import { AnalyticsService } from 'app/services/analytics.service'; import { LocalDbService } from 'app/services/users-local-db.service'; +import { ProjectUser } from 'app/models/project-user'; @Component({ selector: 'appdashboard-widget-set-up', @@ -1365,17 +1366,12 @@ export class WidgetSetUp extends WidgetSetUpBaseComponent implements OnInit, Aft getProjectUserRole() { // const user___role = this.usersService.project_user_role_bs.value; // this.logger.log('[NAVBAR] % »»» WebSocketJs WF +++++ ws-requests--- navbar - USER ROLE 1 ', user___role); - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.logger.log('[NAVBAR] % »»» WebSocketJs WF +++++ ws-requests--- navbar - USER ROLE 2', user_role); - if (user_role) { - this.USER_ROLE = user_role - - } - }); + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + this.logger.log('[NAVBAR] % »»» WebSocketJs WF +++++ ws-requests--- navbar - USER ROLE 2', projectUser); + if (projectUser) { + this.USER_ROLE = projectUser.role + } + }); } getLoggedUser() { diff --git a/src/app/ws_requests/for-panel/ws-request-detail-for-panel/ws-request-detail-for-panel.component.ts b/src/app/ws_requests/for-panel/ws-request-detail-for-panel/ws-request-detail-for-panel.component.ts index ed0588985bd7..976278222fa4 100755 --- a/src/app/ws_requests/for-panel/ws-request-detail-for-panel/ws-request-detail-for-panel.component.ts +++ b/src/app/ws_requests/for-panel/ws-request-detail-for-panel/ws-request-detail-for-panel.component.ts @@ -24,6 +24,7 @@ import { LoggerService } from '../../../services/logger/logger.service'; // import * as moment from 'moment'; import moment from "moment"; import { WebSocketJs } from 'app/services/websocket/websocket-js'; +import { ProjectUser } from 'app/models/project-user'; @Component({ selector: 'appdashboard-ws-request-detail-for-panel', templateUrl: './ws-request-detail-for-panel.component.html', @@ -176,18 +177,11 @@ export class WsRequestDetailForPanelComponent extends WsSharedComponent implemen getProjectUserRole() { // const user___role = this.usersService.project_user_role_bs.value; // this.logger.log('[NAVBAR] % »»» WebSocketJs WF +++++ ws-requests--- navbar - USER ROLE 1 ', user___role); - - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.logger.log('[REQUEST-DTLS-X-PANEL] USER ROLE ', user_role); - if (user_role) { - - if (user_role === 'agent') { + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + this.logger.log('[REQUEST-DTLS-X-PANEL] USER ROLE ', projectUser); + if (projectUser) { + if (projectUser.role === 'agent') { this.ROLE_IS_AGENT = true; - } else { this.ROLE_IS_AGENT = false; } diff --git a/src/app/ws_requests/for-panel/ws-requests-unserved-for-panel/ws-requests-unserved-for-panel.component.html b/src/app/ws_requests/for-panel/ws-requests-unserved-for-panel/ws-requests-unserved-for-panel.component.html index 0727143e1138..343af35942da 100755 --- a/src/app/ws_requests/for-panel/ws-requests-unserved-for-panel/ws-requests-unserved-for-panel.component.html +++ b/src/app/ws_requests/for-panel/ws-requests-unserved-for-panel/ws-requests-unserved-for-panel.component.html @@ -1,4 +1,3 @@ - diff --git a/src/app/ws_requests/for-panel/ws-requests-unserved-for-panel/ws-requests-unserved-for-panel.component.ts b/src/app/ws_requests/for-panel/ws-requests-unserved-for-panel/ws-requests-unserved-for-panel.component.ts index 635d1791fb73..ef4d632a2d68 100755 --- a/src/app/ws_requests/for-panel/ws-requests-unserved-for-panel/ws-requests-unserved-for-panel.component.ts +++ b/src/app/ws_requests/for-panel/ws-requests-unserved-for-panel/ws-requests-unserved-for-panel.component.ts @@ -28,6 +28,7 @@ const swal = require('sweetalert'); import { ContactsService } from '../../../services/contacts.service'; import { LoggerService } from '../../../services/logger/logger.service'; import { WebSocketJs } from 'app/services/websocket/websocket-js'; +import { ProjectUser } from 'app/models/project-user'; @Component({ selector: 'appdashboard-ws-requests-unserved-for-panel', @@ -202,14 +203,12 @@ export class WsRequestsUnservedForPanelComponent extends WsSharedComponent imple getUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((userRole) => { - this.logger.log('[WS-REQUESTS-UNSERVED-X-PANEL] - SUBSCRIPTION TO USER ROLE »»» ', userRole) - this.USER_ROLE = userRole; - }) + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + if(projectUser){ + this.logger.log('[WS-REQUESTS-UNSERVED-X-PANEL] - SUBSCRIPTION TO USER ROLE »»» ', projectUser) + this.USER_ROLE = projectUser.role; + } + }) } // ------------------------------------------ @@ -438,29 +437,24 @@ export class WsRequestsUnservedForPanelComponent extends WsSharedComponent imple } getProjectUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.logger.log('[WS-REQUESTS-UNSERVED-X-PANEL] - GET PROJECT-USER ROLE user_role ', user_role); - - this.ONLY_MY_REQUESTS = true - this.getWsRequests$(); - // if (user_role) { - // if (user_role === 'agent') { - // this.ROLE_IS_AGENT = true - // // this.displayBtnLabelSeeYourRequets = true - // // ------ - // this.ONLY_MY_REQUESTS = true - // this.getWsRequests$(); - // } else { - // this.ROLE_IS_AGENT = false - // // this.displayBtnLabelSeeYourRequets = false; - // this.getWsRequests$(); - // } - // } - }); + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + this.logger.log('[WS-REQUESTS-UNSERVED-X-PANEL] - GET PROJECT-USER ROLE user_role ', projectUser); + this.ONLY_MY_REQUESTS = true + this.getWsRequests$(); + // if (user_role) { + // if (user_role === 'agent') { + // this.ROLE_IS_AGENT = true + // // this.displayBtnLabelSeeYourRequets = true + // // ------ + // this.ONLY_MY_REQUESTS = true + // this.getWsRequests$(); + // } else { + // this.ROLE_IS_AGENT = false + // // this.displayBtnLabelSeeYourRequets = false; + // this.getWsRequests$(); + // } + // } + }); } diff --git a/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.html b/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.html index 021dfd18dcae..8b0055b80afa 100755 --- a/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.html +++ b/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.html @@ -482,19 +482,30 @@ + + +
    + + help_outline +
    @@ -668,12 +679,12 @@
    @@ -1009,11 +1020,17 @@ - + {{ 'HistoryPage.Requester' | translate }} + @@ -1575,6 +1592,7 @@ + @@ -1588,6 +1606,7 @@ + @@ -1675,7 +1694,7 @@ + width: 1%; display: none;" > @@ -1684,7 +1703,7 @@ [ngClass]=" {'requester_fullname_undefined' : !request?.lead?.fullname, 'requester-avatar--in-history-phone-number': request?.lead?.fullname === request?.lead?.phone, - 'requester-avatar--in-history-not-has-phone-number': (request?.channel?.name === CHANNELS_NAME.VOICE_VXML || request?.channel?.name === CHANNELS_NAME.VOICE_TWILIO) && !request?.lead?.phone }"> + 'requester-avatar--in-history-not-has-phone-number': (request?.channel?.name === CHANNELS_NAME.VOICE_VXML || request?.channel?.name === CHANNELS_NAME.VOICE_TWILIO) && !request?.lead?.phone && !request?.lead?.email }"> @@ -1745,13 +1764,13 @@ - + + 'requester-verified-no-phone-num': (request?.channel?.name === CHANNELS_NAME.VOICE_VXML || request?.channel?.name === CHANNELS_NAME.VOICE_TWILIO) && !request?.lead?.phone && !request?.lead?.email}"> {{ request?.lead?.fullname }} @@ -1789,6 +1808,113 @@ + + +
    +
    +
    + + {{ request?.requester_fullname_initial }} + + + call + + + + + {{ request?.requester_fullname_initial }} + + +
    + + + + + + +
    +
    +
    + +
    + +
    + + + {{ request?.lead?.fullname}} + + + + N/A + +
    + +
    +
    + + @@ -2283,9 +2409,12 @@ {{ request?.createdAt | date: 'd/M/y HH:mm:ss' }} --> - + timer diff --git a/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.scss b/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.scss index 9ccb2518a899..dd65cf0ea950 100755 --- a/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.scss +++ b/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.scss @@ -512,6 +512,87 @@ p.member:hover { // color: #566787; } + +/* new style for Requester +/* ********************* */ + +.requester-avatar-and-lead-data-wpr { + display: flex; + flex-direction: row; + align-items: center; +} + +.requester-avatar-wrapper { + position: relative; +} +.requester---avatar { + border-radius: 50%; + font-size: 12px; + font-weight: 400; + text-align: center; + padding-top: 5px; + padding-bottom: 3px; + display: inline-block; + width: 30px; + height: 30px; + line-height: 21px; + position: relative; + // top: 4px; + margin-right: 4px; +} + +.verified-user-icon-wpr { + position: absolute; + top: -2px; + left: -6px; +} + +.verified-user-icon-wpr>span { + font-size: 16px; + color: #18BDF7 +} + + +.lead-data-wpr { + white-space: nowrap; + display: flex; + flex-direction: column; + justify-content: center; + gap: 5px; +} + +.requester---fullname { + max-width: 150px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + // display: inline-block; + // line-height: 13px; +} + +.requester---email { + color: #7695a5; + font-weight: 400; + line-height: 18px; + font-size: 11px; + display: block; + // margin-left: 34px; + margin-top: -8px; + max-width: 150px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + text-transform: lowercase; +} + + +.requester-fullname-is-phone { + position: relative; + top: 3px !important; +} + +/* ********************* */ + .column-td { font-size: 12px; font-weight: 400; @@ -959,7 +1040,7 @@ p.member:hover { background-color: #2d323e !important; font-size: 11px !important; border-radius: 2px !important; - font-family: 'Poppins', 'Roboto', 'Arial', sans-serif !important; + font-family: var(--header-font-family) !important; padding-top: 6px !important; padding-bottom: 6px !important; } @@ -968,12 +1049,13 @@ p.member:hover { background-color: #fff !important; font-size: 11px !important; border-radius: 2px !important; - font-family: 'Poppins', 'Roboto', 'Arial', sans-serif !important; + font-family: var(--header-font-family) !important; padding-top: 5px !important; padding-bottom: 5px !important; border: 1px solid #ccc; color: #000 !important; font-weight: 400 !important; + line-height: 1.5em; } @@ -991,7 +1073,18 @@ p.member:hover { .preflight-checkbox { margin-left: 15px; - margin-top: 30px; + margin-top: 20px; + display: flex; + flex-direction: row; + align-items: center; + gap: 6px; +} + +.preflight-checkbox>.help-icon-wpr>i { + font-size: 18px; + color: #7695a5; + cursor: pointer; + vertical-align: middle; } @@ -1035,7 +1128,7 @@ p.member:hover { top: 2px; } -.no-agent > span{ +.no-agent>span { width: 30px; cursor: pointer; height: 30px; @@ -1047,10 +1140,10 @@ p.member:hover { /* No more used /* ********************************** */ -.no-agent > span > svg{ - fill:var( --icon-color) // #8796af +.no-agent>span>svg { + fill: var(--icon-color) // #8796af } -.no-agent > span > svg > g > path{ - fill:var(--svg-icon-gray) // #8796af +.no-agent>span>svg>g>path { + fill: var(--svg-icon-gray) // #8796af } \ No newline at end of file diff --git a/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.ts b/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.ts index 8d8b52ac42f6..27ec6350b03d 100755 --- a/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.ts +++ b/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.ts @@ -32,6 +32,7 @@ import { WsMsgsService } from 'app/services/websocket/ws-msgs.service'; import { FormGroup, FormControl } from '@angular/forms'; import { MAT_DATE_FORMATS } from '@angular/material/core'; import { BrandService } from 'app/services/brand.service'; +import { ProjectUser } from 'app/models/project-user'; export const MY_DATE_FORMATS = { parse: { @@ -401,28 +402,6 @@ export class HistoryAndNortConvsComponent extends WsSharedComponent implements O } - getProjectUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.logger.log('[HISTORY & NORT-CONVS] - USER ROLE ', user_role); - if (user_role) { - this.USER_ROLE = user_role - this.manageStatusInHistoryForAgentAndExpiredPlan(this.USER_ROLE) - } - if (user_role) { - if (user_role === 'agent') { - this.ROLE_IS_AGENT = true - - } else { - this.ROLE_IS_AGENT = false - } - } - }); - } - manageStatusInHistoryForAgentAndExpiredPlan(USER_ROLE) { this.logger.log('[HISTORY & NORT-CONVS] manageStatusInHistoryForAgentAndExpiredPlan statusInHistory', this.statusInHistory) if (USER_ROLE === 'agent') { @@ -796,7 +775,9 @@ export class HistoryAndNortConvsComponent extends WsSharedComponent implements O ngOnDestroy() { - this.subscription.unsubscribe(); + if (this.subscription) { + this.subscription.unsubscribe(); + } // if (this.requestList.length > 0) { // this.requestList.forEach(request => { @@ -1492,8 +1473,13 @@ export class HistoryAndNortConvsComponent extends WsSharedComponent implements O let newFillColour = ''; if (request.lead && request.lead.fullname) { + this.logger.log('request.lead.fullname', request.lead.fullname) + this.logger.log('request.lead.fullname is a number', !isNaN(Number(request.lead.fullname)) ) newInitials = avatarPlaceholder(request.lead.fullname); newFillColour = getColorBck(request.lead.fullname) + if (!isNaN(Number(request.lead.fullname))) { + request['fullnameIsNumber'] = true + } } else { newInitials = 'N/A'; newFillColour = 'rgb(98, 100, 167)'; @@ -1626,6 +1612,20 @@ export class HistoryAndNortConvsComponent extends WsSharedComponent implements O } + getProjectUserRole() { + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + this.logger.log('[HISTORY & NORT-CONVS] - USER ROLE ', projectUser); + if (projectUser) { + this.USER_ROLE = projectUser.role + this.manageStatusInHistoryForAgentAndExpiredPlan(this.USER_ROLE) + if (this.USER_ROLE === 'agent') { + this.ROLE_IS_AGENT = true + } else { + this.ROLE_IS_AGENT = false + } + } + }); + } // requestWillBePermanentlyDeleted @@ -2566,7 +2566,8 @@ export class HistoryAndNortConvsComponent extends WsSharedComponent implements O // this.conversationTypeValue = ''; // } - + + if (this.requester_email) { this.emailValue = this.requester_email; @@ -2991,12 +2992,12 @@ export class HistoryAndNortConvsComponent extends WsSharedComponent implements O // SERVED_BY: add this if not exist --> getProjectuserbyUseridAndGoToEditProjectuser(member_id: string) { this.usersService.getProjectUserByUserId(member_id) - .subscribe((projectUser: any) => { + .subscribe((projectUser: ProjectUser) => { this.logger.log('[HISTORY & NORT-CONVS] GET projectUser by USER-ID ', projectUser) if (projectUser) { - this.logger.log('[HISTORY & NORT-CONVS] GET projectUser by USER-ID > projectUser id', projectUser[0]._id); + this.logger.log('[HISTORY & NORT-CONVS] GET projectUser by USER-ID > projectUser id', projectUser._id); - this.router.navigate(['project/' + this.projectId + '/user/edit/' + projectUser[0]._id]); + this.router.navigate(['project/' + this.projectId + '/user/edit/' + projectUser._id]); } }, (error) => { this.logger.error('[HISTORY & NORT-CONVS] GET projectUser by USER-ID - ERROR ', error); diff --git a/src/app/ws_requests/ws-requests-list/ws-requests-list.component.ts b/src/app/ws_requests/ws-requests-list/ws-requests-list.component.ts index 0119f036d185..00b2cba72be9 100755 --- a/src/app/ws_requests/ws-requests-list/ws-requests-list.component.ts +++ b/src/app/ws_requests/ws-requests-list/ws-requests-list.component.ts @@ -547,15 +547,11 @@ export class WsRequestsListComponent extends WsSharedComponent implements OnInit getProjectUserRole() { // this.logger.log('[WS-REQUESTS-LIST] - GET PROJECT-USER ROLE calling getProjectUserRole '); - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { // this.logger.log('[WS-REQUESTS-LIST] - GET PROJECT-USER ROLE user_role ', user_role); - if (user_role) { - this.CURRENT_USER_ROLE = user_role; - if (user_role === 'agent') { + if (projectUser) { + this.CURRENT_USER_ROLE = projectUser.role; + if (this.CURRENT_USER_ROLE === 'agent') { this.ROLE_IS_AGENT = true this.displayBtnLabelSeeYourRequets = true @@ -1557,21 +1553,15 @@ export class WsRequestsListComponent extends WsSharedComponent implements OnInit return true } - - }); } } - - this.ws_requests.forEach((request) => { // this.logger.log('[WS-REQUESTS-LIST] - request ', request) - const user_agent_result = this.parseUserAgent(request.userAgent) // this.logger.log('[WS-REQUESTS-LIST] - request userAgent - USER-AGENT RESULT ', user_agent_result) - const ua_browser = user_agent_result.browser.name + ' ' + user_agent_result.browser.version request['ua_browser'] = ua_browser; @@ -1720,6 +1710,10 @@ export class WsRequestsListComponent extends WsSharedComponent implements OnInit request['requester_fullname_initial'] = avatarPlaceholder(request.lead.fullname); request['requester_fullname_fillColour'] = getColorBck(request.lead.fullname) request['requester_fullname'] = request.lead.fullname; + + if (!isNaN(Number(request.lead.fullname))) { + request['fullnameIsNumber'] = true + } } else { request['requester_fullname_initial'] = 'N/A'; request['requester_fullname_fillColour'] = '#6264a7'; diff --git a/src/app/ws_requests/ws-requests-list/ws-requests-served/ws-requests-served.component.html b/src/app/ws_requests/ws-requests-list/ws-requests-served/ws-requests-served.component.html index 29195de364a4..4bdf451d64d7 100755 --- a/src/app/ws_requests/ws-requests-list/ws-requests-served/ws-requests-served.component.html +++ b/src/app/ws_requests/ws-requests-list/ws-requests-served/ws-requests-served.component.html @@ -544,6 +544,21 @@

    + + + + + + + + {{'MessageChannel' | translate}}: + + SMS + + + + @@ -632,19 +647,19 @@

    {{ request?.requester_fullname_initial }} call - call - + --> {{ request?.requester_fullname_initial }} @@ -702,12 +717,20 @@

    - {{request?.lead?.phone}} + + + {{request?.lead?.email}} + + +

    diff --git a/src/app/ws_requests/ws-requests-list/ws-requests-served/ws-requests-served.component.ts b/src/app/ws_requests/ws-requests-list/ws-requests-served/ws-requests-served.component.ts index d1972647f94c..8c3036b493a0 100755 --- a/src/app/ws_requests/ws-requests-list/ws-requests-served/ws-requests-served.component.ts +++ b/src/app/ws_requests/ws-requests-list/ws-requests-served/ws-requests-served.component.ts @@ -26,6 +26,7 @@ import { MatMenuTrigger } from '@angular/material/menu'; const swal = require('sweetalert'); const Swal = require('sweetalert2') import scrollToWithAnimation from 'scrollto-with-animation' +import { ProjectUser } from 'app/models/project-user'; @Component({ selector: 'appdashboard-ws-requests-served', @@ -406,15 +407,11 @@ export class WsRequestsServedComponent extends WsSharedComponent implements OnIn // @ Subscribe to project user role // ------------------------------------------------------------- getProjectUserRole() { - this.usersService.project_user_role_bs - .pipe( - takeUntil(this.unsubscribe$) - ) - .subscribe((user_role) => { - this.logger.log('[WS-REQUESTS-LIST][SERVED] GET PROJECT-USER ROLE ', user_role); - if (user_role) { - this.USER_ROLE = user_role; - if (user_role === 'agent') { + this.usersService.projectUser_bs.pipe(takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => { + this.logger.log('[WS-REQUESTS-LIST][SERVED] GET PROJECT-USER ROLE ', projectUser); + if (projectUser) { + this.USER_ROLE = projectUser.role; + if (this.USER_ROLE === 'agent') { this.ROLE_IS_AGENT = true } else { this.ROLE_IS_AGENT = false @@ -617,12 +614,12 @@ export class WsRequestsServedComponent extends WsSharedComponent implements OnIn // SERVED_BY: add this if not exist --> getProjectuserbyUseridAndGoToEditProjectuser(member_id: string) { this.usersService.getProjectUserByUserId(member_id) - .subscribe((projectUser: any) => { + .subscribe((projectUser: ProjectUser) => { this.logger.log('[WS-REQUESTS-LIST][SERVED] GET PROJECT-USER-BY-USER-ID & GO TO EDIT PROJECT-USER - projectUser ', projectUser) if (projectUser) { - this.logger.log('[WS-REQUESTS-LIST][SERVED] GET PROJECT-USER-BY-USER-ID & GO TO EDIT PROJECT-USER - projectUser id', projectUser[0]._id); + this.logger.log('[WS-REQUESTS-LIST][SERVED] GET PROJECT-USER-BY-USER-ID & GO TO EDIT PROJECT-USER - projectUser id', projectUser._id); - this.router.navigate(['project/' + this.projectId + '/user/edit/' + projectUser[0]._id]); + this.router.navigate(['project/' + this.projectId + '/user/edit/' + projectUser._id]); } }, (error) => { this.logger.error('[WS-REQUESTS-LIST][SERVED] GET PROJECT-USER-BY-USER-ID & GO TO EDIT PROJECT-USER - ERROR ', error); @@ -888,7 +885,7 @@ export class WsRequestsServedComponent extends WsSharedComponent implements OnIn _getProjectUserByUserId(member_id) { this.usersService.getProjectUserByUserId(member_id) - .subscribe((projectUser: any) => { + .subscribe((projectUser: ProjectUser) => { this.logger.log('[WS-REQUESTS-LIST][SERVED] GET projectUser by USER-ID ', projectUser) if (projectUser) { this.logger.log('WS-REQUESTS-LIST][SERVED] GET projectUser by USER-ID projectUser id', projectUser); diff --git a/src/app/ws_requests/ws-requests-list/ws-requests-unserved/ws-requests-unserved.component.html b/src/app/ws_requests/ws-requests-list/ws-requests-unserved/ws-requests-unserved.component.html index 07aa4ed0d583..27e4d9a8878b 100755 --- a/src/app/ws_requests/ws-requests-list/ws-requests-unserved/ws-requests-unserved.component.html +++ b/src/app/ws_requests/ws-requests-list/ws-requests-unserved/ws-requests-unserved.component.html @@ -754,7 +754,7 @@

    {{ request?.requester_fullname_initial }} @@ -764,23 +764,23 @@

    style="color: #ffffff; font-size:18px; position: relative; top: 1px;"> call - call - + --> {{ request?.requester_fullname_initial }} - -
    - + +
    +
    -