@seamly/web-ui 20.8.0-alpha.1 → 20.8.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.
Files changed (48) hide show
  1. package/build/dist/lib/index.debug.js +48 -48
  2. package/build/dist/lib/index.debug.min.js +1 -1
  3. package/build/dist/lib/index.debug.min.js.LICENSE.txt +1 -1
  4. package/build/dist/lib/index.js +364 -284
  5. package/build/dist/lib/index.min.js +1 -1
  6. package/build/dist/lib/standalone.js +551 -274
  7. package/build/dist/lib/standalone.min.js +1 -1
  8. package/build/dist/lib/style-guide.js +166 -85
  9. package/build/dist/lib/style-guide.min.js +1 -1
  10. package/build/dist/lib/styles.css +1 -1
  11. package/package.json +1 -1
  12. package/src/javascripts/config.types.ts +1 -0
  13. package/src/javascripts/domains/app/actions.ts +45 -41
  14. package/src/javascripts/domains/config/slice.ts +2 -0
  15. package/src/javascripts/domains/i18n/slice.ts +0 -3
  16. package/src/javascripts/domains/store/slice.ts +23 -15
  17. package/src/javascripts/domains/store/store.types.ts +12 -1
  18. package/src/javascripts/domains/translations/hooks.ts +54 -48
  19. package/src/javascripts/domains/translations/selectors.ts +12 -0
  20. package/src/javascripts/domains/translations/slice.ts +70 -23
  21. package/src/javascripts/domains/translations/translations.types.ts +8 -1
  22. package/src/javascripts/schema.ts +3 -10
  23. package/src/javascripts/style-guide/components/app.js +2 -2
  24. package/src/javascripts/style-guide/states.js +61 -3
  25. package/src/javascripts/ui/components/conversation/conversation.js +7 -3
  26. package/src/javascripts/ui/components/conversation/event/card-message.js +1 -1
  27. package/src/javascripts/ui/components/conversation/event/carousel-message/index.js +1 -1
  28. package/src/javascripts/ui/components/conversation/event/choice-prompt.js +1 -1
  29. package/src/javascripts/ui/components/conversation/event/conversation-suggestions.js +9 -2
  30. package/src/javascripts/ui/components/conversation/event/cta.js +1 -1
  31. package/src/javascripts/ui/components/conversation/event/divider/variants/new-translation.js +39 -3
  32. package/src/javascripts/ui/components/conversation/event/image.js +1 -1
  33. package/src/javascripts/ui/components/conversation/event/participant.js +1 -1
  34. package/src/javascripts/ui/components/conversation/event/splash.js +1 -1
  35. package/src/javascripts/ui/components/conversation/event/text.js +1 -1
  36. package/src/javascripts/ui/components/conversation/event/translation.js +1 -1
  37. package/src/javascripts/ui/components/conversation/event/upload.js +1 -1
  38. package/src/javascripts/ui/components/conversation/event/video.js +1 -1
  39. package/src/javascripts/ui/components/conversation/message-container.js +1 -23
  40. package/src/javascripts/ui/components/core/seamly-event-subscriber.js +3 -2
  41. package/src/javascripts/ui/components/faq/faq.js +3 -1
  42. package/src/javascripts/ui/components/options/options-button.js +3 -1
  43. package/src/javascripts/ui/components/suggestions/index.js +5 -2
  44. package/src/javascripts/ui/hooks/seamly-state-hooks.js +6 -0
  45. package/src/javascripts/ui/hooks/use-seamly-chat.js +3 -9
  46. package/src/stylesheets/5-components/_message-carousel.scss +10 -8
  47. package/CHANGELOG.md +0 -987
  48. package/src/javascripts/domains/translations/selectors.js +0 -11
@@ -1,4 +1,5 @@
1
1
  import { useUserHasResponded } from 'domains/app/hooks'
2
+ import { useConfig } from 'domains/config/hooks'
2
3
  import { useI18n } from 'domains/i18n/hooks'
3
4
  import { useInterrupt } from 'domains/interrupt/hooks'
4
5
  import { useTranslatedEventData } from 'domains/translations/hooks'
