@botonic/react 0.22.0-alpha.2 → 0.22.0-beta.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/lib/cjs/components/index-types.d.ts +174 -0
- package/lib/cjs/components/index-types.js +17 -0
- package/lib/cjs/components/index-types.js.map +1 -0
- package/lib/cjs/components/index.d.ts +22 -20
- package/lib/cjs/components/index.js +4 -1
- package/lib/cjs/components/index.js.map +1 -1
- package/lib/cjs/components/multichannel/index-types.d.ts +45 -0
- package/lib/cjs/components/multichannel/index-types.js +3 -0
- package/lib/cjs/components/multichannel/index-types.js.map +1 -0
- package/lib/cjs/components/multichannel/index.d.ts +8 -3
- package/lib/cjs/components/multichannel/index.js +2 -0
- package/lib/cjs/components/multichannel/index.js.map +1 -1
- package/lib/cjs/contexts.d.ts +2 -3
- package/lib/cjs/contexts.js +3 -4
- package/lib/cjs/contexts.js.map +1 -1
- package/lib/cjs/index-types.d.ts +94 -0
- package/lib/cjs/index-types.js +12 -0
- package/lib/cjs/index-types.js.map +1 -0
- package/lib/cjs/index.d.ts +8 -10
- package/lib/cjs/index.js +5 -7
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/webchat/index-types.d.ts +55 -0
- package/lib/cjs/webchat/index-types.js +3 -0
- package/lib/cjs/webchat/index-types.js.map +1 -0
- package/lib/cjs/webchat/index.d.ts +4 -6
- package/lib/cjs/webchat/index.js +3 -3
- package/lib/cjs/webchat/index.js.map +1 -1
- package/lib/esm/components/carousel.d.ts +2 -1
- package/lib/esm/components/index-types.d.ts +174 -0
- package/lib/esm/components/index-types.js +16 -0
- package/lib/esm/components/index-types.js.map +1 -0
- package/lib/esm/components/index.d.ts +22 -19
- package/lib/esm/components/index.js +2 -0
- package/lib/esm/components/index.js.map +1 -1
- package/lib/esm/components/multichannel/index-types.d.ts +45 -0
- package/lib/esm/components/multichannel/index-types.js +2 -0
- package/lib/esm/components/multichannel/index-types.js.map +1 -0
- package/lib/esm/components/multichannel/index.d.ts +8 -3
- package/lib/esm/components/multichannel/index.js +1 -0
- package/lib/esm/components/multichannel/index.js.map +1 -1
- package/lib/esm/contexts.d.ts +2 -3
- package/lib/esm/contexts.js +3 -3
- package/lib/esm/contexts.js.map +1 -1
- package/lib/esm/index-types.d.ts +94 -0
- package/lib/esm/index-types.js +9 -0
- package/lib/esm/index-types.js.map +1 -0
- package/lib/esm/index.d.ts +8 -9
- package/lib/esm/index.js +4 -3
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/message-utils.d.ts +2 -1
- package/lib/esm/node-app.d.ts +3 -3
- package/lib/esm/react-bot.d.ts +2 -1
- package/lib/esm/webchat/index-types.d.ts +55 -0
- package/lib/esm/webchat/index-types.js +2 -0
- package/lib/esm/webchat/index-types.js.map +1 -0
- package/lib/esm/webchat/index.d.ts +4 -6
- package/lib/esm/webchat/index.js +2 -3
- package/lib/esm/webchat/index.js.map +1 -1
- package/lib/esm/webchat-app.d.ts +4 -3
- package/package.json +1 -1
- package/src/components/{index.d.ts → index-types.ts} +22 -43
- package/src/components/{index.js → index.ts} +2 -0
- package/src/components/multichannel/{index.d.ts → index-types.ts} +1 -10
- package/src/components/multichannel/{index.js → index.ts} +2 -0
- package/src/contexts.jsx +3 -3
- package/src/index-types.ts +186 -0
- package/src/{index.js → index.ts} +4 -3
- package/src/webchat/{index.d.ts → index-types.ts} +5 -10
- package/src/webchat/{index.js → index.ts} +3 -3
- package/src/index.d.ts +0 -238
package/src/index.d.ts
DELETED
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
import * as core from '@botonic/core'
|
|
2
|
-
import * as React from 'react'
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
BlockInputOption,
|
|
6
|
-
ButtonProps,
|
|
7
|
-
CoverComponentOptions,
|
|
8
|
-
PersistentMenuTheme,
|
|
9
|
-
ReplyProps,
|
|
10
|
-
ThemeProps,
|
|
11
|
-
WebchatSettingsProps,
|
|
12
|
-
Webview,
|
|
13
|
-
} from './components'
|
|
14
|
-
import { WebchatState } from './webchat'
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* See @botonic/core's Response for the description of the Response's semantics*/
|
|
18
|
-
export interface BotResponse extends core.BotRequest {
|
|
19
|
-
response: [React.ReactNode]
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface Route extends core.Route {
|
|
23
|
-
action?: React.ComponentType<any>
|
|
24
|
-
retryAction?: React.ComponentType<any>
|
|
25
|
-
}
|
|
26
|
-
type Routes = core.Routes<Route>
|
|
27
|
-
|
|
28
|
-
export class ReactBot extends core.CoreBot {
|
|
29
|
-
renderReactActions({
|
|
30
|
-
actions,
|
|
31
|
-
request: ActionRequest,
|
|
32
|
-
}): Promise<React.ReactNode>
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export class NodeApp {
|
|
36
|
-
constructor(options: Omit<core.CoreBotConfig, 'renderer'>)
|
|
37
|
-
bot: ReactBot
|
|
38
|
-
input(request: core.BotRequest): Promise<BotResponse>
|
|
39
|
-
renderNode(args): string
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Parameters of the actions' botonicInit method
|
|
43
|
-
export interface ActionRequest {
|
|
44
|
-
defaultDelay: number
|
|
45
|
-
defaultTyping: number
|
|
46
|
-
input: core.Input
|
|
47
|
-
lastRoutePath: string
|
|
48
|
-
params: { [key: string]: string }
|
|
49
|
-
plugins: { [id: string]: core.Plugin }
|
|
50
|
-
session: core.Session
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export class BotonicInputTester {
|
|
54
|
-
constructor(app: NodeApp)
|
|
55
|
-
|
|
56
|
-
text(
|
|
57
|
-
inp: string,
|
|
58
|
-
session?: core.Session,
|
|
59
|
-
lastRoutePath?: string
|
|
60
|
-
): Promise<string>
|
|
61
|
-
|
|
62
|
-
payload(
|
|
63
|
-
inp: string,
|
|
64
|
-
session?: core.Session,
|
|
65
|
-
lastRoutePath?: string
|
|
66
|
-
): Promise<string>
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export class BotonicOutputTester {
|
|
70
|
-
constructor(app: NodeApp)
|
|
71
|
-
|
|
72
|
-
text(out: string, replies?: any): Promise<string>
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface RequestContextInterface extends ActionRequest {
|
|
76
|
-
getString: (stringId: string) => string
|
|
77
|
-
setLocale: (locale: string) => string
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export const RequestContext: React.Context<RequestContextInterface>
|
|
81
|
-
export type RequestContext = React.Context<RequestContextInterface>
|
|
82
|
-
|
|
83
|
-
export interface CustomMessageType {
|
|
84
|
-
customTypeName: string
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export function msgToBotonic(
|
|
88
|
-
msg: any,
|
|
89
|
-
customMessageTypes?: CustomMessageType[]
|
|
90
|
-
): React.ReactNode
|
|
91
|
-
|
|
92
|
-
export function msgsToBotonic(
|
|
93
|
-
msgs: any | any[],
|
|
94
|
-
customMessageTypes?: CustomMessageType[]
|
|
95
|
-
): React.ReactNode
|
|
96
|
-
|
|
97
|
-
export interface WebchatArgs {
|
|
98
|
-
blockInputs?: BlockInputOption[]
|
|
99
|
-
coverComponent?: CoverComponentOptions
|
|
100
|
-
defaultDelay?: number
|
|
101
|
-
defaultTyping?: number
|
|
102
|
-
enableAnimations?: boolean
|
|
103
|
-
enableAttachments?: boolean
|
|
104
|
-
enableEmojiPicker?: boolean
|
|
105
|
-
enableUserInput?: boolean
|
|
106
|
-
shadowDOM?: boolean | (() => boolean)
|
|
107
|
-
hostId?: string
|
|
108
|
-
getString?: (stringId: string, session: core.Session) => string
|
|
109
|
-
onClose?: (app: WebchatApp, args: any) => void
|
|
110
|
-
onInit?: (app: WebchatApp, args: any) => void
|
|
111
|
-
onMessage?: (app: WebchatApp, message: WebchatMessage) => void
|
|
112
|
-
onOpen?: (app: WebchatApp, args: any) => void
|
|
113
|
-
onConnectionChange?: (app: WebchatApp, isOnline: boolean) => void
|
|
114
|
-
persistentMenu?: PersistentMenuTheme
|
|
115
|
-
storage?: Storage | null
|
|
116
|
-
storageKey?: any
|
|
117
|
-
theme?: ThemeProps
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export interface WebchatAppArgs extends WebchatArgs {
|
|
121
|
-
appId?: string
|
|
122
|
-
visibility?: () => boolean
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export interface WebchatMessage {
|
|
126
|
-
ack: 0 | 1
|
|
127
|
-
buttons: ButtonProps[]
|
|
128
|
-
data: any
|
|
129
|
-
delay: number
|
|
130
|
-
display: boolean
|
|
131
|
-
from: 'user' | 'bot'
|
|
132
|
-
id: string
|
|
133
|
-
markdown: boolean
|
|
134
|
-
replies: ReplyProps[]
|
|
135
|
-
timestamp: string
|
|
136
|
-
type: core.InputType
|
|
137
|
-
typing: number
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export interface OnUserInputArgs {
|
|
141
|
-
input: core.Input
|
|
142
|
-
lastRoutePath?: string
|
|
143
|
-
session?: core.Session
|
|
144
|
-
user: core.SessionUser
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export interface OnStateChangeArgs {
|
|
148
|
-
messagesJSON: WebchatMessage[]
|
|
149
|
-
user: core.SessionUser
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export interface MessageInfo {
|
|
153
|
-
data: any | 'typing_on'
|
|
154
|
-
id: string
|
|
155
|
-
type: 'update_webchat_settings' | 'sender_action'
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export interface Event {
|
|
159
|
-
action?: 'update_message_info'
|
|
160
|
-
isError?: boolean
|
|
161
|
-
message?: MessageInfo
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export class WebchatApp {
|
|
165
|
-
constructor(options: WebchatAppArgs)
|
|
166
|
-
addBotMessage(message: WebchatMessage): void
|
|
167
|
-
addBotText(text: string): void
|
|
168
|
-
addUserMessage(message: WebchatMessage): void
|
|
169
|
-
addUserPayload(payload: string): void
|
|
170
|
-
addUserText(text: string): void
|
|
171
|
-
clearMessages(): void
|
|
172
|
-
close(): void
|
|
173
|
-
closeCoverComponent(): void
|
|
174
|
-
destroy(): void
|
|
175
|
-
getComponent(
|
|
176
|
-
host: HTMLElement,
|
|
177
|
-
optionsAtRuntime?: WebchatAppArgs
|
|
178
|
-
): React.ForwardRefExoticComponent<any>
|
|
179
|
-
getLastMessageUpdate(): string
|
|
180
|
-
getMessages(): WebchatMessage[]
|
|
181
|
-
getVisibility(): Promise<boolean>
|
|
182
|
-
isWebchatVisible({ appId: string }): Promise<boolean>
|
|
183
|
-
onCloseWebchat(args: any): void
|
|
184
|
-
onInitWebchat(args: any): void
|
|
185
|
-
onOpenWebchat(args: any): void
|
|
186
|
-
onServiceEvent(event: Event): void
|
|
187
|
-
onStateChange(args: OnStateChangeArgs): void
|
|
188
|
-
onUserInput(args: OnUserInputArgs): Promise<void>
|
|
189
|
-
open(): void
|
|
190
|
-
openCoverComponent(): void
|
|
191
|
-
render(dest?: HTMLElement, optionsAtRuntime?: WebchatAppArgs): void
|
|
192
|
-
resendUnsentInputs(): Promise<void>
|
|
193
|
-
resolveWebchatVisibility(optionsAtRuntime: {
|
|
194
|
-
appId: string
|
|
195
|
-
visibility: () => boolean
|
|
196
|
-
}): Promise<boolean>
|
|
197
|
-
setTyping(enable: boolean): void
|
|
198
|
-
toggle(): void
|
|
199
|
-
toggleCoverComponent(): void
|
|
200
|
-
updateMessageInfo(msgId: string, messageInfo: MessageInfo): void
|
|
201
|
-
updateLastMessageDate(date: string): void
|
|
202
|
-
updateUser(user: Partial<core.SessionUser>): void
|
|
203
|
-
updateWebchatSettings(settings: WebchatSettingsProps): void
|
|
204
|
-
renderCustomComponent(customComponent: React.ReactNode): void
|
|
205
|
-
unmountCustomComponent(): void
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
export interface WebchatContextProps {
|
|
209
|
-
sendText: (text: string, payload?: string) => void
|
|
210
|
-
sendAttachment: (attachment: File) => void
|
|
211
|
-
sendPayload: (payload: string) => void
|
|
212
|
-
sendInput: (input: core.Input) => void
|
|
213
|
-
openWebview: (webviewComponent: Webview) => void
|
|
214
|
-
addMessage: (message: WebchatMessage) => void
|
|
215
|
-
updateMessage: (message: WebchatMessage) => void
|
|
216
|
-
updateReplies: (replies: boolean) => void
|
|
217
|
-
updateLatestInput: (input: core.Input) => void
|
|
218
|
-
closeWebview: () => void
|
|
219
|
-
toggleWebchat: () => void
|
|
220
|
-
getThemeProperty: (property: string, defaultValue?: string) => any
|
|
221
|
-
resolveCase: () => void
|
|
222
|
-
theme: ThemeProps
|
|
223
|
-
webchatState: WebchatState
|
|
224
|
-
updateWebchatDevSettings: (settings: WebchatSettingsProps) => void
|
|
225
|
-
updateUser: (user: Partial<core.SessionUser>) => void
|
|
226
|
-
}
|
|
227
|
-
export const WebchatContext: React.Context<WebchatContextProps>
|
|
228
|
-
export type WebchatContext = React.Context<WebchatContextProps>
|
|
229
|
-
|
|
230
|
-
export class DevApp extends WebchatApp {
|
|
231
|
-
constructor(args: WebchatAppArgs)
|
|
232
|
-
onUserInput(args: OnUserInputArgs): Promise<void>
|
|
233
|
-
render(dest: HTMLElement, optionsAtRuntime: WebchatAppArgs): void
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
export * from './components'
|
|
237
|
-
export * from './util'
|
|
238
|
-
export * from './webchat'
|