@seamly/web-ui 20.2.0-alpha.3 → 20.3.0
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/CHANGELOG.md +729 -0
- package/build/dist/lib/deprecated-view.css +1 -1
- package/build/dist/lib/index.debug.js +270 -260
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.debug.min.js.LICENSE.txt +64 -60
- package/build/dist/lib/index.js +4487 -3568
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/index.min.js.LICENSE.txt +2 -2
- package/build/dist/lib/standalone.js +11945 -9368
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/standalone.min.js.LICENSE.txt +1 -1
- package/build/dist/lib/style-guide.js +7462 -7267
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/styles.css +1 -1
- package/package.json +15 -14
- package/src/javascripts/api/index.js +5 -4
- package/src/javascripts/domains/app/actions.js +22 -10
- package/src/javascripts/domains/config/reducer.js +2 -2
- package/src/javascripts/domains/forms/reducer.js +1 -1
- package/src/javascripts/domains/i18n/reducer.js +1 -1
- package/src/javascripts/domains/interrupt/reducer.js +1 -1
- package/src/javascripts/domains/translations/components/chat-status.js +10 -9
- package/src/javascripts/domains/translations/components/options-button.js +8 -3
- package/src/javascripts/domains/translations/components/options-dialog/form.js +6 -5
- package/src/javascripts/domains/translations/components/options-dialog/index.js +5 -2
- package/src/javascripts/domains/translations/hooks.js +15 -1
- package/src/javascripts/domains/translations/middleware.js +5 -2
- package/src/javascripts/domains/translations/reducer.js +2 -2
- package/src/javascripts/domains/visibility/actions.js +1 -1
- package/src/javascripts/lib/debug.js +1 -0
- package/src/javascripts/lib/external-api/index.js +29 -4
- package/src/javascripts/style-guide/components/app.js +1 -1
- package/src/javascripts/style-guide/components/static-core.js +1 -4
- package/src/javascripts/ui/components/conversation/conversation.js +2 -2
- package/src/javascripts/ui/components/conversation/event/card-component.js +4 -1
- package/src/javascripts/ui/components/conversation/event/carousel-component/index.js +1 -1
- package/src/javascripts/ui/components/conversation/event/conversation-suggestions.js +18 -10
- package/src/javascripts/ui/components/conversation/event/cta.js +1 -1
- package/src/javascripts/ui/components/conversation/event/divider/variants/new-translation.js +4 -9
- package/src/javascripts/ui/components/conversation/event/image.js +1 -1
- package/src/javascripts/ui/components/conversation/event/participant.js +3 -8
- package/src/javascripts/ui/components/conversation/event/text.js +2 -2
- package/src/javascripts/ui/components/conversation/loader.js +1 -1
- package/src/javascripts/ui/components/conversation/message-container.js +1 -1
- package/src/javascripts/ui/components/core/seamly-activity-monitor.js +1 -1
- package/src/javascripts/ui/components/core/seamly-core.js +2 -2
- package/src/javascripts/ui/components/core/seamly-file-upload.js +1 -1
- package/src/javascripts/ui/components/core/seamly-instance-functions-loader.js +6 -2
- package/src/javascripts/ui/components/core/seamly-live-region.js +2 -2
- package/src/javascripts/ui/components/entry/entry-container.js +2 -2
- package/src/javascripts/ui/components/entry/text-entry/hooks.js +1 -4
- package/src/javascripts/ui/components/entry/text-entry/text-entry-form.js +1 -1
- package/src/javascripts/ui/components/form-controls/select.js +1 -1
- package/src/javascripts/ui/components/layout/agent-info.js +1 -1
- package/src/javascripts/ui/components/layout/header.js +1 -1
- package/src/javascripts/ui/components/options/options-button.js +1 -1
- package/src/javascripts/ui/components/options/options.js +1 -1
- package/src/javascripts/ui/components/options/transcript/index.js +1 -1
- package/src/javascripts/ui/components/suggestions/suggestions-item.js +1 -1
- package/src/javascripts/ui/components/warnings/resume-conversation-prompt.js +1 -1
- package/src/javascripts/ui/components/widgets/lightbox.js +1 -1
- package/src/javascripts/ui/hooks/file-upload-hooks.js +2 -3
- package/src/javascripts/ui/hooks/focus-helper-hooks.js +2 -2
- package/src/javascripts/ui/hooks/seamly-entry-hooks.js +1 -1
- package/src/javascripts/ui/hooks/seamly-option-hooks.js +1 -1
- package/src/javascripts/ui/hooks/use-seamly-chat.js +2 -2
- package/src/javascripts/ui/hooks/use-seamly-commands.js +7 -7
- package/src/javascripts/ui/hooks/use-seamly-idle-detach-countdown.js +4 -4
- package/src/javascripts/ui/hooks/use-seamly-resume-conversation-prompt.js +2 -2
- package/src/javascripts/ui/hooks/use-single-file-upload.js +1 -1
- package/src/javascripts/ui/utils/general-utils.js +1 -1
- package/src/javascripts/ui/utils/seamly-utils.js +1 -0
- package/src/stylesheets/1-settings/_animations.scss +1 -1
- package/src/stylesheets/1-settings/_config.scss +17 -2
- package/src/stylesheets/2-tools/_functions.scss +4 -4
- package/src/stylesheets/2-tools/_mixins.scss +16 -14
- package/src/stylesheets/3-chat/_chat.scss +1 -1
- package/src/stylesheets/5-components/_choice-prompt.scss +1 -1
- package/src/stylesheets/5-components/_collapse-button.scss +1 -1
- package/src/stylesheets/5-components/_input.scss +1 -1
- package/src/stylesheets/5-components/_loader.scss +2 -2
- package/src/stylesheets/5-components/_message-carousel.scss +1 -1
- package/src/stylesheets/5-components/_message-count.scss +1 -1
- package/src/stylesheets/5-components/_message.scss +1 -2
- package/src/stylesheets/5-components/_modal.scss +1 -1
- package/src/stylesheets/5-components/_options.scss +3 -3
- package/src/stylesheets/5-components/_suggestions.scss +4 -5
- package/src/stylesheets/5-components/_upload.scss +1 -1
- package/src/stylesheets/7-deprecated/1-settings/_animations.scss +1 -1
- package/src/stylesheets/7-deprecated/1-settings/_config.scss +10 -7
- package/src/stylesheets/7-deprecated/2-tools/_functions.scss +2 -2
- package/src/stylesheets/7-deprecated/2-tools/_mixins.scss +6 -4
- package/src/stylesheets/7-deprecated/3-app/_app.scss +2 -2
- package/src/stylesheets/7-deprecated/4-base/_formelements.scss +1 -0
- package/src/stylesheets/7-deprecated/5-components/_chat-status.scss +1 -1
- package/src/stylesheets/7-deprecated/5-components/_collapse-button.scss +1 -1
- package/src/stylesheets/7-deprecated/5-components/_disclaimer.scss +1 -1
- package/src/stylesheets/7-deprecated/5-components/_input.scss +2 -1
- package/src/stylesheets/7-deprecated/5-components/_loader.scss +2 -2
- package/src/stylesheets/7-deprecated/5-components/_message-count.scss +1 -1
- package/src/stylesheets/7-deprecated/5-components/_message.scss +3 -4
- package/src/stylesheets/7-deprecated/5-components/_modal.scss +1 -1
- package/src/stylesheets/7-deprecated/5-components/_options.scss +2 -2
- package/src/stylesheets/7-deprecated/5-components/_upload.scss +1 -1
|
@@ -53,12 +53,23 @@ class ExternalApi {
|
|
|
53
53
|
|
|
54
54
|
setContext(action, args) {
|
|
55
55
|
switch (action) {
|
|
56
|
+
case 'setTopic':
|
|
57
|
+
const { name } = args
|
|
58
|
+
if (name) {
|
|
59
|
+
this.context.topic = name
|
|
60
|
+
}
|
|
61
|
+
return true
|
|
56
62
|
case 'setTranslation':
|
|
57
63
|
const { enabled, locale } = args
|
|
58
64
|
if (!!enabled && locale) {
|
|
59
65
|
this.context.translationLocale = locale
|
|
60
66
|
}
|
|
61
67
|
return true
|
|
68
|
+
case 'setVariables':
|
|
69
|
+
if (Object.keys(args).length > 0) {
|
|
70
|
+
this.context.variables = { ...args }
|
|
71
|
+
}
|
|
72
|
+
return true
|
|
62
73
|
default:
|
|
63
74
|
return false
|
|
64
75
|
}
|
|
@@ -145,19 +156,21 @@ class ExternalApi {
|
|
|
145
156
|
}
|
|
146
157
|
|
|
147
158
|
getCombinedConfig(userConfig) {
|
|
148
|
-
if (typeof this.appConfig === 'function') {
|
|
149
|
-
return this.appConfig(userConfig)
|
|
150
|
-
}
|
|
151
159
|
const context = {
|
|
152
160
|
...(userConfig.context || this.appConfig.context),
|
|
153
161
|
...this.context,
|
|
154
162
|
}
|
|
163
|
+
// Key `variables` should only be set if there are any variables
|
|
164
|
+
const variables = this.getMergedVariables(userConfig)
|
|
165
|
+
if (Object.keys(variables).length > 0) {
|
|
166
|
+
context.variables = variables
|
|
167
|
+
}
|
|
155
168
|
const defaults = {
|
|
156
169
|
...this.appConfig.defaults,
|
|
157
170
|
...userConfig.defaults,
|
|
158
171
|
}
|
|
159
172
|
|
|
160
|
-
|
|
173
|
+
const combinedConfig = {
|
|
161
174
|
...this.appConfig,
|
|
162
175
|
...userConfig,
|
|
163
176
|
api: {
|
|
@@ -167,6 +180,18 @@ class ExternalApi {
|
|
|
167
180
|
context: Object.keys(context).length ? context : undefined,
|
|
168
181
|
defaults: Object.keys(defaults).length ? defaults : undefined,
|
|
169
182
|
}
|
|
183
|
+
|
|
184
|
+
return typeof this.appConfig === 'function'
|
|
185
|
+
? this.appConfig(combinedConfig)
|
|
186
|
+
: combinedConfig
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
getMergedVariables(userConfig) {
|
|
190
|
+
return {
|
|
191
|
+
...(this.appConfig.context?.variables || {}),
|
|
192
|
+
...(userConfig.context?.variables || {}),
|
|
193
|
+
...(this.context.variables || {}),
|
|
194
|
+
}
|
|
170
195
|
}
|
|
171
196
|
}
|
|
172
197
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from 'preact/hooks'
|
|
2
2
|
import { getUrlParams, getUrlSearchString, randomId } from '@seamly/web-ui'
|
|
3
|
+
import { getStateObj, getDeprecatedStateObj } from 'style-guide/states'
|
|
3
4
|
import StyleGuideView from './view'
|
|
4
5
|
import StyleGuideLinks from './links'
|
|
5
|
-
import { getStateObj, getDeprecatedStateObj } from 'style-guide/states'
|
|
6
6
|
|
|
7
7
|
const StyleGuideApp = ({
|
|
8
8
|
config,
|
|
@@ -12,10 +12,7 @@ import {
|
|
|
12
12
|
import stateReducer from 'domains/store/state-reducer'
|
|
13
13
|
import { Reducer as formReducer } from 'domains/forms'
|
|
14
14
|
import { Reducer as translationsReducer } from 'domains/translations'
|
|
15
|
-
import {
|
|
16
|
-
Reducer as i18nReducer,
|
|
17
|
-
Actions as I18nActions,
|
|
18
|
-
} from 'domains/i18n'
|
|
15
|
+
import { Reducer as i18nReducer, Actions as I18nActions } from 'domains/i18n'
|
|
19
16
|
import { Reducer as interruptReducer } from 'domains/interrupt'
|
|
20
17
|
import { Reducer as appReducer } from 'domains/app'
|
|
21
18
|
import {
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
useSkiplinkTargetFocusing,
|
|
8
8
|
} from 'ui/hooks/seamly-hooks'
|
|
9
9
|
import { useEvents } from 'ui/hooks/seamly-state-hooks'
|
|
10
|
+
import PrivacyDisclaimer from 'ui/components/layout/privacy-disclaimer'
|
|
11
|
+
import { useVisibility } from 'domains/visibility'
|
|
10
12
|
import Event from './event/event'
|
|
11
13
|
import Loader from './loader'
|
|
12
14
|
import ComponentFilter from './component-filter'
|
|
13
|
-
import PrivacyDisclaimer from 'ui/components/layout/privacy-disclaimer'
|
|
14
|
-
import { useVisibility } from 'domains/visibility'
|
|
15
15
|
|
|
16
16
|
const Conversation = () => {
|
|
17
17
|
const { t } = useI18n()
|
|
@@ -38,7 +38,10 @@ const CardComponent = ({
|
|
|
38
38
|
sendMessage({ body: action.ask })
|
|
39
39
|
} else if (action.type === cardTypes.topic) {
|
|
40
40
|
const { topic: name, fallbackMessage } = action
|
|
41
|
-
sendAction({
|
|
41
|
+
sendAction({
|
|
42
|
+
type: actionTypes.setTopic,
|
|
43
|
+
body: { name, fallbackMessage },
|
|
44
|
+
})
|
|
42
45
|
}
|
|
43
46
|
}, [sendMessage, action, sendAction, emitCardEvent])
|
|
44
47
|
|
|
@@ -2,9 +2,9 @@ import { createRef } from 'preact'
|
|
|
2
2
|
import { useState, useEffect, useRef, useMemo } from 'preact/hooks'
|
|
3
3
|
import { className } from 'lib/css'
|
|
4
4
|
import { useGeneratedId } from 'ui/hooks/utility-hooks'
|
|
5
|
+
import CarouselMessageSlide from 'ui/components/conversation/event/carousel-message/components/slide'
|
|
5
6
|
import CarouselPagination from './components/pagination'
|
|
6
7
|
import CarouselControls from './components/controls'
|
|
7
|
-
import CarouselMessageSlide from 'ui/components/conversation/event/carousel-message/components/slide'
|
|
8
8
|
|
|
9
9
|
const defaultGetItemKey = (item, idx, prefix) => `${prefix}${idx}`
|
|
10
10
|
const defaultGetItemLabel = (item) => item.label
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { useCallback, useState } from 'preact/hooks'
|
|
2
|
-
import { className } from '
|
|
2
|
+
import { className } from 'lib/css'
|
|
3
|
+
import { useI18n } from 'domains/i18n'
|
|
4
|
+
import { useTranslatedEventData } from 'domains/translations'
|
|
5
|
+
import { useUserHasResponded } from 'domains/app'
|
|
6
|
+
import { setHasResponded } from 'domains/app/actions'
|
|
3
7
|
import { actionTypes } from '../../../utils/seamly-utils'
|
|
4
|
-
import { useI18n } from '../../../../domains/i18n'
|
|
5
|
-
import { useTranslatedEventData } from '../../../../domains/translations'
|
|
6
8
|
import MessageContainer from '../message-container'
|
|
7
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
useSeamlyCommands,
|
|
11
|
+
useSeamlyDispatchContext,
|
|
12
|
+
} from '../../../hooks/seamly-hooks'
|
|
8
13
|
import SuggestionsList from '../../suggestions/suggestions-list'
|
|
9
|
-
import { useConfig } from '../../../../domains/config'
|
|
10
14
|
|
|
11
15
|
export const useSuggestions = (event) => {
|
|
12
16
|
const { payload } = event
|
|
@@ -19,18 +23,22 @@ export const useSuggestions = (event) => {
|
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
const ConversationSuggestions = ({ event, ...props }) => {
|
|
22
|
-
const { userResponded } = useConfig()
|
|
23
26
|
const [isExpanded, setIsExpanded] = useState(true)
|
|
27
|
+
const dispatch = useSeamlyDispatchContext()
|
|
28
|
+
const userResponded = useUserHasResponded()
|
|
29
|
+
const { sendAction, addMessageBubble } = useSeamlyCommands()
|
|
30
|
+
const { suggestions, payload } = useSuggestions(event)
|
|
31
|
+
|
|
24
32
|
const { t } = useI18n()
|
|
25
33
|
const headingText = t('suggestions.headingText')
|
|
26
34
|
const footerText = t('suggestions.footerText')
|
|
27
|
-
|
|
28
|
-
const { suggestions, payload } = useSuggestions(event)
|
|
35
|
+
|
|
29
36
|
const handleClick = useCallback(
|
|
30
37
|
({ id, question }) => {
|
|
31
|
-
// @todo Refactor to 'suggestionclick'
|
|
32
38
|
setIsExpanded(false)
|
|
39
|
+
dispatch(setHasResponded(true))
|
|
33
40
|
|
|
41
|
+
// @todo Refactor to 'suggestionclick'
|
|
34
42
|
sendAction({
|
|
35
43
|
type: actionTypes.custom,
|
|
36
44
|
originMessage: payload.id,
|
|
@@ -45,7 +53,7 @@ const ConversationSuggestions = ({ event, ...props }) => {
|
|
|
45
53
|
|
|
46
54
|
addMessageBubble(question)
|
|
47
55
|
},
|
|
48
|
-
[
|
|
56
|
+
[dispatch, sendAction, payload.id, addMessageBubble],
|
|
49
57
|
)
|
|
50
58
|
|
|
51
59
|
if (!isExpanded || userResponded) {
|
|
@@ -2,10 +2,10 @@ import { useCallback } from 'preact/hooks'
|
|
|
2
2
|
import { className } from 'lib/css'
|
|
3
3
|
import parseBody from 'lib/parse-body'
|
|
4
4
|
import { useGeneratedId, useSeamlyCommands } from 'ui/hooks/seamly-hooks'
|
|
5
|
-
import useEventLinkClickHandler from './hooks/use-event-link-click-handler'
|
|
6
5
|
import { actionTypes } from 'ui/utils/seamly-utils'
|
|
7
6
|
import MessageContainer from 'ui/components/conversation/message-container'
|
|
8
7
|
import { useTranslatedEventData } from 'domains/translations'
|
|
8
|
+
import useEventLinkClickHandler from './hooks/use-event-link-click-handler'
|
|
9
9
|
|
|
10
10
|
const Cta = ({ event }) => {
|
|
11
11
|
const [body] = useTranslatedEventData(event)
|
package/src/javascripts/ui/components/conversation/event/divider/variants/new-translation.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import { useMemo } from 'preact/hooks'
|
|
2
1
|
import { useI18n } from 'domains/i18n'
|
|
3
2
|
import EventDivider from 'ui/components/conversation/event-divider'
|
|
4
3
|
import { className } from 'lib/css'
|
|
5
|
-
import { useTranslations } from 'domains/translations'
|
|
4
|
+
import { useTranslations, useLocaleNativeName } from 'domains/translations'
|
|
6
5
|
|
|
7
6
|
const NewTranslationDivider = ({ event }) => {
|
|
8
7
|
const { t } = useI18n()
|
|
9
8
|
const { translationEnabled, translationLocale, text } = event.payload.body
|
|
10
|
-
const { enableTranslations
|
|
11
|
-
|
|
12
|
-
const languageName = useMemo(() => {
|
|
13
|
-
return languages?.find((lang) => lang.locale === translationLocale)
|
|
14
|
-
?.nativeName
|
|
15
|
-
}, [languages, translationLocale])
|
|
9
|
+
const { enableTranslations } = useTranslations()
|
|
10
|
+
const localeNativeName = useLocaleNativeName(translationLocale)
|
|
16
11
|
|
|
17
12
|
const handleRestartButtonclick = () => {
|
|
18
13
|
enableTranslations(translationLocale)
|
|
@@ -25,7 +20,7 @@ const NewTranslationDivider = ({ event }) => {
|
|
|
25
20
|
translationEnabled
|
|
26
21
|
? 'translations.divider.startText'
|
|
27
22
|
: 'translations.divider.stopText',
|
|
28
|
-
{ language:
|
|
23
|
+
{ language: localeNativeName },
|
|
29
24
|
)}
|
|
30
25
|
</p>
|
|
31
26
|
{translationEnabled ? (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState } from 'preact/hooks'
|
|
2
|
-
import ImageLightbox from './image-lightbox'
|
|
3
2
|
import MessageContainer from 'ui/components/conversation/message-container'
|
|
4
3
|
import { useTranslatedEventData } from 'domains/translations'
|
|
4
|
+
import ImageLightbox from './image-lightbox'
|
|
5
5
|
|
|
6
6
|
const Image = ({ event, descriptorId, ...props }) => {
|
|
7
7
|
const [body] = useTranslatedEventData(event)
|
|
@@ -3,11 +3,8 @@ import Mustache from 'mustache'
|
|
|
3
3
|
import parseBody from 'lib/parse-body'
|
|
4
4
|
import EventDivider from 'ui/components/conversation/event-divider'
|
|
5
5
|
import { useTranslatedEventData } from 'domains/translations'
|
|
6
|
-
import { useParticipants } from 'domains/config'
|
|
7
6
|
|
|
8
7
|
const Participant = ({ event }) => {
|
|
9
|
-
const { agent } = useParticipants()
|
|
10
|
-
|
|
11
8
|
const { participant } = event.payload
|
|
12
9
|
const [introduction] = useTranslatedEventData(event)
|
|
13
10
|
|
|
@@ -21,13 +18,11 @@ const Participant = ({ event }) => {
|
|
|
21
18
|
return null
|
|
22
19
|
}
|
|
23
20
|
|
|
24
|
-
const avatar = participant.avatar || agent?.avatar
|
|
25
|
-
|
|
26
21
|
return (
|
|
27
22
|
<EventDivider
|
|
28
|
-
graphicSrc={avatar}
|
|
29
|
-
graphicType={avatar ? 'avatar' : undefined}
|
|
30
|
-
iconName={!avatar ? 'balloon' : undefined}
|
|
23
|
+
graphicSrc={participant.avatar}
|
|
24
|
+
graphicType={participant.avatar ? 'avatar' : undefined}
|
|
25
|
+
iconName={!participant.avatar ? 'balloon' : undefined}
|
|
31
26
|
childrenHTML={intro}
|
|
32
27
|
dividerType="participant"
|
|
33
28
|
/>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useMemo } from 'preact/hooks'
|
|
2
2
|
import parseBody from 'lib/parse-body'
|
|
3
|
-
import useEventLinkClickHandler from './hooks/use-event-link-click-handler'
|
|
4
|
-
import { parseRichText } from './hooks/use-text-rendering'
|
|
5
3
|
import MessageContainer from 'ui/components/conversation/message-container'
|
|
6
4
|
import { useTranslatedEventData } from 'domains/translations'
|
|
5
|
+
import useEventLinkClickHandler from './hooks/use-event-link-click-handler'
|
|
6
|
+
import { parseRichText } from './hooks/use-text-rendering'
|
|
7
7
|
|
|
8
8
|
const Text = ({ event, ...props }) => {
|
|
9
9
|
const [body] = useTranslatedEventData(event)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import EventParticipant from './event/event-participant'
|
|
2
1
|
import { useSeamlyCurrentAgent } from 'ui/hooks/seamly-hooks'
|
|
3
2
|
import { className } from 'lib/css'
|
|
3
|
+
import EventParticipant from './event/event-participant'
|
|
4
4
|
|
|
5
5
|
const Loader = () => {
|
|
6
6
|
const { id } = useSeamlyCurrentAgent() || {}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { className } from 'lib/css'
|
|
2
|
-
import EventParticipant from './event/event-participant'
|
|
3
2
|
import { useSeamlyMessageContainerClassNames } from 'ui/hooks/component-helper-hooks'
|
|
4
3
|
import { useTranslatedEventData } from 'domains/translations'
|
|
5
4
|
import { useI18n } from 'domains/i18n'
|
|
5
|
+
import EventParticipant from './event/event-participant'
|
|
6
6
|
|
|
7
7
|
function MessageContainer({
|
|
8
8
|
showParticipant = true,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useRef, useCallback } from 'preact/hooks'
|
|
2
|
-
import SeamlyActivityEventContext from './seamly-activity-event-context'
|
|
3
2
|
import {
|
|
4
3
|
useSeamlyCommands,
|
|
5
4
|
useSeamlyIdleDetachCountdown,
|
|
6
5
|
} from 'ui/hooks/seamly-hooks'
|
|
7
6
|
import { activitySendDelay } from 'config'
|
|
8
7
|
import { className } from 'lib/css'
|
|
8
|
+
import SeamlyActivityEventContext from './seamly-activity-event-context'
|
|
9
9
|
|
|
10
10
|
const SeamlyActivityMonitor = ({ children }) => {
|
|
11
11
|
const prevSendTimestamp = useRef(0)
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { useErrorBoundary } from 'preact/hooks'
|
|
2
|
+
import { StoreProvider } from 'domains/redux'
|
|
3
|
+
import { catchError } from 'domains/errors'
|
|
2
4
|
import SeamlyInstanceFunctionsLoader from './seamly-instance-functions-loader'
|
|
3
5
|
import SeamlyReadState from './seamly-read-state'
|
|
4
6
|
import SeamlyNewNotifications from './seamly-new-notifications'
|
|
@@ -9,8 +11,6 @@ import SeamlyInitializer from './seamly-initializer'
|
|
|
9
11
|
import SeamlyEventSubscriber from './seamly-event-subscriber'
|
|
10
12
|
import SeamlyFileUpload from './seamly-file-upload'
|
|
11
13
|
import { SeamlyEventBusContext, SeamlyApiContext } from './seamly-api-context'
|
|
12
|
-
import { StoreProvider } from 'domains/redux'
|
|
13
|
-
import { catchError } from 'domains/errors'
|
|
14
14
|
import ComponentFilter from '../conversation/component-filter'
|
|
15
15
|
|
|
16
16
|
const SeamlyCore = ({ store, children, config, eventBus, api }) => {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import SeamlyFileUploadContext from './seamly-file-upload-context'
|
|
2
1
|
import { useI18n } from 'domains/i18n'
|
|
3
2
|
import { randomId } from 'lib/id'
|
|
4
3
|
import { seamlyActions } from 'ui/utils/seamly-utils'
|
|
@@ -7,6 +6,7 @@ import {
|
|
|
7
6
|
useSeamlyApiContext,
|
|
8
7
|
useSeamlyDispatchContext,
|
|
9
8
|
} from 'ui/hooks/seamly-hooks'
|
|
9
|
+
import SeamlyFileUploadContext from './seamly-file-upload-context'
|
|
10
10
|
|
|
11
11
|
const {
|
|
12
12
|
REGISTER_UPLOAD,
|
|
@@ -7,11 +7,12 @@ import {
|
|
|
7
7
|
useSeamlyActivityEventHandler,
|
|
8
8
|
useSeamlyApiContext,
|
|
9
9
|
} from 'ui/hooks/seamly-hooks'
|
|
10
|
-
import {
|
|
10
|
+
import { actionTypes } from 'ui/utils/seamly-utils'
|
|
11
11
|
import { useTranslations } from 'domains/translations'
|
|
12
12
|
import { useInterrupt } from 'domains/interrupt'
|
|
13
13
|
import { useConfig } from 'domains/config'
|
|
14
14
|
import { visibilityStates, useVisibility } from 'domains/visibility'
|
|
15
|
+
import { SeamlyEventBusContext } from './seamly-api-context'
|
|
15
16
|
|
|
16
17
|
function useSeamlyInstanceFunction(functionName, fn, deps = []) {
|
|
17
18
|
const eventBus = useContext(SeamlyEventBusContext)
|
|
@@ -101,7 +102,10 @@ const SeamlyInstanceFunctionsLoader = () => {
|
|
|
101
102
|
'setTopic',
|
|
102
103
|
({ name, fallbackMessage }) => {
|
|
103
104
|
if (name && fallbackMessage) {
|
|
104
|
-
sendAction({
|
|
105
|
+
sendAction({
|
|
106
|
+
type: actionTypes.setTopic,
|
|
107
|
+
body: { name, fallbackMessage },
|
|
108
|
+
})
|
|
105
109
|
} else {
|
|
106
110
|
console.warn(
|
|
107
111
|
'A name and a fallbackMessage are required for the setTopic action.',
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
useCallback,
|
|
6
6
|
useContext,
|
|
7
7
|
} from 'preact/hooks'
|
|
8
|
-
import { SeamlyLiveRegionContext } from './seamly-live-region-context'
|
|
9
|
-
import { SeamlyEventBusContext } from './seamly-api-context'
|
|
10
8
|
import { ariaLiveLevels } from 'ui/utils/seamly-utils'
|
|
11
9
|
import { className } from 'lib/css'
|
|
10
|
+
import { SeamlyLiveRegionContext } from './seamly-live-region-context'
|
|
11
|
+
import { SeamlyEventBusContext } from './seamly-api-context'
|
|
12
12
|
|
|
13
13
|
const SeamlyLiveRegion = ({ children }) => {
|
|
14
14
|
const eventBus = useContext(SeamlyEventBusContext)
|
|
@@ -11,11 +11,11 @@ import { entryTypes } from 'ui/utils/seamly-utils'
|
|
|
11
11
|
import { runIfElementContainsOrHasFocus } from 'ui/utils/general-utils'
|
|
12
12
|
import IdleDetachWarning from 'ui/components/warnings/idle-detach-warning'
|
|
13
13
|
import ResumeConversationPrompt from 'ui/components/warnings/resume-conversation-prompt'
|
|
14
|
+
import { useConfig } from 'domains/config'
|
|
15
|
+
import { useVisibility } from 'domains/visibility'
|
|
14
16
|
import TextEntry from './text-entry'
|
|
15
17
|
import UploadToggle from './upload-toggle'
|
|
16
18
|
import Upload from './upload'
|
|
17
|
-
import { useConfig } from 'domains/config'
|
|
18
|
-
import { useVisibility } from 'domains/visibility'
|
|
19
19
|
|
|
20
20
|
const EntryContainer = () => {
|
|
21
21
|
const { isOpen } = useVisibility()
|
|
@@ -3,10 +3,7 @@ import { useI18n } from 'domains/i18n'
|
|
|
3
3
|
import { useLiveRegion } from 'ui/hooks/live-region-hooks'
|
|
4
4
|
import { useEntryTextLimit } from 'ui/hooks/seamly-state-hooks'
|
|
5
5
|
import { debounce } from 'ui/utils/general-utils'
|
|
6
|
-
import {
|
|
7
|
-
maxCharacterSrDebounceDelay,
|
|
8
|
-
maxCharacterWarningLimit,
|
|
9
|
-
} from 'config'
|
|
6
|
+
import { maxCharacterSrDebounceDelay, maxCharacterWarningLimit } from 'config'
|
|
10
7
|
import { useFormControl } from 'domains/forms'
|
|
11
8
|
|
|
12
9
|
export function useCharacterLimit(controlName) {
|
|
@@ -10,8 +10,8 @@ import Icon from 'ui/components/layout/icon'
|
|
|
10
10
|
import { useFormControl } from 'domains/forms'
|
|
11
11
|
import Form from 'ui/components/form-controls/form'
|
|
12
12
|
import Input from 'ui/components/form-controls/input'
|
|
13
|
-
import { useCharacterLimit } from './hooks'
|
|
14
13
|
import { useI18n } from 'domains/i18n'
|
|
14
|
+
import { useCharacterLimit } from './hooks'
|
|
15
15
|
|
|
16
16
|
export default function TextEntryForm({ controlName, skipLinkId }) {
|
|
17
17
|
const { t } = useI18n()
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import Icon from './icon'
|
|
2
1
|
import {
|
|
3
2
|
useSeamlyHeaderData,
|
|
4
3
|
useSeamlyUnreadCount,
|
|
@@ -9,6 +8,7 @@ import { useI18n } from 'domains/i18n'
|
|
|
9
8
|
import { useInterrupt } from 'domains/interrupt'
|
|
10
9
|
import { useStartChatIcon } from 'domains/config'
|
|
11
10
|
import { useVisibility } from 'domains/visibility'
|
|
11
|
+
import Icon from './icon'
|
|
12
12
|
|
|
13
13
|
const AgentInfo = () => {
|
|
14
14
|
const { t } = useI18n()
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useRef } from 'preact/hooks'
|
|
2
2
|
import { className } from 'lib/css'
|
|
3
|
-
import Icon from './icon'
|
|
4
3
|
import { useI18n } from 'domains/i18n'
|
|
5
4
|
import { useSeamlyStateContext } from 'ui/hooks/seamly-hooks'
|
|
5
|
+
import Icon from './icon'
|
|
6
6
|
|
|
7
7
|
const Header = ({ children, onCloseChat }) => {
|
|
8
8
|
const { headerCollapseButtonId } = useSeamlyStateContext()
|
|
@@ -4,11 +4,11 @@ import { className } from 'lib/css'
|
|
|
4
4
|
import { useSeamlyOptions, useOptionButton } from 'ui/hooks/seamly-hooks'
|
|
5
5
|
import { useI18n } from 'domains/i18n'
|
|
6
6
|
import Icon from 'ui/components/layout/icon'
|
|
7
|
-
import Options from './options'
|
|
8
7
|
import InOutTransition, {
|
|
9
8
|
transitionStartStates,
|
|
10
9
|
} from 'ui/components/widgets/in-out-transition'
|
|
11
10
|
import { getKey, keyNames, focusElement } from 'ui/utils/general-utils'
|
|
11
|
+
import Options from './options'
|
|
12
12
|
|
|
13
13
|
const OptionsButton = () => {
|
|
14
14
|
const { t } = useI18n()
|
|
@@ -10,9 +10,9 @@ import {
|
|
|
10
10
|
} from 'ui/hooks/seamly-hooks'
|
|
11
11
|
import { actionTypes } from 'ui/utils/seamly-utils'
|
|
12
12
|
import { FormProvider } from 'domains/forms'
|
|
13
|
-
import TranscriptForm from './transcript-form'
|
|
14
13
|
import { getValidator } from 'ui/utils/form-utils'
|
|
15
14
|
import { isEmailString, isNotEmptyString } from 'ui/utils/validations'
|
|
15
|
+
import TranscriptForm from './transcript-form'
|
|
16
16
|
|
|
17
17
|
const formId = 'sendTranscript'
|
|
18
18
|
const controlName = 'email'
|
|
@@ -15,7 +15,7 @@ const SuggestionsItem = ({
|
|
|
15
15
|
hasIcon,
|
|
16
16
|
}) => {
|
|
17
17
|
const mappedClassNames = useMemo(() => {
|
|
18
|
-
return ['
|
|
18
|
+
return ['suggestions__item', ...categories.map(mapCategoryToClass)]
|
|
19
19
|
}, [categories])
|
|
20
20
|
|
|
21
21
|
const handleClick = useCallback(() => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { className } from 'lib/css'
|
|
2
2
|
import { useI18n } from 'domains/i18n'
|
|
3
|
-
import Prompt from './prompt'
|
|
4
3
|
import useSeamlyResumeConversationPrompt from 'ui/hooks/use-seamly-resume-conversation-prompt'
|
|
5
4
|
import useSeamlyActivityEventHandler from 'ui/hooks/use-seamly-activity-event-handler'
|
|
6
5
|
import { useSeamlyCurrentAgent } from 'ui/hooks/seamly-state-hooks'
|
|
6
|
+
import Prompt from './prompt'
|
|
7
7
|
|
|
8
8
|
const ResumeConversationPrompt = () => {
|
|
9
9
|
const { t } = useI18n()
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useRef } from 'preact/hooks'
|
|
2
|
-
import Modal from './modal'
|
|
3
2
|
import { useI18n } from 'domains/i18n'
|
|
4
3
|
import {
|
|
5
4
|
useSeamlyActivityEventHandler,
|
|
@@ -8,6 +7,7 @@ import {
|
|
|
8
7
|
import { className } from 'lib/css'
|
|
9
8
|
import Icon from 'ui/components/layout/icon'
|
|
10
9
|
import { useConfig } from 'domains/config'
|
|
10
|
+
import Modal from './modal'
|
|
11
11
|
|
|
12
12
|
const Lightbox = ({ url, description, onClose: onCloseHandler }) => {
|
|
13
13
|
const { zIndex, layoutMode, namespace } = useConfig()
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { useCallback, useContext } from 'preact/hooks'
|
|
2
|
-
import { useSeamlyStateContext } from './seamly-state-hooks'
|
|
3
|
-
import useSeamlyDispatchContext from './use-seamly-dispatch'
|
|
4
2
|
import SeamlyFileUploadContext from 'ui/components/core/seamly-file-upload-context'
|
|
5
|
-
|
|
6
3
|
import { seamlyActions } from 'ui/utils/seamly-utils'
|
|
4
|
+
import { useSeamlyStateContext } from './seamly-state-hooks'
|
|
5
|
+
import useSeamlyDispatchContext from './use-seamly-dispatch'
|
|
7
6
|
|
|
8
7
|
const { CLEAR_ALL_UPLOADS } = seamlyActions
|
|
9
8
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useCallback, useRef } from 'preact/hooks'
|
|
2
|
-
import { useSeamlyStateContext, useSkiplink } from './seamly-state-hooks'
|
|
3
2
|
import {
|
|
4
3
|
focusElement,
|
|
5
4
|
runIfElementContainsOrHasFocus,
|
|
6
5
|
} from 'ui/utils/general-utils'
|
|
7
|
-
import useSeamlyDispatchContext from './use-seamly-dispatch'
|
|
8
6
|
import { seamlyActions } from 'ui/utils/seamly-utils'
|
|
7
|
+
import { useSeamlyStateContext, useSkiplink } from './seamly-state-hooks'
|
|
8
|
+
import useSeamlyDispatchContext from './use-seamly-dispatch'
|
|
9
9
|
|
|
10
10
|
const { SET_SEAMLY_CONTAINER_ELEMENT } = seamlyActions
|
|
11
11
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useRef, useCallback, useEffect } from 'preact/hooks'
|
|
2
2
|
import { seamlyActions, actionTypes } from 'ui/utils/seamly-utils'
|
|
3
|
+
import { typingTimeout } from 'config'
|
|
3
4
|
import { useSeamlyStateContext } from './seamly-state-hooks'
|
|
4
5
|
import useSeamlyDispatchContext from './use-seamly-dispatch'
|
|
5
6
|
import { useSeamlyOptions } from './seamly-option-hooks'
|
|
6
7
|
import useSeamlyCommands from './use-seamly-commands'
|
|
7
|
-
import { typingTimeout } from 'config'
|
|
8
8
|
|
|
9
9
|
const {
|
|
10
10
|
SET_BLOCK_AUTO_ENTRY_SWITCH,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useCallback } from 'preact/hooks'
|
|
2
2
|
import { useI18n } from 'domains/i18n'
|
|
3
|
+
import { seamlyActions } from 'ui/utils/seamly-utils'
|
|
3
4
|
import { useSeamlyStateContext } from './seamly-state-hooks'
|
|
4
5
|
import useSeamlyDispatchContext from './use-seamly-dispatch'
|
|
5
6
|
import { useSeamlyObjectStore } from './seamly-api-hooks'
|
|
6
7
|
import { useElementFocusingById } from './focus-helper-hooks'
|
|
7
|
-
import { seamlyActions } from 'ui/utils/seamly-utils'
|
|
8
8
|
|
|
9
9
|
const {
|
|
10
10
|
SET_USER_SELECTED_OPTION,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'preact/hooks'
|
|
2
2
|
import { useI18n } from 'domains/i18n'
|
|
3
|
+
import { seamlyActions } from 'ui/utils/seamly-utils'
|
|
4
|
+
import { useVisibility, visibilityStates } from 'domains/visibility'
|
|
3
5
|
import useSeamlyDispatchContext from './use-seamly-dispatch'
|
|
4
6
|
import { useEvents } from './seamly-state-hooks'
|
|
5
7
|
import useSeamlyCommands from './use-seamly-commands'
|
|
6
8
|
import { useSeamlyHasConversation } from './seamly-api-hooks'
|
|
7
9
|
import { useLiveRegion } from './live-region-hooks'
|
|
8
|
-
import { seamlyActions } from 'ui/utils/seamly-utils'
|
|
9
|
-
import { useVisibility, visibilityStates } from 'domains/visibility'
|
|
10
10
|
import { useConfig } from '../../domains/config'
|
|
11
11
|
|
|
12
12
|
const { SET_IS_LOADING } = seamlyActions
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { useCallback, useContext } from 'preact/hooks'
|
|
2
|
-
import {
|
|
3
|
-
useSeamlyApiContext,
|
|
4
|
-
useSeamlyHasConversation,
|
|
5
|
-
} from './seamly-api-hooks'
|
|
6
|
-
import { useSeamlyUnreadCount } from './seamly-state-hooks'
|
|
7
|
-
import useSeamlyDispatchContext from './use-seamly-dispatch'
|
|
8
2
|
import { SeamlyEventBusContext } from 'ui/components/core/seamly-api-context'
|
|
9
3
|
import { randomId } from 'lib/id'
|
|
10
4
|
import { userParticipantId } from 'config'
|
|
11
5
|
import { actionTypes, seamlyActions } from 'ui/utils/seamly-utils'
|
|
12
|
-
import { useStableCallback } from './utility-hooks'
|
|
13
6
|
import { Actions as InterruptActions } from 'domains/interrupt'
|
|
14
7
|
import { useConfig } from 'domains/config'
|
|
15
8
|
import * as AppActions from 'domains/app/actions'
|
|
16
9
|
import { useUserHasResponded } from 'domains/app/hooks'
|
|
17
10
|
import { useVisibility } from 'domains/visibility'
|
|
11
|
+
import { useStableCallback } from './utility-hooks'
|
|
12
|
+
import useSeamlyDispatchContext from './use-seamly-dispatch'
|
|
13
|
+
import { useSeamlyUnreadCount } from './seamly-state-hooks'
|
|
14
|
+
import {
|
|
15
|
+
useSeamlyApiContext,
|
|
16
|
+
useSeamlyHasConversation,
|
|
17
|
+
} from './seamly-api-hooks'
|
|
18
18
|
|
|
19
19
|
const { ADD_EVENT, SET_INITIAL_STATE } = seamlyActions
|
|
20
20
|
|