@telia-ace/widget-conversation 0.0.1
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/agent.d.ts +22 -0
- package/components/conversation/conversation.d.ts +7 -0
- package/components/conversation/plugin.d.ts +48 -0
- package/components/conversation/ui/content.d.ts +3 -0
- package/components/conversation/ui/input.d.ts +7 -0
- package/components/conversation/ui/language-context.d.ts +3 -0
- package/components/conversation/ui/loader.d.ts +10 -0
- package/components/conversation/ui/message-list-items/button-list.d.ts +9 -0
- package/components/conversation/ui/message-list-items/custom.d.ts +10 -0
- package/components/conversation/ui/message-list-items/html.d.ts +6 -0
- package/components/conversation/ui/message-list-items/item-list.d.ts +9 -0
- package/components/conversation/ui/message-list-items/link-list.d.ts +9 -0
- package/components/conversation/ui/message-list-items/separator.d.ts +3 -0
- package/components/conversation/ui/message-list-items/text.d.ts +7 -0
- package/components/conversation/ui/message-list-items/video-request.d.ts +9 -0
- package/components/conversation/ui/message-types/agent.d.ts +12 -0
- package/components/conversation/ui/message-types/index.d.ts +4 -0
- package/components/conversation/ui/message-types/message-list.d.ts +10 -0
- package/components/conversation/ui/message-types/system.d.ts +16 -0
- package/components/conversation/ui/message-types/timestamp.d.ts +10 -0
- package/components/conversation/ui/message-types/user.d.ts +9 -0
- package/components/conversation/ui/message.d.ts +6 -0
- package/components/conversation/ui/overlay-outlets.d.ts +14 -0
- package/components/conversation/ui/skip-link.d.ts +4 -0
- package/components/conversation/ui/styles.d.ts +62 -0
- package/components/return-button/plugin.d.ts +19 -0
- package/components/return-button/return-button.d.ts +7 -0
- package/conversation-3787f6ba.mjs +1619 -0
- package/conversation-92e4cb62.js +623 -0
- package/conversation-controller.d.ts +122 -0
- package/conversation-history.d.ts +27 -0
- package/conversation-platform.d.ts +55 -0
- package/conversation-provider.d.ts +34 -0
- package/index.d.ts +13 -0
- package/index.js +3 -0
- package/index.mjs +1086 -0
- package/package.json +27 -0
- package/return-button-3e542ab7.mjs +154 -0
- package/return-button-f1f43984.js +97 -0
- package/store.d.ts +33 -0
- package/types.d.ts +130 -0
- package/user.d.ts +10 -0
- package/utils/custom-message.d.ts +4 -0
- package/utils/index.d.ts +1 -0
- package/utils/map-actions.d.ts +1 -0
- package/utils/open-chat-widget.d.ts +5 -0
- package/utils/swap-provider.d.ts +9 -0
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@telia-ace/widget-conversation",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "./index.js",
|
|
5
|
+
"types": "./index.d.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./index.mjs",
|
|
9
|
+
"require": "./index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@telia-ace/widget-core": "*",
|
|
14
|
+
"@telia-ace/widget-forms": "*",
|
|
15
|
+
"@telia-ace/widget-plugins": "*",
|
|
16
|
+
"@telia-ace/widget-routing": "*",
|
|
17
|
+
"@telia-ace/widget-services": "*",
|
|
18
|
+
"@telia-ace/widget-ui": "*",
|
|
19
|
+
"@telia-ace/widget-utilities": "*",
|
|
20
|
+
"@webprovisions/platform": "^1.1.4"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"@emotion/styled": "11.11.0",
|
|
24
|
+
"react": "18.2.0",
|
|
25
|
+
"@emotion/react": "11.11.1"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { jsxs as h, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { keyframes as s, css as l } from "@emotion/react";
|
|
3
|
+
import n from "@emotion/styled";
|
|
4
|
+
import { useProperties as u, useDispatch as b, SymbolBadge as p, Button as y, borderTabStyle as $ } from "@telia-ace/widget-ui";
|
|
5
|
+
const I = ({ className: e, ...t }) => {
|
|
6
|
+
const {
|
|
7
|
+
label: o,
|
|
8
|
+
active: r,
|
|
9
|
+
mode: c = "flat",
|
|
10
|
+
alert: d = {}
|
|
11
|
+
} = u(), { symbol: i, label: m, show: g } = d, f = b();
|
|
12
|
+
return r ? /* @__PURE__ */ h(
|
|
13
|
+
j,
|
|
14
|
+
{
|
|
15
|
+
className: e,
|
|
16
|
+
mode: c,
|
|
17
|
+
"aria-label": o,
|
|
18
|
+
onClick: () => {
|
|
19
|
+
f("toggle");
|
|
20
|
+
},
|
|
21
|
+
children: [
|
|
22
|
+
/* @__PURE__ */ a(A, { children: o }),
|
|
23
|
+
i && /* @__PURE__ */ a(w, { showAlert: g, children: /* @__PURE__ */ a(
|
|
24
|
+
p,
|
|
25
|
+
{
|
|
26
|
+
symbol: i,
|
|
27
|
+
title: m,
|
|
28
|
+
size: 20
|
|
29
|
+
}
|
|
30
|
+
) })
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
) : null;
|
|
34
|
+
}, k = (e) => {
|
|
35
|
+
var t, o, r;
|
|
36
|
+
return s`
|
|
37
|
+
0% {
|
|
38
|
+
background-color: ${(t = e.theme.colors) == null ? void 0 : t.primary};
|
|
39
|
+
}
|
|
40
|
+
50% {
|
|
41
|
+
background-color: ${(o = e.theme.colors) == null ? void 0 : o.accent};
|
|
42
|
+
}
|
|
43
|
+
100 {
|
|
44
|
+
background-color: ${(r = e.theme.colors) == null ? void 0 : r.primary};
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
}, x = s`
|
|
48
|
+
0% {
|
|
49
|
+
background-position:0% 51%
|
|
50
|
+
}
|
|
51
|
+
50% {
|
|
52
|
+
background-position:100% 0%
|
|
53
|
+
}
|
|
54
|
+
100% {
|
|
55
|
+
background-position:0% 51%
|
|
56
|
+
}
|
|
57
|
+
`, S = s`
|
|
58
|
+
0% {
|
|
59
|
+
transform: rotate(0deg) scale(1.00);
|
|
60
|
+
}
|
|
61
|
+
50% {
|
|
62
|
+
transform: rotate(0deg) scale(1.00);
|
|
63
|
+
}
|
|
64
|
+
55% {
|
|
65
|
+
transform: rotate(-3deg) scale(0.80);
|
|
66
|
+
}
|
|
67
|
+
60% {
|
|
68
|
+
transform: rotate(-3deg) scale(0.80);
|
|
69
|
+
}
|
|
70
|
+
65% {
|
|
71
|
+
transform: rotate(3deg) scale(1.20);
|
|
72
|
+
}
|
|
73
|
+
70% {
|
|
74
|
+
transform: rotate(-3deg) scale(1.20);
|
|
75
|
+
}
|
|
76
|
+
75% {
|
|
77
|
+
transform: rotate(3deg) scale(1.20);
|
|
78
|
+
}
|
|
79
|
+
80% {
|
|
80
|
+
transform: rotate(-3deg) scale(1.20);
|
|
81
|
+
}
|
|
82
|
+
85% {
|
|
83
|
+
transform: rotate(3deg) scale(1.20);
|
|
84
|
+
}
|
|
85
|
+
90% {
|
|
86
|
+
transform: rotate(-3deg) scale(1.20);
|
|
87
|
+
}
|
|
88
|
+
95% {
|
|
89
|
+
transform: rotate(3deg) scale(1.20);
|
|
90
|
+
}
|
|
91
|
+
100% {
|
|
92
|
+
transform: rotate(0deg) scale(1);
|
|
93
|
+
}
|
|
94
|
+
`, w = n.span`
|
|
95
|
+
flex-grow: 0;
|
|
96
|
+
transform: translateX(${(e) => e.showAlert ? "0px" : "50px"});
|
|
97
|
+
opacity: ${(e) => e.showAlert ? 1 : 0};
|
|
98
|
+
transition: transform 0.5s ease, opacity 0.3s ease;
|
|
99
|
+
`, A = n.span`
|
|
100
|
+
flex: 1;
|
|
101
|
+
font-weight: 300;
|
|
102
|
+
`, v = (e) => l`
|
|
103
|
+
animation: ${k(e)} 1s ease infinite;
|
|
104
|
+
`, B = (e) => {
|
|
105
|
+
var t, o;
|
|
106
|
+
return l`
|
|
107
|
+
background: linear-gradient(
|
|
108
|
+
155deg,
|
|
109
|
+
${(t = e.theme.colors) == null ? void 0 : t.primary},
|
|
110
|
+
${(o = e.theme.colors) == null ? void 0 : o.accent}
|
|
111
|
+
);
|
|
112
|
+
background-position: 0px 0px;
|
|
113
|
+
background-size: 200% 200%;
|
|
114
|
+
animation: ${x} 1.5s ease infinite;
|
|
115
|
+
`;
|
|
116
|
+
}, j = n(y)`
|
|
117
|
+
overflow: hidden;
|
|
118
|
+
padding: ${(e) => {
|
|
119
|
+
var t;
|
|
120
|
+
return (t = e.theme.sizes) == null ? void 0 : t.large;
|
|
121
|
+
}};
|
|
122
|
+
border-radius: ${(e) => e.theme.borderRadius};
|
|
123
|
+
color: ${(e) => {
|
|
124
|
+
var t;
|
|
125
|
+
return (t = e.theme.colors) == null ? void 0 : t.text;
|
|
126
|
+
}};
|
|
127
|
+
${(e) => e.mode === "flashing" ? v : e.mode === "flashingGradient" ? B : ""}
|
|
128
|
+
background-color: ${(e) => {
|
|
129
|
+
var t;
|
|
130
|
+
return (t = e.theme.colors) == null ? void 0 : t.primary;
|
|
131
|
+
}};
|
|
132
|
+
display: flex;
|
|
133
|
+
align-items: center;
|
|
134
|
+
justify-content: center;
|
|
135
|
+
i,
|
|
136
|
+
svg {
|
|
137
|
+
animation: ${S} 3s ease infinite;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&:focus-visible {
|
|
141
|
+
${(e) => $(e)}
|
|
142
|
+
background: ${(e) => {
|
|
143
|
+
var t;
|
|
144
|
+
return (t = e.theme.colors) == null ? void 0 : t.text;
|
|
145
|
+
}};
|
|
146
|
+
color: ${(e) => {
|
|
147
|
+
var t;
|
|
148
|
+
return (t = e.theme.colors) == null ? void 0 : t.primary;
|
|
149
|
+
}};
|
|
150
|
+
}
|
|
151
|
+
`;
|
|
152
|
+
export {
|
|
153
|
+
I as default
|
|
154
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),a=require("@emotion/react"),i=require("@emotion/styled"),r=require("@telia-ace/widget-ui"),u=({className:e,...t})=>{const{label:o,active:s,mode:c="flat",alert:d={}}=r.useProperties(),{symbol:l,label:g,show:m}=d,f=r.useDispatch();return s?n.jsxs(S,{className:e,mode:c,"aria-label":o,onClick:()=>{f("toggle")},children:[n.jsx(p,{children:o}),l&&n.jsx($,{showAlert:m,children:n.jsx(r.SymbolBadge,{symbol:l,title:g,size:20})})]}):null},h=e=>{var t,o,s;return a.keyframes`
|
|
2
|
+
0% {
|
|
3
|
+
background-color: ${(t=e.theme.colors)==null?void 0:t.primary};
|
|
4
|
+
}
|
|
5
|
+
50% {
|
|
6
|
+
background-color: ${(o=e.theme.colors)==null?void 0:o.accent};
|
|
7
|
+
}
|
|
8
|
+
100 {
|
|
9
|
+
background-color: ${(s=e.theme.colors)==null?void 0:s.primary};
|
|
10
|
+
}
|
|
11
|
+
`},b=a.keyframes`
|
|
12
|
+
0% {
|
|
13
|
+
background-position:0% 51%
|
|
14
|
+
}
|
|
15
|
+
50% {
|
|
16
|
+
background-position:100% 0%
|
|
17
|
+
}
|
|
18
|
+
100% {
|
|
19
|
+
background-position:0% 51%
|
|
20
|
+
}
|
|
21
|
+
`,y=a.keyframes`
|
|
22
|
+
0% {
|
|
23
|
+
transform: rotate(0deg) scale(1.00);
|
|
24
|
+
}
|
|
25
|
+
50% {
|
|
26
|
+
transform: rotate(0deg) scale(1.00);
|
|
27
|
+
}
|
|
28
|
+
55% {
|
|
29
|
+
transform: rotate(-3deg) scale(0.80);
|
|
30
|
+
}
|
|
31
|
+
60% {
|
|
32
|
+
transform: rotate(-3deg) scale(0.80);
|
|
33
|
+
}
|
|
34
|
+
65% {
|
|
35
|
+
transform: rotate(3deg) scale(1.20);
|
|
36
|
+
}
|
|
37
|
+
70% {
|
|
38
|
+
transform: rotate(-3deg) scale(1.20);
|
|
39
|
+
}
|
|
40
|
+
75% {
|
|
41
|
+
transform: rotate(3deg) scale(1.20);
|
|
42
|
+
}
|
|
43
|
+
80% {
|
|
44
|
+
transform: rotate(-3deg) scale(1.20);
|
|
45
|
+
}
|
|
46
|
+
85% {
|
|
47
|
+
transform: rotate(3deg) scale(1.20);
|
|
48
|
+
}
|
|
49
|
+
90% {
|
|
50
|
+
transform: rotate(-3deg) scale(1.20);
|
|
51
|
+
}
|
|
52
|
+
95% {
|
|
53
|
+
transform: rotate(3deg) scale(1.20);
|
|
54
|
+
}
|
|
55
|
+
100% {
|
|
56
|
+
transform: rotate(0deg) scale(1);
|
|
57
|
+
}
|
|
58
|
+
`,$=i.span`
|
|
59
|
+
flex-grow: 0;
|
|
60
|
+
transform: translateX(${e=>e.showAlert?"0px":"50px"});
|
|
61
|
+
opacity: ${e=>e.showAlert?1:0};
|
|
62
|
+
transition: transform 0.5s ease, opacity 0.3s ease;
|
|
63
|
+
`,p=i.span`
|
|
64
|
+
flex: 1;
|
|
65
|
+
font-weight: 300;
|
|
66
|
+
`,k=e=>a.css`
|
|
67
|
+
animation: ${h(e)} 1s ease infinite;
|
|
68
|
+
`,x=e=>{var t,o;return a.css`
|
|
69
|
+
background: linear-gradient(
|
|
70
|
+
155deg,
|
|
71
|
+
${(t=e.theme.colors)==null?void 0:t.primary},
|
|
72
|
+
${(o=e.theme.colors)==null?void 0:o.accent}
|
|
73
|
+
);
|
|
74
|
+
background-position: 0px 0px;
|
|
75
|
+
background-size: 200% 200%;
|
|
76
|
+
animation: ${b} 1.5s ease infinite;
|
|
77
|
+
`},S=i(r.Button)`
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
padding: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.large}};
|
|
80
|
+
border-radius: ${e=>e.theme.borderRadius};
|
|
81
|
+
color: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.text}};
|
|
82
|
+
${e=>e.mode==="flashing"?k:e.mode==="flashingGradient"?x:""}
|
|
83
|
+
background-color: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.primary}};
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
i,
|
|
88
|
+
svg {
|
|
89
|
+
animation: ${y} 3s ease infinite;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&:focus-visible {
|
|
93
|
+
${e=>r.borderTabStyle(e)}
|
|
94
|
+
background: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.text}};
|
|
95
|
+
color: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.primary}};
|
|
96
|
+
}
|
|
97
|
+
`;exports.default=u;
|
package/store.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Container } from '@webprovisions/platform';
|
|
2
|
+
import { AgentSettings } from './agent';
|
|
3
|
+
import { ConversationController } from './conversation-controller';
|
|
4
|
+
|
|
5
|
+
type StoredConversationAgent = {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
avatar?: string;
|
|
9
|
+
providerName: string;
|
|
10
|
+
};
|
|
11
|
+
type StoredConversationMessage = any;
|
|
12
|
+
type StoredConversation = {
|
|
13
|
+
agents: StoredConversationAgent[];
|
|
14
|
+
messages: StoredConversationMessage[];
|
|
15
|
+
};
|
|
16
|
+
export declare const createSessionStorageKey: (id: string) => string;
|
|
17
|
+
declare class Store {
|
|
18
|
+
private container;
|
|
19
|
+
private conversation;
|
|
20
|
+
private enabled;
|
|
21
|
+
private sessionStorageKey;
|
|
22
|
+
private locker;
|
|
23
|
+
private initialStoredAgents;
|
|
24
|
+
constructor(container: Container, conversation: ConversationController, enabled: boolean);
|
|
25
|
+
setInitialData(data: {
|
|
26
|
+
agents: AgentSettings[];
|
|
27
|
+
}): void;
|
|
28
|
+
isRehydrated(): Promise<boolean>;
|
|
29
|
+
getStoredAgent(agentId: string): StoredConversationAgent | undefined;
|
|
30
|
+
write(data: any, type: 'messages' | 'agents', action?: 'add' | 'update'): Promise<void>;
|
|
31
|
+
read(): Promise<StoredConversation>;
|
|
32
|
+
}
|
|
33
|
+
export default Store;
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { Form, FormBuilder } from '../../forms/src/index.ts';
|
|
2
|
+
import { Symbol } from '../../ui/src/index.ts';
|
|
3
|
+
|
|
4
|
+
export type ConversationMessageSettings = {
|
|
5
|
+
key?: string;
|
|
6
|
+
timestamp?: number;
|
|
7
|
+
title?: string;
|
|
8
|
+
body?: string;
|
|
9
|
+
actions?: {
|
|
10
|
+
[actionKey: string]: any;
|
|
11
|
+
};
|
|
12
|
+
form?: (builder: FormBuilder) => void;
|
|
13
|
+
type?: string;
|
|
14
|
+
items?: ConversationMessageList[];
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
};
|
|
17
|
+
export type NormalizedMessageSettings = {
|
|
18
|
+
content: ConversationMessageContent;
|
|
19
|
+
key: string;
|
|
20
|
+
timestamp: number | null;
|
|
21
|
+
};
|
|
22
|
+
export type ConversationMessageList = {
|
|
23
|
+
header?: string;
|
|
24
|
+
itemKey: string;
|
|
25
|
+
type?: ConversationMessageListType;
|
|
26
|
+
items: ConversationMessageListItem[];
|
|
27
|
+
};
|
|
28
|
+
export type ConversationMessageListItem = {
|
|
29
|
+
icon?: string;
|
|
30
|
+
type?: ConversationMessageListItemType;
|
|
31
|
+
actions?: {
|
|
32
|
+
[actionKey: string]: any;
|
|
33
|
+
};
|
|
34
|
+
form?: Form;
|
|
35
|
+
body?: string;
|
|
36
|
+
key: string;
|
|
37
|
+
[key: string]: any;
|
|
38
|
+
};
|
|
39
|
+
export type ConversationMessageContent = {
|
|
40
|
+
title?: string;
|
|
41
|
+
body?: string;
|
|
42
|
+
actions?: {
|
|
43
|
+
[actionKey: string]: any;
|
|
44
|
+
};
|
|
45
|
+
items?: ConverstationMessageItem<any>[];
|
|
46
|
+
form?: Form;
|
|
47
|
+
[key: string]: any;
|
|
48
|
+
};
|
|
49
|
+
export type ConverstationMessageItem<T, R = ItemPayload> = R extends [T, any] ? R : never;
|
|
50
|
+
export type ConversationMessageUpdateSettings = ConversationMessageContent & {
|
|
51
|
+
timestamp?: number;
|
|
52
|
+
};
|
|
53
|
+
export type ConversationMessageSender = {
|
|
54
|
+
name?: string;
|
|
55
|
+
avatar?: string | Symbol;
|
|
56
|
+
id?: string;
|
|
57
|
+
};
|
|
58
|
+
export declare enum ConversationMessageListType {
|
|
59
|
+
Ordinary = "ordinary",
|
|
60
|
+
Seperator = "seperator"
|
|
61
|
+
}
|
|
62
|
+
export declare enum ConversationMessageListItemType {
|
|
63
|
+
LinkList = "link-list",
|
|
64
|
+
Separator = "separator",
|
|
65
|
+
ButtonList = "button-list",
|
|
66
|
+
ItemList = "item-list",
|
|
67
|
+
Text = "text",
|
|
68
|
+
HTML = "html",
|
|
69
|
+
VideoRequest = "video-request"
|
|
70
|
+
}
|
|
71
|
+
export type LinkListProperties = {
|
|
72
|
+
header?: string;
|
|
73
|
+
actions: {
|
|
74
|
+
[key: string]: string;
|
|
75
|
+
} | {
|
|
76
|
+
label: string;
|
|
77
|
+
actionKey: string;
|
|
78
|
+
data: any;
|
|
79
|
+
}[];
|
|
80
|
+
};
|
|
81
|
+
type LinkListItem = [
|
|
82
|
+
ConversationMessageListItemType.LinkList,
|
|
83
|
+
LinkListProperties
|
|
84
|
+
];
|
|
85
|
+
type TextItem = [ConversationMessageListItemType.Text, string];
|
|
86
|
+
type SeparatorItem = [ConversationMessageListItemType.Separator, undefined];
|
|
87
|
+
export type ButtonListProperties = {
|
|
88
|
+
header?: string;
|
|
89
|
+
actions: {
|
|
90
|
+
[key: string]: string;
|
|
91
|
+
} | {
|
|
92
|
+
label: string;
|
|
93
|
+
actionKey: string;
|
|
94
|
+
data: any;
|
|
95
|
+
}[];
|
|
96
|
+
tags?: string[];
|
|
97
|
+
};
|
|
98
|
+
type ButtonListItem = [
|
|
99
|
+
ConversationMessageListItemType.ButtonList,
|
|
100
|
+
ButtonListProperties
|
|
101
|
+
];
|
|
102
|
+
export type ItemListProperties = {
|
|
103
|
+
header?: string;
|
|
104
|
+
actions: {
|
|
105
|
+
[key: string]: string;
|
|
106
|
+
} | {
|
|
107
|
+
label: string;
|
|
108
|
+
actionKey: string;
|
|
109
|
+
data: any;
|
|
110
|
+
}[];
|
|
111
|
+
};
|
|
112
|
+
type ItemListItem = [
|
|
113
|
+
ConversationMessageListItemType.ItemList,
|
|
114
|
+
ItemListProperties
|
|
115
|
+
];
|
|
116
|
+
export type VideoRequestProperties = {
|
|
117
|
+
header?: string;
|
|
118
|
+
acceptLabel: string;
|
|
119
|
+
declineLabel: string;
|
|
120
|
+
};
|
|
121
|
+
type VideoRequestItem = [
|
|
122
|
+
ConversationMessageListItemType.VideoRequest,
|
|
123
|
+
VideoRequestProperties
|
|
124
|
+
];
|
|
125
|
+
export type HtmlProperties = {
|
|
126
|
+
body: string;
|
|
127
|
+
};
|
|
128
|
+
type HtmlItem = [ConversationMessageListItemType.HTML, HtmlProperties];
|
|
129
|
+
type ItemPayload = LinkListItem | TextItem | SeparatorItem | ButtonListItem | HtmlItem | VideoRequestItem | ItemListItem;
|
|
130
|
+
export {};
|
package/user.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ConversationController, ConversationEntry } from './conversation-controller';
|
|
2
|
+
import { ConversationMessageSettings } from './types';
|
|
3
|
+
|
|
4
|
+
export declare class User {
|
|
5
|
+
private controller;
|
|
6
|
+
constructor(controller: ConversationController);
|
|
7
|
+
print: (settings: string | ConversationMessageSettings, options?: {
|
|
8
|
+
key?: string;
|
|
9
|
+
}, timestamp?: number | null) => ConversationEntry;
|
|
10
|
+
}
|
package/utils/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { navigateToConversation, openChatWidget, shouldPreventDefault, } from './open-chat-widget';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const mapActions: (actions: any) => any[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Container } from '@webprovisions/platform';
|
|
2
|
+
|
|
3
|
+
export declare const shouldPreventDefault: (container: Container) => boolean;
|
|
4
|
+
export declare const openChatWidget: (container: Container, contactMethod: any, triggerDOMTarget?: HTMLElement) => boolean | Promise<void> | Promise<boolean>;
|
|
5
|
+
export declare const navigateToConversation: (container: Container, contactMethod: any, routeName?: string) => any;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Container } from '@webprovisions/platform';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This will put the current provider(s) in a queue and
|
|
5
|
+
* swap current provider to another one based on the providerName.
|
|
6
|
+
* When ConversationProvider.complete() is called, the provider(s) in the
|
|
7
|
+
* queue will become active again
|
|
8
|
+
*/
|
|
9
|
+
export declare const swapProvider: (container: Container, conversationId: string, providerName: string) => Promise<void>;
|