diff --git a/CHANGELOG.md b/CHANGELOG.md index 10c0786b..6412c687 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,15 @@ *Giovanni Troisi* ### **Copyrigth**: *Tiledesk SRL* + +### 1.18.0-rc.2 +👉 **added**: implement time slots on cds-action-operating-hours +👉 **added**: ignoreOperatingHours property added on cds-action-online-agents-v2 + +### 1.18.0-rc.1 +👉 **added**: cds-action-lead-update component +👉 **added**: gpt-4o-mini support + ### 1.17.4 in PROD 👉 **added**: gpt-4o-mini support @@ -17,6 +26,12 @@ ### 1.17.1 in PROD +### 1.17.1-rc.2 +👉 **added**: check to hide/show actionCategory + +### 1.17.1-rc.1 +👉 **bug-fixed**: if two or more cds-action-reply-v2 is in the same intent, when user select one of them, also the first action is selected + ### 1.17.0-rc.1 👉 **added**: check to project profile object to dynamically hide/show action diff --git a/package-lock.json b/package-lock.json index da206835..89b249b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@tiledesk/cds", - "version": "1.17.4", + "version": "1.18.0-rc.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 9b278753..cdbcb7f4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@tiledesk/cds", "author": "Tiledesk SRL", - "version": "1.17.4", + "version": "1.18.0-rc.2", "license": "MIT", "homepage": "https://www.tiledesk.com", "repository": { diff --git a/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-change-department/cds-action-change-department.component.ts b/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-change-department/cds-action-change-department.component.ts index 6e22a935..e62285b5 100644 --- a/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-change-department/cds-action-change-department.component.ts +++ b/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-change-department/cds-action-change-department.component.ts @@ -48,4 +48,4 @@ export class CdsActionChangeDepartmentComponent implements OnInit { } -} +} \ No newline at end of file diff --git a/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-online-agents-v2/cds-action-online-agents.component.html b/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-online-agents-v2/cds-action-online-agents.component.html index 540f845c..45e833b3 100644 --- a/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-online-agents-v2/cds-action-online-agents.component.html +++ b/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-online-agents-v2/cds-action-online-agents.component.html @@ -83,6 +83,18 @@ +
+
+ + {{"CDSCanvas.IgnoreOperatingHours" | translate}} + +
+ +
+ +
@@ -146,4 +158,4 @@ --> - + \ No newline at end of file diff --git a/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-online-agents-v2/cds-action-online-agents.component.ts b/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-online-agents-v2/cds-action-online-agents.component.ts index 10e6d19e..bb177950 100644 --- a/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-online-agents-v2/cds-action-online-agents.component.ts +++ b/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-online-agents-v2/cds-action-online-agents.component.ts @@ -190,6 +190,15 @@ export class CdsActionOnlineAgentsV2Component implements OnInit { } } + onChangeCheckbox(target){ + try { + this.action[target] = !this.action[target]; + this.updateAndSaveAction.emit({type: TYPE_UPDATE_ACTION.ACTION, element: this.action}); + } catch (error) { + this.logger.log("Error: ", error); + } + } + onChangeButtonSelect(event: {label: string, value: string, disabled: boolean, checked: boolean}){ this.radioOptions.forEach(el => { el.value ===event.value? el.checked= true: el.checked = false }) @@ -271,4 +280,4 @@ export class CdsActionOnlineAgentsV2Component implements OnInit { } -} +} \ No newline at end of file diff --git a/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-open-hours/cds-action-open-hours.component.html b/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-open-hours/cds-action-open-hours.component.html index 98249862..bb39ab16 100644 --- a/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-open-hours/cds-action-open-hours.component.html +++ b/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-open-hours/cds-action-open-hours.component.html @@ -1,5 +1,25 @@
+
+
+ + + +
+ +
+ + {{ (radioOptions | filter:{key: 'category', value: 'general'}).name | translate }} + + + {{ (timeSlots | filter:{key: 'value', value: action.slotId}).name }} + +
+
+ {{ (radioOptions | filter:{key: 'category', value: 'general'}).name | translate }} +
+
+
@@ -34,6 +54,34 @@
+
+ + + + + +
+ + +
+
+ +
+
diff --git a/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-open-hours/cds-action-open-hours.component.scss b/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-open-hours/cds-action-open-hours.component.scss index e69de29b..004322fe 100644 --- a/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-open-hours/cds-action-open-hours.component.scss +++ b/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-open-hours/cds-action-open-hours.component.scss @@ -0,0 +1,8 @@ +.deps-wrp{ + display: flex; + justify-content: center; +} + +cds-select#list-deps{ + width: 80%; +} \ No newline at end of file diff --git a/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-open-hours/cds-action-open-hours.component.ts b/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-open-hours/cds-action-open-hours.component.ts index 78d10cd3..9a08b200 100644 --- a/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-open-hours/cds-action-open-hours.component.ts +++ b/src/app/chatbot-design-studio/cds-dashboard/cds-canvas/actions/list/cds-action-open-hours/cds-action-open-hours.component.ts @@ -7,6 +7,7 @@ import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance'; import { Subscription } from 'rxjs/internal/Subscription'; import { TYPE_UPDATE_ACTION } from '../../../../../utils'; +import { DashboardService } from 'src/app/services/dashboard.service'; @Component({ selector: 'cds-action-open-hours', @@ -21,7 +22,6 @@ export class CdsActionOpenHoursComponent implements OnInit { @Output() updateAndSaveAction = new EventEmitter(); @Output() onConnectorChange = new EventEmitter<{type: 'create' | 'delete', fromId: string, toId: string}>() - actionOpenHoursFormGroup: FormGroup trueIntentAttributes: any = ""; falseIntentAttributes: any = ""; @@ -36,13 +36,21 @@ export class CdsActionOpenHoursComponent implements OnInit { connector: any; private subscriptionChangedConnector: Subscription; + radioOptions: Array<{name: string, category: string, value: string, disabled: boolean, checked: boolean}>= [ + {name: 'CDSCanvas.General', category: 'general', value: null, disabled: false, checked: true }, + {name: 'CDSCanvas.SelectedTimeSlot', category: 'timeSlot', value: '', disabled: false, checked: false }, + ] + radioOptionSelected = null; + listOfIntents: Array<{name: string, value: string, icon?:string}>; + timeSlots: Array<{name: string, value: string, hours: string, active: boolean}> private logger: LoggerService = LoggerInstance.getInstance(); constructor( private formBuilder: FormBuilder, private intentService: IntentService, + private dashboardService: DashboardService, ) { } ngOnInit(): void { @@ -74,21 +82,26 @@ export class CdsActionOpenHoursComponent implements OnInit { // } private initialize() { - this.actionOpenHoursFormGroup = this.buildForm(); - this.actionOpenHoursFormGroup.valueChanges.subscribe(form => { - this.logger.log('[ACTION-OPEN-HOURS] form valueChanges-->', form) - if (form && (form.trueIntent !== '')) - this.action = Object.assign(this.action, this.actionOpenHoursFormGroup.value); - }) + if (this.dashboardService.project.timeSlots) { + this.timeSlots = Object.keys(this.dashboardService.project.timeSlots).map(key => ({ + value: key, + ...this.dashboardService.project.timeSlots[key] + })); + } + this.trueIntentAttributes = this.action.trueIntentAttributes; this.falseIntentAttributes = this.action.falseIntentAttributes; if(this.intentSelected){ this.initializeConnector(); this.checkConnectionStatus(); } - if (this.action && this.action.trueIntent) { - this.setFormValue() + + this.radioOptionSelected = null; + if(this.action && this.action.slotId && this.action.slotId !== null){ + this.radioOptionSelected = '' + this.radioOptions.forEach(el => { el.category === 'timeSlot'? el.checked = true: el.checked = false }) } + this.logger.log('[ACTION-OPEN-HOURS] initialize action -->', this.action) } private checkConnectionStatus(){ @@ -168,21 +181,23 @@ export class CdsActionOpenHoursComponent implements OnInit { } - buildForm(): FormGroup { - return this.formBuilder.group({ - trueIntent: ['', Validators.required], - falseIntent: ['', Validators.required] - }) + onChangeButtonSelect(event: {label: string, category: string, value: string, disabled: boolean, checked: boolean}){ + this.radioOptions.forEach(el => { el.value ===event.value? el.checked= true: el.checked = false }) + this.action.slotId = null; + switch (event.category){ + case 'general': + this.action.slotId = null + this.radioOptionSelected = null + break; + default: + this.radioOptionSelected = '' + break; + } + this.updateAndSaveAction.emit({type: TYPE_UPDATE_ACTION.ACTION, element: this.action}); } - setFormValue() { - this.actionOpenHoursFormGroup.patchValue({ - trueIntent: this.action.trueIntent, - falseIntent: this.action.falseIntent - }) - } - onChangeSelect(event:{name: string, value: string}, type : 'trueIntent' | 'falseIntent'){ + onChangeSelect(event:{name: string, value: string}, type : 'trueIntent' | 'falseIntent' | 'slotId'){ if(event){ this.action[type]=event.value switch(type){ @@ -197,7 +212,7 @@ export class CdsActionOpenHoursComponent implements OnInit { } } - onResetBlockSelect(event:{name: string, value: string}, type: 'trueIntent' | 'falseIntent') { + onResetBlockSelect(event:{name: string, value: string}, type: 'trueIntent' | 'falseIntent' | 'slotId') { switch(type){ case 'trueIntent': this.onConnectorChange.emit({ type: 'delete', fromId: this.idConnectorTrue, toId: this.action.trueIntent}) diff --git a/src/app/chatbot-design-studio/utils-actions.ts b/src/app/chatbot-design-studio/utils-actions.ts index 3b1842d6..412267a4 100644 --- a/src/app/chatbot-design-studio/utils-actions.ts +++ b/src/app/chatbot-design-studio/utils-actions.ts @@ -79,13 +79,13 @@ export function getKeyByValue(value, keys) { export const ACTIONS_LIST: {[key: string]: {name: string, category: TYPE_ACTION_CATEGORY, type: TYPE_ACTION | TYPE_ACTION_VXML, src: string, status: 'active' | 'inactive' | 'beta', plan?: PLAN_NAME, badge?: string, description?: string, doc?: string, disabled?: boolean}}= { REPLY : { name: 'CDSActionList.NAME.Reply', category: TYPE_ACTION_CATEGORY.MOST_USED, type: TYPE_ACTION.REPLY, src:"assets/images/actions/reply.svg", status: "active" , description: "CDSActionList.DESCRIPTION.Reply", doc: "CDSActionList.DOCS.Reply" }, - REPLYV2 : { name: 'CDSActionList.NAME.ReplyV2', category: TYPE_ACTION_CATEGORY.MOST_USED, type: TYPE_ACTION.REPLYV2, src:"assets/images/actions/reply_v2.svg", status: "beta" , badge: 'NEW', description: "CDSActionList.DESCRIPTION.ReplyV2", doc: "CDSActionList.DOCS.ReplyV2" }, + REPLYV2 : { name: 'CDSActionList.NAME.ReplyV2', category: TYPE_ACTION_CATEGORY.MOST_USED, type: TYPE_ACTION.REPLYV2, src:"assets/images/actions/reply_v2.svg", status: "active" , badge: 'NEW', description: "CDSActionList.DESCRIPTION.ReplyV2", doc: "CDSActionList.DOCS.ReplyV2" }, RANDOM_REPLY : { name: 'CDSActionList.NAME.RandomReply', category: TYPE_ACTION_CATEGORY.MOST_USED, type: TYPE_ACTION.RANDOM_REPLY, src:"assets/images/actions/random_reply.svg", status: "active", description: "CDSActionList.DESCRIPTION.RandomReply" }, AGENT : { name: 'CDSActionList.NAME.AgentHandoff', category: TYPE_ACTION_CATEGORY.MOST_USED, type: TYPE_ACTION.AGENT, src:"assets/images/actions/agent_handoff.svg", status: "active", description: "CDSActionList.DESCRIPTION.AgentHandoff" }, CLOSE : { name: 'CDSActionList.NAME.Close', category: TYPE_ACTION_CATEGORY.MOST_USED, type: TYPE_ACTION.CLOSE, src:"assets/images/actions/close.svg", status: "active", description: "CDSActionList.DESCRIPTION.Close" }, - OPEN_HOURS: { name: 'CDSActionList.NAME.IfOperatingHours', category: TYPE_ACTION_CATEGORY.MOST_USED, type: TYPE_ACTION.OPEN_HOURS, src: "assets/images/actions/open_hours.svg", status: "active", description: "CDSActionList.DESCRIPTION.IfOperatingHours" }, + OPEN_HOURS: { name: 'CDSActionList.NAME.IfOperatingHours', category: TYPE_ACTION_CATEGORY.MOST_USED, type: TYPE_ACTION.OPEN_HOURS, src: "assets/images/actions/open_hours.svg", status: "active", badge: 'NEW', description: "CDSActionList.DESCRIPTION.IfOperatingHours" }, ONLINE_AGENTS: { name: 'CDSActionList.NAME.IfOnlineAgent', category: TYPE_ACTION_CATEGORY.MOST_USED, type: TYPE_ACTION.ONLINE_AGENTS, src: "assets/images/actions/online_agents.svg", status: "inactive", description: "CDSActionList.DESCRIPTION.IfOnlineAgent" }, - ONLINE_AGENTSV2: { name: 'CDSActionList.NAME.IfOnlineAgent', category: TYPE_ACTION_CATEGORY.MOST_USED, type: TYPE_ACTION.ONLINE_AGENTSV2, src: "assets/images/actions/online_agents.svg", status: "active", badge: 'NEW', description: "CDSActionList.DESCRIPTION.IfOnlineAgent" }, + ONLINE_AGENTSV2: { name: 'CDSActionList.NAME.IfOnlineAgent', category: TYPE_ACTION_CATEGORY.MOST_USED, type: TYPE_ACTION.ONLINE_AGENTSV2, src: "assets/images/actions/online_agents.svg", status: "active", description: "CDSActionList.DESCRIPTION.IfOnlineAgent" }, CONDITION: { name: 'CDSActionList.NAME.Condition', category: TYPE_ACTION_CATEGORY.FLOW, type: TYPE_ACTION.CONDITION, src: "assets/images/actions/condition.svg", status: "active" }, JSON_CONDITION: { name: 'CDSActionList.NAME.ConditionElse', category: TYPE_ACTION_CATEGORY.FLOW, type: TYPE_ACTION.JSON_CONDITION, src: "assets/images/actions/condition.svg", status: "active" }, INTENT : { name: 'CDSActionList.NAME.ConnectBlock', category: TYPE_ACTION_CATEGORY.FLOW, type: TYPE_ACTION.INTENT, src:"assets/images/actions/connect_intent.svg", status: "inactive", description: "CDSActionList.DESCRIPTION.ConnectBlock" }, @@ -97,7 +97,7 @@ export const ACTIONS_LIST: {[key: string]: {name: string, category: TYPE_ACTION_ WAIT : { name: 'CDSActionList.NAME.Wait', category: TYPE_ACTION_CATEGORY.FLOW, type: TYPE_ACTION.WAIT, src:"assets/images/actions/wait.svg", status: "active", description: "CDSActionList.DESCRIPTION.Wait" }, LEAD_UPDATE : { name: 'CDSActionList.NAME.LeadUpdate', category: TYPE_ACTION_CATEGORY.FLOW, type: TYPE_ACTION.LEAD_UPDATE, src:"assets/images/actions/lead_update.svg", status: "active", description: "CDSActionList.DESCRIPTION.LeadUpdate" }, // WEB_REQUEST : { name: 'CDSActionList.NAME.WebRequest',category: TYPE_ACTION_CATEGORY.INTEGRATIONS, type: TYPE_ACTION.WEB_REQUEST, src:"assets/images/actions/web_request.svg", status: "active", description: ''}, - WEB_REQUESTV2 : { name: 'CDSActionList.NAME.WebRequest', category: TYPE_ACTION_CATEGORY.INTEGRATIONS, type: TYPE_ACTION.WEB_REQUESTV2, src:"assets/images/actions/web_request.svg", status: "beta", description: '' }, + WEB_REQUESTV2 : { name: 'CDSActionList.NAME.WebRequest', category: TYPE_ACTION_CATEGORY.INTEGRATIONS, type: TYPE_ACTION.WEB_REQUESTV2, src:"assets/images/actions/web_request.svg", status: "active", description: '' }, EMAIL : { name: 'CDSActionList.NAME.SendEmail', category: TYPE_ACTION_CATEGORY.INTEGRATIONS, type: TYPE_ACTION.EMAIL, src:"assets/images/actions/send_email.svg", status: "active", description: "CDSActionList.DESCRIPTION.SendEmail" }, WHATSAPP_STATIC: { name: 'CDSActionList.NAME.WhatsAppStatic', category: TYPE_ACTION_CATEGORY.INTEGRATIONS, type: TYPE_ACTION.WHATSAPP_STATIC, src: "assets/images/actions/whatsapp.svg", status: "active", description: "CDSActionList.DESCRIPTION.WhatsAppStatic" }, WHATSAPP_ATTRIBUTE: { name: 'CDSActionList.NAME.WhatsAppByAttribute', category: TYPE_ACTION_CATEGORY.INTEGRATIONS, type: TYPE_ACTION.WHATSAPP_ATTRIBUTE, src: "assets/images/actions/whatsapp.svg", status: "active", description: "CDSActionList.DESCRIPTION.WhatsAppByAttribute" }, diff --git a/src/app/models/action-model.ts b/src/app/models/action-model.ts index 829a663f..7c59842f 100644 --- a/src/app/models/action-model.ts +++ b/src/app/models/action-model.ts @@ -82,15 +82,18 @@ export class ActionOnlineAgentV2 extends Action { stopOnConditionMet: boolean; selectedOption: string; selectedDepartmentId?: string; + ignoreOperatingHours?: boolean; constructor() { super(); this.stopOnConditionMet = true; this._tdActionType = TYPE_ACTION.ONLINE_AGENTSV2; this.selectedOption = 'all' + this.ignoreOperatingHours = false; } } export class ActionOpenHours extends Action { + slotId?: string; trueIntent: string; falseIntent: string; trueIntentAttributes?: string; @@ -99,6 +102,7 @@ export class ActionOpenHours extends Action { constructor() { super(); this.stopOnConditionMet = true; + // this.slotId = null; this._tdActionType = TYPE_ACTION.OPEN_HOURS; } } diff --git a/src/app/models/project-model.ts b/src/app/models/project-model.ts index 055a34b0..4aaf351e 100755 --- a/src/app/models/project-model.ts +++ b/src/app/models/project-model.ts @@ -7,6 +7,9 @@ export interface Project { name?: string; activeOperatingHours?: boolean; operatingHours?: any + timeSlots?: { + [key: string]: { name: string, hours: string, active: boolean} + } createdBy?: string; id_project?: any; widget?: any; diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 985a1586..21dd4ca4 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -441,7 +441,13 @@ "SelectedDepartment": "Selected Department", "CheckAgentsAvailability":"Check agents availability", "UpdateProperty":"Update property", - "SelectProperty":"Select property" + "SelectProperty":"Select property", + "CheckOperatingHours":"Check operating hours", + "General":"General", + "SelectedTimeSlot":"Selected time slot", + "SelectTimeSlot":"Select time slot", + "IgnoreOperatingHours":"Ignore General operating hours", + "IgnoreOperatingHoursDescription": "Check this option if you want to only check agents availability ignoring the General Operating hours settings.
This option is also useful if you want to demand opening and closing hours checking to the If Operating Hours Action, specifing a specific time slot" }, "Alert": { "ErrorMaxOptions":"Cannot add another option. Max available options achived ( 0..9, *, # )", diff --git a/src/assets/images/hours.svg b/src/assets/images/hours.svg new file mode 100644 index 00000000..e5a523c9 --- /dev/null +++ b/src/assets/images/hours.svg @@ -0,0 +1,5 @@ + + + + \ No newline at end of file