@seamly/web-ui 24.5.0 → 25.1.0-beta.1

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 (154) hide show
  1. package/build/dist/lib/index.debug.js +2129 -1810
  2. package/build/dist/lib/index.debug.js.map +1 -1
  3. package/build/dist/lib/index.debug.min.js +1 -1
  4. package/build/dist/lib/index.debug.min.js.LICENSE.txt +49 -7
  5. package/build/dist/lib/index.debug.min.js.map +1 -1
  6. package/build/dist/lib/index.js +732 -398
  7. package/build/dist/lib/index.js.map +1 -1
  8. package/build/dist/lib/index.min.js +1 -1
  9. package/build/dist/lib/index.min.js.LICENSE.txt +16 -1
  10. package/build/dist/lib/index.min.js.map +1 -1
  11. package/build/dist/lib/style-guide.js +305 -93
  12. package/build/dist/lib/style-guide.js.map +1 -1
  13. package/build/dist/lib/style-guide.min.js +1 -1
  14. package/build/dist/lib/style-guide.min.js.map +1 -1
  15. package/build/dist/lib/styles-default-implementation.css +1 -1
  16. package/build/dist/lib/styles.css +1 -1
  17. package/package.json +27 -38
  18. package/src/javascripts/core/api/api.types.ts +3 -0
  19. package/src/javascripts/core/api/asyncapi.types.ts +292 -69
  20. package/src/javascripts/core/api/channel.types.ts +301 -69
  21. package/src/javascripts/core/api/conversation-connector.ts +1 -3
  22. package/src/javascripts/core/api/errors/seamly-api-error.ts +0 -1
  23. package/src/javascripts/core/api/errors/seamly-base-error.ts +1 -1
  24. package/src/javascripts/core/api/index.ts +7 -7
  25. package/src/javascripts/core/api/utils.ts +0 -1
  26. package/src/javascripts/core/domains/app/actions.ts +1 -1
  27. package/src/javascripts/core/domains/app/hooks.ts +1 -1
  28. package/src/javascripts/core/domains/config/hooks.ts +1 -1
  29. package/src/javascripts/core/domains/config/selectors.ts +1 -1
  30. package/src/javascripts/core/domains/config/slice.ts +2 -2
  31. package/src/javascripts/core/domains/forms/context.ts +1 -1
  32. package/src/javascripts/core/domains/forms/hooks.ts +12 -12
  33. package/src/javascripts/core/domains/forms/provider.tsx +9 -9
  34. package/src/javascripts/core/domains/i18n/actions.ts +1 -1
  35. package/src/javascripts/core/domains/i18n/hooks.ts +3 -3
  36. package/src/javascripts/core/domains/interrupt/hooks.ts +1 -1
  37. package/src/javascripts/core/domains/store/index.ts +2 -2
  38. package/src/javascripts/core/domains/store/slice.ts +47 -34
  39. package/src/javascripts/core/domains/store/store.types.ts +3 -7
  40. package/src/javascripts/core/domains/translations/components/options-button.tsx +2 -2
  41. package/src/javascripts/core/domains/translations/components/options-dialog/index.tsx +1 -1
  42. package/src/javascripts/core/domains/translations/components/options-dialog/translation-option.tsx +1 -1
  43. package/src/javascripts/core/domains/translations/components/options-dialog/translation-options.tsx +2 -2
  44. package/src/javascripts/core/domains/translations/components/translation-status.tsx +1 -1
  45. package/src/javascripts/core/domains/translations/hooks.ts +2 -2
  46. package/src/javascripts/core/domains/translations/middleware.ts +4 -2
  47. package/src/javascripts/core/domains/visibility/actions.ts +2 -2
  48. package/src/javascripts/core/domains/visibility/hooks.ts +5 -5
  49. package/src/javascripts/core/lib/debug.ts +1 -1
  50. package/src/javascripts/core/lib/engine/index.tsx +5 -5
  51. package/src/javascripts/core/lib/external-api/index.ts +6 -6
  52. package/src/javascripts/core/lib/mutex.ts +0 -1
  53. package/src/javascripts/core/lib/split-url-params.ts +1 -1
  54. package/src/javascripts/core/lib/store/index.ts +0 -1
  55. package/src/javascripts/core/lib/store/providers/app-storage.js +4 -7
  56. package/src/javascripts/core/lib/store/providers/app-storage.ts +4 -6
  57. package/src/javascripts/core/ui/components/app-options/index.tsx +1 -1
  58. package/src/javascripts/core/ui/components/chat-status/index.tsx +1 -1
  59. package/src/javascripts/core/ui/components/conversation/component-filter.tsx +1 -3
  60. package/src/javascripts/core/ui/components/conversation/conversation.tsx +9 -11
  61. package/src/javascripts/core/ui/components/conversation/event/card-component.tsx +3 -3
  62. package/src/javascripts/core/ui/components/conversation/event/carousel-component/components/pagination.tsx +1 -1
  63. package/src/javascripts/core/ui/components/conversation/event/carousel-component/index.tsx +1 -1
  64. package/src/javascripts/core/ui/components/conversation/event/chat-scroll/chat-scroll-provider.tsx +1 -1
  65. package/src/javascripts/core/ui/components/conversation/event/choice-prompt.tsx +5 -5
  66. package/src/javascripts/core/ui/components/conversation/event/conversation-suggestions.tsx +1 -1
  67. package/src/javascripts/core/ui/components/conversation/event/divider/variants/new-translation.tsx +3 -3
  68. package/src/javascripts/core/ui/components/conversation/event/divider/variants/time-indicator.tsx +1 -1
  69. package/src/javascripts/core/ui/components/conversation/event/event-participant.tsx +1 -1
  70. package/src/javascripts/core/ui/components/conversation/event/event.tsx +1 -1
  71. package/src/javascripts/core/ui/components/conversation/event/image-lightbox.tsx +1 -1
  72. package/src/javascripts/core/ui/components/conversation/event/image.tsx +2 -2
  73. package/src/javascripts/core/ui/components/conversation/event/participant.tsx +1 -1
  74. package/src/javascripts/core/ui/components/conversation/event/splash.tsx +0 -1
  75. package/src/javascripts/core/ui/components/conversation/event/text.tsx +2 -2
  76. package/src/javascripts/core/ui/components/conversation/event/upload.tsx +3 -3
  77. package/src/javascripts/core/ui/components/conversation/event/video.tsx +2 -2
  78. package/src/javascripts/core/ui/components/conversation/event-divider.tsx +1 -1
  79. package/src/javascripts/core/ui/components/conversation/message-container.tsx +2 -4
  80. package/src/javascripts/core/ui/components/conversation/use-chat-scroll.ts +3 -3
  81. package/src/javascripts/core/ui/components/core/seamly-activity-monitor.tsx +1 -1
  82. package/src/javascripts/core/ui/components/core/seamly-api-context.ts +1 -1
  83. package/src/javascripts/core/ui/components/core/seamly-core.tsx +3 -3
  84. package/src/javascripts/core/ui/components/core/seamly-event-subscriber.ts +9 -7
  85. package/src/javascripts/core/ui/components/core/seamly-file-upload.tsx +2 -3
  86. package/src/javascripts/core/ui/components/core/seamly-initializer.tsx +1 -1
  87. package/src/javascripts/core/ui/components/core/seamly-instance-functions-loader.ts +3 -3
  88. package/src/javascripts/core/ui/components/core/seamly-live-region.tsx +1 -1
  89. package/src/javascripts/core/ui/components/core/seamly-new-notifications.ts +1 -1
  90. package/src/javascripts/core/ui/components/core/seamly-read-state.ts +1 -1
  91. package/src/javascripts/core/ui/components/entry/entry-container.tsx +8 -3
  92. package/src/javascripts/core/ui/components/entry/text-entry/hooks.ts +21 -14
  93. package/src/javascripts/core/ui/components/entry/text-entry/index.tsx +1 -1
  94. package/src/javascripts/core/ui/components/entry/text-entry/text-entry-form.tsx +1 -1
  95. package/src/javascripts/core/ui/components/entry/upload/file-upload-form.tsx +1 -1
  96. package/src/javascripts/core/ui/components/entry/upload/index.tsx +1 -1
  97. package/src/javascripts/core/ui/components/entry/upload-toggle.tsx +2 -1
  98. package/src/javascripts/core/ui/components/form-controls/error.tsx +1 -1
  99. package/src/javascripts/core/ui/components/form-controls/file-input.tsx +1 -1
  100. package/src/javascripts/core/ui/components/form-controls/input.tsx +1 -1
  101. package/src/javascripts/core/ui/components/form-controls/wrapper.tsx +1 -1
  102. package/src/javascripts/core/ui/components/layout/agent-info.tsx +1 -1
  103. package/src/javascripts/core/ui/components/layout/chat-frame.tsx +1 -1
  104. package/src/javascripts/core/ui/components/layout/chat.tsx +8 -6
  105. package/src/javascripts/core/ui/components/layout/continue-chat-messages.tsx +1 -1
  106. package/src/javascripts/core/ui/components/layout/header.tsx +1 -1
  107. package/src/javascripts/core/ui/components/layout/interrupt.tsx +1 -1
  108. package/src/javascripts/core/ui/components/layout/pre-chat-messages.tsx +1 -1
  109. package/src/javascripts/core/ui/components/options/options-button.tsx +1 -3
  110. package/src/javascripts/core/ui/components/options/options-frame.tsx +1 -1
  111. package/src/javascripts/core/ui/components/options/transcript/index.tsx +1 -1
  112. package/src/javascripts/core/ui/components/suggestions/index.tsx +2 -2
  113. package/src/javascripts/core/ui/components/suggestions/suggestions-list.tsx +1 -1
  114. package/src/javascripts/core/ui/components/view/index.tsx +3 -3
  115. package/src/javascripts/core/ui/components/view/window-view/collapse-button.tsx +10 -1
  116. package/src/javascripts/core/ui/components/view/window-view/window-open-button.tsx +9 -3
  117. package/src/javascripts/core/ui/components/widgets/in-out-transition.tsx +2 -2
  118. package/src/javascripts/core/ui/components/widgets/lightbox.tsx +1 -1
  119. package/src/javascripts/core/ui/hooks/file-upload-hooks.ts +1 -1
  120. package/src/javascripts/core/ui/hooks/focus-helper-hooks.ts +6 -1
  121. package/src/javascripts/core/ui/hooks/seamly-entry-hooks.ts +1 -1
  122. package/src/javascripts/core/ui/hooks/seamly-option-hooks.ts +1 -1
  123. package/src/javascripts/core/ui/hooks/seamly-state-hooks.ts +9 -4
  124. package/src/javascripts/core/ui/hooks/use-debounce.ts +1 -1
  125. package/src/javascripts/core/ui/hooks/use-interval.ts +0 -1
  126. package/src/javascripts/core/ui/hooks/use-notifications.ts +2 -3
  127. package/src/javascripts/core/ui/hooks/use-seamly-chat.ts +2 -2
  128. package/src/javascripts/core/ui/hooks/use-seamly-commands.ts +2 -2
  129. package/src/javascripts/core/ui/hooks/use-seamly-conversation.ts +1 -1
  130. package/src/javascripts/core/ui/hooks/use-seamly-idle-detach-countdown.ts +15 -10
  131. package/src/javascripts/core/ui/hooks/use-session-expired-command.ts +1 -1
  132. package/src/javascripts/core/ui/hooks/use-single-file-upload.ts +1 -1
  133. package/src/javascripts/core/ui/hooks/utility-hooks.ts +1 -2
  134. package/src/javascripts/core/ui/utils/seamly-utils.ts +0 -2
  135. package/src/javascripts/core/ui/utils/validations.ts +1 -2
  136. package/src/javascripts/style-guide/components/app.tsx +2 -2
  137. package/src/javascripts/style-guide/components/static-core.tsx +2 -2
  138. package/src/javascripts/style-guide/components/view.tsx +1 -1
  139. package/src/javascripts/style-guide/state-helpers/index.ts +0 -2
  140. package/src/javascripts/style-guide/states.ts +5 -42
  141. package/src/javascripts/style-guide/style-guide-engine.tsx +1 -1
  142. package/src/stylesheets/5-components/_message-body.scss +0 -10
  143. package/src/stylesheets/6-default-implementation/_hover.scss +0 -7
  144. package/src/stylesheets/styles.scss +0 -1
  145. package/webpack/config.common.js +4 -11
  146. package/webpack/config.dev.js +0 -1
  147. package/webpack/config.package.js +5 -7
  148. package/webpack/config.site.js +2 -4
  149. package/webpack/config.test.js +1 -2
  150. package/webpack/defaults.js +0 -1
  151. package/webpack/parts/babel-loader-browser-plugins.js +0 -1
  152. package/webpack/parts/dev-server.js +0 -1
  153. package/src/javascripts/core/ui/components/conversation/event/cta.tsx +0 -54
  154. package/src/stylesheets/5-components/_message-cta.scss +0 -17
