@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.
Files changed (123) hide show
  1. package/LICENSE.txt +5 -5
  2. package/README.md +12 -12
  3. package/lib/client/chat.client.d.ts +15 -15
  4. package/lib/client/chat.client.js +79 -84
  5. package/lib/client/contact-method.client.d.ts +22 -22
  6. package/lib/client/contact-method.client.js +273 -279
  7. package/lib/client/http.client.d.ts +22 -22
  8. package/lib/client/http.client.js +113 -119
  9. package/lib/client/middleware.client.d.ts +13 -13
  10. package/lib/client/middleware.client.js +46 -51
  11. package/lib/contract/custom-component/contact-method-item.d.ts +8 -8
  12. package/lib/contract/custom-component/contact-method-item.js +51 -76
  13. package/lib/contract/custom-component/contact-method-list.d.ts +7 -7
  14. package/lib/contract/custom-component/contact-method-list.js +13 -41
  15. package/lib/contract/custom-component/contact-method.d.ts +3 -3
  16. package/lib/contract/custom-component/contact-method.js +33 -38
  17. package/lib/contract/enum/server-entry-type.enum.d.ts +6 -6
  18. package/lib/contract/enum/server-entry-type.enum.js +7 -10
  19. package/lib/contract/model/conversation-api-model/list.model.d.ts +5 -5
  20. package/lib/contract/model/conversation-api-model/list.model.js +0 -2
  21. package/lib/contract/model/conversation-api-model/message.model.d.ts +7 -7
  22. package/lib/contract/model/conversation-api-model/message.model.js +0 -2
  23. package/lib/contract/model/http/action.model.d.ts +3 -3
  24. package/lib/contract/model/http/action.model.js +0 -2
  25. package/lib/contract/model/http/client-action.model.d.ts +4 -4
  26. package/lib/contract/model/http/client-action.model.js +1 -3
  27. package/lib/contract/model/http/client-envelope.model.d.ts +9 -9
  28. package/lib/contract/model/http/client-envelope.model.js +0 -2
  29. package/lib/contract/model/http/connect-options.model.d.ts +5 -5
  30. package/lib/contract/model/http/connect-options.model.js +0 -2
  31. package/lib/contract/model/http/global-state.model.d.ts +8 -8
  32. package/lib/contract/model/http/global-state.model.js +0 -2
  33. package/lib/contract/model/http/http-client-options.model.d.ts +5 -5
  34. package/lib/contract/model/http/http-client-options.model.js +0 -2
  35. package/lib/contract/model/http/server-entry.model.d.ts +11 -11
  36. package/lib/contract/model/http/server-entry.model.js +0 -2
  37. package/lib/contract/model/http/server-envelope.model.d.ts +10 -10
  38. package/lib/contract/model/http/server-envelope.model.js +0 -2
  39. package/lib/contract/model/middleware/aggregator-state.model.d.ts +4 -4
  40. package/lib/contract/model/middleware/aggregator-state.model.js +1 -3
  41. package/lib/contract/model/shared/loose-object.model.d.ts +3 -3
  42. package/lib/contract/model/shared/loose-object.model.js +0 -2
  43. package/lib/helper/chat.helper.d.ts +8 -8
  44. package/lib/helper/chat.helper.js +18 -21
  45. package/lib/helper/http.helper.d.ts +13 -13
  46. package/lib/helper/http.helper.js +28 -33
  47. package/lib/helper/middleware.helper.d.ts +12 -12
  48. package/lib/helper/middleware.helper.js +67 -72
  49. package/lib/helper/store.helper.d.ts +22 -22
  50. package/lib/helper/store.helper.js +77 -80
  51. package/lib/index.d.ts +2 -2
  52. package/lib/index.js +2 -8
  53. package/lib/interface/entry.interface.d.ts +17 -17
  54. package/lib/interface/entry.interface.js +133 -138
  55. package/lib/interface/middleware/paging.interface.d.ts +4 -4
  56. package/lib/interface/middleware/paging.interface.js +53 -55
  57. package/lib/interface/middleware/processor.interface.d.ts +10 -10
  58. package/lib/interface/middleware/processor.interface.js +118 -120
  59. package/lib/plugin.d.ts +3 -3
  60. package/lib/plugin.js +148 -173
  61. package/lib-esm/client/chat.client.d.ts +15 -15
  62. package/lib-esm/client/chat.client.js +79 -79
  63. package/lib-esm/client/contact-method.client.d.ts +22 -22
  64. package/lib-esm/client/contact-method.client.js +273 -273
  65. package/lib-esm/client/http.client.d.ts +22 -22
  66. package/lib-esm/client/http.client.js +113 -113
  67. package/lib-esm/client/middleware.client.d.ts +13 -13
  68. package/lib-esm/client/middleware.client.js +46 -46
  69. package/lib-esm/contract/custom-component/contact-method-item.d.ts +8 -8
  70. package/lib-esm/contract/custom-component/contact-method-item.js +51 -51
  71. package/lib-esm/contract/custom-component/contact-method-list.d.ts +7 -7
  72. package/lib-esm/contract/custom-component/contact-method-list.js +13 -13
  73. package/lib-esm/contract/custom-component/contact-method.d.ts +3 -3
  74. package/lib-esm/contract/custom-component/contact-method.js +33 -33
  75. package/lib-esm/contract/enum/server-entry-type.enum.d.ts +6 -6
  76. package/lib-esm/contract/enum/server-entry-type.enum.js +7 -7
  77. package/lib-esm/contract/model/conversation-api-model/list.model.d.ts +5 -5
  78. package/lib-esm/contract/model/conversation-api-model/list.model.js +0 -1
  79. package/lib-esm/contract/model/conversation-api-model/message.model.d.ts +7 -7
  80. package/lib-esm/contract/model/conversation-api-model/message.model.js +0 -1
  81. package/lib-esm/contract/model/http/action.model.d.ts +3 -3
  82. package/lib-esm/contract/model/http/action.model.js +0 -1
  83. package/lib-esm/contract/model/http/client-action.model.d.ts +4 -4
  84. package/lib-esm/contract/model/http/client-action.model.js +1 -2
  85. package/lib-esm/contract/model/http/client-envelope.model.d.ts +9 -9
  86. package/lib-esm/contract/model/http/client-envelope.model.js +0 -1
  87. package/lib-esm/contract/model/http/connect-options.model.d.ts +5 -5
  88. package/lib-esm/contract/model/http/connect-options.model.js +0 -1
  89. package/lib-esm/contract/model/http/global-state.model.d.ts +8 -8
  90. package/lib-esm/contract/model/http/global-state.model.js +0 -1
  91. package/lib-esm/contract/model/http/http-client-options.model.d.ts +5 -5
  92. package/lib-esm/contract/model/http/http-client-options.model.js +0 -1
  93. package/lib-esm/contract/model/http/server-entry.model.d.ts +11 -11
  94. package/lib-esm/contract/model/http/server-entry.model.js +0 -1
  95. package/lib-esm/contract/model/http/server-envelope.model.d.ts +10 -10
  96. package/lib-esm/contract/model/http/server-envelope.model.js +0 -1
  97. package/lib-esm/contract/model/middleware/aggregator-state.model.d.ts +4 -4
  98. package/lib-esm/contract/model/middleware/aggregator-state.model.js +1 -2
  99. package/lib-esm/contract/model/shared/loose-object.model.d.ts +3 -3
  100. package/lib-esm/contract/model/shared/loose-object.model.js +0 -1
  101. package/lib-esm/helper/chat.helper.d.ts +8 -8
  102. package/lib-esm/helper/chat.helper.js +18 -18
  103. package/lib-esm/helper/http.helper.d.ts +13 -13
  104. package/lib-esm/helper/http.helper.js +28 -30
  105. package/lib-esm/helper/middleware.helper.d.ts +12 -12
  106. package/lib-esm/helper/middleware.helper.js +67 -69
  107. package/lib-esm/helper/store.helper.d.ts +22 -22
  108. package/lib-esm/helper/store.helper.js +77 -77
  109. package/lib-esm/index.d.ts +2 -2
  110. package/lib-esm/index.js +2 -2
  111. package/lib-esm/interface/entry.interface.d.ts +17 -17
  112. package/lib-esm/interface/entry.interface.js +133 -136
  113. package/lib-esm/interface/middleware/paging.interface.d.ts +4 -4
  114. package/lib-esm/interface/middleware/paging.interface.js +53 -53
  115. package/lib-esm/interface/middleware/processor.interface.d.ts +10 -10
  116. package/lib-esm/interface/middleware/processor.interface.js +118 -118
  117. package/lib-esm/plugin.d.ts +3 -3
  118. package/lib-esm/plugin.js +148 -145
  119. package/package.json +52 -45
  120. package/lib/interface/middleware/contact-expanded.interface.d.ts +0 -0
  121. package/lib/interface/middleware/contact-expanded.interface.js +0 -50
  122. package/lib/interface/middleware/legacy-contact-methods.interface.d.ts +0 -0
  123. package/lib/interface/middleware/legacy-contact-methods.interface.js +0 -394
@@ -1,79 +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
- // 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
+ 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 '@telia-ace/knowledge-widget-adapters';
2
- import { DataClient } from '@telia-ace/knowledge-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
- }
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
+ }