@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.
Files changed (136) hide show
  1. package/{lib-esm → dist}/client/chat.client.d.ts +1 -3
  2. package/{lib-esm → dist}/client/contact-method.client.d.ts +15 -2
  3. package/dist/client/http.client.d.ts +26 -0
  4. package/{lib → dist}/client/middleware.client.d.ts +4 -3
  5. package/dist/contact-method.js +112 -0
  6. package/dist/contact-method.js.map +1 -0
  7. package/{lib → dist}/contract/custom-component/contact-method-item.d.ts +3 -0
  8. package/{lib-esm → dist}/contract/custom-component/contact-method-list.d.ts +1 -0
  9. package/{lib-esm → dist}/contract/custom-component/contact-method.d.ts +0 -0
  10. package/dist/contract/custom-component/entry-context.d.ts +5 -0
  11. package/{lib → dist}/contract/enum/server-entry-type.enum.d.ts +3 -2
  12. package/{lib-esm → dist}/contract/model/conversation-api-model/list.model.d.ts +0 -0
  13. package/{lib-esm → dist}/contract/model/conversation-api-model/message.model.d.ts +0 -0
  14. package/{lib-esm → dist}/contract/model/http/action.model.d.ts +0 -0
  15. package/{lib-esm → dist}/contract/model/http/client-action.model.d.ts +0 -0
  16. package/{lib-esm → dist}/contract/model/http/client-envelope.model.d.ts +0 -0
  17. package/{lib-esm → dist}/contract/model/http/connect-options.model.d.ts +0 -0
  18. package/{lib-esm → dist}/contract/model/http/global-state.model.d.ts +0 -0
  19. package/{lib-esm → dist}/contract/model/http/http-client-options.model.d.ts +0 -0
  20. package/{lib-esm → dist}/contract/model/http/server-entry.model.d.ts +0 -0
  21. package/{lib-esm → dist}/contract/model/http/server-envelope.model.d.ts +0 -0
  22. package/{lib-esm → dist}/contract/model/middleware/aggregator-state.model.d.ts +0 -0
  23. package/{lib-esm → dist}/contract/model/shared/loose-object.model.d.ts +0 -0
  24. package/dist/feedback-list.js +107 -0
  25. package/dist/feedback-list.js.map +1 -0
  26. package/{lib-esm → dist}/helper/chat.helper.d.ts +0 -0
  27. package/{lib-esm → dist}/helper/http.helper.d.ts +1 -1
  28. package/{lib-esm → dist}/helper/middleware.helper.d.ts +1 -1
  29. package/{lib → dist}/helper/store.helper.d.ts +4 -3
  30. package/{lib-esm → dist}/index.d.ts +0 -0
  31. package/dist/index.js +1174 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/interface/entry.interface.d.ts +23 -0
  34. package/{lib-esm → dist}/interface/middleware/paging.interface.d.ts +0 -0
  35. package/{lib-esm → dist}/interface/middleware/processor.interface.d.ts +0 -0
  36. package/dist/no-good-alternative.js +33 -0
  37. package/dist/no-good-alternative.js.map +1 -0
  38. package/dist/plugin.d.ts +3 -0
  39. package/dist/ui/feedback-list.d.ts +8 -0
  40. package/dist/ui/no-good-alternative.d.ts +6 -0
  41. package/dist/utils.d.ts +2 -0
  42. package/package.json +44 -45
  43. package/lib/client/chat.client.d.ts +0 -15
  44. package/lib/client/chat.client.js +0 -80
  45. package/lib/client/contact-method.client.d.ts +0 -22
  46. package/lib/client/contact-method.client.js +0 -276
  47. package/lib/client/http.client.d.ts +0 -22
  48. package/lib/client/http.client.js +0 -114
  49. package/lib/client/middleware.client.js +0 -60
  50. package/lib/contract/custom-component/contact-method-item.js +0 -76
  51. package/lib/contract/custom-component/contact-method-list.d.ts +0 -7
  52. package/lib/contract/custom-component/contact-method-list.js +0 -41
  53. package/lib/contract/custom-component/contact-method.d.ts +0 -3
  54. package/lib/contract/custom-component/contact-method.js +0 -38
  55. package/lib/contract/enum/server-entry-type.enum.js +0 -10
  56. package/lib/contract/model/conversation-api-model/list.model.d.ts +0 -5
  57. package/lib/contract/model/conversation-api-model/list.model.js +0 -2
  58. package/lib/contract/model/conversation-api-model/message.model.d.ts +0 -7
  59. package/lib/contract/model/conversation-api-model/message.model.js +0 -2
  60. package/lib/contract/model/http/action.model.d.ts +0 -3
  61. package/lib/contract/model/http/action.model.js +0 -2
  62. package/lib/contract/model/http/client-action.model.d.ts +0 -4
  63. package/lib/contract/model/http/client-action.model.js +0 -3
  64. package/lib/contract/model/http/client-envelope.model.d.ts +0 -9
  65. package/lib/contract/model/http/client-envelope.model.js +0 -2
  66. package/lib/contract/model/http/connect-options.model.d.ts +0 -5
  67. package/lib/contract/model/http/connect-options.model.js +0 -2
  68. package/lib/contract/model/http/global-state.model.d.ts +0 -8
  69. package/lib/contract/model/http/global-state.model.js +0 -2
  70. package/lib/contract/model/http/http-client-options.model.d.ts +0 -5
  71. package/lib/contract/model/http/http-client-options.model.js +0 -2
  72. package/lib/contract/model/http/server-entry.model.d.ts +0 -11
  73. package/lib/contract/model/http/server-entry.model.js +0 -2
  74. package/lib/contract/model/http/server-envelope.model.d.ts +0 -10
  75. package/lib/contract/model/http/server-envelope.model.js +0 -2
  76. package/lib/contract/model/middleware/aggregator-state.model.d.ts +0 -4
  77. package/lib/contract/model/middleware/aggregator-state.model.js +0 -3
  78. package/lib/contract/model/shared/loose-object.model.d.ts +0 -3
  79. package/lib/contract/model/shared/loose-object.model.js +0 -2
  80. package/lib/helper/chat.helper.d.ts +0 -8
  81. package/lib/helper/chat.helper.js +0 -21
  82. package/lib/helper/http.helper.d.ts +0 -13
  83. package/lib/helper/http.helper.js +0 -33
  84. package/lib/helper/middleware.helper.d.ts +0 -12
  85. package/lib/helper/middleware.helper.js +0 -72
  86. package/lib/helper/store.helper.js +0 -80
  87. package/lib/index.d.ts +0 -2
  88. package/lib/index.js +0 -8
  89. package/lib/interface/entry.interface.d.ts +0 -17
  90. package/lib/interface/entry.interface.js +0 -138
  91. package/lib/interface/middleware/contact-expanded.interface.d.ts +0 -0
  92. package/lib/interface/middleware/contact-expanded.interface.js +0 -50
  93. package/lib/interface/middleware/legacy-contact-methods.interface.d.ts +0 -0
  94. package/lib/interface/middleware/legacy-contact-methods.interface.js +0 -394
  95. package/lib/interface/middleware/paging.interface.d.ts +0 -4
  96. package/lib/interface/middleware/paging.interface.js +0 -55
  97. package/lib/interface/middleware/processor.interface.d.ts +0 -10
  98. package/lib/interface/middleware/processor.interface.js +0 -120
  99. package/lib/plugin.d.ts +0 -3
  100. package/lib/plugin.js +0 -172
  101. package/lib-esm/client/chat.client.js +0 -75
  102. package/lib-esm/client/contact-method.client.js +0 -270
  103. package/lib-esm/client/http.client.d.ts +0 -22
  104. package/lib-esm/client/http.client.js +0 -108
  105. package/lib-esm/client/middleware.client.d.ts +0 -13
  106. package/lib-esm/client/middleware.client.js +0 -55
  107. package/lib-esm/contract/custom-component/contact-method-item.d.ts +0 -8
  108. package/lib-esm/contract/custom-component/contact-method-item.js +0 -51
  109. package/lib-esm/contract/custom-component/contact-method-list.js +0 -13
  110. package/lib-esm/contract/custom-component/contact-method.js +0 -33
  111. package/lib-esm/contract/enum/server-entry-type.enum.d.ts +0 -6
  112. package/lib-esm/contract/enum/server-entry-type.enum.js +0 -7
  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.js +0 -1
  116. package/lib-esm/contract/model/http/client-action.model.js +0 -2
  117. package/lib-esm/contract/model/http/client-envelope.model.js +0 -1
  118. package/lib-esm/contract/model/http/connect-options.model.js +0 -1
  119. package/lib-esm/contract/model/http/global-state.model.js +0 -1
  120. package/lib-esm/contract/model/http/http-client-options.model.js +0 -1
  121. package/lib-esm/contract/model/http/server-entry.model.js +0 -1
  122. package/lib-esm/contract/model/http/server-envelope.model.js +0 -1
  123. package/lib-esm/contract/model/middleware/aggregator-state.model.js +0 -2
  124. package/lib-esm/contract/model/shared/loose-object.model.js +0 -1
  125. package/lib-esm/helper/chat.helper.js +0 -18
  126. package/lib-esm/helper/http.helper.js +0 -30
  127. package/lib-esm/helper/middleware.helper.js +0 -69
  128. package/lib-esm/helper/store.helper.d.ts +0 -22
  129. package/lib-esm/helper/store.helper.js +0 -77
  130. package/lib-esm/index.js +0 -2
  131. package/lib-esm/interface/entry.interface.d.ts +0 -17
  132. package/lib-esm/interface/entry.interface.js +0 -136
  133. package/lib-esm/interface/middleware/paging.interface.js +0 -53
  134. package/lib-esm/interface/middleware/processor.interface.js +0 -118
  135. package/lib-esm/plugin.d.ts +0 -3
  136. 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 initialize(dataClient: DataClient, contactMethodPlatform: ContactMethodPlatform, agent: any): void;
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
- private loadContactMethods;
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(input: string, endpoint: string): void;
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,W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,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;;"}
@@ -2,7 +2,10 @@ import React from 'react';
2
2
  interface PropsType {
3
3
  contactMethod: any;
4
4
  type: any;
5
+ expanded?: boolean;
5
6
  className?: any;
7
+ entry?: any;
8
+ embeded: boolean;
6
9
  }
7
10
  declare const ContactMethodItem: React.FC<PropsType>;
8
11
  export default ContactMethodItem;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  interface PropsType {
3
+ embeded: boolean;
3
4
  contactMethodList: any;
4
5
  type: any;
5
6
  }
@@ -0,0 +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,6 +1,7 @@
1
1
  export declare enum ServerEntryTypeEnum {
2
2
  Widget = 0,
3
3
  Text = 1,
4
- List = 2,
5
- Error = 3
4
+ Contact = 2,
5
+ List = 3,
6
+ Error = 4
6
7
  }
@@ -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":";;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E,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
@@ -3,7 +3,7 @@ export declare class HttpHelper {
3
3
  method: string;
4
4
  headers: {
5
5
  Accept: string;
6
- "Content-Type": string;
6
+ 'Content-Type': string;
7
7
  };
8
8
  };
9
9
  static combineUrl(basePath: string, path: string): string;
@@ -1,4 +1,4 @@
1
- import { Message } from "../contract/model/conversation-api-model/message.model";
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
- private static insertMessageToStore;
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