@@ -1,5 +1,5 @@
1
- import { FC } from 'preact/compat'
2
1
  import { className } from 'lib/css'
2
+ import { FC } from 'preact/compat'
3
3
  import Icon from 'ui/components/layout/icon'
4
4
  import { useGeneratedId } from 'ui/hooks/utility-hooks'
5
5
 
@@ -1,11 +1,10 @@
1
- import { useMemo } from 'preact/hooks'
2
1
  import { useConfig } from 'domains/config/hooks'
2
+ import { useMemo } from 'preact/hooks'
3
3
  import ComponentContext from './component-context'
4
4
  import CardMessage from './event/card-message'
5
5
  import CarouselMessage from './event/carousel-message'
6
6
  import ChoicePrompt from './event/choice-prompt'
7
7
  import ConversationSuggestions from './event/conversation-suggestions'
8
- import Cta from './event/cta'
9
8
  import Divider from './event/divider'
10
9
  import TimeIndicator from './event/divider/variants/time-indicator'
11
10
  import Image from './event/image'
@@ -24,7 +23,6 @@ const eventTypeMapping = {
24
23
  splash: Splash,
25
24
  video: Video,
26
25
  upload: Upload,
27
- cta: Cta,
28
26
  carousel: CarouselMessage,
29
27
  card: CardMessage,
30
28
  },
