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ate Connection: signalR.HubConnection;\r\n\tprivate ConversationId: string = null;\r\n\tprivate EmailAddress: string = null;\r\n\r\n\tconstructor() {\r\n\t\tthis.EmailAddress = this.GetUrlParameter('EmailAddress');\r\n\r\n\t\tthis.Chat = $('#chat').kendoChat({\r\n\t\t\tpost: (args) => this.OnPost(args),\r\n\r\n\t\t}).data('kendoChat');\r\n\r\n\t\tthis.Chat.renderMessage({\r\n\t\t\ttype: 'text',\r\n\t\t\ttext: 'Welcome to CADLearning Assist. Please use the message box below to ask your login related question.',\r\n\t\t\ttimestamp: new Date()\r\n\t\t} as kendo.ui.ChatRenderMessageMessage,\r\n\t\t\t{\r\n\t\t\t\tid: 'Q',\r\n\t\t\t\tname: '',\r\n\t\t\t\ticonUrl: '/images/Q.png'\r\n\t\t\t} as kendo.ui.ChatRenderMessageSender);\r\n\r\n\t\t//Hook up the hub\r\n\t\tthis.Connection = new signalR.HubConnectionBuilder().withUrl('/Hubs/Q').build();\r\n\t\tthis.Connection.start().then(() => {\r\n\t\t\tthis.Connection.on('BroadcastData', (message: QMessageDto) => this.OnReceived(message));\r\n\t\t});\r\n\t}\r\n\r\n\tpublic OnReceived(message: QMessageDto) {\r\n\r\n\t\tif (message.Type === QMessageTypes.Restart) {\r\n\t\t\tthis.ConversationId = null;\r\n\t\t\tdebugger;\r\n\t\t} else {\r\n\t\t\tthis.ConversationId = message.ConversationId;\r\n\t\t\tthis.Chat.renderMessage({\r\n\t\t\t\ttype: 'text',\r\n\t\t\t\ttext: message.Message\r\n\t\t\t} as kendo.ui.ChatRenderMessageMessage, {\r\n\t\t\t\tid: message.FromParticipant === null ? 'Q' : message.FromParticipant.UserId,\r\n\t\t\t\tname: message.FromParticipant === null ? '' : message.FromParticipant.Name,\r\n\t\t\t\ticonUrl: message.FromParticipant === null ? '/images/Q.png' : null\r\n\t\t\t} as kendo.ui.ChatRenderMessageSender)\r\n\t\t}\r\n\t}\r\n\r\n\tpublic OnPost(args: kendo.ui.ChatPostEvent) {\r\n\t\tthis.Connection.invoke('SendMessage', {\r\n\t\t\tType: QMessageTypes.Message,\r\n\t\t\tMessage: args.text,\r\n\t\t\tConversationId: this.ConversationId,\r\n\t\t\tFromParticipant: {\r\n\t\t\t\tUserId: null,\r\n\t\t\t\tName: 'Login User',\r\n\t\t\t\tActive: true,\r\n\t\t\t\tType: QParticipantTypes.User\r\n\t\t\t}\r\n\t\t} as QMessageDto);\r\n\t}\r\n\r\n\tprivate GetUrlParameter(sParam: string) {\r\n\t\tvar sPageURL = window.location.search.substring(1),\r\n\t\t\tsURLVariables = sPageURL.split('&'),\r\n\t\t\tsParameterName,\r\n\t\t\ti;\r\n\r\n\t\tfor (i = 0; i < sURLVariables.length; i++) {\r\n\t\t\tsParameterName = sURLVariables[i].split('=');\r\n\r\n\t\t\tif (sParameterName[0] === sParam) {\r\n\t\t\t\treturn sParameterName[1] === undefined ? null : decodeURIComponent(sParameterName[1]);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nenum QMessageTypes {\r\n\t/** Initial Request */\r\n\tInitialRequest = 1,\r\n\t/** Answer */\r\n\tAnswer = 2,\r\n\t/** Message */\r\n\tMessage = 4,\r\n\t/** User Success */\r\n\tSuccess = 8,\r\n\t/** User Fail */\r\n\tFail = 16,\r\n\t/** Escallation Expert Request */\r\n\tEscallationExpertRequest = 32,\r\n\t/** Restart */\r\n\tRestart = 64,\r\n\t/** Response */\r\n\tResponse = 128,\r\n\t/** Clarifying Question */\r\n\tClarifyingQuestion = 256\r\n}\r\n\r\nenum QParticipantTypes {\r\n\t/** User */\r\n\tUser = 1,\r\n\t/** Expert */\r\n\tExpert = 2,\r\n\t/** CADLearning Subject Matter Expert */\r\n\tCADSME = 4\r\n}\r\n\r\nenum QButtonActionTypes {\r\n\t/** Response */\r\n\tResponse = 1,\r\n\t/** Open Url */\r\n\tOpenUrl = 2,\r\n\t/** Fail */\r\n\tFail = 4,\r\n\t/** Success */\r\n\tSuccess = 8\r\n}\r\n\r\ninterface ShortContentDto {\r\n\t/** The id of the item */\r\n\tId: number;\r\n\t/** The name */\r\n\tName?: string;\r\n\t/** The description */\r\n\tDescription?: string;\r\n\t/** The length of video for the content item */\r\n\tLength: number;\r\n}\r\n\r\ninterface QParticipantDto {\r\n\t/** User Id */\r\n\tUserId: number;\r\n\t/** Name */\r\n\tName: string;\r\n\t/** Access Token */\r\n\tAccessToken: string;\r\n\t/** */\r\n\tType: QParticipantTypes;\r\n\t/** Active in conversation */\r\n\tActive?: boolean;\r\n}\r\n\r\ninterface QMessageButtonDto {\r\n\t/** Button Text */\r\n\tText?: string;\r\n\t/** Value of the response */\r\n\tValue?: string;\r\n\t/** */\r\n\tType: QButtonActionTypes;\r\n}\r\n\r\ninterface QMessageDto {\r\n\t/** Message Id */\r\n\tId: string;\r\n\t/** Conversation Id */\r\n\tConversationId?: string;\r\n\t/** Q Paticipant */\r\n\tFromParticipant?: QParticipantDto;\r\n\t/** Who is the message to? */\r\n\tToParticipants?: QParticipantDto[];\r\n\t/** */\r\n\tType: QMessageTypes;\r\n\t/** Message */\r\n\tMessage?: string;\r\n\t/** Is HTML Message */\r\n\tisHTML: boolean;\r\n\t/** Time stamp of the message */\r\n\tDateTime: Date;\r\n\t/** The message that this response is in reference to. */\r\n\tInResponseToMessageId?: string;\r\n\t/** Verification Token used for out of band invites to the call. */\r\n\tVerificationToken?: string;\r\n\t/** Buttons that can be selected */\r\n\tButtons?: QMessageButtonDto[];\r\n\t/** Only a button press is allowed. */\r\n\tButtonOnly: boolean;\r\n\t/** Lessons */\r\n\tLessons?: ShortContentDto[];\r\n\t/** The product Id if known to be sent on the initiation of a conversation */\r\n\tInitialProductId?: number;\r\n\t/** The version Id if know to be send on the intiiation of a conversation */\r\n\tInitialVersionId?: number;\r\n\t/** Intent Score */\r\n\tIntentScore?: number;\r\n\t/** Interpreted Intent */\r\n\tIntent?: string;\r\n\t/** Concepts */\r\n\tConcepts?: string[];\r\n\t/** Entities */\r\n\tEntities?: object;\r\n\t/** Timestamp for changes */\r\n\tTimeStamp?: string;\r\n}\r\n"]}