@@ -29,6 +30,7 @@ const Suggestions = ({ isAside = false }) => {
29
30
  const { t } = useI18n()
30
31
  const { sendAction, addMessageBubble } = useSeamlyCommands()
31
32
  const { isOpen, setVisibility } = useVisibility()
33
+ const { showSuggestions } = useConfig()
32
34
  // a11y hooks
33
35
  const sectionId = useGeneratedId()
34
36
  const focusSkiplinkTarget = useSkiplinkTargetFocusing()
@@ -41,7 +43,7 @@ const Suggestions = ({ isAside = false }) => {
41
43
  // data hooks
42
44
  const userHasResponded = useUserHasResponded()
43
45
  const payload = useSeamlyServiceData('suggestion')
44
- const [eventBody] = useTranslatedEventData({ payload })
46
+ const { body: eventBody } = useTranslatedEventData({ payload })
45
47
  const suggestions = useMemo(
46
48
  () => (payload && !hasInterrupt ? eventBody : []),
47
49
  [payload, hasInterrupt, eventBody],
@@ -56,7 +58,8 @@ const Suggestions = ({ isAside = false }) => {
56
58
  ? (userHasResponded || isOpen) && !isAside
57
59
  : userHasResponded
58
60
  const prevHideSuggestions = useRef(hideSuggestions)
59
- const showSuggestionsContainer = hasSuggestions && !hideSuggestions
61
+ const showSuggestionsContainer =
62
+ hasSuggestions && !hideSuggestions && showSuggestions
60
63
  const renderedSuggestions = hasSuggestions
61
64
  ? suggestions
62
65
  : previousRenderedSuggestions.current
@@ -65,6 +65,12 @@ export const selectEvents = createSelector(
65
65
  )
66
66
  export const useEvents = () => useSelector(selectEvents)
67
67
 
68
+ export const selectEventIds = createSelector(selectEvents, (events) => {
69
+ return events.map((event) => event.payload.id)
70
+ })
71
+
72
+ export const useEventsIds = () => useSelector(selectEventIds)
73
+
68
74
  export const useSeamlyIsLoading = () => useSeamlyStateContext().isLoading
69
75
 
70
76
  export const useSeamlyHeaderData = () => useSeamlyStateContext().headerTitles
@@ -7,7 +7,7 @@ import { useDispatch, useSelector } from 'react-redux'
7
7
  import { selectShowInlineView } from '../../domains/visibility/selectors'
8
8
  import { useLiveRegion } from './live-region-hooks'
9
9
  import { useSeamlyHasConversation } from './seamly-api-hooks'
10
- import { useEvents, useSeamlyLayoutMode } from './seamly-state-hooks'
10
+ import { useSeamlyLayoutMode } from './seamly-state-hooks'
11
11
  import useSeamlyCommands from './use-seamly-commands'
12
12
 
13
13
  const useSeamlyChat = () => {
@@ -16,7 +16,6 @@ const useSeamlyChat = () => {
16
16
  const { isOpen, isVisible, setVisibility } = useVisibility()
17
17
  const showInlineView = useSelector(selectShowInlineView)
18
18
  const dispatch = useDispatch()
19
- const events = useEvents()
20
19
  const spinnerTimeout = useRef(null)
21
20
  const { start, connect, apiConfigReady, apiConnected } = useSeamlyCommands()
22
21
  const hasConversation = useSeamlyHasConversation()
@@ -25,8 +24,6 @@ const useSeamlyChat = () => {
25
24
  const startCalled = useRef(false)
26
25
  const { sendAssertive } = useLiveRegion()
27
26
 
28
- const hasEvents = events.length > 0
29
-
30
27
  useEffect(() => {
31
28
  if (isVisible) {
32
29
  // Wait for the live containers to stabilise in the DOM before injecting
@@ -60,14 +57,11 @@ const useSeamlyChat = () => {
60
57
  spinnerTimeout.current = setTimeout(() => {
61
58
  dispatch(setIsLoading(true))
62
59
  }, 500)
63
- }, [dispatch])
64
60
 
65
- useEffect(() => {
66
- if (hasEvents) {
61
+ return () => {
67
62
  clearTimeout(spinnerTimeout.current)
68
- dispatch(setIsLoading(false))
69
63
  }
70
- }, [hasEvents, dispatch])
64
+ }, [dispatch])
71
65
 
72
66
  useEffect(() => {
73
67
  // This is needed to reset the ref to allow connect and start to happen again.
@@ -41,6 +41,7 @@
41
41
  .#{$n}-carousel-controls {
42
42
  display: flex;
43
43
  position: relative;
44
+ align-items: center;
44
45
  justify-content: space-between;
45
46
  width: 100%;
46
47
  height: fit-content;
@@ -51,6 +52,7 @@
51
52
  /* stylelint-disable no-descending-specificity */
52
53
  .#{$n}-carousel-controls .#{$n}-button {
53
54
  display: flex;
55
+ flex: 0 0 $buttonsize;
54
56
  align-items: center;
55
57
  justify-content: center;
56
58
  width: $buttonsize;
@@ -89,21 +91,21 @@
89
91
  padding: 0 $spacer * 0.5;
90
92
  }
91
93
 
92
- .#{$n}-carousel-pagination {
94
+ .#{$n}-carousel-pagination__wrapper {
93
95
  display: flex;
94
96
  position: relative;
95
97
  flex-direction: row;
96
98
  justify-content: center;
97
- width: 100%;
98
- margin: 0 auto;
99
- padding: 0;
100
99
  }
101
100
 
102
- .#{$n}-carousel-pagination__wrapper {
101
+ .#{$n}-carousel-pagination {
103
102
  display: flex;
104
103
  position: relative;
105
- flex-direction: row;
104
+ flex-flow: row wrap;
106
105
  justify-content: center;
106
+ width: 100%;
107
+ margin: 0 auto;
108
+ padding: 0;
107
109
  }
108
110
 
109
111
  .#{$n}-carousel-pagination__item {
@@ -114,8 +116,8 @@
114
116
  .#{$n}-carousel-pagination__button {
115
117
  display: block;
116
118
  position: relative;
117
- width: $buttonsize-small;
118
- height: $buttonsize-small;
119
+ width: $buttonsize-small * 0.75;
120
+ height: $buttonsize-small * 0.75;
119
121
  padding: 0;
120
122
  border: 0;
121
123
  border-radius: 0;