@@ -79,17 +79,15 @@ const Conversation = () => {
79
79
  <div className={className('chat__body')}>
80
80
  <div className={className('conversation__container')}>
81
81
  <PrivacyDisclaimer />
82
- <ol
83
- className={className('conversation')}
84
- role="log"
85
- aria-label={t('chat.srLabel')}
86
- >
87
- <ComponentFilter>
88
- <Events />
89
- </ComponentFilter>
90
- {debouncedIsLoading ? <Loader /> : null}
91
- <AbortTransactionButton />
92
- </ol>
82
+ <div role="log" aria-label={t('chat.srLabel')}>
83
+ <ol className={className('conversation')}>
84
+ <ComponentFilter>
85
+ <Events />
86
+ </ComponentFilter>
87
+ {debouncedIsLoading ? <Loader /> : null}
88
+ <AbortTransactionButton />
89
+ </ol>
90
+ </div>
93
91
  </div>
94
92
  </div>
95
93
  </>
@@ -1,7 +1,7 @@
1
- import { FunctionalComponent } from 'preact'
2
- import { useCallback, useEffect, useMemo, useRef } from 'preact/hooks'
3
1
  import { MessageCard } from 'domains/store/store.types'
4
2
  import { className } from 'lib/css'
3
+ import { FunctionalComponent } from 'preact'
4
+ import { useCallback, useEffect, useMemo, useRef } from 'preact/hooks'
5
5
  import { useGeneratedId, useSeamlyCommands } from 'ui/hooks/seamly-hooks'
6
6
  import { actionTypes, cardTypes } from 'ui/utils/seamly-utils'
7
7
 
@@ -32,7 +32,7 @@ const CardComponent: FunctionalComponent<CardComponentProps> = ({
32
32
  const emitCardEvent = useCallback(
33
33
  () =>
34
34
  emitEvent(`action.${actionTypes.clickCard}`, {
35
- type: actionTypes.clickCta,
35
+ type: actionTypes.clickCard,
36
36
  originMessage: id,
37
37
  action,
38
38
  }),
@@ -1,5 +1,5 @@
1
- import { useCallback } from 'preact/hooks'
2
1
  import { className } from 'lib/css'
2
+ import { useCallback } from 'preact/hooks'
3
3
 
4
4
  export default function CarouselPagination({
5
5
  items,
@@ -1,6 +1,6 @@
1
+ import { className } from 'lib/css'
1
2
  import { RefObject, createRef } from 'preact'
2
3
  import { useEffect, useMemo, useRef, useState } from 'preact/hooks'
3
- import { className } from 'lib/css'
4
4
  import CarouselMessageSlide from 'ui/components/conversation/event/carousel-message/components/slide'
5
5
  import { useGeneratedId } from 'ui/hooks/utility-hooks'
6
6
  import CarouselControls from './components/controls'
@@ -1,6 +1,6 @@
1
+ import { className } from 'lib/css'
1
2
  import { RefObject, createRef } from 'preact'
2
3
  import { useMemo } from 'preact/hooks'
3
- import { className } from 'lib/css'
4
4
  import ChatScrollContext from 'ui/components/conversation/event/chat-scroll/chat-scroll-context'
5
5
  import UnreadMessagesButton from 'ui/components/conversation/event/chat-scroll/unread-messages-button'
6
6
  import useChatScroll from 'ui/components/conversation/use-chat-scroll'
@@ -1,10 +1,11 @@
1
- import { toChildArray } from 'preact'
2
- import { FC } from 'preact/compat'
3
- import { useEffect, useMemo, useState } from 'preact/hooks'
4
1
  import { useI18n } from 'domains/i18n/hooks'
2
+ import type { MessageChoicePrompt } from 'domains/store/store.types'
5
3
  import { useTranslatedEventData } from 'domains/translations/hooks'
6
4
  import { className } from 'lib/css'
7
5
  import { randomId } from 'lib/id'
6
+ import { toChildArray } from 'preact'
7
+ import { FC } from 'preact/compat'
8
+ import { useEffect, useMemo, useState } from 'preact/hooks'
8
9
  import MessageContainer from 'ui/components/conversation/message-container'
9
10
  import Icon from 'ui/components/layout/icon'
10
11
  import { useSeamlyHasConversation } from 'ui/hooks/seamly-api-hooks'
@@ -16,7 +17,6 @@ import {
16
17
  } from 'ui/hooks/seamly-hooks'
17
18
  import { childIsVNode } from 'ui/utils/general-utils'
18
19
  import { actionTypes } from 'ui/utils/seamly-utils'
19
- import type { MessageChoicePrompt } from 'domains/store/store.types'
20
20
 
21
21
  export const useChoicePrompt = (event: MessageChoicePrompt) => {
22
22
  const { payload } = event
@@ -118,7 +118,7 @@ const ChoicePrompt: FC<ChoicePromptProps> = ({ event, children, ...props }) => {
118
118
  child.props = {
119
119
  ...child.props,
120
120
  event: subEvent,
121
- descriptorId,
121
+ id: descriptorId,
122
122
  showTranslationToggle: false,
123
123
  }
124
124
  return child
@@ -1,4 +1,3 @@
1
- import { useCallback, useMemo, useState } from 'preact/hooks'
2
1
  import { useUserHasResponded } from 'domains/app/hooks'
3
2
  import { setHasResponded } from 'domains/app/slice'
4
3
  import { useConfig } from 'domains/config/hooks'
@@ -7,6 +6,7 @@ import { useAppDispatch } from 'domains/store'
7
6
  import { useTranslatedEventData } from 'domains/translations/hooks'
8
7
  import { className } from 'lib/css'
9
8
  import { randomId } from 'lib/id'
9
+ import { useCallback, useMemo, useState } from 'preact/hooks'
10
10
  import MessageContainer from 'ui/components/conversation/message-container'
11
11
  import SuggestionsList from 'ui/components/suggestions/suggestions-list'
12
12
  import { useSeamlyHasConversation } from 'ui/hooks/seamly-api-hooks'
@@ -1,15 +1,15 @@
1
- import { useCallback } from 'preact/hooks'
2
- import { useSelector } from 'react-redux'
3
1
  import { useI18n } from 'domains/i18n/hooks'
4
2
  import { useAppDispatch } from 'domains/store'
3
+ import type { RootState } from 'domains/store'
5
4
  import {
6
5
  disableEventsTranslation,
7
6
  enableEventsTranslation,
8
7
  } from 'domains/translations/slice'
9
8
  import { className } from 'lib/css'
9
+ import { useCallback } from 'preact/hooks'
10
+ import { useSelector } from 'react-redux'
10
11
  import EventDivider from 'ui/components/conversation/event-divider'
11
12
  import { useEvents } from 'ui/hooks/seamly-state-hooks'
12
- import type { RootState } from 'domains/store'
13
13
 
14
14
  const NewTranslationDivider = ({ event }) => {
15
15
  const { t } = useI18n()
@@ -1,5 +1,5 @@
1
- import { useEffect } from 'preact/hooks'
2
1
  import { className } from 'lib/css'
2
+ import { useEffect } from 'preact/hooks'
3
3
  import { useFormattedDate } from 'ui/components/conversation/event/hooks/use-formatted-date'
4
4
  import EventDivider from 'ui/components/conversation/event-divider'
5
5
  import { useForceUpdate } from 'ui/hooks/utility-hooks'
@@ -1,7 +1,7 @@
1
- import { VNode } from 'preact'
2
1
  import { useConfig } from 'domains/config/hooks'
3
2
  import { useI18n } from 'domains/i18n/hooks'
4
3
  import { className } from 'lib/css'
4
+ import { VNode } from 'preact'
5
5
  import { useSeamlyParticipant } from 'ui/hooks/seamly-hooks'
6
6
 
7
7
  const EventParticipant = ({ eventPayload }) => {
@@ -1,9 +1,9 @@
1
- import { FunctionComponent, useEffect } from 'preact/compat'
2
1
  import { useAppDispatch } from 'domains/store'
3
2
  import { setEventsRead } from 'domains/store/slice'
4
3
  import { ChannelEvent } from 'domains/store/store.types'
5
4
  import { useIntersect } from 'domains/visibility/hooks'
6
5
  import { className } from 'lib/css'
6
+ import { FunctionComponent, useEffect } from 'preact/compat'
7
7
  import { useChatScrollContext } from 'ui/components/conversation/event/chat-scroll/chat-scroll-context'
8
8
  import TimeIndicator from 'ui/components/conversation/event/divider/variants/time-indicator'
9
9
  import { useSeamlyCommands } from 'ui/hooks/seamly-hooks'
@@ -1,6 +1,6 @@
1
- import { useState } from 'preact/hooks'
2
1
  import { useI18n } from 'domains/i18n/hooks'
3
2
  import { className } from 'lib/css'
3
+ import { useState } from 'preact/hooks'
4
4
  import Icon from 'ui/components/layout/icon'
5
5
  import Lightbox from 'ui/components/widgets/lightbox'
6
6
 
@@ -1,9 +1,9 @@
1
- import { FunctionalComponent } from 'preact'
2
- import { useState } from 'preact/hooks'
3
1
  import { useAppDispatch } from 'domains/store'
4
2
  import { setLoadedImageEventIds } from 'domains/store/slice'
5
3
  import { MessageImage } from 'domains/store/store.types'
6
4
  import { useTranslatedEventData } from 'domains/translations/hooks'
5
+ import { FunctionalComponent } from 'preact'
6
+ import { useState } from 'preact/hooks'
7
7
  import MessageContainer, {
8
8
  MessageContainerProps,
9
9
  } from 'ui/components/conversation/message-container'
@@ -1,6 +1,6 @@
1
- import { FunctionalComponent } from 'preact'
2
1
  import { ParticipantEvent } from 'domains/store/store.types'
3
2
  import { useTranslatedParticipantData } from 'domains/translations/hooks'
3
+ import { FunctionalComponent } from 'preact'
4
4
  import EventDivider from 'ui/components/conversation/event-divider'
5
5
 
6
6
  type ParticipantProps = {
@@ -18,7 +18,6 @@ const Splash = ({ event, ...props }) => {
18
18
  {...props}
19
19
  bodyProps={{
20
20
  dangerouslySetInnerHTML: {
21
- // @ts-ignore
22
21
  __html: body?.text || '',
23
22
  },
24
23
  }}
@@ -1,7 +1,7 @@
1
- import { FunctionalComponent } from 'preact'
2
- import { useMemo } from 'preact/hooks'
3
1
  import { MessageText } from 'domains/store/store.types'
4
2
  import { useTranslatedEventData } from 'domains/translations/hooks'
3
+ import { FunctionalComponent } from 'preact'
4
+ import { useMemo } from 'preact/hooks'
5
5
  import MessageContainer, {
6
6
  MessageContainerProps,
7
7
  } from 'ui/components/conversation/message-container'
@@ -1,9 +1,9 @@
1
- import { useMemo } from 'preact/hooks'
2
- import { useSelector } from 'react-redux'
3
1
  import { useI18n } from 'domains/i18n/hooks'
4
2
  import { RootState } from 'domains/store'
5
3
  import { useTranslatedEventData } from 'domains/translations/hooks'
6
4
  import { className } from 'lib/css'
5
+ import { useMemo } from 'preact/hooks'
6
+ import { useSelector } from 'react-redux'
7
7
  import MessageContainer from 'ui/components/conversation/message-container'
8
8
  import Icon from 'ui/components/layout/icon'
9
9
  import { useSeamlyApiContext } from 'ui/hooks/seamly-api-hooks'
@@ -22,7 +22,7 @@ const useImageFromStorage = (currentFileId) => {
22
22
 
23
23
  try {
24
24
  return sessionStorage.getItem(`image-${currentFileId}`)
25
- } catch (error) {
25
+ } catch (_error) {
26
26
  return undefined
27
27
  }
28
28
  }, [currentFileId, processingFileUploads])
@@ -1,9 +1,9 @@
1
- import { FC } from 'preact/compat'
1
+ import type { MessageVideo } from 'domains/store/store.types'
2
2
  import { useTranslatedEventData } from 'domains/translations/hooks'
3
3
  import { className } from 'lib/css'
4
+ import { FC } from 'preact/compat'
4
5
  import MessageContainer from 'ui/components/conversation/message-container'
5
6
  import { useSeamlyMessageContainerClassNames } from 'ui/hooks/seamly-hooks'
6
- import type { MessageVideo } from 'domains/store/store.types'
7
7
 
8
8
  type VideoProps = {
9
9
  event: MessageVideo
@@ -1,5 +1,5 @@
1
- import { FC } from 'preact/compat'
2
1
  import { className } from 'lib/css'
2
+ import { FC } from 'preact/compat'
3
3
  import Icon from 'ui/components/layout/icon'
4
4
 
5
5
  type EventDividerProps = {
@@ -1,5 +1,3 @@
1
- import { PreactDOMAttributes } from 'preact'
2
- import { FC, HTMLAttributes } from 'preact/compat'
3
1
  import {
4
2
  InfoEvent,
5
3
  MessageEvent,
@@ -7,6 +5,8 @@ import {
7
5
  } from 'domains/store/store.types'
8
6
  import { useTranslatedEventData } from 'domains/translations/hooks'
9
7
  import { className } from 'lib/css'
8
+ import { PreactDOMAttributes } from 'preact'
9
+ import { FC, HTMLAttributes } from 'preact/compat'
10
10
  import { useSeamlyMessageContainerClassNames } from 'ui/hooks/component-helper-hooks'
11
11
  import EventParticipant from './event/event-participant'
12
12
 
@@ -39,7 +39,6 @@ const MessageContainer: FC<MessageContainerProps> = ({
39
39
  }
40
40
  if (modifiers) {
41
41
  if (typeof modifiers === 'string') {
42
- // eslint-disable-next-line no-param-reassign
43
42
  modifiers = modifiers.split(' ').filter((v) => v.length)
44
43
  }
45
44
  modifiers.forEach((modifier) => {
@@ -54,7 +53,6 @@ const MessageContainer: FC<MessageContainerProps> = ({
54
53
  }
55
54
 
56
55
  if (isTranslated) {
57
- // eslint-disable-next-line no-param-reassign
58
56
  bodyProps = {
59
57
  ...bodyProps,
60
58
  lang: locale,
@@ -1,3 +1,6 @@
1
+ import { RootState } from 'domains/store'
2
+ import { selectUnreadEventIds } from 'domains/store/selectors'
3
+ import { useVisibility } from 'domains/visibility/hooks'
1
4
  import { RefObject } from 'preact'
2
5
  import {
3
6
  MutableRef,
@@ -7,9 +10,6 @@ import {
7
10
  useState,
8
11
  } from 'preact/hooks'
9
12
  import { useSelector } from 'react-redux'
10
- import { RootState } from 'domains/store'
11
- import { selectUnreadEventIds } from 'domains/store/selectors'
12
- import { useVisibility } from 'domains/visibility/hooks'
13
13
  import { timeout } from 'ui/hooks/focus-helper-hooks'
14
14
  import {
15
15
  useEvents,
@@ -1,7 +1,7 @@
1
- import { useCallback, useRef } from 'preact/hooks'
2
1
  import { activitySendDelay } from 'config'
3
2
  import { useVisibility } from 'domains/visibility/hooks'
4
3
  import { className } from 'lib/css'
4
+ import { useCallback, useRef } from 'preact/hooks'
5
5
  import {
6
6
  useSeamlyCommands,
7
7
  useSeamlyIdleDetachCountdown,
@@ -1,6 +1,6 @@
1
+ import API from 'api'
1
2
  import { Events } from 'minivents'
2
3
  import { createContext } from 'preact'
3
- import API from 'api'
4
4
 
5
5
  export const SeamlyApiContext = createContext<API | null>(null)
6
6
 
@@ -1,10 +1,10 @@
1
+ import API from 'api'
2
+ import { catchError } from 'domains/errors'
3
+ import { Store } from 'domains/store'
1
4
  import { Events } from 'minivents'
2
5
  import { FunctionComponent } from 'preact'
3
6
  import { useErrorBoundary } from 'preact/hooks'
4
7
  import { Provider } from 'react-redux'
5
- import API from 'api'
6
- import { catchError } from 'domains/errors'
7
- import { Store } from 'domains/store'
8
8
  import SeamlyChat from 'ui/components/core/seamly-chat'
9
9
  import ComponentFilter from '../conversation/component-filter'
10
10
  import SeamlyActivityMonitor from './seamly-activity-monitor'
@@ -1,4 +1,3 @@
1
- import { useEffect, useRef } from 'preact/hooks'
2
1
  import { AsyncAPIMessage } from 'api/api.types'
3
2
  import SeamlyGeneralError from 'api/errors/seamly-general-error'
4
3
  import SeamlyOfflineError from 'api/errors/seamly-offline-error'
@@ -23,7 +22,9 @@ import {
23
22
  updateEvent,
24
23
  updateFeatures,
25
24
  } from 'domains/store/slice'
25
+ import type { ChannelEvent } from 'domains/store/store.types'
26
26
  import { setTranslationProposalPrompt } from 'domains/translations/slice'
27
+ import { useEffect, useRef } from 'preact/hooks'
27
28
  import useSeamlyEventBusContext from 'ui/hooks/event-bus-hooks'
28
29
  import {
29
30
  useSeamlyCommands,
@@ -31,7 +32,6 @@ import {
31
32
  useSeamlyResumeConversationPrompt,
32
33
  } from 'ui/hooks/seamly-hooks'
33
34
  import useSeamlyConversation from 'ui/hooks/use-seamly-conversation'
34
- import type { ChannelEvent } from 'domains/store/store.types'
35
35
 
36
36
  const EMITTABLE_MESSAGE_TYPES = ['text', 'choice_prompt', 'image', 'video']
37
37
 
@@ -165,7 +165,7 @@ const SeamlyEventSubscriber = () => {
165
165
  break
166
166
  }
167
167
  break
168
- case 'service_attach':
168
+ case 'service_attach': {
169
169
  const {
170
170
  service: {
171
171
  name,
@@ -187,6 +187,7 @@ const SeamlyEventSubscriber = () => {
187
187
  }),
188
188
  )
189
189
  break
190
+ }
190
191
  case 'context':
191
192
  if (event.payload.contentLocale && event.payload.userLocale) {
192
193
  dispatch(setLocale(event.payload.userLocale))
@@ -200,7 +201,6 @@ const SeamlyEventSubscriber = () => {
200
201
  case 'image':
201
202
  case 'upload':
202
203
  case 'video':
203
- case 'cta':
204
204
  case 'custom':
205
205
  case 'carousel':
206
206
  case 'card':
@@ -254,7 +254,7 @@ const SeamlyEventSubscriber = () => {
254
254
  break
255
255
  case 'error':
256
256
  switch (event.payload.type) {
257
- case 'find_conversation':
257
+ case 'find_conversation': {
258
258
  const seamlySessionExpiredError = new SeamlySessionExpiredError(
259
259
  event,
260
260
  )
@@ -268,7 +268,8 @@ const SeamlyEventSubscriber = () => {
268
268
  }),
269
269
  )
270
270
  break
271
- case 'conversation':
271
+ }
272
+ case 'conversation': {
272
273
  const seamlyGeneralError = new SeamlyGeneralError(event)
273
274
  dispatch(
274
275
  setInterrupt({
@@ -281,6 +282,7 @@ const SeamlyEventSubscriber = () => {
281
282
  }),
282
283
  )
283
284
  break
285
+ }
284
286
  }
285
287
  }
286
288
 
@@ -315,7 +317,7 @@ const SeamlyEventSubscriber = () => {
315
317
  if (events && 'service' in events) {
316
318
  dispatch(setEvents(events))
317
319
  }
318
- } catch (e) {
320
+ } catch (_e) {
319
321
  // nothing to do,
320
322
  }
321
323
  }
@@ -1,4 +1,3 @@
1
- import { useCallback } from 'preact/hooks'
2
1
  import { useI18n } from 'domains/i18n/hooks'
3
2
  import { useAppDispatch } from 'domains/store'
4
3
  import {
@@ -10,6 +9,7 @@ import {
10
9
  startProcessingImage,
11
10
  } from 'domains/store/slice'
12
11
  import { randomId } from 'lib/id'
12
+ import { useCallback } from 'preact/hooks'
13
13
  import SeamlyFileUploadContext from 'ui/components/core/seamly-file-upload-context'
14
14
  import { useSeamlyApiContext, useSeamlyCommands } from 'ui/hooks/seamly-hooks'
15
15
 
@@ -73,7 +73,7 @@ const SeamlyFileUpload = ({ children }) => {
73
73
 
74
74
  try {
75
75
  sessionStorage.setItem(`image-${fileId}`, newDataUri)
76
- } catch (error) {
76
+ } catch (_error) {
77
77
  // Nothing to do!
78
78
  } finally {
79
79
  dispatch(doneProcessingImage(fileId))
@@ -96,7 +96,6 @@ const SeamlyFileUpload = ({ children }) => {
96
96
  id,
97
97
  transactionId,
98
98
  occurredAt,
99
- // @ts-ignore
100
99
  body: { contentType, filename, filesize },
101
100
  } = result
102
101
  dispatch(setUploadComplete(fileId))
@@ -1,5 +1,5 @@
1
- import { useEffect, useRef } from 'preact/hooks'
2
1
  import { useConfig } from 'domains/config/hooks'
2
+ import { useEffect, useRef } from 'preact/hooks'
3
3
  import { useSeamlyOptions } from 'ui/hooks/seamly-hooks'
4
4
 
5
5
  const SeamlyInitializer = () => {
@@ -1,5 +1,3 @@
1
- import { useEffect, useRef } from 'preact/hooks'
2
- import { useSelector } from 'react-redux'
3
1
  import { VisibilityOptions } from 'config.types'
4
2
  import { useConfig } from 'domains/config/hooks'
5
3
  import { updateConfig } from 'domains/config/slice'
@@ -8,6 +6,9 @@ import { useAppDispatch } from 'domains/store'
8
6
  import { useTranslations } from 'domains/translations/hooks'
9
7
  import { visibilityStates } from 'domains/visibility/constants'
10
8
  import { useVisibility } from 'domains/visibility/hooks'
9
+ import type { VisibilityActionArgs } from 'domains/visibility/visibility.types'
10
+ import { useEffect, useRef } from 'preact/hooks'
11
+ import { useSelector } from 'react-redux'
11
12
  import useSeamlyEventBusContext from 'ui/hooks/event-bus-hooks'
12
13
  import {
13
14
  useSeamlyActivityEventHandler,
@@ -18,7 +19,6 @@ import {
18
19
  useSeamlyUnreadCount,
19
20
  } from 'ui/hooks/seamly-hooks'
20
21
  import { actionTypes, sourceTypes } from 'ui/utils/seamly-utils'
21
- import type { VisibilityActionArgs } from 'domains/visibility/visibility.types'
22
22
 
23
23
  function useSeamlyInstanceFunction(functionName, fn, deps: any[] = []) {
24
24
  const eventBus = useSeamlyEventBusContext()
@@ -1,5 +1,5 @@
1
- import { useCallback, useEffect, useRef, useState } from 'preact/hooks'
2
1
  import { className } from 'lib/css'
2
+ import { useCallback, useEffect, useRef, useState } from 'preact/hooks'
3
3
  import useSeamlyEventBusContext from 'ui/hooks/event-bus-hooks'
4
4
  import { ValueOf } from 'ui/utils/general-utils'
5
5
  import { ariaLiveLevels } from 'ui/utils/seamly-utils'
@@ -1,5 +1,5 @@
1
- import { useEffect } from 'preact/hooks'
2
1
  import { useI18n } from 'domains/i18n/hooks'
2
+ import { useEffect } from 'preact/hooks'
3
3
  import { useLiveRegion, useSeamlyIsHistoryLoaded } from 'ui/hooks/seamly-hooks'
4
4
 
5
5
  const SeamlyNewNotifications = () => {
@@ -1,7 +1,7 @@
1
- import { useEffect, useMemo, useRef } from 'preact/hooks'
2
1
  import { unreadScreenReaderWait } from 'config'
3
2
  import { useI18n } from 'domains/i18n/hooks'
4
3
  import { useVisibility } from 'domains/visibility/hooks'
4
+ import { useEffect, useMemo, useRef } from 'preact/hooks'
5
5
  import { useLiveRegion, useSeamlyUnreadCount } from 'ui/hooks/seamly-hooks'
6
6
  import { debounce } from 'ui/utils/general-utils'
7
7
 
@@ -1,7 +1,7 @@
1
- import { useCallback, useEffect, useRef, useState } from 'preact/hooks'
2
1
  import { useConfig } from 'domains/config/hooks'
3
2
  import { useVisibility } from 'domains/visibility/hooks'
4
3
  import { className } from 'lib/css'
4
+ import { useCallback, useEffect, useRef, useState } from 'preact/hooks'
5
5
  import IdleDetachWarning from 'ui/components/warnings/idle-detach-warning'
6
6
  import ResumeConversationPrompt from 'ui/components/warnings/resume-conversation-prompt'
7
7
  import { useSeamlyEntry } from 'ui/hooks/seamly-entry-hooks'
@@ -74,9 +74,14 @@ const EntryContainer = () => {
74
74
  entryContainer.current.contains(document.activeElement)
75
75
  )
76
76
 
77
- const EntryComponent = entryComponents[renderEntry]
77
+ // Everything other than `text` and `upload` will fallback to `TextEntry` for now.
78
+ // This is also done for `choice_prompt`, see comment above `allowManualInput` below.
79
+ // At a later stage we could implement components like `DateTime` or `PhoneNumber`.
80
+ const EntryComponent = entryComponents[renderEntry] || TextEntry
81
+
78
82
  // Currently we do not have an actual ChoicePrompt entry component.
79
- // Once we do, this property should be moved to that component instead.
83
+ // If we ever do, this property should be moved to that component instead.
84
+ // The current ChoicePrompt component is only responsible for the rendering of the buttons/choose again option.
80
85
  const { allowManualInput = true } = activeEntryOptions
81
86
 
82
87
  return (