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L,SACVX,KAAKsG,MAAMI,aAAaN,EAAa,CACnCO,SAAQC,+BAC+B,QAAlCqC,OAAK3C,MAAMQ,WAAWV,UAAYW,eAAEJ,UAAQ,CAC/CyE,gBAAiBzK,MA+BvBkF,oBACE,MAAMgG,EAAoB7L,KAAKsI,wBAE/BtI,KAAKwG,oBAAoBjF,SACvBsK,EAAkBC,KAAK,MACvB,aACA,iCAA0BC,QAAO,IAAIlL,KAAQ,iEA3atCmL,GAAclK,MA8EfmK,KAAW,8EA9EVD,EAAcxH,oTAFd,CAAC0H,QAAiBC,q5GD7D/BrK,+BAqBGA,8wBC2C+BkE,UAAtBoG,QAAUlM,IAAYmM,iCAkBxBrG,YAAPC,SAAOoG,sCACArG,UAAPC,SAAOoG,yCACArG,UAAPC,WAAOoG,6CACArG,QAAPC,WAAOoG,0CACArG,QAAPC,WAAOoG,wDChDH,IAAMC,GAAb,MAAM,sDAAOA,8BAAaC,WAFZP,iCAFH,CAACQ,KAAcC,KAAaC,KAAeC,KAAaC,KAAaC,KAAeC,SAIlFR,GAAb,EAAaA","names":["period","scheduler","async","val","isArray","parseFloat","isNumeric","schedule","Observable","subscriber","add","dispatch","counter","state","next","this","ChatAppMessageType","VIEWSTATES","closed","action","open","unread","unreadMessageCount","loading","messages","messageType","message","timestamp","Date","getTime","error","dialog","agent","agentInfo","options","label","links","href","download","fileUrl","fileName","fileSize","switchToAgent","switchToBot","warning","i0","messages$","MessageGroupComponent","constructor","elementRef","changeDetectorRef","Subscription","noRoundedTopRightCorner","isFirst","alignment","noRoundedBottomRightCorner","isLast","noRoundedBottomLeftCorner","noRoundedTopLeftCorner","condensedMargin","alignRight","alignLeft","ngOnInit","target","observer","MutationObserver","observe","childList","subtree","disconnect","setMessagesObservable","nativeElement","closest","_messagesSubscription","subscribe","hostElement","parentElement","nextElement","nextElementSibling","previousElement","previousElementSibling","tagName","l","i","markForCheck","ngOnDestroy","unsubscribe","selectors","currentTime$","interval","pipe","map","MessageTimestampComponent","_currentTimeSubscription","currentTime","MessageAgentComponent","MessageBotComponent","MessageDownloadComponent","MessageLinksComponent","EventEmitter","onClick","clicked","emit","MessageOptionsComponent","onSelected","selected","MessageUserComponent","MessageSwitchAgentComponent","onDownloadHistory","downloadHistory","MessageSwitchBotComponent","__decorate","Slot","b","MessageWarningComponent","STORAGE_KEY","environment","store","webSocketService","fileDownloadService","initialized","patchStorage","metadata","Object","m","getStorage","_a","h","_b","viewstate","currentPage","f","_c","parameters","k","_d","y","_e","interactionWithAgent","send","push","chatAppTooltipLabel","openTooltip","messageWrapperElement","scroll","top","scrollHeight","pollAgentIntervalSubscription","o","formattedChatMessages","forEach","msg","T","endMessage","getActor","storageIdentifier","visible","_visible","value","coerceBooleanProperty","t","n","messageDelay","sessionId","initialize","setTimeout","setTooltip","tooltipDelay","ngAfterViewInit","scrollIntoView","startAgentPolling","webSocketSubscription","close","stopAgentPolling","onToggle","onSubmit","ngForm","resetForm","setMessage","onEnter","event","preventDefault","invalid","setStorage","id","storage","connect","getURL","endpoints","chatApi","tap","setLoading","delay","sendChatHistory","setError","callbackMessage","initMessage","sessionMessage","undefined","pollAgentInterval$","pollAgentMessage","sendAgentMessage","onClearHistory","onLinkClick","formattedMessages","join","format","ChatAppElement","ENVIRONMENT","WebSocketService","decls","Viewstate","u","ChatAppModule","bootstrap","CommonModule","FormsModule","LoadingModule","InputModule","ErrorModule","TooltipModule","PipesModule"],"sources":["../node_modules/rxjs/_esm2015/internal/observable/interval.js","../node_modules/rxjs/_esm2015/internal/util/isNumeric.js","./src/app/chat-app/chat-app.model.ts","./src/app/chat-app/chat-app.viewstates.ts","./src/app/chat-app/shared/message-group.component.html","./src/app/chat-app/shared/message-group.component.ts","./src/app/chat-app/shared/message-timestamp.component.ts","./src/app/chat-app/message-agent/message-agent.component.html","./src/app/chat-app/message-agent/message-agent.component.ts","./src/app/chat-app/message-bot/message-bot.component.html","./src/app/chat-app/message-bot/message-bot.component.ts","./src/app/chat-app/message-download/message-download.component.ts","./src/app/chat-app/message-download/message-download.component.html","./src/app/chat-app/message-links/message-links.component.html","./src/app/chat-app/message-links/message-links.component.ts","./src/app/chat-app/message-options/message-options.component.html","./src/app/chat-app/message-options/message-options.component.ts","./src/app/chat-app/message-user/message-user.component.html","./src/app/chat-app/message-user/message-user.component.ts","./src/app/chat-app/message-switch-agent/message-switch-agent.component.html","./src/app/chat-app/message-switch-agent/message-switch-agent.component.ts","./src/app/chat-app/message-switch-bot/message-switch-bot.component.html","./src/app/chat-app/message-switch-bot/message-switch-bot.component.ts","./src/app/chat-app/message-warning/message-warning.component.html","./src/app/chat-app/message-warning/message-warning.component.ts","./src/app/chat-app/chat-app.element.html","./src/app/chat-app/chat-app.element.ts","./src/app/chat-app/chat-app.module.ts"],"sourcesContent":["import { Observable } from '../Observable';\nimport { async } from '../scheduler/async';\nimport { isNumeric } from '../util/isNumeric';\nexport function interval(period = 0, scheduler = async) {\n if (!isNumeric(period) || period < 0) {\n period = 0;\n }\n if (!scheduler || typeof scheduler.schedule !== 'function') {\n scheduler = async;\n }\n return new Observable(subscriber => {\n subscriber.add(scheduler.schedule(dispatch, period, { subscriber, counter: 0, period }));\n return subscriber;\n });\n}\nfunction dispatch(state) {\n const { subscriber, counter, period } = state;\n subscriber.next(counter);\n this.schedule({ subscriber, counter: counter + 1, period }, period);\n}\n","import { isArray } from './isArray';\nexport function isNumeric(val) {\n return !isArray(val) && (val - parseFloat(val) + 1) >= 0;\n}\n","export interface ChatAppElementModel {\n visible: boolean;\n open: boolean;\n error: boolean;\n loading: boolean;\n initialized: boolean;\n messages: Array;\n unreadMessageCount: number;\n}\n\nexport enum ChatAppMessageType {\n Agent = \"Agent\",\n Bot = \"Bot\",\n Download = \"Download\",\n Initialize = \"Initialize\",\n Links = \"Links\",\n Options = \"Options\",\n User = \"User\",\n Process = \"Process\",\n SwitchAgent = \"SwitchAgent\",\n SwitchBot = \"SwitchBot\",\n Warning = \"Warning\",\n PollAgent = \"PollAgent\",\n}\n\nexport interface ChatAppMessage {\n messageType: ChatAppMessageType;\n parameters?: string;\n currentPage?: string;\n timestamp?: Date;\n agentInfo?: string;\n}\n\nexport interface ChatAppMessageAgent extends ChatAppMessage {\n messageType: ChatAppMessageType.Agent;\n message: string;\n}\n\nexport interface ChatAppMessageBot extends ChatAppMessage {\n messageType: ChatAppMessageType.Bot;\n message: string;\n}\n\nexport interface ChatAppMessageDownload extends ChatAppMessage {\n messageType: ChatAppMessageType.Download;\n fileUrl: string;\n fileName: string;\n fileSize: number;\n}\n\nexport interface ChatAppMessageInitialize extends ChatAppMessage {\n messageType: ChatAppMessageType.Initialize;\n message: string;\n}\n\nexport interface ChatAppMessageLinksLink {\n label: string;\n href: string;\n callbackMessage?: string;\n}\n\nexport interface ChatAppMessageLinks extends ChatAppMessage {\n messageType: ChatAppMessageType.Links;\n links: Array;\n}\n\nexport interface ChatAppMessageOptionsOption {\n label: string;\n}\n\nexport interface ChatAppMessageOptions extends ChatAppMessage {\n messageType: ChatAppMessageType.Options;\n options: Array;\n}\n\nexport interface ChatAppMessageUser extends ChatAppMessage {\n messageType: ChatAppMessageType.User;\n message: string;\n}\n\nexport interface ChatAppMessageProcess extends ChatAppMessage {\n messageType: ChatAppMessageType.Process;\n}\n\nexport interface ChatAppMessageSwitchAgent extends ChatAppMessage {\n messageType: ChatAppMessageType.SwitchAgent;\n message: string;\n}\n\nexport interface ChatAppMessageSwitchBot extends ChatAppMessage {\n messageType: ChatAppMessageType.SwitchBot;\n message: string;\n}\n\nexport interface ChatAppMessageWarning extends ChatAppMessage {\n messageType: ChatAppMessageType.Warning;\n message: string;\n}\n\nexport interface ChatAppMessagePollAgent extends ChatAppMessage {\n messageType: ChatAppMessageType.PollAgent;\n agentInfo: string;\n}\n\nexport type ChatAppMessages =\n | ChatAppMessageAgent\n | ChatAppMessageBot\n | ChatAppMessageDownload\n | ChatAppMessageInitialize\n | ChatAppMessageLinks\n | ChatAppMessageUser\n | ChatAppMessageOptions\n | ChatAppMessageProcess\n | ChatAppMessageSwitchAgent\n | ChatAppMessageSwitchBot\n | ChatAppMessageWarning\n | ChatAppMessagePollAgent;\n","import { Viewstates } from \"@vattenfall/core\";\n\nimport { ChatAppMessageType, ChatAppElementModel } from \"./chat-app.model\";\n\nexport const VIEWSTATES: Viewstates = {\n closed: {\n action: \"closed\",\n open: false,\n },\n unread: {\n action: \"unread\",\n open: false,\n unreadMessageCount: 5,\n },\n open: {\n action: \"open\",\n open: true,\n },\n loading: {\n action: \"loading\",\n open: true,\n loading: true,\n messages: [\n {\n messageType: ChatAppMessageType.Bot,\n message: \"Hello, please ask your question directly in the chat!\",\n timestamp: new Date(new Date().getTime() - 1000 * 60 * 5),\n },\n {\n messageType: ChatAppMessageType.Bot,\n message: \"Please keep in mind not to share personal information unless I ask for it.\",\n timestamp: new Date(new Date().getTime() - 1000 * 15),\n },\n {\n messageType: ChatAppMessageType.User,\n message: \"Ok sure I'll try.\",\n timestamp: new Date(new Date().getTime() - 1000 * 12),\n },\n ],\n },\n error: {\n action: \"error\",\n open: true,\n error: true,\n },\n dialog: {\n action: \"dialog\",\n open: true,\n messages: [\n {\n messageType: ChatAppMessageType.Bot,\n message: \"Hello, please ask your question directly in the chat!\",\n timestamp: new Date(new Date().getTime() - 1000 * 60 * 5),\n },\n {\n messageType: ChatAppMessageType.Bot,\n message: \"Please keep in mind not to share personal information unless I ask for it.\",\n timestamp: new Date(new Date().getTime() - 1000 * 60 * 5),\n },\n {\n messageType: ChatAppMessageType.User,\n message: \"Ok, I have a question about my electricity bill.\",\n timestamp: new Date(new Date().getTime() - 1000 * 60 * 4),\n },\n {\n messageType: ChatAppMessageType.Bot,\n message: \"Alright, what's the question?\",\n timestamp: new Date(new Date().getTime() - 1000 * 60 * 4),\n },\n ],\n },\n agent: {\n action: \"agent\",\n open: true,\n messages: [\n {\n messageType: ChatAppMessageType.Agent,\n message: \"Hello, please ask your question directly in the chat!\",\n timestamp: new Date(\"2020-01-01T12:00:00\"),\n agentInfo:\n '{\"SecureKey\":\"c96899871e0c9bbfc33d\",\"ChatId\":\"00135aJTHBPN0463\",\"UserId\":\"020265AEC906019C\",\"Alias\":\"514\",\"NextPosition\":8}',\n },\n {\n messageType: ChatAppMessageType.Agent,\n message: \"Please keep in mind not to share personal information unless I ask for it.\",\n timestamp: new Date(\"2022-11-01T12:00:00\"),\n agentInfo:\n '{\"SecureKey\":\"c96899871e0c9bbfc33d\",\"ChatId\":\"00135aJTHBPN0463\",\"UserId\":\"020265AEC906019C\",\"Alias\":\"514\",\"NextPosition\":8}',\n },\n {\n messageType: ChatAppMessageType.User,\n message: \"Ok, I have a question about my electricity bill.\",\n timestamp: new Date(\"2022-11-01T16:00:00\"),\n agentInfo:\n '{\"SecureKey\":\"c96899871e0c9bbfc33d\",\"ChatId\":\"00135aJTHBPN0463\",\"UserId\":\"020265AEC906019C\",\"Alias\":\"514\",\"NextPosition\":8}',\n },\n {\n messageType: ChatAppMessageType.Agent,\n message: \"Alright, what's the question?\",\n timestamp: new Date(),\n agentInfo:\n '{\"SecureKey\":\"c96899871e0c9bbfc33d\",\"ChatId\":\"00135aJTHBPN0463\",\"UserId\":\"020265AEC906019C\",\"Alias\":\"514\",\"NextPosition\":8}',\n },\n ],\n },\n options: {\n action: \"dialog\",\n open: true,\n messages: [\n {\n messageType: ChatAppMessageType.Bot,\n message: \"Hello, let me suggest a couple of things for you.\",\n },\n {\n messageType: ChatAppMessageType.Options,\n options: [\n {\n label: \"Invoice\",\n },\n {\n label: \"Consumption\",\n },\n ],\n },\n ],\n },\n links: {\n action: \"links\",\n open: true,\n messages: [\n {\n messageType: ChatAppMessageType.Bot,\n message: \"Hello, let me suggest a couple of links for you.\",\n },\n {\n messageType: ChatAppMessageType.Links,\n links: [\n {\n label: \"Prices\",\n href: \"https://www.vattenfall.se/elavtal/elpriser/\",\n },\n {\n label: \"Solar\",\n href: \"https://www.vattenfall.se/solceller/\",\n },\n ],\n },\n ],\n },\n download: {\n action: \"download\",\n open: true,\n messages: [\n {\n messageType: ChatAppMessageType.Bot,\n message: \"Hello, How can I help you?.\",\n timestamp: new Date(new Date().getTime() - 1000 * 14),\n },\n {\n messageType: ChatAppMessageType.User,\n message: \"Can you send me my latest invoice please?\",\n timestamp: new Date(new Date().getTime() - 1000 * 13),\n },\n {\n messageType: ChatAppMessageType.Bot,\n message: \"Sure hold on, I'm sending it to you now.\",\n timestamp: new Date(new Date().getTime() - 1000 * 10),\n },\n {\n messageType: ChatAppMessageType.Download,\n fileUrl: \"https://localhost\",\n fileName: \"august-2022.pdf\",\n fileSize: 96.8,\n },\n ],\n },\n switchToAgent: {\n action: \"switch-to-agent\",\n open: true,\n messages: [\n {\n messageType: ChatAppMessageType.Bot,\n message: \"Hello, this is a bot talking.\",\n timestamp: new Date(new Date().getTime() - 1000 * 15),\n },\n {\n messageType: ChatAppMessageType.SwitchAgent,\n message: \"Now a agent at Customer Service will take over the conversation. Have a great day.\",\n timestamp: new Date(new Date().getTime() - 1000 * 14),\n },\n {\n messageType: ChatAppMessageType.Agent,\n message:\n \"Hello Daniel. My name is Håkan Gillman. Sorry that you had to wait that long. I see that you had a question about changing your contract to Hourly spot .\",\n timestamp: new Date(new Date().getTime() - 1000 * 10),\n },\n ],\n },\n switchToBot: {\n action: \"switch-to-bot\",\n open: true,\n messages: [\n {\n messageType: ChatAppMessageType.Agent,\n message: \"Hello, this is an agent talking.\",\n timestamp: new Date(new Date().getTime() - 1000 * 15),\n },\n {\n messageType: ChatAppMessageType.SwitchBot,\n message: \"The agent ended the conversation.\",\n timestamp: new Date(new Date().getTime() - 1000 * 14),\n },\n ],\n },\n warning: {\n action: \"message-warning\",\n open: true,\n messages: [\n {\n messageType: ChatAppMessageType.Warning,\n message: \"Sorry something went wrong. I could not connect to an agent.\",\n timestamp: new Date(new Date().getTime() - 1000 * 10),\n },\n ],\n },\n};\n","\n\n \n \n \n\n","/* eslint-disable @typescript-eslint/no-non-null-assertion */\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n HostBinding,\n Input,\n OnDestroy,\n OnInit,\n} from \"@angular/core\";\nimport { Observable, Subscription } from \"rxjs\";\n\nlet messages$: Observable | null = null;\n\nconst setMessagesObservable = (target: HTMLElement) => {\n messages$ = new Observable((subscriber) => {\n const observer = new MutationObserver(() => subscriber.next());\n\n observer.observe(target, {\n childList: true,\n subtree: true,\n });\n\n return () => {\n observer.disconnect();\n };\n });\n};\n\n@Component({\n selector: \"message-group\",\n templateUrl: \"./message-group.component.html\",\n host: {\n class: \"ds-relative ds-px ds-py-xs ds-rounded-lg ds-ml-2xl ds-max-w-[75%] ds-min-w-[50%] ds-mb-sm\",\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MessageGroupComponent implements OnInit, OnDestroy {\n @Input() alignment: \"left\" | \"right\" = \"left\";\n @Input() icon: \"agent\" | \"bot\" | \"warning\" | null = null;\n\n isFirst = true;\n isLast = true;\n\n private _messagesSubscription = Subscription.EMPTY;\n\n @HostBinding(\"class.ds-rounded-tr-none\") get noRoundedTopRightCorner() {\n return !this.isFirst && this.alignment === \"right\";\n }\n @HostBinding(\"class.ds-rounded-br-none\") get noRoundedBottomRightCorner() {\n return !this.isLast && this.alignment === \"right\";\n }\n @HostBinding(\"class.ds-rounded-bl-none\") get noRoundedBottomLeftCorner() {\n return !this.isLast && this.alignment === \"left\";\n }\n @HostBinding(\"class.ds-rounded-tl-none\") get noRoundedTopLeftCorner() {\n return !this.isFirst && this.alignment === \"left\";\n }\n @HostBinding(\"class.!ds-mb-2xs\") get condensedMargin() {\n return !this.isLast;\n }\n @HostBinding(\"class.ds-self-end\") get alignRight() {\n return this.alignment === \"right\";\n }\n @HostBinding(\"class.ds-self-start\") get alignLeft() {\n return this.alignment === \"left\";\n }\n\n constructor(private elementRef: ElementRef, private changeDetectorRef: ChangeDetectorRef) {}\n\n ngOnInit() {\n if (!messages$) {\n setMessagesObservable(this.elementRef.nativeElement.closest(\"#chat-app-messages-wrapper\")!);\n }\n this._messagesSubscription = messages$!.subscribe(() => {\n const hostElement = this.elementRef.nativeElement.parentElement!.parentElement!;\n const nextElement = hostElement.nextElementSibling;\n const previousElement = hostElement.previousElementSibling;\n this.isFirst = hostElement.tagName !== previousElement?.tagName;\n this.isLast = hostElement.tagName !== nextElement?.tagName;\n this.changeDetectorRef.markForCheck();\n });\n }\n\n ngOnDestroy() {\n this._messagesSubscription.unsubscribe();\n }\n}\n","import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy, OnInit } from \"@angular/core\";\n\nimport { interval, Subscription } from \"rxjs\";\nimport { map } from \"rxjs/operators\";\n\nconst currentTime$ = interval(3000).pipe(map(() => new Date()));\n\n@Component({\n selector: \"message-timestamp\",\n // eslint-disable-next-line prettier/prettier\n template: `{{ timestamp | relativeTimeFormat: currentTime }}\n`,\n host: {\n class: \"ds-block ds-text-xs ds-font-light ds-opacity-70\",\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MessageTimestampComponent implements OnInit, OnDestroy {\n @Input() timestamp!: Date;\n\n currentTime = new Date();\n\n private _currentTimeSubscription = Subscription.EMPTY;\n\n constructor(private changeDetectorRef: ChangeDetectorRef) {}\n\n ngOnInit() {\n this._currentTimeSubscription = currentTime$.subscribe((currentTime) => {\n this.currentTime = currentTime;\n this.changeDetectorRef.markForCheck();\n });\n }\n\n ngOnDestroy() {\n this._currentTimeSubscription.unsubscribe();\n }\n}\n","
\n \n {{ message.message }}\n \n \n
\n","import { ChangeDetectionStrategy, Component, Input } from \"@angular/core\";\n\nimport { ChatAppMessageAgent } from \"../chat-app.model\";\n\n@Component({\n selector: \"message-agent\",\n templateUrl: \"./message-agent.component.html\",\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MessageAgentComponent {\n @Input() message!: ChatAppMessageAgent;\n}\n","
\n \n {{ message.message }}\n \n \n
\n","import { ChangeDetectionStrategy, Component, Input } from \"@angular/core\";\n\nimport { ChatAppMessageBot } from \"../chat-app.model\";\n\n@Component({\n selector: \"message-bot\",\n templateUrl: \"./message-bot.component.html\",\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MessageBotComponent {\n @Input() message!: ChatAppMessageBot;\n}\n","import { Component, ChangeDetectionStrategy, Input } from \"@angular/core\";\n\nimport { ChatAppMessageDownload } from \"../chat-app.model\";\n\n@Component({\n selector: \"message-download\",\n templateUrl: \"./message-download.component.html\",\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MessageDownloadComponent {\n @Input() message!: ChatAppMessageDownload;\n // TODO (stefan): Add file download service\n}\n","
\n \n
\n {{ message.fileName }}\n
\n
\n ({{ message.fileSize }}kb)\n
\n \n
\n\n","
\n
\n \n {{ link.label }}\n \n
\n
\n","import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from \"@angular/core\";\n\nimport { ChatAppMessageLinks } from \"../chat-app.model\";\n\n@Component({\n selector: \"message-links\",\n templateUrl: \"./message-links.component.html\",\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MessageLinksComponent {\n @Input() message!: ChatAppMessageLinks;\n\n @Output() readonly clicked = new EventEmitter();\n\n onClick(message: string) {\n this.clicked.emit(message);\n }\n}\n","
\n
\n \n {{ option.label }}\n \n
\n
\n","import { Component, ChangeDetectionStrategy, Input, EventEmitter, Output } from \"@angular/core\";\n\nimport { ChatAppMessageOptions } from \"../chat-app.model\";\n\n@Component({\n selector: \"message-options\",\n templateUrl: \"./message-options.component.html\",\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MessageOptionsComponent {\n @Input() message!: ChatAppMessageOptions;\n @Output() readonly selected = new EventEmitter();\n\n onSelected(message: string) {\n this.selected.emit(message);\n }\n}\n","
\n \n {{ message.message }}\n \n \n
\n","import { ChangeDetectionStrategy, Component, Input } from \"@angular/core\";\n\nimport { ChatAppMessageUser } from \"../chat-app.model\";\n\n@Component({\n selector: \"message-user\",\n templateUrl: \"./message-user.component.html\",\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MessageUserComponent {\n @Input() message!: ChatAppMessageUser;\n}\n","
\n \n {{ message.message }}\n \n \n
\n
\n \n \n
\n
\n
\n\n","import { ChangeDetectionStrategy, Component, Input } from \"@angular/core\";\n\nimport { ChatAppMessageSwitchAgent } from \"../chat-app.model\";\n\n@Component({\n selector: \"message-switch-agent\",\n templateUrl: \"./message-switch-agent.component.html\",\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MessageSwitchAgentComponent {\n @Input() message!: ChatAppMessageSwitchAgent;\n}\n","
\n
\n
\n \n \n
\n
\n
\n \n {{ message.message }}\n \n
\n

\n {{ chatAppDownloadHistoryLabel }}\n

\n \n \n {{ chatAppDownloadHistoryButtonLabel }}\n \n
\n
\n\n","import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from \"@angular/core\";\n\nimport { Slot } from \"@vattenfall/core\";\n\nimport { ChatAppMessageSwitchBot } from \"../chat-app.model\";\n\n@Component({\n selector: \"message-switch-bot\",\n templateUrl: \"./message-switch-bot.component.html\",\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MessageSwitchBotComponent {\n @Slot() readonly chatAppDownloadHistoryLabel?: string;\n @Slot() readonly chatAppDownloadHistoryButtonLabel?: string;\n\n @Input() message!: ChatAppMessageSwitchBot;\n @Output() readonly downloadHistory: EventEmitter = new EventEmitter();\n\n onDownloadHistory() {\n this.downloadHistory.emit();\n }\n}\n","
\n \n {{ message.message }}\n \n \n
\n","import { Component, ChangeDetectionStrategy, Input } from \"@angular/core\";\n\nimport { ChatAppMessageWarning } from \"../chat-app.model\";\n\n@Component({\n selector: \"message-warning\",\n templateUrl: \"./message-warning.component.html\",\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MessageWarningComponent {\n @Input() message!: ChatAppMessageWarning;\n}\n","\n \n {{ chatAppException }}\n \n {{ chatAppLabel }}\n\n \n 1\"\n class=\"\n ds-icon ds-icon-download ds-float-right ds-outline-none ds-mr-xl\n sm:!ds-mr-0\n \"\n >\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n {{ chatAppInputLabel }}\n \n \n \n
\n \n \n
\n \n \n \n {{ unreadMessageCount }}\n \n \n\n","import { format } from \"util\";\n\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n Inject,\n Input,\n OnDestroy,\n OnInit,\n Optional,\n ViewChild,\n} from \"@angular/core\";\nimport { NgForm } from \"@angular/forms\";\n\nimport { ENVIRONMENT, Environment, FileDownloadService, Slot, Store, Viewstate, WebSocketService } from \"@vattenfall/core\";\nimport { BooleanInput, coerceBooleanProperty, getURL } from \"@vattenfall/util\";\n\nimport { Subscription, interval } from \"rxjs\";\nimport { delay, tap } from \"rxjs/operators\";\n\nimport {\n ChatAppElementModel,\n ChatAppMessageInitialize,\n ChatAppMessagePollAgent,\n ChatAppMessageType,\n ChatAppMessages,\n} from \"./chat-app.model\";\n\nimport { VIEWSTATES } from \"./chat-app.viewstates\";\n\nexport const STORAGE_KEY = \"ChatAppElement\";\n\nexport interface ChatAppStateModel {\n sessionId: string;\n messages: Array;\n metadata: {\n currentPage: string;\n parameters: string;\n initialized: boolean;\n unreadMessageCount: number;\n interactionWithAgent: boolean;\n agentInfo: string;\n callbackMessage: string;\n };\n}\n\n/**\n * Chat application allowing for client-server conversations.\n *\n * Will occupy a fixed position on the bottom right corner of the page, and expand once enabled by the user.\n *\n * Supports different sets of messages depending on what is received from the server.\n */\n@Component({\n selector: \"chat-app\",\n templateUrl: \"./chat-app.element.html\",\n styleUrls: [\"./chat-app.element.scss\"],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [WebSocketService],\n})\nexport class ChatAppElement implements ChatAppElementModel, OnInit, OnDestroy, AfterViewInit {\n @Input() @Viewstate(VIEWSTATES) viewstate?: string;\n\n /** Hidden message to be sent when the chat is initialized to show intent. */\n @Input() sessionMessage = \"hej\";\n\n /** Time until a tooltip should appear (over the chat icon) expressed in milliseconds. */\n @Input() tooltipDelay = 3000;\n\n /** Whether the chat should be visible to the user on the given page. */\n @Input()\n get visible(): boolean {\n return this._visible;\n }\n set visible(value: BooleanInput) {\n this._visible = coerceBooleanProperty(value);\n }\n _visible = false;\n\n @Slot() readonly chatAppLabel?: string;\n @Slot() readonly chatAppInputLabel?: string;\n @Slot() readonly chatAppTooltipLabel?: string;\n @Slot() readonly chatAppException?: string;\n @Slot() readonly chatAppDownloadHistoryButtonLabel?: string;\n\n @ViewChild(\"ngForm\") ngForm!: NgForm;\n @ViewChild(\"messageWrapperElement\") messageWrapperElement!: ElementRef;\n\n /** Whether the chat has been initialized or not. */\n initialized = false;\n\n /** Whether the chat window is open. */\n open = false;\n\n /** Whether the tooltip is open. */\n openTooltip = false;\n\n /** Whether the chat has failed. */\n error = false;\n\n /** Whether server is processing. */\n loading = false;\n\n /** Unique identifier for the session. */\n sessionId = \"\";\n\n /** List of messages for the session. */\n messages: Array = [];\n\n /** Holds the count for unread messages. */\n unreadMessageCount = 0;\n\n /** Holds the current page values used for extending a session. Read more here: https://cloud.google.com/dialogflow/cx/docs/concept/session */\n private currentPage = \"\";\n\n /** Holds the current page parameters used for extending a session. Read more here: https://cloud.google.com/dialogflow/cx/docs/concept/session */\n private parameters = \"\";\n\n /** Placeholder to know if user is interacting with agent or not */\n private get interactionWithAgent() {\n return this.store.getStorage(STORAGE_KEY)?.metadata?.interactionWithAgent;\n }\n\n /**\n * Delay response time from bot to simulate a real conversation.\n * When talking to live agent, we return immediately. We already have a delay in the polling.\n * @returns {number} Zero milliseconds if talking to live agent, otherwise 1500 milliseconds.\n */\n private get messageDelay() {\n return this.interactionWithAgent ? 0 : 1500;\n }\n\n private webSocketSubscription = Subscription.EMPTY;\n\n private pollAgentIntervalSubscription = Subscription.EMPTY;\n\n constructor(\n @Optional()\n @Inject(ENVIRONMENT)\n private environment: Environment,\n private changeDetectorRef: ChangeDetectorRef,\n private store: Store,\n private webSocketService: WebSocketService,\n private fileDownloadService: FileDownloadService\n ) {\n this.store.storageIdentifier = \".\";\n }\n\n ngOnInit() {\n if (!this.viewstate) {\n // Always show the chat if the user has an open chat session (from some other page)\n if (this.store.getStorage(STORAGE_KEY).sessionId) {\n this.visible = true;\n this.initialize();\n }\n\n if (this.visible) {\n // Display the tooltip message\n setTimeout(this.setTooltip(true), this.tooltipDelay);\n // Make sure to close the message after a duration of time\n setTimeout(this.setTooltip(false), this.tooltipDelay * 6);\n }\n }\n }\n\n ngAfterViewInit() {\n if (this.visible)\n // Keeps track of when messages are added into the view and scrolls to the last message\n new MutationObserver(this.scrollIntoView).observe(this.messageWrapperElement.nativeElement, {\n subtree: true,\n childList: true,\n });\n\n if (this.interactionWithAgent) {\n // We are having an ongoing conversation with an agent,\n // We force initialize the chat.\n // Otherwise the chat is intialized when the user clicks on the chat icon and opens the chat window.\n this.initialize();\n this.startAgentPolling();\n }\n }\n\n ngOnDestroy() {\n // Fix for 'TypeError: Cannot read properties of undefined' in Storybook\n if (!this.viewstate) {\n if (this.webSocketSubscription) this.webSocketSubscription.unsubscribe();\n this.webSocketService.close();\n }\n // Stop any potential polling, by sending interactionWithAgent as false when we kill the component.\n this.stopAgentPolling();\n }\n\n onToggle() {\n if (!this.viewstate && !this.initialized) this.initialize();\n if (!this.open) {\n this.unreadMessageCount = 0;\n this.openTooltip = false;\n this.store.patchStorage(STORAGE_KEY, {\n metadata: {\n ...this.store.getStorage(STORAGE_KEY)?.metadata,\n unreadMessageCount: 0,\n },\n });\n }\n this.open = !this.open;\n this.scrollIntoView();\n }\n\n onSubmit(message: string) {\n this.ngForm.resetForm();\n this.setMessage({\n messageType: ChatAppMessageType.User,\n currentPage: this.currentPage,\n parameters: this.parameters,\n ...(this.interactionWithAgent && {\n agentInfo: this.store.getStorage(STORAGE_KEY).metadata.agentInfo,\n }),\n message,\n });\n }\n\n onEnter(event: Event) {\n event.preventDefault();\n if (this.ngForm.invalid) return;\n this.onSubmit(this.ngForm.value.message);\n }\n\n private initialize() {\n // Save session key in storage so the chat session can persist over page reloads\n if (!this.store.getStorage(STORAGE_KEY).sessionId)\n this.store.setStorage(STORAGE_KEY, {\n sessionId: this.store.id,\n messages: [],\n metadata: {\n currentPage: \"\",\n parameters: \"\",\n initialized: false,\n unreadMessageCount: 0,\n interactionWithAgent: false,\n },\n });\n const storage = this.store.getStorage(STORAGE_KEY);\n // Load conversation from storage\n this.messages = storage.messages;\n this.sessionId = storage.sessionId && this.store.id;\n this.currentPage = storage.metadata.currentPage;\n this.parameters = storage.metadata.parameters;\n this.initialized = storage.metadata.initialized;\n this.unreadMessageCount = storage.metadata.unreadMessageCount;\n this.changeDetectorRef.markForCheck();\n // Establish connection once the session ID has been resolved\n this.webSocketService.connect(getURL(this.environment.endpoints.chatApi, { sessionId: this.sessionId }));\n if (this.webSocketService.messages)\n this.webSocketSubscription = this.webSocketService.messages\n ?.pipe(\n tap(this.setLoading),\n delay(this.messageDelay),\n tap((message: ChatAppMessages) => {\n if (message?.messageType === ChatAppMessageType.SwitchAgent) {\n this.store.patchStorage(STORAGE_KEY, {\n metadata: {\n ...this.store.getStorage(STORAGE_KEY)?.metadata,\n agentInfo: message.agentInfo,\n interactionWithAgent: true,\n },\n });\n this.sendChatHistory();\n this.startAgentPolling();\n }\n if (message?.messageType === ChatAppMessageType.SwitchBot) {\n this.store.patchStorage(STORAGE_KEY, {\n metadata: {\n ...this.store.getStorage(STORAGE_KEY)?.metadata,\n agentInfo: \"\",\n interactionWithAgent: false,\n },\n });\n this.stopAgentPolling();\n }\n if (message?.messageType === ChatAppMessageType.Agent) {\n this.store.patchStorage(STORAGE_KEY, {\n metadata: { ...this.store.getStorage(STORAGE_KEY)?.metadata, agentInfo: message.agentInfo },\n });\n }\n return message;\n })\n )\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .subscribe(this.setMessage, this.setError);\n\n // Read storage for callback message. If it exists, it means that we need to recover a conversation.\n const { callbackMessage } = this.store.getStorage(STORAGE_KEY).metadata;\n\n // Prioritize callback message over session message.\n // If there is no callback message, we use the session message to initiate the conversation.\n const initMessage: ChatAppMessageInitialize = {\n messageType: ChatAppMessageType.Initialize,\n message: callbackMessage || this.sessionMessage,\n };\n // Clear callback message from storage\n if (callbackMessage) {\n this.store.patchStorage(STORAGE_KEY, {\n metadata: {\n ...this.store.getStorage(STORAGE_KEY)?.metadata,\n callbackMessage: undefined,\n },\n });\n }\n\n // Start the conversation if there is a callback message. Meaning we need to recover a conversation.\n // Or if the chat is not initialized, meaning we need to start a new conversation.\n if (callbackMessage || !this.initialized) this.webSocketService.send(initMessage);\n }\n\n private setMessage = (message: ChatAppMessages) => {\n // Process messages should not be handled\n if (message.messageType === ChatAppMessageType.Process) return;\n else this.loading = false;\n if (!this.initialized) {\n this.initialized = true;\n this.store.patchStorage(STORAGE_KEY, {\n metadata: {\n ...this.store.getStorage(STORAGE_KEY)?.metadata,\n initialized: true,\n },\n });\n }\n if (!this.open) {\n this.unreadMessageCount++;\n this.store.patchStorage(STORAGE_KEY, {\n metadata: {\n ...this.store.getStorage(STORAGE_KEY)?.metadata,\n unreadMessageCount: this.unreadMessageCount,\n },\n });\n }\n\n if (!this.viewstate) {\n this.currentPage = message.currentPage ?? \"\";\n this.parameters = message.parameters ?? \"\";\n this.store.patchStorage(STORAGE_KEY, {\n messages: this.messages,\n metadata: {\n ...this.store.getStorage(STORAGE_KEY)?.metadata,\n currentPage: message.currentPage,\n parameters: message.parameters,\n },\n });\n if (message.messageType === ChatAppMessageType.User) {\n const { interactionWithAgent, agentInfo } = this.store.getStorage(STORAGE_KEY).metadata;\n if (interactionWithAgent) message.agentInfo = agentInfo;\n this.webSocketService.send(message);\n }\n }\n message.timestamp = new Date();\n this.messages.push(message);\n this.store.patchStorage(STORAGE_KEY, { messages: this.messages });\n this.changeDetectorRef.markForCheck();\n };\n\n private setLoading = (message: ChatAppMessages) => {\n if (message.messageType === ChatAppMessageType.Process) this.loading = true;\n this.changeDetectorRef.markForCheck();\n };\n\n private setError = () => {\n this.error = true;\n this.changeDetectorRef.markForCheck();\n };\n\n private setTooltip = (open: boolean) => () => {\n if (this.chatAppTooltipLabel && !this.initialized && !this.error) {\n this.openTooltip = open;\n this.changeDetectorRef.markForCheck();\n }\n };\n\n private scrollIntoView = () => {\n // Scroll to last message\n this.messageWrapperElement.nativeElement.scroll({\n top: this.messageWrapperElement.nativeElement.scrollHeight,\n });\n // Ensures that message isFirst and isLast is checked correctly\n this.changeDetectorRef.markForCheck();\n };\n\n private startAgentPolling() {\n const sendAgentMessage = () => {\n const { agentInfo } = this.store.getStorage(STORAGE_KEY).metadata;\n const pollAgentMessage: ChatAppMessagePollAgent = {\n messageType: ChatAppMessageType.PollAgent,\n agentInfo: agentInfo,\n };\n this.webSocketService?.send(pollAgentMessage);\n };\n const pollAgentInterval$ = interval(3700);\n this.pollAgentIntervalSubscription = pollAgentInterval$.subscribe(sendAgentMessage);\n }\n private stopAgentPolling = () => {\n this.pollAgentIntervalSubscription.unsubscribe();\n };\n\n /**\n * Sends the chat history via websocket.\n * Among other situations, this is used when the user switches from bot to agent.\n * All the messages until this point are converted to ChatMessagType.User and sent via websocket service.\n */\n private sendChatHistory = () => {\n const agentInfo = this.store.getStorage(STORAGE_KEY).metadata.agentInfo;\n\n /** Start the conversation messages with a line wrapper */\n const startMessage: ChatAppMessages = {\n messageType: ChatAppMessageType.User,\n message: \"########### This is what what the user said to me ###########\",\n agentInfo: agentInfo,\n };\n this.webSocketService?.send(startMessage);\n /** Convert and send to websocket service all the messages until this point. */\n const formattedMessages = this.formattedChatMessages();\n formattedMessages.forEach((msg?: string) => {\n if (msg)\n this.webSocketService?.send({\n messageType: ChatAppMessageType.User,\n message: msg,\n agentInfo: agentInfo,\n });\n });\n /** The end message to mark the conversation end for UX purposes in the agent side. */\n const endMessage: ChatAppMessages = {\n messageType: ChatAppMessageType.User,\n message: \"########### Regards, Elliot! ###########\",\n agentInfo: agentInfo,\n };\n this.webSocketService?.send(endMessage);\n };\n onClearHistory() {\n // Clear messages\n this.messages = [];\n // Clear storage messages\n this.store.patchStorage(STORAGE_KEY, { messages: [] });\n // Re-initialize the chat\n this.webSocketService.send({\n messageType: ChatAppMessageType.Initialize,\n message: this.sessionMessage,\n });\n }\n onLinkClick(message: string) {\n this.store.patchStorage(STORAGE_KEY, {\n metadata: {\n ...this.store.getStorage(STORAGE_KEY)?.metadata,\n callbackMessage: message,\n },\n });\n }\n private getActor = (message: ChatAppMessages): string => {\n // TODO: Use hardcoded strings for now, but should be replaced with EPi slots\n switch (message.messageType) {\n case ChatAppMessageType.User:\n return \"Användare\";\n case ChatAppMessageType.Bot:\n return \"Bot\";\n case ChatAppMessageType.Agent:\n return \"Agent\";\n case ChatAppMessageType.Links:\n return \"Användare\";\n default:\n return \"Bot\";\n }\n };\n private formattedChatMessages = () => {\n // Map messages\n const formattedMessages = this.messages.map((msg) => {\n // Add type guard to check if 'message' property exists\n // We are only interested in messages with a 'message' property\n if (!(\"message\" in msg) || !msg.message) return;\n return `${this.getActor(msg)}: ${msg.message} \\n`;\n });\n\n return formattedMessages;\n };\n\n onDownloadHistory() {\n const formattedMessages = this.formattedChatMessages();\n\n this.fileDownloadService.download(\n formattedMessages.join(\"\\n\"),\n \"text/plain\",\n `Vattenfall_Försäljning_${format(new Date(), \"yyyy-MM-dd hhmm\")}.txt`\n );\n }\n}\n","import { CommonModule } from \"@angular/common\";\nimport { NgModule } from \"@angular/core\";\nimport { FormsModule } from \"@angular/forms\";\nimport { PipesModule } from \"@vattenfall/core\";\nimport { LoadingModule, InputModule, ErrorModule, TooltipModule } from \"@vattenfall/ui\";\n\nimport { ChatAppElement } from \"./chat-app.element\";\nimport { MessageAgentComponent } from \"./message-agent/message-agent.component\";\nimport { MessageBotComponent } from \"./message-bot/message-bot.component\";\nimport { MessageDownloadComponent } from \"./message-download/message-download.component\";\nimport { MessageLinksComponent } from \"./message-links/message-links.component\";\nimport { MessageOptionsComponent } from \"./message-options/message-options.component\";\nimport { MessageSwitchAgentComponent } from \"./message-switch-agent/message-switch-agent.component\";\nimport { MessageSwitchBotComponent } from \"./message-switch-bot/message-switch-bot.component\";\nimport { MessageUserComponent } from \"./message-user/message-user.component\";\nimport { MessageWarningComponent } from \"./message-warning/message-warning.component\";\nimport { MessageGroupComponent } from \"./shared/message-group.component\";\nimport { MessageTimestampComponent } from \"./shared/message-timestamp.component\";\n\n@NgModule({\n declarations: [\n ChatAppElement,\n MessageAgentComponent,\n MessageBotComponent,\n MessageDownloadComponent,\n MessageLinksComponent,\n MessageUserComponent,\n MessageOptionsComponent,\n MessageSwitchAgentComponent,\n MessageSwitchBotComponent,\n MessageWarningComponent,\n MessageTimestampComponent,\n MessageGroupComponent,\n ],\n imports: [CommonModule, FormsModule, LoadingModule, InputModule, ErrorModule, TooltipModule, PipesModule],\n exports: [ChatAppElement],\n bootstrap: [ChatAppElement],\n})\nexport class ChatAppModule {}\n"],"sourceRoot":"webpack:///","file":"239.js"}