@telia-ace/knowledge-widget-bot-provider 0.0.1-alpha.7 → 0.0.1-alpha.8
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 +15 -15
- package/lib/client/chat.client.js +79 -84
- package/lib/client/contact-method.client.d.ts +22 -22
- package/lib/client/contact-method.client.js +273 -279
- package/lib/client/http.client.d.ts +22 -22
- package/lib/client/http.client.js +113 -119
- package/lib/client/middleware.client.d.ts +13 -13
- package/lib/client/middleware.client.js +46 -51
- package/lib/contract/custom-component/contact-method-item.d.ts +8 -8
- package/lib/contract/custom-component/contact-method-item.js +51 -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 +33 -38
- package/lib/contract/enum/server-entry-type.enum.d.ts +6 -6
- package/lib/contract/enum/server-entry-type.enum.js +7 -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/entry.interface.d.ts +17 -17
- package/lib/interface/entry.interface.js +133 -138
- 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 +148 -173
- package/lib-esm/client/chat.client.d.ts +15 -15
- package/lib-esm/client/chat.client.js +79 -79
- package/lib-esm/client/contact-method.client.d.ts +22 -22
- package/lib-esm/client/contact-method.client.js +273 -273
- package/lib-esm/client/http.client.d.ts +22 -22
- package/lib-esm/client/http.client.js +113 -113
- package/lib-esm/client/middleware.client.d.ts +13 -13
- package/lib-esm/client/middleware.client.js +46 -46
- package/lib-esm/contract/custom-component/contact-method-item.d.ts +8 -8
- package/lib-esm/contract/custom-component/contact-method-item.js +51 -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 +33 -33
- package/lib-esm/contract/enum/server-entry-type.enum.d.ts +6 -6
- package/lib-esm/contract/enum/server-entry-type.enum.js +7 -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/entry.interface.d.ts +17 -17
- package/lib-esm/interface/entry.interface.js +133 -136
- 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 +148 -145
- package/package.json +52 -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
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,15 +1,15 @@
|
|
|
1
|
-
import { Message } from '../contract/model/conversation-api-model/message.model';
|
|
2
|
-
import EntryInterface from '../interface/entry.interface';
|
|
3
|
-
export default class ChatClient {
|
|
4
|
-
entryInterface: EntryInterface;
|
|
5
|
-
constructor();
|
|
6
|
-
static initialize(user: any, agent: any): void;
|
|
7
|
-
processMessageArrayAndStoreIt(messages: Message[]): void;
|
|
8
|
-
updateMessageArrayAndStoreIt(messages: Message[]): void;
|
|
9
|
-
printUserMessageAndStoreIt(action: string): void;
|
|
10
|
-
private postUserMessage;
|
|
11
|
-
private postAgentMessage;
|
|
12
|
-
private getTitleFromEntry;
|
|
13
|
-
private getTitleFromText;
|
|
14
|
-
private getTitleFromList;
|
|
15
|
-
}
|
|
1
|
+
import { Message } from '../contract/model/conversation-api-model/message.model';
|
|
2
|
+
import EntryInterface from '../interface/entry.interface';
|
|
3
|
+
export default class ChatClient {
|
|
4
|
+
entryInterface: EntryInterface;
|
|
5
|
+
constructor();
|
|
6
|
+
static initialize(user: any, agent: any): void;
|
|
7
|
+
processMessageArrayAndStoreIt(messages: Message[]): void;
|
|
8
|
+
updateMessageArrayAndStoreIt(messages: Message[]): void;
|
|
9
|
+
printUserMessageAndStoreIt(action: string): void;
|
|
10
|
+
private postUserMessage;
|
|
11
|
+
private postAgentMessage;
|
|
12
|
+
private getTitleFromEntry;
|
|
13
|
+
private getTitleFromText;
|
|
14
|
+
private getTitleFromList;
|
|
15
|
+
}
|
|
@@ -1,84 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
//
|
|
16
|
-
ChatClient.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return entry.content.items.find(function (o) { return o.actionKey == action; }).title;
|
|
81
|
-
};
|
|
82
|
-
return ChatClient;
|
|
83
|
-
}());
|
|
84
|
-
exports.default = ChatClient;
|
|
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
|
+
// 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,22 @@
|
|
|
1
|
-
import { ContactMethodPlatform } from '@
|
|
2
|
-
import { DataClient } from '@
|
|
3
|
-
export declare class ContactMethodClient {
|
|
4
|
-
private static dataClient;
|
|
5
|
-
private static contactMethodPlatform;
|
|
6
|
-
private static contactMessageEntryArray;
|
|
7
|
-
private static agent;
|
|
8
|
-
private chatClient;
|
|
9
|
-
static initialize(dataClient: DataClient, contactMethodPlatform: ContactMethodPlatform, agent: any): void;
|
|
10
|
-
handleNewForm: (errors: any, entry: any) => Promise<void>;
|
|
11
|
-
handleContactMethod: (input?: string) => Promise<void>;
|
|
12
|
-
validate(form: any): void;
|
|
13
|
-
private handleContactCategoryList;
|
|
14
|
-
private handleForm;
|
|
15
|
-
private handleContactMethodList;
|
|
16
|
-
private handleSingleContactMethod;
|
|
17
|
-
private submit;
|
|
18
|
-
private removeForm;
|
|
19
|
-
private printMessage;
|
|
20
|
-
private loadContactMethods;
|
|
21
|
-
private updateForm;
|
|
22
|
-
}
|
|
1
|
+
import { ContactMethodPlatform } from '@humany/widget-adapters';
|
|
2
|
+
import { DataClient } from '@humany/widget-types-grid';
|
|
3
|
+
export declare class ContactMethodClient {
|
|
4
|
+
private static dataClient;
|
|
5
|
+
private static contactMethodPlatform;
|
|
6
|
+
private static contactMessageEntryArray;
|
|
7
|
+
private static agent;
|
|
8
|
+
private chatClient;
|
|
9
|
+
static initialize(dataClient: DataClient, contactMethodPlatform: ContactMethodPlatform, agent: any): void;
|
|
10
|
+
handleNewForm: (errors: any, entry: any) => Promise<void>;
|
|
11
|
+
handleContactMethod: (input?: string) => Promise<void>;
|
|
12
|
+
validate(form: any): void;
|
|
13
|
+
private handleContactCategoryList;
|
|
14
|
+
private handleForm;
|
|
15
|
+
private handleContactMethodList;
|
|
16
|
+
private handleSingleContactMethod;
|
|
17
|
+
private submit;
|
|
18
|
+
private removeForm;
|
|
19
|
+
private printMessage;
|
|
20
|
+
private loadContactMethods;
|
|
21
|
+
private updateForm;
|
|
22
|
+
}
|