@seamly/web-ui 24.5.0-beta.1 → 25.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 +2077 -1786
- 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 +49 -7
- package/build/dist/lib/index.debug.min.js.map +1 -1
- package/build/dist/lib/index.js +695 -384
- 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.LICENSE.txt +16 -1
- package/build/dist/lib/index.min.js.map +1 -1
- package/build/dist/lib/style-guide.js +305 -93
- 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-default-implementation.css +1 -1
- package/build/dist/lib/styles.css +1 -1
- package/package.json +27 -38
- package/src/javascripts/core/api/api.types.ts +3 -0
- package/src/javascripts/core/api/asyncapi.types.ts +292 -69
- package/src/javascripts/core/api/channel.types.ts +301 -69
- package/src/javascripts/core/api/conversation-connector.ts +1 -3
- package/src/javascripts/core/api/errors/seamly-api-error.ts +0 -1
- package/src/javascripts/core/api/errors/seamly-base-error.ts +1 -1
- package/src/javascripts/core/api/index.ts +7 -7
- package/src/javascripts/core/api/utils.ts +0 -1
- package/src/javascripts/core/domains/app/actions.ts +1 -1
- package/src/javascripts/core/domains/app/hooks.ts +1 -1
- package/src/javascripts/core/domains/config/hooks.ts +1 -1
- package/src/javascripts/core/domains/config/selectors.ts +1 -1
- package/src/javascripts/core/domains/config/slice.ts +2 -2
- package/src/javascripts/core/domains/forms/context.ts +1 -1
- package/src/javascripts/core/domains/forms/hooks.ts +12 -12
- package/src/javascripts/core/domains/forms/provider.tsx +9 -9
- package/src/javascripts/core/domains/i18n/actions.ts +1 -1
- package/src/javascripts/core/domains/i18n/hooks.ts +3 -3
- package/src/javascripts/core/domains/interrupt/hooks.ts +1 -1
- package/src/javascripts/core/domains/store/index.ts +2 -2
- package/src/javascripts/core/domains/store/slice.ts +46 -34
- package/src/javascripts/core/domains/store/store.types.ts +2 -7
- package/src/javascripts/core/domains/translations/components/options-button.tsx +2 -2
- package/src/javascripts/core/domains/translations/components/options-dialog/index.tsx +1 -1
- package/src/javascripts/core/domains/translations/components/options-dialog/translation-option.tsx +1 -1
- package/src/javascripts/core/domains/translations/components/options-dialog/translation-options.tsx +2 -2
- package/src/javascripts/core/domains/translations/components/translation-status.tsx +1 -1
- package/src/javascripts/core/domains/translations/hooks.ts +2 -2
- package/src/javascripts/core/domains/translations/middleware.ts +4 -2
- package/src/javascripts/core/domains/visibility/actions.ts +2 -2
- package/src/javascripts/core/domains/visibility/hooks.ts +5 -5
- package/src/javascripts/core/lib/debug.ts +1 -1
- package/src/javascripts/core/lib/engine/index.tsx +5 -5
- package/src/javascripts/core/lib/external-api/index.ts +6 -6
- package/src/javascripts/core/lib/mutex.ts +0 -1
- package/src/javascripts/core/lib/split-url-params.ts +1 -1
- package/src/javascripts/core/lib/store/index.ts +0 -1
- package/src/javascripts/core/lib/store/providers/app-storage.js +4 -7
- package/src/javascripts/core/lib/store/providers/app-storage.ts +4 -6
- package/src/javascripts/core/ui/components/app-options/index.tsx +1 -1
- package/src/javascripts/core/ui/components/chat-status/index.tsx +1 -1
- package/src/javascripts/core/ui/components/conversation/component-filter.tsx +1 -3
- package/src/javascripts/core/ui/components/conversation/event/card-component.tsx +3 -3
- package/src/javascripts/core/ui/components/conversation/event/carousel-component/components/pagination.tsx +1 -1
- package/src/javascripts/core/ui/components/conversation/event/carousel-component/index.tsx +1 -1
- package/src/javascripts/core/ui/components/conversation/event/chat-scroll/chat-scroll-provider.tsx +1 -1
- package/src/javascripts/core/ui/components/conversation/event/choice-prompt.tsx +4 -4
- package/src/javascripts/core/ui/components/conversation/event/conversation-suggestions.tsx +1 -1
- package/src/javascripts/core/ui/components/conversation/event/divider/variants/new-translation.tsx +3 -3
- package/src/javascripts/core/ui/components/conversation/event/divider/variants/time-indicator.tsx +1 -1
- package/src/javascripts/core/ui/components/conversation/event/event-participant.tsx +1 -1
- package/src/javascripts/core/ui/components/conversation/event/event.tsx +1 -1
- package/src/javascripts/core/ui/components/conversation/event/image-lightbox.tsx +1 -1
- package/src/javascripts/core/ui/components/conversation/event/image.tsx +2 -2
- package/src/javascripts/core/ui/components/conversation/event/participant.tsx +1 -1
- package/src/javascripts/core/ui/components/conversation/event/splash.tsx +0 -1
- package/src/javascripts/core/ui/components/conversation/event/text.tsx +2 -2
- package/src/javascripts/core/ui/components/conversation/event/upload.tsx +3 -3
- package/src/javascripts/core/ui/components/conversation/event/video.tsx +2 -2
- package/src/javascripts/core/ui/components/conversation/event-divider.tsx +1 -1
- package/src/javascripts/core/ui/components/conversation/message-container.tsx +2 -4
- package/src/javascripts/core/ui/components/conversation/use-chat-scroll.ts +3 -3
- package/src/javascripts/core/ui/components/core/seamly-activity-monitor.tsx +1 -1
- package/src/javascripts/core/ui/components/core/seamly-api-context.ts +1 -1
- package/src/javascripts/core/ui/components/core/seamly-core.tsx +3 -3
- package/src/javascripts/core/ui/components/core/seamly-event-subscriber.ts +9 -7
- package/src/javascripts/core/ui/components/core/seamly-file-upload.tsx +2 -3
- package/src/javascripts/core/ui/components/core/seamly-initializer.tsx +1 -1
- package/src/javascripts/core/ui/components/core/seamly-instance-functions-loader.ts +3 -3
- package/src/javascripts/core/ui/components/core/seamly-live-region.tsx +1 -1
- package/src/javascripts/core/ui/components/core/seamly-new-notifications.ts +1 -1
- package/src/javascripts/core/ui/components/core/seamly-read-state.ts +1 -1
- package/src/javascripts/core/ui/components/entry/entry-container.tsx +8 -3
- package/src/javascripts/core/ui/components/entry/text-entry/hooks.ts +21 -14
- package/src/javascripts/core/ui/components/entry/text-entry/index.tsx +1 -1
- package/src/javascripts/core/ui/components/entry/text-entry/text-entry-form.tsx +1 -1
- package/src/javascripts/core/ui/components/entry/upload/file-upload-form.tsx +1 -1
- package/src/javascripts/core/ui/components/entry/upload/index.tsx +1 -1
- package/src/javascripts/core/ui/components/entry/upload-toggle.tsx +1 -1
- package/src/javascripts/core/ui/components/form-controls/error.tsx +1 -1
- package/src/javascripts/core/ui/components/form-controls/file-input.tsx +1 -1
- package/src/javascripts/core/ui/components/form-controls/input.tsx +1 -1
- package/src/javascripts/core/ui/components/form-controls/wrapper.tsx +1 -1
- package/src/javascripts/core/ui/components/layout/agent-info.tsx +1 -1
- package/src/javascripts/core/ui/components/layout/chat-frame.tsx +1 -1
- package/src/javascripts/core/ui/components/layout/chat.tsx +2 -2
- package/src/javascripts/core/ui/components/layout/continue-chat-messages.tsx +1 -1
- package/src/javascripts/core/ui/components/layout/header.tsx +1 -1
- package/src/javascripts/core/ui/components/layout/interrupt.tsx +1 -1
- package/src/javascripts/core/ui/components/layout/pre-chat-messages.tsx +1 -1
- package/src/javascripts/core/ui/components/options/options-button.tsx +1 -3
- package/src/javascripts/core/ui/components/options/options-frame.tsx +1 -1
- package/src/javascripts/core/ui/components/options/transcript/index.tsx +1 -1
- package/src/javascripts/core/ui/components/suggestions/index.tsx +2 -2
- package/src/javascripts/core/ui/components/suggestions/suggestions-list.tsx +1 -1
- package/src/javascripts/core/ui/components/view/index.tsx +3 -3
- package/src/javascripts/core/ui/components/view/window-view/window-open-button.tsx +2 -2
- package/src/javascripts/core/ui/components/widgets/in-out-transition.tsx +2 -2
- package/src/javascripts/core/ui/components/widgets/lightbox.tsx +1 -1
- package/src/javascripts/core/ui/hooks/file-upload-hooks.ts +1 -1
- package/src/javascripts/core/ui/hooks/focus-helper-hooks.ts +1 -1
- package/src/javascripts/core/ui/hooks/seamly-entry-hooks.ts +1 -1
- package/src/javascripts/core/ui/hooks/seamly-option-hooks.ts +1 -1
- package/src/javascripts/core/ui/hooks/seamly-state-hooks.ts +9 -4
- package/src/javascripts/core/ui/hooks/use-debounce.ts +1 -1
- package/src/javascripts/core/ui/hooks/use-interval.ts +0 -1
- package/src/javascripts/core/ui/hooks/use-notifications.ts +2 -3
- package/src/javascripts/core/ui/hooks/use-seamly-chat.ts +2 -2
- package/src/javascripts/core/ui/hooks/use-seamly-commands.ts +2 -2
- package/src/javascripts/core/ui/hooks/use-seamly-conversation.ts +1 -1
- package/src/javascripts/core/ui/hooks/use-seamly-idle-detach-countdown.ts +15 -10
- package/src/javascripts/core/ui/hooks/use-session-expired-command.ts +1 -1
- package/src/javascripts/core/ui/hooks/use-single-file-upload.ts +1 -1
- package/src/javascripts/core/ui/hooks/utility-hooks.ts +1 -2
- package/src/javascripts/core/ui/utils/seamly-utils.ts +0 -2
- package/src/javascripts/core/ui/utils/validations.ts +1 -2
- package/src/javascripts/style-guide/components/app.tsx +2 -2
- package/src/javascripts/style-guide/components/static-core.tsx +2 -2
- package/src/javascripts/style-guide/components/view.tsx +1 -1
- package/src/javascripts/style-guide/state-helpers/index.ts +0 -2
- package/src/javascripts/style-guide/states.ts +5 -42
- package/src/javascripts/style-guide/style-guide-engine.tsx +1 -1
- package/src/stylesheets/5-components/_message-body.scss +0 -10
- package/src/stylesheets/6-default-implementation/_hover.scss +0 -7
- package/src/stylesheets/styles.scss +0 -1
- package/webpack/config.common.js +4 -11
- package/webpack/config.dev.js +0 -1
- package/webpack/config.package.js +5 -7
- package/webpack/config.site.js +2 -4
- package/webpack/config.test.js +1 -2
- package/webpack/defaults.js +0 -1
- package/webpack/parts/babel-loader-browser-plugins.js +0 -1
- package/webpack/parts/dev-server.js +0 -1
- package/src/javascripts/core/ui/components/conversation/event/cta.tsx +0 -54
- package/src/stylesheets/5-components/_message-cta.scss +0 -17
|
@@ -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
|
},
|
|
@@ -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.
|
|
35
|
+
type: actionTypes.clickCard,
|
|
36
36
|
originMessage: id,
|
|
37
37
|
action,
|
|
38
38
|
}),
|
|
@@ -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'
|
package/src/javascripts/core/ui/components/conversation/event/chat-scroll/chat-scroll-provider.tsx
CHANGED
|
@@ -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
|
|
@@ -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'
|
package/src/javascripts/core/ui/components/conversation/event/divider/variants/new-translation.tsx
CHANGED
|
@@ -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()
|
package/src/javascripts/core/ui/components/conversation/event/divider/variants/time-indicator.tsx
CHANGED
|
@@ -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 = {
|
|
@@ -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 (
|
|
25
|
+
} catch (_error) {
|
|
26
26
|
return undefined
|
|
27
27
|
}
|
|
28
28
|
}, [currentFileId, processingFileUploads])
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
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,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,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
|
-
|
|
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 (
|
|
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 (
|
|
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,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,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
|
-
|
|
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
|
-
//
|
|
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 (
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useEffect, useMemo } from 'preact/hooks'
|
|
2
1
|
import { maxCharacterSrDebounceDelay, maxCharacterWarningLimit } from 'config'
|
|
3
2
|
import { useConfig } from 'domains/config/hooks'
|
|
4
3
|
import { useFormControl } from 'domains/forms/hooks'
|
|
5
4
|
import { useI18n } from 'domains/i18n/hooks'
|
|
6
5
|
import { useAppDispatch } from 'domains/store'
|
|
7
6
|
import { clearAbortTransaction } from 'domains/store/slice'
|
|
7
|
+
import { useEffect, useMemo } from 'preact/hooks'
|
|
8
8
|
import { useLiveRegion } from 'ui/hooks/live-region-hooks'
|
|
9
9
|
import {
|
|
10
10
|
useEntryTextLimit,
|
|
@@ -60,9 +60,20 @@ export const useEntryTextTranslation = (controlName: 'textMessageEntry') => {
|
|
|
60
60
|
const { hasCharacterLimit, characterLimit } = useCharacterLimit(controlName)
|
|
61
61
|
|
|
62
62
|
const {
|
|
63
|
-
entryMeta: { optionsOverride },
|
|
63
|
+
entryMeta: { active: entryType, optionsOverride },
|
|
64
64
|
} = useSeamlyStateContext()
|
|
65
65
|
|
|
66
|
+
let labelOverride: string | null = null
|
|
67
|
+
let placeholderOverride: string | null = null
|
|
68
|
+
if (
|
|
69
|
+
entryType &&
|
|
70
|
+
optionsOverride &&
|
|
71
|
+
typeof optionsOverride[entryType] === 'object'
|
|
72
|
+
) {
|
|
73
|
+
labelOverride = optionsOverride[entryType].label
|
|
74
|
+
placeholderOverride = optionsOverride[entryType].placeholder
|
|
75
|
+
}
|
|
76
|
+
|
|
66
77
|
const { alwaysShowEntryLabel } = useConfig()
|
|
67
78
|
const { t } = useI18n()
|
|
68
79
|
|
|
@@ -70,32 +81,28 @@ export const useEntryTextTranslation = (controlName: 'textMessageEntry') => {
|
|
|
70
81
|
() =>
|
|
71
82
|
t('input.inputPlaceholder', {
|
|
72
83
|
hasLimit: hasCharacterLimit,
|
|
73
|
-
text:
|
|
74
|
-
optionsOverride?.text?.placeholder || t('input.inputPlaceholderText'),
|
|
84
|
+
text: placeholderOverride || t('input.inputPlaceholderText'),
|
|
75
85
|
limit: hasCharacterLimit ? characterLimit : null,
|
|
76
86
|
}),
|
|
77
|
-
[t, hasCharacterLimit, characterLimit,
|
|
87
|
+
[t, hasCharacterLimit, characterLimit, placeholderOverride],
|
|
78
88
|
)
|
|
79
89
|
|
|
80
90
|
const label: string = useMemo(
|
|
81
91
|
() =>
|
|
82
92
|
t('input.inputLabel', {
|
|
83
|
-
hasLimit: !
|
|
84
|
-
text:
|
|
85
|
-
limit:
|
|
86
|
-
!optionsOverride?.text?.label && hasCharacterLimit
|
|
87
|
-
? characterLimit
|
|
88
|
-
: null,
|
|
93
|
+
hasLimit: !labelOverride ? hasCharacterLimit : false,
|
|
94
|
+
text: labelOverride || t('input.inputLabelText'),
|
|
95
|
+
limit: !labelOverride && hasCharacterLimit ? characterLimit : null,
|
|
89
96
|
}),
|
|
90
|
-
[t, hasCharacterLimit, characterLimit,
|
|
97
|
+
[t, hasCharacterLimit, characterLimit, labelOverride],
|
|
91
98
|
)
|
|
92
99
|
|
|
93
100
|
const labelClass = useMemo(
|
|
94
101
|
() =>
|
|
95
|
-
alwaysShowEntryLabel === true ||
|
|
102
|
+
alwaysShowEntryLabel === true || labelOverride
|
|
96
103
|
? 'label'
|
|
97
104
|
: 'visually-hidden',
|
|
98
|
-
[alwaysShowEntryLabel,
|
|
105
|
+
[alwaysShowEntryLabel, labelOverride],
|
|
99
106
|
)
|
|
100
107
|
|
|
101
108
|
return { placeholder, label, labelClass }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useCallback } from 'preact/hooks'
|
|
2
1
|
import FormProvider from 'domains/forms/provider'
|
|
3
2
|
import { visibilityStates } from 'domains/visibility/constants'
|
|
4
3
|
import { useVisibility } from 'domains/visibility/hooks'
|
|
4
|
+
import { useCallback } from 'preact/hooks'
|
|
5
5
|
import {
|
|
6
6
|
useSeamlyCommands,
|
|
7
7
|
useSkiplink,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useCallback, useLayoutEffect } from 'preact/hooks'
|
|
2
1
|
import { useFormControl } from 'domains/forms/hooks'
|
|
3
2
|
import { useI18n } from 'domains/i18n/hooks'
|
|
4
3
|
import { useVisibility } from 'domains/visibility/hooks'
|
|
5
4
|
import { className } from 'lib/css'
|
|
5
|
+
import { useCallback, useLayoutEffect } from 'preact/hooks'
|
|
6
6
|
import Form from 'ui/components/form-controls/form'
|
|
7
7
|
import Input from 'ui/components/form-controls/input'
|
|
8
8
|
import Icon from 'ui/components/layout/icon'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { FC } from 'preact/compat'
|
|
2
1
|
import { FormControlName } from 'domains/forms/forms.types'
|
|
3
2
|
import { useFormControl } from 'domains/forms/hooks'
|
|
4
3
|
import { useI18n } from 'domains/i18n/hooks'
|
|
5
4
|
import { className } from 'lib/css'
|
|
5
|
+
import { FC } from 'preact/compat'
|
|
6
6
|
import FileInput from 'ui/components/form-controls/file-input'
|
|
7
7
|
import Form from 'ui/components/form-controls/form'
|
|
8
8
|
|