@botonic/react 0.49.0-alpha.1 → 0.49.0-alpha.3
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/system-debug-trace/events/ai-agent/ai-agent.js +1 -1
- package/lib/cjs/components/system-debug-trace/events/ai-agent/ai-agent.js.map +1 -1
- package/lib/cjs/components/system-debug-trace/events/ai-agent-router/ai-agent-router.js +1 -1
- package/lib/cjs/components/system-debug-trace/events/ai-agent-router/ai-agent-router.js.map +1 -1
- package/lib/cjs/components/system-debug-trace/icons/ai-specialist.d.ts +1 -0
- package/lib/cjs/components/system-debug-trace/icons/ai-specialist.js +11 -0
- package/lib/cjs/components/system-debug-trace/icons/ai-specialist.js.map +1 -0
- package/lib/cjs/components/system-debug-trace/icons/index.d.ts +1 -0
- package/lib/cjs/components/system-debug-trace/icons/index.js +1 -0
- package/lib/cjs/components/system-debug-trace/icons/index.js.map +1 -1
- package/lib/cjs/constants.d.ts +3 -0
- package/lib/cjs/constants.js +4 -1
- package/lib/cjs/constants.js.map +1 -1
- package/lib/cjs/dev-app.d.ts +2 -1
- package/lib/cjs/dev-app.js +5 -3
- package/lib/cjs/dev-app.js.map +1 -1
- package/lib/cjs/index-types.d.ts +5 -0
- package/lib/cjs/index-types.js.map +1 -1
- package/lib/cjs/webchat/theme/default-theme.js +1 -1
- package/lib/cjs/webchat/theme/default-theme.js.map +1 -1
- package/lib/cjs/webchat/webchat.js +7 -0
- package/lib/cjs/webchat/webchat.js.map +1 -1
- package/lib/cjs/webchat-app.d.ts +3 -2
- package/lib/cjs/webchat-app.js +5 -3
- package/lib/cjs/webchat-app.js.map +1 -1
- package/lib/esm/components/system-debug-trace/events/ai-agent/ai-agent.js +1 -1
- package/lib/esm/components/system-debug-trace/events/ai-agent/ai-agent.js.map +1 -1
- package/lib/esm/components/system-debug-trace/events/ai-agent-router/ai-agent-router.js +1 -1
- package/lib/esm/components/system-debug-trace/events/ai-agent-router/ai-agent-router.js.map +1 -1
- package/lib/esm/components/system-debug-trace/icons/ai-specialist.d.ts +1 -0
- package/lib/esm/components/system-debug-trace/icons/ai-specialist.js +11 -0
- package/lib/esm/components/system-debug-trace/icons/ai-specialist.js.map +1 -0
- package/lib/esm/components/system-debug-trace/icons/index.d.ts +1 -0
- package/lib/esm/components/system-debug-trace/icons/index.js +1 -0
- package/lib/esm/components/system-debug-trace/icons/index.js.map +1 -1
- package/lib/esm/constants.d.ts +3 -0
- package/lib/esm/constants.js +4 -1
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/dev-app.d.ts +2 -1
- package/lib/esm/dev-app.js +5 -3
- package/lib/esm/dev-app.js.map +1 -1
- package/lib/esm/index-types.d.ts +5 -0
- package/lib/esm/index-types.js.map +1 -1
- package/lib/esm/webchat/theme/default-theme.js +1 -1
- package/lib/esm/webchat/theme/default-theme.js.map +1 -1
- package/lib/esm/webchat/webchat.js +7 -0
- package/lib/esm/webchat/webchat.js.map +1 -1
- package/lib/esm/webchat-app.d.ts +3 -2
- package/lib/esm/webchat-app.js +5 -3
- package/lib/esm/webchat-app.js.map +1 -1
- package/package.json +2 -2
- package/src/components/system-debug-trace/events/ai-agent/ai-agent.tsx +2 -2
- package/src/components/system-debug-trace/events/ai-agent-router/ai-agent-router.tsx +2 -2
- package/src/components/system-debug-trace/icons/ai-specialist.tsx +50 -0
- package/src/components/system-debug-trace/icons/index.ts +1 -0
- package/src/constants.js +4 -0
- package/src/dev-app.jsx +5 -0
- package/src/index-types.ts +6 -0
- package/src/webchat/theme/default-theme.ts +2 -2
- package/src/webchat/webchat.tsx +18 -1
- package/src/webchat-app.tsx +7 -0
package/src/dev-app.jsx
CHANGED
|
@@ -27,6 +27,7 @@ export class DevApp extends WebchatApp {
|
|
|
27
27
|
onClose,
|
|
28
28
|
onMessage,
|
|
29
29
|
onTrackEvent,
|
|
30
|
+
contentsByLocale,
|
|
30
31
|
webviews,
|
|
31
32
|
...botOptions
|
|
32
33
|
}) {
|
|
@@ -48,6 +49,7 @@ export class DevApp extends WebchatApp {
|
|
|
48
49
|
onClose,
|
|
49
50
|
onMessage,
|
|
50
51
|
onTrackEvent,
|
|
52
|
+
contentsByLocale,
|
|
51
53
|
})
|
|
52
54
|
this.webviews = webviews
|
|
53
55
|
this.bot = new ReactBot({
|
|
@@ -65,6 +67,7 @@ export class DevApp extends WebchatApp {
|
|
|
65
67
|
onClose,
|
|
66
68
|
onMessage,
|
|
67
69
|
onTrackEvent,
|
|
70
|
+
contentsByLocale,
|
|
68
71
|
hostId,
|
|
69
72
|
...webchatOptions
|
|
70
73
|
} = optionsAtRuntime
|
|
@@ -76,6 +79,7 @@ export class DevApp extends WebchatApp {
|
|
|
76
79
|
this.onClose = onClose || this.onClose
|
|
77
80
|
this.onMessage = onMessage || this.onMessage
|
|
78
81
|
this.onTrackEvent = onTrackEvent || this.onTrackEvent
|
|
82
|
+
this.contentsByLocale = contentsByLocale || this.contentsByLocale
|
|
79
83
|
this.hostId = hostId || this.hostId
|
|
80
84
|
this.createRootElement(host)
|
|
81
85
|
return (
|
|
@@ -87,6 +91,7 @@ export class DevApp extends WebchatApp {
|
|
|
87
91
|
theme={theme}
|
|
88
92
|
storage={storage}
|
|
89
93
|
storageKey={storageKey}
|
|
94
|
+
contentsByLocale={this.contentsByLocale}
|
|
90
95
|
onInit={(...args) => this.onInitWebchat(...args)}
|
|
91
96
|
onOpen={(...args) => this.onOpenWebchat(...args)}
|
|
92
97
|
onClose={(...args) => this.onCloseWebchat(...args)}
|
package/src/index-types.ts
CHANGED
|
@@ -89,6 +89,10 @@ export interface MinimalHubtypeMessage {
|
|
|
89
89
|
text: string
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
export interface WebchatLocaleContents {
|
|
93
|
+
inputPlaceholder: string
|
|
94
|
+
}
|
|
95
|
+
|
|
92
96
|
export interface PreviewUtils {
|
|
93
97
|
getChunkIdsGroupedBySource: (
|
|
94
98
|
chunkIds: string[]
|
|
@@ -122,6 +126,7 @@ export interface WebchatArgs {
|
|
|
122
126
|
onMessage?: (app: WebchatApp, message: WebchatMessage) => void
|
|
123
127
|
onTrackEvent?: TrackEventFunction
|
|
124
128
|
onConnectionChange?: (app: WebchatApp, isOnline: boolean) => void
|
|
129
|
+
contentsByLocale?: Record<string, WebchatLocaleContents>
|
|
125
130
|
appId?: string
|
|
126
131
|
visibility?: boolean | (() => boolean) | 'dynamic'
|
|
127
132
|
server?: ServerConfig
|
|
@@ -149,6 +154,7 @@ export interface WebchatProps {
|
|
|
149
154
|
server?: ServerConfig
|
|
150
155
|
localWebviews?: React.ComponentType[]
|
|
151
156
|
previewUtils?: PreviewUtils
|
|
157
|
+
contentsByLocale?: Record<string, WebchatLocaleContents>
|
|
152
158
|
}
|
|
153
159
|
|
|
154
160
|
export type EventArgs = { [key: string]: any }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COLORS, WEBCHAT } from '../../constants'
|
|
1
|
+
import { COLORS, WEBCHAT, WEBCHAT_DEFAULT_CONTENTS } from '../../constants'
|
|
2
2
|
import type { WebchatTheme } from './types'
|
|
3
3
|
|
|
4
4
|
export const defaultTheme: WebchatTheme = {
|
|
@@ -81,7 +81,7 @@ export const defaultTheme: WebchatTheme = {
|
|
|
81
81
|
userInput: {
|
|
82
82
|
attachments: { enable: undefined },
|
|
83
83
|
box: {
|
|
84
|
-
placeholder:
|
|
84
|
+
placeholder: WEBCHAT_DEFAULT_CONTENTS.INPUT_PLACEHOLDER,
|
|
85
85
|
},
|
|
86
86
|
emojiPicker: { enable: undefined },
|
|
87
87
|
sendButton: { enable: true },
|
package/src/webchat/webchat.tsx
CHANGED
|
@@ -21,7 +21,13 @@ import {
|
|
|
21
21
|
Video,
|
|
22
22
|
type WebchatSettingsProps,
|
|
23
23
|
} from '../components'
|
|
24
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
COLORS,
|
|
26
|
+
MAX_ALLOWED_SIZE_MB,
|
|
27
|
+
ROLES,
|
|
28
|
+
WEBCHAT,
|
|
29
|
+
WEBCHAT_DEFAULT_CONTENTS,
|
|
30
|
+
} from '../constants'
|
|
25
31
|
import type { CloseWebviewOptions } from '../contexts'
|
|
26
32
|
import { SENDERS, type WebchatProps, type WebchatRef } from '../index-types'
|
|
27
33
|
import {
|
|
@@ -109,6 +115,7 @@ const Webchat = forwardRef<WebchatRef | null, WebchatProps>((props, ref) => {
|
|
|
109
115
|
scrollableMessagesListRef,
|
|
110
116
|
} = props.webchatHooks || useWebchat(props.theme)
|
|
111
117
|
|
|
118
|
+
const contentsByLocale = props.contentsByLocale
|
|
112
119
|
const firstUpdate = useRef(true)
|
|
113
120
|
const isOnline = () => webchatState.online
|
|
114
121
|
const currentDateString = () => new Date().toISOString()
|
|
@@ -485,6 +492,16 @@ const Webchat = forwardRef<WebchatRef | null, WebchatProps>((props, ref) => {
|
|
|
485
492
|
*/
|
|
486
493
|
|
|
487
494
|
const updateSessionWithUser = (userToUpdate: any) => {
|
|
495
|
+
if (contentsByLocale && userToUpdate.system_locale) {
|
|
496
|
+
const placeholder =
|
|
497
|
+
contentsByLocale[userToUpdate.system_locale]?.inputPlaceholder ??
|
|
498
|
+
WEBCHAT_DEFAULT_CONTENTS.INPUT_PLACEHOLDER
|
|
499
|
+
const themeUpdates = { userInput: { box: { placeholder } } }
|
|
500
|
+
updateTheme(
|
|
501
|
+
merge(props.theme, themeUpdates),
|
|
502
|
+
themeUpdates as WebchatTheme
|
|
503
|
+
)
|
|
504
|
+
}
|
|
488
505
|
updateSession(merge(webchatState.session, { user: userToUpdate }))
|
|
489
506
|
}
|
|
490
507
|
|
package/src/webchat-app.tsx
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
SENDERS,
|
|
18
18
|
Typing,
|
|
19
19
|
type WebchatArgs,
|
|
20
|
+
type WebchatLocaleContents,
|
|
20
21
|
type WebchatMessage,
|
|
21
22
|
type WebchatRef,
|
|
22
23
|
} from './index-types'
|
|
@@ -55,6 +56,7 @@ export class WebchatApp {
|
|
|
55
56
|
args?: EventArgs
|
|
56
57
|
) => Promise<void>
|
|
57
58
|
public onConnectionChange?: (app: WebchatApp, isOnline: boolean) => void
|
|
59
|
+
public contentsByLocale?: Record<string, WebchatLocaleContents>
|
|
58
60
|
public appId?: string
|
|
59
61
|
public visibility?: boolean | (() => boolean) | 'dynamic'
|
|
60
62
|
public server?: ServerConfig
|
|
@@ -86,6 +88,7 @@ export class WebchatApp {
|
|
|
86
88
|
onMessage,
|
|
87
89
|
onTrackEvent,
|
|
88
90
|
onConnectionChange,
|
|
91
|
+
contentsByLocale,
|
|
89
92
|
appId,
|
|
90
93
|
visibility,
|
|
91
94
|
server,
|
|
@@ -119,6 +122,7 @@ export class WebchatApp {
|
|
|
119
122
|
this.onMessage = onMessage
|
|
120
123
|
this.onTrackEvent = onTrackEvent
|
|
121
124
|
this.onConnectionChange = onConnectionChange
|
|
125
|
+
this.contentsByLocale = contentsByLocale
|
|
122
126
|
this.visibility = visibility
|
|
123
127
|
this.server = server
|
|
124
128
|
this.previewUtils = previewUtils
|
|
@@ -482,6 +486,7 @@ export class WebchatApp {
|
|
|
482
486
|
onClose,
|
|
483
487
|
onMessage,
|
|
484
488
|
onConnectionChange,
|
|
489
|
+
contentsByLocale,
|
|
485
490
|
onTrackEvent,
|
|
486
491
|
appId,
|
|
487
492
|
visibility,
|
|
@@ -502,6 +507,7 @@ export class WebchatApp {
|
|
|
502
507
|
this.onMessage = onMessage || this.onMessage
|
|
503
508
|
this.onTrackEvent = onTrackEvent || this.onTrackEvent
|
|
504
509
|
this.onConnectionChange = onConnectionChange || this.onConnectionChange
|
|
510
|
+
this.contentsByLocale = contentsByLocale || this.contentsByLocale
|
|
505
511
|
this.visibility = visibility || this.visibility
|
|
506
512
|
this.appId = appId || this.appId
|
|
507
513
|
this.hostId = hostId || this.hostId
|
|
@@ -533,6 +539,7 @@ export class WebchatApp {
|
|
|
533
539
|
args?: EventArgs
|
|
534
540
|
) => this.onTrackEventWebchat(request, eventName, args)}
|
|
535
541
|
server={server}
|
|
542
|
+
contentsByLocale={this.contentsByLocale}
|
|
536
543
|
/>
|
|
537
544
|
)
|
|
538
545
|
}
|