@telia-ace/knowledge-widget-bot-provider 0.0.1-alpha.48 → 0.0.1-alpha.49
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 +34 -34
- package/dist/client/http.client.d.ts +26 -26
- package/dist/client/middleware.client.d.ts +14 -14
- package/dist/components/feedback-list.d.ts +8 -0
- package/dist/components/no-good-alternative.d.ts +6 -0
- package/dist/contact-method.js.map +1 -1
- package/dist/contract/custom-component/contact-method-item.d.ts +9 -9
- 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/custom-component/entry-context.d.ts +5 -5
- 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/feedback-list.js +104 -0
- package/dist/feedback-list.js.map +1 -0
- 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 +23 -23
- package/dist/index.d.ts +2 -2
- package/dist/index.js +32 -11
- 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/no-good-alternative.js +33 -0
- package/dist/no-good-alternative.js.map +1 -0
- package/dist/plugin.d.ts +3 -3
- package/dist/ui/feedback-list.d.ts +8 -0
- package/dist/ui/no-good-alternative.d.ts +6 -0
- package/dist/utils.d.ts +2 -2
- package/package.json +8 -8
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[]): Promise<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[]): Promise<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,34 +1,34 @@
|
|
|
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
|
-
addContactMethod(contactMethod: any): {
|
|
19
|
-
contactMethods: any;
|
|
20
|
-
type: string;
|
|
21
|
-
noPadding: boolean;
|
|
22
|
-
};
|
|
23
|
-
expandContactMethod(input: {
|
|
24
|
-
entryId: string;
|
|
25
|
-
contactMethodId: string;
|
|
26
|
-
}): void;
|
|
27
|
-
private handleContactMethodList;
|
|
28
|
-
private handleSingleContactMethod;
|
|
29
|
-
private submit;
|
|
30
|
-
private removeForm;
|
|
31
|
-
private printMessage;
|
|
32
|
-
private loadContactMethods;
|
|
33
|
-
private updateForm;
|
|
34
|
-
}
|
|
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
|
+
addContactMethod(contactMethod: any): {
|
|
19
|
+
contactMethods: any;
|
|
20
|
+
type: string;
|
|
21
|
+
noPadding: boolean;
|
|
22
|
+
};
|
|
23
|
+
expandContactMethod(input: {
|
|
24
|
+
entryId: string;
|
|
25
|
+
contactMethodId: string;
|
|
26
|
+
}): void;
|
|
27
|
+
private handleContactMethodList;
|
|
28
|
+
private handleSingleContactMethod;
|
|
29
|
+
private submit;
|
|
30
|
+
private removeForm;
|
|
31
|
+
private printMessage;
|
|
32
|
+
private loadContactMethods;
|
|
33
|
+
private updateForm;
|
|
34
|
+
}
|
|
@@ -1,26 +1,26 @@
|
|
|
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
|
-
private container;
|
|
11
|
-
constructor(endpoint: string, clientId: string, container: Container);
|
|
12
|
-
firstHit(): Promise<void>;
|
|
13
|
-
handleUpdate(action: string): Promise<any>;
|
|
14
|
-
handleInput(action: string): Promise<void>;
|
|
15
|
-
handleCategories(): Promise<void>;
|
|
16
|
-
handlePhrase(phrase: string): Promise<void>;
|
|
17
|
-
private postAndHandleTheData;
|
|
18
|
-
private postAndHandleTheUpdateData;
|
|
19
|
-
private getHttpOptions;
|
|
20
|
-
private constructInputEnvelope;
|
|
21
|
-
private constructCategoriesEnvelope;
|
|
22
|
-
private constructPhraseEnvelope;
|
|
23
|
-
private constructFirstHitEnvelope;
|
|
24
|
-
private handleResponseData;
|
|
25
|
-
private handleUpdateResponseData;
|
|
26
|
-
}
|
|
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
|
+
private container;
|
|
11
|
+
constructor(endpoint: string, clientId: string, container: Container);
|
|
12
|
+
firstHit(): Promise<void>;
|
|
13
|
+
handleUpdate(action: string): Promise<any>;
|
|
14
|
+
handleInput(action: string): Promise<void>;
|
|
15
|
+
handleCategories(): Promise<void>;
|
|
16
|
+
handlePhrase(phrase: string): Promise<void>;
|
|
17
|
+
private postAndHandleTheData;
|
|
18
|
+
private postAndHandleTheUpdateData;
|
|
19
|
+
private getHttpOptions;
|
|
20
|
+
private constructInputEnvelope;
|
|
21
|
+
private constructCategoriesEnvelope;
|
|
22
|
+
private constructPhraseEnvelope;
|
|
23
|
+
private constructFirstHitEnvelope;
|
|
24
|
+
private handleResponseData;
|
|
25
|
+
private handleUpdateResponseData;
|
|
26
|
+
}
|
|
@@ -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.js","sources":["../src/contract/custom-component/entry-context.tsx","../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 { createContext } from 'react';\
|
|
1
|
+
{"version":3,"file":"contact-method.js","sources":["../src/contract/custom-component/entry-context.tsx","../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 { createContext } from 'react';\n\nexport type IEntryContext = {\n entryId: string | null;\n};\n\nexport const EntryContext = createContext<IEntryContext>({\n entryId: null,\n});\n","import { ContactMethod as GenericContactMethod } from '@telia-ace/knowledge-widget-adapters';\nimport { useDispatch } from '@telia-ace/knowledge-widget-ui';\nimport React, { useContext } from 'react';\nimport { EntryContext } from './entry-context';\n\ninterface PropsType {\n contactMethod: any;\n type: any;\n expanded?: boolean;\n className?: any;\n}\n\nconst ContactMethodItem: React.FC<PropsType> = ({ contactMethod, className }) => {\n const dispatch = useDispatch();\n const { entryId } = useContext(EntryContext);\n\n return (\n <GenericContactMethod\n className={className}\n onClick={(event: React.MouseEvent) => {\n if (contactMethod.inline) {\n // preventing default to use a custom expand action\n event.preventDefault();\n dispatch('expand', {\n entryId,\n contactMethodId: contactMethod.id,\n });\n } else {\n dispatch(\n 'action',\n `${contactMethod.id}/contact-methods/${contactMethod.title}`\n );\n }\n }}\n dispatch={dispatch}\n {...contactMethod}\n inline={true}\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 expanded={!!contactMethod.executeImmediately || undefined}\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 &:last-child {\n border-bottom: none;\n }\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';\nimport { EntryContext } from './entry-context';\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 if (!methodList.length) {\n return <StyledContactMethodItem type={type} contactMethod={methodList} />;\n }\n\n return (\n <EntryContext.Provider value={props.entry}>\n <ContactMethodList type={type} contactMethodList={methodList} />\n </EntryContext.Provider>\n );\n};\n\nconst StyledContactMethodItem = styled(ContactMethodItem)`\n padding: ${(p) => p.theme.sizes?.medium};\n`;\n\nexport default ContactMethod;\n"],"names":["GenericContactMethod"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAMO,MAAM,eAAe,cAA6B;AAAA,EACrD,SAAS;AACb,CAAC;ACID,MAAM,oBAAyC,CAAC,EAAE,eAAe,gBAAgB;AAC7E,QAAM,WAAW;AACX,QAAA,EAAE,YAAY,WAAW,YAAY;AAE3C,SACK,sBAAA,cAAAA,iBAAA;AAAA,IACG;AAAA,IACA,SAAS,CAAC,UAA4B;AAClC,UAAI,cAAc,QAAQ;AAEtB,cAAM,eAAe;AACrB,iBAAS,UAAU;AAAA,UACf;AAAA,UACA,iBAAiB,cAAc;AAAA,QAAA,CAClC;AAAA,MAAA,OACE;AACH,iBACI,UACA,GAAG,cAAc,sBAAsB,cAAc,OACzD;AAAA,MACJ;AAAA,IACJ;AAAA,IACA;AAAA,KACI,gBAlBP;AAAA,IAmBG,QAAQ;AAAA,EAAA,EACZ;AAER;AC9BA,MAAM,oBAAyC,CAAC,UAAqB;AACjE,6CACK,UACI,MAAA,MAAM,kBAAkB,IAAI,CAAC,kBACzB,sBAAA,cAAA,qBAAA;AAAA,IACG,KAAK,cAAc;AAAA,IACnB,MAAM,MAAM;AAAA,IACZ;AAAA,IACA,UAAU,CAAC,CAAC,cAAc,sBAAsB;AAAA,EACpD,CAAA,CACH,CACL;AAER;AAEA,MAAM,sBAAsB,OAAO,iBAAiB;AAAA;AAAA,eAErC,CAAC,MAAM;;AAAA,iBAAE,MAAM,UAAR,mBAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACpB/B,MAAA,gBAA0B,CAAC,UAAe;;AACxC,MAAA;AACA,MAAA;AAEJ,MAAI,MAAM,kBAAkB,aAAM,eAAe,mBAArB,mBAAqC,UAAS,GAAG;AACzE,WAAO,SAAS;AAChB,iBAAa,MAAM,eAAe;AAAA,EAAA,WAC3B,MAAM,eAAe,cAAc,aAAM,eAAe,eAArB,mBAAiC,UAAS,GAAG;AACvF,WAAO,SAAS;AACH,iBAAA,MAAM,eAAe,WAAW,OAAO,CAAC,MAAW,EAAE,UAAU,CAAC;AAAA,EAAA,OAC1E;AACH,WAAO,SAAS;AAChB,iBAAa,MAAM;AAAA,EACvB;AAEI,MAAA,CAAC,WAAW,QAAQ;AACpB,WAAQ,sBAAA,cAAA,yBAAA;AAAA,MAAwB;AAAA,MAAY,eAAe;AAAA,IAAA,CAAY;AAAA,EAC3E;AAGI,SAAA,sBAAA,cAAC,aAAa,UAAb;AAAA,IAAsB,OAAO,MAAM;AAAA,EAAA,GAC/B,sBAAA,cAAA,mBAAA;AAAA,IAAkB;AAAA,IAAY,mBAAmB;AAAA,EAAY,CAAA,CAClE;AAER;AAEA,MAAM,0BAA0B,OAAO,iBAAiB;AAAA,eACzC,CAAC,MAAM;;AAAA,iBAAE,MAAM,UAAR,mBAAe;AAAA;AAAA;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface PropsType {
|
|
3
|
-
contactMethod: any;
|
|
4
|
-
type: any;
|
|
5
|
-
expanded?: boolean;
|
|
6
|
-
className?: any;
|
|
7
|
-
}
|
|
8
|
-
declare const ContactMethodItem: React.FC<PropsType>;
|
|
9
|
-
export default ContactMethodItem;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface PropsType {
|
|
3
|
+
contactMethod: any;
|
|
4
|
+
type: any;
|
|
5
|
+
expanded?: boolean;
|
|
6
|
+
className?: any;
|
|
7
|
+
}
|
|
8
|
+
declare const ContactMethodItem: React.FC<PropsType>;
|
|
9
|
+
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,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare type IEntryContext = {
|
|
3
|
-
entryId: string | null;
|
|
4
|
-
};
|
|
5
|
-
export declare const EntryContext: import("react").Context<IEntryContext>;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare type IEntryContext = {
|
|
3
|
+
entryId: string | null;
|
|
4
|
+
};
|
|
5
|
+
export declare const EntryContext: import("react").Context<IEntryContext>;
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { useDispatch, Icon, List, invertedHoverButton } from "@telia-ace/knowledge-widget-ui";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import styled, { css } from "styled-components";
|
|
4
|
+
const FeedbackList = ({ actions }) => {
|
|
5
|
+
const dispatch = useDispatch();
|
|
6
|
+
return /* @__PURE__ */ React.createElement(StyledButtonList, {
|
|
7
|
+
items: Object.keys(actions).map((i) => {
|
|
8
|
+
return {
|
|
9
|
+
label: actions[i],
|
|
10
|
+
actionKey: i
|
|
11
|
+
};
|
|
12
|
+
}),
|
|
13
|
+
renderItem: (item) => {
|
|
14
|
+
return /* @__PURE__ */ React.createElement(FeedbackItem, {
|
|
15
|
+
key: item.actionKey
|
|
16
|
+
}, /* @__PURE__ */ React.createElement(FeedbackButton, {
|
|
17
|
+
className: "humany-feedback-button",
|
|
18
|
+
disabled: false,
|
|
19
|
+
"aria-pressed": true,
|
|
20
|
+
"data-selected": true,
|
|
21
|
+
"data-direction": "vertical",
|
|
22
|
+
onClick: () => {
|
|
23
|
+
dispatch("action", item.actionKey);
|
|
24
|
+
}
|
|
25
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
26
|
+
faIcon: item.actionKey == "yes" ? "smile-o" : "frown-o"
|
|
27
|
+
}), /* @__PURE__ */ React.createElement("span", null, item.label)));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
const StyledButtonList = styled(List)`
|
|
32
|
+
padding: 0;
|
|
33
|
+
list-style: none;
|
|
34
|
+
> li {
|
|
35
|
+
margin: ${(p) => {
|
|
36
|
+
var _a;
|
|
37
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.small;
|
|
38
|
+
}} ${(p) => {
|
|
39
|
+
var _a;
|
|
40
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
41
|
+
}};
|
|
42
|
+
margin-left: 0;
|
|
43
|
+
display: inline-block;
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
const FeedbackItem = styled.li`
|
|
47
|
+
@media (min-width: 768px) {
|
|
48
|
+
display: list-item !important;
|
|
49
|
+
margin-right: 0 !important;
|
|
50
|
+
margin-top: ${(p) => {
|
|
51
|
+
var _a;
|
|
52
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
53
|
+
}} !important;
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
const FeedbackButton = styled.button`
|
|
57
|
+
@media (min-width: 768px) {
|
|
58
|
+
min-width: 100%;
|
|
59
|
+
margin-right: 0;
|
|
60
|
+
}
|
|
61
|
+
display: inline-block;
|
|
62
|
+
font-size: ${(p) => {
|
|
63
|
+
var _a;
|
|
64
|
+
return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
|
|
65
|
+
}};
|
|
66
|
+
border-color: ${(p) => {
|
|
67
|
+
var _a;
|
|
68
|
+
return (_a = p.theme.colors) == null ? void 0 : _a.primary;
|
|
69
|
+
}} !important;
|
|
70
|
+
font-weight: 300;
|
|
71
|
+
&& {
|
|
72
|
+
margin-right: ${(p) => {
|
|
73
|
+
var _a;
|
|
74
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.small;
|
|
75
|
+
}};
|
|
76
|
+
}
|
|
77
|
+
${(p) => {
|
|
78
|
+
var _a, _b;
|
|
79
|
+
return p["data-direction"] === "horizontal" && css`
|
|
80
|
+
width: 225px;
|
|
81
|
+
max-width: calc(50% - ${(_a = p.theme.sizes) == null ? void 0 : _a.large} - ${(_b = p.theme.sizes) == null ? void 0 : _b.small});
|
|
82
|
+
`;
|
|
83
|
+
}}
|
|
84
|
+
${(p) => p["data-direction"] === "vertical" && css`
|
|
85
|
+
min-width: 150px;
|
|
86
|
+
`}
|
|
87
|
+
${(p) => {
|
|
88
|
+
var _a;
|
|
89
|
+
return invertedHoverButton({
|
|
90
|
+
primaryColor: `${(_a = p.theme.colors) == null ? void 0 : _a.primary}`,
|
|
91
|
+
secondaryColor: "#FFFFFF"
|
|
92
|
+
});
|
|
93
|
+
}}
|
|
94
|
+
i {
|
|
95
|
+
margin: 0 ${(p) => {
|
|
96
|
+
var _a;
|
|
97
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.small;
|
|
98
|
+
}} 0 0;
|
|
99
|
+
}
|
|
100
|
+
span {
|
|
101
|
+
}
|
|
102
|
+
`;
|
|
103
|
+
export { FeedbackList as default };
|
|
104
|
+
//# sourceMappingURL=feedback-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedback-list.js","sources":["../src/ui/feedback-list.tsx"],"sourcesContent":["import { Icon, invertedHoverButton, List, useDispatch } from '@telia-ace/knowledge-widget-ui';\nimport React from 'react';\nimport styled, { css } from 'styled-components';\n\ntype Props = {\n actions: { [key: string]: string };\n};\nconst FeedbackList: React.FC<Props> = ({ actions }) => {\n const dispatch = useDispatch();\n return (\n <StyledButtonList\n items={Object.keys(actions).map((i: any) => {\n return {\n label: actions[i],\n actionKey: i,\n };\n })}\n renderItem={(item: any) => {\n return (\n <FeedbackItem key={item.actionKey}>\n <FeedbackButton\n className=\"humany-feedback-button\"\n disabled={false}\n aria-pressed={true}\n data-selected={true}\n data-direction={'vertical'}\n onClick={() => {\n dispatch('action', item.actionKey);\n }}\n >\n <Icon faIcon={item.actionKey == 'yes' ? 'smile-o' : 'frown-o'} />\n <span>{item.label}</span>\n </FeedbackButton>\n </FeedbackItem>\n );\n }}\n />\n );\n};\n\nexport default FeedbackList;\n\nconst StyledButtonList = styled(List as any)`\n padding: 0;\n list-style: none;\n > li {\n margin: ${(p) => p.theme.sizes?.small} ${(p) => p.theme.sizes?.normal};\n margin-left: 0;\n display: inline-block;\n }\n`;\n\nconst FeedbackItem = styled.li`\n @media (min-width: 768px) {\n display: list-item !important;\n margin-right: 0 !important;\n margin-top: ${(p) => p.theme.sizes?.normal} !important;\n }\n`;\n\nconst FeedbackButton = styled.button<{\n 'data-selected': boolean;\n 'data-direction': 'horizontal' | 'vertical';\n}>`\n @media (min-width: 768px) {\n min-width: 100%;\n margin-right: 0;\n }\n display: inline-block;\n font-size: ${(p) => p.theme.fonts?.normal};\n border-color: ${(p) => p.theme.colors?.primary} !important;\n font-weight: 300;\n && {\n margin-right: ${(p) => p.theme.sizes?.small};\n }\n ${(p) =>\n p['data-direction'] === 'horizontal' &&\n css`\n width: 225px;\n max-width: calc(50% - ${p.theme.sizes?.large} - ${p.theme.sizes?.small});\n `}\n ${(p) =>\n p['data-direction'] === 'vertical' &&\n css`\n min-width: 150px;\n `}\n ${(p) =>\n invertedHoverButton({\n primaryColor: `${p.theme.colors?.primary}`,\n secondaryColor: '#FFFFFF',\n })}\n i {\n margin: 0 ${(p) => p.theme.sizes?.small} 0 0;\n }\n span {\n }\n`;\n"],"names":[],"mappings":";;;AAOM,MAAA,eAAgC,CAAC,EAAE,cAAc;AACnD,QAAM,WAAW;AACjB,SACK,sBAAA,cAAA,kBAAA;AAAA,IACG,OAAO,OAAO,KAAK,OAAO,EAAE,IAAI,CAAC,MAAW;AACjC,aAAA;AAAA,QACH,OAAO,QAAQ;AAAA,QACf,WAAW;AAAA,MAAA;AAAA,IACf,CACH;AAAA,IACD,YAAY,CAAC,SAAc;AACvB,aACK,sBAAA,cAAA,cAAA;AAAA,QAAa,KAAK,KAAK;AAAA,MAAA,GACnB,sBAAA,cAAA,gBAAA;AAAA,QACG,WAAU;AAAA,QACV,UAAU;AAAA,QACV,gBAAc;AAAA,QACd,iBAAe;AAAA,QACf,kBAAgB;AAAA,QAChB,SAAS,MAAM;AACF,mBAAA,UAAU,KAAK,SAAS;AAAA,QACrC;AAAA,MAAA,GAEC,sBAAA,cAAA,MAAA;AAAA,QAAK,QAAQ,KAAK,aAAa,QAAQ,YAAY;AAAA,MAAA,CAAW,GAC9D,sBAAA,cAAA,QAAA,MAAM,KAAK,KAAM,CACtB,CACJ;AAAA,IAER;AAAA,EAAA,CACJ;AAER;AAIA,MAAM,mBAAmB,OAAO,IAAW;AAAA;AAAA;AAAA;AAAA,kBAIzB,CAAC,MAAM;;AAAA,iBAAE,MAAM,UAAR,mBAAe;AAAA,KAAS,CAAC,MAAA;;AAAM,iBAAE,MAAM,UAAR,mBAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAMvE,MAAM,eAAe,OAAO;AAAA;AAAA;AAAA;AAAA,sBAIN,CAAC,MAAM;;AAAA,iBAAE,MAAM,UAAR,mBAAe;AAAA;AAAA;AAAA;AAI5C,MAAM,iBAAiB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBASb,CAAC,MAAM;;AAAA,iBAAE,MAAM,UAAR,mBAAe;AAAA;AAAA,oBACnB,CAAC,MAAM;;AAAA,iBAAE,MAAM,WAAR,mBAAgB;AAAA;AAAA;AAAA;AAAA,wBAGnB,CAAC,MAAM;;AAAA,iBAAE,MAAM,UAAR,mBAAe;AAAA;AAAA;AAAA,MAExC,CAAC,MAAA;;AACC,WAAE,sBAAsB,gBACxB;AAAA;AAAA,oCAE4B,QAAE,MAAM,UAAR,mBAAe,WAAW,QAAE,MAAM,UAAR,mBAAe;AAAA;AAAA;AAAA,MAEvE,CAAC,MACC,EAAE,sBAAsB,cACxB;AAAA;AAAA;AAAA,IAGJ,CAAC;;AACG,6BAAoB;AAAA,IAChB,cAAc,GAAG,QAAE,MAAM,WAAR,mBAAgB;AAAA,IACjC,gBAAgB;AAAA,EACpB,CAAC;AAAA;AAAA;AAAA,oBAEW,CAAC,MAAM;;AAAA,iBAAE,MAAM,UAAR,mBAAe;AAAA;AAAA;AAAA;AAAA;AAAA;;"}
|