@telia-ace/knowledge-widget-bot-provider 0.0.1-alpha.3 → 0.0.1-alpha.32
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/lib/client/chat.client.d.ts +16 -15
- package/lib/client/chat.client.js +79 -80
- package/lib/client/contact-method.client.d.ts +25 -22
- package/lib/client/contact-method.client.js +282 -276
- package/lib/client/http.client.d.ts +23 -22
- package/lib/client/http.client.js +160 -115
- package/lib/client/middleware.client.d.ts +14 -13
- package/lib/client/middleware.client.js +104 -60
- package/lib/contract/custom-component/contact-method-item.d.ts +8 -8
- package/lib/contract/custom-component/contact-method-item.js +54 -76
- package/lib/contract/custom-component/contact-method-list.d.ts +7 -7
- package/lib/contract/custom-component/contact-method-list.js +13 -41
- package/lib/contract/custom-component/contact-method.d.ts +3 -3
- package/lib/contract/custom-component/contact-method.js +34 -38
- package/lib/contract/enum/server-entry-type.enum.d.ts +7 -6
- package/lib/contract/enum/server-entry-type.enum.js +8 -10
- package/lib/contract/model/conversation-api-model/list.model.d.ts +5 -5
- package/lib/contract/model/conversation-api-model/list.model.js +0 -2
- package/lib/contract/model/conversation-api-model/message.model.d.ts +7 -7
- package/lib/contract/model/conversation-api-model/message.model.js +0 -2
- package/lib/contract/model/http/action.model.d.ts +3 -3
- package/lib/contract/model/http/action.model.js +0 -2
- package/lib/contract/model/http/client-action.model.d.ts +4 -4
- package/lib/contract/model/http/client-action.model.js +1 -3
- package/lib/contract/model/http/client-envelope.model.d.ts +9 -9
- package/lib/contract/model/http/client-envelope.model.js +0 -2
- package/lib/contract/model/http/connect-options.model.d.ts +5 -5
- package/lib/contract/model/http/connect-options.model.js +0 -2
- package/lib/contract/model/http/global-state.model.d.ts +8 -8
- package/lib/contract/model/http/global-state.model.js +0 -2
- package/lib/contract/model/http/http-client-options.model.d.ts +5 -5
- package/lib/contract/model/http/http-client-options.model.js +0 -2
- package/lib/contract/model/http/server-entry.model.d.ts +11 -11
- package/lib/contract/model/http/server-entry.model.js +0 -2
- package/lib/contract/model/http/server-envelope.model.d.ts +10 -10
- package/lib/contract/model/http/server-envelope.model.js +0 -2
- package/lib/contract/model/middleware/aggregator-state.model.d.ts +4 -4
- package/lib/contract/model/middleware/aggregator-state.model.js +1 -3
- package/lib/contract/model/shared/loose-object.model.d.ts +3 -3
- package/lib/contract/model/shared/loose-object.model.js +0 -2
- package/lib/helper/chat.helper.d.ts +8 -8
- package/lib/helper/chat.helper.js +18 -21
- package/lib/helper/http.helper.d.ts +13 -13
- package/lib/helper/http.helper.js +28 -33
- package/lib/helper/middleware.helper.d.ts +12 -12
- package/lib/helper/middleware.helper.js +67 -72
- package/lib/helper/store.helper.d.ts +22 -22
- package/lib/helper/store.helper.js +77 -80
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -8
- package/lib/interface/_mocked-contact-method.json +375 -0
- package/lib/interface/convert.d.ts +1 -0
- package/lib/interface/convert.js +68 -0
- package/lib/interface/entry.interface.d.ts +20 -17
- package/lib/interface/entry.interface.js +262 -139
- package/lib/interface/middleware/paging.interface.d.ts +4 -4
- package/lib/interface/middleware/paging.interface.js +53 -55
- package/lib/interface/middleware/processor.interface.d.ts +10 -10
- package/lib/interface/middleware/processor.interface.js +118 -120
- package/lib/plugin.d.ts +3 -3
- package/lib/plugin.js +147 -169
- package/lib-esm/client/chat.client.d.ts +16 -15
- package/lib-esm/client/chat.client.js +79 -75
- package/lib-esm/client/contact-method.client.d.ts +25 -22
- package/lib-esm/client/contact-method.client.js +282 -270
- package/lib-esm/client/http.client.d.ts +23 -22
- package/lib-esm/client/http.client.js +160 -109
- package/lib-esm/client/middleware.client.d.ts +14 -13
- package/lib-esm/client/middleware.client.js +104 -55
- package/lib-esm/contract/custom-component/contact-method-item.d.ts +8 -8
- package/lib-esm/contract/custom-component/contact-method-item.js +54 -51
- package/lib-esm/contract/custom-component/contact-method-list.d.ts +7 -7
- package/lib-esm/contract/custom-component/contact-method-list.js +13 -13
- package/lib-esm/contract/custom-component/contact-method.d.ts +3 -3
- package/lib-esm/contract/custom-component/contact-method.js +34 -33
- package/lib-esm/contract/enum/server-entry-type.enum.d.ts +7 -6
- package/lib-esm/contract/enum/server-entry-type.enum.js +8 -7
- package/lib-esm/contract/model/conversation-api-model/list.model.d.ts +5 -5
- package/lib-esm/contract/model/conversation-api-model/list.model.js +0 -1
- package/lib-esm/contract/model/conversation-api-model/message.model.d.ts +7 -7
- package/lib-esm/contract/model/conversation-api-model/message.model.js +0 -1
- package/lib-esm/contract/model/http/action.model.d.ts +3 -3
- package/lib-esm/contract/model/http/action.model.js +0 -1
- package/lib-esm/contract/model/http/client-action.model.d.ts +4 -4
- package/lib-esm/contract/model/http/client-action.model.js +1 -2
- package/lib-esm/contract/model/http/client-envelope.model.d.ts +9 -9
- package/lib-esm/contract/model/http/client-envelope.model.js +0 -1
- package/lib-esm/contract/model/http/connect-options.model.d.ts +5 -5
- package/lib-esm/contract/model/http/connect-options.model.js +0 -1
- package/lib-esm/contract/model/http/global-state.model.d.ts +8 -8
- package/lib-esm/contract/model/http/global-state.model.js +0 -1
- package/lib-esm/contract/model/http/http-client-options.model.d.ts +5 -5
- package/lib-esm/contract/model/http/http-client-options.model.js +0 -1
- package/lib-esm/contract/model/http/server-entry.model.d.ts +11 -11
- package/lib-esm/contract/model/http/server-entry.model.js +0 -1
- package/lib-esm/contract/model/http/server-envelope.model.d.ts +10 -10
- package/lib-esm/contract/model/http/server-envelope.model.js +0 -1
- package/lib-esm/contract/model/middleware/aggregator-state.model.d.ts +4 -4
- package/lib-esm/contract/model/middleware/aggregator-state.model.js +1 -2
- package/lib-esm/contract/model/shared/loose-object.model.d.ts +3 -3
- package/lib-esm/contract/model/shared/loose-object.model.js +0 -1
- package/lib-esm/helper/chat.helper.d.ts +8 -8
- package/lib-esm/helper/chat.helper.js +18 -18
- package/lib-esm/helper/http.helper.d.ts +13 -13
- package/lib-esm/helper/http.helper.js +28 -30
- package/lib-esm/helper/middleware.helper.d.ts +12 -12
- package/lib-esm/helper/middleware.helper.js +67 -69
- package/lib-esm/helper/store.helper.d.ts +22 -22
- package/lib-esm/helper/store.helper.js +77 -77
- package/lib-esm/index.d.ts +2 -2
- package/lib-esm/index.js +2 -2
- package/lib-esm/interface/_mocked-contact-method.json +375 -0
- package/lib-esm/interface/convert.d.ts +1 -0
- package/lib-esm/interface/convert.js +68 -0
- package/lib-esm/interface/entry.interface.d.ts +20 -17
- package/lib-esm/interface/entry.interface.js +262 -137
- package/lib-esm/interface/middleware/paging.interface.d.ts +4 -4
- package/lib-esm/interface/middleware/paging.interface.js +53 -53
- package/lib-esm/interface/middleware/processor.interface.d.ts +10 -10
- package/lib-esm/interface/middleware/processor.interface.js +118 -118
- package/lib-esm/plugin.d.ts +3 -3
- package/lib-esm/plugin.js +147 -141
- package/package.json +54 -45
- 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
|
@@ -1,75 +1,79 @@
|
|
|
1
|
-
import { v4 as newGuid } from 'uuid';
|
|
2
|
-
import { ServerEntryTypeEnum } from '../contract/enum/server-entry-type.enum';
|
|
3
|
-
import { ChatHelper } from '../helper/chat.helper';
|
|
4
|
-
import { StoreHelper } from '../helper/store.helper';
|
|
5
|
-
import EntryInterface from '../interface/entry.interface';
|
|
6
|
-
var ChatClient = /** @class */ (function () {
|
|
7
|
-
function ChatClient() {
|
|
8
|
-
this.entryInterface = new EntryInterface();
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
ChatHelper.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
_this.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
1
|
+
import { v4 as newGuid } from 'uuid';
|
|
2
|
+
import { ServerEntryTypeEnum } from '../contract/enum/server-entry-type.enum';
|
|
3
|
+
import { ChatHelper } from '../helper/chat.helper';
|
|
4
|
+
import { StoreHelper } from '../helper/store.helper';
|
|
5
|
+
import EntryInterface from '../interface/entry.interface';
|
|
6
|
+
var ChatClient = /** @class */ (function () {
|
|
7
|
+
function ChatClient(container) {
|
|
8
|
+
this.entryInterface = new EntryInterface(container);
|
|
9
|
+
}
|
|
10
|
+
// Initialize from setting the user and agent for the Helper
|
|
11
|
+
ChatClient.initialize = function (user, agent) {
|
|
12
|
+
ChatHelper.setUser(user);
|
|
13
|
+
ChatHelper.setAgent(agent);
|
|
14
|
+
};
|
|
15
|
+
// function for posting the messages
|
|
16
|
+
ChatClient.prototype.processMessageArrayAndStoreIt = function (messages) {
|
|
17
|
+
var _this = this;
|
|
18
|
+
messages
|
|
19
|
+
.filter(function (o) { return o && o != null; })
|
|
20
|
+
.forEach(function (o) {
|
|
21
|
+
if (o.isUser)
|
|
22
|
+
_this.postUserMessage(o);
|
|
23
|
+
else
|
|
24
|
+
_this.postAgentMessage(o);
|
|
25
|
+
});
|
|
26
|
+
StoreHelper.insertOrUpdateMessageArrayStore(messages);
|
|
27
|
+
};
|
|
28
|
+
// function for updating current messages
|
|
29
|
+
ChatClient.prototype.updateMessageArrayAndStoreIt = function (messages) {
|
|
30
|
+
var conversationEntry = undefined;
|
|
31
|
+
messages.forEach(function (o) {
|
|
32
|
+
var message = StoreHelper.getMessage(o.id);
|
|
33
|
+
message === null || message === void 0 ? void 0 : message.conversationEntry.update(o.message);
|
|
34
|
+
conversationEntry = message === null || message === void 0 ? void 0 : message.conversationEntry;
|
|
35
|
+
});
|
|
36
|
+
StoreHelper.insertOrUpdateMessageArrayStore(messages, conversationEntry);
|
|
37
|
+
};
|
|
38
|
+
// function for posting a message for the user actions, such as button clicks
|
|
39
|
+
ChatClient.prototype.printUserMessageAndStoreIt = function (action) {
|
|
40
|
+
if (action == 'next' || action == 'help')
|
|
41
|
+
return;
|
|
42
|
+
var entry = StoreHelper.getEntry(action);
|
|
43
|
+
var message = {
|
|
44
|
+
id: newGuid(),
|
|
45
|
+
message: !entry ? action : this.getTitleFromEntry(entry, action),
|
|
46
|
+
isUser: true,
|
|
47
|
+
};
|
|
48
|
+
this.postUserMessage(message);
|
|
49
|
+
StoreHelper.insertOrUpdateMessageArrayStore([message]);
|
|
50
|
+
};
|
|
51
|
+
ChatClient.prototype.postUserMessage = function (message) {
|
|
52
|
+
ChatHelper.getUser().print(message.message);
|
|
53
|
+
};
|
|
54
|
+
ChatClient.prototype.postAgentMessage = function (message) {
|
|
55
|
+
message.conversationEntry = ChatHelper.getAgent().print(message.message);
|
|
56
|
+
};
|
|
57
|
+
ChatClient.prototype.getTitleFromEntry = function (entry, action) {
|
|
58
|
+
var entryType = ServerEntryTypeEnum[entry.type];
|
|
59
|
+
switch (entryType) {
|
|
60
|
+
case ServerEntryTypeEnum.List:
|
|
61
|
+
return this.getTitleFromList(entry, action);
|
|
62
|
+
case ServerEntryTypeEnum.Text:
|
|
63
|
+
return this.getTitleFromText(entry, action);
|
|
64
|
+
default:
|
|
65
|
+
return '';
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
ChatClient.prototype.getTitleFromText = function (entry, action) {
|
|
69
|
+
if (!!entry.content.items)
|
|
70
|
+
return this.getTitleFromList(entry, action);
|
|
71
|
+
else
|
|
72
|
+
return entry.content.html;
|
|
73
|
+
};
|
|
74
|
+
ChatClient.prototype.getTitleFromList = function (entry, action) {
|
|
75
|
+
return entry.content.items.find(function (o) { return o.actionKey == action; }).title;
|
|
76
|
+
};
|
|
77
|
+
return ChatClient;
|
|
78
|
+
}());
|
|
79
|
+
export default ChatClient;
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import { ContactMethodPlatform } from '@
|
|
2
|
-
import { DataClient } from '@
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
private static
|
|
6
|
-
private static
|
|
7
|
-
private static
|
|
8
|
-
private
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
private
|
|
17
|
-
private
|
|
18
|
-
private
|
|
19
|
-
private
|
|
20
|
-
private
|
|
21
|
-
private
|
|
22
|
-
|
|
1
|
+
import { ContactMethodPlatform } from '@humany/widget-adapters';
|
|
2
|
+
import { DataClient } from '@humany/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
|
+
}
|