@telia-ace/knowledge-widget-bot-provider 0.0.1-alpha.46 → 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.
Files changed (139) hide show
  1. package/LICENSE.txt +5 -5
  2. package/README.md +12 -12
  3. package/{lib-esm → dist}/client/chat.client.d.ts +16 -16
  4. package/{lib → dist}/client/contact-method.client.d.ts +34 -34
  5. package/{lib → dist}/client/http.client.d.ts +26 -26
  6. package/{lib → dist}/client/middleware.client.d.ts +14 -14
  7. package/dist/components/feedback-list.d.ts +8 -0
  8. package/dist/components/no-good-alternative.d.ts +6 -0
  9. package/dist/contact-method.js +102 -0
  10. package/dist/contact-method.js.map +1 -0
  11. package/{lib-esm → dist}/contract/custom-component/contact-method-item.d.ts +9 -9
  12. package/{lib-esm → dist}/contract/custom-component/contact-method-list.d.ts +7 -7
  13. package/{lib-esm → dist}/contract/custom-component/contact-method.d.ts +3 -3
  14. package/{lib-esm → dist}/contract/custom-component/entry-context.d.ts +5 -5
  15. package/{lib → dist}/contract/enum/server-entry-type.enum.d.ts +7 -7
  16. package/{lib → dist}/contract/model/conversation-api-model/list.model.d.ts +5 -5
  17. package/{lib-esm → dist}/contract/model/conversation-api-model/message.model.d.ts +7 -7
  18. package/{lib → dist}/contract/model/http/action.model.d.ts +3 -3
  19. package/{lib → dist}/contract/model/http/client-action.model.d.ts +4 -4
  20. package/{lib → dist}/contract/model/http/client-envelope.model.d.ts +9 -9
  21. package/{lib-esm → dist}/contract/model/http/connect-options.model.d.ts +5 -5
  22. package/{lib-esm → dist}/contract/model/http/global-state.model.d.ts +8 -8
  23. package/{lib-esm → dist}/contract/model/http/http-client-options.model.d.ts +5 -5
  24. package/{lib-esm → dist}/contract/model/http/server-entry.model.d.ts +11 -11
  25. package/{lib-esm → dist}/contract/model/http/server-envelope.model.d.ts +10 -10
  26. package/{lib-esm → dist}/contract/model/middleware/aggregator-state.model.d.ts +4 -4
  27. package/{lib → dist}/contract/model/shared/loose-object.model.d.ts +3 -3
  28. package/dist/feedback-list.js +104 -0
  29. package/dist/feedback-list.js.map +1 -0
  30. package/{lib-esm → dist}/helper/chat.helper.d.ts +8 -8
  31. package/{lib-esm → dist}/helper/http.helper.d.ts +13 -13
  32. package/{lib-esm → dist}/helper/middleware.helper.d.ts +12 -12
  33. package/{lib → dist}/helper/store.helper.d.ts +23 -23
  34. package/{lib-esm → dist}/index.d.ts +2 -2
  35. package/dist/index.js +1152 -0
  36. package/dist/index.js.map +1 -0
  37. package/{lib-esm → dist}/interface/entry.interface.d.ts +20 -20
  38. package/{lib-esm → dist}/interface/middleware/paging.interface.d.ts +4 -4
  39. package/{lib-esm → dist}/interface/middleware/processor.interface.d.ts +10 -10
  40. package/dist/no-good-alternative.js +33 -0
  41. package/dist/no-good-alternative.js.map +1 -0
  42. package/{lib-esm → dist}/plugin.d.ts +3 -3
  43. package/dist/ui/feedback-list.d.ts +8 -0
  44. package/dist/ui/no-good-alternative.d.ts +6 -0
  45. package/{lib-esm → dist}/utils.d.ts +2 -2
  46. package/package.json +14 -15
  47. package/lib/client/chat.client.d.ts +0 -16
  48. package/lib/client/chat.client.js +0 -145
  49. package/lib/client/contact-method.client.js +0 -337
  50. package/lib/client/http.client.js +0 -211
  51. package/lib/client/middleware.client.js +0 -125
  52. package/lib/contract/custom-component/contact-method-item.d.ts +0 -9
  53. package/lib/contract/custom-component/contact-method-item.js +0 -34
  54. package/lib/contract/custom-component/contact-method-list.d.ts +0 -7
  55. package/lib/contract/custom-component/contact-method-list.js +0 -13
  56. package/lib/contract/custom-component/contact-method.d.ts +0 -3
  57. package/lib/contract/custom-component/contact-method.js +0 -35
  58. package/lib/contract/custom-component/entry-context.d.ts +0 -5
  59. package/lib/contract/custom-component/entry-context.js +0 -4
  60. package/lib/contract/enum/server-entry-type.enum.js +0 -8
  61. package/lib/contract/model/conversation-api-model/list.model.js +0 -1
  62. package/lib/contract/model/conversation-api-model/message.model.d.ts +0 -7
  63. package/lib/contract/model/conversation-api-model/message.model.js +0 -1
  64. package/lib/contract/model/http/action.model.js +0 -1
  65. package/lib/contract/model/http/client-action.model.js +0 -2
  66. package/lib/contract/model/http/client-envelope.model.js +0 -1
  67. package/lib/contract/model/http/connect-options.model.d.ts +0 -5
  68. package/lib/contract/model/http/connect-options.model.js +0 -1
  69. package/lib/contract/model/http/global-state.model.d.ts +0 -8
  70. package/lib/contract/model/http/global-state.model.js +0 -1
  71. package/lib/contract/model/http/http-client-options.model.d.ts +0 -5
  72. package/lib/contract/model/http/http-client-options.model.js +0 -1
  73. package/lib/contract/model/http/server-entry.model.d.ts +0 -11
  74. package/lib/contract/model/http/server-entry.model.js +0 -1
  75. package/lib/contract/model/http/server-envelope.model.d.ts +0 -10
  76. package/lib/contract/model/http/server-envelope.model.js +0 -1
  77. package/lib/contract/model/middleware/aggregator-state.model.d.ts +0 -4
  78. package/lib/contract/model/middleware/aggregator-state.model.js +0 -2
  79. package/lib/contract/model/shared/loose-object.model.js +0 -1
  80. package/lib/helper/chat.helper.d.ts +0 -8
  81. package/lib/helper/chat.helper.js +0 -18
  82. package/lib/helper/http.helper.d.ts +0 -13
  83. package/lib/helper/http.helper.js +0 -28
  84. package/lib/helper/middleware.helper.d.ts +0 -12
  85. package/lib/helper/middleware.helper.js +0 -68
  86. package/lib/helper/store.helper.js +0 -169
  87. package/lib/index.d.ts +0 -2
  88. package/lib/index.js +0 -2
  89. package/lib/interface/entry.interface.d.ts +0 -20
  90. package/lib/interface/entry.interface.js +0 -306
  91. package/lib/interface/middleware/paging.interface.d.ts +0 -4
  92. package/lib/interface/middleware/paging.interface.js +0 -53
  93. package/lib/interface/middleware/processor.interface.d.ts +0 -10
  94. package/lib/interface/middleware/processor.interface.js +0 -118
  95. package/lib/plugin.d.ts +0 -3
  96. package/lib/plugin.js +0 -154
  97. package/lib/utils.d.ts +0 -2
  98. package/lib/utils.js +0 -79
  99. package/lib-esm/client/chat.client.js +0 -145
  100. package/lib-esm/client/contact-method.client.d.ts +0 -34
  101. package/lib-esm/client/contact-method.client.js +0 -337
  102. package/lib-esm/client/http.client.d.ts +0 -26
  103. package/lib-esm/client/http.client.js +0 -211
  104. package/lib-esm/client/middleware.client.d.ts +0 -14
  105. package/lib-esm/client/middleware.client.js +0 -125
  106. package/lib-esm/contract/custom-component/contact-method-item.js +0 -34
  107. package/lib-esm/contract/custom-component/contact-method-list.js +0 -13
  108. package/lib-esm/contract/custom-component/contact-method.js +0 -35
  109. package/lib-esm/contract/custom-component/entry-context.js +0 -4
  110. package/lib-esm/contract/enum/server-entry-type.enum.d.ts +0 -7
  111. package/lib-esm/contract/enum/server-entry-type.enum.js +0 -8
  112. package/lib-esm/contract/model/conversation-api-model/list.model.d.ts +0 -5
  113. package/lib-esm/contract/model/conversation-api-model/list.model.js +0 -1
  114. package/lib-esm/contract/model/conversation-api-model/message.model.js +0 -1
  115. package/lib-esm/contract/model/http/action.model.d.ts +0 -3
  116. package/lib-esm/contract/model/http/action.model.js +0 -1
  117. package/lib-esm/contract/model/http/client-action.model.d.ts +0 -4
  118. package/lib-esm/contract/model/http/client-action.model.js +0 -2
  119. package/lib-esm/contract/model/http/client-envelope.model.d.ts +0 -9
  120. package/lib-esm/contract/model/http/client-envelope.model.js +0 -1
  121. package/lib-esm/contract/model/http/connect-options.model.js +0 -1
  122. package/lib-esm/contract/model/http/global-state.model.js +0 -1
  123. package/lib-esm/contract/model/http/http-client-options.model.js +0 -1
  124. package/lib-esm/contract/model/http/server-entry.model.js +0 -1
  125. package/lib-esm/contract/model/http/server-envelope.model.js +0 -1
  126. package/lib-esm/contract/model/middleware/aggregator-state.model.js +0 -2
  127. package/lib-esm/contract/model/shared/loose-object.model.d.ts +0 -3
  128. package/lib-esm/contract/model/shared/loose-object.model.js +0 -1
  129. package/lib-esm/helper/chat.helper.js +0 -18
  130. package/lib-esm/helper/http.helper.js +0 -28
  131. package/lib-esm/helper/middleware.helper.js +0 -68
  132. package/lib-esm/helper/store.helper.d.ts +0 -23
  133. package/lib-esm/helper/store.helper.js +0 -169
  134. package/lib-esm/index.js +0 -2
  135. package/lib-esm/interface/entry.interface.js +0 -306
  136. package/lib-esm/interface/middleware/paging.interface.js +0 -53
  137. package/lib-esm/interface/middleware/processor.interface.js +0 -118
  138. package/lib-esm/plugin.js +0 -154
  139. package/lib-esm/utils.js +0 -79
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
+ }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ declare type Props = {
3
+ actions: {
4
+ [key: string]: string;
5
+ };
6
+ };
7
+ declare const FeedbackList: React.FC<Props>;
8
+ export default FeedbackList;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ declare type Props = {
3
+ body: string;
4
+ };
5
+ declare const NoGoodAlternative: React.FC<Props>;
6
+ export default NoGoodAlternative;
@@ -0,0 +1,102 @@
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 }) => {
29
+ const dispatch = useDispatch();
30
+ const { entryId } = useContext(EntryContext);
31
+ return /* @__PURE__ */ React.createElement(ContactMethod$1, __spreadProps(__spreadValues({
32
+ className,
33
+ onClick: (event) => {
34
+ if (contactMethod.inline) {
35
+ event.preventDefault();
36
+ dispatch("expand", {
37
+ entryId,
38
+ contactMethodId: contactMethod.id
39
+ });
40
+ } else {
41
+ dispatch("action", `${contactMethod.id}/contact-methods/${contactMethod.title}`);
42
+ }
43
+ },
44
+ dispatch
45
+ }, contactMethod), {
46
+ inline: true
47
+ }));
48
+ };
49
+ const ContactMethodList = (props) => {
50
+ return /* @__PURE__ */ React.createElement(Fragment, null, props.contactMethodList.map((contactMethod) => /* @__PURE__ */ React.createElement(StyledContactMethod, {
51
+ key: contactMethod.id,
52
+ type: props.type,
53
+ contactMethod,
54
+ expanded: !!contactMethod.executeImmediately || void 0
55
+ })));
56
+ };
57
+ const StyledContactMethod = styled(ContactMethodItem)`
58
+ border-bottom: 1px solid rgb(239, 239, 239);
59
+ padding: ${(p) => {
60
+ var _a;
61
+ return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
62
+ }};
63
+
64
+ &:last-child {
65
+ border-bottom: none;
66
+ }
67
+ `;
68
+ const ContactMethod = (props) => {
69
+ var _a, _b;
70
+ let type;
71
+ let methodList;
72
+ if (props.contactMethods && ((_a = props.contactMethods.contactMethods) == null ? void 0 : _a.length) > 0) {
73
+ type = DataType.ContactMethods;
74
+ methodList = props.contactMethods.contactMethods;
75
+ } else if (props.contactMethods.categories && ((_b = props.contactMethods.categories) == null ? void 0 : _b.length) > 0) {
76
+ type = DataType.ContactMethodCategories;
77
+ methodList = props.contactMethods.categories.filter((o) => o.matches > 0);
78
+ } else {
79
+ type = DataType.ContactMethod;
80
+ methodList = props.contactMethods;
81
+ }
82
+ if (!methodList.length) {
83
+ return /* @__PURE__ */ React.createElement(StyledContactMethodItem, {
84
+ type,
85
+ contactMethod: methodList
86
+ });
87
+ }
88
+ return /* @__PURE__ */ React.createElement(EntryContext.Provider, {
89
+ value: props.entry
90
+ }, /* @__PURE__ */ React.createElement(ContactMethodList, {
91
+ type,
92
+ contactMethodList: methodList
93
+ }));
94
+ };
95
+ const StyledContactMethodItem = styled(ContactMethodItem)`
96
+ padding: ${(p) => {
97
+ var _a;
98
+ return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
99
+ }};
100
+ `;
101
+ export { ContactMethod as default };
102
+ //# 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';\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
+ }