@seamly/web-ui 20.0.0-beta.6 → 20.1.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/deprecated-view.css +1 -1
- package/build/dist/lib/index.debug.js +138 -149
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.debug.min.js.LICENSE.txt +0 -4
- package/build/dist/lib/index.js +669 -655
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/standalone.js +702 -688
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/style-guide.js +7288 -7266
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/styles-default-implementation.css +1 -1
- package/build/dist/lib/styles.css +1 -1
- package/package.json +1 -2
- package/src/javascripts/api/errors/seamly-base-error.js +1 -0
- package/src/javascripts/api/index.js +24 -19
- package/src/javascripts/api/producer.js +3 -3
- package/src/javascripts/domains/app/actions.js +30 -8
- package/src/javascripts/domains/app/hooks.js +1 -1
- package/src/javascripts/domains/app/utils.js +1 -1
- package/src/javascripts/domains/config/hooks.js +18 -1
- package/src/javascripts/domains/config/index.js +0 -1
- package/src/javascripts/domains/config/reducer.js +7 -3
- package/src/javascripts/domains/config/selectors.js +1 -1
- package/src/javascripts/domains/config/utils.js +1 -1
- package/src/javascripts/domains/errors/index.js +2 -2
- package/src/javascripts/domains/forms/hooks.js +1 -1
- package/src/javascripts/domains/forms/provider.js +5 -3
- package/src/javascripts/domains/forms/reducer.js +1 -1
- package/src/javascripts/domains/forms/selectors.js +1 -1
- package/src/javascripts/domains/forms/utils.js +1 -1
- package/src/javascripts/domains/i18n/actions.js +1 -1
- package/src/javascripts/domains/i18n/hooks.js +1 -1
- package/src/javascripts/domains/i18n/reducer.js +1 -1
- package/src/javascripts/domains/i18n/utils.js +1 -1
- package/src/javascripts/domains/interrupt/hooks.js +2 -2
- package/src/javascripts/domains/interrupt/middleware.js +6 -6
- package/src/javascripts/domains/interrupt/reducer.js +1 -1
- package/src/javascripts/domains/interrupt/utils.js +1 -1
- package/src/javascripts/domains/options/middleware.js +1 -1
- package/src/javascripts/domains/store/index.js +10 -14
- package/src/javascripts/domains/store/state-reducer.js +3 -3
- package/src/javascripts/domains/translations/components/chat-status.js +8 -5
- package/src/javascripts/domains/translations/components/options-button.js +6 -6
- package/src/javascripts/domains/translations/components/options-dialog/form.js +5 -5
- package/src/javascripts/domains/translations/components/options-dialog/index.js +10 -7
- package/src/javascripts/domains/translations/hooks.js +7 -3
- package/src/javascripts/domains/translations/middleware.js +5 -2
- package/src/javascripts/domains/translations/reducer.js +4 -4
- package/src/javascripts/domains/translations/selectors.js +1 -1
- package/src/javascripts/domains/translations/utils.js +1 -1
- package/src/javascripts/domains/visibility/actions.js +3 -3
- package/src/javascripts/domains/visibility/hooks.js +1 -1
- package/src/javascripts/domains/visibility/utils.js +1 -1
- package/src/javascripts/lib/css.js +1 -1
- package/src/javascripts/lib/engine/index.js +6 -5
- package/src/javascripts/lib/external-api/index.js +1 -1
- package/src/javascripts/lib/redux-helpers/index.js +1 -1
- package/src/javascripts/style-guide/components/app.js +9 -5
- package/src/javascripts/style-guide/components/links.js +6 -6
- package/src/javascripts/style-guide/components/static-core.js +27 -13
- package/src/javascripts/style-guide/components/view.js +16 -3
- package/src/javascripts/style-guide/states.js +23 -41
- package/src/javascripts/style-guide/style-guide-engine.js +13 -1
- package/src/javascripts/style-guide.js +2 -0
- package/src/javascripts/ui/components/app-options/index.js +4 -4
- package/src/javascripts/ui/components/chat-status/index.js +2 -2
- package/src/javascripts/ui/components/conversation/component-filter.js +1 -1
- package/src/javascripts/ui/components/conversation/conversation.js +6 -6
- package/src/javascripts/ui/components/conversation/event/card-component.js +4 -4
- package/src/javascripts/ui/components/conversation/event/card-message.js +3 -3
- package/src/javascripts/ui/components/conversation/event/carousel-component/components/controls.js +3 -3
- package/src/javascripts/ui/components/conversation/event/carousel-component/components/pagination.js +1 -1
- package/src/javascripts/ui/components/conversation/event/carousel-component/index.js +3 -3
- package/src/javascripts/ui/components/conversation/event/carousel-message/components/slide.js +3 -3
- package/src/javascripts/ui/components/conversation/event/carousel-message/index.js +3 -3
- package/src/javascripts/ui/components/conversation/event/choice-prompt.js +7 -7
- package/src/javascripts/ui/components/conversation/event/cta.js +6 -6
- package/src/javascripts/ui/components/conversation/event/divider/index.js +1 -1
- package/src/javascripts/ui/components/conversation/event/divider/variants/default.js +3 -3
- package/src/javascripts/ui/components/conversation/event/divider/variants/new-translation.js +4 -4
- package/src/javascripts/ui/components/conversation/event/divider/variants/time-indicator.js +5 -5
- package/src/javascripts/ui/components/conversation/event/event-participant.js +13 -10
- package/src/javascripts/ui/components/conversation/event/event.js +2 -2
- package/src/javascripts/ui/components/conversation/event/hooks/use-event-link-click-handler.js +2 -2
- package/src/javascripts/ui/components/conversation/event/hooks/use-formatted-date.js +3 -3
- package/src/javascripts/ui/components/conversation/event/image-lightbox.js +4 -4
- package/src/javascripts/ui/components/conversation/event/image.js +2 -2
- package/src/javascripts/ui/components/conversation/event/participant.js +6 -6
- package/src/javascripts/ui/components/conversation/event/text.js +3 -3
- package/src/javascripts/ui/components/conversation/event/translation.js +3 -3
- package/src/javascripts/ui/components/conversation/event/upload.js +18 -15
- package/src/javascripts/ui/components/conversation/event/video.js +4 -4
- package/src/javascripts/ui/components/conversation/event-divider.js +2 -2
- package/src/javascripts/ui/components/conversation/loader.js +2 -2
- package/src/javascripts/ui/components/conversation/message-container.js +4 -4
- package/src/javascripts/ui/components/core/seamly-activity-monitor.js +4 -4
- package/src/javascripts/ui/components/core/seamly-core.js +2 -2
- package/src/javascripts/ui/components/core/seamly-event-subscriber.js +8 -8
- package/src/javascripts/ui/components/core/seamly-file-upload.js +5 -5
- package/src/javascripts/ui/components/core/seamly-idle-detach-counter.js +2 -2
- package/src/javascripts/ui/components/core/seamly-initializer.js +2 -2
- package/src/javascripts/ui/components/core/seamly-instance-functions-loader.js +5 -5
- package/src/javascripts/ui/components/core/seamly-live-region.js +2 -2
- package/src/javascripts/ui/components/core/seamly-new-notifications.js +5 -5
- package/src/javascripts/ui/components/core/seamly-read-state.js +6 -6
- package/src/javascripts/ui/components/entry/deprecated-toggle-button.js +5 -5
- package/src/javascripts/ui/components/entry/entry-container.js +8 -8
- package/src/javascripts/ui/components/entry/text-entry/hooks.js +6 -9
- package/src/javascripts/ui/components/entry/text-entry/index.js +2 -2
- package/src/javascripts/ui/components/entry/text-entry/text-entry-form.js +8 -8
- package/src/javascripts/ui/components/entry/upload/file-upload-form.js +5 -5
- package/src/javascripts/ui/components/entry/upload/index.js +10 -10
- package/src/javascripts/ui/components/entry/upload-toggle.js +9 -9
- package/src/javascripts/ui/components/faq/faq.js +16 -16
- package/src/javascripts/ui/components/form-controls/error.js +2 -2
- package/src/javascripts/ui/components/form-controls/file-input.js +4 -4
- package/src/javascripts/ui/components/form-controls/form.js +2 -2
- package/src/javascripts/ui/components/form-controls/input.js +1 -1
- package/src/javascripts/ui/components/form-controls/select.js +1 -1
- package/src/javascripts/ui/components/form-controls/wrapper.js +1 -1
- package/src/javascripts/ui/components/layout/agent-info.js +13 -17
- package/src/javascripts/ui/components/layout/chat-frame.js +6 -6
- package/src/javascripts/ui/components/layout/deprecated-app-frame.js +7 -7
- package/src/javascripts/ui/components/layout/header.js +3 -3
- package/src/javascripts/ui/components/layout/icon.js +1 -1
- package/src/javascripts/ui/components/layout/interrupt.js +3 -3
- package/src/javascripts/ui/components/layout/privacy-disclaimer.js +3 -3
- package/src/javascripts/ui/components/options/options-button.js +8 -13
- package/src/javascripts/ui/components/options/options-frame.js +4 -4
- package/src/javascripts/ui/components/options/options.js +1 -1
- package/src/javascripts/ui/components/options/transcript/index.js +8 -8
- package/src/javascripts/ui/components/options/transcript/transcript-form.js +4 -4
- package/src/javascripts/ui/components/view/window-view/window-open-button.js +7 -7
- package/src/javascripts/ui/components/warnings/idle-detach-warning.js +6 -6
- package/src/javascripts/ui/components/warnings/prompt.js +2 -2
- package/src/javascripts/ui/components/warnings/resume-conversation-prompt.js +5 -5
- package/src/javascripts/ui/components/widgets/in-out-transition.js +3 -3
- package/src/javascripts/ui/components/widgets/lightbox.js +6 -6
- package/src/javascripts/ui/components/widgets/modal.js +2 -2
- package/src/javascripts/ui/components/widgets/upload-progress.js +4 -4
- package/src/javascripts/ui/hooks/component-helper-hooks.js +1 -1
- package/src/javascripts/ui/hooks/file-upload-hooks.js +2 -3
- package/src/javascripts/ui/hooks/focus-helper-hooks.js +3 -3
- package/src/javascripts/ui/hooks/live-region-hooks.js +2 -2
- package/src/javascripts/ui/hooks/seamly-api-hooks.js +1 -1
- package/src/javascripts/ui/hooks/seamly-entry-hooks.js +2 -2
- package/src/javascripts/ui/hooks/seamly-option-hooks.js +2 -2
- package/src/javascripts/ui/hooks/seamly-state-hooks.js +5 -5
- package/src/javascripts/ui/hooks/use-event-component-mapping.js +2 -2
- package/src/javascripts/ui/hooks/use-seamly-activity-event-handler.js +1 -1
- package/src/javascripts/ui/hooks/use-seamly-chat.js +3 -3
- package/src/javascripts/ui/hooks/use-seamly-commands.js +12 -12
- package/src/javascripts/ui/hooks/use-seamly-dispatch.js +1 -1
- package/src/javascripts/ui/hooks/use-seamly-idle-detach-countdown.js +9 -9
- package/src/javascripts/ui/hooks/use-seamly-resume-conversation-prompt.js +2 -2
- package/src/javascripts/ui/hooks/use-single-file-upload.js +2 -2
- package/src/javascripts/ui/hooks/utility-hooks.js +1 -1
- package/src/javascripts/ui/utils/seamly-utils.js +9 -2
- package/src/stylesheets/4-base/_formelements.scss +3 -3
- package/src/stylesheets/5-components/_buttons.scss +1 -1
- package/src/stylesheets/5-components/_input.scss +2 -2
- package/src/stylesheets/5-components/_message-body.scss +19 -12
- package/src/stylesheets/6-default-implementation/_hover.scss +24 -12
- package/src/stylesheets/7-deprecated/4-base/_formelements.scss +4 -4
- package/src/stylesheets/7-deprecated/5-components/_buttons.scss +1 -1
- package/src/stylesheets/7-deprecated/5-components/_input.scss +1 -1
- package/src/stylesheets/7-deprecated/5-components/_message.scss +4 -3
- package/src/stylesheets/7-deprecated/5-components/_options.scss +2 -2
- package/webpack/config.common.js +5 -0
- package/webpack/config.package.js +3 -0
- package/src/javascripts/domains/config/middleware.js +0 -22
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
import thunkMiddleware from 'redux-thunk'
|
|
2
|
-
import { createReduxStore } from '
|
|
3
|
-
import { Reducer as appReducer } from '
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
Reducer as configReducer,
|
|
7
|
-
} from '../config'
|
|
8
|
-
import { Reducer as formReducer } from '../forms'
|
|
2
|
+
import { createReduxStore } from 'domains/redux'
|
|
3
|
+
import { Reducer as appReducer } from 'domains/app'
|
|
4
|
+
import { Reducer as formReducer } from 'domains/forms'
|
|
5
|
+
import { Reducer as configReducer } from 'domains/config'
|
|
9
6
|
import {
|
|
10
7
|
Reducer as translationsReducer,
|
|
11
8
|
createMiddleware as createI18nMiddleware,
|
|
12
|
-
} from '
|
|
13
|
-
import { Reducer as i18nReducer } from '
|
|
14
|
-
import { Reducer as visibilityReducer } from '
|
|
9
|
+
} from 'domains/translations'
|
|
10
|
+
import { Reducer as i18nReducer } from 'domains/i18n'
|
|
11
|
+
import { Reducer as visibilityReducer } from 'domains/visibility'
|
|
15
12
|
import {
|
|
16
13
|
Reducer as interruptReducer,
|
|
17
14
|
createMiddleware as createInterruptMiddleware,
|
|
18
|
-
} from '
|
|
19
|
-
import { createMiddleware as createOptionsMiddleware } from '
|
|
20
|
-
import { createMiddleware as createErrorsMiddleware } from '
|
|
15
|
+
} from 'domains/interrupt'
|
|
16
|
+
import { createMiddleware as createOptionsMiddleware } from 'domains/options'
|
|
17
|
+
import { createMiddleware as createErrorsMiddleware } from 'domains/errors'
|
|
21
18
|
import stateReducer from './state-reducer'
|
|
22
19
|
|
|
23
20
|
export function createStore({ initialState, api, eventBus, config } = {}) {
|
|
@@ -40,7 +37,6 @@ export function createStore({ initialState, api, eventBus, config } = {}) {
|
|
|
40
37
|
eventBus,
|
|
41
38
|
config,
|
|
42
39
|
}),
|
|
43
|
-
createConfigMiddleware(),
|
|
44
40
|
createInterruptMiddleware({ api }),
|
|
45
41
|
createOptionsMiddleware({ api }),
|
|
46
42
|
createI18nMiddleware(),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Legacy state reducer. Do not add new features here but extract/create new reducers as needed
|
|
2
2
|
|
|
3
|
-
import { randomId } from '
|
|
4
|
-
import { entryTypes, seamlyStateReducer } from '
|
|
5
|
-
import * as AppActions from '
|
|
3
|
+
import { randomId } from 'lib/id'
|
|
4
|
+
import { entryTypes, seamlyStateReducer } from 'ui/utils/seamly-utils'
|
|
5
|
+
import * as AppActions from 'domains/app/actions'
|
|
6
6
|
|
|
7
7
|
const initialState = {
|
|
8
8
|
events: [],
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { useCallback, useMemo } from 'preact/hooks'
|
|
2
|
-
import ChatStatus from '
|
|
3
|
-
import { useI18n } from '
|
|
4
|
-
import { useSkiplinkTargetFocusing } from '
|
|
5
|
-
import {
|
|
6
|
-
|
|
2
|
+
import ChatStatus from 'ui/components/chat-status'
|
|
3
|
+
import { useI18n } from 'domains/i18n'
|
|
4
|
+
import { useSkiplinkTargetFocusing } from 'ui/hooks/seamly-hooks'
|
|
5
|
+
import {
|
|
6
|
+
useTranslationsContainer,
|
|
7
|
+
useTranslations,
|
|
8
|
+
} from 'domains/translations/hooks'
|
|
9
|
+
import { useInterrupt } from 'domains/interrupt'
|
|
7
10
|
|
|
8
11
|
export default function TranslationsChatStatus() {
|
|
9
12
|
const { t } = useI18n()
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useRef, useState } from 'preact/hooks'
|
|
2
|
-
import { className } from '
|
|
3
|
-
import { focusElement, getKey, keyNames } from '
|
|
4
|
-
import Icon from '
|
|
5
|
-
import { useGeneratedId } from '
|
|
6
|
-
import { useI18n } from '
|
|
2
|
+
import { className } from 'lib/css'
|
|
3
|
+
import { focusElement, getKey, keyNames } from 'ui/utils/general-utils'
|
|
4
|
+
import Icon from 'ui/components/layout/icon'
|
|
5
|
+
import { useGeneratedId } from 'ui/hooks/seamly-hooks'
|
|
6
|
+
import { useI18n } from 'domains/i18n'
|
|
7
7
|
import InOutTransition, {
|
|
8
8
|
transitionStartStates,
|
|
9
|
-
} from '
|
|
9
|
+
} from 'ui/components/widgets/in-out-transition'
|
|
10
10
|
import TranslationsOptionsDialog from './options-dialog'
|
|
11
11
|
|
|
12
12
|
export default function TranslationsOptionButton() {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useMemo } from 'preact/hooks'
|
|
2
|
-
import Form from '
|
|
3
|
-
import { className } from '
|
|
4
|
-
import { useI18n } from '
|
|
5
|
-
import { useTranslations } from '
|
|
6
|
-
import Select from '
|
|
2
|
+
import Form from 'ui/components/form-controls/form'
|
|
3
|
+
import { className } from 'lib/css'
|
|
4
|
+
import { useI18n } from 'domains/i18n'
|
|
5
|
+
import { useTranslations } from 'domains/translations/hooks'
|
|
6
|
+
import Select from 'ui/components/form-controls/select'
|
|
7
7
|
|
|
8
8
|
function TranslationsOptionsDialogForm({ controlName, descriptionId }) {
|
|
9
9
|
const { t } = useI18n()
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { useCallback, useMemo, useRef, useState } from 'preact/hooks'
|
|
2
|
-
import OptionsFrame from '
|
|
3
|
-
import { FormProvider } from '
|
|
2
|
+
import OptionsFrame from 'ui/components/options/options-frame'
|
|
3
|
+
import { FormProvider } from 'domains/forms'
|
|
4
|
+
import { useGeneratedId } from 'ui/hooks/seamly-hooks'
|
|
5
|
+
import { getValidator } from 'ui/utils/form-utils'
|
|
6
|
+
import { isNotEmptyString } from 'ui/utils/validations'
|
|
7
|
+
import {
|
|
8
|
+
useTranslations,
|
|
9
|
+
useTranslationsContainer,
|
|
10
|
+
} from 'domains/translations/hooks'
|
|
11
|
+
import { useI18n } from 'domains/i18n'
|
|
4
12
|
import TranslationsOptionsDialogForm from './form'
|
|
5
|
-
import { useGeneratedId } from '../../../../ui/hooks/seamly-hooks'
|
|
6
|
-
import { getValidator } from '../../../../ui/utils/form-utils'
|
|
7
|
-
import { isNotEmptyString } from '../../../../ui/utils/validations'
|
|
8
|
-
import { useTranslations, useTranslationsContainer } from '../../hooks'
|
|
9
|
-
import { useI18n } from '../../../i18n'
|
|
10
13
|
|
|
11
14
|
export const formName = 'translation-settings'
|
|
12
15
|
export const inputName = 'locale'
|
|
@@ -2,9 +2,13 @@ import {
|
|
|
2
2
|
useElementFocusingById,
|
|
3
3
|
useSeamlyCommands,
|
|
4
4
|
useStableCallback,
|
|
5
|
-
} from '
|
|
6
|
-
import { actionTypes } from '
|
|
7
|
-
import {
|
|
5
|
+
} from 'ui/hooks/seamly-hooks'
|
|
6
|
+
import { actionTypes } from 'ui/utils/seamly-utils'
|
|
7
|
+
import {
|
|
8
|
+
useSelector,
|
|
9
|
+
useSelectorWithProps,
|
|
10
|
+
useStoreDispatch,
|
|
11
|
+
} from 'domains/redux'
|
|
8
12
|
import * as Selectors from './selectors'
|
|
9
13
|
import * as Actions from './actions'
|
|
10
14
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { seamlyActions } from 'ui/utils/seamly-utils'
|
|
2
|
+
import {
|
|
3
|
+
Actions as I18nActions,
|
|
4
|
+
Selectors as I18nSelectors,
|
|
5
|
+
} from 'domains/i18n'
|
|
1
6
|
import * as Actions from './actions'
|
|
2
|
-
import { seamlyActions } from '../../ui/utils/seamly-utils'
|
|
3
|
-
import { Actions as I18nActions, Selectors as I18nSelectors } from '../i18n'
|
|
4
7
|
|
|
5
8
|
export default function createMiddleware() {
|
|
6
9
|
return ({ dispatch, getState }) =>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { seamlyActions } from 'ui/utils/seamly-utils'
|
|
2
|
+
import { randomId } from 'lib/id'
|
|
3
|
+
import * as AppActions from 'domains/app/actions'
|
|
4
4
|
import * as Actions from './actions'
|
|
5
|
-
import
|
|
5
|
+
import { createReducer } from './utils'
|
|
6
6
|
|
|
7
7
|
const initialState = {
|
|
8
8
|
isActive: false,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as ConfigSelectors from '
|
|
2
|
-
import * as AppSelectors from '
|
|
1
|
+
import * as ConfigSelectors from 'domains/config/selectors'
|
|
2
|
+
import * as AppSelectors from 'domains/app/selectors'
|
|
3
3
|
|
|
4
|
+
import { selectState } from 'ui/hooks/seamly-state-hooks'
|
|
4
5
|
import { visibilityStates, StoreKey } from './constants'
|
|
5
6
|
import { createAction, createThunk, calculateVisibility } from './utils'
|
|
6
7
|
import * as Selectors from './selectors'
|
|
7
|
-
import { selectState } from '../../ui/hooks/seamly-state-hooks'
|
|
8
8
|
|
|
9
9
|
export const setFromStorage = createAction('setFromStorage', (visibility) => ({
|
|
10
10
|
visibility,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback } from 'preact/hooks'
|
|
2
|
-
import { useSelector, useStoreDispatch } from '
|
|
2
|
+
import { useSelector, useStoreDispatch } from 'domains/redux'
|
|
3
3
|
import * as Actions from './actions'
|
|
4
4
|
import * as Selectors from './selectors'
|
|
5
5
|
import { visibilityStates } from './constants'
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { render, h } from 'preact'
|
|
2
2
|
import Events from 'minivents'
|
|
3
|
-
import ChatApp from '
|
|
4
|
-
import SeamlyCore from '
|
|
5
|
-
import { API } from '
|
|
6
|
-
import { createStore } from '
|
|
7
|
-
import * as AppActions from '
|
|
3
|
+
import ChatApp from 'ui/components/chat-app'
|
|
4
|
+
import SeamlyCore from 'ui/components/core/seamly-core'
|
|
5
|
+
import { API } from 'api'
|
|
6
|
+
import { createStore } from 'domains/store'
|
|
7
|
+
import * as AppActions from 'domains/app/actions'
|
|
8
8
|
|
|
9
9
|
export default class Engine {
|
|
10
10
|
constructor(config, externalApi) {
|
|
@@ -20,6 +20,7 @@ export default class Engine {
|
|
|
20
20
|
this.externalApi = externalApi
|
|
21
21
|
|
|
22
22
|
this.api = new API({
|
|
23
|
+
layoutMode: config.layoutMode,
|
|
23
24
|
namespace: config.namespace,
|
|
24
25
|
config: config.api,
|
|
25
26
|
context: config.context,
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from 'preact/hooks'
|
|
2
2
|
import { getUrlParams, getUrlSearchString, randomId } from '@seamly/web-ui'
|
|
3
|
+
import { getStateObj, getDeprecatedStateObj } from 'style-guide/states'
|
|
3
4
|
import StyleGuideView from './view'
|
|
4
5
|
import StyleGuideLinks from './links'
|
|
5
|
-
import { getStateObj, getDeprecatedStateObj } from '../states'
|
|
6
6
|
|
|
7
7
|
const StyleGuideApp = ({
|
|
8
8
|
config,
|
|
9
9
|
styleGuideConfig,
|
|
10
10
|
translations,
|
|
11
11
|
headingLevel = 2,
|
|
12
|
+
participants,
|
|
12
13
|
}) => {
|
|
13
14
|
const [staticState, setStaticState] = useState(null)
|
|
14
15
|
const [selectedStateDescription, setSelectedStateDescription] = useState('')
|
|
@@ -46,13 +47,15 @@ const StyleGuideApp = ({
|
|
|
46
47
|
|
|
47
48
|
const getState = useCallback(
|
|
48
49
|
(layoutMode, feature) => {
|
|
49
|
-
const { defaults } = config
|
|
50
50
|
const { headingText } = mainState[feature]
|
|
51
51
|
setSelectedStateDescription(headingText)
|
|
52
52
|
const bareState = mainState[feature][layoutMode]
|
|
53
53
|
const { overrideMessages, showFaq } = bareState.config
|
|
54
54
|
|
|
55
|
-
const
|
|
55
|
+
const agent = participants.find(
|
|
56
|
+
(participant) => participant.id === 'agent',
|
|
57
|
+
)
|
|
58
|
+
|
|
56
59
|
const updatedState = {
|
|
57
60
|
...bareState,
|
|
58
61
|
config: {
|
|
@@ -64,12 +67,12 @@ const StyleGuideApp = ({
|
|
|
64
67
|
},
|
|
65
68
|
headerTitles: {
|
|
66
69
|
...bareState.headerTitles,
|
|
67
|
-
subTitle:
|
|
70
|
+
subTitle: agent?.name || bareState.headerTitles.subTitle,
|
|
68
71
|
},
|
|
69
72
|
}
|
|
70
73
|
return updatedState
|
|
71
74
|
},
|
|
72
|
-
[mainState, config],
|
|
75
|
+
[mainState, participants, config],
|
|
73
76
|
)
|
|
74
77
|
|
|
75
78
|
useEffect(() => {
|
|
@@ -145,6 +148,7 @@ const StyleGuideApp = ({
|
|
|
145
148
|
customComponents={styleGuideConfig.customComponents}
|
|
146
149
|
translations={translations}
|
|
147
150
|
state={staticState}
|
|
151
|
+
participants={participants}
|
|
148
152
|
/>
|
|
149
153
|
)}
|
|
150
154
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getUrlSearchString, getUrlParams } from '@seamly/web-ui'
|
|
2
|
-
import { categories } from '
|
|
2
|
+
import { categories } from 'style-guide/states'
|
|
3
3
|
|
|
4
4
|
const StyleGuideLinks = ({ setSelectedState, states, headingLevel }) => {
|
|
5
5
|
const CategoryHeading = `h${headingLevel.toString()}`
|
|
@@ -77,11 +77,11 @@ const StyleGuideLinks = ({ setSelectedState, states, headingLevel }) => {
|
|
|
77
77
|
onClick={(e) => {
|
|
78
78
|
e.preventDefault()
|
|
79
79
|
if (layoutMode === 'inline') {
|
|
80
|
-
|
|
81
|
-
document
|
|
82
|
-
.
|
|
83
|
-
|
|
84
|
-
}
|
|
80
|
+
window.scroll({
|
|
81
|
+
top: document.querySelector('.cvco-app')
|
|
82
|
+
.offsetTop,
|
|
83
|
+
behavior: 'smooth',
|
|
84
|
+
})
|
|
85
85
|
}
|
|
86
86
|
onClickHandler({ layoutMode, feature })
|
|
87
87
|
}}
|
|
@@ -9,20 +9,20 @@ import {
|
|
|
9
9
|
ComponentFilter,
|
|
10
10
|
createReduxStore,
|
|
11
11
|
} from '@seamly/web-ui'
|
|
12
|
-
import stateReducer from '
|
|
13
|
-
import { Reducer as formReducer } from '
|
|
14
|
-
import { Reducer as translationsReducer } from '
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} from '../../domains/i18n'
|
|
19
|
-
import { Reducer as interruptReducer } from '../../domains/interrupt'
|
|
20
|
-
import { Reducer as appReducer } from '../../domains/app'
|
|
12
|
+
import stateReducer from 'domains/store/state-reducer'
|
|
13
|
+
import { Reducer as formReducer } from 'domains/forms'
|
|
14
|
+
import { Reducer as translationsReducer } from 'domains/translations'
|
|
15
|
+
import { Reducer as i18nReducer, Actions as I18nActions } from 'domains/i18n'
|
|
16
|
+
import { Reducer as interruptReducer } from 'domains/interrupt'
|
|
17
|
+
import { Reducer as appReducer } from 'domains/app'
|
|
21
18
|
import {
|
|
22
19
|
Reducer as configReducer,
|
|
23
20
|
Actions as ConfigActions,
|
|
24
|
-
} from '
|
|
25
|
-
import { Reducer as visibilityReducer } from '
|
|
21
|
+
} from 'domains/config'
|
|
22
|
+
import { Reducer as visibilityReducer } from 'domains/visibility'
|
|
23
|
+
import { seamlyActions } from '../../ui/utils/seamly-utils'
|
|
24
|
+
|
|
25
|
+
const { SET_PARTICIPANT } = seamlyActions
|
|
26
26
|
|
|
27
27
|
const bareApi = {
|
|
28
28
|
send: () => {},
|
|
@@ -33,7 +33,12 @@ const bareApi = {
|
|
|
33
33
|
hasConversation: () => false,
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
const SeamlyTestCore = ({
|
|
36
|
+
const SeamlyTestCore = ({
|
|
37
|
+
state,
|
|
38
|
+
translations,
|
|
39
|
+
participants = [],
|
|
40
|
+
children,
|
|
41
|
+
}) => {
|
|
37
42
|
const liveMsgRef = useRef(() => {})
|
|
38
43
|
const eventBusRef = useRef({ emit: () => {} })
|
|
39
44
|
|
|
@@ -76,8 +81,17 @@ const SeamlyTestCore = ({ state, translations, children }) => {
|
|
|
76
81
|
)
|
|
77
82
|
}
|
|
78
83
|
newStore.dispatch(I18nActions.setLocale.fulfilled('en-GB', translations))
|
|
84
|
+
|
|
85
|
+
participants.forEach((participant) => {
|
|
86
|
+
newStore.dispatch({
|
|
87
|
+
type: SET_PARTICIPANT,
|
|
88
|
+
participant,
|
|
89
|
+
fromClient: participant.id === 'user',
|
|
90
|
+
})
|
|
91
|
+
})
|
|
92
|
+
|
|
79
93
|
return newStore
|
|
80
|
-
}, [state, translations])
|
|
94
|
+
}, [state, translations, participants])
|
|
81
95
|
|
|
82
96
|
return (
|
|
83
97
|
state && (
|
|
@@ -2,7 +2,12 @@ import { useState, useEffect } from 'preact/hooks'
|
|
|
2
2
|
import { View } from '@seamly/web-ui'
|
|
3
3
|
import StyleGuideStaticCore from './static-core'
|
|
4
4
|
|
|
5
|
-
const StyleGuideView = ({
|
|
5
|
+
const StyleGuideView = ({
|
|
6
|
+
state,
|
|
7
|
+
customComponents = {},
|
|
8
|
+
translations,
|
|
9
|
+
participants,
|
|
10
|
+
}) => {
|
|
6
11
|
const [renderView, setRenderView] = useState(true)
|
|
7
12
|
const { config } = state || {}
|
|
8
13
|
const { layoutMode } = config || {}
|
|
@@ -25,11 +30,19 @@ const StyleGuideView = ({ state, customComponents = {}, translations }) => {
|
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
return CustomView ? (
|
|
28
|
-
<StyleGuideStaticCore
|
|
33
|
+
<StyleGuideStaticCore
|
|
34
|
+
state={state}
|
|
35
|
+
translations={translations}
|
|
36
|
+
participants={participants}
|
|
37
|
+
>
|
|
29
38
|
<CustomView />
|
|
30
39
|
</StyleGuideStaticCore>
|
|
31
40
|
) : (
|
|
32
|
-
<StyleGuideStaticCore
|
|
41
|
+
<StyleGuideStaticCore
|
|
42
|
+
state={state}
|
|
43
|
+
translations={translations}
|
|
44
|
+
participants={participants}
|
|
45
|
+
>
|
|
33
46
|
<View />
|
|
34
47
|
</StyleGuideStaticCore>
|
|
35
48
|
)
|