@telia-ace/knowledge-widget-bot-provider 0.0.1-alpha.5 → 0.0.1-alpha.50
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/{lib-esm → dist}/client/chat.client.d.ts +1 -3
- package/{lib-esm → dist}/client/contact-method.client.d.ts +15 -2
- package/dist/client/http.client.d.ts +26 -0
- package/{lib → dist}/client/middleware.client.d.ts +4 -3
- package/dist/contact-method.js +112 -0
- package/dist/contact-method.js.map +1 -0
- package/{lib → dist}/contract/custom-component/contact-method-item.d.ts +3 -0
- package/{lib-esm → dist}/contract/custom-component/contact-method-list.d.ts +1 -0
- package/{lib-esm → dist}/contract/custom-component/contact-method.d.ts +0 -0
- package/dist/contract/custom-component/entry-context.d.ts +5 -0
- package/{lib → dist}/contract/enum/server-entry-type.enum.d.ts +3 -2
- package/{lib-esm → dist}/contract/model/conversation-api-model/list.model.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/conversation-api-model/message.model.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/http/action.model.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/http/client-action.model.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/http/client-envelope.model.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/http/connect-options.model.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/http/global-state.model.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/http/http-client-options.model.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/http/server-entry.model.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/http/server-envelope.model.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/middleware/aggregator-state.model.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/shared/loose-object.model.d.ts +0 -0
- package/dist/feedback-list.js +107 -0
- package/dist/feedback-list.js.map +1 -0
- package/{lib-esm → dist}/helper/chat.helper.d.ts +0 -0
- package/{lib-esm → dist}/helper/http.helper.d.ts +1 -1
- package/{lib-esm → dist}/helper/middleware.helper.d.ts +1 -1
- package/{lib → dist}/helper/store.helper.d.ts +4 -3
- package/{lib-esm → dist}/index.d.ts +0 -0
- package/dist/index.js +1174 -0
- package/dist/index.js.map +1 -0
- package/dist/interface/entry.interface.d.ts +23 -0
- package/{lib-esm → dist}/interface/middleware/paging.interface.d.ts +0 -0
- package/{lib-esm → dist}/interface/middleware/processor.interface.d.ts +0 -0
- package/dist/no-good-alternative.js +33 -0
- package/dist/no-good-alternative.js.map +1 -0
- package/dist/plugin.d.ts +3 -0
- 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 -0
- package/package.json +44 -45
- package/lib/client/chat.client.d.ts +0 -15
- package/lib/client/chat.client.js +0 -80
- package/lib/client/contact-method.client.d.ts +0 -22
- package/lib/client/contact-method.client.js +0 -276
- package/lib/client/http.client.d.ts +0 -22
- package/lib/client/http.client.js +0 -114
- package/lib/client/middleware.client.js +0 -60
- package/lib/contract/custom-component/contact-method-item.js +0 -76
- package/lib/contract/custom-component/contact-method-list.d.ts +0 -7
- package/lib/contract/custom-component/contact-method-list.js +0 -41
- package/lib/contract/custom-component/contact-method.d.ts +0 -3
- package/lib/contract/custom-component/contact-method.js +0 -38
- package/lib/contract/enum/server-entry-type.enum.js +0 -10
- package/lib/contract/model/conversation-api-model/list.model.d.ts +0 -5
- package/lib/contract/model/conversation-api-model/list.model.js +0 -2
- package/lib/contract/model/conversation-api-model/message.model.d.ts +0 -7
- package/lib/contract/model/conversation-api-model/message.model.js +0 -2
- package/lib/contract/model/http/action.model.d.ts +0 -3
- package/lib/contract/model/http/action.model.js +0 -2
- package/lib/contract/model/http/client-action.model.d.ts +0 -4
- package/lib/contract/model/http/client-action.model.js +0 -3
- package/lib/contract/model/http/client-envelope.model.d.ts +0 -9
- package/lib/contract/model/http/client-envelope.model.js +0 -2
- package/lib/contract/model/http/connect-options.model.d.ts +0 -5
- package/lib/contract/model/http/connect-options.model.js +0 -2
- package/lib/contract/model/http/global-state.model.d.ts +0 -8
- package/lib/contract/model/http/global-state.model.js +0 -2
- package/lib/contract/model/http/http-client-options.model.d.ts +0 -5
- package/lib/contract/model/http/http-client-options.model.js +0 -2
- package/lib/contract/model/http/server-entry.model.d.ts +0 -11
- package/lib/contract/model/http/server-entry.model.js +0 -2
- package/lib/contract/model/http/server-envelope.model.d.ts +0 -10
- package/lib/contract/model/http/server-envelope.model.js +0 -2
- package/lib/contract/model/middleware/aggregator-state.model.d.ts +0 -4
- package/lib/contract/model/middleware/aggregator-state.model.js +0 -3
- package/lib/contract/model/shared/loose-object.model.d.ts +0 -3
- package/lib/contract/model/shared/loose-object.model.js +0 -2
- package/lib/helper/chat.helper.d.ts +0 -8
- package/lib/helper/chat.helper.js +0 -21
- package/lib/helper/http.helper.d.ts +0 -13
- package/lib/helper/http.helper.js +0 -33
- package/lib/helper/middleware.helper.d.ts +0 -12
- package/lib/helper/middleware.helper.js +0 -72
- package/lib/helper/store.helper.js +0 -80
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -8
- package/lib/interface/entry.interface.d.ts +0 -17
- package/lib/interface/entry.interface.js +0 -138
- package/lib/interface/middleware/contact-expanded.interface.d.ts +0 -0
- package/lib/interface/middleware/contact-expanded.interface.js +0 -50
- package/lib/interface/middleware/legacy-contact-methods.interface.d.ts +0 -0
- package/lib/interface/middleware/legacy-contact-methods.interface.js +0 -394
- package/lib/interface/middleware/paging.interface.d.ts +0 -4
- package/lib/interface/middleware/paging.interface.js +0 -55
- package/lib/interface/middleware/processor.interface.d.ts +0 -10
- package/lib/interface/middleware/processor.interface.js +0 -120
- package/lib/plugin.d.ts +0 -3
- package/lib/plugin.js +0 -172
- package/lib-esm/client/chat.client.js +0 -75
- package/lib-esm/client/contact-method.client.js +0 -270
- package/lib-esm/client/http.client.d.ts +0 -22
- package/lib-esm/client/http.client.js +0 -108
- package/lib-esm/client/middleware.client.d.ts +0 -13
- package/lib-esm/client/middleware.client.js +0 -55
- package/lib-esm/contract/custom-component/contact-method-item.d.ts +0 -8
- package/lib-esm/contract/custom-component/contact-method-item.js +0 -51
- package/lib-esm/contract/custom-component/contact-method-list.js +0 -13
- package/lib-esm/contract/custom-component/contact-method.js +0 -33
- package/lib-esm/contract/enum/server-entry-type.enum.d.ts +0 -6
- package/lib-esm/contract/enum/server-entry-type.enum.js +0 -7
- package/lib-esm/contract/model/conversation-api-model/list.model.js +0 -1
- package/lib-esm/contract/model/conversation-api-model/message.model.js +0 -1
- package/lib-esm/contract/model/http/action.model.js +0 -1
- package/lib-esm/contract/model/http/client-action.model.js +0 -2
- package/lib-esm/contract/model/http/client-envelope.model.js +0 -1
- package/lib-esm/contract/model/http/connect-options.model.js +0 -1
- package/lib-esm/contract/model/http/global-state.model.js +0 -1
- package/lib-esm/contract/model/http/http-client-options.model.js +0 -1
- package/lib-esm/contract/model/http/server-entry.model.js +0 -1
- package/lib-esm/contract/model/http/server-envelope.model.js +0 -1
- package/lib-esm/contract/model/middleware/aggregator-state.model.js +0 -2
- package/lib-esm/contract/model/shared/loose-object.model.js +0 -1
- package/lib-esm/helper/chat.helper.js +0 -18
- package/lib-esm/helper/http.helper.js +0 -30
- package/lib-esm/helper/middleware.helper.js +0 -69
- package/lib-esm/helper/store.helper.d.ts +0 -22
- package/lib-esm/helper/store.helper.js +0 -77
- package/lib-esm/index.js +0 -2
- package/lib-esm/interface/entry.interface.d.ts +0 -17
- package/lib-esm/interface/entry.interface.js +0 -136
- package/lib-esm/interface/middleware/paging.interface.js +0 -53
- package/lib-esm/interface/middleware/processor.interface.js +0 -118
- package/lib-esm/plugin.d.ts +0 -3
- package/lib-esm/plugin.js +0 -144
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { Message } from '../contract/model/conversation-api-model/message.model';
|
|
2
|
-
import EntryInterface from '../interface/entry.interface';
|
|
3
2
|
export default class ChatClient {
|
|
4
|
-
entryInterface: EntryInterface;
|
|
5
3
|
constructor();
|
|
6
4
|
static initialize(user: any, agent: any): void;
|
|
7
|
-
processMessageArrayAndStoreIt(messages: Message[]): void
|
|
5
|
+
processMessageArrayAndStoreIt(messages: Message[]): Promise<void>;
|
|
8
6
|
updateMessageArrayAndStoreIt(messages: Message[]): void;
|
|
9
7
|
printUserMessageAndStoreIt(action: string): void;
|
|
10
8
|
private postUserMessage;
|
|
@@ -1,22 +1,35 @@
|
|
|
1
1
|
import { ContactMethodPlatform } from '@telia-ace/knowledge-widget-adapters';
|
|
2
2
|
import { DataClient } from '@telia-ace/knowledge-widget-types-grid';
|
|
3
|
+
import { Container } from '@webprovisions/platform';
|
|
3
4
|
export declare class ContactMethodClient {
|
|
4
5
|
private static dataClient;
|
|
5
6
|
private static contactMethodPlatform;
|
|
6
7
|
private static contactMessageEntryArray;
|
|
7
8
|
private static agent;
|
|
8
9
|
private chatClient;
|
|
9
|
-
static
|
|
10
|
+
private static container;
|
|
11
|
+
constructor(container: Container);
|
|
12
|
+
static initialize(container: any, dataClient: DataClient, contactMethodPlatform: ContactMethodPlatform, agent: any): void;
|
|
10
13
|
handleNewForm: (errors: any, entry: any) => Promise<void>;
|
|
11
14
|
handleContactMethod: (input?: string) => Promise<void>;
|
|
12
15
|
validate(form: any): void;
|
|
13
16
|
private handleContactCategoryList;
|
|
14
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 getNewContactMethods;
|
|
15
28
|
private handleContactMethodList;
|
|
16
29
|
private handleSingleContactMethod;
|
|
17
30
|
private submit;
|
|
18
31
|
private removeForm;
|
|
19
32
|
private printMessage;
|
|
20
|
-
|
|
33
|
+
loadContactMethods(dataType: string, id?: string | undefined, guideId?: string | undefined): Promise<any>;
|
|
21
34
|
private updateForm;
|
|
22
35
|
}
|
|
@@ -0,0 +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,13 +1,14 @@
|
|
|
1
|
+
import { Container } from '@webprovisions/platform';
|
|
1
2
|
import { ServerEntry } from '../contract/model/http/server-entry.model';
|
|
2
3
|
export default class MiddlewareClient {
|
|
3
4
|
private paging;
|
|
4
5
|
private processor;
|
|
5
6
|
private entryInterface;
|
|
6
7
|
private chatClient;
|
|
7
|
-
constructor();
|
|
8
|
+
constructor(container: Container);
|
|
8
9
|
static initialize(container: any, widget: any): void;
|
|
9
|
-
handleEntries(entries: ServerEntry[], action?: string): void
|
|
10
|
-
handleUpdate(
|
|
10
|
+
handleEntries(entries: ServerEntry[], action?: string): Promise<void>;
|
|
11
|
+
handleUpdate(entries: ServerEntry[], action?: string): Promise<void>;
|
|
11
12
|
checkForUpdate(input: string): boolean;
|
|
12
13
|
private executeMiddlewares;
|
|
13
14
|
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { DataType } from "@telia-ace/knowledge-widget-types-grid";
|
|
21
|
+
import React, { createContext, useContext, Fragment } from "react";
|
|
22
|
+
import styled from "styled-components";
|
|
23
|
+
import { ContactMethod as ContactMethod$1 } from "@telia-ace/knowledge-widget-adapters";
|
|
24
|
+
import { useDispatch } from "@telia-ace/knowledge-widget-ui";
|
|
25
|
+
const EntryContext = createContext({
|
|
26
|
+
entryId: null
|
|
27
|
+
});
|
|
28
|
+
const ContactMethodItem = ({ contactMethod, className, entry, embeded }) => {
|
|
29
|
+
console.log(embeded, !embeded && contactMethod.inline);
|
|
30
|
+
const dispatch = useDispatch();
|
|
31
|
+
let entryId;
|
|
32
|
+
if (!!entry) {
|
|
33
|
+
entryId = entry.entryId;
|
|
34
|
+
} else {
|
|
35
|
+
entryId = useContext(EntryContext).entryId;
|
|
36
|
+
}
|
|
37
|
+
return /* @__PURE__ */ React.createElement(ContactMethod$1, __spreadProps(__spreadValues({
|
|
38
|
+
className,
|
|
39
|
+
onClick: (event) => {
|
|
40
|
+
if (embeded || contactMethod.inline) {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
dispatch("expand", {
|
|
43
|
+
entryId,
|
|
44
|
+
contactMethodId: contactMethod.id
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
dispatch("action", `${contactMethod.id}/contact-methods/${contactMethod.title}`);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
dispatch
|
|
51
|
+
}, contactMethod), {
|
|
52
|
+
inline: true
|
|
53
|
+
}));
|
|
54
|
+
};
|
|
55
|
+
const ContactMethodList = (props) => {
|
|
56
|
+
return /* @__PURE__ */ React.createElement(Fragment, null, props.contactMethodList.map((contactMethod) => /* @__PURE__ */ React.createElement(StyledContactMethod, {
|
|
57
|
+
embeded: props.embeded,
|
|
58
|
+
key: contactMethod.id,
|
|
59
|
+
type: props.type,
|
|
60
|
+
contactMethod,
|
|
61
|
+
expanded: !!contactMethod.executeImmediately || void 0
|
|
62
|
+
})));
|
|
63
|
+
};
|
|
64
|
+
const StyledContactMethod = styled(ContactMethodItem)`
|
|
65
|
+
border-bottom: 1px solid rgb(239, 239, 239);
|
|
66
|
+
padding: ${(p) => {
|
|
67
|
+
var _a;
|
|
68
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
|
|
69
|
+
}};
|
|
70
|
+
|
|
71
|
+
&:last-child {
|
|
72
|
+
border-bottom: none;
|
|
73
|
+
}
|
|
74
|
+
`;
|
|
75
|
+
const ContactMethod = (props) => {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
let type;
|
|
78
|
+
let methodList;
|
|
79
|
+
if (props.contactMethods && ((_a = props.contactMethods.contactMethods) == null ? void 0 : _a.length) > 0) {
|
|
80
|
+
type = DataType.ContactMethods;
|
|
81
|
+
methodList = props.contactMethods.contactMethods;
|
|
82
|
+
} else if (props.contactMethods.categories && ((_b = props.contactMethods.categories) == null ? void 0 : _b.length) > 0) {
|
|
83
|
+
type = DataType.ContactMethodCategories;
|
|
84
|
+
methodList = props.contactMethods.categories.filter((o) => o.matches > 0);
|
|
85
|
+
} else {
|
|
86
|
+
type = DataType.ContactMethod;
|
|
87
|
+
methodList = props.contactMethods;
|
|
88
|
+
}
|
|
89
|
+
if (!methodList.length) {
|
|
90
|
+
return /* @__PURE__ */ React.createElement(StyledContactMethodItem, {
|
|
91
|
+
embeded: !!props.guideId,
|
|
92
|
+
type,
|
|
93
|
+
contactMethod: methodList,
|
|
94
|
+
entry: props.entry
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return /* @__PURE__ */ React.createElement(EntryContext.Provider, {
|
|
98
|
+
value: props.entry
|
|
99
|
+
}, /* @__PURE__ */ React.createElement(ContactMethodList, {
|
|
100
|
+
embeded: !!props.guideId,
|
|
101
|
+
type,
|
|
102
|
+
contactMethodList: methodList
|
|
103
|
+
}));
|
|
104
|
+
};
|
|
105
|
+
const StyledContactMethodItem = styled(ContactMethodItem)`
|
|
106
|
+
padding: ${(p) => {
|
|
107
|
+
var _a;
|
|
108
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
|
|
109
|
+
}};
|
|
110
|
+
`;
|
|
111
|
+
export { ContactMethod as default };
|
|
112
|
+
//# sourceMappingURL=contact-method.js.map
|
|
@@ -0,0 +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';\r\n\r\nexport type IEntryContext = {\r\n entryId: string | null;\r\n};\r\n\r\nexport const EntryContext = createContext<IEntryContext>({\r\n entryId: null,\r\n});\r\n","import { ContactMethod as GenericContactMethod } from '@telia-ace/knowledge-widget-adapters';\r\nimport { useDispatch } from '@telia-ace/knowledge-widget-ui';\r\nimport React, { useContext } from 'react';\r\nimport { EntryContext } from './entry-context';\r\n\r\ninterface PropsType {\r\n contactMethod: any;\r\n type: any;\r\n expanded?: boolean;\r\n className?: any;\r\n entry?: any;\r\n embeded: boolean;\r\n}\r\n\r\nconst ContactMethodItem: React.FC<PropsType> = ({ contactMethod, className, entry, embeded }) => {\r\n console.log(embeded, !embeded && contactMethod.inline);\r\n const dispatch = useDispatch();\r\n let entryId: string | null;\r\n if (!!entry) {\r\n entryId = entry.entryId;\r\n } else {\r\n entryId = useContext(EntryContext).entryId;\r\n }\r\n\r\n return (\r\n <GenericContactMethod\r\n className={className}\r\n onClick={(event: React.MouseEvent) => {\r\n if (embeded || contactMethod.inline) {\r\n // preventing default to use a custom expand action\r\n event.preventDefault();\r\n dispatch('expand', {\r\n entryId,\r\n contactMethodId: contactMethod.id,\r\n });\r\n } else {\r\n dispatch(\r\n 'action',\r\n `${contactMethod.id}/contact-methods/${contactMethod.title}`\r\n );\r\n }\r\n }}\r\n dispatch={dispatch}\r\n {...contactMethod}\r\n inline={true}\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 embeded: boolean;\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 embeded={props.embeded}\r\n key={contactMethod.id}\r\n type={props.type}\r\n contactMethod={contactMethod}\r\n expanded={!!contactMethod.executeImmediately || undefined}\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 &:last-child {\r\n border-bottom: none;\r\n }\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\nimport { EntryContext } from './entry-context';\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 if (!methodList.length) {\r\n return (\r\n <StyledContactMethodItem\r\n embeded={!!props.guideId}\r\n type={type}\r\n contactMethod={methodList}\r\n entry={props.entry}\r\n />\r\n );\r\n }\r\n\r\n return (\r\n <EntryContext.Provider value={props.entry}>\r\n <ContactMethodList\r\n embeded={!!props.guideId}\r\n type={type}\r\n contactMethodList={methodList}\r\n />\r\n </EntryContext.Provider>\r\n );\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":";;;;;;;;;;;;;;;;;;;;;;;;AAMO,MAAM,eAAe,cAA6B;AAAA,EACrD,SAAS;AACb,CAAC;ACMD,MAAM,oBAAyC,CAAC,EAAE,eAAe,WAAW,OAAO,cAAc;AAC7F,UAAQ,IAAI,SAAS,CAAC,WAAW,cAAc,MAAM;AACrD,QAAM,WAAW;AACb,MAAA;AACA,MAAA,CAAC,CAAC,OAAO;AACT,cAAU,MAAM;AAAA,EAAA,OACb;AACO,cAAA,WAAW,YAAY,EAAE;AAAA,EACvC;AAEA,SACK,sBAAA,cAAAA,iBAAA;AAAA,IACG;AAAA,IACA,SAAS,CAAC,UAA4B;AAC9B,UAAA,WAAW,cAAc,QAAQ;AAEjC,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;ACrCA,MAAM,oBAAyC,CAAC,UAAqB;AACjE,6CACK,UACI,MAAA,MAAM,kBAAkB,IAAI,CAAC,kBACzB,sBAAA,cAAA,qBAAA;AAAA,IACG,SAAS,MAAM;AAAA,IACf,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;ACtB/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,WACK,sBAAA,cAAA,yBAAA;AAAA,MACG,SAAS,CAAC,CAAC,MAAM;AAAA,MACjB;AAAA,MACA,eAAe;AAAA,MACf,OAAO,MAAM;AAAA,IAAA,CACjB;AAAA,EAER;AAGI,SAAA,sBAAA,cAAC,aAAa,UAAb;AAAA,IAAsB,OAAO,MAAM;AAAA,EAAA,GAC/B,sBAAA,cAAA,mBAAA;AAAA,IACG,SAAS,CAAC,CAAC,MAAM;AAAA,IACjB;AAAA,IACA,mBAAmB;AAAA,EACvB,CAAA,CACJ;AAER;AAEA,MAAM,0BAA0B,OAAO,iBAAiB;AAAA,eACzC,CAAC,MAAM;;AAAA,iBAAE,MAAM,UAAR,mBAAe;AAAA;AAAA;;"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,107 @@
|
|
|
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 ${(p) => {
|
|
33
|
+
var _a;
|
|
34
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
|
|
35
|
+
}};
|
|
36
|
+
list-style: none;
|
|
37
|
+
> li {
|
|
38
|
+
margin: ${(p) => {
|
|
39
|
+
var _a;
|
|
40
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.small;
|
|
41
|
+
}} ${(p) => {
|
|
42
|
+
var _a;
|
|
43
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
44
|
+
}};
|
|
45
|
+
margin-left: 0;
|
|
46
|
+
display: inline-block;
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
const FeedbackItem = styled.li`
|
|
50
|
+
@media (min-width: 768px) {
|
|
51
|
+
display: list-item !important;
|
|
52
|
+
margin-right: 0 !important;
|
|
53
|
+
margin-top: ${(p) => {
|
|
54
|
+
var _a;
|
|
55
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
56
|
+
}} !important;
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
const FeedbackButton = styled.button`
|
|
60
|
+
@media (min-width: 768px) {
|
|
61
|
+
min-width: 100%;
|
|
62
|
+
margin-right: 0;
|
|
63
|
+
}
|
|
64
|
+
display: inline-block;
|
|
65
|
+
font-size: ${(p) => {
|
|
66
|
+
var _a;
|
|
67
|
+
return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
|
|
68
|
+
}};
|
|
69
|
+
border-color: ${(p) => {
|
|
70
|
+
var _a;
|
|
71
|
+
return (_a = p.theme.colors) == null ? void 0 : _a.primary;
|
|
72
|
+
}} !important;
|
|
73
|
+
font-weight: 300;
|
|
74
|
+
&& {
|
|
75
|
+
margin-right: ${(p) => {
|
|
76
|
+
var _a;
|
|
77
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.small;
|
|
78
|
+
}};
|
|
79
|
+
}
|
|
80
|
+
${(p) => {
|
|
81
|
+
var _a, _b;
|
|
82
|
+
return p["data-direction"] === "horizontal" && css`
|
|
83
|
+
width: 225px;
|
|
84
|
+
max-width: calc(50% - ${(_a = p.theme.sizes) == null ? void 0 : _a.large} - ${(_b = p.theme.sizes) == null ? void 0 : _b.small});
|
|
85
|
+
`;
|
|
86
|
+
}}
|
|
87
|
+
${(p) => p["data-direction"] === "vertical" && css`
|
|
88
|
+
min-width: 150px;
|
|
89
|
+
`}
|
|
90
|
+
${(p) => {
|
|
91
|
+
var _a;
|
|
92
|
+
return invertedHoverButton({
|
|
93
|
+
primaryColor: `${(_a = p.theme.colors) == null ? void 0 : _a.primary}`,
|
|
94
|
+
secondaryColor: "#FFFFFF"
|
|
95
|
+
});
|
|
96
|
+
}}
|
|
97
|
+
i {
|
|
98
|
+
margin: 0 ${(p) => {
|
|
99
|
+
var _a;
|
|
100
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.small;
|
|
101
|
+
}} 0 0;
|
|
102
|
+
}
|
|
103
|
+
span {
|
|
104
|
+
}
|
|
105
|
+
`;
|
|
106
|
+
export { FeedbackList as default };
|
|
107
|
+
//# 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';\r\nimport React from 'react';\r\nimport styled, { css } from 'styled-components';\r\n\r\ntype Props = {\r\n actions: { [key: string]: string };\r\n};\r\nconst FeedbackList: React.FC<Props> = ({ actions }) => {\r\n const dispatch = useDispatch();\r\n return (\r\n <StyledButtonList\r\n items={Object.keys(actions).map((i: any) => {\r\n return {\r\n label: actions[i],\r\n actionKey: i,\r\n };\r\n })}\r\n renderItem={(item: any) => {\r\n return (\r\n <FeedbackItem key={item.actionKey}>\r\n <FeedbackButton\r\n className=\"humany-feedback-button\"\r\n disabled={false}\r\n aria-pressed={true}\r\n data-selected={true}\r\n data-direction={'vertical'}\r\n onClick={() => {\r\n dispatch('action', item.actionKey);\r\n }}\r\n >\r\n <Icon faIcon={item.actionKey == 'yes' ? 'smile-o' : 'frown-o'} />\r\n <span>{item.label}</span>\r\n </FeedbackButton>\r\n </FeedbackItem>\r\n );\r\n }}\r\n />\r\n );\r\n};\r\n\r\nexport default FeedbackList;\r\n\r\nconst StyledButtonList = styled(List as any)`\r\n padding: 0 ${(p) => p.theme.sizes?.medium};\r\n list-style: none;\r\n > li {\r\n margin: ${(p) => p.theme.sizes?.small} ${(p) => p.theme.sizes?.normal};\r\n margin-left: 0;\r\n display: inline-block;\r\n }\r\n`;\r\n\r\nconst FeedbackItem = styled.li`\r\n @media (min-width: 768px) {\r\n display: list-item !important;\r\n margin-right: 0 !important;\r\n margin-top: ${(p) => p.theme.sizes?.normal} !important;\r\n }\r\n`;\r\n\r\nconst FeedbackButton = styled.button<{\r\n 'data-selected': boolean;\r\n 'data-direction': 'horizontal' | 'vertical';\r\n}>`\r\n @media (min-width: 768px) {\r\n min-width: 100%;\r\n margin-right: 0;\r\n }\r\n display: inline-block;\r\n font-size: ${(p) => p.theme.fonts?.normal};\r\n border-color: ${(p) => p.theme.colors?.primary} !important;\r\n font-weight: 300;\r\n && {\r\n margin-right: ${(p) => p.theme.sizes?.small};\r\n }\r\n ${(p) =>\r\n p['data-direction'] === 'horizontal' &&\r\n css`\r\n width: 225px;\r\n max-width: calc(50% - ${p.theme.sizes?.large} - ${p.theme.sizes?.small});\r\n `}\r\n ${(p) =>\r\n p['data-direction'] === 'vertical' &&\r\n css`\r\n min-width: 150px;\r\n `}\r\n ${(p) =>\r\n invertedHoverButton({\r\n primaryColor: `${p.theme.colors?.primary}`,\r\n secondaryColor: '#FFFFFF',\r\n })}\r\n i {\r\n margin: 0 ${(p) => p.theme.sizes?.small} 0 0;\r\n }\r\n span {\r\n }\r\n`;\r\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,iBAC1B,CAAC,MAAM;;AAAA,iBAAE,MAAM,UAAR,mBAAe;AAAA;AAAA;AAAA;AAAA,kBAGrB,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;;"}
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Message } from
|
|
1
|
+
import { Message } from '../contract/model/conversation-api-model/message.model';
|
|
2
2
|
export declare class MiddlewareHelper {
|
|
3
3
|
private static sessionMessageStorageVariable;
|
|
4
4
|
private static container;
|
|
@@ -7,16 +7,17 @@ export declare class StoreHelper {
|
|
|
7
7
|
private static messageStore;
|
|
8
8
|
private static globalState;
|
|
9
9
|
constructor();
|
|
10
|
-
static insertOrUpdateMessageArrayStore(messageArray: Message[], entry?: any): void
|
|
11
|
-
|
|
10
|
+
static insertOrUpdateMessageArrayStore(messageArray: Message[], entry?: any): Promise<void>;
|
|
11
|
+
static insertMessageToStore(message: Message): void;
|
|
12
12
|
private static updateMessageInStore;
|
|
13
13
|
static checkIdInMessageStore(id: string): boolean;
|
|
14
14
|
static getLocalState(action: string): LooseObject | undefined;
|
|
15
15
|
static getGlobalState(): GlobalState;
|
|
16
|
-
static setGlobalState(state: GlobalState): void
|
|
16
|
+
static setGlobalState(state: GlobalState): Promise<void>;
|
|
17
17
|
static getAction(action: string): ClientAction;
|
|
18
18
|
static getCommand(text: string): LooseObject;
|
|
19
19
|
static getEntry(action: string): ServerEntry | undefined;
|
|
20
20
|
static getMessage(id: string): Message | undefined;
|
|
21
21
|
static getEntryStore(): ServerEntry[];
|
|
22
|
+
static rehydrateState(): Promise<void>;
|
|
22
23
|
}
|
|
File without changes
|