@seamly/web-ui 22.2.0 → 22.3.0-beta.2
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 +449 -291
- package/build/dist/lib/components.js.map +1 -1
- package/build/dist/lib/components.min.js +1 -1
- package/build/dist/lib/components.min.js.map +1 -1
- package/build/dist/lib/hooks.js +367 -177
- package/build/dist/lib/hooks.js.map +1 -1
- package/build/dist/lib/hooks.min.js +1 -1
- package/build/dist/lib/hooks.min.js.map +1 -1
- package/build/dist/lib/index.debug.js +76 -54
- package/build/dist/lib/index.debug.js.map +1 -1
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.debug.min.js.LICENSE.txt +16 -8
- package/build/dist/lib/index.debug.min.js.map +1 -1
- package/build/dist/lib/index.js +342 -193
- package/build/dist/lib/index.js.map +1 -1
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/index.min.js.map +1 -1
- package/build/dist/lib/standalone.js +350 -194
- package/build/dist/lib/standalone.js.map +1 -1
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/standalone.min.js.map +1 -1
- package/build/dist/lib/style-guide.js +365 -194
- package/build/dist/lib/style-guide.js.map +1 -1
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/style-guide.min.js.map +1 -1
- package/build/dist/lib/styles.css +1 -1
- package/build/dist/lib/utils.js +504 -324
- package/build/dist/lib/utils.js.map +1 -1
- package/build/dist/lib/utils.min.js +1 -1
- package/build/dist/lib/utils.min.js.map +1 -1
- package/package.json +1 -1
- package/src/javascripts/api/errors/seamly-api-error.ts +0 -1
- package/src/javascripts/api/index.ts +16 -8
- package/src/javascripts/domains/app/actions.ts +8 -3
- package/src/javascripts/domains/interrupt/selectors.ts +3 -2
- package/src/javascripts/domains/interrupt/slice.ts +2 -0
- package/src/javascripts/domains/redux/create-debounced-async-thunk.ts +109 -0
- package/src/javascripts/domains/redux/redux.types.ts +2 -1
- package/src/javascripts/domains/store/actions.ts +38 -0
- package/src/javascripts/domains/translations/components/options-dialog/translation-option.tsx +1 -1
- package/src/javascripts/domains/visibility/actions.ts +4 -1
- package/src/javascripts/style-guide/states.js +26 -1
- package/src/javascripts/ui/components/chat-status/chat-status-action.tsx +2 -2
- package/src/javascripts/ui/components/conversation/event/{card-component.js → card-component.tsx} +6 -4
- package/src/javascripts/ui/components/conversation/event/carousel-component/components/controls.js +2 -2
- package/src/javascripts/ui/components/conversation/event/choice-prompt.js +1 -1
- package/src/javascripts/ui/components/conversation/event/event-participant.js +1 -1
- package/src/javascripts/ui/components/conversation/event/image-lightbox.js +1 -1
- package/src/javascripts/ui/components/conversation/event-divider.js +6 -1
- package/src/javascripts/ui/components/core/seamly-event-subscriber.ts +14 -30
- package/src/javascripts/ui/components/form-controls/error.js +1 -1
- package/src/javascripts/ui/components/form-controls/file-input.js +1 -1
- package/src/javascripts/ui/components/layout/agent-info.js +1 -1
- package/src/javascripts/ui/components/layout/{icon.js → icon.tsx} +74 -37
- package/src/javascripts/ui/components/options/options-button.js +1 -1
- package/src/javascripts/ui/components/suggestions/suggestions-item.js +1 -1
- package/src/javascripts/ui/components/view/window-view/window-open-button.js +9 -4
- package/src/javascripts/ui/components/widgets/lightbox.js +1 -1
- package/src/javascripts/ui/hooks/use-session-expired-command.ts +31 -2
- package/src/stylesheets/5-components/_message-card.scss +4 -3
- package/src/stylesheets/5-components/_message-count.scss +11 -9
|
@@ -27,44 +27,81 @@ import { className as classNameFn } from 'lib/css'
|
|
|
27
27
|
|
|
28
28
|
/* eslint-enable import/no-webpack-loader-syntax */
|
|
29
29
|
|
|
30
|
-
const ICONS = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
30
|
+
export const ICONS = {
|
|
31
|
+
send: {
|
|
32
|
+
32: iconSend32,
|
|
33
|
+
},
|
|
34
|
+
balloon: {
|
|
35
|
+
32: iconBalloon32,
|
|
36
|
+
},
|
|
37
|
+
newTopic: {
|
|
38
|
+
32: iconNewTopic32,
|
|
39
|
+
},
|
|
40
|
+
newTranslation: {
|
|
41
|
+
16: iconNewTranslation16,
|
|
42
|
+
32: iconNewTranslation32,
|
|
43
|
+
},
|
|
44
|
+
avatar: {
|
|
45
|
+
32: iconAvatar32,
|
|
46
|
+
},
|
|
47
|
+
chevronDown: {
|
|
48
|
+
8: iconChevronDown8,
|
|
49
|
+
32: iconChevronDown32,
|
|
50
|
+
},
|
|
51
|
+
chevronRight: {
|
|
52
|
+
8: iconChevronRight8,
|
|
53
|
+
16: iconChevronRight16,
|
|
54
|
+
},
|
|
55
|
+
close: {
|
|
56
|
+
8: iconClose8,
|
|
57
|
+
16: iconClose16,
|
|
58
|
+
},
|
|
59
|
+
enlarge: {
|
|
60
|
+
32: iconEnlarge32,
|
|
61
|
+
},
|
|
62
|
+
options: {
|
|
63
|
+
32: iconOptions32,
|
|
64
|
+
},
|
|
65
|
+
file: {
|
|
66
|
+
32: iconFile32,
|
|
67
|
+
},
|
|
68
|
+
upload: {
|
|
69
|
+
32: iconUpload32,
|
|
70
|
+
},
|
|
71
|
+
download: {
|
|
72
|
+
16: iconDownload16,
|
|
73
|
+
},
|
|
74
|
+
error: {
|
|
75
|
+
16: iconError16,
|
|
76
|
+
},
|
|
77
|
+
arrowLeft: {
|
|
78
|
+
16: iconArrowLeft16,
|
|
79
|
+
},
|
|
80
|
+
arrowRight: {
|
|
81
|
+
16: iconArrowRight16,
|
|
82
|
+
},
|
|
83
|
+
check: {
|
|
84
|
+
16: iconCheck16,
|
|
85
|
+
32: iconCheck32,
|
|
86
|
+
},
|
|
87
|
+
} as const
|
|
57
88
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
dangerouslySetInnerHTML={{ __html: ICONS[iconName] }}
|
|
64
|
-
/>
|
|
65
|
-
{alt && <span className={classNameFn('visually-hidden')}>{alt}</span>}
|
|
66
|
-
</>
|
|
67
|
-
)
|
|
89
|
+
export type IconProps = {
|
|
90
|
+
name: keyof typeof ICONS
|
|
91
|
+
size?: '8' | '16' | '32'
|
|
92
|
+
className?: string
|
|
93
|
+
alt: string
|
|
68
94
|
}
|
|
69
95
|
|
|
96
|
+
const Icon = ({ name, size = '32', className, alt }: IconProps) => (
|
|
97
|
+
<>
|
|
98
|
+
<div
|
|
99
|
+
aria-hidden="true"
|
|
100
|
+
className={className || classNameFn('icon')}
|
|
101
|
+
dangerouslySetInnerHTML={{ __html: ICONS[name][size] }}
|
|
102
|
+
/>
|
|
103
|
+
{alt && <span className={classNameFn('visually-hidden')}>{alt}</span>}
|
|
104
|
+
</>
|
|
105
|
+
)
|
|
106
|
+
|
|
70
107
|
export default Icon
|
|
@@ -236,7 +236,7 @@ const OptionsButton = () => {
|
|
|
236
236
|
aria-expanded={multiMenu ? menuIsOpen.toString() : null}
|
|
237
237
|
aria-disabled={!multiMenu && !firstOption.available ? 'true' : null}
|
|
238
238
|
>
|
|
239
|
-
{multiMenu && <Icon name="options" size="32" />}
|
|
239
|
+
{multiMenu && <Icon name="options" size="32" alt="" />}
|
|
240
240
|
<span className={className('button__text')}>
|
|
241
241
|
{multiMenu
|
|
242
242
|
? t('options.openButtonText')
|
|
@@ -30,7 +30,7 @@ const SuggestionsItem = ({
|
|
|
30
30
|
onClick={handleClick}
|
|
31
31
|
className={className('button', 'button--primary')}
|
|
32
32
|
>
|
|
33
|
-
{hasIcon && <Icon name="chevronRight" size="8" />}
|
|
33
|
+
{hasIcon && <Icon name="chevronRight" size="8" alt="" />}
|
|
34
34
|
{question}
|
|
35
35
|
</button>
|
|
36
36
|
</li>
|
|
@@ -29,7 +29,7 @@ const ButtonIcon = () => {
|
|
|
29
29
|
alt=""
|
|
30
30
|
/>
|
|
31
31
|
) : (
|
|
32
|
-
<Icon name="avatar" size="32" />
|
|
32
|
+
<Icon name="avatar" size="32" alt="" />
|
|
33
33
|
)
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -57,9 +57,14 @@ const WindowOpenButton = ({ onClick }) => {
|
|
|
57
57
|
aria-hidden={isOpen}
|
|
58
58
|
onClick={handleClick}
|
|
59
59
|
>
|
|
60
|
-
<
|
|
61
|
-
{!!count
|
|
62
|
-
|
|
60
|
+
<InOutTransition
|
|
61
|
+
isActive={!!count}
|
|
62
|
+
transitionStartState={transitionStartStates.notRendered}
|
|
63
|
+
>
|
|
64
|
+
<span className={className('message-count')} aria-hidden="true">
|
|
65
|
+
{count}
|
|
66
|
+
</span>
|
|
67
|
+
</InOutTransition>
|
|
63
68
|
<ButtonIcon />
|
|
64
69
|
</button>
|
|
65
70
|
</InOutTransition>
|
|
@@ -66,7 +66,7 @@ const Lightbox = ({ url, description, onClose: onCloseHandler }) => {
|
|
|
66
66
|
className={className('modal__close')}
|
|
67
67
|
onClick={onClose}
|
|
68
68
|
>
|
|
69
|
-
<Icon name="close" size="16" />
|
|
69
|
+
<Icon name="close" size="16" alt="" />
|
|
70
70
|
{t('lightbox.closeLabel')}
|
|
71
71
|
</button>
|
|
72
72
|
</div>
|
|
@@ -1,17 +1,46 @@
|
|
|
1
|
-
import { useEffect } from 'preact/hooks'
|
|
1
|
+
import { useEffect, useRef } from 'preact/hooks'
|
|
2
|
+
import SeamlyGeneralError from 'api/errors/seamly-general-error'
|
|
2
3
|
import { useInterrupt } from 'domains/interrupt/hooks'
|
|
4
|
+
import { setInterrupt } from 'domains/interrupt/slice'
|
|
5
|
+
import { useAppDispatch } from 'domains/store'
|
|
3
6
|
import useSeamlyCommands from './use-seamly-commands'
|
|
4
7
|
|
|
5
8
|
export default function useSessionExpiredCommand() {
|
|
6
9
|
const {
|
|
7
10
|
meta: { originalError, action },
|
|
8
11
|
} = useInterrupt()
|
|
12
|
+
const dispatch = useAppDispatch()
|
|
9
13
|
const seamlyCommands = useSeamlyCommands()
|
|
10
14
|
const isExpiredError = originalError?.name === 'SeamlySessionExpiredError'
|
|
15
|
+
const limit = useRef(0)
|
|
16
|
+
const limitTimer = useRef<ReturnType<typeof setTimeout>>(null)
|
|
11
17
|
|
|
12
18
|
useEffect(() => {
|
|
13
19
|
if (isExpiredError && seamlyCommands[action]) {
|
|
20
|
+
if (limit.current >= 10) {
|
|
21
|
+
limitTimer.current = setTimeout(() => {
|
|
22
|
+
limit.current = 0
|
|
23
|
+
}, 10000)
|
|
24
|
+
|
|
25
|
+
const error = new SeamlyGeneralError()
|
|
26
|
+
dispatch(
|
|
27
|
+
setInterrupt({
|
|
28
|
+
name: error.name,
|
|
29
|
+
message: error.message,
|
|
30
|
+
langKey: error.langKey,
|
|
31
|
+
originalEvent: error.originalEvent,
|
|
32
|
+
originalError: error.originalError,
|
|
33
|
+
action: error.action,
|
|
34
|
+
}),
|
|
35
|
+
)
|
|
36
|
+
return () => {}
|
|
37
|
+
}
|
|
38
|
+
limit.current += 1
|
|
14
39
|
seamlyCommands[action]()
|
|
15
40
|
}
|
|
16
|
-
|
|
41
|
+
|
|
42
|
+
return () => {
|
|
43
|
+
if (limitTimer.current) clearTimeout(limitTimer.current)
|
|
44
|
+
}
|
|
45
|
+
}, [action, seamlyCommands, isExpiredError, dispatch])
|
|
17
46
|
}
|
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
.#{$n}-card__content {
|
|
19
19
|
display: flex;
|
|
20
20
|
flex: 1 1 auto;
|
|
21
|
-
flex-
|
|
21
|
+
flex-direction: column;
|
|
22
22
|
gap: $spacer * 0.5;
|
|
23
23
|
padding: $spacer * 0.5 $spacer * 0.75 $spacer * 0.75;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
.#{$n}-card__title {
|
|
27
27
|
display: block;
|
|
28
|
-
flex: 0 0 100%;
|
|
29
28
|
width: 100%;
|
|
29
|
+
height: fit-content;
|
|
30
30
|
margin: 0;
|
|
31
31
|
padding: 0;
|
|
32
32
|
font-size: $fontsize-default;
|
|
@@ -36,12 +36,13 @@
|
|
|
36
36
|
.#{$n}-card__description {
|
|
37
37
|
display: block;
|
|
38
38
|
width: 100%;
|
|
39
|
+
height: fit-content;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
.#{$n}-card__content .#{$n}-button {
|
|
42
43
|
display: block;
|
|
43
|
-
align-self: flex-end;
|
|
44
44
|
width: 100%;
|
|
45
|
+
margin-top: auto;
|
|
45
46
|
font-weight: $fontweight-bold;
|
|
46
47
|
text-decoration: none;
|
|
47
48
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.#{$n}-message-count {
|
|
2
|
-
display:
|
|
2
|
+
display: none;
|
|
3
3
|
position: absolute;
|
|
4
4
|
z-index: 1;
|
|
5
5
|
top: $spacer * -0.5;
|
|
@@ -8,21 +8,23 @@
|
|
|
8
8
|
justify-content: center;
|
|
9
9
|
width: $messagecountsize;
|
|
10
10
|
height: $messagecountsize;
|
|
11
|
-
transform: scale(
|
|
11
|
+
transform: scale(0);
|
|
12
12
|
transform-origin: 50% 50%;
|
|
13
|
-
transition: transform
|
|
14
|
-
opacity $transition;
|
|
13
|
+
transition: transform $transition, opacity $transition;
|
|
15
14
|
border-radius: 50%;
|
|
16
|
-
opacity:
|
|
15
|
+
opacity: 0;
|
|
17
16
|
background-color: $negative;
|
|
18
17
|
color: $white;
|
|
19
18
|
font-size: $fontsize-small;
|
|
20
19
|
font-weight: $fontweight-bold;
|
|
21
20
|
line-height: 1;
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
&.#{$n}-transition--visible {
|
|
23
|
+
display: flex;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.#{$n}-transition--in {
|
|
27
|
+
transform: scale(1);
|
|
28
|
+
opacity: 1;
|
|
27
29
|
}
|
|
28
30
|
}
|