From b08d8854743ac2ae7661d19ad4934cf0a94e189a Mon Sep 17 00:00:00 2001 From: VijayalakshmiSF4471 <164475295+VijayalakshmirSF4471@users.noreply.github.com> Date: Fri, 20 Dec 2024 22:01:35 +0530 Subject: [PATCH 1/6] feature(402683): implemented customer block node --- .../workflow-diagram.component.html | 7 + .../workflow-diagram.component.ts | 11 +- .../workflow-sidebar.component.html | 9 +- .../workflow-sidebar.component.ts | 21 ++- src/app/data/list-data.ts | 37 +---- src/app/data/rule-data.ts | 153 +----------------- src/app/models/appModel.ts | 44 ++--- 7 files changed, 61 insertions(+), 221 deletions(-) diff --git a/src/app/components/workflow-diagram/workflow-diagram.component.html b/src/app/components/workflow-diagram/workflow-diagram.component.html index 63cf19d..6e9f8d7 100644 --- a/src/app/components/workflow-diagram/workflow-diagram.component.html +++ b/src/app/components/workflow-diagram/workflow-diagram.component.html @@ -123,6 +123,13 @@ } } } + @case(chatWorkflowBlockTypeEnum.GetCustomerDetails){ + +
+
+
+
+ } } diff --git a/src/app/components/workflow-diagram/workflow-diagram.component.ts b/src/app/components/workflow-diagram/workflow-diagram.component.ts index cfca60d..e2221df 100644 --- a/src/app/components/workflow-diagram/workflow-diagram.component.ts +++ b/src/app/components/workflow-diagram/workflow-diagram.component.ts @@ -1,7 +1,7 @@ import { AfterViewInit, Component, ElementRef, EventEmitter, Input, Output, viewChild, ViewChild } from '@angular/core'; import { ComplexHierarchicalTree, ConnectionPointOrigin, ConnectorConstraints, ConnectorModel, DecoratorModel, Diagram, DiagramComponent, DiagramModule, HierarchicalTree, HierarchicalTreeService, HtmlModel, IClickEventArgs, IExportOptions, LayoutModel, LineDistribution, Node, NodeModel, PrintAndExport, SelectorConstraints, SelectorModel, SnapSettingsModel, TextModel, UserHandleEventsArgs, UserHandleModel } from '@syncfusion/ej2-angular-diagrams'; -import { FieldDetails, FieldOptionDetail, FieldValidation, MessageDetails, RuleData, RuleData2 } from '../../models/appModel'; -import { RULE_DATA, RULE_DATA2, RULE_DATA3 } from '../../data/rule-data'; +import { FieldDetails, FieldOptionDetail, FieldValidation, MessageDetails, RuleData2 } from '../../models/appModel'; +import { RULE_DATA2, RULE_DATA3 } from '../../data/rule-data'; import { DialogModule } from '@syncfusion/ej2-angular-popups'; import { BeforeOpenCloseMenuEventArgs, DropDownButtonComponent, DropDownButtonModule, ItemModel, OpenCloseMenuEventArgs } from '@syncfusion/ej2-angular-splitbuttons'; import { CommonModule } from '@angular/common'; @@ -39,7 +39,6 @@ export class WorkflowDiagramComponent implements AfterViewInit{ public chatWorkflowEditorTypeEnum = ChatWorkflowEditorTypeEnum; public chatWorkflowBlockTypeEnum = ChatWorkflowBlockTypeEnum; - // public data: RuleData[] = RULE_DATA; public data: RuleData2[] = RULE_DATA3; public nodes: NodeModel[] = []; public connectors: ConnectorModel[] = []; @@ -319,8 +318,10 @@ export class WorkflowDiagramComponent implements AfterViewInit{ this.isParentListItem = false; // The value is reset here, to handle document click case of dropdown // Reset ListView to its initial state before opening if (this.listView) { - this.listView.dataSource = this.listdata; // Reset data - this.listView.refresh(); + // this.listView.dataSource = this.listdata; // Reset data + while ((this.listView as any).curDSLevel.length > 0) { + this.listView.back(); + } } } diff --git a/src/app/components/workflow-sidebar/workflow-sidebar.component.html b/src/app/components/workflow-sidebar/workflow-sidebar.component.html index 4aea947..3d41ecd 100644 --- a/src/app/components/workflow-sidebar/workflow-sidebar.component.html +++ b/src/app/components/workflow-sidebar/workflow-sidebar.component.html @@ -3,7 +3,7 @@
{{sidebarHeader}}
-
+
@@ -167,6 +167,13 @@ } } } + @case(chatWorkflowBlockTypeEnum.GetCustomerDetails){ +
+ + + +
+ } }
diff --git a/src/app/components/workflow-sidebar/workflow-sidebar.component.ts b/src/app/components/workflow-sidebar/workflow-sidebar.component.ts index 0227296..381f5de 100644 --- a/src/app/components/workflow-sidebar/workflow-sidebar.component.ts +++ b/src/app/components/workflow-sidebar/workflow-sidebar.component.ts @@ -7,13 +7,13 @@ import { FieldDetails, FieldOptionDetail, FieldValidation, MessageDetails, RuleD import { NodeModel } from '@syncfusion/ej2-angular-diagrams'; import { DropDownListComponent } from '@syncfusion/ej2-angular-dropdowns'; import { DatePickerModule, DateTimePickerModule } from '@syncfusion/ej2-angular-calendars'; -import { ButtonModule } from '@syncfusion/ej2-angular-buttons'; +import { ButtonModule, CheckBoxModule } from '@syncfusion/ej2-angular-buttons'; @Component({ selector: 'app-workflow-sidebar', standalone: true, - imports: [SidebarModule, FormsModule, CommonModule, DatePickerModule, DateTimePickerModule, ButtonModule], + imports: [SidebarModule, FormsModule, CommonModule, DatePickerModule, DateTimePickerModule, ButtonModule, CheckBoxModule], templateUrl: './workflow-sidebar.component.html', styleUrl: './workflow-sidebar.component.scss' }) @@ -56,6 +56,10 @@ export class WorkflowSidebarComponent { public newNodeInfo: any; private updatePending = false; + public getEmailInfo: boolean = true; + public getNameInfo: boolean = false; + public getPhoneNumberInfo: boolean = false; + @Input() nodeEditType!: number; @Input() nodeBlockType!: number; @Input() sidebarHeader!: string; @@ -288,6 +292,11 @@ export class WorkflowSidebarComponent { } break; } + case (this.chatWorkflowBlockTypeEnum.GetCustomerDetails): { + let fieldInfo = this.createCustomerBlockFieldInfo(); + this.newNodeInfo = this.createNodeInfo(null, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null); + break; + } } if (this.isEdit) { this.updateNode.emit([sourceNodeId, this.newNodeInfo]); @@ -340,6 +349,14 @@ export class WorkflowSidebarComponent { } } + public createCustomerBlockFieldInfo(): FieldDetails { + return { + hasEmailDetails: this.getEmailInfo, + hasNameDetails: this.getNameInfo, + hasPhoneNumberDetails: this.getPhoneNumberInfo, + } + } + public createNode(width: number, height: number, nodeInfo: RuleData2): NodeModel { return { id: `node${nodeInfo.id}`, diff --git a/src/app/data/list-data.ts b/src/app/data/list-data.ts index 4c189e0..226a7e0 100644 --- a/src/app/data/list-data.ts +++ b/src/app/data/list-data.ts @@ -3,42 +3,19 @@ export const LIST_DATA: { [key: string]: any }[] = [ 'text': 'Action', 'id': '01', 'category': 'Block Type', - 'child': [{ - 'text': 'Identity', + 'child': [ + { + 'text': 'Customer Block', 'id': '1', + 'blockid': 3, + 'editerTypeId': null, 'category': 'Action', - 'child': [{ - 'text': 'Name', - 'id': '1001', - 'blockid': 3, - 'editerTypeId': 18, - 'category': 'Identity', - }, - { - 'text': 'Email', - 'id': '1002', - 'blockid': 3, - 'editerTypeId': 19, - 'category': 'Identity', - }, - { - 'text': 'Phone No', - 'id': '1003', - 'blockid': 3, - 'editerTypeId': 20, - 'category': 'Identity', - }, - { - 'text': 'Requester Linking', - 'id': '1004', - 'blockid': 3, - 'editerTypeId': 21, - 'category': 'Identity', - }] }, { 'text': 'Custom Message', 'id': '2', + 'blockid': 6, + 'editerTypeId': null, 'category': 'Action', }, { diff --git a/src/app/data/rule-data.ts b/src/app/data/rule-data.ts index 0c97f69..0efbe09 100644 --- a/src/app/data/rule-data.ts +++ b/src/app/data/rule-data.ts @@ -1,155 +1,4 @@ -import { RuleData, RuleData2 } from "../models/appModel"; - - -export const RULE_DATA: RuleData[] = [ - { - // identity input request rule - "id" : 1, - "workflow_id" : 1, - "expression" : "Utils.IsValidEmail(input)", - "success_message" : "Email received", - "error_message" : "Invalid Email. Provide valid Email", - "operator" : null, - "success_action_name" : "EvaluateRule", - "success_expression" : null, - "success_workflow_id" : 1, - "success_rule_id" : 2, - "failure_action_name" : "OutputExpression", - "failure_expression" : "false", - "failure_workflow_id" : 1, - "failure_rule_id" : 1, - "child_rules" : null, - "custom_details" : "{\"Field\": \"visitorEmail\", \"Description\": \"Provide valid email\", \"Placeholder\": \"Enter your email\", \"IsInputStage\": true}", - "last_modified_on" : "2024-09-26T07:16:07.705Z", - "is_active" : true - }, - { - // identity verification rule - "id" : 2, - "workflow_id" : 1, - "expression" : "Utils.IsUserEmailExists(input)", - "success_message" : "", - "error_message" : "", - "operator" : null, - "success_action_name" : "EvaluateRule", - "success_expression" : null, - "success_workflow_id" : 1, - "success_rule_id" : 4, - "failure_action_name" : "EvaluateRule", - "failure_expression" : null, - "failure_workflow_id" : 1, - "failure_rule_id" : 3, - "child_rules" : null, - "custom_details" : null, - "last_modified_on" : "2024-09-16T12:17:20.768Z", - "is_active" : true - }, - { - // requesting and updating name field - "id" : 3, - "workflow_id" : 1, - "expression" : "Utils.SaveField(input)", - "success_message" : "Name received", - "error_message" : "Name should not be empty", - "operator" : null, - "success_action_name" : "EvaluateRule", - "success_expression" : null, - "success_workflow_id" : 1, - "success_rule_id" : 4, - "failure_action_name" : "OutputExpression", - "failure_expression" : "false", - "failure_workflow_id" : 1, - "failure_rule_id" : 3, - "child_rules" : null, - "custom_details" : "{\"Field\": \"visitorName\", \"Description\": \"Provide valid name\", \"Placeholder\": \"Enter your name\", \"IsInputStage\": true}", - "last_modified_on" : "2024-09-26T10:05:28.391Z", - "is_active" : true - }, - { - // branching rule cases - "id" : 4, - "workflow_id" : 1, - "expression" : "true", - "success_message" : "", - "error_message" : "", - "operator" : null, - "success_action_name" : "CustomAction", // validate the selected value in custom method action - "success_expression" : null, - "success_workflow_id" : null, - "success_rule_id" : null, - "failure_action_name" : null, - "failure_expression" : null, - "failure_workflow_id" : null, - "failure_rule_id" : null, - "child_rules" : null, - "custom_details" : "{\"values\":[{\"value\":\"Bolddesk\",\"SuccessWorkflowId\":1,\"SuccessRuleId\":5},{\"value\":\"Boldsign\",\"SuccessWorkflowId\":1,\"SuccessRuleId\":6}]}", - "last_modified_on" : "2024-09-16T13:10:50.543Z", - "is_active" : true - }, - { - //branch rule from rule id "4" - "id" : 5, - "workflow_id" : 1, - "expression" : "Utils.SendMessage(input)", // send message action for selected item - "success_message" : "Bold desk product selected", - "error_message" : "Send message action failed", - "operator" : null, - "success_action_name" : "EvaluateRule", - "success_expression" : null, - "success_workflow_id" : 1, - "success_rule_id" : 7, - "failure_action_name" : null, - "failure_expression" : null, - "failure_workflow_id" : null, - "failure_rule_id" : null, - "child_rules" : null, - "custom_details" : "{\"Message\": \"Bolddesk value selected\"}", - "last_modified_on" : "2024-09-16T13:10:50.543Z", - "is_active" : true - }, - { - //branch rule from rule id "4" - "id" : 6, - "workflow_id" : 1, - "expression" : "Utils.SendMessage(input)", // send message action for selected item - "success_message" : "Bold sign product selected", - "error_message" : "Send message action failed", - "operator" : null, - "success_action_name" : "EvaluateRule", - "success_expression" : null, - "success_workflow_id" : 7, - "success_rule_id" : 1, - "failure_action_name" : null, - "failure_expression" : null, - "failure_workflow_id" : null, - "failure_rule_id" : null, - "child_rules" : null, - "custom_details" : "{\"Message\": \"Boldsign value selected\"}", - "last_modified_on" : "2024-09-16T13:10:50.543Z", - "is_active" : true - }, - { - // flow completed - "id" : 7, - "workflow_id" : 1, - "expression" : "true", - "success_message" : "Flow completed", - "error_message" : "Flow completed action failed", - "operator" : null, - "success_action_name" : "OutputExpression", - "success_expression" : "true", - "success_workflow_id" : null, - "success_rule_id" : null, - "failure_action_name" : null, - "failure_expression" : null, - "failure_workflow_id" : null, - "failure_rule_id" : null, - "child_rules" : null, - "custom_details" : null, - "last_modified_on" : "2024-09-16T13:10:50.543Z", - "is_active" : true - } -]; +import { RuleData2 } from "../models/appModel"; export const RULE_DATA2: RuleData2[] = [ { diff --git a/src/app/models/appModel.ts b/src/app/models/appModel.ts index 3e23f8d..f1b7459 100644 --- a/src/app/models/appModel.ts +++ b/src/app/models/appModel.ts @@ -1,26 +1,5 @@ import { TextFormatEnum } from "./enum"; -export interface RuleData { - id: number; - workflow_id: number; - expression: string; - success_message: string; - error_message: string; - operator: any | null; // Use 'any' if the data type is unknown, else specify a more specific type - success_action_name: string | null; - success_expression: string | null; - success_workflow_id: number | null; - success_rule_id: number | null; - failure_action_name: string | null; - failure_expression: string | null; - failure_workflow_id: number | null; - failure_rule_id: number | null; - child_rules: any | null; // If child_rules has a specific type, replace 'any' with it - custom_details: string | null; // Assuming this is always a JSON string - last_modified_on: string; // Keep as a string, or use Date if you prefer converting it - is_active: boolean; -} - // Define FieldOptionDetails interface export interface FieldOptionDetail { label: string; @@ -37,17 +16,20 @@ export interface FieldValidation { // Define FieldDetails interface export interface FieldDetails { - description?: string | null; - label?: string | null; - placeholder?: string | null; - apiName?: string | null; - maskForAgent?: boolean | null; - isOptional?: boolean | null; - useAPI?: boolean | null; + description?: string; + label?: string; + placeholder?: string; + apiName?: string; + maskForAgent?: boolean; + isOptional?: boolean; + useAPI?: boolean; fieldValidation?: FieldValidation | null; - value?: string | null; - groupId?: number | null; - ruleType?: number | null; + value?: string; + groupId?: number; + ruleType?: number; + hasEmailDetails?: boolean; // Indicates if the customer block has email details + hasNameDetails?: boolean; + hasPhoneNumberDetails?: boolean; } // Define MessageDetails interface From 2e3479a1b0f1d0beee05a9983727137e502bda5b Mon Sep 17 00:00:00 2001 From: VijayalakshmiSF4471 <164475295+VijayalakshmirSF4471@users.noreply.github.com> Date: Mon, 23 Dec 2024 13:19:27 +0530 Subject: [PATCH 2/6] feature(402683): removed commented line --- .../components/workflow-diagram/workflow-diagram.component.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app/components/workflow-diagram/workflow-diagram.component.ts b/src/app/components/workflow-diagram/workflow-diagram.component.ts index e2221df..455f8d2 100644 --- a/src/app/components/workflow-diagram/workflow-diagram.component.ts +++ b/src/app/components/workflow-diagram/workflow-diagram.component.ts @@ -318,7 +318,6 @@ export class WorkflowDiagramComponent implements AfterViewInit{ this.isParentListItem = false; // The value is reset here, to handle document click case of dropdown // Reset ListView to its initial state before opening if (this.listView) { - // this.listView.dataSource = this.listdata; // Reset data while ((this.listView as any).curDSLevel.length > 0) { this.listView.back(); } From 26279e5cc913ebed8327d481ed5be67c49a63d49 Mon Sep 17 00:00:00 2001 From: VijayalakshmiSF4471 <164475295+VijayalakshmirSF4471@users.noreply.github.com> Date: Mon, 23 Dec 2024 18:29:02 +0530 Subject: [PATCH 3/6] feature(402683): made changes as per incoming changes --- .../workflow-diagram/workflow-diagram.component.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/components/workflow-diagram/workflow-diagram.component.html b/src/app/components/workflow-diagram/workflow-diagram.component.html index 8b3f5b9..aacb149 100644 --- a/src/app/components/workflow-diagram/workflow-diagram.component.html +++ b/src/app/components/workflow-diagram/workflow-diagram.component.html @@ -117,8 +117,8 @@ @case(chatWorkflowBlockTypeEnum.GetCustomerDetails){
-
-
+
+
} } From 646d8334c12ac9361128329ae0cbabc826e4c43e Mon Sep 17 00:00:00 2001 From: VijayalakshmiSF4471 <164475295+VijayalakshmirSF4471@users.noreply.github.com> Date: Fri, 27 Dec 2024 17:17:21 +0530 Subject: [PATCH 4/6] feature(402683): made changes to get customer block details from API --- .../workflow-diagram.component.html | 20 +++++--- .../workflow-diagram.component.ts | 1 - .../workflow-sidebar.component.ts | 49 +++++++++---------- src/app/models/appModel.ts | 12 +++-- 4 files changed, 44 insertions(+), 38 deletions(-) diff --git a/src/app/components/workflow-diagram/workflow-diagram.component.html b/src/app/components/workflow-diagram/workflow-diagram.component.html index 1a549ce..ea49c8b 100644 --- a/src/app/components/workflow-diagram/workflow-diagram.component.html +++ b/src/app/components/workflow-diagram/workflow-diagram.component.html @@ -38,7 +38,7 @@ - @if(data.data.chatWorkflowBlockId !== chatWorkflowBlockTypeEnum.SendTextMessage){ + @if(data.data.chatWorkflowBlockId !== chatWorkflowBlockTypeEnum.SendTextMessage && data.data.chatWorkflowBlockId !== chatWorkflowBlockTypeEnum.GetCustomerDetails) {
} @switch (data.data.chatWorkflowBlockId){ @@ -51,6 +51,17 @@
} + @case(chatWorkflowBlockTypeEnum.GetCustomerDetails){ + +
+ @if (data.data.customerBlockFieldInfo.isNameEditorEnabled){ +
+ } + @if (data.data.customerBlockFieldInfo.isPhoneEditorEnabled){ +
+ } +
+ } @case(chatWorkflowBlockTypeEnum.GetPickerInput){ @switch (data.data.chatWorkflowEditorTypeId){ @case (chatWorkflowEditorTypeEnum.Boolean){ @@ -125,13 +136,6 @@ } } } - @case(chatWorkflowBlockTypeEnum.GetCustomerDetails){ - -
-
-
-
- } } diff --git a/src/app/components/workflow-diagram/workflow-diagram.component.ts b/src/app/components/workflow-diagram/workflow-diagram.component.ts index 3232923..7362568 100644 --- a/src/app/components/workflow-diagram/workflow-diagram.component.ts +++ b/src/app/components/workflow-diagram/workflow-diagram.component.ts @@ -347,5 +347,4 @@ export class WorkflowDiagramComponent implements AfterViewInit { this.diagram.loadDiagram(jsonString); this.fileInput.nativeElement.value = ''; } - } \ No newline at end of file diff --git a/src/app/components/workflow-sidebar/workflow-sidebar.component.ts b/src/app/components/workflow-sidebar/workflow-sidebar.component.ts index 43db66f..e9572cd 100644 --- a/src/app/components/workflow-sidebar/workflow-sidebar.component.ts +++ b/src/app/components/workflow-sidebar/workflow-sidebar.component.ts @@ -3,7 +3,7 @@ import { SidebarComponent, SidebarModule } from '@syncfusion/ej2-angular-navigat import { TextFormatEnum, ChatWorkflowEditorTypeEnum, ChatWorkflowBlockTypeEnum } from '../../models/enum'; import { FormsModule } from '@angular/forms'; import { CommonModule } from '@angular/common'; -import { FieldDetails, FieldOptionDetail, FieldValidation, MessageDetails, RuleData2 } from '../../models/appModel'; +import { CustomerBlockFieldDetails, FieldDetails, FieldOptionDetail, FieldValidation, MessageDetails, RuleData2 } from '../../models/appModel'; import { NodeModel } from '@syncfusion/ej2-angular-diagrams'; import { DropDownListComponent, DropDownListModule } from '@syncfusion/ej2-angular-dropdowns'; import { DatePickerModule, DateTimePickerModule } from '@syncfusion/ej2-angular-calendars'; @@ -212,27 +212,27 @@ export class WorkflowSidebarComponent { isPrivate: this.checkedIsPrivate, textFormat: this.ddlTextFormat.value as TextFormatEnum } - this.newNodeInfo = this.createNodeInfo(null, this.nodeBlockType, this.selectedWorkFlowId, null, null, messageInfo); + this.newNodeInfo = this.createNodeInfo(null, this.nodeBlockType, this.selectedWorkFlowId, null, null, messageInfo, null); break; } case (this.chatWorkflowBlockTypeEnum.GetPickerInput): { switch (this.nodeEditType) { case (this.chatWorkflowEditorTypeEnum.Boolean): { let fieldInfo = this.createFieldInfo(null); - this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null); + this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null, null); break; } case (this.chatWorkflowEditorTypeEnum.Buttons): { let fieldOptionInfo = this.mapOptionsToFieldOptions(); let fieldInfo = this.createFieldInfo(null); - this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, fieldOptionInfo, null); + this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, fieldOptionInfo, null, null); this.newNodeHeight += (this.options.length * 25); break; } case this.chatWorkflowEditorTypeEnum.DropDown: { let fieldOptionInfo = this.mapOptionsToFieldOptions(); let fieldInfo = this.createFieldInfo(null); - this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, fieldOptionInfo, null); + this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, fieldOptionInfo, null, null); this.newNodeHeight += (this.options.length * 25); break; } @@ -240,14 +240,14 @@ export class WorkflowSidebarComponent { let fieldValidationInfo = this.createFieldValidationInfo(this.fieldOptionMinValue.toString(), this.fieldOptionMaxValue.toString(), null); let fieldOptionInfo = this.mapOptionsToFieldOptions(); let fieldInfo = this.createFieldInfo(fieldValidationInfo); - this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, fieldOptionInfo, null); + this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, fieldOptionInfo, null, null); this.newNodeHeight += (this.options.length * 25); break; } case (this.chatWorkflowEditorTypeEnum.List): { let fieldOptionInfo = this.mapOptionsToFieldOptions(); let fieldInfo = this.createFieldInfo(null); - this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, fieldOptionInfo, null); + this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, fieldOptionInfo, null, null); this.newNodeHeight += (this.options.length * 25); break; } @@ -259,13 +259,13 @@ export class WorkflowSidebarComponent { case (this.chatWorkflowEditorTypeEnum.Text): { let fieldValidationInfo = this.createFieldValidationInfo(null, this.fieldOptionMaxValue.toString(), null); let fieldInfo = this.createFieldInfo(fieldValidationInfo); - this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null); + this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null, null); break; } case (this.chatWorkflowEditorTypeEnum.TextArea): { let fieldValidationInfo = this.createFieldValidationInfo(null, this.fieldOptionMaxValue.toString(), null); let fieldInfo = this.createFieldInfo(fieldValidationInfo); - this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null); + this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null, null); break; } case (this.chatWorkflowEditorTypeEnum.Date): { @@ -276,7 +276,7 @@ export class WorkflowSidebarComponent { let fieldValidationInfo = this.createFieldValidationInfo(minDate, maxDate, null); let fieldInfo = this.createFieldInfo(fieldValidationInfo); - this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null); + this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null, null); break; } case (this.chatWorkflowEditorTypeEnum.DateTime): { @@ -286,33 +286,37 @@ export class WorkflowSidebarComponent { let fieldValidationInfo = this.createFieldValidationInfo(minDateTime, maxDateTime, null); let fieldInfo = this.createFieldInfo(fieldValidationInfo); - this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null); + this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null, null); break; } case (this.chatWorkflowEditorTypeEnum.Number): { let fieldValidationInfo = this.createFieldValidationInfo(this.fieldOptionMinValue.toString(), this.fieldOptionMaxValue.toString(), null); let fieldInfo = this.createFieldInfo(fieldValidationInfo); - this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null); + this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null, null); break; } case (this.chatWorkflowEditorTypeEnum.Decimal): { let fieldValidationInfo = this.createFieldValidationInfo(this.fieldOptionMinValue.toString(), this.fieldOptionMaxValue.toString(), null); let fieldInfo = this.createFieldInfo(fieldValidationInfo); - this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null); + this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null, null); break; } case (this.chatWorkflowEditorTypeEnum.Regex): { let fieldValidationInfo = this.createFieldValidationInfo(null, null, this.fieldOptionRegexValue); let fieldInfo = this.createFieldInfo(fieldValidationInfo); - this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null); + this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null, null); break; } } break; } case (this.chatWorkflowBlockTypeEnum.GetCustomerDetails): { - let fieldInfo = this.createCustomerBlockFieldInfo(); - this.newNodeInfo = this.createNodeInfo(null, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null); + let customerBlockFieldInfo : CustomerBlockFieldDetails = { + isEmailEditorEnabled: this.getEmailInfo, + isNameEditorEnabled: this.getNameInfo, + isPhoneEditorEnabled: this.getPhoneNumberInfo, + } + this.newNodeInfo = this.createNodeInfo(null, this.nodeBlockType, this.selectedWorkFlowId, null, null, null, customerBlockFieldInfo); break; } } @@ -325,7 +329,7 @@ export class WorkflowSidebarComponent { } } - public createNodeInfo(editorTypeId: number | null, blockId: number, workflowId: number, fieldInfo: FieldDetails | null, fieldOptionInfo: FieldOptionDetail[] | null, messageInfo: MessageDetails | null): RuleData2 { + public createNodeInfo(editorTypeId: number | null, blockId: number, workflowId: number, fieldInfo: FieldDetails | null, fieldOptionInfo: FieldOptionDetail[] | null, messageInfo: MessageDetails | null, customerBlockFieldInfo: CustomerBlockFieldDetails | null): RuleData2 { let ruleDataId = this.isEdit ? 0 : WorkflowSidebarComponent.nodeLength++; // Need to set value dynamically from db return { id: ruleDataId, @@ -338,7 +342,8 @@ export class WorkflowSidebarComponent { fieldDetails: fieldInfo, branchDetails: null, messageDetails: messageInfo, - fieldOptionDetails: fieldOptionInfo + fieldOptionDetails: fieldOptionInfo, + customerBlockFieldInfo: customerBlockFieldInfo }; } @@ -367,14 +372,6 @@ export class WorkflowSidebarComponent { } } - public createCustomerBlockFieldInfo(): FieldDetails { - return { - hasEmailDetails: this.getEmailInfo, - hasNameDetails: this.getNameInfo, - hasPhoneNumberDetails: this.getPhoneNumberInfo, - } - } - public createNode(width: number, height: number, nodeInfo: RuleData2): NodeModel { return { id: `node${nodeInfo.id}`, diff --git a/src/app/models/appModel.ts b/src/app/models/appModel.ts index 17e7737..e2aad60 100644 --- a/src/app/models/appModel.ts +++ b/src/app/models/appModel.ts @@ -27,9 +27,6 @@ export interface FieldDetails { value?: string; groupId?: number; ruleType?: number; - hasEmailDetails?: boolean; // Indicates if the customer block has email details - hasNameDetails?: boolean; - hasPhoneNumberDetails?: boolean; } // Define MessageDetails interface @@ -49,6 +46,12 @@ export interface BranchDetail { value?: string | null; } +export interface CustomerBlockFieldDetails { + isEmailEditorEnabled?: boolean; + isNameEditorEnabled?: boolean; + isPhoneEditorEnabled?: boolean; +} + // Define the main Workflow interface export interface RuleData2 { id: number; @@ -62,6 +65,8 @@ export interface RuleData2 { branchDetails?: BranchDetail[] | null; messageDetails?: MessageDetails | null; fieldOptionDetails?: FieldOptionDetail[] | null; + customerBlockFieldInfo?: CustomerBlockFieldDetails | null; + parentId?: number | null; } // Define the main Workflow interface @@ -75,5 +80,6 @@ export interface ChatWorkflowRulesData { branchDetails?: BranchDetail[] | null; messageDetails?: MessageDetails | null; fieldOptionDetails?: FieldOptionDetail[] | null; + customerBlockFieldInfo?: CustomerBlockFieldDetails | null; parentId?: number | null; } \ No newline at end of file From df976dbef68aaeb5c1ebacb3e9d10ad31cf83c9a Mon Sep 17 00:00:00 2001 From: VijayalakshmiSF4471 <164475295+VijayalakshmirSF4471@users.noreply.github.com> Date: Mon, 30 Dec 2024 15:52:45 +0530 Subject: [PATCH 5/6] feature(405666): made api path changes --- src/app/api/workflowDesignerAPI.ts | 7 +++++-- .../workflow-diagram/workflow-diagram.component.ts | 2 +- .../workflow-sidebar/workflow-sidebar.component.html | 2 +- src/app/services/workflow.service.ts | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/app/api/workflowDesignerAPI.ts b/src/app/api/workflowDesignerAPI.ts index 789b5eb..ef1343b 100644 --- a/src/app/api/workflowDesignerAPI.ts +++ b/src/app/api/workflowDesignerAPI.ts @@ -3,9 +3,12 @@ export interface WorkflowListPathsType { readonly deleteWorkflowRules: string; } +// Define the path template once +const workflowRulesPath = `{baseUrl}/{workflowId}/rules/{ruleId}`; + const apiPaths: WorkflowListPathsType = { - updateWorkflowRules: `{baseUrl}/{workflowId}/rules/{ruleId}/update`, - deleteWorkflowRules: `{baseUrl}/{ruleId}/rules`, + updateWorkflowRules: workflowRulesPath, + deleteWorkflowRules: workflowRulesPath, } export const WorkflowApiPaths: WorkflowListPathsType = apiPaths; \ No newline at end of file diff --git a/src/app/components/workflow-diagram/workflow-diagram.component.ts b/src/app/components/workflow-diagram/workflow-diagram.component.ts index db18628..4dd3817 100644 --- a/src/app/components/workflow-diagram/workflow-diagram.component.ts +++ b/src/app/components/workflow-diagram/workflow-diagram.component.ts @@ -235,7 +235,7 @@ export class WorkflowDiagramComponent implements AfterViewInit { public onDeleteNode(nodeObject) : void{ let ruleData : RuleData2 = nodeObject.data as RuleData2; const index = this.diagram.nodes.findIndex(node => (node.data as RuleData2).successRuleId === ruleData.id); - this.workflowService.deleteRule(ruleData.id).then((result) => { + this.workflowService.deleteRule(ruleData.chatWorkflowId, ruleData.id).then((result) => { console.log(result.message); this.diagram.setProperties({ nodes: [], connectors: [] }, true); this.diagram.refresh(); diff --git a/src/app/components/workflow-sidebar/workflow-sidebar.component.html b/src/app/components/workflow-sidebar/workflow-sidebar.component.html index ebff77f..36afc3d 100644 --- a/src/app/components/workflow-sidebar/workflow-sidebar.component.html +++ b/src/app/components/workflow-sidebar/workflow-sidebar.component.html @@ -7,7 +7,7 @@ -
diff --git a/src/app/services/workflow.service.ts b/src/app/services/workflow.service.ts index 94ac924..a2ca115 100644 --- a/src/app/services/workflow.service.ts +++ b/src/app/services/workflow.service.ts @@ -24,9 +24,10 @@ export class WorkflowService { return this.http.put<{ message: string }>(url, body, this.httpOptions).toPromise(); } - deleteRule(ruleId: number): Promise<{ message: string }> { + deleteRule(workflowId :number, ruleId: number): Promise<{ message: string }> { const url = WorkflowApiPaths.deleteWorkflowRules .replace('{baseUrl}', this.baseUrl) + .replace('{workflowId}', workflowId.toString()) .replace('{ruleId}', ruleId.toString()); return this.http.delete<{ message: string }>(url, this.httpOptions).toPromise(); From e43dcaa8e35009fd35933e0d4e3b51aac463408e Mon Sep 17 00:00:00 2001 From: VijayalakshmiSF4471 <164475295+VijayalakshmirSF4471@users.noreply.github.com> Date: Tue, 31 Dec 2024 10:50:30 +0530 Subject: [PATCH 6/6] feature(405666): made changes based on delete api route changes --- .../components/workflow-diagram/workflow-diagram.component.ts | 1 + src/app/models/appModel.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/app/components/workflow-diagram/workflow-diagram.component.ts b/src/app/components/workflow-diagram/workflow-diagram.component.ts index 4dd3817..fa11e30 100644 --- a/src/app/components/workflow-diagram/workflow-diagram.component.ts +++ b/src/app/components/workflow-diagram/workflow-diagram.component.ts @@ -121,6 +121,7 @@ export class WorkflowDiagramComponent implements AfterViewInit { if(data.chatWorkflowEditorTypeId == 2) { buttonCount = data.fieldOptionDetails?.length || 0; } + data.chatWorkflowId = this.workflowID; nodeModel.id= `node${data.id}`; nodeModel.width= 200; nodeModel.height= 150 + (buttonCount * 25); diff --git a/src/app/models/appModel.ts b/src/app/models/appModel.ts index 2faf6c3..76805be 100644 --- a/src/app/models/appModel.ts +++ b/src/app/models/appModel.ts @@ -72,6 +72,7 @@ export interface RuleData2 { // Define the main Workflow interface export interface ChatWorkflowRulesData { id: number; + chatWorkflowId: number; successWorkflowId?: number | null; successRuleId?: number | null; chatWorkflowBlockId: number;