@telia-ace/knowledge-widget-bot-provider 0.0.1-alpha.46 → 0.0.1-alpha.47
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/{lib-esm → dist}/client/chat.client.d.ts +0 -0
- package/{lib-esm → dist}/client/contact-method.client.d.ts +0 -0
- package/{lib-esm → dist}/client/http.client.d.ts +0 -0
- package/{lib-esm → dist}/client/middleware.client.d.ts +0 -0
- package/dist/contact-method.js +102 -0
- package/dist/contact-method.js.map +1 -0
- package/{lib-esm → dist}/contract/custom-component/contact-method-item.d.ts +0 -0
- package/{lib-esm → dist}/contract/custom-component/contact-method-list.d.ts +0 -0
- package/{lib-esm → dist}/contract/custom-component/contact-method.d.ts +0 -0
- package/{lib-esm → dist}/contract/custom-component/entry-context.d.ts +0 -0
- package/{lib-esm → dist}/contract/enum/server-entry-type.enum.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/conversation-api-model/list.model.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/conversation-api-model/message.model.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/http/action.model.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/http/client-action.model.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/http/client-envelope.model.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/http/connect-options.model.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/http/global-state.model.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/http/http-client-options.model.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/http/server-entry.model.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/http/server-envelope.model.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/middleware/aggregator-state.model.d.ts +0 -0
- package/{lib-esm → dist}/contract/model/shared/loose-object.model.d.ts +0 -0
- package/{lib-esm → dist}/helper/chat.helper.d.ts +0 -0
- package/{lib-esm → dist}/helper/http.helper.d.ts +0 -0
- package/{lib-esm → dist}/helper/middleware.helper.d.ts +0 -0
- package/{lib-esm → dist}/helper/store.helper.d.ts +0 -0
- package/{lib-esm → dist}/index.d.ts +0 -0
- package/dist/index.js +1131 -0
- package/dist/index.js.map +1 -0
- package/{lib-esm → dist}/interface/entry.interface.d.ts +0 -0
- package/{lib-esm → dist}/interface/middleware/paging.interface.d.ts +0 -0
- package/{lib-esm → dist}/interface/middleware/processor.interface.d.ts +0 -0
- package/{lib-esm → dist}/plugin.d.ts +0 -0
- package/{lib-esm → dist}/utils.d.ts +0 -0
- package/package.json +14 -15
- package/lib/client/chat.client.d.ts +0 -16
- package/lib/client/chat.client.js +0 -145
- package/lib/client/contact-method.client.d.ts +0 -34
- package/lib/client/contact-method.client.js +0 -337
- package/lib/client/http.client.d.ts +0 -26
- package/lib/client/http.client.js +0 -211
- package/lib/client/middleware.client.d.ts +0 -14
- package/lib/client/middleware.client.js +0 -125
- package/lib/contract/custom-component/contact-method-item.d.ts +0 -9
- package/lib/contract/custom-component/contact-method-item.js +0 -34
- package/lib/contract/custom-component/contact-method-list.d.ts +0 -7
- package/lib/contract/custom-component/contact-method-list.js +0 -13
- package/lib/contract/custom-component/contact-method.d.ts +0 -3
- package/lib/contract/custom-component/contact-method.js +0 -35
- package/lib/contract/custom-component/entry-context.d.ts +0 -5
- package/lib/contract/custom-component/entry-context.js +0 -4
- package/lib/contract/enum/server-entry-type.enum.d.ts +0 -7
- package/lib/contract/enum/server-entry-type.enum.js +0 -8
- package/lib/contract/model/conversation-api-model/list.model.d.ts +0 -5
- package/lib/contract/model/conversation-api-model/list.model.js +0 -1
- package/lib/contract/model/conversation-api-model/message.model.d.ts +0 -7
- package/lib/contract/model/conversation-api-model/message.model.js +0 -1
- package/lib/contract/model/http/action.model.d.ts +0 -3
- package/lib/contract/model/http/action.model.js +0 -1
- package/lib/contract/model/http/client-action.model.d.ts +0 -4
- package/lib/contract/model/http/client-action.model.js +0 -2
- package/lib/contract/model/http/client-envelope.model.d.ts +0 -9
- package/lib/contract/model/http/client-envelope.model.js +0 -1
- package/lib/contract/model/http/connect-options.model.d.ts +0 -5
- package/lib/contract/model/http/connect-options.model.js +0 -1
- package/lib/contract/model/http/global-state.model.d.ts +0 -8
- package/lib/contract/model/http/global-state.model.js +0 -1
- package/lib/contract/model/http/http-client-options.model.d.ts +0 -5
- package/lib/contract/model/http/http-client-options.model.js +0 -1
- package/lib/contract/model/http/server-entry.model.d.ts +0 -11
- package/lib/contract/model/http/server-entry.model.js +0 -1
- package/lib/contract/model/http/server-envelope.model.d.ts +0 -10
- package/lib/contract/model/http/server-envelope.model.js +0 -1
- package/lib/contract/model/middleware/aggregator-state.model.d.ts +0 -4
- package/lib/contract/model/middleware/aggregator-state.model.js +0 -2
- package/lib/contract/model/shared/loose-object.model.d.ts +0 -3
- package/lib/contract/model/shared/loose-object.model.js +0 -1
- package/lib/helper/chat.helper.d.ts +0 -8
- package/lib/helper/chat.helper.js +0 -18
- package/lib/helper/http.helper.d.ts +0 -13
- package/lib/helper/http.helper.js +0 -28
- package/lib/helper/middleware.helper.d.ts +0 -12
- package/lib/helper/middleware.helper.js +0 -68
- package/lib/helper/store.helper.d.ts +0 -23
- package/lib/helper/store.helper.js +0 -169
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -2
- package/lib/interface/entry.interface.d.ts +0 -20
- package/lib/interface/entry.interface.js +0 -306
- package/lib/interface/middleware/paging.interface.d.ts +0 -4
- package/lib/interface/middleware/paging.interface.js +0 -53
- package/lib/interface/middleware/processor.interface.d.ts +0 -10
- package/lib/interface/middleware/processor.interface.js +0 -118
- package/lib/plugin.d.ts +0 -3
- package/lib/plugin.js +0 -154
- package/lib/utils.d.ts +0 -2
- package/lib/utils.js +0 -79
- package/lib-esm/client/chat.client.js +0 -145
- package/lib-esm/client/contact-method.client.js +0 -337
- package/lib-esm/client/http.client.js +0 -211
- package/lib-esm/client/middleware.client.js +0 -125
- package/lib-esm/contract/custom-component/contact-method-item.js +0 -34
- package/lib-esm/contract/custom-component/contact-method-list.js +0 -13
- package/lib-esm/contract/custom-component/contact-method.js +0 -35
- package/lib-esm/contract/custom-component/entry-context.js +0 -4
- package/lib-esm/contract/enum/server-entry-type.enum.js +0 -8
- package/lib-esm/contract/model/conversation-api-model/list.model.js +0 -1
- package/lib-esm/contract/model/conversation-api-model/message.model.js +0 -1
- package/lib-esm/contract/model/http/action.model.js +0 -1
- package/lib-esm/contract/model/http/client-action.model.js +0 -2
- package/lib-esm/contract/model/http/client-envelope.model.js +0 -1
- package/lib-esm/contract/model/http/connect-options.model.js +0 -1
- package/lib-esm/contract/model/http/global-state.model.js +0 -1
- package/lib-esm/contract/model/http/http-client-options.model.js +0 -1
- package/lib-esm/contract/model/http/server-entry.model.js +0 -1
- package/lib-esm/contract/model/http/server-envelope.model.js +0 -1
- package/lib-esm/contract/model/middleware/aggregator-state.model.js +0 -2
- package/lib-esm/contract/model/shared/loose-object.model.js +0 -1
- package/lib-esm/helper/chat.helper.js +0 -18
- package/lib-esm/helper/http.helper.js +0 -28
- package/lib-esm/helper/middleware.helper.js +0 -68
- package/lib-esm/helper/store.helper.js +0 -169
- package/lib-esm/index.js +0 -2
- package/lib-esm/interface/entry.interface.js +0 -306
- package/lib-esm/interface/middleware/paging.interface.js +0 -53
- package/lib-esm/interface/middleware/processor.interface.js +0 -118
- package/lib-esm/plugin.js +0 -154
- package/lib-esm/utils.js +0 -79
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -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';\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}\r\n\r\nconst ContactMethodItem: React.FC<PropsType> = ({ contactMethod, className }) => {\r\n const dispatch = useDispatch();\r\n const { entryId } = useContext(EntryContext);\r\n\r\n return (\r\n <GenericContactMethod\r\n className={className}\r\n onClick={(event: React.MouseEvent) => {\r\n if (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 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 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 <StyledContactMethodItem type={type} contactMethod={methodList} />;\r\n }\r\n\r\n return (\r\n <EntryContext.Provider value={props.entry}>\r\n <ContactMethodList type={type} contactMethodList={methodList} />\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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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;;"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|