@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,7 +1,7 @@
|
|
|
1
|
-
import { useCallback, useEffect, useMemo, useRef } from 'preact/hooks'
|
|
2
1
|
import FormProvider from 'domains/forms/provider'
|
|
3
2
|
import { useI18n } from 'domains/i18n/hooks'
|
|
4
3
|
import { className } from 'lib/css'
|
|
4
|
+
import { useCallback, useEffect, useMemo, useRef } from 'preact/hooks'
|
|
5
5
|
import UploadProgress from 'ui/components/widgets/upload-progress'
|
|
6
6
|
import { useSeamlyEntry } from 'ui/hooks/seamly-entry-hooks'
|
|
7
7
|
import {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from 'preact/hooks'
|
|
2
1
|
import { useI18n } from 'domains/i18n/hooks'
|
|
3
2
|
import { className } from 'lib/css'
|
|
3
|
+
import { useEffect, useRef, useState } from 'preact/hooks'
|
|
4
4
|
import Icon from 'ui/components/layout/icon'
|
|
5
5
|
import InOutTransition, {
|
|
6
6
|
transitionStartStates,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useCallback, useState } from 'preact/hooks'
|
|
2
1
|
import { useFormContext, useFormControl } from 'domains/forms/hooks'
|
|
3
2
|
import { className } from 'lib/css'
|
|
3
|
+
import { useCallback, useState } from 'preact/hooks'
|
|
4
4
|
import Icon from 'ui/components/layout/icon'
|
|
5
5
|
import { useGeneratedId } from 'ui/hooks/seamly-hooks'
|
|
6
6
|
import Error from './error'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { useFormContext, useFormControl } from 'domains/forms/hooks'
|
|
1
2
|
import { InputHTMLAttributes } from 'preact/compat'
|
|
2
3
|
import { useRef, useLayoutEffect } from 'preact/hooks'
|
|
3
|
-
import { useFormContext, useFormControl } from 'domains/forms/hooks'
|
|
4
4
|
import FormControlWrapper from './wrapper'
|
|
5
5
|
|
|
6
6
|
type InputProps = InputHTMLAttributes<HTMLInputElement> & {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { useSelector } from 'react-redux'
|
|
2
1
|
import { useStartChatIcon } from 'domains/config/hooks'
|
|
3
2
|
import { useI18n } from 'domains/i18n/hooks'
|
|
4
3
|
import { selectHasError } from 'domains/interrupt/selectors'
|
|
5
4
|
import { useVisibility } from 'domains/visibility/hooks'
|
|
6
5
|
import { className } from 'lib/css'
|
|
6
|
+
import { useSelector } from 'react-redux'
|
|
7
7
|
import {
|
|
8
8
|
useSeamlyCurrentAgent,
|
|
9
9
|
useSeamlyHeaderData,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useSelector } from 'react-redux'
|
|
2
1
|
import { selectHasError } from 'domains/interrupt/selectors'
|
|
3
2
|
import TranslationStatus from 'domains/translations/components/translation-status'
|
|
4
3
|
import { useVisibility } from 'domains/visibility/hooks'
|
|
5
4
|
import { className } from 'lib/css'
|
|
5
|
+
import { useSelector } from 'react-redux'
|
|
6
6
|
import AppOptions from 'ui/components/app-options'
|
|
7
7
|
import ChatScrollProvider from 'ui/components/conversation/event/chat-scroll/chat-scroll-provider'
|
|
8
8
|
import EntryContainer from 'ui/components/entry/entry-container'
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ComponentChildren } from 'preact'
|
|
2
|
-
import { forwardRef } from 'preact/compat'
|
|
3
1
|
import { useUserHasResponded } from 'domains/app/hooks'
|
|
4
2
|
import { useConfig } from 'domains/config/hooks'
|
|
5
3
|
import { useI18n } from 'domains/i18n/hooks'
|
|
6
4
|
import { visibilityStates } from 'domains/visibility/constants'
|
|
7
5
|
import { useVisibility } from 'domains/visibility/hooks'
|
|
8
6
|
import { className } from 'lib/css'
|
|
7
|
+
import { ComponentChildren } from 'preact'
|
|
8
|
+
import { forwardRef } from 'preact/compat'
|
|
9
9
|
import Suggestions from 'ui/components/suggestions'
|
|
10
10
|
import { useSeamlyAppContainerClassNames } from 'ui/hooks/component-helper-hooks'
|
|
11
11
|
import { useSeamlyLayoutMode } from 'ui/hooks/seamly-state-hooks'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useMemo } from 'preact/hooks'
|
|
2
1
|
import { useI18n } from 'domains/i18n/hooks'
|
|
3
2
|
import { ChannelEvent } from 'domains/store/store.types'
|
|
3
|
+
import { useMemo } from 'preact/hooks'
|
|
4
4
|
import { CollapsedChatMessages } from './collapsed-chat-messages'
|
|
5
5
|
|
|
6
6
|
export default function ContinueChatMessages() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useEffect } from 'preact/hooks'
|
|
2
1
|
import { useInterrupt } from 'domains/interrupt/hooks'
|
|
3
2
|
import { className } from 'lib/css'
|
|
3
|
+
import { useEffect } from 'preact/hooks'
|
|
4
4
|
import CollapseButton from 'ui/components/view/window-view/collapse-button'
|
|
5
5
|
import {
|
|
6
6
|
useGeneratedId,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useSelector } from 'react-redux'
|
|
2
1
|
import { useConfig } from 'domains/config/hooks'
|
|
3
2
|
import { selectHasError } from 'domains/interrupt/selectors'
|
|
4
3
|
import { useVisibility } from 'domains/visibility/hooks'
|
|
4
|
+
import { useSelector } from 'react-redux'
|
|
5
5
|
import { CollapsedChatMessages } from './collapsed-chat-messages'
|
|
6
6
|
|
|
7
7
|
export default function PreChatMessages() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useEffect, useMemo, useRef, useState } from 'preact/hooks'
|
|
2
1
|
import { useI18n } from 'domains/i18n/hooks'
|
|
3
2
|
import { className } from 'lib/css'
|
|
3
|
+
import { useEffect, useMemo, useRef, useState } from 'preact/hooks'
|
|
4
4
|
import Icon from 'ui/components/layout/icon'
|
|
5
5
|
import InOutTransition, {
|
|
6
6
|
transitionStartStates,
|
|
@@ -167,9 +167,7 @@ const OptionsButton = () => {
|
|
|
167
167
|
<div
|
|
168
168
|
className={className('options__container')}
|
|
169
169
|
onKeyDown={onMainKeyDownHandler}
|
|
170
|
-
// eslint-disable-next-line react/no-unknown-property
|
|
171
170
|
onFocusOut={onFocusOutHandler}
|
|
172
|
-
// eslint-disable-next-line react/no-unknown-property
|
|
173
171
|
onFocusIn={onFocusInHandler}
|
|
174
172
|
>
|
|
175
173
|
<InOutTransition
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useCallback, useMemo, useState } from 'preact/hooks'
|
|
2
1
|
import FormProvider from 'domains/forms/provider'
|
|
3
2
|
import { useI18n } from 'domains/i18n/hooks'
|
|
3
|
+
import { useCallback, useMemo, useState } from 'preact/hooks'
|
|
4
4
|
import OptionsFrame from 'ui/components/options/options-frame'
|
|
5
5
|
import {
|
|
6
6
|
useGeneratedId,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { useCallback, useEffect, useMemo, useRef } from 'preact/hooks'
|
|
2
|
-
import { useSelector } from 'react-redux'
|
|
3
1
|
import { useUserHasResponded } from 'domains/app/hooks'
|
|
4
2
|
import { useConfig } from 'domains/config/hooks'
|
|
5
3
|
import { useI18n } from 'domains/i18n/hooks'
|
|
@@ -10,6 +8,8 @@ import { visibilityStates } from 'domains/visibility/constants'
|
|
|
10
8
|
import { useVisibility } from 'domains/visibility/hooks'
|
|
11
9
|
import { className } from 'lib/css'
|
|
12
10
|
import { randomId } from 'lib/id'
|
|
11
|
+
import { useCallback, useEffect, useMemo, useRef } from 'preact/hooks'
|
|
12
|
+
import { useSelector } from 'react-redux'
|
|
13
13
|
import SuggestionsList from 'ui/components/suggestions/suggestions-list'
|
|
14
14
|
import InOutTransition, {
|
|
15
15
|
transitionStartStates,
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { RefCallback } from 'preact'
|
|
2
|
-
import { useCallback, useEffect, useMemo, useRef } from 'preact/hooks'
|
|
3
|
-
import { useSelector } from 'react-redux'
|
|
4
1
|
import { useUserHasResponded } from 'domains/app/hooks'
|
|
5
2
|
import { useConfig } from 'domains/config/hooks'
|
|
6
3
|
import { useI18n } from 'domains/i18n/hooks'
|
|
@@ -8,6 +5,9 @@ import { selectLastUnreadEvent } from 'domains/store/selectors'
|
|
|
8
5
|
import { useTranslatedEventData } from 'domains/translations/hooks'
|
|
9
6
|
import { useVisibility } from 'domains/visibility/hooks'
|
|
10
7
|
import { className } from 'lib/css'
|
|
8
|
+
import { RefCallback } from 'preact'
|
|
9
|
+
import { useCallback, useEffect, useMemo, useRef } from 'preact/hooks'
|
|
10
|
+
import { useSelector } from 'react-redux'
|
|
11
11
|
import AppView from 'ui/components/view/app-view'
|
|
12
12
|
import InlineView from 'ui/components/view/inline-view'
|
|
13
13
|
import WindowView from 'ui/components/view/window-view'
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useCallback } from 'preact/hooks'
|
|
2
|
-
import { useSelector } from 'react-redux'
|
|
3
1
|
import { useStartChatIcon } from 'domains/config/hooks'
|
|
4
2
|
import { useI18n } from 'domains/i18n/hooks'
|
|
5
3
|
import { selectHasError } from 'domains/interrupt/selectors'
|
|
6
4
|
import { useVisibility } from 'domains/visibility/hooks'
|
|
7
5
|
import { className } from 'lib/css'
|
|
6
|
+
import { useCallback } from 'preact/hooks'
|
|
7
|
+
import { useSelector } from 'react-redux'
|
|
8
8
|
import Icon from 'ui/components/layout/icon'
|
|
9
9
|
import InOutTransition, {
|
|
10
10
|
transitionStartStates,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { defaultTransitionTimeMs } from 'config'
|
|
2
|
+
import { className } from 'lib/css'
|
|
1
3
|
import { cloneElement, toChildArray } from 'preact'
|
|
2
4
|
import { FC } from 'preact/compat'
|
|
3
5
|
import { useEffect, useMemo, useRef, useState } from 'preact/hooks'
|
|
4
|
-
import { defaultTransitionTimeMs } from 'config'
|
|
5
|
-
import { className } from 'lib/css'
|
|
6
6
|
import useTimeout from 'ui/hooks/use-timeout'
|
|
7
7
|
import { ValueOf, childIsVNode } from 'ui/utils/general-utils'
|
|
8
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useRef } from 'preact/hooks'
|
|
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 { useRef } from 'preact/hooks'
|
|
5
5
|
import Icon from 'ui/components/layout/icon'
|
|
6
6
|
import {
|
|
7
7
|
useSeamlyActivityEventHandler,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useCallback, useContext } from 'preact/hooks'
|
|
2
1
|
import { useAppDispatch } from 'domains/store'
|
|
3
2
|
import { clearAllUploads } from 'domains/store/slice'
|
|
3
|
+
import { useCallback, useContext } from 'preact/hooks'
|
|
4
4
|
import SeamlyFileUploadContext from 'ui/components/core/seamly-file-upload-context'
|
|
5
5
|
import { useSeamlyStateContext } from './seamly-state-hooks'
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useCallback, useRef } from 'preact/hooks'
|
|
2
1
|
import { useAppDispatch } from 'domains/store'
|
|
3
2
|
import { setSeamlyContainerElement } from 'domains/store/slice'
|
|
3
|
+
import { useCallback, useRef } from 'preact/hooks'
|
|
4
4
|
import {
|
|
5
5
|
focusElement,
|
|
6
6
|
runIfElementContainsOrHasFocus,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useCallback, useEffect, useRef } from 'preact/hooks'
|
|
2
1
|
import { typingTimeout } from 'config'
|
|
3
2
|
import { useAppDispatch } from 'domains/store'
|
|
4
3
|
import {
|
|
@@ -6,6 +5,7 @@ import {
|
|
|
6
5
|
setBlockAutoEntrySwitch,
|
|
7
6
|
setUserEntryType,
|
|
8
7
|
} from 'domains/store/slice'
|
|
8
|
+
import { useCallback, useEffect, useRef } from 'preact/hooks'
|
|
9
9
|
import { useSeamlyCommands, useSeamlyOptions } from 'ui/hooks/seamly-hooks'
|
|
10
10
|
import { useSeamlyStateContext } from 'ui/hooks/seamly-state-hooks'
|
|
11
11
|
import { actionTypes } from 'ui/utils/seamly-utils'
|
|
@@ -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 {
|
|
@@ -7,6 +6,7 @@ import {
|
|
|
7
6
|
setUserSelectedOption as dispatchUserSelectedOption,
|
|
8
7
|
setUserSelectedOptions as dispatchUserSelectedOptions,
|
|
9
8
|
} from 'domains/store/slice'
|
|
9
|
+
import { useCallback } from 'preact/hooks'
|
|
10
10
|
import { useElementFocusingById } from 'ui/hooks/focus-helper-hooks'
|
|
11
11
|
import { useSeamlyObjectStore } from 'ui/hooks/seamly-api-hooks'
|
|
12
12
|
import { useSeamlyStateContext } from 'ui/hooks/seamly-state-hooks'
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createSelector } from '@reduxjs/toolkit'
|
|
2
|
-
import { useSelector } from 'react-redux'
|
|
3
2
|
import { selectUserHasResponded } from 'domains/app/selectors'
|
|
4
3
|
import { useConfig } from 'domains/config/hooks'
|
|
5
4
|
import * as ConfigSelectors from 'domains/config/selectors'
|
|
6
|
-
import { microsecondsToMilliseconds } from 'ui/utils/general-utils'
|
|
7
5
|
import type { RootState } from 'domains/store'
|
|
8
6
|
import type { ChannelEvent, ServiceDataEvent } from 'domains/store/store.types'
|
|
7
|
+
import { useSelector } from 'react-redux'
|
|
8
|
+
import { microsecondsToMilliseconds } from 'ui/utils/general-utils'
|
|
9
9
|
|
|
10
10
|
export const selectState = ({ state }: RootState) => state
|
|
11
11
|
export const useSeamlyStateContext = () => useSelector(selectState)
|
|
@@ -131,10 +131,15 @@ export const useSeamlyServiceData = (key: string) => {
|
|
|
131
131
|
|
|
132
132
|
export const useEntryTextLimit = () => {
|
|
133
133
|
const {
|
|
134
|
-
entryMeta: { options, optionsOverride },
|
|
134
|
+
entryMeta: { active: entryType, options, optionsOverride },
|
|
135
135
|
} = useSeamlyStateContext()
|
|
136
136
|
|
|
137
|
-
|
|
137
|
+
let limit: number | null = null
|
|
138
|
+
if (entryType && typeof optionsOverride[entryType]?.limit === 'number') {
|
|
139
|
+
limit = optionsOverride[entryType].limit
|
|
140
|
+
} else if (entryType && typeof options[entryType]?.limit === 'number') {
|
|
141
|
+
limit = options[entryType].limit
|
|
142
|
+
}
|
|
138
143
|
|
|
139
144
|
return {
|
|
140
145
|
hasLimit: limit !== null,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from 'preact/hooks'
|
|
2
2
|
|
|
3
|
-
const useDebounce = <T
|
|
3
|
+
const useDebounce = <T>(value: T, delay = 20): T => {
|
|
4
4
|
const [debouncedValue, setDebouncedValue] = useState<T>(value)
|
|
5
5
|
const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useCallback, useEffect, useMemo, useState } from 'preact/hooks'
|
|
2
|
-
import { useSelector } from 'react-redux'
|
|
3
1
|
import { useConfig } from 'domains/config/hooks'
|
|
4
2
|
import { selectShowNotifications } from 'domains/store/selectors'
|
|
3
|
+
import { useCallback, useEffect, useMemo, useState } from 'preact/hooks'
|
|
4
|
+
import { useSelector } from 'react-redux'
|
|
5
5
|
import { textEntryControlName } from 'ui/components/entry/text-entry'
|
|
6
6
|
import { useSeamlyServiceInfo } from './seamly-state-hooks'
|
|
7
7
|
import beep from './sounds/beep.mp3'
|
|
@@ -45,7 +45,6 @@ const useNotification = () => {
|
|
|
45
45
|
}, [permission, proactiveMessages, requestPermission])
|
|
46
46
|
|
|
47
47
|
const sendNotification = useCallback(
|
|
48
|
-
// eslint-disable-next-line no-undef
|
|
49
48
|
async (title: string, options?: NotificationOptions) => {
|
|
50
49
|
if (!showNotifications || !hasNotificationSupport) return
|
|
51
50
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useCallback, useEffect, useRef } from 'preact/hooks'
|
|
2
|
-
import { useSelector } from 'react-redux'
|
|
3
1
|
import { useI18n } from 'domains/i18n/hooks'
|
|
4
2
|
import { useVisibility } from 'domains/visibility/hooks'
|
|
3
|
+
import { useCallback, useEffect, useRef } from 'preact/hooks'
|
|
4
|
+
import { useSelector } from 'react-redux'
|
|
5
5
|
import useSeamlyCommands from 'ui/hooks/use-seamly-commands'
|
|
6
6
|
import { selectShowInlineView } from '../../domains/visibility/selectors'
|
|
7
7
|
import { useLiveRegion } from './live-region-hooks'
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { useCallback } from 'preact/hooks'
|
|
2
1
|
import { resetApp } from 'domains/app/actions'
|
|
3
2
|
import { useUserHasResponded } from 'domains/app/hooks'
|
|
4
3
|
import { setHasResponded } from 'domains/app/slice'
|
|
5
4
|
import { setInterrupt } from 'domains/interrupt/slice'
|
|
6
5
|
import { useAppDispatch } from 'domains/store'
|
|
7
6
|
import { addEvent, setEvents, setInitialState } from 'domains/store/slice'
|
|
7
|
+
import type { MessageUpload } from 'domains/store/store.types'
|
|
8
8
|
import { visibilityStates } from 'domains/visibility/constants'
|
|
9
9
|
import { useVisibility } from 'domains/visibility/hooks'
|
|
10
10
|
import { randomId } from 'lib/id'
|
|
11
|
+
import { useCallback } from 'preact/hooks'
|
|
11
12
|
import useSeamlyEventBusContext from './event-bus-hooks'
|
|
12
13
|
import {
|
|
13
14
|
useSeamlyApiContext,
|
|
14
15
|
useSeamlyHasConversation,
|
|
15
16
|
} from './seamly-api-hooks'
|
|
16
17
|
import { useSeamlyUnreadCount } from './seamly-state-hooks'
|
|
17
|
-
import type { MessageUpload } from 'domains/store/store.types'
|
|
18
18
|
|
|
19
19
|
const useSeamlyCommands = () => {
|
|
20
20
|
const api = useSeamlyApiContext()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useSyncExternalStore } from 'preact/compat'
|
|
2
1
|
import ConversationConnector from 'api/conversation-connector'
|
|
2
|
+
import { useSyncExternalStore } from 'preact/compat'
|
|
3
3
|
import { useSeamlyApiContext } from './seamly-api-hooks'
|
|
4
4
|
|
|
5
5
|
const useSeamlyConversation = () => {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useCallback } from 'preact/hooks'
|
|
2
1
|
import { screenReaderDebounceDelaySeconds } from 'config'
|
|
3
2
|
import { useI18n } from 'domains/i18n/hooks'
|
|
4
3
|
import { useAppDispatch } from 'domains/store'
|
|
@@ -9,6 +8,7 @@ import {
|
|
|
9
8
|
stopIdleDetachCountdownCounter,
|
|
10
9
|
} from 'domains/store/slice'
|
|
11
10
|
import { useVisibility } from 'domains/visibility/hooks'
|
|
11
|
+
import { useCallback, useRef } from 'preact/hooks'
|
|
12
12
|
import {
|
|
13
13
|
getTimeFromSeconds,
|
|
14
14
|
millisecondsToSeconds,
|
|
@@ -34,6 +34,18 @@ const useSeamlyIdleDetachCountdown = () => {
|
|
|
34
34
|
|
|
35
35
|
const { isOpen } = useVisibility()
|
|
36
36
|
|
|
37
|
+
// We create a ref here, and explicitly overwrite the current values, because the
|
|
38
|
+
// `endCountdown` call initiated by the server has a different lifecycle from the
|
|
39
|
+
// `IdleDetachWarning` component.
|
|
40
|
+
const countdownState = useRef({
|
|
41
|
+
hasCountdown: false,
|
|
42
|
+
wasStopped: false,
|
|
43
|
+
})
|
|
44
|
+
countdownState.current = {
|
|
45
|
+
hasCountdown,
|
|
46
|
+
wasStopped: wasStopped || false,
|
|
47
|
+
}
|
|
48
|
+
|
|
37
49
|
const { emitEvent, sendAction } = useSeamlyCommands()
|
|
38
50
|
const { t } = useI18n()
|
|
39
51
|
const { sendAssertive, sendPolite } = useLiveRegion()
|
|
@@ -81,6 +93,7 @@ const useSeamlyIdleDetachCountdown = () => {
|
|
|
81
93
|
(_continueChat?: boolean | undefined, _isServerAction?: boolean) => void
|
|
82
94
|
>(
|
|
83
95
|
(continueChat = undefined, isServerAction = false) => {
|
|
96
|
+
const { hasCountdown, wasStopped } = countdownState.current
|
|
84
97
|
if (!hasCountdown) {
|
|
85
98
|
return
|
|
86
99
|
}
|
|
@@ -98,15 +111,7 @@ const useSeamlyIdleDetachCountdown = () => {
|
|
|
98
111
|
|
|
99
112
|
dispatch(clearIdleDetachCountdown())
|
|
100
113
|
},
|
|
101
|
-
[
|
|
102
|
-
dispatch,
|
|
103
|
-
emitEvent,
|
|
104
|
-
hasCountdown,
|
|
105
|
-
sendAction,
|
|
106
|
-
sendAssertiveIfOpen,
|
|
107
|
-
t,
|
|
108
|
-
wasStopped,
|
|
109
|
-
],
|
|
114
|
+
[dispatch, emitEvent, sendAction, sendAssertiveIfOpen, t],
|
|
110
115
|
)
|
|
111
116
|
|
|
112
117
|
const decrementCountdown = useCallback(() => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useEffect, useRef } from 'preact/hooks'
|
|
2
1
|
import SeamlyGeneralError from 'api/errors/seamly-general-error'
|
|
3
2
|
import { useInterrupt } from 'domains/interrupt/hooks'
|
|
4
3
|
import { setInterrupt } from 'domains/interrupt/slice'
|
|
5
4
|
import { useAppDispatch } from 'domains/store'
|
|
5
|
+
import { useEffect, useRef } from 'preact/hooks'
|
|
6
6
|
import useSeamlyCommands from './use-seamly-commands'
|
|
7
7
|
|
|
8
8
|
export default function useSessionExpiredCommand() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useSelector } from 'react-redux'
|
|
2
1
|
import { getControlValueByName } from 'domains/forms/selectors'
|
|
3
2
|
import { CurrentUpload } from 'domains/store/store.types'
|
|
3
|
+
import { useSelector } from 'react-redux'
|
|
4
4
|
import { useFileUploads } from './seamly-hooks'
|
|
5
5
|
|
|
6
6
|
const useSingleFileUpload = (formId, name) => {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { useCallback, useReducer, useState } from 'preact/hooks'
|
|
2
1
|
import { randomId } from 'lib/id'
|
|
2
|
+
import { useCallback, useReducer, useState } from 'preact/hooks'
|
|
3
3
|
|
|
4
4
|
export const useForceUpdate = () => {
|
|
5
5
|
// This is an escape hatch mentioned in the React docs:
|
|
6
6
|
// https://reactjs.org/docs/hooks-faq.html#is-there-something-like-forceupdate
|
|
7
|
-
/* eslint-disable-next-line no-unused-vars */
|
|
8
7
|
const [_, forceUpdate] = useReducer((x) => x + 1, 0)
|
|
9
8
|
|
|
10
9
|
return useCallback(() => {
|
|
@@ -16,7 +16,6 @@ export const payloadTypes = {
|
|
|
16
16
|
message: 'message',
|
|
17
17
|
countdown: 'countdown',
|
|
18
18
|
upload: 'upload',
|
|
19
|
-
cta: 'cta',
|
|
20
19
|
splash: 'splash',
|
|
21
20
|
}
|
|
22
21
|
|
|
@@ -43,7 +42,6 @@ export const actionTypes = {
|
|
|
43
42
|
setTopic: 'set_topic',
|
|
44
43
|
setTranslation: 'set_translation',
|
|
45
44
|
setContext: 'set_context',
|
|
46
|
-
clickCta: 'click_cta',
|
|
47
45
|
clickCard: 'click_card',
|
|
48
46
|
}
|
|
49
47
|
|
|
@@ -11,13 +11,12 @@ export const validateFileSize = (fileList, maxSize) => {
|
|
|
11
11
|
|
|
12
12
|
export const fileListObjectIsNotEmpty = (fileListObj) => !!fileListObj?.length
|
|
13
13
|
|
|
14
|
-
/* eslint-disable no-control-regex */
|
|
15
14
|
export const isEmailString = (val) => {
|
|
16
15
|
const regex =
|
|
16
|
+
// eslint-disable-next-line no-control-regex
|
|
17
17
|
/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i
|
|
18
18
|
const trimmedVal = val && val.trim()
|
|
19
19
|
return !!(trimmedVal && trimmedVal.match(regex))
|
|
20
20
|
}
|
|
21
|
-
/* eslint-enable no-control-regex */
|
|
22
21
|
|
|
23
22
|
export const isNotEmptyString = (val) => !!val
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { FC } from 'preact/compat'
|
|
2
|
-
import { useCallback, useEffect, useState } from 'preact/hooks'
|
|
3
1
|
import {
|
|
4
2
|
randomId,
|
|
5
3
|
getSearchParamsByKeys,
|
|
6
4
|
getUrlSearchParams,
|
|
7
5
|
} from '@seamly/web-ui'
|
|
6
|
+
import { FC } from 'preact/compat'
|
|
7
|
+
import { useCallback, useEffect, useState } from 'preact/hooks'
|
|
8
8
|
import { getStateObj } from '../states'
|
|
9
9
|
import StyleGuideLinks from './links'
|
|
10
10
|
import StyleGuideView from './view'
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { configureStore } from '@reduxjs/toolkit'
|
|
2
|
-
import { FC } from 'preact/compat'
|
|
3
|
-
import { useMemo, useRef } from 'preact/hooks'
|
|
4
2
|
import {
|
|
5
3
|
ComponentFilter,
|
|
6
4
|
SeamlyApiContext,
|
|
@@ -28,6 +26,8 @@ import {
|
|
|
28
26
|
visibilityReducer,
|
|
29
27
|
SeamlyActivityEventContext,
|
|
30
28
|
} from '@seamly/web-ui'
|
|
29
|
+
import { FC } from 'preact/compat'
|
|
30
|
+
import { useMemo, useRef } from 'preact/hooks'
|
|
31
31
|
|
|
32
32
|
const bareApi = {
|
|
33
33
|
send: () => {
|
|
@@ -9,7 +9,6 @@ export const payloadTypes = {
|
|
|
9
9
|
message: 'message',
|
|
10
10
|
countdown: 'countdown',
|
|
11
11
|
upload: 'upload',
|
|
12
|
-
cta: 'cta',
|
|
13
12
|
}
|
|
14
13
|
const defaultTranslatedBody = {
|
|
15
14
|
direction: 'to_translation_locale',
|
|
@@ -20,7 +19,6 @@ const defaultTranslatedBody = {
|
|
|
20
19
|
|
|
21
20
|
export function addTranslationData(event) {
|
|
22
21
|
switch (event.payload.type) {
|
|
23
|
-
case payloadTypes.cta:
|
|
24
22
|
case payloadTypes.image:
|
|
25
23
|
case payloadTypes.text:
|
|
26
24
|
case payloadTypes.choicePrompt:
|