@seamly/web-ui 21.0.7 → 21.0.9
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 +224 -231
- package/build/dist/lib/components.min.js +1 -1
- package/build/dist/lib/hooks.js +116 -16
- package/build/dist/lib/hooks.min.js +1 -1
- package/build/dist/lib/index.debug.js +50 -39
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.debug.min.js.LICENSE.txt +5 -1
- package/build/dist/lib/index.js +208 -220
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/standalone.js +215 -251
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/style-guide.js +194 -191
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/utils.js +192 -189
- package/build/dist/lib/utils.min.js +1 -1
- package/package.json +1 -1
- package/src/javascripts/domains/forms/provider.tsx +1 -1
- package/src/javascripts/domains/i18n/slice.ts +2 -0
- package/src/javascripts/domains/interrupt/hooks.ts +15 -7
- package/src/javascripts/domains/interrupt/middleware.ts +7 -14
- package/src/javascripts/domains/interrupt/selectors.ts +4 -0
- package/src/javascripts/domains/interrupt/slice.ts +2 -2
- package/src/javascripts/domains/translations/components/translation-status.tsx +4 -3
- package/src/javascripts/domains/translations/slice.ts +2 -0
- package/src/javascripts/ui/components/app-options/index.js +4 -3
- package/src/javascripts/ui/components/core/seamly-event-subscriber.ts +9 -13
- package/src/javascripts/ui/components/core/seamly-instance-functions-loader.js +5 -5
- package/src/javascripts/ui/components/entry/deprecated-toggle-button.js +4 -3
- package/src/javascripts/ui/components/faq/faq.js +5 -4
- package/src/javascripts/ui/components/layout/agent-info.js +4 -3
- package/src/javascripts/ui/components/layout/chat-frame.js +7 -8
- package/src/javascripts/ui/components/layout/deprecated-chat-frame.js +7 -8
- package/src/javascripts/ui/components/layout/interrupt.js +6 -15
- package/src/javascripts/ui/components/layout/pre-chat-messages.js +4 -3
- package/src/javascripts/ui/components/suggestions/index.js +5 -4
- package/src/javascripts/ui/components/translation-chat-status/index.tsx +4 -3
- package/src/javascripts/ui/components/view/app-view.js +1 -2
- package/src/javascripts/ui/components/view/deprecated-view.js +1 -2
- package/src/javascripts/ui/components/view/inline-view.js +1 -11
- package/src/javascripts/ui/components/view/window-view/index.js +1 -9
- package/src/javascripts/ui/components/view/window-view/window-open-button.js +4 -3
- package/src/javascripts/ui/hooks/{use-seamly-chat.js → use-seamly-chat.ts} +5 -1
- package/src/javascripts/ui/hooks/use-session-expired-command.ts +17 -0
- package/src/.DS_Store +0 -0
|
@@ -3,14 +3,12 @@ import Conversation from 'ui/components/conversation/conversation'
|
|
|
3
3
|
import Text from 'ui/components/conversation/event/text'
|
|
4
4
|
import Chat from 'ui/components/layout/chat'
|
|
5
5
|
import ChatFrame from 'ui/components/layout/chat-frame'
|
|
6
|
-
import Interrupt from 'ui/components/layout/interrupt'
|
|
7
6
|
import PreChatMessages from 'ui/components/layout/pre-chat-messages'
|
|
8
7
|
import InOutTransition, {
|
|
9
8
|
transitionStartStates,
|
|
10
9
|
} from 'ui/components/widgets/in-out-transition'
|
|
11
10
|
import { useUserHasResponded } from 'domains/app/hooks'
|
|
12
11
|
import { useI18n } from 'domains/i18n/hooks'
|
|
13
|
-
import { useInterrupt } from 'domains/interrupt/hooks'
|
|
14
12
|
import { useVisibility } from 'domains/visibility/hooks'
|
|
15
13
|
import { className } from 'lib/css'
|
|
16
14
|
import WindowOpenButton from './window-open-button'
|
|
@@ -18,8 +16,6 @@ import WindowOpenButton from './window-open-button'
|
|
|
18
16
|
const WindowView = () => {
|
|
19
17
|
const { isOpen, openChat } = useVisibility()
|
|
20
18
|
const userHasResponded = useUserHasResponded()
|
|
21
|
-
const { hasInterrupt, meta } = useInterrupt()
|
|
22
|
-
|
|
23
19
|
const { t } = useI18n()
|
|
24
20
|
const continueChatText = t('window.chat.continue')
|
|
25
21
|
const continueChatEvent = useMemo(
|
|
@@ -33,10 +29,6 @@ const WindowView = () => {
|
|
|
33
29
|
[continueChatText],
|
|
34
30
|
)
|
|
35
31
|
|
|
36
|
-
if (hasInterrupt && !isOpen) {
|
|
37
|
-
return <Interrupt {...meta} />
|
|
38
|
-
}
|
|
39
|
-
|
|
40
32
|
return (
|
|
41
33
|
<>
|
|
42
34
|
<WindowOpenButton onClick={openChat} />
|
|
@@ -72,7 +64,7 @@ const WindowView = () => {
|
|
|
72
64
|
transitionStartState={transitionStartStates.notRendered}
|
|
73
65
|
>
|
|
74
66
|
<Chat>
|
|
75
|
-
<ChatFrame
|
|
67
|
+
<ChatFrame>
|
|
76
68
|
<Conversation />
|
|
77
69
|
</ChatFrame>
|
|
78
70
|
</Chat>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useCallback } from 'preact/hooks'
|
|
2
|
+
import { useSelector } from 'react-redux'
|
|
2
3
|
import Icon from 'ui/components/layout/icon'
|
|
3
4
|
import InOutTransition, {
|
|
4
5
|
transitionStartStates,
|
|
@@ -11,15 +12,15 @@ import {
|
|
|
11
12
|
} from 'ui/hooks/seamly-state-hooks'
|
|
12
13
|
import { useStartChatIcon } from 'domains/config/hooks'
|
|
13
14
|
import { useI18n } from 'domains/i18n/hooks'
|
|
14
|
-
import {
|
|
15
|
+
import { selectHasError } from 'domains/interrupt/selectors'
|
|
15
16
|
import { useVisibility } from 'domains/visibility/hooks'
|
|
16
17
|
import { className } from 'lib/css'
|
|
17
18
|
|
|
18
19
|
const ButtonIcon = () => {
|
|
19
20
|
const startChatIcon = useStartChatIcon()
|
|
20
21
|
const currentAgent = useSeamlyCurrentAgent()
|
|
21
|
-
const
|
|
22
|
-
const isActiveConversation = currentAgent && !
|
|
22
|
+
const hasError = useSelector(selectHasError)
|
|
23
|
+
const isActiveConversation = currentAgent && !hasError
|
|
23
24
|
const src = isActiveConversation ? currentAgent.avatar : startChatIcon
|
|
24
25
|
return src ? (
|
|
25
26
|
<img
|
|
@@ -8,6 +8,7 @@ import { selectShowInlineView } from '../../domains/visibility/selectors'
|
|
|
8
8
|
import { useLiveRegion } from './live-region-hooks'
|
|
9
9
|
import { useSeamlyHasConversation } from './seamly-api-hooks'
|
|
10
10
|
import { useEvents, useSeamlyLayoutMode } from './seamly-state-hooks'
|
|
11
|
+
import useSessionExpiredCommand from './use-session-expired-command'
|
|
11
12
|
|
|
12
13
|
const useSeamlyChat = () => {
|
|
13
14
|
const events = useEvents()
|
|
@@ -22,6 +23,9 @@ const useSeamlyChat = () => {
|
|
|
22
23
|
const connectCalled = useRef(false)
|
|
23
24
|
const { sendAssertive } = useLiveRegion()
|
|
24
25
|
|
|
26
|
+
// Automatically reset conversation if the session has expired
|
|
27
|
+
useSessionExpiredCommand()
|
|
28
|
+
|
|
25
29
|
useEffect(() => {
|
|
26
30
|
if (isVisible) {
|
|
27
31
|
// Wait for the live containers to stabilise in the DOM before injecting
|
|
@@ -97,7 +101,7 @@ const useSeamlyChat = () => {
|
|
|
97
101
|
if (
|
|
98
102
|
!apiConfigReady ||
|
|
99
103
|
connectCalled.current ||
|
|
100
|
-
(isWindow && !isOpen
|
|
104
|
+
(isWindow && !isOpen) ||
|
|
101
105
|
(isInline && (!isVisible || !showInlineView))
|
|
102
106
|
) {
|
|
103
107
|
return
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useEffect } from 'preact/hooks'
|
|
2
|
+
import { useInterrupt } from 'domains/interrupt/hooks'
|
|
3
|
+
import useSeamlyCommands from './use-seamly-commands'
|
|
4
|
+
|
|
5
|
+
export default function useSessionExpiredCommand() {
|
|
6
|
+
const {
|
|
7
|
+
meta: { originalError, action },
|
|
8
|
+
} = useInterrupt()
|
|
9
|
+
const seamlyCommands = useSeamlyCommands()
|
|
10
|
+
const isExpiredError = originalError?.name === 'SeamlySessionExpiredError'
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (isExpiredError && seamlyCommands[action]) {
|
|
14
|
+
seamlyCommands[action]()
|
|
15
|
+
}
|
|
16
|
+
}, [action, seamlyCommands, isExpiredError])
|
|
17
|
+
}
|
package/src/.DS_Store
DELETED
|
Binary file
|