@telia-ace/knowledge-widget-bot-provider 0.0.1-alpha.61 → 0.0.1-alpha.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +5 -5
- package/README.md +12 -12
- package/dist/client/chat.client.d.ts +16 -16
- package/dist/client/contact-method.client.d.ts +25 -25
- package/dist/client/http.client.d.ts +23 -23
- package/dist/client/middleware.client.d.ts +14 -14
- package/dist/contact-method.15886c3d.js.map +1 -1
- package/dist/contract/custom-component/contact-method-item.d.ts +8 -8
- package/dist/contract/custom-component/contact-method-list.d.ts +7 -7
- package/dist/contract/custom-component/contact-method.d.ts +3 -3
- package/dist/contract/enum/server-entry-type.enum.d.ts +7 -7
- package/dist/contract/model/conversation-api-model/list.model.d.ts +5 -5
- package/dist/contract/model/conversation-api-model/message.model.d.ts +7 -7
- package/dist/contract/model/http/action.model.d.ts +3 -3
- package/dist/contract/model/http/client-action.model.d.ts +4 -4
- package/dist/contract/model/http/client-envelope.model.d.ts +9 -9
- package/dist/contract/model/http/connect-options.model.d.ts +5 -5
- package/dist/contract/model/http/global-state.model.d.ts +8 -8
- package/dist/contract/model/http/http-client-options.model.d.ts +5 -5
- package/dist/contract/model/http/server-entry.model.d.ts +11 -11
- package/dist/contract/model/http/server-envelope.model.d.ts +10 -10
- package/dist/contract/model/middleware/aggregator-state.model.d.ts +4 -4
- package/dist/contract/model/shared/loose-object.model.d.ts +3 -3
- package/dist/helper/chat.helper.d.ts +8 -8
- package/dist/helper/http.helper.d.ts +13 -13
- package/dist/helper/middleware.helper.d.ts +12 -12
- package/dist/helper/store.helper.d.ts +22 -22
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/interface/entry.interface.d.ts +20 -20
- package/dist/interface/middleware/paging.interface.d.ts +4 -4
- package/dist/interface/middleware/processor.interface.d.ts +10 -10
- package/dist/plugin.d.ts +3 -3
- package/package.json +9 -9
package/LICENSE.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Copyright © 2021, Telia Company AB. All rights reserved.
|
|
2
|
-
|
|
3
|
-
THIS PACKAGE AND CONTAINING SOFTWARE IS PART OF
|
|
4
|
-
THE HUMANY SERVICE. BY USING THIS SOFTWARE YOU
|
|
5
|
-
AGREE TO THE FOLLOWING TERMS AND CONDITIONS:
|
|
1
|
+
Copyright © 2021, Telia Company AB. All rights reserved.
|
|
2
|
+
|
|
3
|
+
THIS PACKAGE AND CONTAINING SOFTWARE IS PART OF
|
|
4
|
+
THE HUMANY SERVICE. BY USING THIS SOFTWARE YOU
|
|
5
|
+
AGREE TO THE FOLLOWING TERMS AND CONDITIONS:
|
|
6
6
|
http://www.humany.com/legal
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# `@telia-ace/knowledge-widget-bot-provider`
|
|
2
|
-
|
|
3
|
-
Provider for the ACE Knowledge chat bot.
|
|
4
|
-
|
|
5
|
-
For this provider to work, the "chat.bot" provider must be registered in the widget config file.
|
|
6
|
-
|
|
7
|
-
In addition, these plugins are also required:
|
|
8
|
-
WidgetHeaderComponent
|
|
9
|
-
AreaComponent
|
|
10
|
-
ConversationComponent
|
|
11
|
-
DefaultContactMethodsPlugin
|
|
12
|
-
ConversationPlugin
|
|
1
|
+
# `@telia-ace/knowledge-widget-bot-provider`
|
|
2
|
+
|
|
3
|
+
Provider for the ACE Knowledge chat bot.
|
|
4
|
+
|
|
5
|
+
For this provider to work, the "chat.bot" provider must be registered in the widget config file.
|
|
6
|
+
|
|
7
|
+
In addition, these plugins are also required:
|
|
8
|
+
WidgetHeaderComponent
|
|
9
|
+
AreaComponent
|
|
10
|
+
ConversationComponent
|
|
11
|
+
DefaultContactMethodsPlugin
|
|
12
|
+
ConversationPlugin
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { Container } from '@webprovisions/platform';
|
|
2
|
-
import { Message } from '../contract/model/conversation-api-model/message.model';
|
|
3
|
-
import EntryInterface from '../interface/entry.interface';
|
|
4
|
-
export default class ChatClient {
|
|
5
|
-
entryInterface: EntryInterface;
|
|
6
|
-
constructor(container: Container);
|
|
7
|
-
static initialize(user: any, agent: any): void;
|
|
8
|
-
processMessageArrayAndStoreIt(messages: Message[]): void;
|
|
9
|
-
updateMessageArrayAndStoreIt(messages: Message[]): void;
|
|
10
|
-
printUserMessageAndStoreIt(action: string): void;
|
|
11
|
-
private postUserMessage;
|
|
12
|
-
private postAgentMessage;
|
|
13
|
-
private getTitleFromEntry;
|
|
14
|
-
private getTitleFromText;
|
|
15
|
-
private getTitleFromList;
|
|
16
|
-
}
|
|
1
|
+
import { Container } from '@webprovisions/platform';
|
|
2
|
+
import { Message } from '../contract/model/conversation-api-model/message.model';
|
|
3
|
+
import EntryInterface from '../interface/entry.interface';
|
|
4
|
+
export default class ChatClient {
|
|
5
|
+
entryInterface: EntryInterface;
|
|
6
|
+
constructor(container: Container);
|
|
7
|
+
static initialize(user: any, agent: any): void;
|
|
8
|
+
processMessageArrayAndStoreIt(messages: Message[]): void;
|
|
9
|
+
updateMessageArrayAndStoreIt(messages: Message[]): void;
|
|
10
|
+
printUserMessageAndStoreIt(action: string): void;
|
|
11
|
+
private postUserMessage;
|
|
12
|
+
private postAgentMessage;
|
|
13
|
+
private getTitleFromEntry;
|
|
14
|
+
private getTitleFromText;
|
|
15
|
+
private getTitleFromList;
|
|
16
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { ContactMethodPlatform } from '@telia-ace/knowledge-widget-adapters';
|
|
2
|
-
import { DataClient } from '@telia-ace/knowledge-widget-types-grid';
|
|
3
|
-
import { Container } from '@webprovisions/platform';
|
|
4
|
-
export declare class ContactMethodClient {
|
|
5
|
-
private static dataClient;
|
|
6
|
-
private static contactMethodPlatform;
|
|
7
|
-
private static contactMessageEntryArray;
|
|
8
|
-
private static agent;
|
|
9
|
-
private chatClient;
|
|
10
|
-
private static container;
|
|
11
|
-
constructor(container: Container);
|
|
12
|
-
static initialize(container: any, dataClient: DataClient, contactMethodPlatform: ContactMethodPlatform, agent: any): void;
|
|
13
|
-
handleNewForm: (errors: any, entry: any) => Promise<void>;
|
|
14
|
-
handleContactMethod: (input?: string) => Promise<void>;
|
|
15
|
-
validate(form: any): void;
|
|
16
|
-
private handleContactCategoryList;
|
|
17
|
-
private handleForm;
|
|
18
|
-
private handleContactMethodList;
|
|
19
|
-
private handleSingleContactMethod;
|
|
20
|
-
private submit;
|
|
21
|
-
private removeForm;
|
|
22
|
-
private printMessage;
|
|
23
|
-
private loadContactMethods;
|
|
24
|
-
private updateForm;
|
|
25
|
-
}
|
|
1
|
+
import { ContactMethodPlatform } from '@telia-ace/knowledge-widget-adapters';
|
|
2
|
+
import { DataClient } from '@telia-ace/knowledge-widget-types-grid';
|
|
3
|
+
import { Container } from '@webprovisions/platform';
|
|
4
|
+
export declare class ContactMethodClient {
|
|
5
|
+
private static dataClient;
|
|
6
|
+
private static contactMethodPlatform;
|
|
7
|
+
private static contactMessageEntryArray;
|
|
8
|
+
private static agent;
|
|
9
|
+
private chatClient;
|
|
10
|
+
private static container;
|
|
11
|
+
constructor(container: Container);
|
|
12
|
+
static initialize(container: any, dataClient: DataClient, contactMethodPlatform: ContactMethodPlatform, agent: any): void;
|
|
13
|
+
handleNewForm: (errors: any, entry: any) => Promise<void>;
|
|
14
|
+
handleContactMethod: (input?: string) => Promise<void>;
|
|
15
|
+
validate(form: any): void;
|
|
16
|
+
private handleContactCategoryList;
|
|
17
|
+
private handleForm;
|
|
18
|
+
private handleContactMethodList;
|
|
19
|
+
private handleSingleContactMethod;
|
|
20
|
+
private submit;
|
|
21
|
+
private removeForm;
|
|
22
|
+
private printMessage;
|
|
23
|
+
private loadContactMethods;
|
|
24
|
+
private updateForm;
|
|
25
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { Container } from '@webprovisions/platform';
|
|
2
|
-
export declare class HttpClient {
|
|
3
|
-
private endpointUrl;
|
|
4
|
-
private clientId;
|
|
5
|
-
private projectionPath;
|
|
6
|
-
private apiEndpoint;
|
|
7
|
-
private options;
|
|
8
|
-
private middlewareClient;
|
|
9
|
-
private chatClient;
|
|
10
|
-
constructor(endpoint: string, clientId: string, container: Container);
|
|
11
|
-
firstHit(): void;
|
|
12
|
-
handleUpdate(action: string): void;
|
|
13
|
-
handleInput(action: string): void;
|
|
14
|
-
handlePhrase(phrase: string): void;
|
|
15
|
-
private postAndHandleTheData;
|
|
16
|
-
private postAndHandleTheUpdateData;
|
|
17
|
-
private getHttpOptions;
|
|
18
|
-
private constructInputEnvelope;
|
|
19
|
-
private constructPhraseEnvelope;
|
|
20
|
-
private constructFirstHitEnvelope;
|
|
21
|
-
private handleResponseData;
|
|
22
|
-
private handleUpdateResponseData;
|
|
23
|
-
}
|
|
1
|
+
import { Container } from '@webprovisions/platform';
|
|
2
|
+
export declare class HttpClient {
|
|
3
|
+
private endpointUrl;
|
|
4
|
+
private clientId;
|
|
5
|
+
private projectionPath;
|
|
6
|
+
private apiEndpoint;
|
|
7
|
+
private options;
|
|
8
|
+
private middlewareClient;
|
|
9
|
+
private chatClient;
|
|
10
|
+
constructor(endpoint: string, clientId: string, container: Container);
|
|
11
|
+
firstHit(): void;
|
|
12
|
+
handleUpdate(action: string): void;
|
|
13
|
+
handleInput(action: string): void;
|
|
14
|
+
handlePhrase(phrase: string): void;
|
|
15
|
+
private postAndHandleTheData;
|
|
16
|
+
private postAndHandleTheUpdateData;
|
|
17
|
+
private getHttpOptions;
|
|
18
|
+
private constructInputEnvelope;
|
|
19
|
+
private constructPhraseEnvelope;
|
|
20
|
+
private constructFirstHitEnvelope;
|
|
21
|
+
private handleResponseData;
|
|
22
|
+
private handleUpdateResponseData;
|
|
23
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Container } from '@webprovisions/platform';
|
|
2
|
-
import { ServerEntry } from '../contract/model/http/server-entry.model';
|
|
3
|
-
export default class MiddlewareClient {
|
|
4
|
-
private paging;
|
|
5
|
-
private processor;
|
|
6
|
-
private entryInterface;
|
|
7
|
-
private chatClient;
|
|
8
|
-
constructor(container: Container);
|
|
9
|
-
static initialize(container: any, widget: any): void;
|
|
10
|
-
handleEntries(entries: ServerEntry[], action?: string): Promise<void>;
|
|
11
|
-
handleUpdate(entries: ServerEntry[], action?: string): Promise<void>;
|
|
12
|
-
checkForUpdate(input: string): boolean;
|
|
13
|
-
private executeMiddlewares;
|
|
14
|
-
}
|
|
1
|
+
import { Container } from '@webprovisions/platform';
|
|
2
|
+
import { ServerEntry } from '../contract/model/http/server-entry.model';
|
|
3
|
+
export default class MiddlewareClient {
|
|
4
|
+
private paging;
|
|
5
|
+
private processor;
|
|
6
|
+
private entryInterface;
|
|
7
|
+
private chatClient;
|
|
8
|
+
constructor(container: Container);
|
|
9
|
+
static initialize(container: any, widget: any): void;
|
|
10
|
+
handleEntries(entries: ServerEntry[], action?: string): Promise<void>;
|
|
11
|
+
handleUpdate(entries: ServerEntry[], action?: string): Promise<void>;
|
|
12
|
+
checkForUpdate(input: string): boolean;
|
|
13
|
+
private executeMiddlewares;
|
|
14
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-method.15886c3d.js","sources":["../src/contract/custom-component/contact-method-item.tsx","../src/contract/custom-component/contact-method-list.tsx","../src/contract/custom-component/contact-method.tsx"],"sourcesContent":["import { ContactMethod as GenericContactMethod } from '@telia-ace/knowledge-widget-adapters';\nimport { useContainer, useDispatch } from '@telia-ace/knowledge-widget-ui';\nimport { Widget } from '@webprovisions/platform';\nimport React, { useEffect, useState } from 'react';\n\ninterface PropsType {\n contactMethod: any;\n type: any;\n className?: any;\n}\n\nconst ContactMethodItem: React.FC<PropsType> = (props: PropsType) => {\n const dispatch = useDispatch();\n const container = useContainer();\n\n const [body, setBody] = useState(props.contactMethod.body);\n\n useEffect(() => {\n if (!container || !container.get('$widget')) {\n return;\n }\n const { events } = container.get('$widget') as Widget;\n events.subscribe('form:validated', (_event, _data) => {\n // TODO: this is a due to props not being updated when props.contactMethod.body changes\n // perhaps there is a cleaner way of doing this\n setBody(props.contactMethod.body);\n });\n }, [container]);\n return (\n <GenericContactMethod\n className={props.className}\n onClick={() => {\n dispatch(\n 'action',\n `${props.contactMethod.id}/${props.type.toString()}/${\n props.contactMethod.title\n }`\n );\n // dispatch(\n // \"expand\",\n // `${props.contactMethod.id}/${props.type.toString()}`\n // );\n }}\n dispatch={dispatch}\n {...props.contactMethod}\n body={body}\n expanded={props.contactMethod.expanded}\n />\n );\n};\n\nexport default ContactMethodItem;\n","import React, { Fragment } from 'react';\nimport styled from 'styled-components';\nimport ContactMethodItem from './contact-method-item';\n\ninterface PropsType {\n contactMethodList: any;\n type: any;\n}\n\nconst ContactMethodList: React.FC<PropsType> = (props: PropsType) => {\n return (\n <Fragment>\n {props.contactMethodList.map((contactMethod: any) => (\n <StyledContactMethod\n key={contactMethod.id}\n type={props.type}\n contactMethod={contactMethod}\n />\n ))}\n </Fragment>\n );\n};\n\nconst StyledContactMethod = styled(ContactMethodItem)`\n border-bottom: 1px solid rgb(239, 239, 239);\n padding: ${(p) => p.theme.sizes?.medium};\n`;\n\nexport default ContactMethodList;\n","import { DataType } from '@telia-ace/knowledge-widget-types-grid';\nimport React from 'react';\nimport styled from 'styled-components';\nimport ContactMethodItem from './contact-method-item';\nimport ContactMethodList from './contact-method-list';\nconst ContactMethod: React.FC = (props: any) => {\n let type;\n let methodList;\n\n if (props.contactMethods && props.contactMethods.contactMethods?.length > 0) {\n type = DataType.ContactMethods;\n methodList = props.contactMethods.contactMethods;\n } else if (props.contactMethods.categories && props.contactMethods.categories?.length > 0) {\n type = DataType.ContactMethodCategories;\n methodList = props.contactMethods.categories.filter((o: any) => o.matches > 0);\n } else {\n type = DataType.ContactMethod;\n methodList = props.contactMethods;\n }\n\n // TODO: ContactMethodItem should not be passed a list as contact method?\n if (!methodList.length) {\n return <StyledContactMethodItem type={type} contactMethod={methodList} />;\n }\n\n return <ContactMethodList type={type} contactMethodList={methodList} />;\n};\n\nconst StyledContactMethodItem = styled(ContactMethodItem)`\n padding: ${(p) => p.theme.sizes?.medium};\n`;\n\nexport default ContactMethod;\n"],"names":["GenericContactMethod"],"mappings":";;;;;;;;;;;;;;;;;AAWA,MAAM,IAAyC,CAAC,MAAqB;AACjE,QAAM,IAAW,KACX,IAAY,KAEZ,CAAC,GAAM,KAAW,EAAS,EAAM,cAAc,IAAI;AAEzD,WAAU,MAAM;AACZ,QAAI,CAAC,KAAa,CAAC,EAAU,IAAI,SAAS;AACtC;AAEJ,UAAM,EAAE,cAAW,EAAU,IAAI,SAAS;AAC1C,MAAO,UAAU,kBAAkB,CAAC,GAAQ,MAAU;AAG1C,QAAA,EAAM,cAAc,IAAI;AAAA,IAAA,CACnC;AAAA,EAAA,GACF,CAAC,CAAS,CAAC,GAET,kBAAA,cAAAA,GAAA;AAAA,IACG,WAAW,EAAM;AAAA,IACjB,SAAS,MAAM;AAEP,QAAA,UACA,GAAG,EAAM,cAAc,MAAM,EAAM,KAAK,SAAS,KAC7C,EAAM,cAAc,OAE5B;AAAA,IAKJ;AAAA,IACA;AAAA,KACI,EAAM,gBAfb;AAAA,IAgBG;AAAA,IACA,UAAU,EAAM,cAAc;AAAA,EAAA,EAClC;AAER,GCxCM,IAAyC,CAAC,sCAEvC,GACI,MAAA,EAAM,kBAAkB,IAAI,CAAC,MACzB,kBAAA,cAAA,GAAA;AAAA,EACG,KAAK,EAAc;AAAA,EACnB,MAAM,EAAM;AAAA,EACZ;AACJ,CAAA,CACH,CACL,GAIF,IAAsB,EAAO,CAAiB;AAAA;AAAA,eAErC,CAAC,MAAM;;AAAA,gBAAE,MAAM,UAAR,kBAAe;AAAA;AAAA,GCpB/B,IAA0B,CAAC,MAAe;;AACxC,MAAA,GACA;AAcA,SAZJ,AAAI,EAAM,kBAAkB,QAAM,eAAe,mBAArB,kBAAqC,UAAS,IACtE,KAAO,EAAS,gBAChB,IAAa,EAAM,eAAe,kBACtC,AAAW,EAAM,eAAe,cAAc,QAAM,eAAe,eAArB,kBAAiC,UAAS,IACpF,KAAO,EAAS,yBACH,IAAA,EAAM,eAAe,WAAW,OAAO,CAAC,MAAW,EAAE,UAAU,CAAC,KAE7E,KAAO,EAAS,eAChB,IAAa,EAAM,iBAInB,AAAC,EAAW,SAIR,kBAAA,cAAA,GAAA;AAAA,IAAkB;AAAA,IAAY,mBAAmB;AAAA,EAAA,CAAY,IAHzD,kBAAA,cAAA,GAAA;AAAA,IAAwB;AAAA,IAAY,eAAe;AAAA,EAAA,CAAY;AAI/E,GAEM,IAA0B,EAAO,CAAiB;AAAA,eACzC,CAAC,MAAM;;AAAA,gBAAE,MAAM,UAAR,kBAAe;AAAA;AAAA;"}
|
|
1
|
+
{"version":3,"file":"contact-method.15886c3d.js","sources":["../src/contract/custom-component/contact-method-item.tsx","../src/contract/custom-component/contact-method-list.tsx","../src/contract/custom-component/contact-method.tsx"],"sourcesContent":["import { ContactMethod as GenericContactMethod } from '@telia-ace/knowledge-widget-adapters';\r\nimport { useContainer, useDispatch } from '@telia-ace/knowledge-widget-ui';\r\nimport { Widget } from '@webprovisions/platform';\r\nimport React, { useEffect, useState } from 'react';\r\n\r\ninterface PropsType {\r\n contactMethod: any;\r\n type: any;\r\n className?: any;\r\n}\r\n\r\nconst ContactMethodItem: React.FC<PropsType> = (props: PropsType) => {\r\n const dispatch = useDispatch();\r\n const container = useContainer();\r\n\r\n const [body, setBody] = useState(props.contactMethod.body);\r\n\r\n useEffect(() => {\r\n if (!container || !container.get('$widget')) {\r\n return;\r\n }\r\n const { events } = container.get('$widget') as Widget;\r\n events.subscribe('form:validated', (_event, _data) => {\r\n // TODO: this is a due to props not being updated when props.contactMethod.body changes\r\n // perhaps there is a cleaner way of doing this\r\n setBody(props.contactMethod.body);\r\n });\r\n }, [container]);\r\n return (\r\n <GenericContactMethod\r\n className={props.className}\r\n onClick={() => {\r\n dispatch(\r\n 'action',\r\n `${props.contactMethod.id}/${props.type.toString()}/${\r\n props.contactMethod.title\r\n }`\r\n );\r\n // dispatch(\r\n // \"expand\",\r\n // `${props.contactMethod.id}/${props.type.toString()}`\r\n // );\r\n }}\r\n dispatch={dispatch}\r\n {...props.contactMethod}\r\n body={body}\r\n expanded={props.contactMethod.expanded}\r\n />\r\n );\r\n};\r\n\r\nexport default ContactMethodItem;\r\n","import React, { Fragment } from 'react';\r\nimport styled from 'styled-components';\r\nimport ContactMethodItem from './contact-method-item';\r\n\r\ninterface PropsType {\r\n contactMethodList: any;\r\n type: any;\r\n}\r\n\r\nconst ContactMethodList: React.FC<PropsType> = (props: PropsType) => {\r\n return (\r\n <Fragment>\r\n {props.contactMethodList.map((contactMethod: any) => (\r\n <StyledContactMethod\r\n key={contactMethod.id}\r\n type={props.type}\r\n contactMethod={contactMethod}\r\n />\r\n ))}\r\n </Fragment>\r\n );\r\n};\r\n\r\nconst StyledContactMethod = styled(ContactMethodItem)`\r\n border-bottom: 1px solid rgb(239, 239, 239);\r\n padding: ${(p) => p.theme.sizes?.medium};\r\n`;\r\n\r\nexport default ContactMethodList;\r\n","import { DataType } from '@telia-ace/knowledge-widget-types-grid';\r\nimport React from 'react';\r\nimport styled from 'styled-components';\r\nimport ContactMethodItem from './contact-method-item';\r\nimport ContactMethodList from './contact-method-list';\r\nconst ContactMethod: React.FC = (props: any) => {\r\n let type;\r\n let methodList;\r\n\r\n if (props.contactMethods && props.contactMethods.contactMethods?.length > 0) {\r\n type = DataType.ContactMethods;\r\n methodList = props.contactMethods.contactMethods;\r\n } else if (props.contactMethods.categories && props.contactMethods.categories?.length > 0) {\r\n type = DataType.ContactMethodCategories;\r\n methodList = props.contactMethods.categories.filter((o: any) => o.matches > 0);\r\n } else {\r\n type = DataType.ContactMethod;\r\n methodList = props.contactMethods;\r\n }\r\n\r\n // TODO: ContactMethodItem should not be passed a list as contact method?\r\n if (!methodList.length) {\r\n return <StyledContactMethodItem type={type} contactMethod={methodList} />;\r\n }\r\n\r\n return <ContactMethodList type={type} contactMethodList={methodList} />;\r\n};\r\n\r\nconst StyledContactMethodItem = styled(ContactMethodItem)`\r\n padding: ${(p) => p.theme.sizes?.medium};\r\n`;\r\n\r\nexport default ContactMethod;\r\n"],"names":["GenericContactMethod"],"mappings":";;;;;;;;;;;;;;;;;AAWA,MAAM,IAAyC,CAAC,MAAqB;AACjE,QAAM,IAAW,KACX,IAAY,KAEZ,CAAC,GAAM,KAAW,EAAS,EAAM,cAAc,IAAI;AAEzD,WAAU,MAAM;AACZ,QAAI,CAAC,KAAa,CAAC,EAAU,IAAI,SAAS;AACtC;AAEJ,UAAM,EAAE,cAAW,EAAU,IAAI,SAAS;AAC1C,MAAO,UAAU,kBAAkB,CAAC,GAAQ,MAAU;AAG1C,QAAA,EAAM,cAAc,IAAI;AAAA,IAAA,CACnC;AAAA,EAAA,GACF,CAAC,CAAS,CAAC,GAET,kBAAA,cAAAA,GAAA;AAAA,IACG,WAAW,EAAM;AAAA,IACjB,SAAS,MAAM;AAEP,QAAA,UACA,GAAG,EAAM,cAAc,MAAM,EAAM,KAAK,SAAS,KAC7C,EAAM,cAAc,OAE5B;AAAA,IAKJ;AAAA,IACA;AAAA,KACI,EAAM,gBAfb;AAAA,IAgBG;AAAA,IACA,UAAU,EAAM,cAAc;AAAA,EAAA,EAClC;AAER,GCxCM,IAAyC,CAAC,sCAEvC,GACI,MAAA,EAAM,kBAAkB,IAAI,CAAC,MACzB,kBAAA,cAAA,GAAA;AAAA,EACG,KAAK,EAAc;AAAA,EACnB,MAAM,EAAM;AAAA,EACZ;AACJ,CAAA,CACH,CACL,GAIF,IAAsB,EAAO,CAAiB;AAAA;AAAA,eAErC,CAAC,MAAM;;AAAA,gBAAE,MAAM,UAAR,kBAAe;AAAA;AAAA,GCpB/B,IAA0B,CAAC,MAAe;;AACxC,MAAA,GACA;AAcA,SAZJ,AAAI,EAAM,kBAAkB,QAAM,eAAe,mBAArB,kBAAqC,UAAS,IACtE,KAAO,EAAS,gBAChB,IAAa,EAAM,eAAe,kBACtC,AAAW,EAAM,eAAe,cAAc,QAAM,eAAe,eAArB,kBAAiC,UAAS,IACpF,KAAO,EAAS,yBACH,IAAA,EAAM,eAAe,WAAW,OAAO,CAAC,MAAW,EAAE,UAAU,CAAC,KAE7E,KAAO,EAAS,eAChB,IAAa,EAAM,iBAInB,AAAC,EAAW,SAIR,kBAAA,cAAA,GAAA;AAAA,IAAkB;AAAA,IAAY,mBAAmB;AAAA,EAAA,CAAY,IAHzD,kBAAA,cAAA,GAAA;AAAA,IAAwB;AAAA,IAAY,eAAe;AAAA,EAAA,CAAY;AAI/E,GAEM,IAA0B,EAAO,CAAiB;AAAA,eACzC,CAAC,MAAM;;AAAA,gBAAE,MAAM,UAAR,kBAAe;AAAA;AAAA;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface PropsType {
|
|
3
|
-
contactMethod: any;
|
|
4
|
-
type: any;
|
|
5
|
-
className?: any;
|
|
6
|
-
}
|
|
7
|
-
declare const ContactMethodItem: React.FC<PropsType>;
|
|
8
|
-
export default ContactMethodItem;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface PropsType {
|
|
3
|
+
contactMethod: any;
|
|
4
|
+
type: any;
|
|
5
|
+
className?: any;
|
|
6
|
+
}
|
|
7
|
+
declare const ContactMethodItem: React.FC<PropsType>;
|
|
8
|
+
export default ContactMethodItem;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface PropsType {
|
|
3
|
-
contactMethodList: any;
|
|
4
|
-
type: any;
|
|
5
|
-
}
|
|
6
|
-
declare const ContactMethodList: React.FC<PropsType>;
|
|
7
|
-
export default ContactMethodList;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface PropsType {
|
|
3
|
+
contactMethodList: any;
|
|
4
|
+
type: any;
|
|
5
|
+
}
|
|
6
|
+
declare const ContactMethodList: React.FC<PropsType>;
|
|
7
|
+
export default ContactMethodList;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
declare const ContactMethod: React.FC;
|
|
3
|
-
export default ContactMethod;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const ContactMethod: React.FC;
|
|
3
|
+
export default ContactMethod;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export declare enum ServerEntryTypeEnum {
|
|
2
|
-
Widget = 0,
|
|
3
|
-
Text = 1,
|
|
4
|
-
Contact = 2,
|
|
5
|
-
List = 3,
|
|
6
|
-
Error = 4
|
|
7
|
-
}
|
|
1
|
+
export declare enum ServerEntryTypeEnum {
|
|
2
|
+
Widget = 0,
|
|
3
|
+
Text = 1,
|
|
4
|
+
Contact = 2,
|
|
5
|
+
List = 3,
|
|
6
|
+
Error = 4
|
|
7
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export interface List {
|
|
2
|
-
title?: string;
|
|
3
|
-
body?: string;
|
|
4
|
-
items: object;
|
|
5
|
-
}
|
|
1
|
+
export interface List {
|
|
2
|
+
title?: string;
|
|
3
|
+
body?: string;
|
|
4
|
+
items: object;
|
|
5
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export interface Message {
|
|
2
|
-
id: string;
|
|
3
|
-
message: any;
|
|
4
|
-
entry?: any;
|
|
5
|
-
conversationEntry?: any;
|
|
6
|
-
isUser: boolean;
|
|
7
|
-
}
|
|
1
|
+
export interface Message {
|
|
2
|
+
id: string;
|
|
3
|
+
message: any;
|
|
4
|
+
entry?: any;
|
|
5
|
+
conversationEntry?: any;
|
|
6
|
+
isUser: boolean;
|
|
7
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export interface Action {
|
|
2
|
-
[label: string]: any;
|
|
3
|
-
}
|
|
1
|
+
export interface Action {
|
|
2
|
+
[label: string]: any;
|
|
3
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface ClientAction {
|
|
2
|
-
key: string;
|
|
3
|
-
content: any;
|
|
4
|
-
}
|
|
1
|
+
export interface ClientAction {
|
|
2
|
+
key: string;
|
|
3
|
+
content: any;
|
|
4
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { LooseObject } from "../shared/loose-object.model";
|
|
2
|
-
import { ClientAction } from "./client-action.model";
|
|
3
|
-
export interface ClientEnvelope {
|
|
4
|
-
command?: LooseObject;
|
|
5
|
-
action?: ClientAction;
|
|
6
|
-
globalState?: LooseObject;
|
|
7
|
-
localState?: LooseObject;
|
|
8
|
-
clientId?: string;
|
|
9
|
-
}
|
|
1
|
+
import { LooseObject } from "../shared/loose-object.model";
|
|
2
|
+
import { ClientAction } from "./client-action.model";
|
|
3
|
+
export interface ClientEnvelope {
|
|
4
|
+
command?: LooseObject;
|
|
5
|
+
action?: ClientAction;
|
|
6
|
+
globalState?: LooseObject;
|
|
7
|
+
localState?: LooseObject;
|
|
8
|
+
clientId?: string;
|
|
9
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LooseObject } from "../shared/loose-object.model";
|
|
2
|
-
export declare type ConnectOptions = {
|
|
3
|
-
globalState?: LooseObject;
|
|
4
|
-
command?: LooseObject;
|
|
5
|
-
};
|
|
1
|
+
import { LooseObject } from "../shared/loose-object.model";
|
|
2
|
+
export declare type ConnectOptions = {
|
|
3
|
+
globalState?: LooseObject;
|
|
4
|
+
command?: LooseObject;
|
|
5
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export interface GlobalState {
|
|
2
|
-
completedInteractionsCount: number;
|
|
3
|
-
lastQuestion?: string;
|
|
4
|
-
lastBotGuide: number;
|
|
5
|
-
lastGuideTitle?: string;
|
|
6
|
-
site: string;
|
|
7
|
-
invincibleParameters: object;
|
|
8
|
-
}
|
|
1
|
+
export interface GlobalState {
|
|
2
|
+
completedInteractionsCount: number;
|
|
3
|
+
lastQuestion?: string;
|
|
4
|
+
lastBotGuide: number;
|
|
5
|
+
lastGuideTitle?: string;
|
|
6
|
+
site: string;
|
|
7
|
+
invincibleParameters: object;
|
|
8
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export interface HttpClientOptions {
|
|
2
|
-
credentials: string | undefined;
|
|
3
|
-
clientId?: string;
|
|
4
|
-
onError?: (error: any) => void;
|
|
5
|
-
}
|
|
1
|
+
export interface HttpClientOptions {
|
|
2
|
+
credentials: string | undefined;
|
|
3
|
+
clientId?: string;
|
|
4
|
+
onError?: (error: any) => void;
|
|
5
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Action } from "./action.model";
|
|
2
|
-
export interface ServerEntry {
|
|
3
|
-
id: string;
|
|
4
|
-
type: string;
|
|
5
|
-
content: any;
|
|
6
|
-
actions: Action;
|
|
7
|
-
tags: string[];
|
|
8
|
-
relation: string;
|
|
9
|
-
timestamp: string;
|
|
10
|
-
localState: object;
|
|
11
|
-
}
|
|
1
|
+
import { Action } from "./action.model";
|
|
2
|
+
export interface ServerEntry {
|
|
3
|
+
id: string;
|
|
4
|
+
type: string;
|
|
5
|
+
content: any;
|
|
6
|
+
actions: Action;
|
|
7
|
+
tags: string[];
|
|
8
|
+
relation: string;
|
|
9
|
+
timestamp: string;
|
|
10
|
+
localState: object;
|
|
11
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ClientEnvelope } from "./client-envelope.model";
|
|
2
|
-
import { GlobalState } from "./global-state.model";
|
|
3
|
-
import { ServerEntry } from "./server-entry.model";
|
|
4
|
-
export interface ServerEnvelope {
|
|
5
|
-
clientId: string | undefined;
|
|
6
|
-
entries: ServerEntry[];
|
|
7
|
-
globalState: GlobalState;
|
|
8
|
-
resolveCommand?: string;
|
|
9
|
-
clientEnvelope: ClientEnvelope;
|
|
10
|
-
}
|
|
1
|
+
import { ClientEnvelope } from "./client-envelope.model";
|
|
2
|
+
import { GlobalState } from "./global-state.model";
|
|
3
|
+
import { ServerEntry } from "./server-entry.model";
|
|
4
|
+
export interface ServerEnvelope {
|
|
5
|
+
clientId: string | undefined;
|
|
6
|
+
entries: ServerEntry[];
|
|
7
|
+
globalState: GlobalState;
|
|
8
|
+
resolveCommand?: string;
|
|
9
|
+
clientEnvelope: ClientEnvelope;
|
|
10
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ServerEntry } from "../http/server-entry.model";
|
|
2
|
-
export interface AggregatorState {
|
|
3
|
-
[key: string]: ServerEntry;
|
|
4
|
-
}
|
|
1
|
+
import { ServerEntry } from "../http/server-entry.model";
|
|
2
|
+
export interface AggregatorState {
|
|
3
|
+
[key: string]: ServerEntry;
|
|
4
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export interface LooseObject {
|
|
2
|
-
[key: string]: any;
|
|
3
|
-
}
|
|
1
|
+
export interface LooseObject {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare class ChatHelper {
|
|
2
|
-
private static user;
|
|
3
|
-
private static agent;
|
|
4
|
-
static setUser(user: any): void;
|
|
5
|
-
static setAgent(agent: any): void;
|
|
6
|
-
static getUser(): any;
|
|
7
|
-
static getAgent(): any;
|
|
8
|
-
}
|
|
1
|
+
export declare class ChatHelper {
|
|
2
|
+
private static user;
|
|
3
|
+
private static agent;
|
|
4
|
+
static setUser(user: any): void;
|
|
5
|
+
static setAgent(agent: any): void;
|
|
6
|
+
static getUser(): any;
|
|
7
|
+
static getAgent(): any;
|
|
8
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export declare class HttpHelper {
|
|
2
|
-
static fetchOptions: {
|
|
3
|
-
method: string;
|
|
4
|
-
headers: {
|
|
5
|
-
Accept: string;
|
|
6
|
-
'Content-Type': string;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
static combineUrl(basePath: string, path: string): string;
|
|
10
|
-
static managedSubdomainSuffixes: string[];
|
|
11
|
-
static parseSubdomain: (input: string) => string;
|
|
12
|
-
static getCredentials(): string | undefined;
|
|
13
|
-
}
|
|
1
|
+
export declare class HttpHelper {
|
|
2
|
+
static fetchOptions: {
|
|
3
|
+
method: string;
|
|
4
|
+
headers: {
|
|
5
|
+
Accept: string;
|
|
6
|
+
'Content-Type': string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
static combineUrl(basePath: string, path: string): string;
|
|
10
|
+
static managedSubdomainSuffixes: string[];
|
|
11
|
+
static parseSubdomain: (input: string) => string;
|
|
12
|
+
static getCredentials(): string | undefined;
|
|
13
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Message } from '../contract/model/conversation-api-model/message.model';
|
|
2
|
-
export declare class MiddlewareHelper {
|
|
3
|
-
private static sessionMessageStorageVariable;
|
|
4
|
-
private static container;
|
|
5
|
-
private static widget;
|
|
6
|
-
static setContainer(container: any): void;
|
|
7
|
-
static setWidget(widget: any): void;
|
|
8
|
-
static getContainer(): any;
|
|
9
|
-
static getWidget(): any;
|
|
10
|
-
static setEntrySessionStorage: (messages: Message[]) => Promise<void>;
|
|
11
|
-
static getEntrySessionStorage(): Promise<any>;
|
|
12
|
-
}
|
|
1
|
+
import { Message } from '../contract/model/conversation-api-model/message.model';
|
|
2
|
+
export declare class MiddlewareHelper {
|
|
3
|
+
private static sessionMessageStorageVariable;
|
|
4
|
+
private static container;
|
|
5
|
+
private static widget;
|
|
6
|
+
static setContainer(container: any): void;
|
|
7
|
+
static setWidget(widget: any): void;
|
|
8
|
+
static getContainer(): any;
|
|
9
|
+
static getWidget(): any;
|
|
10
|
+
static setEntrySessionStorage: (messages: Message[]) => Promise<void>;
|
|
11
|
+
static getEntrySessionStorage(): Promise<any>;
|
|
12
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { Message } from '../contract/model/conversation-api-model/message.model';
|
|
2
|
-
import { ClientAction } from '../contract/model/http/client-action.model';
|
|
3
|
-
import { GlobalState } from '../contract/model/http/global-state.model';
|
|
4
|
-
import { ServerEntry } from '../contract/model/http/server-entry.model';
|
|
5
|
-
import { LooseObject } from '../contract/model/shared/loose-object.model';
|
|
6
|
-
export declare class StoreHelper {
|
|
7
|
-
private static messageStore;
|
|
8
|
-
private static globalState;
|
|
9
|
-
constructor();
|
|
10
|
-
static insertOrUpdateMessageArrayStore(messageArray: Message[], entry?: any): void;
|
|
11
|
-
private static insertMessageToStore;
|
|
12
|
-
private static updateMessageInStore;
|
|
13
|
-
static checkIdInMessageStore(id: string): boolean;
|
|
14
|
-
static getLocalState(action: string): LooseObject | undefined;
|
|
15
|
-
static getGlobalState(): GlobalState;
|
|
16
|
-
static setGlobalState(state: GlobalState): void;
|
|
17
|
-
static getAction(action: string): ClientAction;
|
|
18
|
-
static getCommand(text: string): LooseObject;
|
|
19
|
-
static getEntry(action: string): ServerEntry | undefined;
|
|
20
|
-
static getMessage(id: string): Message | undefined;
|
|
21
|
-
static getEntryStore(): ServerEntry[];
|
|
22
|
-
}
|
|
1
|
+
import { Message } from '../contract/model/conversation-api-model/message.model';
|
|
2
|
+
import { ClientAction } from '../contract/model/http/client-action.model';
|
|
3
|
+
import { GlobalState } from '../contract/model/http/global-state.model';
|
|
4
|
+
import { ServerEntry } from '../contract/model/http/server-entry.model';
|
|
5
|
+
import { LooseObject } from '../contract/model/shared/loose-object.model';
|
|
6
|
+
export declare class StoreHelper {
|
|
7
|
+
private static messageStore;
|
|
8
|
+
private static globalState;
|
|
9
|
+
constructor();
|
|
10
|
+
static insertOrUpdateMessageArrayStore(messageArray: Message[], entry?: any): void;
|
|
11
|
+
private static insertMessageToStore;
|
|
12
|
+
private static updateMessageInStore;
|
|
13
|
+
static checkIdInMessageStore(id: string): boolean;
|
|
14
|
+
static getLocalState(action: string): LooseObject | undefined;
|
|
15
|
+
static getGlobalState(): GlobalState;
|
|
16
|
+
static setGlobalState(state: GlobalState): void;
|
|
17
|
+
static getAction(action: string): ClientAction;
|
|
18
|
+
static getCommand(text: string): LooseObject;
|
|
19
|
+
static getEntry(action: string): ServerEntry | undefined;
|
|
20
|
+
static getMessage(id: string): Message | undefined;
|
|
21
|
+
static getEntryStore(): ServerEntry[];
|
|
22
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import ConversationPlugin from './plugin';
|
|
2
|
-
export { ConversationPlugin };
|
|
1
|
+
import ConversationPlugin from './plugin';
|
|
2
|
+
export { ConversationPlugin };
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/contract/enum/server-entry-type.enum.ts","../src/helper/chat.helper.ts","../src/helper/middleware.helper.ts","../src/helper/store.helper.ts","../src/interface/entry.interface.ts","../src/client/chat.client.ts","../src/client/contact-method.client.ts","../src/helper/http.helper.ts","../src/interface/middleware/paging.interface.ts","../src/interface/middleware/processor.interface.ts","../src/client/middleware.client.ts","../src/client/http.client.ts","../src/plugin.ts"],"sourcesContent":["export enum ServerEntryTypeEnum {\n Widget,\n Text,\n Contact,\n List,\n Error,\n}\n","export class ChatHelper {\n private static user: any;\n private static agent: any;\n\n static setUser(user: any) {\n this.user = user;\n }\n\n static setAgent(agent: any) {\n this.agent = agent;\n }\n \n static getUser(): any {\n return this.user;\n }\n \n static getAgent(): any {\n return this.agent;\n }\n}\n","import { createStorageWriter, readStorage, StorageCategory } from '@telia-ace/widget-services';\nimport { Message } from '../contract/model/conversation-api-model/message.model';\n\nexport class MiddlewareHelper {\n private static sessionMessageStorageVariable: string = 'conversation-plugin-messages';\n private static container: any;\n private static widget: any;\n\n static setContainer(container: any) {\n MiddlewareHelper.container = container;\n }\n\n static setWidget(widget: any) {\n this.widget = widget;\n }\n\n static getContainer(): any {\n return this.container;\n }\n\n static getWidget(): any {\n return this.widget;\n }\n\n static setEntrySessionStorage = async (messages: Message[]) => {\n createStorageWriter(\n MiddlewareHelper.container,\n MiddlewareHelper.sessionMessageStorageVariable,\n StorageCategory.Necessary\n ).then((write) => {\n return write(messages);\n });\n };\n\n static getEntrySessionStorage(): Promise<any> {\n return readStorage(this.container, this.sessionMessageStorageVariable);\n }\n}\n","import { Message } from '../contract/model/conversation-api-model/message.model';\nimport { ClientAction } from '../contract/model/http/client-action.model';\nimport { GlobalState } from '../contract/model/http/global-state.model';\nimport { ServerEntry } from '../contract/model/http/server-entry.model';\nimport { LooseObject } from '../contract/model/shared/loose-object.model';\nimport { MiddlewareHelper } from './middleware.helper';\n\nexport class StoreHelper {\n private static messageStore: Message[] = [];\n private static globalState: GlobalState;\n\n constructor() {\n StoreHelper.globalState = {\n completedInteractionsCount: 0,\n lastBotGuide: 0,\n site: 'https://localhost:8080/',\n invincibleParameters: {},\n };\n }\n\n static insertOrUpdateMessageArrayStore(messageArray: Message[], entry?: any) {\n messageArray\n .filter((o) => !!o)\n .forEach((t) => {\n if (!this.messageStore.find((o) => o.id == t.id)) this.insertMessageToStore(t);\n else {\n this.updateMessageInStore(t, entry);\n }\n });\n\n MiddlewareHelper.setEntrySessionStorage(this.messageStore);\n }\n\n private static insertMessageToStore(message: Message) {\n this.messageStore.push(message);\n }\n\n private static updateMessageInStore(message: Message, entry?: any) {\n message.conversationEntry = entry;\n let index = this.messageStore.findIndex((o) => o.id == message.id);\n this.messageStore[index] = message;\n }\n\n static checkIdInMessageStore(id: string): boolean {\n return this.messageStore.find((o) => o.id == id) === undefined;\n }\n\n static getLocalState(action: string): LooseObject | undefined {\n const entry: ServerEntry | undefined = this.getEntry(action);\n return entry?.localState;\n }\n\n static getGlobalState(): GlobalState {\n return StoreHelper.globalState;\n }\n\n static setGlobalState(state: GlobalState) {\n StoreHelper.globalState = state;\n }\n\n static getAction(action: string): ClientAction {\n const entry: ServerEntry | undefined = this.getEntry(action);\n\n return {\n key: action,\n content: entry?.actions[action],\n };\n }\n\n static getCommand(text: string): LooseObject {\n return { phrase: text };\n }\n\n static getEntry(action: string): ServerEntry | undefined {\n let entry: ServerEntry | undefined = undefined;\n this.getEntryStore().forEach((o) => {\n if (o.actions[action]) {\n entry = o;\n }\n });\n return entry;\n }\n\n static getMessage(id: string): Message | undefined {\n return this.messageStore.find((o) => o.id == id);\n }\n\n static getEntryStore(): ServerEntry[] {\n return this.messageStore\n .filter((o) => !!o.entry)\n .map((o) => {\n return o.entry;\n });\n }\n}\n","import { DataClient, DataType } from '@telia-ace/knowledge-widget-types-grid';\nimport {\n ConversationMessageListItemType,\n ConverstationMessageItem\n} from '@telia-ace/widget-conversation';\nimport { Container } from '@webprovisions/platform';\nimport { ServerEntryTypeEnum } from '../contract/enum/server-entry-type.enum';\nimport { Message } from '../contract/model/conversation-api-model/message.model';\nimport { ServerEntry } from '../contract/model/http/server-entry.model';\nimport { StoreHelper } from '../helper/store.helper';\n\nexport default class EntryInterface {\n private helpActionKey = 'help';\n private nextActionKey = 'next';\n\n constructor(private container: Container) {}\n\n // transform the entry based on its type\n async transform(entry: ServerEntry): Promise<Message | undefined> {\n const entryType = (<any>ServerEntryTypeEnum)[entry.type];\n switch (entryType) {\n case ServerEntryTypeEnum.List:\n return {\n id: entry.id,\n message: this.listTransform(entry),\n entry: entry,\n isUser: false,\n };\n case ServerEntryTypeEnum.Text:\n return {\n id: entry.id,\n message: this.textTransform(entry),\n entry: entry,\n isUser: false,\n };\n case ServerEntryTypeEnum.Text:\n return {\n id: entry.id,\n message: this.listTransform(entry),\n entry: entry,\n isUser: false,\n };\n case ServerEntryTypeEnum.Contact:\n return {\n id: entry.id,\n message: await this.transformContactMethod(entry),\n entry: entry,\n isUser: false,\n };\n }\n }\n\n async transformContactMethod(entry: ServerEntry): Promise<any> {\n const dataClient: DataClient = await this.container.getAsync('dataClient');\n\n const contactMethods = [];\n const contactMethod = await dataClient.fetch(DataType.ContactMethod, {\n contactMethodId: entry.content.id,\n });\n\n if (contactMethod) {\n contactMethod.expanded = true;\n contactMethods.push(contactMethod);\n }\n\n return {\n type: 'ace-knowledge-contact-method',\n contactMethods: contactMethods,\n };\n }\n\n // transform an array of entries\n async transformArray(entryArray: ServerEntry[]): Promise<Message[]> {\n let returnArray: Message[] = [];\n for (const o of entryArray) {\n let x = await this.transform(o);\n if (!!x) returnArray.push(x);\n }\n return returnArray;\n }\n\n // gets the text that should be printed as a user message on action\n getUserMessage(action: string) {\n let entry = StoreHelper.getEntry(action);\n\n return this.getTitleFromEntry(entry, action);\n }\n\n private listTransform(entry: ServerEntry): any {\n if (entry.type === 'Contact') {\n // TODO: is this needed\n return undefined;\n }\n\n if (!entry.content) return undefined;\n\n let object = this.getListActions(\n entry.content.items,\n this.getContentText(entry),\n entry.actions,\n entry.localState\n );\n\n return object;\n }\n\n private getContentText(entry: ServerEntry): object | undefined {\n if (entry.content.html) return { body: entry.content.html };\n if (entry.content.header) return { title: entry.content.header };\n }\n\n private textTransform(entry: ServerEntry): any {\n if (!!entry.content.items) return this.listTransform(entry);\n return [\n ConversationMessageListItemType.HTML,\n { body: entry.content.html.replace('\\n', '') },\n ];\n }\n\n private getListActions(items: any[], text: any, actions: any, state: any): object {\n let list: ConverstationMessageItem<any>[] = [];\n let mainListContent: { [key: string]: string } = {};\n let mainList: any = [this.getListType(state), { actions: mainListContent }];\n if (text && text.title) {\n list.push([ConversationMessageListItemType.Header, text.title]);\n }\n if (text && text.body) {\n list.push([ConversationMessageListItemType.HTML, { body: text.body }]);\n }\n list.push(mainList);\n items.forEach((o) => {\n switch (o.actionKey) {\n case this.helpActionKey: {\n list.push([ConversationMessageListItemType.Separator, undefined]);\n list.push([\n ConversationMessageListItemType.NoGoodAlternative,\n { body: o.title },\n ]);\n break;\n }\n case this.nextActionKey: {\n if (!!actions['next'] && actions['next'].take === items.length + 1)\n mainListContent[o.actionKey] = o.title;\n break;\n }\n default: {\n mainListContent[o.actionKey] = o.title;\n }\n }\n });\n return list;\n }\n\n private getListType(state: any) {\n if (state?.$type === 'Humany.Matching.Bots.Conversations.GuideListState, Humany.Matching')\n return ConversationMessageListItemType.LinkList;\n else if (\n state?.$type ===\n 'Humany.Matching.Bots.Conversations.States.GuideFeedbackState, Humany.Matching'\n )\n return ConversationMessageListItemType.FeedbackList;\n else return ConversationMessageListItemType.ButtonList;\n }\n\n private getTitleFromEntry(entry: ServerEntry | undefined, action: string): string | undefined {\n if (!!entry) {\n const entryType = (<any>ServerEntryTypeEnum)[entry.type];\n switch (entryType) {\n case ServerEntryTypeEnum.List:\n return this.getTitleFromList(entry, action);\n case ServerEntryTypeEnum.Text:\n return this.textTransform(entry);\n }\n }\n }\n\n private getTitleFromList(entry: ServerEntry, action: string): string {\n return (<Array<any>>entry.content.items).find((o) => o.actionKey == action).title;\n }\n}\n","import { Container } from '@webprovisions/platform';\nimport { v4 as newGuid } from 'uuid';\nimport { ServerEntryTypeEnum } from '../contract/enum/server-entry-type.enum';\nimport { Message } from '../contract/model/conversation-api-model/message.model';\nimport { ServerEntry } from '../contract/model/http/server-entry.model';\nimport { ChatHelper } from '../helper/chat.helper';\nimport { StoreHelper } from '../helper/store.helper';\nimport EntryInterface from '../interface/entry.interface';\n\nexport default class ChatClient {\n entryInterface: EntryInterface;\n constructor(container: Container) {\n this.entryInterface = new EntryInterface(container);\n }\n\n // Initialize from setting the user and agent for the Helper\n static initialize(user: any, agent: any) {\n ChatHelper.setUser(user);\n ChatHelper.setAgent(agent);\n }\n\n // function for posting the messages\n processMessageArrayAndStoreIt(messages: Message[]) {\n messages\n .filter((o) => o && o != null)\n .forEach((o) => {\n if (o.isUser) this.postUserMessage(o);\n else this.postAgentMessage(o);\n });\n StoreHelper.insertOrUpdateMessageArrayStore(messages);\n }\n\n // function for updating current messages\n updateMessageArrayAndStoreIt(messages: Message[]) {\n let conversationEntry = undefined;\n messages.forEach((o) => {\n let message = StoreHelper.getMessage(o.id);\n message?.conversationEntry.update(o.message);\n conversationEntry = message?.conversationEntry;\n });\n\n StoreHelper.insertOrUpdateMessageArrayStore(messages, conversationEntry);\n }\n\n // function for posting a message for the user actions, such as button clicks\n printUserMessageAndStoreIt(action: string) {\n if (action == 'next' || action == 'help') return;\n\n let entry = StoreHelper.getEntry(action);\n\n let message = {\n id: newGuid(),\n message: !entry ? action : this.getTitleFromEntry(entry, action),\n isUser: true,\n };\n\n this.postUserMessage(message);\n StoreHelper.insertOrUpdateMessageArrayStore([message]);\n }\n\n private postUserMessage(message: Message) {\n ChatHelper.getUser().print(message.message);\n }\n\n private postAgentMessage(message: Message) {\n message.conversationEntry = ChatHelper.getAgent().print(message.message);\n }\n\n private getTitleFromEntry(entry: ServerEntry, action: string): string {\n const entryType = (<any>ServerEntryTypeEnum)[entry.type];\n switch (entryType) {\n case ServerEntryTypeEnum.List:\n return this.getTitleFromList(entry, action);\n case ServerEntryTypeEnum.Text:\n return this.getTitleFromText(entry, action);\n default:\n return '';\n }\n }\n\n private getTitleFromText(entry: ServerEntry, action: string): any {\n if (!!entry.content.items) return this.getTitleFromList(entry, action);\n else return entry.content.html;\n }\n\n private getTitleFromList(entry: ServerEntry, action: string): string {\n return (<Array<any>>entry.content.items).find((o) => o.actionKey == action).title;\n }\n}\n","import { ContactMethodPlatform } from '@telia-ace/knowledge-widget-adapters';\nimport { DataClient, DataType } from '@telia-ace/knowledge-widget-types-grid';\nimport { FormBuilder, submitButton } from '@telia-ace/widget-forms';\nimport { Container } from '@webprovisions/platform';\nimport { v4 as uuidv4 } from 'uuid';\nimport { StoreHelper } from '../helper/store.helper';\nimport ChatClient from './chat.client';\n\nexport class ContactMethodClient {\n private static dataClient: DataClient;\n private static contactMethodPlatform: ContactMethodPlatform;\n private static contactMessageEntryArray: any[] = [];\n private static agent: any;\n private chatClient: ChatClient;\n private static container: any;\n\n constructor(container: Container) {\n this.chatClient = new ChatClient(container);\n }\n\n static initialize(\n container: any,\n dataClient: DataClient,\n contactMethodPlatform: ContactMethodPlatform,\n agent: any\n ) {\n this.dataClient = dataClient;\n this.contactMethodPlatform = contactMethodPlatform;\n this.agent = agent;\n this.container = container;\n }\n\n // function for handling forms as contact methods\n handleNewForm = async (errors: any, entry: any) => {\n this.updateForm(entry.contactMethods, {\n submit: 'Submit',\n errors: errors,\n });\n entry.entry.update({\n contactMethods: entry.contactMethods,\n type: 'ace-knowledge-contact-method',\n noPadding: true,\n });\n };\n\n // function for receiving the contact method based on the input\n handleContactMethod = async (input: string = '') => {\n if (input == 'contact') {\n await this.handleContactCategoryList(input);\n } else {\n let contactMethods = await this.loadContactMethods(\n input.split('/')[1], // type\n input.split('/')[0] // id\n );\n\n if (!!contactMethods.body?.form) {\n this.handleForm(input, contactMethods);\n } else if (!contactMethods.expanded && contactMethods.inline) {\n this.handleSingleContactMethod(contactMethods);\n } else if (!!contactMethods.contactMethods) {\n this.handleContactMethodList(input, contactMethods);\n }\n }\n };\n\n // validation of the form provided\n validate(form: any) {\n let entry = ContactMethodClient.contactMessageEntryArray.find(\n (o) => o.id == form.schema.id\n );\n ContactMethodClient.contactMethodPlatform.validate(entry.contactMethods).then((result) => {\n this.handleNewForm(result.errors, entry);\n if (result.valid) {\n this.submit(entry);\n this.removeForm(entry);\n }\n });\n }\n\n private handleContactCategoryList = async (input: string) => {\n let newGuid = uuidv4();\n let type = DataType.ContactMethodCategories;\n let contactMethods = await this.loadContactMethods(type);\n this.chatClient.printUserMessageAndStoreIt(input);\n this.printMessage(newGuid, contactMethods);\n };\n\n private handleForm(input: string, contactMethods: any) {\n let title = input.split('/')[2];\n contactMethods.expanded = true;\n this.updateForm(contactMethods, {\n submit: 'Submit',\n errors: undefined,\n });\n this.printMessage(contactMethods.id, contactMethods, title);\n }\n\n private handleContactMethodList(input: string, contactMethods: any) {\n let title = input.split('/')[2];\n let newGuid = uuidv4();\n this.printMessage(newGuid, contactMethods, title);\n }\n\n private handleSingleContactMethod(contactMethods: any) {\n let entry = ContactMethodClient.contactMessageEntryArray.find((o) =>\n o.contactMethods.contactMethods.find((t: any) => t.id == contactMethods.id)\n );\n let curCM = entry.contactMethods.contactMethods.find((t: any) => t.id == contactMethods.id);\n curCM.expanded = true;\n let message = {\n contactMethods: entry.contactMethods,\n type: 'ace-knowledge-contact-method',\n noPadding: true,\n };\n StoreHelper.insertOrUpdateMessageArrayStore([\n {\n id: entry.id,\n message: message,\n isUser: false,\n },\n ]);\n entry.entry.update(message);\n }\n\n private submit(entry: any) {\n ContactMethodClient.contactMethodPlatform.submit(entry.contactMethods).then((result) => {\n if (!!result) ContactMethodClient.agent.print(result);\n });\n }\n\n private removeForm(entry: any) {\n entry.entry.remove();\n ContactMethodClient.contactMessageEntryArray.splice(\n ContactMethodClient.contactMessageEntryArray.indexOf(entry),\n 1\n );\n }\n\n private printMessage(\n newGuid: string,\n contactMethods: any,\n title: string | undefined = undefined\n ) {\n if (ContactMethodClient.contactMessageEntryArray.find((o) => o.id == contactMethods.id)) {\n let entry = ContactMethodClient.contactMessageEntryArray.find(\n (o) => o.id == contactMethods.id\n );\n let message = {\n contactMethods: contactMethods,\n type: 'ace-knowledge-contact-method',\n noPadding: true,\n };\n entry.entry.update(message);\n StoreHelper.insertOrUpdateMessageArrayStore([\n {\n id: entry.guid,\n message: message,\n isUser: false,\n },\n ]);\n } else {\n if (title) this.chatClient.printUserMessageAndStoreIt(title);\n let message = {\n contactMethods: contactMethods,\n type: 'ace-knowledge-contact-method',\n noPadding: true,\n };\n let entry = ContactMethodClient.agent.print(message);\n StoreHelper.insertOrUpdateMessageArrayStore([\n {\n id: newGuid,\n message: message,\n isUser: false,\n },\n ]);\n ContactMethodClient.contactMessageEntryArray.push({\n id: newGuid,\n contactMethods: contactMethods,\n entry: entry,\n });\n }\n }\n\n private loadContactMethods(dataType: string, id: string | undefined = undefined): Promise<any> {\n switch (dataType) {\n case DataType.ContactMethodCategories: {\n return ContactMethodClient.container\n .getAsync('matchingClient')\n .then((matchingClient: any) => {\n return matchingClient.customRequest('/contactmethods', 'GET', {});\n })\n .then((contactMethods: any) => {\n return contactMethods;\n });\n // return ContactMethodClient.dataClient\n // .fetch(DataType.ContactMethods, { contactMethodCategoryId: id })\n // .then((contactMethods) => contactMethods);\n }\n case DataType.ContactMethods: {\n if (!!id) {\n return ContactMethodClient.dataClient\n .fetch(DataType.ContactMethod, { contactMethodId: id })\n .then((contactMethods) => contactMethods);\n } else {\n return ContactMethodClient.dataClient\n .fetch(DataType.ContactMethods, {})\n .then((contactMethods) => contactMethods);\n }\n }\n case DataType.ContactMethodCategories: {\n return ContactMethodClient.dataClient\n .fetch(DataType.ContactMethods, { contactMethodCategoryId: id })\n .then((contactMethods) => contactMethods);\n }\n default: {\n return Promise.resolve(undefined);\n }\n }\n }\n\n private updateForm = (contactMethod: any, properties: any) => {\n if (contactMethod?.body?.form) {\n const { body } = contactMethod;\n const builder = new FormBuilder(body.form);\n\n if (!body.form.layout || !body.form.layout.submit) {\n builder.createComponent(submitButton(properties.submit, 'submit'));\n }\n\n if (properties.errors) {\n builder.setValidationErrors(properties.errors);\n }\n\n return {\n ...body,\n form: builder.get(),\n };\n }\n return contactMethod?.body || {};\n };\n}\n","export class HttpHelper {\n static fetchOptions = {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n };\n\n static combineUrl(basePath: string, path: string) {\n return basePath + path;\n }\n\n static managedSubdomainSuffixes = ['stage', 'alpha', 'beta', 'gamma'];\n\n static parseSubdomain = (input: string) => {\n const index = input.lastIndexOf('-');\n const lastPart = input.substr(index + 1);\n if (HttpHelper.managedSubdomainSuffixes.indexOf(lastPart) > -1) {\n return input.substr(0, index);\n }\n return input;\n };\n\n static getCredentials(): string | undefined {\n return 'same-origin';\n }\n}\n","import { ServerEntry } from \"../../contract/model/http/server-entry.model\";\nimport { StoreHelper } from \"../../helper/store.helper\";\n\nexport default class PagingInterface {\n process(entries: ServerEntry[]): ServerEntry[] {\n const pagingEntry = entries.find((e) => e.tags.indexOf(\"paging\") > -1);\n\n if (pagingEntry) {\n const stream = StoreHelper.getEntryStore().filter(\n (e) => e.tags.indexOf(\"paging\") > -1 && e.id === pagingEntry.id\n );\n\n if (stream.length > 0) {\n // Get the paging entry with the highest take count\n const last = stream.reduce((acc, entry) => {\n if (\n entry.actions.next &&\n entry.actions.next.take >= acc.actions.next.take\n ) {\n return entry;\n }\n return acc;\n }, stream[0]); // tslint:disable-line:align\n\n // If there is a paging entry with higher take count than the entry to be written,\n // it should be updated to use the paging data from the highest take count entry\n if (last.actions.next.take > pagingEntry.actions.next.take) {\n entries.forEach((entry) => {\n if (entry.id === pagingEntry.id) {\n entry.actions.next = {\n ...entry.actions.next,\n take: last.actions.next.take,\n skip: last.actions.next.skip,\n };\n }\n });\n }\n }\n\n // if items is null or undefined it should\n // overwrite with an empty array\n entries.forEach((entry) => {\n if (\n entry.id === pagingEntry.id &&\n entry.content &&\n entry.content.timestamp\n ) {\n entry.content = {\n ...entry.content,\n items: (entry.content && entry.content.items) || [],\n };\n }\n });\n }\n\n return entries;\n }\n}\n","import { Action } from '../../contract/model/http/action.model';\nimport { ServerEntry } from '../../contract/model/http/server-entry.model';\n\nexport default class ProcessorInterface {\n process(entries: ServerEntry[]): ServerEntry[] {\n let processedEntries = entries;\n\n processedEntries = this.deletePaging(processedEntries);\n processedEntries = this.delete(processedEntries);\n processedEntries = this.merge(processedEntries);\n processedEntries = this.moveLoader(processedEntries);\n\n return processedEntries;\n }\n\n processUpdate(entry: ServerEntry | undefined, updateEntryArray: ServerEntry[]): ServerEntry[] {\n updateEntryArray\n .filter((t) => t.type == 'List')\n .forEach((o) => {\n o.content?.items.forEach((t: any) => {\n if (!entry?.content.items.find((p: any) => p.actionKey == t.actionKey))\n entry?.content.items.push(t);\n });\n Object.keys(o.actions).forEach((t) => {\n this.handleActionUpdateOrInsert(entry?.actions, t, o.actions);\n });\n });\n\n //moves the show more and if it helped to the end if it is needed\n var itemArray: any[] = entry?.content.items;\n\n if (itemArray.find((o) => o.actionKey == 'next')) {\n itemArray.push(\n itemArray.splice(\n itemArray.indexOf(itemArray.find((o) => o.actionKey == 'next')),\n 1\n )[0]\n );\n }\n\n if (itemArray.find((o) => o.actionKey == 'help')) {\n itemArray.push(\n itemArray.splice(\n itemArray.indexOf(itemArray.find((o) => o.actionKey == 'help')),\n 1\n )[0]\n );\n }\n\n return entry ? [entry] : [];\n }\n\n private handleActionUpdateOrInsert(\n currentArray: Action | undefined,\n actionKey: string,\n action: Action\n ) {\n if (!!currentArray) currentArray[actionKey] = action[actionKey];\n }\n\n private deletePaging(entries: ServerEntry[]): ServerEntry[] {\n return entries.filter((entry) => {\n const isEmptyPaging =\n entry.type === 'List' &&\n entry.tags &&\n entry.tags.indexOf('paging') > -1 &&\n typeof entry.content === 'undefined';\n return !isEmptyPaging;\n });\n }\n\n private delete(entries: ServerEntry[]): ServerEntry[] {\n return entries.filter((entry) => entry.content !== null);\n }\n\n private merge(entries: ServerEntry[]): ServerEntry[] {\n const output: ServerEntry[] = [];\n\n const merge = (source: any, target: any = {}): any => {\n const content: any = {};\n if (source == null) {\n return null;\n }\n\n if (target) {\n Object.keys(target).forEach((key) => {\n content[key] = target[key];\n });\n }\n\n Object.keys(source).forEach((key) => {\n if (key == 'items') {\n if (!content[key]) content[key] = [];\n content[key] = content[key].concat(source[key]);\n } else if (key == 'html') content[key] = content[key] + source[key];\n else content[key] = source[key];\n });\n\n return content;\n };\n\n const mergeLocalState = (source: any, target: any): any => {\n if (source == null) return null;\n\n if (Object.keys(source.actions).length === 0) return target.localState;\n\n if (Object.keys(target.actions).length === 0) return source.localState;\n\n return target.localState;\n };\n\n entries.forEach((entry) => {\n if (entry.relation) {\n let existingEntry = entries.find((o) => o.id == entry.relation);\n\n if (existingEntry) {\n const existingIndex = output.indexOf(existingEntry);\n existingEntry.localState = mergeLocalState(entry, existingEntry);\n existingEntry.content = merge(entry.content, existingEntry.content);\n existingEntry.actions = merge(entry.actions, existingEntry.actions);\n output[existingIndex] = existingEntry;\n }\n } else {\n output.push(entry);\n }\n });\n\n return output;\n }\n\n private moveLoader(entries: ServerEntry[]): ServerEntry[] {\n // Moves the loader component to last position in stream\n const loaderEntry = entries.find((e) => e.id === 'loader');\n\n if (!loaderEntry) {\n return entries;\n }\n\n const loaderIndex = entries.indexOf(loaderEntry);\n if (loaderIndex > -1) {\n entries.splice(entries.length - 1, 0, entries.splice(loaderIndex, 1)[0]);\n }\n return entries;\n }\n}\n","import { Container } from '@webprovisions/platform';\nimport { ServerEntry } from '../contract/model/http/server-entry.model';\nimport { ChatHelper } from '../helper/chat.helper';\nimport { MiddlewareHelper } from '../helper/middleware.helper';\nimport { StoreHelper } from '../helper/store.helper';\nimport EntryInterface from '../interface/entry.interface';\nimport PagingInterface from '../interface/middleware/paging.interface';\nimport ProcessorInterface from '../interface/middleware/processor.interface';\nimport ChatClient from './chat.client';\n\nexport default class MiddlewareClient {\n private paging: PagingInterface;\n private processor: ProcessorInterface;\n private entryInterface: EntryInterface;\n private chatClient: ChatClient;\n\n constructor(container: Container) {\n this.paging = new PagingInterface();\n this.processor = new ProcessorInterface();\n this.entryInterface = new EntryInterface(container);\n this.chatClient = new ChatClient(container);\n }\n\n static initialize(container: any, widget: any) {\n MiddlewareHelper.setContainer(container);\n MiddlewareHelper.setWidget(widget);\n }\n\n // called on all standard scenarios like actions and user messages\n async handleEntries(entries: ServerEntry[], action?: string) {\n const widgetEntry = (entries || []).find((e) => e.type === 'Widget');\n\n if (widgetEntry) {\n const agent = ChatHelper.getAgent();\n\n if (agent) {\n agent.update({\n name: widgetEntry.content.agent.name,\n avatar: widgetEntry.content.agent.avatar,\n });\n }\n }\n\n let o = this.executeMiddlewares(entries, false, action);\n let messageArray = await this.entryInterface.transformArray(o);\n this.chatClient.processMessageArrayAndStoreIt(messageArray);\n }\n\n // called on situations such as paging changes\n // when no new entries will be printed\n async handleUpdate(entries: ServerEntry[], action?: string) {\n let o = this.executeMiddlewares(entries, true, action);\n let messageArray = await this.entryInterface.transformArray(o);\n this.chatClient.updateMessageArrayAndStoreIt(messageArray);\n }\n\n // checks whether the action was of an update type\n checkForUpdate(input: string) {\n return input === 'next';\n }\n\n private executeMiddlewares(\n entries: ServerEntry[],\n isUpdate: boolean,\n action?: string\n ): ServerEntry[] {\n if (isUpdate && action)\n entries = this.processor.processUpdate(StoreHelper.getEntry(action), entries);\n else {\n entries = this.processor.process(entries);\n }\n entries = this.paging.process(entries);\n\n return entries;\n }\n}\n","import { Container } from '@webprovisions/platform';\nimport { ClientEnvelope } from '../contract/model/http/client-envelope.model';\nimport { HttpClientOptions } from '../contract/model/http/http-client-options.model';\nimport { ServerEnvelope } from '../contract/model/http/server-envelope.model';\nimport { HttpHelper } from '../helper/http.helper';\nimport { MiddlewareHelper } from '../helper/middleware.helper';\nimport { StoreHelper } from '../helper/store.helper';\nimport ChatClient from './chat.client';\nimport MiddlewareClient from './middleware.client';\n\nexport class HttpClient {\n private endpointUrl: string;\n private clientId: string | undefined;\n private projectionPath: string;\n private apiEndpoint: string;\n private options: HttpClientOptions;\n private middlewareClient: MiddlewareClient;\n private chatClient: ChatClient;\n\n constructor(endpoint: string, clientId: string, container: Container) {\n this.options = {\n credentials: HttpHelper.getCredentials(),\n clientId: clientId,\n };\n this.apiEndpoint = endpoint;\n this.projectionPath = window.location.href;\n this.endpointUrl = HttpHelper.combineUrl(this.projectionPath, 'conversations');\n this.clientId = this.options.clientId;\n this.middlewareClient = new MiddlewareClient(container);\n this.chatClient = new ChatClient(container);\n }\n\n firstHit() {\n // On first hit if there are entries stored in the storage, use them\n // Otherwise start a new session\n MiddlewareHelper.getEntrySessionStorage().then((o) => {\n if (o && o.length > 0) this.chatClient.processMessageArrayAndStoreIt(o);\n else {\n let envelope = this.constructFirstHitEnvelope();\n this.postAndHandleTheData(envelope);\n }\n });\n }\n\n // for updates, such as paging changes\n handleUpdate(action: string) {\n let envelope = this.constructInputEnvelope(action);\n this.postAndHandleTheUpdateData(envelope, action);\n // return this.postAndReturnTheData(envelope, action).then((o) => {\n // return o.entries;\n // });\n }\n\n // for action clicks\n handleInput(action: string) {\n let envelope = this.constructInputEnvelope(action);\n this.postAndHandleTheData(envelope, action);\n }\n\n // for text entries by user\n handlePhrase(phrase: string) {\n let envelope = this.constructPhraseEnvelope(phrase);\n this.postAndHandleTheData(envelope);\n }\n\n private postAndHandleTheData(envelope: ClientEnvelope, action?: string) {\n return fetch(this.apiEndpoint, this.getHttpOptions(envelope))\n .then((response) => {\n if (response.ok) return response.json();\n throw response;\n })\n .then((data) => {\n this.handleResponseData(data, action);\n })\n .catch((err) => console.log(err));\n }\n\n private postAndHandleTheUpdateData(envelope: ClientEnvelope, action?: string): Promise<any> {\n return fetch(this.apiEndpoint, this.getHttpOptions(envelope))\n .then((response) => {\n if (response.ok) return response.json();\n throw response;\n })\n .then((data) => {\n this.handleUpdateResponseData(data, action);\n })\n .catch((err) => console.log(err));\n }\n\n private getHttpOptions(envelope: ClientEnvelope) {\n return Object.assign({}, HttpHelper.fetchOptions, {\n body: JSON.stringify(envelope),\n credentials: <RequestCredentials>this.options.credentials,\n });\n }\n\n private constructInputEnvelope(action: string): ClientEnvelope {\n return {\n action: StoreHelper.getAction(action),\n localState: StoreHelper.getLocalState(action),\n globalState: StoreHelper.getGlobalState(),\n clientId: this.clientId,\n };\n }\n\n private constructPhraseEnvelope(phrase: string): ClientEnvelope {\n return {\n command: { phrase: phrase },\n globalState: StoreHelper.getGlobalState(),\n clientId: this.clientId,\n };\n }\n\n private constructFirstHitEnvelope(): ClientEnvelope {\n return {\n command: { site: this.endpointUrl },\n clientId: this.clientId,\n globalState: {},\n };\n }\n\n private handleResponseData(envelope: ServerEnvelope, action?: string) {\n StoreHelper.setGlobalState(envelope.globalState);\n this.middlewareClient.handleEntries(envelope.entries, action);\n }\n\n private handleUpdateResponseData(envelope: ServerEnvelope, action?: string) {\n this.middlewareClient.handleUpdate(envelope.entries, action);\n }\n}\n","import { ContactMethodPlatform } from '@telia-ace/knowledge-widget-adapters';\nimport { DataClient } from '@telia-ace/knowledge-widget-types-grid';\nimport {\n ConversationPlatform,\n registerCustomMessageComponent\n} from '@telia-ace/widget-conversation';\nimport { Container } from '@webprovisions/platform';\nimport { v4 } from 'uuid';\nimport ChatClient from './client/chat.client';\nimport { ContactMethodClient } from './client/contact-method.client';\nimport { HttpClient } from './client/http.client';\nimport MiddlewareClient from './client/middleware.client';\n\nconst getKnowledgeBotEndpoint = (\n container: Container,\n component: any /*: ComponentNodeController */\n // ComponentNodeController type differs from component passed into registerProvider\n) => {\n const { knowledgeBotEndpoint } = component.properties();\n\n if (knowledgeBotEndpoint) {\n return `${knowledgeBotEndpoint}/conversations`;\n }\n\n const { data } = container.get('$settings');\n\n if (!data || !data.projection) throw new Error('Missing Knowledge Bot endpoint');\n\n return `${data.projection}/conversations`;\n};\n\nconst KnowledgeBotProviderPlugin = async (container: Container) => {\n const dataClient = await DataClient.getInstance(container);\n const platform = await ConversationPlatform.getInstance(container);\n const contactMethodPlatform = await ContactMethodPlatform.getInstance(container);\n registerCustomMessageComponent(\n container,\n 'ace-knowledge-contact-method',\n import('./contract/custom-component/contact-method')\n );\n\n platform.registerProvider('chat.bot', (conversation, component) => {\n const endpoint = getKnowledgeBotEndpoint(container, component);\n\n const clientId = v4();\n\n const agent = conversation.createAgent({\n name: '',\n avatar: undefined,\n });\n\n // passes the user and the agent to the Chat Helper\n ChatClient.initialize(conversation.user, agent);\n\n // passes the conversation provider to the Contact Method Client\n ContactMethodClient.initialize(container, dataClient, contactMethodPlatform, agent);\n\n // passes the container and the widget to the Middleware Store\n MiddlewareClient.initialize(container, container.get('$widget'));\n\n // executes to decide on what to do on first load\n let httpClient = new HttpClient(endpoint, clientId, container);\n httpClient.firstHit();\n\n component.actions.create('evaluate', (input) => {\n let cmClient = new ContactMethodClient(container);\n cmClient.handleNewForm(input.form, input.form.id);\n });\n component.actions.create('validate', (input) => {\n let cmClient = new ContactMethodClient(container);\n cmClient.validate(input.form);\n });\n component.actions.create('submit', (input) => {\n let cmClient = new ContactMethodClient(container);\n cmClient.validate(input.form);\n });\n\n component.actions.watch('conversation.user-typing', (input, next) => {\n return next(input);\n });\n\n component.actions.watch('conversation.user-submit', (input, next) => {\n let httpClient = new HttpClient(endpoint, clientId, container);\n httpClient.handlePhrase(input.text);\n return next(input);\n });\n\n component.actions.watch('conversation.form', (input, next) => {\n return next(input);\n });\n\n component.actions.watch('conversation.action', (input, next) => {\n let chatClient = new ChatClient(container);\n let cmClient = new ContactMethodClient(container);\n // if (input === 'contact' || input.split('/').length > 1) {\n // cmClient.handleContactMethod(input);\n // return next(input);\n // }\n if (input.split('/').length > 1) {\n cmClient.handleContactMethod(input);\n return next(input);\n }\n\n let middlewareClient = new MiddlewareClient(container);\n let httpClient = new HttpClient(endpoint, clientId, container);\n\n // this is an update check, as it requires\n // a lot different logic and no user message\n if (middlewareClient.checkForUpdate(input)) {\n httpClient.handleUpdate(input);\n\n return next(input);\n }\n\n chatClient.printUserMessageAndStoreIt(input);\n\n httpClient.handleInput(input);\n\n return next(input);\n });\n });\n};\n\nexport default KnowledgeBotProviderPlugin;\n"],"names":["newGuid","uuidv4"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAY,IAAA,sBAAA,MACR,GAAA,EAAA,SAAA,KAAA,UACA,EAAA,EAAA,OAAA,KAAA,QACA,EAAA,EAAA,UAAA,KAAA,WACA,EAAA,EAAA,OAAA,KAAA,QACA,EAAA,EAAA,QAAA,KAAA,SALQ,IAAA,KAAA,CAAA,CAAA;ACAL,MAAM,EAAW;AAAA,EAItB,OAAO,QAAQ,GAAW;AACxB,SAAK,OAAO;AAAA,EACd;AAAA,EAEA,OAAO,SAAS,GAAY;AAC1B,SAAK,QAAQ;AAAA,EACf;AAAA,EAEA,OAAO,UAAe;AACpB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,OAAO,WAAgB;AACrB,WAAO,KAAK;AAAA,EACd;AACF;AChBO,MAAM,IAAN,MAAuB;AAAA,EAK1B,OAAO,aAAa,GAAgB;AAChC,MAAiB,YAAY;AAAA,EACjC;AAAA,EAEA,OAAO,UAAU,GAAa;AAC1B,SAAK,SAAS;AAAA,EAClB;AAAA,EAEA,OAAO,eAAoB;AACvB,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,OAAO,YAAiB;AACpB,WAAO,KAAK;AAAA,EAChB;AAAA,EAYA,OAAO,yBAAuC;AAC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index.js","sources":["../src/contract/enum/server-entry-type.enum.ts","../src/helper/chat.helper.ts","../src/helper/middleware.helper.ts","../src/helper/store.helper.ts","../src/interface/entry.interface.ts","../src/client/chat.client.ts","../src/client/contact-method.client.ts","../src/helper/http.helper.ts","../src/interface/middleware/paging.interface.ts","../src/interface/middleware/processor.interface.ts","../src/client/middleware.client.ts","../src/client/http.client.ts","../src/plugin.ts"],"sourcesContent":["export enum ServerEntryTypeEnum {\r\n Widget,\r\n Text,\r\n Contact,\r\n List,\r\n Error,\r\n}\r\n","export class ChatHelper {\r\n private static user: any;\r\n private static agent: any;\r\n\r\n static setUser(user: any) {\r\n this.user = user;\r\n }\r\n\r\n static setAgent(agent: any) {\r\n this.agent = agent;\r\n }\r\n \r\n static getUser(): any {\r\n return this.user;\r\n }\r\n \r\n static getAgent(): any {\r\n return this.agent;\r\n }\r\n}\r\n","import { createStorageWriter, readStorage, StorageCategory } from '@telia-ace/widget-services';\r\nimport { Message } from '../contract/model/conversation-api-model/message.model';\r\n\r\nexport class MiddlewareHelper {\r\n private static sessionMessageStorageVariable: string = 'conversation-plugin-messages';\r\n private static container: any;\r\n private static widget: any;\r\n\r\n static setContainer(container: any) {\r\n MiddlewareHelper.container = container;\r\n }\r\n\r\n static setWidget(widget: any) {\r\n this.widget = widget;\r\n }\r\n\r\n static getContainer(): any {\r\n return this.container;\r\n }\r\n\r\n static getWidget(): any {\r\n return this.widget;\r\n }\r\n\r\n static setEntrySessionStorage = async (messages: Message[]) => {\r\n createStorageWriter(\r\n MiddlewareHelper.container,\r\n MiddlewareHelper.sessionMessageStorageVariable,\r\n StorageCategory.Necessary\r\n ).then((write) => {\r\n return write(messages);\r\n });\r\n };\r\n\r\n static getEntrySessionStorage(): Promise<any> {\r\n return readStorage(this.container, this.sessionMessageStorageVariable);\r\n }\r\n}\r\n","import { Message } from '../contract/model/conversation-api-model/message.model';\r\nimport { ClientAction } from '../contract/model/http/client-action.model';\r\nimport { GlobalState } from '../contract/model/http/global-state.model';\r\nimport { ServerEntry } from '../contract/model/http/server-entry.model';\r\nimport { LooseObject } from '../contract/model/shared/loose-object.model';\r\nimport { MiddlewareHelper } from './middleware.helper';\r\n\r\nexport class StoreHelper {\r\n private static messageStore: Message[] = [];\r\n private static globalState: GlobalState;\r\n\r\n constructor() {\r\n StoreHelper.globalState = {\r\n completedInteractionsCount: 0,\r\n lastBotGuide: 0,\r\n site: 'https://localhost:8080/',\r\n invincibleParameters: {},\r\n };\r\n }\r\n\r\n static insertOrUpdateMessageArrayStore(messageArray: Message[], entry?: any) {\r\n messageArray\r\n .filter((o) => !!o)\r\n .forEach((t) => {\r\n if (!this.messageStore.find((o) => o.id == t.id)) this.insertMessageToStore(t);\r\n else {\r\n this.updateMessageInStore(t, entry);\r\n }\r\n });\r\n\r\n MiddlewareHelper.setEntrySessionStorage(this.messageStore);\r\n }\r\n\r\n private static insertMessageToStore(message: Message) {\r\n this.messageStore.push(message);\r\n }\r\n\r\n private static updateMessageInStore(message: Message, entry?: any) {\r\n message.conversationEntry = entry;\r\n let index = this.messageStore.findIndex((o) => o.id == message.id);\r\n this.messageStore[index] = message;\r\n }\r\n\r\n static checkIdInMessageStore(id: string): boolean {\r\n return this.messageStore.find((o) => o.id == id) === undefined;\r\n }\r\n\r\n static getLocalState(action: string): LooseObject | undefined {\r\n const entry: ServerEntry | undefined = this.getEntry(action);\r\n return entry?.localState;\r\n }\r\n\r\n static getGlobalState(): GlobalState {\r\n return StoreHelper.globalState;\r\n }\r\n\r\n static setGlobalState(state: GlobalState) {\r\n StoreHelper.globalState = state;\r\n }\r\n\r\n static getAction(action: string): ClientAction {\r\n const entry: ServerEntry | undefined = this.getEntry(action);\r\n\r\n return {\r\n key: action,\r\n content: entry?.actions[action],\r\n };\r\n }\r\n\r\n static getCommand(text: string): LooseObject {\r\n return { phrase: text };\r\n }\r\n\r\n static getEntry(action: string): ServerEntry | undefined {\r\n let entry: ServerEntry | undefined = undefined;\r\n this.getEntryStore().forEach((o) => {\r\n if (o.actions[action]) {\r\n entry = o;\r\n }\r\n });\r\n return entry;\r\n }\r\n\r\n static getMessage(id: string): Message | undefined {\r\n return this.messageStore.find((o) => o.id == id);\r\n }\r\n\r\n static getEntryStore(): ServerEntry[] {\r\n return this.messageStore\r\n .filter((o) => !!o.entry)\r\n .map((o) => {\r\n return o.entry;\r\n });\r\n }\r\n}\r\n","import { DataClient, DataType } from '@telia-ace/knowledge-widget-types-grid';\r\nimport {\r\n ConversationMessageListItemType,\r\n ConverstationMessageItem\r\n} from '@telia-ace/widget-conversation';\r\nimport { Container } from '@webprovisions/platform';\r\nimport { ServerEntryTypeEnum } from '../contract/enum/server-entry-type.enum';\r\nimport { Message } from '../contract/model/conversation-api-model/message.model';\r\nimport { ServerEntry } from '../contract/model/http/server-entry.model';\r\nimport { StoreHelper } from '../helper/store.helper';\r\n\r\nexport default class EntryInterface {\r\n private helpActionKey = 'help';\r\n private nextActionKey = 'next';\r\n\r\n constructor(private container: Container) {}\r\n\r\n // transform the entry based on its type\r\n async transform(entry: ServerEntry): Promise<Message | undefined> {\r\n const entryType = (<any>ServerEntryTypeEnum)[entry.type];\r\n switch (entryType) {\r\n case ServerEntryTypeEnum.List:\r\n return {\r\n id: entry.id,\r\n message: this.listTransform(entry),\r\n entry: entry,\r\n isUser: false,\r\n };\r\n case ServerEntryTypeEnum.Text:\r\n return {\r\n id: entry.id,\r\n message: this.textTransform(entry),\r\n entry: entry,\r\n isUser: false,\r\n };\r\n case ServerEntryTypeEnum.Text:\r\n return {\r\n id: entry.id,\r\n message: this.listTransform(entry),\r\n entry: entry,\r\n isUser: false,\r\n };\r\n case ServerEntryTypeEnum.Contact:\r\n return {\r\n id: entry.id,\r\n message: await this.transformContactMethod(entry),\r\n entry: entry,\r\n isUser: false,\r\n };\r\n }\r\n }\r\n\r\n async transformContactMethod(entry: ServerEntry): Promise<any> {\r\n const dataClient: DataClient = await this.container.getAsync('dataClient');\r\n\r\n const contactMethods = [];\r\n const contactMethod = await dataClient.fetch(DataType.ContactMethod, {\r\n contactMethodId: entry.content.id,\r\n });\r\n\r\n if (contactMethod) {\r\n contactMethod.expanded = true;\r\n contactMethods.push(contactMethod);\r\n }\r\n\r\n return {\r\n type: 'ace-knowledge-contact-method',\r\n contactMethods: contactMethods,\r\n };\r\n }\r\n\r\n // transform an array of entries\r\n async transformArray(entryArray: ServerEntry[]): Promise<Message[]> {\r\n let returnArray: Message[] = [];\r\n for (const o of entryArray) {\r\n let x = await this.transform(o);\r\n if (!!x) returnArray.push(x);\r\n }\r\n return returnArray;\r\n }\r\n\r\n // gets the text that should be printed as a user message on action\r\n getUserMessage(action: string) {\r\n let entry = StoreHelper.getEntry(action);\r\n\r\n return this.getTitleFromEntry(entry, action);\r\n }\r\n\r\n private listTransform(entry: ServerEntry): any {\r\n if (entry.type === 'Contact') {\r\n // TODO: is this needed\r\n return undefined;\r\n }\r\n\r\n if (!entry.content) return undefined;\r\n\r\n let object = this.getListActions(\r\n entry.content.items,\r\n this.getContentText(entry),\r\n entry.actions,\r\n entry.localState\r\n );\r\n\r\n return object;\r\n }\r\n\r\n private getContentText(entry: ServerEntry): object | undefined {\r\n if (entry.content.html) return { body: entry.content.html };\r\n if (entry.content.header) return { title: entry.content.header };\r\n }\r\n\r\n private textTransform(entry: ServerEntry): any {\r\n if (!!entry.content.items) return this.listTransform(entry);\r\n return [\r\n ConversationMessageListItemType.HTML,\r\n { body: entry.content.html.replace('\\n', '') },\r\n ];\r\n }\r\n\r\n private getListActions(items: any[], text: any, actions: any, state: any): object {\r\n let list: ConverstationMessageItem<any>[] = [];\r\n let mainListContent: { [key: string]: string } = {};\r\n let mainList: any = [this.getListType(state), { actions: mainListContent }];\r\n if (text && text.title) {\r\n list.push([ConversationMessageListItemType.Header, text.title]);\r\n }\r\n if (text && text.body) {\r\n list.push([ConversationMessageListItemType.HTML, { body: text.body }]);\r\n }\r\n list.push(mainList);\r\n items.forEach((o) => {\r\n switch (o.actionKey) {\r\n case this.helpActionKey: {\r\n list.push([ConversationMessageListItemType.Separator, undefined]);\r\n list.push([\r\n ConversationMessageListItemType.NoGoodAlternative,\r\n { body: o.title },\r\n ]);\r\n break;\r\n }\r\n case this.nextActionKey: {\r\n if (!!actions['next'] && actions['next'].take === items.length + 1)\r\n mainListContent[o.actionKey] = o.title;\r\n break;\r\n }\r\n default: {\r\n mainListContent[o.actionKey] = o.title;\r\n }\r\n }\r\n });\r\n return list;\r\n }\r\n\r\n private getListType(state: any) {\r\n if (state?.$type === 'Humany.Matching.Bots.Conversations.GuideListState, Humany.Matching')\r\n return ConversationMessageListItemType.LinkList;\r\n else if (\r\n state?.$type ===\r\n 'Humany.Matching.Bots.Conversations.States.GuideFeedbackState, Humany.Matching'\r\n )\r\n return ConversationMessageListItemType.FeedbackList;\r\n else return ConversationMessageListItemType.ButtonList;\r\n }\r\n\r\n private getTitleFromEntry(entry: ServerEntry | undefined, action: string): string | undefined {\r\n if (!!entry) {\r\n const entryType = (<any>ServerEntryTypeEnum)[entry.type];\r\n switch (entryType) {\r\n case ServerEntryTypeEnum.List:\r\n return this.getTitleFromList(entry, action);\r\n case ServerEntryTypeEnum.Text:\r\n return this.textTransform(entry);\r\n }\r\n }\r\n }\r\n\r\n private getTitleFromList(entry: ServerEntry, action: string): string {\r\n return (<Array<any>>entry.content.items).find((o) => o.actionKey == action).title;\r\n }\r\n}\r\n","import { Container } from '@webprovisions/platform';\r\nimport { v4 as newGuid } from 'uuid';\r\nimport { ServerEntryTypeEnum } from '../contract/enum/server-entry-type.enum';\r\nimport { Message } from '../contract/model/conversation-api-model/message.model';\r\nimport { ServerEntry } from '../contract/model/http/server-entry.model';\r\nimport { ChatHelper } from '../helper/chat.helper';\r\nimport { StoreHelper } from '../helper/store.helper';\r\nimport EntryInterface from '../interface/entry.interface';\r\n\r\nexport default class ChatClient {\r\n entryInterface: EntryInterface;\r\n constructor(container: Container) {\r\n this.entryInterface = new EntryInterface(container);\r\n }\r\n\r\n // Initialize from setting the user and agent for the Helper\r\n static initialize(user: any, agent: any) {\r\n ChatHelper.setUser(user);\r\n ChatHelper.setAgent(agent);\r\n }\r\n\r\n // function for posting the messages\r\n processMessageArrayAndStoreIt(messages: Message[]) {\r\n messages\r\n .filter((o) => o && o != null)\r\n .forEach((o) => {\r\n if (o.isUser) this.postUserMessage(o);\r\n else this.postAgentMessage(o);\r\n });\r\n StoreHelper.insertOrUpdateMessageArrayStore(messages);\r\n }\r\n\r\n // function for updating current messages\r\n updateMessageArrayAndStoreIt(messages: Message[]) {\r\n let conversationEntry = undefined;\r\n messages.forEach((o) => {\r\n let message = StoreHelper.getMessage(o.id);\r\n message?.conversationEntry.update(o.message);\r\n conversationEntry = message?.conversationEntry;\r\n });\r\n\r\n StoreHelper.insertOrUpdateMessageArrayStore(messages, conversationEntry);\r\n }\r\n\r\n // function for posting a message for the user actions, such as button clicks\r\n printUserMessageAndStoreIt(action: string) {\r\n if (action == 'next' || action == 'help') return;\r\n\r\n let entry = StoreHelper.getEntry(action);\r\n\r\n let message = {\r\n id: newGuid(),\r\n message: !entry ? action : this.getTitleFromEntry(entry, action),\r\n isUser: true,\r\n };\r\n\r\n this.postUserMessage(message);\r\n StoreHelper.insertOrUpdateMessageArrayStore([message]);\r\n }\r\n\r\n private postUserMessage(message: Message) {\r\n ChatHelper.getUser().print(message.message);\r\n }\r\n\r\n private postAgentMessage(message: Message) {\r\n message.conversationEntry = ChatHelper.getAgent().print(message.message);\r\n }\r\n\r\n private getTitleFromEntry(entry: ServerEntry, action: string): string {\r\n const entryType = (<any>ServerEntryTypeEnum)[entry.type];\r\n switch (entryType) {\r\n case ServerEntryTypeEnum.List:\r\n return this.getTitleFromList(entry, action);\r\n case ServerEntryTypeEnum.Text:\r\n return this.getTitleFromText(entry, action);\r\n default:\r\n return '';\r\n }\r\n }\r\n\r\n private getTitleFromText(entry: ServerEntry, action: string): any {\r\n if (!!entry.content.items) return this.getTitleFromList(entry, action);\r\n else return entry.content.html;\r\n }\r\n\r\n private getTitleFromList(entry: ServerEntry, action: string): string {\r\n return (<Array<any>>entry.content.items).find((o) => o.actionKey == action).title;\r\n }\r\n}\r\n","import { ContactMethodPlatform } from '@telia-ace/knowledge-widget-adapters';\r\nimport { DataClient, DataType } from '@telia-ace/knowledge-widget-types-grid';\r\nimport { FormBuilder, submitButton } from '@telia-ace/widget-forms';\r\nimport { Container } from '@webprovisions/platform';\r\nimport { v4 as uuidv4 } from 'uuid';\r\nimport { StoreHelper } from '../helper/store.helper';\r\nimport ChatClient from './chat.client';\r\n\r\nexport class ContactMethodClient {\r\n private static dataClient: DataClient;\r\n private static contactMethodPlatform: ContactMethodPlatform;\r\n private static contactMessageEntryArray: any[] = [];\r\n private static agent: any;\r\n private chatClient: ChatClient;\r\n private static container: any;\r\n\r\n constructor(container: Container) {\r\n this.chatClient = new ChatClient(container);\r\n }\r\n\r\n static initialize(\r\n container: any,\r\n dataClient: DataClient,\r\n contactMethodPlatform: ContactMethodPlatform,\r\n agent: any\r\n ) {\r\n this.dataClient = dataClient;\r\n this.contactMethodPlatform = contactMethodPlatform;\r\n this.agent = agent;\r\n this.container = container;\r\n }\r\n\r\n // function for handling forms as contact methods\r\n handleNewForm = async (errors: any, entry: any) => {\r\n this.updateForm(entry.contactMethods, {\r\n submit: 'Submit',\r\n errors: errors,\r\n });\r\n entry.entry.update({\r\n contactMethods: entry.contactMethods,\r\n type: 'ace-knowledge-contact-method',\r\n noPadding: true,\r\n });\r\n };\r\n\r\n // function for receiving the contact method based on the input\r\n handleContactMethod = async (input: string = '') => {\r\n if (input == 'contact') {\r\n await this.handleContactCategoryList(input);\r\n } else {\r\n let contactMethods = await this.loadContactMethods(\r\n input.split('/')[1], // type\r\n input.split('/')[0] // id\r\n );\r\n\r\n if (!!contactMethods.body?.form) {\r\n this.handleForm(input, contactMethods);\r\n } else if (!contactMethods.expanded && contactMethods.inline) {\r\n this.handleSingleContactMethod(contactMethods);\r\n } else if (!!contactMethods.contactMethods) {\r\n this.handleContactMethodList(input, contactMethods);\r\n }\r\n }\r\n };\r\n\r\n // validation of the form provided\r\n validate(form: any) {\r\n let entry = ContactMethodClient.contactMessageEntryArray.find(\r\n (o) => o.id == form.schema.id\r\n );\r\n ContactMethodClient.contactMethodPlatform.validate(entry.contactMethods).then((result) => {\r\n this.handleNewForm(result.errors, entry);\r\n if (result.valid) {\r\n this.submit(entry);\r\n this.removeForm(entry);\r\n }\r\n });\r\n }\r\n\r\n private handleContactCategoryList = async (input: string) => {\r\n let newGuid = uuidv4();\r\n let type = DataType.ContactMethodCategories;\r\n let contactMethods = await this.loadContactMethods(type);\r\n this.chatClient.printUserMessageAndStoreIt(input);\r\n this.printMessage(newGuid, contactMethods);\r\n };\r\n\r\n private handleForm(input: string, contactMethods: any) {\r\n let title = input.split('/')[2];\r\n contactMethods.expanded = true;\r\n this.updateForm(contactMethods, {\r\n submit: 'Submit',\r\n errors: undefined,\r\n });\r\n this.printMessage(contactMethods.id, contactMethods, title);\r\n }\r\n\r\n private handleContactMethodList(input: string, contactMethods: any) {\r\n let title = input.split('/')[2];\r\n let newGuid = uuidv4();\r\n this.printMessage(newGuid, contactMethods, title);\r\n }\r\n\r\n private handleSingleContactMethod(contactMethods: any) {\r\n let entry = ContactMethodClient.contactMessageEntryArray.find((o) =>\r\n o.contactMethods.contactMethods.find((t: any) => t.id == contactMethods.id)\r\n );\r\n let curCM = entry.contactMethods.contactMethods.find((t: any) => t.id == contactMethods.id);\r\n curCM.expanded = true;\r\n let message = {\r\n contactMethods: entry.contactMethods,\r\n type: 'ace-knowledge-contact-method',\r\n noPadding: true,\r\n };\r\n StoreHelper.insertOrUpdateMessageArrayStore([\r\n {\r\n id: entry.id,\r\n message: message,\r\n isUser: false,\r\n },\r\n ]);\r\n entry.entry.update(message);\r\n }\r\n\r\n private submit(entry: any) {\r\n ContactMethodClient.contactMethodPlatform.submit(entry.contactMethods).then((result) => {\r\n if (!!result) ContactMethodClient.agent.print(result);\r\n });\r\n }\r\n\r\n private removeForm(entry: any) {\r\n entry.entry.remove();\r\n ContactMethodClient.contactMessageEntryArray.splice(\r\n ContactMethodClient.contactMessageEntryArray.indexOf(entry),\r\n 1\r\n );\r\n }\r\n\r\n private printMessage(\r\n newGuid: string,\r\n contactMethods: any,\r\n title: string | undefined = undefined\r\n ) {\r\n if (ContactMethodClient.contactMessageEntryArray.find((o) => o.id == contactMethods.id)) {\r\n let entry = ContactMethodClient.contactMessageEntryArray.find(\r\n (o) => o.id == contactMethods.id\r\n );\r\n let message = {\r\n contactMethods: contactMethods,\r\n type: 'ace-knowledge-contact-method',\r\n noPadding: true,\r\n };\r\n entry.entry.update(message);\r\n StoreHelper.insertOrUpdateMessageArrayStore([\r\n {\r\n id: entry.guid,\r\n message: message,\r\n isUser: false,\r\n },\r\n ]);\r\n } else {\r\n if (title) this.chatClient.printUserMessageAndStoreIt(title);\r\n let message = {\r\n contactMethods: contactMethods,\r\n type: 'ace-knowledge-contact-method',\r\n noPadding: true,\r\n };\r\n let entry = ContactMethodClient.agent.print(message);\r\n StoreHelper.insertOrUpdateMessageArrayStore([\r\n {\r\n id: newGuid,\r\n message: message,\r\n isUser: false,\r\n },\r\n ]);\r\n ContactMethodClient.contactMessageEntryArray.push({\r\n id: newGuid,\r\n contactMethods: contactMethods,\r\n entry: entry,\r\n });\r\n }\r\n }\r\n\r\n private loadContactMethods(dataType: string, id: string | undefined = undefined): Promise<any> {\r\n switch (dataType) {\r\n case DataType.ContactMethodCategories: {\r\n return ContactMethodClient.container\r\n .getAsync('matchingClient')\r\n .then((matchingClient: any) => {\r\n return matchingClient.customRequest('/contactmethods', 'GET', {});\r\n })\r\n .then((contactMethods: any) => {\r\n return contactMethods;\r\n });\r\n // return ContactMethodClient.dataClient\r\n // .fetch(DataType.ContactMethods, { contactMethodCategoryId: id })\r\n // .then((contactMethods) => contactMethods);\r\n }\r\n case DataType.ContactMethods: {\r\n if (!!id) {\r\n return ContactMethodClient.dataClient\r\n .fetch(DataType.ContactMethod, { contactMethodId: id })\r\n .then((contactMethods) => contactMethods);\r\n } else {\r\n return ContactMethodClient.dataClient\r\n .fetch(DataType.ContactMethods, {})\r\n .then((contactMethods) => contactMethods);\r\n }\r\n }\r\n case DataType.ContactMethodCategories: {\r\n return ContactMethodClient.dataClient\r\n .fetch(DataType.ContactMethods, { contactMethodCategoryId: id })\r\n .then((contactMethods) => contactMethods);\r\n }\r\n default: {\r\n return Promise.resolve(undefined);\r\n }\r\n }\r\n }\r\n\r\n private updateForm = (contactMethod: any, properties: any) => {\r\n if (contactMethod?.body?.form) {\r\n const { body } = contactMethod;\r\n const builder = new FormBuilder(body.form);\r\n\r\n if (!body.form.layout || !body.form.layout.submit) {\r\n builder.createComponent(submitButton(properties.submit, 'submit'));\r\n }\r\n\r\n if (properties.errors) {\r\n builder.setValidationErrors(properties.errors);\r\n }\r\n\r\n return {\r\n ...body,\r\n form: builder.get(),\r\n };\r\n }\r\n return contactMethod?.body || {};\r\n };\r\n}\r\n","export class HttpHelper {\r\n static fetchOptions = {\r\n method: 'POST',\r\n headers: {\r\n Accept: 'application/json',\r\n 'Content-Type': 'application/json',\r\n },\r\n };\r\n\r\n static combineUrl(basePath: string, path: string) {\r\n return basePath + path;\r\n }\r\n\r\n static managedSubdomainSuffixes = ['stage', 'alpha', 'beta', 'gamma'];\r\n\r\n static parseSubdomain = (input: string) => {\r\n const index = input.lastIndexOf('-');\r\n const lastPart = input.substr(index + 1);\r\n if (HttpHelper.managedSubdomainSuffixes.indexOf(lastPart) > -1) {\r\n return input.substr(0, index);\r\n }\r\n return input;\r\n };\r\n\r\n static getCredentials(): string | undefined {\r\n return 'same-origin';\r\n }\r\n}\r\n","import { ServerEntry } from \"../../contract/model/http/server-entry.model\";\r\nimport { StoreHelper } from \"../../helper/store.helper\";\r\n\r\nexport default class PagingInterface {\r\n process(entries: ServerEntry[]): ServerEntry[] {\r\n const pagingEntry = entries.find((e) => e.tags.indexOf(\"paging\") > -1);\r\n\r\n if (pagingEntry) {\r\n const stream = StoreHelper.getEntryStore().filter(\r\n (e) => e.tags.indexOf(\"paging\") > -1 && e.id === pagingEntry.id\r\n );\r\n\r\n if (stream.length > 0) {\r\n // Get the paging entry with the highest take count\r\n const last = stream.reduce((acc, entry) => {\r\n if (\r\n entry.actions.next &&\r\n entry.actions.next.take >= acc.actions.next.take\r\n ) {\r\n return entry;\r\n }\r\n return acc;\r\n }, stream[0]); // tslint:disable-line:align\r\n\r\n // If there is a paging entry with higher take count than the entry to be written,\r\n // it should be updated to use the paging data from the highest take count entry\r\n if (last.actions.next.take > pagingEntry.actions.next.take) {\r\n entries.forEach((entry) => {\r\n if (entry.id === pagingEntry.id) {\r\n entry.actions.next = {\r\n ...entry.actions.next,\r\n take: last.actions.next.take,\r\n skip: last.actions.next.skip,\r\n };\r\n }\r\n });\r\n }\r\n }\r\n\r\n // if items is null or undefined it should\r\n // overwrite with an empty array\r\n entries.forEach((entry) => {\r\n if (\r\n entry.id === pagingEntry.id &&\r\n entry.content &&\r\n entry.content.timestamp\r\n ) {\r\n entry.content = {\r\n ...entry.content,\r\n items: (entry.content && entry.content.items) || [],\r\n };\r\n }\r\n });\r\n }\r\n\r\n return entries;\r\n }\r\n}\r\n","import { Action } from '../../contract/model/http/action.model';\r\nimport { ServerEntry } from '../../contract/model/http/server-entry.model';\r\n\r\nexport default class ProcessorInterface {\r\n process(entries: ServerEntry[]): ServerEntry[] {\r\n let processedEntries = entries;\r\n\r\n processedEntries = this.deletePaging(processedEntries);\r\n processedEntries = this.delete(processedEntries);\r\n processedEntries = this.merge(processedEntries);\r\n processedEntries = this.moveLoader(processedEntries);\r\n\r\n return processedEntries;\r\n }\r\n\r\n processUpdate(entry: ServerEntry | undefined, updateEntryArray: ServerEntry[]): ServerEntry[] {\r\n updateEntryArray\r\n .filter((t) => t.type == 'List')\r\n .forEach((o) => {\r\n o.content?.items.forEach((t: any) => {\r\n if (!entry?.content.items.find((p: any) => p.actionKey == t.actionKey))\r\n entry?.content.items.push(t);\r\n });\r\n Object.keys(o.actions).forEach((t) => {\r\n this.handleActionUpdateOrInsert(entry?.actions, t, o.actions);\r\n });\r\n });\r\n\r\n //moves the show more and if it helped to the end if it is needed\r\n var itemArray: any[] = entry?.content.items;\r\n\r\n if (itemArray.find((o) => o.actionKey == 'next')) {\r\n itemArray.push(\r\n itemArray.splice(\r\n itemArray.indexOf(itemArray.find((o) => o.actionKey == 'next')),\r\n 1\r\n )[0]\r\n );\r\n }\r\n\r\n if (itemArray.find((o) => o.actionKey == 'help')) {\r\n itemArray.push(\r\n itemArray.splice(\r\n itemArray.indexOf(itemArray.find((o) => o.actionKey == 'help')),\r\n 1\r\n )[0]\r\n );\r\n }\r\n\r\n return entry ? [entry] : [];\r\n }\r\n\r\n private handleActionUpdateOrInsert(\r\n currentArray: Action | undefined,\r\n actionKey: string,\r\n action: Action\r\n ) {\r\n if (!!currentArray) currentArray[actionKey] = action[actionKey];\r\n }\r\n\r\n private deletePaging(entries: ServerEntry[]): ServerEntry[] {\r\n return entries.filter((entry) => {\r\n const isEmptyPaging =\r\n entry.type === 'List' &&\r\n entry.tags &&\r\n entry.tags.indexOf('paging') > -1 &&\r\n typeof entry.content === 'undefined';\r\n return !isEmptyPaging;\r\n });\r\n }\r\n\r\n private delete(entries: ServerEntry[]): ServerEntry[] {\r\n return entries.filter((entry) => entry.content !== null);\r\n }\r\n\r\n private merge(entries: ServerEntry[]): ServerEntry[] {\r\n const output: ServerEntry[] = [];\r\n\r\n const merge = (source: any, target: any = {}): any => {\r\n const content: any = {};\r\n if (source == null) {\r\n return null;\r\n }\r\n\r\n if (target) {\r\n Object.keys(target).forEach((key) => {\r\n content[key] = target[key];\r\n });\r\n }\r\n\r\n Object.keys(source).forEach((key) => {\r\n if (key == 'items') {\r\n if (!content[key]) content[key] = [];\r\n content[key] = content[key].concat(source[key]);\r\n } else if (key == 'html') content[key] = content[key] + source[key];\r\n else content[key] = source[key];\r\n });\r\n\r\n return content;\r\n };\r\n\r\n const mergeLocalState = (source: any, target: any): any => {\r\n if (source == null) return null;\r\n\r\n if (Object.keys(source.actions).length === 0) return target.localState;\r\n\r\n if (Object.keys(target.actions).length === 0) return source.localState;\r\n\r\n return target.localState;\r\n };\r\n\r\n entries.forEach((entry) => {\r\n if (entry.relation) {\r\n let existingEntry = entries.find((o) => o.id == entry.relation);\r\n\r\n if (existingEntry) {\r\n const existingIndex = output.indexOf(existingEntry);\r\n existingEntry.localState = mergeLocalState(entry, existingEntry);\r\n existingEntry.content = merge(entry.content, existingEntry.content);\r\n existingEntry.actions = merge(entry.actions, existingEntry.actions);\r\n output[existingIndex] = existingEntry;\r\n }\r\n } else {\r\n output.push(entry);\r\n }\r\n });\r\n\r\n return output;\r\n }\r\n\r\n private moveLoader(entries: ServerEntry[]): ServerEntry[] {\r\n // Moves the loader component to last position in stream\r\n const loaderEntry = entries.find((e) => e.id === 'loader');\r\n\r\n if (!loaderEntry) {\r\n return entries;\r\n }\r\n\r\n const loaderIndex = entries.indexOf(loaderEntry);\r\n if (loaderIndex > -1) {\r\n entries.splice(entries.length - 1, 0, entries.splice(loaderIndex, 1)[0]);\r\n }\r\n return entries;\r\n }\r\n}\r\n","import { Container } from '@webprovisions/platform';\r\nimport { ServerEntry } from '../contract/model/http/server-entry.model';\r\nimport { ChatHelper } from '../helper/chat.helper';\r\nimport { MiddlewareHelper } from '../helper/middleware.helper';\r\nimport { StoreHelper } from '../helper/store.helper';\r\nimport EntryInterface from '../interface/entry.interface';\r\nimport PagingInterface from '../interface/middleware/paging.interface';\r\nimport ProcessorInterface from '../interface/middleware/processor.interface';\r\nimport ChatClient from './chat.client';\r\n\r\nexport default class MiddlewareClient {\r\n private paging: PagingInterface;\r\n private processor: ProcessorInterface;\r\n private entryInterface: EntryInterface;\r\n private chatClient: ChatClient;\r\n\r\n constructor(container: Container) {\r\n this.paging = new PagingInterface();\r\n this.processor = new ProcessorInterface();\r\n this.entryInterface = new EntryInterface(container);\r\n this.chatClient = new ChatClient(container);\r\n }\r\n\r\n static initialize(container: any, widget: any) {\r\n MiddlewareHelper.setContainer(container);\r\n MiddlewareHelper.setWidget(widget);\r\n }\r\n\r\n // called on all standard scenarios like actions and user messages\r\n async handleEntries(entries: ServerEntry[], action?: string) {\r\n const widgetEntry = (entries || []).find((e) => e.type === 'Widget');\r\n\r\n if (widgetEntry) {\r\n const agent = ChatHelper.getAgent();\r\n\r\n if (agent) {\r\n agent.update({\r\n name: widgetEntry.content.agent.name,\r\n avatar: widgetEntry.content.agent.avatar,\r\n });\r\n }\r\n }\r\n\r\n let o = this.executeMiddlewares(entries, false, action);\r\n let messageArray = await this.entryInterface.transformArray(o);\r\n this.chatClient.processMessageArrayAndStoreIt(messageArray);\r\n }\r\n\r\n // called on situations such as paging changes\r\n // when no new entries will be printed\r\n async handleUpdate(entries: ServerEntry[], action?: string) {\r\n let o = this.executeMiddlewares(entries, true, action);\r\n let messageArray = await this.entryInterface.transformArray(o);\r\n this.chatClient.updateMessageArrayAndStoreIt(messageArray);\r\n }\r\n\r\n // checks whether the action was of an update type\r\n checkForUpdate(input: string) {\r\n return input === 'next';\r\n }\r\n\r\n private executeMiddlewares(\r\n entries: ServerEntry[],\r\n isUpdate: boolean,\r\n action?: string\r\n ): ServerEntry[] {\r\n if (isUpdate && action)\r\n entries = this.processor.processUpdate(StoreHelper.getEntry(action), entries);\r\n else {\r\n entries = this.processor.process(entries);\r\n }\r\n entries = this.paging.process(entries);\r\n\r\n return entries;\r\n }\r\n}\r\n","import { Container } from '@webprovisions/platform';\r\nimport { ClientEnvelope } from '../contract/model/http/client-envelope.model';\r\nimport { HttpClientOptions } from '../contract/model/http/http-client-options.model';\r\nimport { ServerEnvelope } from '../contract/model/http/server-envelope.model';\r\nimport { HttpHelper } from '../helper/http.helper';\r\nimport { MiddlewareHelper } from '../helper/middleware.helper';\r\nimport { StoreHelper } from '../helper/store.helper';\r\nimport ChatClient from './chat.client';\r\nimport MiddlewareClient from './middleware.client';\r\n\r\nexport class HttpClient {\r\n private endpointUrl: string;\r\n private clientId: string | undefined;\r\n private projectionPath: string;\r\n private apiEndpoint: string;\r\n private options: HttpClientOptions;\r\n private middlewareClient: MiddlewareClient;\r\n private chatClient: ChatClient;\r\n\r\n constructor(endpoint: string, clientId: string, container: Container) {\r\n this.options = {\r\n credentials: HttpHelper.getCredentials(),\r\n clientId: clientId,\r\n };\r\n this.apiEndpoint = endpoint;\r\n this.projectionPath = window.location.href;\r\n this.endpointUrl = HttpHelper.combineUrl(this.projectionPath, 'conversations');\r\n this.clientId = this.options.clientId;\r\n this.middlewareClient = new MiddlewareClient(container);\r\n this.chatClient = new ChatClient(container);\r\n }\r\n\r\n firstHit() {\r\n // On first hit if there are entries stored in the storage, use them\r\n // Otherwise start a new session\r\n MiddlewareHelper.getEntrySessionStorage().then((o) => {\r\n if (o && o.length > 0) this.chatClient.processMessageArrayAndStoreIt(o);\r\n else {\r\n let envelope = this.constructFirstHitEnvelope();\r\n this.postAndHandleTheData(envelope);\r\n }\r\n });\r\n }\r\n\r\n // for updates, such as paging changes\r\n handleUpdate(action: string) {\r\n let envelope = this.constructInputEnvelope(action);\r\n this.postAndHandleTheUpdateData(envelope, action);\r\n // return this.postAndReturnTheData(envelope, action).then((o) => {\r\n // return o.entries;\r\n // });\r\n }\r\n\r\n // for action clicks\r\n handleInput(action: string) {\r\n let envelope = this.constructInputEnvelope(action);\r\n this.postAndHandleTheData(envelope, action);\r\n }\r\n\r\n // for text entries by user\r\n handlePhrase(phrase: string) {\r\n let envelope = this.constructPhraseEnvelope(phrase);\r\n this.postAndHandleTheData(envelope);\r\n }\r\n\r\n private postAndHandleTheData(envelope: ClientEnvelope, action?: string) {\r\n return fetch(this.apiEndpoint, this.getHttpOptions(envelope))\r\n .then((response) => {\r\n if (response.ok) return response.json();\r\n throw response;\r\n })\r\n .then((data) => {\r\n this.handleResponseData(data, action);\r\n })\r\n .catch((err) => console.log(err));\r\n }\r\n\r\n private postAndHandleTheUpdateData(envelope: ClientEnvelope, action?: string): Promise<any> {\r\n return fetch(this.apiEndpoint, this.getHttpOptions(envelope))\r\n .then((response) => {\r\n if (response.ok) return response.json();\r\n throw response;\r\n })\r\n .then((data) => {\r\n this.handleUpdateResponseData(data, action);\r\n })\r\n .catch((err) => console.log(err));\r\n }\r\n\r\n private getHttpOptions(envelope: ClientEnvelope) {\r\n return Object.assign({}, HttpHelper.fetchOptions, {\r\n body: JSON.stringify(envelope),\r\n credentials: <RequestCredentials>this.options.credentials,\r\n });\r\n }\r\n\r\n private constructInputEnvelope(action: string): ClientEnvelope {\r\n return {\r\n action: StoreHelper.getAction(action),\r\n localState: StoreHelper.getLocalState(action),\r\n globalState: StoreHelper.getGlobalState(),\r\n clientId: this.clientId,\r\n };\r\n }\r\n\r\n private constructPhraseEnvelope(phrase: string): ClientEnvelope {\r\n return {\r\n command: { phrase: phrase },\r\n globalState: StoreHelper.getGlobalState(),\r\n clientId: this.clientId,\r\n };\r\n }\r\n\r\n private constructFirstHitEnvelope(): ClientEnvelope {\r\n return {\r\n command: { site: this.endpointUrl },\r\n clientId: this.clientId,\r\n globalState: {},\r\n };\r\n }\r\n\r\n private handleResponseData(envelope: ServerEnvelope, action?: string) {\r\n StoreHelper.setGlobalState(envelope.globalState);\r\n this.middlewareClient.handleEntries(envelope.entries, action);\r\n }\r\n\r\n private handleUpdateResponseData(envelope: ServerEnvelope, action?: string) {\r\n this.middlewareClient.handleUpdate(envelope.entries, action);\r\n }\r\n}\r\n","import { ContactMethodPlatform } from '@telia-ace/knowledge-widget-adapters';\r\nimport { DataClient } from '@telia-ace/knowledge-widget-types-grid';\r\nimport {\r\n ConversationPlatform,\r\n registerCustomMessageComponent\r\n} from '@telia-ace/widget-conversation';\r\nimport { Container } from '@webprovisions/platform';\r\nimport { v4 } from 'uuid';\r\nimport ChatClient from './client/chat.client';\r\nimport { ContactMethodClient } from './client/contact-method.client';\r\nimport { HttpClient } from './client/http.client';\r\nimport MiddlewareClient from './client/middleware.client';\r\n\r\nconst getKnowledgeBotEndpoint = (\r\n container: Container,\r\n component: any /*: ComponentNodeController */\r\n // ComponentNodeController type differs from component passed into registerProvider\r\n) => {\r\n const { knowledgeBotEndpoint } = component.properties();\r\n\r\n if (knowledgeBotEndpoint) {\r\n return `${knowledgeBotEndpoint}/conversations`;\r\n }\r\n\r\n const { data } = container.get('$settings');\r\n\r\n if (!data || !data.projection) throw new Error('Missing Knowledge Bot endpoint');\r\n\r\n return `${data.projection}/conversations`;\r\n};\r\n\r\nconst KnowledgeBotProviderPlugin = async (container: Container) => {\r\n const dataClient = await DataClient.getInstance(container);\r\n const platform = await ConversationPlatform.getInstance(container);\r\n const contactMethodPlatform = await ContactMethodPlatform.getInstance(container);\r\n registerCustomMessageComponent(\r\n container,\r\n 'ace-knowledge-contact-method',\r\n import('./contract/custom-component/contact-method')\r\n );\r\n\r\n platform.registerProvider('chat.bot', (conversation, component) => {\r\n const endpoint = getKnowledgeBotEndpoint(container, component);\r\n\r\n const clientId = v4();\r\n\r\n const agent = conversation.createAgent({\r\n name: '',\r\n avatar: undefined,\r\n });\r\n\r\n // passes the user and the agent to the Chat Helper\r\n ChatClient.initialize(conversation.user, agent);\r\n\r\n // passes the conversation provider to the Contact Method Client\r\n ContactMethodClient.initialize(container, dataClient, contactMethodPlatform, agent);\r\n\r\n // passes the container and the widget to the Middleware Store\r\n MiddlewareClient.initialize(container, container.get('$widget'));\r\n\r\n // executes to decide on what to do on first load\r\n let httpClient = new HttpClient(endpoint, clientId, container);\r\n httpClient.firstHit();\r\n\r\n component.actions.create('evaluate', (input) => {\r\n let cmClient = new ContactMethodClient(container);\r\n cmClient.handleNewForm(input.form, input.form.id);\r\n });\r\n component.actions.create('validate', (input) => {\r\n let cmClient = new ContactMethodClient(container);\r\n cmClient.validate(input.form);\r\n });\r\n component.actions.create('submit', (input) => {\r\n let cmClient = new ContactMethodClient(container);\r\n cmClient.validate(input.form);\r\n });\r\n\r\n component.actions.watch('conversation.user-typing', (input, next) => {\r\n return next(input);\r\n });\r\n\r\n component.actions.watch('conversation.user-submit', (input, next) => {\r\n let httpClient = new HttpClient(endpoint, clientId, container);\r\n httpClient.handlePhrase(input.text);\r\n return next(input);\r\n });\r\n\r\n component.actions.watch('conversation.form', (input, next) => {\r\n return next(input);\r\n });\r\n\r\n component.actions.watch('conversation.action', (input, next) => {\r\n let chatClient = new ChatClient(container);\r\n let cmClient = new ContactMethodClient(container);\r\n // if (input === 'contact' || input.split('/').length > 1) {\r\n // cmClient.handleContactMethod(input);\r\n // return next(input);\r\n // }\r\n if (input.split('/').length > 1) {\r\n cmClient.handleContactMethod(input);\r\n return next(input);\r\n }\r\n\r\n let middlewareClient = new MiddlewareClient(container);\r\n let httpClient = new HttpClient(endpoint, clientId, container);\r\n\r\n // this is an update check, as it requires\r\n // a lot different logic and no user message\r\n if (middlewareClient.checkForUpdate(input)) {\r\n httpClient.handleUpdate(input);\r\n\r\n return next(input);\r\n }\r\n\r\n chatClient.printUserMessageAndStoreIt(input);\r\n\r\n httpClient.handleInput(input);\r\n\r\n return next(input);\r\n });\r\n });\r\n};\r\n\r\nexport default KnowledgeBotProviderPlugin;\r\n"],"names":["newGuid","uuidv4"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAY,IAAA,sBAAA,MACR,GAAA,EAAA,SAAA,KAAA,UACA,EAAA,EAAA,OAAA,KAAA,QACA,EAAA,EAAA,UAAA,KAAA,WACA,EAAA,EAAA,OAAA,KAAA,QACA,EAAA,EAAA,QAAA,KAAA,SALQ,IAAA,KAAA,CAAA,CAAA;ACAL,MAAM,EAAW;AAAA,EAItB,OAAO,QAAQ,GAAW;AACxB,SAAK,OAAO;AAAA,EACd;AAAA,EAEA,OAAO,SAAS,GAAY;AAC1B,SAAK,QAAQ;AAAA,EACf;AAAA,EAEA,OAAO,UAAe;AACpB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,OAAO,WAAgB;AACrB,WAAO,KAAK;AAAA,EACd;AACF;AChBO,MAAM,IAAN,MAAuB;AAAA,EAK1B,OAAO,aAAa,GAAgB;AAChC,MAAiB,YAAY;AAAA,EACjC;AAAA,EAEA,OA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AAK,IACrC,GAAW,aAAa,CAAK,GAEtB,EAAK,CAAK,KAGrB,GAAW,2BAA2B,CAAK,GAE3C,EAAW,YAAY,CAAK,GAErB,EAAK,CAAK;AAAA,IAAA,CACpB;AAAA,EAAA,CACJ;AACL;"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { Container } from '@webprovisions/platform';
|
|
2
|
-
import { Message } from '../contract/model/conversation-api-model/message.model';
|
|
3
|
-
import { ServerEntry } from '../contract/model/http/server-entry.model';
|
|
4
|
-
export default class EntryInterface {
|
|
5
|
-
private container;
|
|
6
|
-
private helpActionKey;
|
|
7
|
-
private nextActionKey;
|
|
8
|
-
constructor(container: Container);
|
|
9
|
-
transform(entry: ServerEntry): Promise<Message | undefined>;
|
|
10
|
-
transformContactMethod(entry: ServerEntry): Promise<any>;
|
|
11
|
-
transformArray(entryArray: ServerEntry[]): Promise<Message[]>;
|
|
12
|
-
getUserMessage(action: string): string | undefined;
|
|
13
|
-
private listTransform;
|
|
14
|
-
private getContentText;
|
|
15
|
-
private textTransform;
|
|
16
|
-
private getListActions;
|
|
17
|
-
private getListType;
|
|
18
|
-
private getTitleFromEntry;
|
|
19
|
-
private getTitleFromList;
|
|
20
|
-
}
|
|
1
|
+
import { Container } from '@webprovisions/platform';
|
|
2
|
+
import { Message } from '../contract/model/conversation-api-model/message.model';
|
|
3
|
+
import { ServerEntry } from '../contract/model/http/server-entry.model';
|
|
4
|
+
export default class EntryInterface {
|
|
5
|
+
private container;
|
|
6
|
+
private helpActionKey;
|
|
7
|
+
private nextActionKey;
|
|
8
|
+
constructor(container: Container);
|
|
9
|
+
transform(entry: ServerEntry): Promise<Message | undefined>;
|
|
10
|
+
transformContactMethod(entry: ServerEntry): Promise<any>;
|
|
11
|
+
transformArray(entryArray: ServerEntry[]): Promise<Message[]>;
|
|
12
|
+
getUserMessage(action: string): string | undefined;
|
|
13
|
+
private listTransform;
|
|
14
|
+
private getContentText;
|
|
15
|
+
private textTransform;
|
|
16
|
+
private getListActions;
|
|
17
|
+
private getListType;
|
|
18
|
+
private getTitleFromEntry;
|
|
19
|
+
private getTitleFromList;
|
|
20
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ServerEntry } from "../../contract/model/http/server-entry.model";
|
|
2
|
-
export default class PagingInterface {
|
|
3
|
-
process(entries: ServerEntry[]): ServerEntry[];
|
|
4
|
-
}
|
|
1
|
+
import { ServerEntry } from "../../contract/model/http/server-entry.model";
|
|
2
|
+
export default class PagingInterface {
|
|
3
|
+
process(entries: ServerEntry[]): ServerEntry[];
|
|
4
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ServerEntry } from '../../contract/model/http/server-entry.model';
|
|
2
|
-
export default class ProcessorInterface {
|
|
3
|
-
process(entries: ServerEntry[]): ServerEntry[];
|
|
4
|
-
processUpdate(entry: ServerEntry | undefined, updateEntryArray: ServerEntry[]): ServerEntry[];
|
|
5
|
-
private handleActionUpdateOrInsert;
|
|
6
|
-
private deletePaging;
|
|
7
|
-
private delete;
|
|
8
|
-
private merge;
|
|
9
|
-
private moveLoader;
|
|
10
|
-
}
|
|
1
|
+
import { ServerEntry } from '../../contract/model/http/server-entry.model';
|
|
2
|
+
export default class ProcessorInterface {
|
|
3
|
+
process(entries: ServerEntry[]): ServerEntry[];
|
|
4
|
+
processUpdate(entry: ServerEntry | undefined, updateEntryArray: ServerEntry[]): ServerEntry[];
|
|
5
|
+
private handleActionUpdateOrInsert;
|
|
6
|
+
private deletePaging;
|
|
7
|
+
private delete;
|
|
8
|
+
private merge;
|
|
9
|
+
private moveLoader;
|
|
10
|
+
}
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Container } from '@webprovisions/platform';
|
|
2
|
-
declare const KnowledgeBotProviderPlugin: (container: Container) => Promise<void>;
|
|
3
|
-
export default KnowledgeBotProviderPlugin;
|
|
1
|
+
import { Container } from '@webprovisions/platform';
|
|
2
|
+
declare const KnowledgeBotProviderPlugin: (container: Container) => Promise<void>;
|
|
3
|
+
export default KnowledgeBotProviderPlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/knowledge-widget-bot-provider",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.62",
|
|
4
4
|
"description": "Bot Provider Plugin ACE Knowledge Widgets.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Telia Company AB",
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
},
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@telia-ace/knowledge-widget-adapters": "^1.0.
|
|
29
|
-
"@telia-ace/knowledge-widget-types-grid": "^1.0.
|
|
30
|
-
"@telia-ace/knowledge-widget-ui": "^1.0.
|
|
31
|
-
"@telia-ace/widget-conversation": "^1.0.
|
|
32
|
-
"@telia-ace/widget-forms": "^1.0.
|
|
33
|
-
"@telia-ace/widget-services": "^1.0.
|
|
34
|
-
"@telia-ace/widget-utilities": "^1.0.
|
|
28
|
+
"@telia-ace/knowledge-widget-adapters": "^1.0.28",
|
|
29
|
+
"@telia-ace/knowledge-widget-types-grid": "^1.0.29",
|
|
30
|
+
"@telia-ace/knowledge-widget-ui": "^1.0.24",
|
|
31
|
+
"@telia-ace/widget-conversation": "^1.0.27",
|
|
32
|
+
"@telia-ace/widget-forms": "^1.0.21",
|
|
33
|
+
"@telia-ace/widget-services": "^1.0.14",
|
|
34
|
+
"@telia-ace/widget-utilities": "^1.0.3",
|
|
35
35
|
"@webprovisions/bootstrapping": "^1.0.12",
|
|
36
36
|
"uuid": "^8.3.2"
|
|
37
37
|
},
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/uuid": "^8.3.4"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "899e3b274a983e07cd18de361776b74c4c82f3af"
|
|
46
46
|
}
|