@seamly/web-ui 20.0.0-beta.3 → 20.0.0-beta.4
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/build/dist/lib/components.js +1 -1
- package/build/dist/lib/components.min.js +1 -1
- package/build/dist/lib/deprecated-view.css +1 -0
- package/build/dist/lib/deprecated-view.js +1 -0
- package/build/dist/lib/index.debug.js +75 -52
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.debug.min.js.LICENSE.txt +20 -12
- package/build/dist/lib/index.js +14465 -13888
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/index.min.js.LICENSE.txt +5 -0
- package/build/dist/lib/standalone.js +19693 -19678
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/style-guide.js +68 -26
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/styles-default-implementation.css +1 -0
- package/build/dist/lib/styles-default-implementation.js +1 -0
- package/build/dist/lib/styles.css +1 -1
- package/package.json +8 -7
- package/src/javascripts/domains/translations/components/options-button.js +1 -1
- package/src/javascripts/index.js +2 -2
- package/src/javascripts/lib/parse-body.js +1 -1
- package/src/javascripts/package/components.js +1 -1
- package/src/javascripts/style-guide/components/view.js +1 -0
- package/src/javascripts/style-guide/states.js +48 -6
- package/src/javascripts/ui/components/app-options/index.js +9 -3
- package/src/javascripts/ui/components/conversation/conversation.js +1 -1
- package/src/javascripts/ui/components/conversation/event/carousel-message/index.js +3 -1
- package/src/javascripts/ui/components/conversation/event/conversation-suggestions.js +12 -3
- package/src/javascripts/ui/components/conversation/event/hooks/use-text-rendering.js +35 -0
- package/src/javascripts/ui/components/conversation/event/participant.js +5 -2
- package/src/javascripts/ui/components/conversation/event/splash.js +2 -1
- package/src/javascripts/ui/components/conversation/event/text.js +2 -1
- package/src/javascripts/ui/components/entry/{toggle-button.js → deprecated-toggle-button.js} +0 -0
- package/src/javascripts/ui/components/entry/entry-container.js +1 -1
- package/src/javascripts/ui/components/layout/chat-frame.js +1 -1
- package/src/javascripts/ui/components/layout/{app-frame.js → chat.js} +10 -41
- package/src/javascripts/ui/components/layout/deprecated-app-frame.js +1 -8
- package/src/javascripts/ui/components/layout/header.js +1 -1
- package/src/javascripts/ui/components/options/options-button.js +2 -2
- package/src/javascripts/ui/components/suggestions/index.js +2 -2
- package/src/javascripts/ui/components/view/app-view.js +3 -3
- package/src/javascripts/ui/components/view/deprecated-view.js +2 -2
- package/src/javascripts/ui/components/view/index.js +61 -5
- package/src/javascripts/ui/components/view/inline-view.js +9 -3
- package/src/javascripts/ui/components/view/window-view/index.js +3 -3
- package/src/stylesheets/1-settings/_config.scss +6 -6
- package/src/stylesheets/{3-app/_app.scss → 3-chat/_chat.scss} +27 -25
- package/src/stylesheets/5-components/_conversation.scss +2 -2
- package/src/stylesheets/5-components/_disclaimer.scss +1 -1
- package/src/stylesheets/5-components/_message-count.scss +1 -0
- package/src/stylesheets/5-components/_modal.scss +2 -2
- package/src/stylesheets/5-components/_options.scss +8 -8
- package/src/stylesheets/5-components/_pre-chat-messages.scss +6 -2
- package/src/stylesheets/5-components/_suggestions.scss +12 -6
- package/src/stylesheets/5-components/_unstarted.scss +14 -8
- package/src/stylesheets/6-default-implementation/_hover.scss +153 -0
- package/src/stylesheets/{6-webui-only → 6-default-implementation}/_scrollbar.scss +1 -1
- package/src/stylesheets/7-deprecated/3-app/_app.scss +8 -8
- package/src/stylesheets/7-deprecated/5-components/_options.scss +8 -8
- package/src/stylesheets/styles-default-implementation.scss +3 -0
- package/src/stylesheets/styles.scss +8 -9
- package/webpack/config.package.js +9 -1
- package/webpack/defaults.js +3 -6
- package/src/javascripts/ui/components/layout/modal-wrapper.js +0 -0
- package/src/stylesheets/6-webui-only/_hover.scss +0 -151
- package/src/stylesheets/styles-webui-only.scss +0 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useMemo } from 'preact/hooks'
|
|
2
|
+
import Mustache from 'mustache'
|
|
2
3
|
import parseBody from '../../../../lib/parse-body'
|
|
3
4
|
import EventDivider from '../event-divider'
|
|
4
5
|
import { useTranslatedEventData } from '../../../../domains/translations'
|
|
@@ -11,8 +12,10 @@ const Participant = ({ event }) => {
|
|
|
11
12
|
const [introduction] = useTranslatedEventData(event)
|
|
12
13
|
|
|
13
14
|
const intro = useMemo(() => {
|
|
14
|
-
return introduction
|
|
15
|
-
|
|
15
|
+
return introduction
|
|
16
|
+
? Mustache.render(parseBody(introduction), participant)
|
|
17
|
+
: undefined
|
|
18
|
+
}, [introduction, participant])
|
|
16
19
|
|
|
17
20
|
if (!intro) {
|
|
18
21
|
return null
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import parseBody from '../../../../lib/parse-body'
|
|
2
2
|
import useEventLinkClickHandler from './hooks/use-event-link-click-handler'
|
|
3
|
+
import { parseRichText } from './hooks/use-text-rendering'
|
|
3
4
|
import MessageContainer from '../message-container'
|
|
4
5
|
import { useTranslatedEventData } from '../../../../domains/translations'
|
|
5
6
|
|
|
@@ -16,7 +17,7 @@ const Splash = ({ event, ...props }) => {
|
|
|
16
17
|
{...props}
|
|
17
18
|
bodyProps={{
|
|
18
19
|
dangerouslySetInnerHTML: {
|
|
19
|
-
__html: parseBody(body.text),
|
|
20
|
+
__html: parseRichText(parseBody(body.text), body.variables),
|
|
20
21
|
},
|
|
21
22
|
}}
|
|
22
23
|
/>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useMemo } from 'preact/hooks'
|
|
2
2
|
import parseBody from '../../../../lib/parse-body'
|
|
3
3
|
import useEventLinkClickHandler from './hooks/use-event-link-click-handler'
|
|
4
|
+
import { parseRichText } from './hooks/use-text-rendering'
|
|
4
5
|
import MessageContainer from '../message-container'
|
|
5
6
|
import { useTranslatedEventData } from '../../../../domains/translations'
|
|
6
7
|
|
|
@@ -13,7 +14,7 @@ const Text = ({ event, ...props }) => {
|
|
|
13
14
|
return {
|
|
14
15
|
bodyProps: {
|
|
15
16
|
dangerouslySetInnerHTML: {
|
|
16
|
-
__html: parseBody(body.text),
|
|
17
|
+
__html: parseRichText(parseBody(body.text), body.variables),
|
|
17
18
|
},
|
|
18
19
|
},
|
|
19
20
|
}
|
package/src/javascripts/ui/components/entry/{toggle-button.js → deprecated-toggle-button.js}
RENAMED
|
File without changes
|
|
@@ -79,7 +79,7 @@ const EntryContainer = () => {
|
|
|
79
79
|
const EntryComponent = entryComponents[renderEntry]
|
|
80
80
|
|
|
81
81
|
return (
|
|
82
|
-
<div className={className('
|
|
82
|
+
<div className={className('chat__entry')} ref={entryContainer}>
|
|
83
83
|
{showCountdown && <IdleDetachWarning />}
|
|
84
84
|
{showResumeConversationPrompt && <ResumeConversationPrompt />}
|
|
85
85
|
<div
|
|
@@ -21,7 +21,7 @@ function ChatFrame({ children, interruptComponent: InterruptComponent }) {
|
|
|
21
21
|
return (
|
|
22
22
|
<>
|
|
23
23
|
<TranslationsChatStatus />
|
|
24
|
-
<div className={className('
|
|
24
|
+
<div className={className('chat__container')}>{getContent()}</div>
|
|
25
25
|
<AppOptions />
|
|
26
26
|
</>
|
|
27
27
|
)
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { useCallback, useMemo } from 'preact/hooks'
|
|
2
1
|
import { className } from '../../../lib/css'
|
|
3
2
|
import {
|
|
4
3
|
useSeamlyAppContainerClassNames,
|
|
5
4
|
useSeamlyLayoutMode,
|
|
6
|
-
useSeamlyContainerElement,
|
|
7
5
|
} from '../../hooks/seamly-hooks'
|
|
8
6
|
import { useConfig } from '../../../domains/config'
|
|
9
7
|
import { useUserHasResponded } from '../../../domains/app'
|
|
@@ -11,57 +9,32 @@ import { useI18n } from '../../../domains/i18n'
|
|
|
11
9
|
import { useVisibility, visibilityStates } from '../../../domains/visibility'
|
|
12
10
|
import Suggestions from '../suggestions'
|
|
13
11
|
|
|
14
|
-
const
|
|
15
|
-
children,
|
|
16
|
-
className: givenClassName = '',
|
|
17
|
-
isDeprecated,
|
|
18
|
-
}) => {
|
|
19
|
-
const [, setSeamlyContainerElement] = useSeamlyContainerElement()
|
|
12
|
+
const Chat = ({ children, className: givenClassName = '' }) => {
|
|
20
13
|
const { isOpen, isVisible, setVisibility } = useVisibility()
|
|
21
|
-
const {
|
|
14
|
+
const { namespace, layoutMode } = useConfig()
|
|
22
15
|
const { isInline } = useSeamlyLayoutMode()
|
|
23
16
|
const appContainerClassNames = useSeamlyAppContainerClassNames()
|
|
24
17
|
const userResponded = useUserHasResponded()
|
|
25
|
-
const {
|
|
18
|
+
const { t } = useI18n()
|
|
26
19
|
|
|
27
|
-
const containerElementRef = useCallback(
|
|
28
|
-
(container) => {
|
|
29
|
-
setSeamlyContainerElement(container)
|
|
30
|
-
},
|
|
31
|
-
[setSeamlyContainerElement],
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
const blockLang = useMemo(() => {
|
|
35
|
-
if (locale) {
|
|
36
|
-
const htmlElementLang = document
|
|
37
|
-
.querySelector('html')
|
|
38
|
-
.getAttribute('lang')
|
|
39
|
-
if (htmlElementLang !== locale) {
|
|
40
|
-
return locale
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return undefined
|
|
44
|
-
}, [locale])
|
|
45
|
-
|
|
46
|
-
const baseClassName = isDeprecated ? 'app--deprecated' : 'app'
|
|
47
20
|
const defaultClassNames = [
|
|
48
|
-
|
|
21
|
+
'chat',
|
|
22
|
+
`chat--layout-${layoutMode}`,
|
|
49
23
|
`namespace--${namespace}`,
|
|
50
24
|
]
|
|
51
25
|
|
|
52
26
|
const classNames = [
|
|
53
|
-
baseClassName,
|
|
54
27
|
...defaultClassNames,
|
|
55
28
|
...appContainerClassNames,
|
|
56
29
|
givenClassName,
|
|
57
30
|
]
|
|
58
31
|
|
|
59
32
|
if (!isOpen && layoutMode !== 'app') {
|
|
60
|
-
classNames.push('
|
|
33
|
+
classNames.push('chat--collapsed')
|
|
61
34
|
}
|
|
62
35
|
|
|
63
36
|
if (userResponded) {
|
|
64
|
-
classNames.push('
|
|
37
|
+
classNames.push('chat--user-responded')
|
|
65
38
|
}
|
|
66
39
|
|
|
67
40
|
const onKeyDownHandler = (e) => {
|
|
@@ -76,18 +49,14 @@ const AppFrame = ({
|
|
|
76
49
|
<section
|
|
77
50
|
className={className(classNames)}
|
|
78
51
|
onKeyDown={onKeyDownHandler}
|
|
79
|
-
lang={blockLang}
|
|
80
52
|
tabIndex="-1"
|
|
81
|
-
|
|
82
|
-
style={{ zIndex }}
|
|
83
|
-
data-nosnippet
|
|
84
|
-
aria-label={t('app.srLabel')}
|
|
53
|
+
aria-label={t('chat.srLabel')}
|
|
85
54
|
>
|
|
86
|
-
<div className={className('
|
|
55
|
+
<div className={className('chat-wrapper')}>{children}</div>
|
|
87
56
|
{layoutMode === 'inline' && isOpen && <Suggestions isAside={true} />}
|
|
88
57
|
</section>
|
|
89
58
|
)
|
|
90
59
|
)
|
|
91
60
|
}
|
|
92
61
|
|
|
93
|
-
export default
|
|
62
|
+
export default Chat
|
|
@@ -15,7 +15,7 @@ const DeprecatedAppFrame = ({ children }) => {
|
|
|
15
15
|
const [, setSeamlyContainerElement] = useSeamlyContainerElement()
|
|
16
16
|
const { isOpen, isVisible, setVisibility } = useVisibility()
|
|
17
17
|
const { zIndex, showFaq, layoutMode } = useConfig()
|
|
18
|
-
const {
|
|
18
|
+
const { isInline } = useSeamlyLayoutMode()
|
|
19
19
|
const appContainerClassNames = useSeamlyAppContainerClassNames()
|
|
20
20
|
const userResponded = useUserHasResponded()
|
|
21
21
|
const { locale } = useI18n()
|
|
@@ -58,18 +58,11 @@ const DeprecatedAppFrame = ({ children }) => {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
const onClickHandler = (e) => {
|
|
62
|
-
if (isModal) {
|
|
63
|
-
e.stopPropagation()
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
61
|
return (
|
|
68
62
|
isVisible && (
|
|
69
63
|
<section
|
|
70
64
|
className={className(classNames)}
|
|
71
65
|
onKeyDown={onKeyDownHandler}
|
|
72
|
-
onClick={onClickHandler}
|
|
73
66
|
lang={blockLang}
|
|
74
67
|
tabIndex="-1"
|
|
75
68
|
ref={containerElementRef}
|
|
@@ -10,7 +10,7 @@ const Header = ({ children, onCloseChat }) => {
|
|
|
10
10
|
|
|
11
11
|
const { t } = useI18n()
|
|
12
12
|
return (
|
|
13
|
-
<header className={className('
|
|
13
|
+
<header className={className('chat__header')}>
|
|
14
14
|
{children}
|
|
15
15
|
<div className={className('header-controls')}>
|
|
16
16
|
<button
|
|
@@ -223,9 +223,9 @@ const OptionsButton = () => {
|
|
|
223
223
|
className={className([
|
|
224
224
|
'button',
|
|
225
225
|
'button--secondary',
|
|
226
|
-
'
|
|
226
|
+
'chat__options__button',
|
|
227
227
|
...(!multiMenu && firstOptionName
|
|
228
|
-
? [`
|
|
228
|
+
? [`chat__options__button--${firstOptionName}`]
|
|
229
229
|
: []),
|
|
230
230
|
...(!multiMenu && !firstOption.available ? ['button--disabled'] : []),
|
|
231
231
|
])}
|
|
@@ -152,9 +152,9 @@ const Suggestions = ({ isAside }) => {
|
|
|
152
152
|
ref={containerRef}
|
|
153
153
|
>
|
|
154
154
|
{headingText && (
|
|
155
|
-
<
|
|
155
|
+
<p id={sectionId} className={className('suggestions__heading')}>
|
|
156
156
|
{headingText}
|
|
157
|
-
</
|
|
157
|
+
</p>
|
|
158
158
|
)}
|
|
159
159
|
{!!renderedSuggestions.length && (
|
|
160
160
|
<SuggestionsList
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Chat from '../layout/chat'
|
|
2
2
|
import Interrupt from '../layout/interrupt'
|
|
3
3
|
import Conversation from '../conversation/conversation'
|
|
4
4
|
import EntryContainer from '../entry/entry-container'
|
|
@@ -9,12 +9,12 @@ const AppView = () => {
|
|
|
9
9
|
useSeamlyChat()
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
|
-
<
|
|
12
|
+
<Chat>
|
|
13
13
|
<ChatFrame interruptComponent={Interrupt}>
|
|
14
14
|
<Conversation />
|
|
15
15
|
<EntryContainer />
|
|
16
16
|
</ChatFrame>
|
|
17
|
-
</
|
|
17
|
+
</Chat>
|
|
18
18
|
)
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -7,11 +7,11 @@ import EntryContainer from '../entry/entry-container'
|
|
|
7
7
|
import Interrupt from '../layout/interrupt'
|
|
8
8
|
import { useSeamlyChat } from '../../hooks/seamly-hooks'
|
|
9
9
|
import { useVisibility } from '../../../domains/visibility'
|
|
10
|
-
import DeprecatedToggleButton from '../entry/toggle-button'
|
|
10
|
+
import DeprecatedToggleButton from '../entry/deprecated-toggle-button'
|
|
11
11
|
|
|
12
12
|
const DeprecatedView = () => {
|
|
13
13
|
const { isVisible } = useVisibility()
|
|
14
|
-
const {
|
|
14
|
+
const { openChat, closeChat } = useSeamlyChat()
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
isVisible && (
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import { useCallback, useMemo } from 'preact/hooks'
|
|
1
2
|
import { useConfig } from '../../../domains/config'
|
|
2
3
|
import AppView from './app-view'
|
|
3
4
|
import InlineView from './inline-view'
|
|
4
5
|
import WindowView from './window-view'
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
6
|
+
import { useVisibility } from '../../../domains/visibility'
|
|
7
|
+
import { className } from '../../../lib/css'
|
|
8
|
+
import { useSeamlyAppContainerClassNames } from '../../hooks/component-helper-hooks'
|
|
9
|
+
import { useUserHasResponded } from '../../../domains/app'
|
|
10
|
+
import { useI18n } from '../../../domains/i18n'
|
|
11
|
+
import { useSeamlyContainerElement } from '../../hooks/focus-helper-hooks'
|
|
7
12
|
|
|
8
13
|
const ViewComponentsMap = {
|
|
9
14
|
app: AppView,
|
|
@@ -12,16 +17,67 @@ const ViewComponentsMap = {
|
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
const View = () => {
|
|
15
|
-
const
|
|
16
|
-
const {
|
|
20
|
+
const [, setSeamlyContainerElement] = useSeamlyContainerElement()
|
|
21
|
+
const { namespace, layoutMode, zIndex } = useConfig()
|
|
22
|
+
const { isOpen, isVisible } = useVisibility()
|
|
23
|
+
const appContainerClassNames = useSeamlyAppContainerClassNames()
|
|
24
|
+
const userResponded = useUserHasResponded()
|
|
25
|
+
const { locale } = useI18n()
|
|
17
26
|
const ViewComponent = ViewComponentsMap[layoutMode]
|
|
18
27
|
|
|
28
|
+
const containerElementRef = useCallback(
|
|
29
|
+
(container) => {
|
|
30
|
+
setSeamlyContainerElement(container)
|
|
31
|
+
},
|
|
32
|
+
[setSeamlyContainerElement],
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
const blockLang = useMemo(() => {
|
|
36
|
+
if (locale) {
|
|
37
|
+
const htmlElementLang = document
|
|
38
|
+
.querySelector('html')
|
|
39
|
+
.getAttribute('lang')
|
|
40
|
+
if (htmlElementLang !== locale) {
|
|
41
|
+
return locale
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return undefined
|
|
45
|
+
}, [locale])
|
|
46
|
+
|
|
19
47
|
if (!ViewComponent) {
|
|
20
48
|
console.warn('"layoutMode" should be one of "app", "inline" or "window"')
|
|
21
49
|
return null
|
|
22
50
|
}
|
|
23
51
|
|
|
24
|
-
|
|
52
|
+
const defaultClassNames = [
|
|
53
|
+
`app--layout-${layoutMode}`,
|
|
54
|
+
`namespace--${namespace}`,
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
const classNames = ['app', ...defaultClassNames, ...appContainerClassNames]
|
|
58
|
+
|
|
59
|
+
if (!isOpen && layoutMode !== 'app') {
|
|
60
|
+
classNames.push('app--collapsed')
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (userResponded) {
|
|
64
|
+
classNames.push('app--user-responded')
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
isVisible && (
|
|
69
|
+
<div
|
|
70
|
+
className={className(classNames)}
|
|
71
|
+
lang={blockLang}
|
|
72
|
+
tabIndex="-1"
|
|
73
|
+
data-nosnippet
|
|
74
|
+
style={{ zIndex }}
|
|
75
|
+
ref={containerElementRef}
|
|
76
|
+
>
|
|
77
|
+
<ViewComponent />
|
|
78
|
+
</div>
|
|
79
|
+
)
|
|
80
|
+
)
|
|
25
81
|
}
|
|
26
82
|
|
|
27
83
|
export default View
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { className } from '../../../lib/css'
|
|
2
|
-
import
|
|
2
|
+
import Chat from '../layout/chat'
|
|
3
3
|
import Interrupt from '../layout/interrupt'
|
|
4
4
|
import Conversation from '../conversation/conversation'
|
|
5
5
|
import EntryContainer from '../entry/entry-container'
|
|
@@ -11,10 +11,16 @@ import Suggestions from '../suggestions'
|
|
|
11
11
|
import InOutTransition, {
|
|
12
12
|
transitionStartStates,
|
|
13
13
|
} from '../widgets/in-out-transition'
|
|
14
|
+
import { useInterrupt } from '../../../domains/interrupt'
|
|
14
15
|
|
|
15
16
|
const InlineView = () => {
|
|
16
17
|
useSeamlyChat()
|
|
17
18
|
const { isOpen } = useVisibility()
|
|
19
|
+
const { hasInterrupt, meta } = useInterrupt()
|
|
20
|
+
|
|
21
|
+
if (hasInterrupt && !isOpen) {
|
|
22
|
+
return <Interrupt {...meta} />
|
|
23
|
+
}
|
|
18
24
|
|
|
19
25
|
return (
|
|
20
26
|
<>
|
|
@@ -31,12 +37,12 @@ const InlineView = () => {
|
|
|
31
37
|
isActive={isOpen}
|
|
32
38
|
transitionStartState={transitionStartStates.rendered}
|
|
33
39
|
>
|
|
34
|
-
<
|
|
40
|
+
<Chat>
|
|
35
41
|
<ChatFrame interruptComponent={Interrupt}>
|
|
36
42
|
{isOpen && <Conversation />}
|
|
37
43
|
<EntryContainer />
|
|
38
44
|
</ChatFrame>
|
|
39
|
-
</
|
|
45
|
+
</Chat>
|
|
40
46
|
</InOutTransition>
|
|
41
47
|
</>
|
|
42
48
|
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMemo } from 'preact/hooks'
|
|
2
2
|
import { useSeamlyChat } from '../../../hooks/seamly-hooks'
|
|
3
3
|
import { useVisibility } from '../../../../domains/visibility'
|
|
4
|
-
import
|
|
4
|
+
import Chat from '../../layout/chat'
|
|
5
5
|
import ChatFrame from '../../layout/chat-frame'
|
|
6
6
|
import Interrupt from '../../layout/interrupt'
|
|
7
7
|
import Conversation from '../../conversation/conversation'
|
|
@@ -67,13 +67,13 @@ const WindowView = () => {
|
|
|
67
67
|
isActive={isOpen}
|
|
68
68
|
transitionStartState={transitionStartStates.notRendered}
|
|
69
69
|
>
|
|
70
|
-
<
|
|
70
|
+
<Chat>
|
|
71
71
|
{isOpen && <CollapseButton onClick={closeChat} />}
|
|
72
72
|
<ChatFrame interruptComponent={Interrupt}>
|
|
73
73
|
<Conversation />
|
|
74
74
|
<EntryContainer />
|
|
75
75
|
</ChatFrame>
|
|
76
|
-
</
|
|
76
|
+
</Chat>
|
|
77
77
|
</InOutTransition>
|
|
78
78
|
</>
|
|
79
79
|
)
|
|
@@ -37,7 +37,7 @@ $white: #fff !default;
|
|
|
37
37
|
$black: #000 !default;
|
|
38
38
|
|
|
39
39
|
// BACKGROUND COLORS
|
|
40
|
-
$
|
|
40
|
+
$chat-bg: $white !default;
|
|
41
41
|
|
|
42
42
|
$threadlist-agent-text-bgcolor: $grey-a;
|
|
43
43
|
$threadlist-user-text-bgcolor: $brand2;
|
|
@@ -70,13 +70,13 @@ $borderradius-small: $borderradius * 0.5 !default;
|
|
|
70
70
|
$borderradius-large: $borderradius * 2 !default;
|
|
71
71
|
|
|
72
72
|
// DIMENSIONS
|
|
73
|
-
$
|
|
74
|
-
$
|
|
73
|
+
$chat-window-width: $spacer * 18 !default;
|
|
74
|
+
$chat-window-height: $spacer * 36 !default;
|
|
75
75
|
|
|
76
|
-
$
|
|
77
|
-
$
|
|
76
|
+
$chat-inline-height: $spacer * 32 !default;
|
|
77
|
+
$chat-inline-maxheight: 90vh !default;
|
|
78
78
|
|
|
79
|
-
$
|
|
79
|
+
$chat-suggestions-maxheight: $spacer * 16 !default;
|
|
80
80
|
|
|
81
81
|
$viewport-width: 100vw !default;
|
|
82
82
|
$viewport-height: 100vh !default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.#{$n}-
|
|
1
|
+
.#{$n}-chat {
|
|
2
2
|
@include boxSizing;
|
|
3
3
|
|
|
4
4
|
display: flex;
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
transition: margin $transition, height $transition, transform $transition,
|
|
8
8
|
opacity $transition;
|
|
9
9
|
outline: 0;
|
|
10
|
-
color: set-text-color($
|
|
10
|
+
color: set-text-color($chat-bg);
|
|
11
11
|
font-family: $fontfamily-default;
|
|
12
12
|
font-size: $fontsize-small;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
&.#{$n}-app--layout-inline .#{$n}-chat {
|
|
16
16
|
height: fit-content;
|
|
17
17
|
background-color: initial;
|
|
18
18
|
box-shadow: none;
|
|
@@ -22,19 +22,19 @@
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
&.#{$n}-app--layout-inline .#{$n}-chat--collapsed .#{$n}-chat-wrapper {
|
|
26
26
|
height: auto;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
&.#{$n}-app--layout-inline .#{$n}-chat--user-responded {
|
|
30
30
|
transition: none;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
&.#{$n}-app--layout-inline .#{$n}-chat--user-responded .#{$n}-chat-wrapper {
|
|
34
34
|
transition: none;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
&.#{$n}-app--layout-window .#{$n}-chat {
|
|
38
38
|
@include responsiveAppSizing();
|
|
39
39
|
|
|
40
40
|
display: none;
|
|
@@ -42,23 +42,23 @@
|
|
|
42
42
|
z-index: $z-index;
|
|
43
43
|
right: $spacer;
|
|
44
44
|
bottom: $spacer;
|
|
45
|
-
width: $
|
|
45
|
+
width: $chat-window-width;
|
|
46
46
|
max-width: calc(100% - #{$spacer * 2});
|
|
47
|
-
height: $
|
|
47
|
+
height: $chat-window-height;
|
|
48
48
|
transform: scale(0);
|
|
49
49
|
opacity: 0;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
&.#{$n}-app--layout-window .#{$n}-chat.#{$n}-transition--visible {
|
|
53
53
|
display: flex;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
&.#{$n}-app--layout-window .#{$n}-chat.#{$n}-transition--in {
|
|
57
57
|
transform: scale(1);
|
|
58
58
|
opacity: 1;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
&.#{$n}-app--layout-app .#{$n}-chat {
|
|
62
62
|
position: fixed;
|
|
63
63
|
z-index: $z-index;
|
|
64
64
|
top: 0;
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
max-height: 100%;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
.#{$n}-
|
|
74
|
+
.#{$n}-chat-wrapper {
|
|
75
75
|
display: flex;
|
|
76
76
|
position: relative;
|
|
77
77
|
z-index: 1;
|
|
@@ -81,18 +81,18 @@
|
|
|
81
81
|
overflow: hidden;
|
|
82
82
|
transition: flex $transition, width $transition, height $transition,
|
|
83
83
|
border-radius $transition;
|
|
84
|
-
border: $thin-border solid set-border-color($
|
|
84
|
+
border: $thin-border solid set-border-color($chat-bg);
|
|
85
85
|
border-radius: $borderradius;
|
|
86
|
-
background-color: $
|
|
86
|
+
background-color: $chat-bg;
|
|
87
87
|
box-shadow: $boxshadow-soft;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
&.#{$n}-app--layout-app .#{$n}-chat-wrapper {
|
|
91
91
|
border: 0 none;
|
|
92
92
|
border-radius: 0;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
&.#{$n}-app--layout-inline .#{$n}-chat-wrapper {
|
|
96
96
|
width: 100%;
|
|
97
97
|
height: 0;
|
|
98
98
|
|
|
@@ -111,12 +111,14 @@
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
&.#{$n}-app--layout-inline
|
|
115
|
+
.#{$n}-chat.#{$n}-transition--in
|
|
116
|
+
.#{$n}-chat-wrapper {
|
|
117
|
+
height: $chat-inline-height;
|
|
118
|
+
max-height: $chat-inline-maxheight;
|
|
117
119
|
}
|
|
118
120
|
|
|
119
|
-
.#{$n}-
|
|
121
|
+
.#{$n}-chat__container {
|
|
120
122
|
display: flex;
|
|
121
123
|
position: relative;
|
|
122
124
|
flex-direction: column;
|
|
@@ -124,7 +126,7 @@
|
|
|
124
126
|
height: 100%;
|
|
125
127
|
}
|
|
126
128
|
|
|
127
|
-
.#{$n}-
|
|
129
|
+
.#{$n}-chat__body {
|
|
128
130
|
display: flex;
|
|
129
131
|
position: relative;
|
|
130
132
|
flex-grow: 4;
|
|
@@ -132,11 +134,11 @@
|
|
|
132
134
|
overflow-y: auto;
|
|
133
135
|
}
|
|
134
136
|
|
|
135
|
-
|
|
137
|
+
&.#{$n}-app--layout-window .#{$n}-chat__body {
|
|
136
138
|
overscroll-behavior: contain;
|
|
137
139
|
}
|
|
138
140
|
|
|
139
|
-
.#{$n}-
|
|
141
|
+
.#{$n}-chat__entry {
|
|
140
142
|
position: relative;
|
|
141
143
|
flex: 0 0 auto;
|
|
142
144
|
padding: $spacer * 0.5;
|
|
@@ -147,7 +149,7 @@
|
|
|
147
149
|
}
|
|
148
150
|
}
|
|
149
151
|
|
|
150
|
-
|
|
152
|
+
&.#{$n}-app--layout-inline .#{$n}-chat.#{$n}-app--collapsed .#{$n}-chat__entry {
|
|
151
153
|
border: 0 none;
|
|
152
154
|
}
|
|
153
155
|
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
.#{$n}-chat-status ~ .#{$n}-
|
|
32
|
+
.#{$n}-chat-status ~ .#{$n}-chat__container .#{$n}-conversation {
|
|
33
33
|
padding-top: $buttonsize + $spacer * 2;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
.#{$n}-chat-status
|
|
37
|
-
~ .#{$n}-
|
|
37
|
+
~ .#{$n}-chat__container
|
|
38
38
|
.#{$n}-disclaimer
|
|
39
39
|
+ .#{$n}-conversation {
|
|
40
40
|
padding-top: 0;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
padding-right: $buttonsize + $spacer * 2;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
.#{$n}-chat-status ~ .#{$n}-
|
|
14
|
+
.#{$n}-chat-status ~ .#{$n}-chat__container .#{$n}-disclaimer {
|
|
15
15
|
margin-top: $buttonsize + $spacer * 2;
|
|
16
16
|
padding: $spacer * 0.5 $spacer;
|
|
17
17
|
}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
padding: $spacer;
|
|
18
18
|
transform: scale(1);
|
|
19
19
|
opacity: 1;
|
|
20
|
-
background-color: rgba($
|
|
20
|
+
background-color: rgba($chat-bg, 0.8);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
.#{$n}-modal__float {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
border: $thin-border solid $grey-b;
|
|
30
30
|
border-radius: $borderradius;
|
|
31
31
|
outline: 0;
|
|
32
|
-
background-color: $
|
|
32
|
+
background-color: $chat-bg;
|
|
33
33
|
box-shadow: $boxshadow-soft;
|
|
34
34
|
}
|
|
35
35
|
|