@seamly/web-ui 20.0.0-beta.4 → 20.0.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/build/dist/lib/index.debug.js +19 -30
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.debug.min.js.LICENSE.txt +0 -4
- package/build/dist/lib/index.js +147 -141
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/standalone.js +163 -157
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/style-guide.js +123 -92
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/styles.css +1 -1
- package/package.json +1 -2
- package/src/javascripts/api/index.js +19 -10
- package/src/javascripts/api/producer.js +5 -3
- package/src/javascripts/domains/app/actions.js +23 -1
- package/src/javascripts/domains/config/hooks.js +17 -0
- package/src/javascripts/domains/config/index.js +0 -1
- package/src/javascripts/domains/config/reducer.js +4 -0
- package/src/javascripts/domains/store/index.js +1 -5
- package/src/javascripts/lib/engine/index.js +2 -1
- package/src/javascripts/style-guide/components/app.js +8 -4
- package/src/javascripts/style-guide/components/static-core.js +19 -2
- package/src/javascripts/style-guide/components/view.js +16 -3
- package/src/javascripts/style-guide/states.js +42 -41
- package/src/javascripts/style-guide/style-guide-engine.js +14 -1
- package/src/javascripts/ui/components/conversation/event/event-participant.js +10 -7
- package/src/javascripts/ui/components/conversation/event/participant.js +3 -3
- package/src/javascripts/ui/components/layout/agent-info.js +7 -11
- package/src/javascripts/ui/components/layout/chat-frame.js +1 -1
- package/src/javascripts/ui/components/layout/pre-chat-messages.js +2 -8
- package/src/javascripts/ui/components/suggestions/index.js +0 -1
- package/src/javascripts/ui/components/suggestions/suggestions-list.js +1 -1
- package/src/javascripts/ui/components/view/inline-view.js +6 -1
- package/src/javascripts/ui/components/view/window-view/index.js +2 -2
- package/src/javascripts/ui/components/view/window-view/window-open-button.js +7 -7
- package/src/javascripts/ui/utils/seamly-utils.js +9 -2
- package/src/stylesheets/3-chat/_chat.scss +10 -25
- package/src/stylesheets/5-components/_chat-status.scss +1 -5
- package/src/stylesheets/5-components/_conversation.scss +1 -1
- package/src/stylesheets/5-components/_disclaimer.scss +1 -5
- package/src/stylesheets/5-components/_interrupt.scss +21 -2
- package/src/stylesheets/5-components/_message-body.scss +23 -1
- package/src/stylesheets/5-components/_message.scss +4 -0
- package/src/stylesheets/5-components/_options.scss +0 -8
- package/src/stylesheets/5-components/_pre-chat-messages.scss +22 -19
- package/src/stylesheets/5-components/_suggestions.scss +3 -9
- package/src/stylesheets/5-components/_unstarted.scss +20 -40
- package/src/stylesheets/7-deprecated/5-components/_message.scss +1 -1
- package/src/stylesheets/7-deprecated/5-components/_modal.scss +1 -1
- package/src/stylesheets/style-guide.scss +1 -1
- package/src/javascripts/domains/config/middleware.js +0 -22
|
@@ -62,11 +62,8 @@ const avatar =
|
|
|
62
62
|
|
|
63
63
|
const participantInfo = {
|
|
64
64
|
participants: {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
id: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
|
|
68
|
-
introduction: "You're now talking to {{name}} gimme a minit",
|
|
69
|
-
name: 'Mrs. Bot',
|
|
65
|
+
agent: {
|
|
66
|
+
id: 'agent',
|
|
70
67
|
service: {
|
|
71
68
|
expose: { map: {}, version: 2 },
|
|
72
69
|
meta: {},
|
|
@@ -75,23 +72,8 @@ const participantInfo = {
|
|
|
75
72
|
settings: {},
|
|
76
73
|
},
|
|
77
74
|
},
|
|
78
|
-
|
|
79
|
-
id: '
|
|
80
|
-
introduction: "You're now talking to {{name}} gimme a minit",
|
|
81
|
-
name: 'Mrs. Bot',
|
|
82
|
-
service: {
|
|
83
|
-
expose: { map: {}, version: 2 },
|
|
84
|
-
meta: {},
|
|
85
|
-
name: null,
|
|
86
|
-
service_session_id: null,
|
|
87
|
-
settings: {},
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
'seamly-client-participant': {
|
|
91
|
-
avatar,
|
|
92
|
-
id: 'seamly-client-participant',
|
|
93
|
-
introduction: null,
|
|
94
|
-
name: 'User',
|
|
75
|
+
user: {
|
|
76
|
+
id: 'user',
|
|
95
77
|
service: {
|
|
96
78
|
expose: { map: {}, version: 2 },
|
|
97
79
|
meta: {},
|
|
@@ -101,7 +83,7 @@ const participantInfo = {
|
|
|
101
83
|
},
|
|
102
84
|
},
|
|
103
85
|
},
|
|
104
|
-
currentAgent: '
|
|
86
|
+
currentAgent: 'agent',
|
|
105
87
|
}
|
|
106
88
|
|
|
107
89
|
const newTopicDivider = {
|
|
@@ -215,7 +197,7 @@ const participantMessage = {
|
|
|
215
197
|
messageStatus: 'received',
|
|
216
198
|
participant: {
|
|
217
199
|
avatar,
|
|
218
|
-
id: '
|
|
200
|
+
id: 'agent',
|
|
219
201
|
introduction: "You're now talking to {{name}} gimme a minit",
|
|
220
202
|
name: 'Mrs. Bot',
|
|
221
203
|
service: {
|
|
@@ -239,7 +221,7 @@ const participantMessageDefaultIcon = {
|
|
|
239
221
|
id: randomId(),
|
|
240
222
|
messageStatus: 'received',
|
|
241
223
|
participant: {
|
|
242
|
-
id: '
|
|
224
|
+
id: 'user',
|
|
243
225
|
introduction: "You're now talking to {{name}} gimme a minit",
|
|
244
226
|
name: 'Mrs. Bot',
|
|
245
227
|
service: {
|
|
@@ -264,7 +246,7 @@ const getCustomMessage = ({ type, data, text }) => ({
|
|
|
264
246
|
data,
|
|
265
247
|
variables: {},
|
|
266
248
|
},
|
|
267
|
-
participant: '
|
|
249
|
+
participant: 'agent',
|
|
268
250
|
service: {
|
|
269
251
|
meta: { additions: {} },
|
|
270
252
|
name: 'bot',
|
|
@@ -292,7 +274,7 @@ const shortTextMessage = {
|
|
|
292
274
|
fromHistory: true,
|
|
293
275
|
id: randomId(),
|
|
294
276
|
messageStatus: 'read',
|
|
295
|
-
participant: '
|
|
277
|
+
participant: 'agent',
|
|
296
278
|
service: {
|
|
297
279
|
meta: { additions: {} },
|
|
298
280
|
name: 'bot',
|
|
@@ -331,7 +313,7 @@ const ctaMessage = {
|
|
|
331
313
|
fromHistory: true,
|
|
332
314
|
id: 'f5351010-0def-452d-818f-ca22ac61792z',
|
|
333
315
|
messageStatus: 'read',
|
|
334
|
-
participant: '
|
|
316
|
+
participant: 'agent',
|
|
335
317
|
service: {
|
|
336
318
|
meta: { additions: { hideFeedback: 'true' } },
|
|
337
319
|
name: 'bot',
|
|
@@ -354,7 +336,7 @@ const longTextMessage = {
|
|
|
354
336
|
fromHistory: true,
|
|
355
337
|
id: randomId(),
|
|
356
338
|
messageStatus: 'read',
|
|
357
|
-
participant: '
|
|
339
|
+
participant: 'agent',
|
|
358
340
|
service: {
|
|
359
341
|
meta: { additions: {} },
|
|
360
342
|
name: 'bot',
|
|
@@ -378,7 +360,7 @@ const textMessageBoldItalicUnderline = {
|
|
|
378
360
|
fromHistory: true,
|
|
379
361
|
id: randomId(),
|
|
380
362
|
messageStatus: 'read',
|
|
381
|
-
participant: '
|
|
363
|
+
participant: 'agent',
|
|
382
364
|
service: {
|
|
383
365
|
meta: { additions: { hideFeedback: 'true' } },
|
|
384
366
|
name: 'bot',
|
|
@@ -417,7 +399,7 @@ const textMessageWithLinks = {
|
|
|
417
399
|
fromHistory: true,
|
|
418
400
|
id: randomId(),
|
|
419
401
|
messageStatus: 'read',
|
|
420
|
-
participant: '
|
|
402
|
+
participant: 'agent',
|
|
421
403
|
service: {
|
|
422
404
|
meta: { additions: { hideFeedback: 'true' } },
|
|
423
405
|
name: 'bot',
|
|
@@ -449,7 +431,7 @@ const textMessageWithLongLink = {
|
|
|
449
431
|
fromHistory: true,
|
|
450
432
|
id: 'a964e54e-ea98-46ff-a952-979a47f162c0',
|
|
451
433
|
messageStatus: 'read',
|
|
452
|
-
participant: '
|
|
434
|
+
participant: 'agent',
|
|
453
435
|
service: {
|
|
454
436
|
meta: { additions: { hideFeedback: 'true' } },
|
|
455
437
|
name: 'bot',
|
|
@@ -473,7 +455,7 @@ const textMesageWithBullets = {
|
|
|
473
455
|
fromHistory: true,
|
|
474
456
|
id: 'f5351010-0def-452d-818f-ca22ac61792a',
|
|
475
457
|
messageStatus: 'read',
|
|
476
|
-
participant: '
|
|
458
|
+
participant: 'agent',
|
|
477
459
|
service: {
|
|
478
460
|
meta: { additions: { hideFeedback: 'true' } },
|
|
479
461
|
name: 'bot',
|
|
@@ -498,7 +480,7 @@ const imageMessage = {
|
|
|
498
480
|
fromHistory: true,
|
|
499
481
|
id: 'b44ef42c-880c-43ff-b067-499e7f2e81f7',
|
|
500
482
|
messageStatus: 'read',
|
|
501
|
-
participant: '
|
|
483
|
+
participant: 'agent',
|
|
502
484
|
service: {
|
|
503
485
|
meta: { additions: { hideFeedback: 'true' } },
|
|
504
486
|
name: 'bot',
|
|
@@ -523,7 +505,7 @@ const imageMessageWithLightbox = {
|
|
|
523
505
|
fromHistory: true,
|
|
524
506
|
id: 'b44ef42c-880c-43ff-b067-499e7f2e81f8',
|
|
525
507
|
messageStatus: 'read',
|
|
526
|
-
participant: '
|
|
508
|
+
participant: 'agent',
|
|
527
509
|
service: {
|
|
528
510
|
meta: { additions: { hideFeedback: 'true' } },
|
|
529
511
|
name: 'bot',
|
|
@@ -548,7 +530,7 @@ const videoMessage = {
|
|
|
548
530
|
fromHistory: true,
|
|
549
531
|
id: randomId(),
|
|
550
532
|
messageStatus: 'read',
|
|
551
|
-
participant: '
|
|
533
|
+
participant: 'agent',
|
|
552
534
|
service: {
|
|
553
535
|
meta: { additions: { hideFeedback: 'true' } },
|
|
554
536
|
name: 'bot',
|
|
@@ -604,7 +586,7 @@ const choicePromptMessage = {
|
|
|
604
586
|
fromHistory: true,
|
|
605
587
|
id: randomId(),
|
|
606
588
|
messageStatus: 'read',
|
|
607
|
-
participant: '
|
|
589
|
+
participant: 'agent',
|
|
608
590
|
service: {
|
|
609
591
|
meta: { additions: {} },
|
|
610
592
|
name: 'bot',
|
|
@@ -628,7 +610,7 @@ const userMessage = {
|
|
|
628
610
|
fromHistory: true,
|
|
629
611
|
id: randomId(),
|
|
630
612
|
messageStatus: 'read',
|
|
631
|
-
participant: '
|
|
613
|
+
participant: 'user',
|
|
632
614
|
transactionId: '1cdefea9-7437-4672-bcf8-2c75dc99244c',
|
|
633
615
|
transactionLast: null,
|
|
634
616
|
type: 'text',
|
|
@@ -647,7 +629,7 @@ const userMessageLong = {
|
|
|
647
629
|
fromHistory: true,
|
|
648
630
|
id: randomId(),
|
|
649
631
|
messageStatus: 'read',
|
|
650
|
-
participant: '
|
|
632
|
+
participant: 'user',
|
|
651
633
|
transactionId: '1cdefea9-7437-4672-bcf8-2c75dc99244c',
|
|
652
634
|
transactionLast: null,
|
|
653
635
|
type: 'text',
|
|
@@ -671,7 +653,7 @@ const fileDownloadAgentMessage = {
|
|
|
671
653
|
payload: {
|
|
672
654
|
...fileDownloadPayload,
|
|
673
655
|
fromClient: false,
|
|
674
|
-
participant: '
|
|
656
|
+
participant: 'agent',
|
|
675
657
|
id: randomId(),
|
|
676
658
|
},
|
|
677
659
|
}
|
|
@@ -692,7 +674,7 @@ const fileDownloadUserMessage = {
|
|
|
692
674
|
payload: {
|
|
693
675
|
...fileDownloadPayload,
|
|
694
676
|
fromClient: true,
|
|
695
|
-
participant: '
|
|
677
|
+
participant: 'user',
|
|
696
678
|
id: randomId(),
|
|
697
679
|
},
|
|
698
680
|
}
|
|
@@ -1851,6 +1833,25 @@ const inlineInterface = {
|
|
|
1851
1833
|
},
|
|
1852
1834
|
},
|
|
1853
1835
|
},
|
|
1836
|
+
minimizedInlineWithError: {
|
|
1837
|
+
category: categoryKeys.minimizedInline,
|
|
1838
|
+
headingText: 'Inline minimized with error',
|
|
1839
|
+
description: '',
|
|
1840
|
+
inline: {
|
|
1841
|
+
...baseState,
|
|
1842
|
+
config: {
|
|
1843
|
+
...baseState.config,
|
|
1844
|
+
layoutMode: 'inline',
|
|
1845
|
+
},
|
|
1846
|
+
visibility: {
|
|
1847
|
+
...baseState.visibility,
|
|
1848
|
+
visibility: visibilityStates.minimized,
|
|
1849
|
+
},
|
|
1850
|
+
interrupt: {
|
|
1851
|
+
error: new SeamlyOfflineError(),
|
|
1852
|
+
},
|
|
1853
|
+
},
|
|
1854
|
+
},
|
|
1854
1855
|
}
|
|
1855
1856
|
|
|
1856
1857
|
const standardWindowStates = {
|
|
@@ -17,6 +17,7 @@ class SeamlyStyleGuideInstance extends Engine {
|
|
|
17
17
|
const api = new API({
|
|
18
18
|
namespace: this.config.namespace,
|
|
19
19
|
config: this.config.api,
|
|
20
|
+
context: this.config.context,
|
|
20
21
|
})
|
|
21
22
|
api.URLS = {
|
|
22
23
|
translations: `/client/${this.config.api.key}/translations/{version}/{locale}.json`,
|
|
@@ -24,7 +25,18 @@ class SeamlyStyleGuideInstance extends Engine {
|
|
|
24
25
|
const translations = await api.getTranslations(
|
|
25
26
|
this.config.context.locale || 'en-GB',
|
|
26
27
|
)
|
|
27
|
-
|
|
28
|
+
const { agentParticipant, userParticipant } = await api.getConfig()
|
|
29
|
+
const participants = [
|
|
30
|
+
{
|
|
31
|
+
id: 'user',
|
|
32
|
+
...userParticipant,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 'agent',
|
|
36
|
+
introduction: 'I am {{name}}',
|
|
37
|
+
...agentParticipant,
|
|
38
|
+
},
|
|
39
|
+
]
|
|
28
40
|
const renderConfig = {
|
|
29
41
|
...this.config,
|
|
30
42
|
customComponents: Object.keys(restComponents).length
|
|
@@ -37,6 +49,7 @@ class SeamlyStyleGuideInstance extends Engine {
|
|
|
37
49
|
config={renderConfig}
|
|
38
50
|
styleGuideConfig={this.styleGuideConfig}
|
|
39
51
|
translations={translations}
|
|
52
|
+
participants={participants}
|
|
40
53
|
/>,
|
|
41
54
|
this.parentElement,
|
|
42
55
|
)
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { useSeamlyParticipant } from '../../../hooks/seamly-hooks'
|
|
2
2
|
import { className } from '../../../../lib/css'
|
|
3
3
|
import { useConfig } from '../../../../domains/config'
|
|
4
|
+
import { useI18n } from '../../../../domains/i18n'
|
|
4
5
|
|
|
5
6
|
const EventParticipant = ({ eventPayload }) => {
|
|
7
|
+
const { t } = useI18n()
|
|
6
8
|
const { fromClient, participant: participantId } = eventPayload
|
|
7
9
|
const participant = useSeamlyParticipant(participantId) || {}
|
|
8
|
-
const { messages
|
|
10
|
+
const { messages } = useConfig()
|
|
9
11
|
|
|
10
|
-
const participantName =
|
|
12
|
+
const participantName = fromClient
|
|
13
|
+
? t('participants.user.name')
|
|
14
|
+
: participant && participant.name
|
|
11
15
|
const { showAvatar, showName } = messages[fromClient ? 'user' : 'agent'] || {}
|
|
12
|
-
const { userName } = defaults || {}
|
|
13
16
|
|
|
14
17
|
if (!showAvatar && !showName) {
|
|
15
18
|
return null
|
|
@@ -25,11 +28,11 @@ const EventParticipant = ({ eventPayload }) => {
|
|
|
25
28
|
)
|
|
26
29
|
}
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (showName && authorName) {
|
|
31
|
+
if (showName) {
|
|
31
32
|
authorInfo.push(
|
|
32
|
-
<span className={className('message__author-name')}>
|
|
33
|
+
<span className={className('message__author-name')}>
|
|
34
|
+
{participantName}
|
|
35
|
+
</span>,
|
|
33
36
|
)
|
|
34
37
|
}
|
|
35
38
|
|
|
@@ -3,10 +3,10 @@ import Mustache from 'mustache'
|
|
|
3
3
|
import parseBody from '../../../../lib/parse-body'
|
|
4
4
|
import EventDivider from '../event-divider'
|
|
5
5
|
import { useTranslatedEventData } from '../../../../domains/translations'
|
|
6
|
-
import {
|
|
6
|
+
import { useParticipants } from '../../../../domains/config'
|
|
7
7
|
|
|
8
8
|
const Participant = ({ event }) => {
|
|
9
|
-
const {
|
|
9
|
+
const { agent } = useParticipants()
|
|
10
10
|
|
|
11
11
|
const { participant } = event.payload
|
|
12
12
|
const [introduction] = useTranslatedEventData(event)
|
|
@@ -21,7 +21,7 @@ const Participant = ({ event }) => {
|
|
|
21
21
|
return null
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
const avatar = participant.avatar ||
|
|
24
|
+
const avatar = participant.avatar || agent?.avatar
|
|
25
25
|
|
|
26
26
|
return (
|
|
27
27
|
<EventDivider
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import { className } from '../../../lib/css'
|
|
8
8
|
import { useI18n } from '../../../domains/i18n'
|
|
9
9
|
import { useInterrupt } from '../../../domains/interrupt'
|
|
10
|
-
import {
|
|
10
|
+
import { useStartChatIcon } from '../../../domains/config'
|
|
11
11
|
import { useVisibility } from '../../../domains/visibility'
|
|
12
12
|
|
|
13
13
|
const AgentInfo = () => {
|
|
@@ -17,12 +17,8 @@ const AgentInfo = () => {
|
|
|
17
17
|
const { isOpen } = useVisibility()
|
|
18
18
|
const currentAgent = useSeamlyCurrentAgent()
|
|
19
19
|
const { hasInterrupt } = useInterrupt()
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
const { startChatIcon } = defaults || {}
|
|
23
|
-
|
|
24
|
-
const avatar = currentAgent && !hasInterrupt ? currentAgent.avatar : null
|
|
25
|
-
|
|
20
|
+
const startChatIcon = useStartChatIcon()
|
|
21
|
+
const src = currentAgent?.avatar ?? startChatIcon
|
|
26
22
|
const displaySubtitle = hasInterrupt ? '' : subTitle
|
|
27
23
|
|
|
28
24
|
const classNames = ['message-count']
|
|
@@ -36,13 +32,13 @@ const AgentInfo = () => {
|
|
|
36
32
|
}
|
|
37
33
|
|
|
38
34
|
return (
|
|
39
|
-
(
|
|
35
|
+
(displaySubtitle || !isOpen) && (
|
|
40
36
|
<div className={className('agent-info')}>
|
|
41
37
|
<div className={className('agent-info__graphic')}>
|
|
42
|
-
{
|
|
38
|
+
{src ? (
|
|
43
39
|
<img
|
|
44
|
-
className={className(avatar ? 'avatar' : 'icon')}
|
|
45
|
-
src={
|
|
40
|
+
className={className(currentAgent?.avatar ? 'avatar' : 'icon')}
|
|
41
|
+
src={src}
|
|
46
42
|
alt=""
|
|
47
43
|
/>
|
|
48
44
|
) : (
|
|
@@ -3,9 +3,6 @@ import { useInterrupt } from '../../../domains/interrupt'
|
|
|
3
3
|
import { useConfig } from '../../../domains/config'
|
|
4
4
|
import useEventComponentMapping from '../../hooks/use-event-component-mapping'
|
|
5
5
|
import { useVisibility } from '../../../domains/visibility'
|
|
6
|
-
import InOutTransition, {
|
|
7
|
-
transitionStartStates,
|
|
8
|
-
} from '../widgets/in-out-transition'
|
|
9
6
|
|
|
10
7
|
export default function PreChatMessages() {
|
|
11
8
|
const { preChatEvents, layoutMode } = useConfig()
|
|
@@ -15,10 +12,7 @@ export default function PreChatMessages() {
|
|
|
15
12
|
const isVisible = !(hasInterrupt || !preChatEvents.length || isOpen)
|
|
16
13
|
|
|
17
14
|
return (
|
|
18
|
-
|
|
19
|
-
isActive={isVisible}
|
|
20
|
-
transitionStartState={transitionStartStates.notRendered}
|
|
21
|
-
>
|
|
15
|
+
isVisible && (
|
|
22
16
|
<ul
|
|
23
17
|
className={className(
|
|
24
18
|
'pre-chat-messages',
|
|
@@ -35,7 +29,7 @@ export default function PreChatMessages() {
|
|
|
35
29
|
</li>
|
|
36
30
|
))}
|
|
37
31
|
</ul>
|
|
38
|
-
|
|
32
|
+
)
|
|
39
33
|
)
|
|
40
34
|
}
|
|
41
35
|
|
|
@@ -28,7 +28,12 @@ const InlineView = () => {
|
|
|
28
28
|
isActive={!isOpen}
|
|
29
29
|
transitionStartState={transitionStartStates.rendered}
|
|
30
30
|
>
|
|
31
|
-
<div
|
|
31
|
+
<div
|
|
32
|
+
className={className(
|
|
33
|
+
'unstarted-wrapper',
|
|
34
|
+
'unstarted-wrapper--inline',
|
|
35
|
+
)}
|
|
36
|
+
>
|
|
32
37
|
<PreChatMessages />
|
|
33
38
|
<Suggestions />
|
|
34
39
|
</div>
|
|
@@ -14,7 +14,7 @@ import InOutTransition, {
|
|
|
14
14
|
import PreChatMessages from '../../layout/pre-chat-messages'
|
|
15
15
|
import { useUserHasResponded } from '../../../../domains/app'
|
|
16
16
|
import { className } from '../../../../lib/css'
|
|
17
|
-
import
|
|
17
|
+
import Text from '../../conversation/event/text'
|
|
18
18
|
import { useI18n } from '../../../../domains/i18n'
|
|
19
19
|
|
|
20
20
|
const WindowView = () => {
|
|
@@ -60,7 +60,7 @@ const WindowView = () => {
|
|
|
60
60
|
'unstarted-wrapper--continue',
|
|
61
61
|
)}
|
|
62
62
|
>
|
|
63
|
-
<
|
|
63
|
+
<Text event={continueChatEvent} />
|
|
64
64
|
</div>
|
|
65
65
|
</InOutTransition>
|
|
66
66
|
<InOutTransition
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
useSkiplinkTargetFocusing,
|
|
7
7
|
} from '../../../hooks/seamly-hooks'
|
|
8
8
|
import { useI18n } from '../../../../domains/i18n'
|
|
9
|
-
import {
|
|
9
|
+
import { useStartChatIcon } from '../../../../domains/config'
|
|
10
10
|
import { useVisibility } from '../../../../domains/visibility'
|
|
11
11
|
import Icon from '../../layout/icon'
|
|
12
12
|
import { useInterrupt } from '../../../../domains/interrupt'
|
|
@@ -16,15 +16,15 @@ import InOutTransition, {
|
|
|
16
16
|
import { useSeamlyHasConversation } from '../../../hooks/seamly-api-hooks'
|
|
17
17
|
|
|
18
18
|
const ButtonIcon = () => {
|
|
19
|
+
const startChatIcon = useStartChatIcon()
|
|
19
20
|
const currentAgent = useSeamlyCurrentAgent()
|
|
20
21
|
const { hasInterrupt } = useInterrupt()
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
return avatar || startChatIcon ? (
|
|
22
|
+
const isActiveConversation = currentAgent && !hasInterrupt
|
|
23
|
+
const src = isActiveConversation ? currentAgent.avatar : startChatIcon
|
|
24
|
+
return src ? (
|
|
25
25
|
<img
|
|
26
|
-
className={className(
|
|
27
|
-
src={
|
|
26
|
+
className={className(isActiveConversation ? 'avatar' : 'icon')}
|
|
27
|
+
src={src}
|
|
28
28
|
alt=""
|
|
29
29
|
/>
|
|
30
30
|
) : (
|
|
@@ -200,9 +200,16 @@ const participantReducer = (state, action) => {
|
|
|
200
200
|
currentAgent: '',
|
|
201
201
|
}
|
|
202
202
|
case SET_PARTICIPANT:
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
// TODO: a) Styleguide only! b) Should be removed after styleguide overhaul.
|
|
204
|
+
if (!state) {
|
|
205
|
+
return {
|
|
206
|
+
participants: {},
|
|
207
|
+
currentAgent: '',
|
|
208
|
+
}
|
|
209
|
+
}
|
|
205
210
|
|
|
211
|
+
const { participants } = state || { participants: {} }
|
|
212
|
+
const { id, avatar, name, introduction } = action.participant
|
|
206
213
|
const oldParticipant = participants[id]
|
|
207
214
|
|
|
208
215
|
const newParticipants = {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
font-size: $fontsize-small;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
.#{$n}-chat--layout-inline {
|
|
16
16
|
height: fit-content;
|
|
17
17
|
background-color: initial;
|
|
18
18
|
box-shadow: none;
|
|
@@ -22,19 +22,11 @@
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
.#{$n}-chat--layout-inline.#{$n}-chat--collapsed .#{$n}-chat-wrapper {
|
|
26
26
|
height: auto;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
transition: none;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&.#{$n}-app--layout-inline .#{$n}-chat--user-responded .#{$n}-chat-wrapper {
|
|
34
|
-
transition: none;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
&.#{$n}-app--layout-window .#{$n}-chat {
|
|
29
|
+
.#{$n}-chat--layout-window {
|
|
38
30
|
@include responsiveAppSizing();
|
|
39
31
|
|
|
40
32
|
display: none;
|
|
@@ -49,16 +41,16 @@
|
|
|
49
41
|
opacity: 0;
|
|
50
42
|
}
|
|
51
43
|
|
|
52
|
-
|
|
44
|
+
.#{$n}-chat--layout-window.#{$n}-transition--visible {
|
|
53
45
|
display: flex;
|
|
54
46
|
}
|
|
55
47
|
|
|
56
|
-
|
|
48
|
+
.#{$n}-chat--layout-window.#{$n}-transition--in {
|
|
57
49
|
transform: scale(1);
|
|
58
50
|
opacity: 1;
|
|
59
51
|
}
|
|
60
52
|
|
|
61
|
-
|
|
53
|
+
.#{$n}-chat--layout-app {
|
|
62
54
|
position: fixed;
|
|
63
55
|
z-index: $z-index;
|
|
64
56
|
top: 0;
|
|
@@ -87,12 +79,7 @@
|
|
|
87
79
|
box-shadow: $boxshadow-soft;
|
|
88
80
|
}
|
|
89
81
|
|
|
90
|
-
|
|
91
|
-
border: 0 none;
|
|
92
|
-
border-radius: 0;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
&.#{$n}-app--layout-inline .#{$n}-chat-wrapper {
|
|
82
|
+
.#{$n}-chat--layout-inline .#{$n}-chat-wrapper {
|
|
96
83
|
width: 100%;
|
|
97
84
|
height: 0;
|
|
98
85
|
|
|
@@ -111,9 +98,7 @@
|
|
|
111
98
|
}
|
|
112
99
|
}
|
|
113
100
|
|
|
114
|
-
|
|
115
|
-
.#{$n}-chat.#{$n}-transition--in
|
|
116
|
-
.#{$n}-chat-wrapper {
|
|
101
|
+
.#{$n}-chat--layout-inline.#{$n}-transition--in .#{$n}-chat-wrapper {
|
|
117
102
|
height: $chat-inline-height;
|
|
118
103
|
max-height: $chat-inline-maxheight;
|
|
119
104
|
}
|
|
@@ -134,7 +119,7 @@
|
|
|
134
119
|
overflow-y: auto;
|
|
135
120
|
}
|
|
136
121
|
|
|
137
|
-
|
|
122
|
+
.#{$n}-chat--layout-window .#{$n}-chat__body {
|
|
138
123
|
overscroll-behavior: contain;
|
|
139
124
|
}
|
|
140
125
|
|
|
@@ -149,7 +134,7 @@
|
|
|
149
134
|
}
|
|
150
135
|
}
|
|
151
136
|
|
|
152
|
-
|
|
137
|
+
.#{$n}-chat--layout-inline.#{$n}-chat--collapsed .#{$n}-chat__entry {
|
|
153
138
|
border: 0 none;
|
|
154
139
|
}
|
|
155
140
|
|
|
@@ -15,14 +15,10 @@
|
|
|
15
15
|
box-shadow: $boxshadow;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
.#{$n}-chat--layout-window .#{$n}-chat-status {
|
|
19
19
|
width: calc(100% - #{$spacer * 2.5 + $buttonsize});
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
&.#{$n}-app--collapsed .#{$n}-chat-status {
|
|
23
|
-
display: none;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
22
|
.#{$n}-chat-status__title {
|
|
27
23
|
display: flex;
|
|
28
24
|
flex: 1;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
background-color: $grey-a;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
.#{$n}-chat--layout-window .#{$n}-disclaimer {
|
|
11
11
|
padding-right: $buttonsize + $spacer * 2;
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -16,10 +16,6 @@
|
|
|
16
16
|
padding: $spacer * 0.5 $spacer;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
&.#{$n}-app--collapsed .#{$n}-disclaimer {
|
|
20
|
-
display: none;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
19
|
.#{$n}-disclaimer__title {
|
|
24
20
|
margin: 0 0 $spacer * 0.25;
|
|
25
21
|
padding-right: $spacer;
|