diff --git a/ANAConversationPlatform/Models/Button.cs b/ANAConversationPlatform/Models/Button.cs
index 7efd8cc..3929c4d 100644
--- a/ANAConversationPlatform/Models/Button.cs
+++ b/ANAConversationPlatform/Models/Button.cs
@@ -54,6 +54,7 @@ public enum ButtonTypeEnum
DeepLink,
GetAgent,
ApiCall,
- ShowConfirmation
+ ShowConfirmation,
+ FetchChatFlow
}
}
\ No newline at end of file
diff --git a/ANAConversationSimulator/ANAConversationSimulator.csproj b/ANAConversationSimulator/ANAConversationSimulator.csproj
index 3fbe7dc..a8912b8 100644
--- a/ANAConversationSimulator/ANAConversationSimulator.csproj
+++ b/ANAConversationSimulator/ANAConversationSimulator.csproj
@@ -138,6 +138,8 @@
+
+
diff --git a/ANAConversationSimulator/Helpers/ButtonActionHelper.cs b/ANAConversationSimulator/Helpers/ButtonActionHelper.cs
index c9b5d3c..98c8d1c 100644
--- a/ANAConversationSimulator/Helpers/ButtonActionHelper.cs
+++ b/ANAConversationSimulator/Helpers/ButtonActionHelper.cs
@@ -80,7 +80,7 @@ public static void HandlePostTextToThread(string text)
MainPageViewModel.CurrentInstance.AddOutgoingSection(new TextSection
{
SectionType = SectionTypeEnum.Text,
- Text = text
+ Text = text,
});
}
public static void HandlePostMediaToThread(string mediaUrl, ButtonTypeEnum mediaType)
@@ -131,6 +131,11 @@ internal static async Task HandleDeepLinkAsync(string deeplinkSlug)
Utils.ShowDialog($"Deeplink: {deeplinkSlug}.\r\nNote: Deeplinks not supported here");
}
+ internal static async Task HandleFetchChatFlowAsync(string flowUrl)
+ {
+ await MainPageViewModel.CurrentInstance.JoinNodesFromFlowAsync(flowUrl);
+ }
+
public static void NavigateToNode(string nodeId)
{
MainPageViewModel.CurrentInstance.NavigateToNode(nodeId);
diff --git a/ANAConversationSimulator/Helpers/Utils.cs b/ANAConversationSimulator/Helpers/Utils.cs
index ed3344a..de50ec0 100644
--- a/ANAConversationSimulator/Helpers/Utils.cs
+++ b/ANAConversationSimulator/Helpers/Utils.cs
@@ -1,7 +1,10 @@
using ANAConversationSimulator.Models;
+using ANAConversationSimulator.Models.Chat;
using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
@@ -201,6 +204,13 @@ public static string CalculateMD5Hash(string input)
sb.Append(hash[i].ToString("X2"));
return sb.ToString();
}
+
+ public static readonly ButtonTypeEnum[] IGNORED_DEFAULT_BUTTONS = new[] { ButtonTypeEnum.GetItemFromSource };
+
+ public static bool IsSectionTypePresentInNode(JToken node, SectionTypeEnum secType)
+ {
+ return node?["Sections"]?.Any(x => x.ToObject()?.SectionType == secType) == true;
+ }
}
public enum DeviceFormFactorType
diff --git a/ANAConversationSimulator/Models/Chat/Button.cs b/ANAConversationSimulator/Models/Chat/Button.cs
index 6edb84e..c208b43 100644
--- a/ANAConversationSimulator/Models/Chat/Button.cs
+++ b/ANAConversationSimulator/Models/Chat/Button.cs
@@ -117,6 +117,7 @@ public enum ButtonTypeEnum
DeepLink,
GetAgent,
ApiCall,
- ShowConfirmation
+ ShowConfirmation,
+ FetchChatFlow
}
}
\ No newline at end of file
diff --git a/ANAConversationSimulator/Models/Chat/Sections/PrintOTPSection.cs b/ANAConversationSimulator/Models/Chat/Sections/PrintOTPSection.cs
index 4c9a128..81eee1a 100644
--- a/ANAConversationSimulator/Models/Chat/Sections/PrintOTPSection.cs
+++ b/ANAConversationSimulator/Models/Chat/Sections/PrintOTPSection.cs
@@ -1,6 +1,6 @@
using ANAConversationSimulator.Models.Chat;
-namespace ANAConversationSimulator.Models.Sections
+namespace ANAConversationSimulator.Models.Chat.Sections
{
public class PrintOTPSection : Section
{
@@ -9,5 +9,8 @@ public PrintOTPSection()
{
SectionType = SectionTypeEnum.PrintOTP;
}
+
+ //Below fields will be filled at runtime
+ public static string OTP { get; set; }
}
}
diff --git a/ANAConversationSimulator/Models/Chat/Sections/Section.cs b/ANAConversationSimulator/Models/Chat/Sections/Section.cs
index 65260dc..d24e6f4 100644
--- a/ANAConversationSimulator/Models/Chat/Sections/Section.cs
+++ b/ANAConversationSimulator/Models/Chat/Sections/Section.cs
@@ -28,5 +28,5 @@ public enum SectionTypeEnum
Image, Text, Graph, Gif, Audio, Video, Link, EmbeddedHtml, Carousel, Typing, PrintOTP
}
- public enum MessageDirection { In, Out }
+ public enum MessageDirection { In, Out, AwkwardCenter }
}
\ No newline at end of file
diff --git a/ANAConversationSimulator/Package.appxmanifest b/ANAConversationSimulator/Package.appxmanifest
index 986af33..ea41b78 100644
--- a/ANAConversationSimulator/Package.appxmanifest
+++ b/ANAConversationSimulator/Package.appxmanifest
@@ -1,6 +1,6 @@
-
+
ANA Conversation Simulator
diff --git a/ANAConversationSimulator/Services/ChatInterfaceServices/ButtonActionCommand.cs b/ANAConversationSimulator/Services/ChatInterfaceServices/ButtonActionCommand.cs
index 879d6b2..7ddec2b 100644
--- a/ANAConversationSimulator/Services/ChatInterfaceServices/ButtonActionCommand.cs
+++ b/ANAConversationSimulator/Services/ChatInterfaceServices/ButtonActionCommand.cs
@@ -25,11 +25,18 @@ public async void Execute(object parameter)
{
if (parameter is Button button)
{
+ var parentNode = MainPageViewModel.CurrentInstance.GetNodeById(button.NodeId);
+ var parsedParentNode = parentNode?.ToObject();
+
+ //Special Case: Print OTP Section
+ if (Utils.IsSectionTypePresentInNode(parentNode, SectionTypeEnum.PrintOTP))
+ button.VariableValue = PrintOTPSection.OTP;
+
var userData = new Dictionary();
switch (button.ButtonType)
{
case ButtonTypeEnum.PostText:
- if (!button.Hidden)
+ if (!button.Hidden && button.PostToChat)
ButtonActionHelper.HandlePostTextToThread(button.ButtonText);
break;
case ButtonTypeEnum.OpenUrl:
@@ -39,7 +46,7 @@ public async void Execute(object parameter)
if (string.IsNullOrWhiteSpace(button.VariableValue)) return;
ButtonActionHelper.HandleSaveTextInput(button.VariableName, button.VariableValue);
userData[button.VariableName] = button.VariableValue;
- if (!button.Hidden)
+ if (!button.Hidden && button.PostToChat)
ButtonActionHelper.HandlePostTextToThread(button.PrefixText + button.VariableValue + button.PostfixText);
break;
case ButtonTypeEnum.GetEmail:
@@ -52,7 +59,7 @@ public async void Execute(object parameter)
ButtonActionHelper.HandleSaveTextInput(button.VariableName, button.VariableValue);
userData[button.VariableName] = button.VariableValue;
- if (!button.Hidden)
+ if (!button.Hidden && button.PostToChat)
ButtonActionHelper.HandlePostTextToThread(button.PrefixText + button.VariableValue + button.PostfixText);
break;
case ButtonTypeEnum.GetNumber:
@@ -65,7 +72,7 @@ public async void Execute(object parameter)
}
ButtonActionHelper.HandleSaveTextInput(button.VariableName, d.ToString());
userData[button.VariableName] = d.ToString();
- if (!button.Hidden)
+ if (!button.Hidden && button.PostToChat)
ButtonActionHelper.HandlePostTextToThread(button.PrefixText + d.ToString() + button.PostfixText);
break;
case ButtonTypeEnum.GetPhoneNumber:
@@ -78,20 +85,20 @@ public async void Execute(object parameter)
ButtonActionHelper.HandleSaveTextInput(button.VariableName, button.VariableValue);
userData[button.VariableName] = button.VariableValue;
- if (!button.Hidden)
+ if (!button.Hidden && button.PostToChat)
ButtonActionHelper.HandlePostTextToThread(button.PrefixText + button.VariableValue + button.PostfixText);
break;
case ButtonTypeEnum.GetItemFromSource:
- var valueToSave = button.Items.FirstOrDefault(x => x.Value == button.VariableValue);
- if (valueToSave.Key == null && valueToSave.Value == null)
+ var valueToSave = button.Items?.FirstOrDefault(x => x.Value == button.VariableValue);
+ if (valueToSave?.Key == null && valueToSave?.Value == null)
{
Utils.ShowDialog("Invalid value");
return;
}
- ButtonActionHelper.HandleSaveTextInput(button.VariableName, valueToSave.Key);
- userData[button.VariableName] = valueToSave.Key;
+ ButtonActionHelper.HandleSaveTextInput(button.VariableName, valueToSave?.Key);
+ userData[button.VariableName] = valueToSave?.Key;
- if (!button.Hidden)
+ if (!button.Hidden && button.PostToChat)
ButtonActionHelper.HandlePostTextToThread(button.PrefixText + button.VariableValue + button.PostfixText);
break;
case ButtonTypeEnum.GetAddress:
@@ -122,7 +129,7 @@ public async void Execute(object parameter)
userData["STREET_ADDRESS"] = ad.StreetAddress;
#endregion
- if (!button.Hidden)
+ if (!button.Hidden && button.PostToChat)
ButtonActionHelper.HandlePostTextToThread($"{ad.StreetAddress}\r\n\r\nCity: {ad.City}\r\nCountry: {ad.Country}\r\nPin: {ad.PinCode}");
done = true;
}
@@ -143,21 +150,28 @@ public async void Execute(object parameter)
ButtonActionHelper.HandlePostMediaToThread(mediaUrl, button.ButtonType);
break;
case ButtonTypeEnum.NextNode:
- if (!button.Hidden)
+ if (!button.Hidden && button.PostToChat)
ButtonActionHelper.HandlePostTextToThread(button.ButtonText);
if (!string.IsNullOrWhiteSpace(button.VariableName) && button.VariableValue != null) //VariableValue should be != null only
ButtonActionHelper.HandleSaveTextInput(button.VariableName, button.VariableValue);
break;
case ButtonTypeEnum.DeepLink:
await ButtonActionHelper.HandleDeepLinkAsync(button.DeepLinkUrl);
- if (!button.Hidden)
+ if (!button.Hidden && button.PostToChat)
ButtonActionHelper.HandlePostTextToThread(button.ButtonText);
break;
case ButtonTypeEnum.GetAgent:
if (MainPageViewModel.CurrentInstance != null)
MainPageViewModel.CurrentInstance.AgentChat();
- if (!button.Hidden)
+ if (!button.Hidden && button.PostToChat)
+ ButtonActionHelper.HandlePostTextToThread(button.ButtonText);
+ break;
+ case ButtonTypeEnum.FetchChatFlow:
+ if (!button.Hidden && button.PostToChat)
ButtonActionHelper.HandlePostTextToThread(button.ButtonText);
+ if (!string.IsNullOrWhiteSpace(button.VariableName) && button.VariableValue != null) //VariableValue should be != null only
+ ButtonActionHelper.HandleSaveTextInput(button.VariableName, button.VariableValue);
+ await ButtonActionHelper.HandleFetchChatFlowAsync(button.Url);
break;
default:
Utils.ShowDialog($"Button type: {button.ButtonType} not supported");
diff --git a/ANAConversationSimulator/Styles/Custom.xaml b/ANAConversationSimulator/Styles/Custom.xaml
index 63b17f4..fd8172a 100644
--- a/ANAConversationSimulator/Styles/Custom.xaml
+++ b/ANAConversationSimulator/Styles/Custom.xaml
@@ -44,7 +44,10 @@
+
+
+
@@ -54,12 +57,35 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -68,7 +94,7 @@
-
+
@@ -109,7 +135,7 @@
-
+
@@ -122,7 +148,7 @@
-
+
@@ -132,7 +158,7 @@
-
+
@@ -145,7 +171,7 @@
-
+
@@ -154,12 +180,12 @@
-
+
-
+
diff --git a/ANAConversationSimulator/UIHelpers/DirectionToAlignmentConverter.cs b/ANAConversationSimulator/UIHelpers/DirectionToAlignmentConverter.cs
index cf9f259..c0bffdd 100644
--- a/ANAConversationSimulator/UIHelpers/DirectionToAlignmentConverter.cs
+++ b/ANAConversationSimulator/UIHelpers/DirectionToAlignmentConverter.cs
@@ -21,7 +21,8 @@ public object Convert(object value, Type targetType, object parameter, string la
return HorizontalAlignment.Left;
case MessageDirection.Out:
return HorizontalAlignment.Right;
-
+ case MessageDirection.AwkwardCenter:
+ return HorizontalAlignment.Center;
}
}
return value;
diff --git a/ANAConversationSimulator/UIHelpers/DirectionToBackgroundColorConverter.cs b/ANAConversationSimulator/UIHelpers/DirectionToBackgroundColorConverter.cs
index 7107f3e..c5f9d9c 100644
--- a/ANAConversationSimulator/UIHelpers/DirectionToBackgroundColorConverter.cs
+++ b/ANAConversationSimulator/UIHelpers/DirectionToBackgroundColorConverter.cs
@@ -19,8 +19,12 @@ public object Convert(object value, Type targetType, object parameter, string la
{
case MessageDirection.In:
return new SolidColorBrush(Windows.UI.Color.FromArgb(255, 234, 237, 242)) { Opacity = 1 }; //Pale White
+ case MessageDirection.AwkwardCenter:
+ return new SolidColorBrush(Windows.UI.Color.FromArgb(255, 234, 237, 242)) { Opacity = 1 }; //Pale White
case MessageDirection.Out:
return new SolidColorBrush(Windows.UI.Color.FromArgb(255, 0, 173, 239)) { Opacity = 1 }; //NF Yellow
+ default:
+ return new SolidColorBrush(Windows.UI.Color.FromArgb(255, 234, 237, 242)) { Opacity = 1 }; //Pale White
}
}
return value;
diff --git a/ANAConversationSimulator/UIHelpers/DirectionToBorderColorConverter.cs b/ANAConversationSimulator/UIHelpers/DirectionToBorderColorConverter.cs
new file mode 100644
index 0000000..94464ca
--- /dev/null
+++ b/ANAConversationSimulator/UIHelpers/DirectionToBorderColorConverter.cs
@@ -0,0 +1,38 @@
+using ANAConversationSimulator.Models.Chat;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Windows.UI.Xaml.Data;
+using Windows.UI.Xaml.Media;
+
+namespace ANAConversationSimulator.UIHelpers
+{
+ public class DirectionToBorderColorConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, string language)
+ {
+ if (value is MessageDirection direction)
+ {
+ switch (direction)
+ {
+ case MessageDirection.In:
+ return new SolidColorBrush(Windows.UI.Color.FromArgb(255, 234, 237, 242)) { Opacity = 1 }; //Pale White
+ case MessageDirection.AwkwardCenter:
+ return new SolidColorBrush(Windows.UI.Colors.Transparent);
+ case MessageDirection.Out:
+ return new SolidColorBrush(Windows.UI.Color.FromArgb(255, 0, 173, 239)) { Opacity = 1 }; //NF Yellow
+ default:
+ return new SolidColorBrush(Windows.UI.Color.FromArgb(255, 234, 237, 242)) { Opacity = 1 }; //Pale White
+ }
+ }
+ return value;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, string language)
+ {
+ return value;
+ }
+ }
+}
diff --git a/ANAConversationSimulator/UIHelpers/DirectionToBubbleDirectionConverter.cs b/ANAConversationSimulator/UIHelpers/DirectionToBubbleDirectionConverter.cs
index 4ef286e..69a789d 100644
--- a/ANAConversationSimulator/UIHelpers/DirectionToBubbleDirectionConverter.cs
+++ b/ANAConversationSimulator/UIHelpers/DirectionToBubbleDirectionConverter.cs
@@ -21,6 +21,8 @@ public object Convert(object value, Type targetType, object parameter, string la
return ChatBubbleDirection.UpperLeft;
case MessageDirection.Out:
return ChatBubbleDirection.LowerRight;
+ default:
+ return ChatBubbleDirection.UpperLeft;
}
}
return value;
diff --git a/ANAConversationSimulator/UIHelpers/DirectionToForegroundColorConverter.cs b/ANAConversationSimulator/UIHelpers/DirectionToForegroundColorConverter.cs
index 55245ef..2626064 100644
--- a/ANAConversationSimulator/UIHelpers/DirectionToForegroundColorConverter.cs
+++ b/ANAConversationSimulator/UIHelpers/DirectionToForegroundColorConverter.cs
@@ -18,9 +18,11 @@ public object Convert(object value, Type targetType, object parameter, string la
switch (direction)
{
case MessageDirection.In:
- return new SolidColorBrush(Windows.UI.Colors.Black) { Opacity = 1 };
+ return new SolidColorBrush(Windows.UI.Colors.Black) { Opacity = 1 };
case MessageDirection.Out:
return new SolidColorBrush(Windows.UI.Colors.White) { Opacity = 1 };
+ default:
+ return new SolidColorBrush(Windows.UI.Colors.Black) { Opacity = 1 };
}
}
return value;
diff --git a/ANAConversationSimulator/UIHelpers/DirectionToTextAlignmentConverter.cs b/ANAConversationSimulator/UIHelpers/DirectionToTextAlignmentConverter.cs
new file mode 100644
index 0000000..2fab5df
--- /dev/null
+++ b/ANAConversationSimulator/UIHelpers/DirectionToTextAlignmentConverter.cs
@@ -0,0 +1,36 @@
+using ANAConversationSimulator.Models.Chat;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Data;
+
+namespace ANAConversationSimulator.UIHelpers
+{
+ public class DirectionToTextAlignmentConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, string language)
+ {
+ if (value is MessageDirection direction)
+ {
+ switch (direction)
+ {
+ case MessageDirection.In:
+ return TextAlignment.Left;
+ case MessageDirection.Out:
+ return TextAlignment.Left;
+ case MessageDirection.AwkwardCenter:
+ return TextAlignment.Center;
+ }
+ }
+ return value;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, string language)
+ {
+ return value;
+ }
+ }
+}
diff --git a/ANAConversationSimulator/ViewModels/MainPageViewModel.cs b/ANAConversationSimulator/ViewModels/MainPageViewModel.cs
index 05487d1..81573ba 100644
--- a/ANAConversationSimulator/ViewModels/MainPageViewModel.cs
+++ b/ANAConversationSimulator/ViewModels/MainPageViewModel.cs
@@ -65,6 +65,27 @@ public async Task LoadNodesAsync()
Utils.ShowDialog(ex.Message);
}
}
+ public async Task JoinNodesFromFlowAsync(string chatFlowUrl)
+ {
+ try
+ {
+ if (string.IsNullOrWhiteSpace(chatFlowUrl))
+ {
+ Utils.ShowDialog("Given chat flow url is empty! Please provide a correct chat flow url in the button");
+ return;
+ }
+ using (var hc = new HttpClient())
+ {
+ var resp = await hc.GetStringAsync(chatFlowUrl);
+ foreach (var newChatNode in JArray.Parse(resp))
+ chatNodes.Add(newChatNode);
+ }
+ }
+ catch (Exception ex)
+ {
+ Utils.ShowDialog(ex.Message);
+ }
+ }
public JToken GetNodeById(string nodeId)
{
return chatNodes.Children().FirstOrDefault(x => x["Id"].ToString() == nodeId);
@@ -197,6 +218,9 @@ public async void ProcessNode(JToken node, JToken section = null)
case SectionTypeEnum.EmbeddedHtml:
parsedSection = currentSectionSource.ToObject();
break;
+ case SectionTypeEnum.PrintOTP:
+ parsedSection = currentSectionSource.ToObject();
+ break;
case SectionTypeEnum.Carousel:
parsedSection = currentSectionSource.ToObject();
(parsedSection as CarouselSection).Items
@@ -215,6 +239,13 @@ public async void ProcessNode(JToken node, JToken section = null)
default:
break;
}
+#if DEBUG
+ if (Debugger.IsAttached)
+ {
+ if (parsedSection != null)
+ parsedSection.DelayInMs = 0;
+ }
+#endif
if (parsedSection != null)
{
if (parsedSection.DelayInMs > 50 || showTyping) //Add 'typing' bubble if delay is grather than 50 ms
@@ -246,7 +277,21 @@ await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatch
});
});
}
- AddIncommingSection(parsedSection);
+
+ if (parsedNode.NodeType == NodeTypeEnum.Card)
+ {
+ parsedSection.Title = VerbProcessor.Process(parsedNode.CardHeader);
+ parsedSection.Caption = VerbProcessor.Process(parsedNode.CardFooter);
+
+ if (parsedNode.Placement == null || parsedNode.Placement == Placement.Incoming)
+ AddIncommingSection(parsedSection);
+ else if (parsedNode.Placement == Placement.Outgoing)
+ AddOutgoingSection(parsedSection);
+ else if (parsedNode.Placement == Placement.Center)
+ AddCenterSection(parsedSection);
+ }
+ else
+ AddIncommingSection(parsedSection);
}
var remainingSections = sectionsSource.Children().Count() - (sectionIndex + 1);
if (remainingSections > 0)
@@ -311,12 +356,21 @@ public async Task ProcessButtonsAsync(JToken node)
btn.Items = btn.ItemsSource;
}
}
- catch { }
+ catch
+ {
+#if DEBUG
+ if (Debugger.IsAttached)
+ {
+ btn.ItemsSource = JsonConvert.DeserializeObject>("{\r\n \"ADVERTISING & MARKETING SERVICES\": \"Advertising & Marketing Services\",\r\n \"AEROSPACE\": \"Aerospace\",\r\n \"ARCHITECTURE\": \"Architecture\",\r\n \"ARTS & CRAFTS\": \"Arts & Crafts\",\r\n \"AUTOMOTIVE\": \"Automotive\",\r\n \"BANK\": \"Bank\",\r\n \"BIOTECHNOLOGY\": \"Biotechnology\",\r\n \"BOOK STORE\": \"Book Store\",\r\n \"BLOGS\": \"Blogs\",\r\n \"BUSINESS SERVICES\": \"Business Services\",\r\n \"CARS\": \"Cars\",\r\n \"USED CARS\": \"Used Cars\",\r\n \"CARGO & LOGISTICS\": \"Cargo & Logistics\",\r\n \"CATERING\": \"Catering\",\r\n \"CHEMICALS\": \"Chemicals\",\r\n \"COLLEGE\": \"College\",\r\n \"COMMUNITY\": \"Community\",\r\n \"COMPUTERS\": \"Computers\",\r\n \"CONSTRUCTION MATERIAL\": \"Construction Material\",\r\n \"CONSULTANTS\": \"Consultants\",\r\n \"EDUCATION\": \"Education\",\r\n \"ELECTRONICS\": \"Electronics\",\r\n \"ENERGY\": \"Energy\",\r\n \"ENTERTAINMENT\": \"Entertainment\",\r\n \"EQUIPMENT\": \"Equipment\",\r\n \"EVENT PLANNING SERVICES\": \"Event Planning Services\",\r\n \"EVENTS\": \"Events\",\r\n \"EXPORTS\": \"Exports\",\r\n \"FASHION - APPAREL\": \"Fashion - Apparel\",\r\n \"FASHION - FOOTWEAR\": \"Fashion - Footwear\",\r\n \"F&B - BAKERY\": \"F&B - Bakery\",\r\n \"F&B - BARS\": \"F&B - Bars\",\r\n \"F&B - CAFE\": \"F&B - Cafe\",\r\n \"F&B - RESTAURANTS\": \"F&B - Restaurants\",\r\n \"FREELANCER\": \"Freelancer\",\r\n \"FLOWER SHOP\": \"Flower Shop\",\r\n \"FINANCIAL SERVICES\": \"Financial Services\",\r\n \"FURNITURE\": \"Furniture\",\r\n \"GENERAL SERVICES\": \"General Services\",\r\n \"GIFTS & NOVELTIES\": \"Gifts & Novelties\",\r\n \"GROCERY\": \"Grocery\",\r\n \"GAMING\": \"Gaming\",\r\n \"GARDEN\": \"Garden\",\r\n \"HOME FURNISHINGS\": \"Home Furnishings\",\r\n \"HEALTH & FITNESS\": \"Health & Fitness\",\r\n \"HOME APPLIANCES\": \"Home Appliances\",\r\n \"HARDWARE & SANITARY-WARE\": \"Hardware & Sanitary-Ware\",\r\n \"HOME MAINTENANCE\": \"Home Maintenance\",\r\n \"HOME CARE\": \"Home Care\",\r\n \"HOTEL & MOTELS\": \"Hotel & Motels\",\r\n \"HOSPITAL\": \"Hospital\",\r\n \"HYPERMARKET\": \"Hypermarket\",\r\n \"INSURANCE\": \"Insurance\",\r\n \"INTERIOR DESIGN\": \"Interior Design\",\r\n \"KINDER GARTEN\": \"Kinder Garten\",\r\n \"KIDS GOODS\": \"Kids Goods\",\r\n \"KITCHEN EQUIPMENT\": \"Kitchen Equipment\",\r\n \"LEGAL SERVICES\": \"Legal Services\",\r\n \"MANUFACTURERS\": \"Manufacturers\",\r\n \"MEDICAL - DENTAL\": \"Medical - Dental\",\r\n \"MEDICAL - GENERAL\": \"Medical - General\",\r\n \"MEDIA & NEWS\": \"Media & News\",\r\n \"MINING\": \"Mining\",\r\n \"NATURAL & AYURVEDA\": \"Natural & Ayurveda\",\r\n \"NON-PROFIT ORGANIZATION\": \"Non-Profit Organization\",\r\n \"OFFICE SUPPLIES\": \"Office Supplies\",\r\n \"OTHER RETAIL\": \"Other Retail\",\r\n \"OUTDOOR & SPORTING GOODS\": \"Outdoor & Sporting Goods\",\r\n \"PETS\": \"Pets\",\r\n \"PHOTOGRAPHY\": \"Photography\",\r\n \"POLITICAL ORGANIZATION\": \"Political Organization\",\r\n \"REAL ESTATE & CONSTRUCTION\": \"Real Estate & Construction\",\r\n \"RELIGIOUS ORGANIZATION\": \"Religious Organization\",\r\n \"SPA\": \"Spa\",\r\n \"SPORTS\": \"Sports\",\r\n \"SHOPPING COMPLEX\": \"Shopping Complex\",\r\n \"SOFTWARE\": \"Software\",\r\n \"SCIENCE & ENGINEERING\": \"Science & Engineering\",\r\n \"SECURITY\": \"Security\",\r\n \"TELECOMMUNICATION\": \"Telecommunication\",\r\n \"TOURISM\": \"Tourism\",\r\n \"TRADING\": \"Trading\",\r\n \"TRANSPORTATION SERVICE\": \"Transportation Service\",\r\n \"TRAINING INSTITUTES\": \"Training Institutes\",\r\n \"TUITIONS & COACHING\": \"Tuitions & Coaching\",\r\n \"WATCHES\": \"Watches\",\r\n \"WATCHES & JEWELRY\": \"Watches & Jewelry\"\r\n}");
+ btn.Items = btn.ItemsSource;
+ }
+#endif
+ }
CurrentTextInputButtons.Add(btn);
}
//Handling node timeout to default button
- var defaultBtn = allButtons.FirstOrDefault(x => x.DefaultButton);
- if (defaultBtn != null && parsedNode.TimeoutInMs > 0)
+ var defaultBtn = allButtons.FirstOrDefault(x => x.DefaultButton && !Utils.IGNORED_DEFAULT_BUTTONS.Contains(x.ButtonType));
+ if (defaultBtn != null && parsedNode.TimeoutInMs >= 0)
{
buttonTimeoutTimer = new DispatcherTimer()
{
@@ -325,6 +379,7 @@ public async Task ProcessButtonsAsync(JToken node)
buttonTimeoutTimer.Tick += (s, e) =>
{
ClearButtons();
+ ClearButtonTimer();
defaultBtn.Action.Execute(defaultBtn);
};
buttonTimeoutTimer.Start();
@@ -349,6 +404,8 @@ public void AddOutgoingSection(Section sec)
textSec.Text = VerbProcessor.Process(textSec.Text);
sec.Sno = (ChatThread.Count + 1);
ChatThread.Add(sec);
+
+ RemoveOldCenterSectionsFromThread();
}
public void AddIncommingSection(Section sec)
{
@@ -360,7 +417,29 @@ public void AddIncommingSection(Section sec)
sec.Sno = (ChatThread.Count + 1);
ChatThread.Add(sec);
+
+ RemoveOldCenterSectionsFromThread();
+ }
+ public void AddCenterSection(Section sec)
+ {
+ if (sec == null) return;
+
+ sec.Direction = MessageDirection.AwkwardCenter;
+ if (sec is TextSection textSec)
+ textSec.Text = VerbProcessor.Process(textSec.Text);
+
+ sec.Sno = (ChatThread.Count + 1);
+ ChatThread.Add(sec);
+
+ RemoveOldCenterSectionsFromThread();
}
+ public void RemoveOldCenterSectionsFromThread()
+ {
+ var sectionsToRemove = ChatThread.Where(x => x.Direction == MessageDirection.AwkwardCenter && ChatThread.LastOrDefault() != x).ToList();
+ foreach (var section in sectionsToRemove)
+ ChatThread.Remove(section);
+ }
+
public async Task PrecacheSection(Section sec)
{
try
diff --git a/ANAConversationStudio/Models/Chat/Button.cs b/ANAConversationStudio/Models/Chat/Button.cs
index 164abe8..a2d1c94 100644
--- a/ANAConversationStudio/Models/Chat/Button.cs
+++ b/ANAConversationStudio/Models/Chat/Button.cs
@@ -212,7 +212,7 @@ public bool Hidden
}
private string _NextNodeId;
- [Editor(typeof(ReadonlyTextBoxEditor), typeof(ReadonlyTextBoxEditor))]
+ //[Editor(typeof(ReadonlyTextBoxEditor), typeof(ReadonlyTextBoxEditor))]
public string NextNodeId
{
get { return _NextNodeId; }
@@ -248,6 +248,7 @@ public enum ButtonTypeEnum
NextNode,
DeepLink,
GetAgent,
- ShowConfirmation
+ ShowConfirmation,
+ FetchChatFlow
}
}
\ No newline at end of file
diff --git a/ANAConversationStudio/Properties/AssemblyInfo.cs b/ANAConversationStudio/Properties/AssemblyInfo.cs
index 461de35..75ecd99 100644
--- a/ANAConversationStudio/Properties/AssemblyInfo.cs
+++ b/ANAConversationStudio/Properties/AssemblyInfo.cs
@@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("3.26.0.0")]
-[assembly: AssemblyFileVersion("3.26.0.0")]
+[assembly: AssemblyVersion("3.28.0.0")]
+[assembly: AssemblyFileVersion("3.28.0.0")]