@seamly/web-ui 20.1.0-alpha.1 → 20.2.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/lib/deprecated-view.css +1 -1
- package/build/dist/lib/index.debug.js +135 -135
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.js +107 -48
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/standalone.js +107 -48
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/style-guide.js +53 -28
- 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 +2 -2
- package/src/javascripts/api/errors/seamly-base-error.js +1 -0
- package/src/javascripts/api/index.js +26 -20
- package/src/javascripts/api/producer.js +3 -3
- package/src/javascripts/domains/app/actions.js +17 -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 +1 -1
- package/src/javascripts/domains/config/reducer.js +3 -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 -10
- package/src/javascripts/domains/store/state-reducer.js +3 -3
- package/src/javascripts/domains/translations/components/chat-status.js +5 -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 +7 -7
- package/src/javascripts/domains/translations/hooks.js +3 -3
- package/src/javascripts/domains/translations/middleware.js +2 -2
- package/src/javascripts/domains/translations/reducer.js +3 -3
- 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 +7 -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 +28 -2
- package/src/javascripts/lib/redux-helpers/index.js +1 -1
- package/src/javascripts/style-guide/components/app.js +1 -1
- package/src/javascripts/style-guide/components/links.js +1 -1
- package/src/javascripts/style-guide/components/static-core.js +8 -8
- 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 +4 -4
- 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 +4 -4
- 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 +5 -5
- 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 +3 -3
- 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 +4 -4
- 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 -6
- 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 +6 -6
- package/src/javascripts/ui/components/layout/chat-frame.js +5 -5
- 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 +7 -12
- 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/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 +5 -5
- 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 -2
- package/src/javascripts/ui/hooks/focus-helper-hooks.js +2 -2
- 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 +9 -9
- package/src/javascripts/ui/hooks/use-seamly-dispatch.js +1 -1
- package/src/javascripts/ui/hooks/use-seamly-idle-detach-countdown.js +5 -5
- 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/stylesheets/4-base/_formelements.scss +3 -3
- package/src/stylesheets/5-components/_buttons.scss +1 -1
- package/src/stylesheets/5-components/_chat-status.scss +4 -0
- package/src/stylesheets/5-components/_input.scss +2 -2
- package/src/stylesheets/5-components/_message-translation-info.scss +4 -0
- package/src/stylesheets/6-default-implementation/_hover.scss +5 -5
- 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 -0
- package/src/stylesheets/7-deprecated/5-components/_options.scss +2 -2
- package/webpack/config.common.js +5 -0
- package/webpack/config.package.js +10 -0
- package/src/.DS_Store +0 -0
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import thunkMiddleware from 'redux-thunk'
|
|
2
|
-
import { createReduxStore } from '
|
|
3
|
-
import { Reducer as appReducer } from '
|
|
4
|
-
import { Reducer as
|
|
5
|
-
import { Reducer as
|
|
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'
|
|
6
6
|
import {
|
|
7
7
|
Reducer as translationsReducer,
|
|
8
8
|
createMiddleware as createI18nMiddleware,
|
|
9
|
-
} from '
|
|
10
|
-
import { Reducer as i18nReducer } from '
|
|
11
|
-
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'
|
|
12
12
|
import {
|
|
13
13
|
Reducer as interruptReducer,
|
|
14
14
|
createMiddleware as createInterruptMiddleware,
|
|
15
|
-
} from '
|
|
16
|
-
import { createMiddleware as createOptionsMiddleware } from '
|
|
17
|
-
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'
|
|
18
18
|
import stateReducer from './state-reducer'
|
|
19
19
|
|
|
20
20
|
export function createStore({ initialState, api, eventBus, config } = {}) {
|
|
@@ -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,9 @@
|
|
|
1
1
|
import { useCallback, useMemo } from 'preact/hooks'
|
|
2
|
-
import ChatStatus from '
|
|
3
|
-
import { useI18n } from '
|
|
4
|
-
import { useSkiplinkTargetFocusing } from '
|
|
5
|
-
import { useTranslationsContainer, useTranslations } from '
|
|
6
|
-
import { useInterrupt } from '
|
|
2
|
+
import ChatStatus from 'ui/components/chat-status'
|
|
3
|
+
import { useI18n } from 'domains/i18n'
|
|
4
|
+
import { useSkiplinkTargetFocusing } from 'ui/hooks/seamly-hooks'
|
|
5
|
+
import { useTranslationsContainer, useTranslations } from 'domains/translations/hooks'
|
|
6
|
+
import { useInterrupt } from 'domains/interrupt'
|
|
7
7
|
|
|
8
8
|
export default function TranslationsChatStatus() {
|
|
9
9
|
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,12 @@
|
|
|
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
4
|
import TranslationsOptionsDialogForm from './form'
|
|
5
|
-
import { useGeneratedId } from '
|
|
6
|
-
import { getValidator } from '
|
|
7
|
-
import { isNotEmptyString } from '
|
|
8
|
-
import { useTranslations, useTranslationsContainer } from '
|
|
9
|
-
import { useI18n } from '
|
|
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 'domains/translations/hooks'
|
|
9
|
+
import { useI18n } from 'domains/i18n'
|
|
10
10
|
|
|
11
11
|
export const formName = 'translation-settings'
|
|
12
12
|
export const inputName = 'locale'
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
useElementFocusingById,
|
|
3
3
|
useSeamlyCommands,
|
|
4
4
|
useStableCallback,
|
|
5
|
-
} from '
|
|
6
|
-
import { actionTypes } from '
|
|
7
|
-
import { useSelector, useSelectorWithProps, useStoreDispatch } from '
|
|
5
|
+
} from 'ui/hooks/seamly-hooks'
|
|
6
|
+
import { actionTypes } from 'ui/utils/seamly-utils'
|
|
7
|
+
import { useSelector, useSelectorWithProps, useStoreDispatch } from 'domains/redux'
|
|
8
8
|
import * as Selectors from './selectors'
|
|
9
9
|
import * as Actions from './actions'
|
|
10
10
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Actions from './actions'
|
|
2
|
-
import { seamlyActions } from '
|
|
3
|
-
import { Actions as I18nActions, Selectors as I18nSelectors } from '
|
|
2
|
+
import { seamlyActions } from 'ui/utils/seamly-utils'
|
|
3
|
+
import { Actions as I18nActions, Selectors as I18nSelectors } from 'domains/i18n'
|
|
4
4
|
|
|
5
5
|
export default function createMiddleware() {
|
|
6
6
|
return ({ dispatch, getState }) =>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createReducer } from './utils'
|
|
2
|
-
import { seamlyActions } from '
|
|
3
|
-
import { randomId } from '
|
|
2
|
+
import { seamlyActions } from 'ui/utils/seamly-utils'
|
|
3
|
+
import { randomId } from 'lib/id'
|
|
4
4
|
import * as Actions from './actions'
|
|
5
|
-
import * as AppActions from '
|
|
5
|
+
import * as AppActions from 'domains/app/actions'
|
|
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
4
|
import { visibilityStates, StoreKey } from './constants'
|
|
5
5
|
import { createAction, createThunk, calculateVisibility } from './utils'
|
|
6
6
|
import * as Selectors from './selectors'
|
|
7
|
-
import { selectState } from '
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import { createDomain } from '
|
|
1
|
+
import { createDomain } from 'lib/redux-helpers'
|
|
2
2
|
import { visibilityStates } from './constants'
|
|
3
3
|
|
|
4
4
|
export const {
|
|
@@ -30,6 +30,12 @@ export const calculateVisibility = ({
|
|
|
30
30
|
: visibilityStates.hidden
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
// Allow users to continue a conversation (if they have responded and no visibility is requested)
|
|
34
|
+
// when switching from the window layout to the inline layout
|
|
35
|
+
if (layoutMode === 'inline' && hasResponded && !requestedVisibility) {
|
|
36
|
+
return previousVisibility || visibilityStates.open
|
|
37
|
+
}
|
|
38
|
+
|
|
33
39
|
const baseVisibility = visibilityStates.minimized
|
|
34
40
|
|
|
35
41
|
return (
|
|
@@ -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,4 +1,4 @@
|
|
|
1
|
-
import Engine from '
|
|
1
|
+
import Engine from 'lib/engine'
|
|
2
2
|
|
|
3
3
|
const isActionObject = (actionObj) =>
|
|
4
4
|
typeof actionObj === 'object' && 'action' in actionObj
|
|
@@ -12,6 +12,7 @@ class ExternalApi {
|
|
|
12
12
|
this._waitingActions = []
|
|
13
13
|
this._instances = {}
|
|
14
14
|
this.appConfig = appConfig
|
|
15
|
+
this.context = {}
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
push(...actionObjects) {
|
|
@@ -38,7 +39,11 @@ class ExternalApi {
|
|
|
38
39
|
this.handleDestroy(actionObj)
|
|
39
40
|
break
|
|
40
41
|
default:
|
|
41
|
-
if (
|
|
42
|
+
if (
|
|
43
|
+
!this.handleAction(actionObj) &&
|
|
44
|
+
// Store context properties for the next instance that will be created
|
|
45
|
+
!this.setContext(actionObj.action, ...actionObj.args)
|
|
46
|
+
) {
|
|
42
47
|
this._waitingActions.push(actionObj)
|
|
43
48
|
}
|
|
44
49
|
break
|
|
@@ -46,6 +51,19 @@ class ExternalApi {
|
|
|
46
51
|
})
|
|
47
52
|
}
|
|
48
53
|
|
|
54
|
+
setContext(action, args) {
|
|
55
|
+
switch (action) {
|
|
56
|
+
case 'setTranslation':
|
|
57
|
+
const { enabled, locale } = args
|
|
58
|
+
if (!!enabled && locale) {
|
|
59
|
+
this.context.translationLocale = locale
|
|
60
|
+
}
|
|
61
|
+
return true
|
|
62
|
+
default:
|
|
63
|
+
return false
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
49
67
|
handleInit(actionObj) {
|
|
50
68
|
const userConfig = this.getUserConfig(...actionObj.args)
|
|
51
69
|
const config = this.getCombinedConfig(userConfig)
|
|
@@ -67,6 +85,8 @@ class ExternalApi {
|
|
|
67
85
|
if (config) {
|
|
68
86
|
const instance = this.createInstance(config)
|
|
69
87
|
this._instances[config.namespace] = instance
|
|
88
|
+
// Clear the context after creating the instance, so we do not reuse it for the next
|
|
89
|
+
this.context = {}
|
|
70
90
|
instance.render()
|
|
71
91
|
}
|
|
72
92
|
}
|
|
@@ -128,10 +148,15 @@ class ExternalApi {
|
|
|
128
148
|
if (typeof this.appConfig === 'function') {
|
|
129
149
|
return this.appConfig(userConfig)
|
|
130
150
|
}
|
|
151
|
+
const context = {
|
|
152
|
+
...(userConfig.context || this.appConfig.context),
|
|
153
|
+
...this.context,
|
|
154
|
+
}
|
|
131
155
|
const defaults = {
|
|
132
156
|
...this.appConfig.defaults,
|
|
133
157
|
...userConfig.defaults,
|
|
134
158
|
}
|
|
159
|
+
|
|
135
160
|
return {
|
|
136
161
|
...this.appConfig,
|
|
137
162
|
...userConfig,
|
|
@@ -139,6 +164,7 @@ class ExternalApi {
|
|
|
139
164
|
...this.appConfig.api,
|
|
140
165
|
...userConfig.api,
|
|
141
166
|
},
|
|
167
|
+
context: Object.keys(context).length ? context : undefined,
|
|
142
168
|
defaults: Object.keys(defaults).length ? defaults : undefined,
|
|
143
169
|
}
|
|
144
170
|
}
|
|
@@ -2,7 +2,7 @@ import { useCallback, useEffect, useState } from 'preact/hooks'
|
|
|
2
2
|
import { getUrlParams, getUrlSearchString, randomId } from '@seamly/web-ui'
|
|
3
3
|
import StyleGuideView from './view'
|
|
4
4
|
import StyleGuideLinks from './links'
|
|
5
|
-
import { getStateObj, getDeprecatedStateObj } from '
|
|
5
|
+
import { getStateObj, getDeprecatedStateObj } from 'style-guide/states'
|
|
6
6
|
|
|
7
7
|
const StyleGuideApp = ({
|
|
8
8
|
config,
|
|
@@ -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()}`
|
|
@@ -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 '
|
|
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
15
|
import {
|
|
16
16
|
Reducer as i18nReducer,
|
|
17
17
|
Actions as I18nActions,
|
|
18
|
-
} from '
|
|
19
|
-
import { Reducer as interruptReducer } from '
|
|
20
|
-
import { Reducer as appReducer } from '
|
|
18
|
+
} from 'domains/i18n'
|
|
19
|
+
import { Reducer as interruptReducer } from 'domains/interrupt'
|
|
20
|
+
import { Reducer as appReducer } from 'domains/app'
|
|
21
21
|
import {
|
|
22
22
|
Reducer as configReducer,
|
|
23
23
|
Actions as ConfigActions,
|
|
24
|
-
} from '
|
|
25
|
-
import { Reducer as visibilityReducer } from '
|
|
24
|
+
} from 'domains/config'
|
|
25
|
+
import { Reducer as visibilityReducer } from 'domains/visibility'
|
|
26
26
|
import { seamlyActions } from '../../ui/utils/seamly-utils'
|
|
27
27
|
|
|
28
28
|
const { SET_PARTICIPANT } = seamlyActions
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useSeamlyOptions } from '
|
|
2
|
-
import { className } from '
|
|
3
|
-
import OptionsButton from '
|
|
1
|
+
import { useSeamlyOptions } from 'ui/hooks/seamly-hooks'
|
|
2
|
+
import { className } from 'lib/css'
|
|
3
|
+
import OptionsButton from 'ui/components/options/options-button'
|
|
4
4
|
import {
|
|
5
5
|
useTranslations,
|
|
6
6
|
OptionsButton as TranslationsOptionsButton,
|
|
7
|
-
} from '
|
|
7
|
+
} from 'domains/translations'
|
|
8
8
|
|
|
9
9
|
export default function AppOptions() {
|
|
10
10
|
const { menuOptions, allowOptionSelection } = useSeamlyOptions()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMemo } from 'preact/hooks'
|
|
2
|
-
import { useConfig } from '
|
|
2
|
+
import { useConfig } from 'domains/config'
|
|
3
3
|
import ComponentContext from './component-context'
|
|
4
4
|
import ChoicePrompt from './event/choice-prompt'
|
|
5
5
|
import Text from './event/text'
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { useRef, useEffect } from 'preact/hooks'
|
|
2
|
-
import { className } from '
|
|
3
|
-
import { useI18n } from '
|
|
2
|
+
import { className } from 'lib/css'
|
|
3
|
+
import { useI18n } from 'domains/i18n'
|
|
4
4
|
import {
|
|
5
5
|
useSeamlyIsLoading,
|
|
6
6
|
useSkiplink,
|
|
7
7
|
useSkiplinkTargetFocusing,
|
|
8
|
-
} from '
|
|
9
|
-
import { useEvents } from '
|
|
8
|
+
} from 'ui/hooks/seamly-hooks'
|
|
9
|
+
import { useEvents } from 'ui/hooks/seamly-state-hooks'
|
|
10
10
|
import Event from './event/event'
|
|
11
11
|
import Loader from './loader'
|
|
12
12
|
import ComponentFilter from './component-filter'
|
|
13
|
-
import PrivacyDisclaimer from '
|
|
14
|
-
import { useVisibility } from '
|
|
13
|
+
import PrivacyDisclaimer from 'ui/components/layout/privacy-disclaimer'
|
|
14
|
+
import { useVisibility } from 'domains/visibility'
|
|
15
15
|
|
|
16
16
|
const Conversation = () => {
|
|
17
17
|
const { t } = useI18n()
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef } from 'preact/hooks'
|
|
2
|
-
import { className } from '
|
|
3
|
-
import parseBody from '
|
|
4
|
-
import { useGeneratedId, useSeamlyCommands } from '
|
|
5
|
-
import { cardTypes, actionTypes } from '
|
|
2
|
+
import { className } from 'lib/css'
|
|
3
|
+
import parseBody from 'lib/parse-body'
|
|
4
|
+
import { useGeneratedId, useSeamlyCommands } from 'ui/hooks/seamly-hooks'
|
|
5
|
+
import { cardTypes, actionTypes } from 'ui/utils/seamly-utils'
|
|
6
6
|
|
|
7
7
|
const CardComponent = ({
|
|
8
8
|
id,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useGeneratedId } from '
|
|
2
|
-
import MessageContainer from '
|
|
3
|
-
import { useTranslatedEventData } from '
|
|
1
|
+
import { useGeneratedId } from 'ui/hooks/seamly-hooks'
|
|
2
|
+
import MessageContainer from 'ui/components/conversation/message-container'
|
|
3
|
+
import { useTranslatedEventData } from 'domains/translations'
|
|
4
4
|
import CardComponent from './card-component'
|
|
5
5
|
|
|
6
6
|
const CardMessage = ({ event }) => {
|
package/src/javascripts/ui/components/conversation/event/carousel-component/components/controls.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { className } from '
|
|
2
|
-
import { useI18n } from '
|
|
3
|
-
import Icon from '
|
|
1
|
+
import { className } from 'lib/css'
|
|
2
|
+
import { useI18n } from 'domains/i18n'
|
|
3
|
+
import Icon from 'ui/components/layout/icon'
|
|
4
4
|
|
|
5
5
|
export default function CarouselControls({
|
|
6
6
|
items,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRef } from 'preact'
|
|
2
2
|
import { useState, useEffect, useRef, useMemo } from 'preact/hooks'
|
|
3
|
-
import { className } from '
|
|
4
|
-
import { useGeneratedId } from '
|
|
3
|
+
import { className } from 'lib/css'
|
|
4
|
+
import { useGeneratedId } from 'ui/hooks/utility-hooks'
|
|
5
5
|
import CarouselPagination from './components/pagination'
|
|
6
6
|
import CarouselControls from './components/controls'
|
|
7
|
-
import CarouselMessageSlide from '
|
|
7
|
+
import CarouselMessageSlide from 'ui/components/conversation/event/carousel-message/components/slide'
|
|
8
8
|
|
|
9
9
|
const defaultGetItemKey = (item, idx, prefix) => `${prefix}${idx}`
|
|
10
10
|
const defaultGetItemLabel = (item) => item.label
|
package/src/javascripts/ui/components/conversation/event/carousel-message/components/slide.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { className } from '
|
|
2
|
-
import { useI18n } from '
|
|
3
|
-
import CardComponent from '
|
|
1
|
+
import { className } from 'lib/css'
|
|
2
|
+
import { useI18n } from 'domains/i18n'
|
|
3
|
+
import CardComponent from 'ui/components/conversation/event/card-component'
|
|
4
4
|
|
|
5
5
|
export default function CarouselMessageSlide({
|
|
6
6
|
item: slide,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import MessageContainer from '
|
|
2
|
-
import CarouselComponent from '
|
|
3
|
-
import { useTranslatedEventData } from '
|
|
1
|
+
import MessageContainer from 'ui/components/conversation/message-container'
|
|
2
|
+
import CarouselComponent from 'ui/components/conversation/event/carousel-component'
|
|
3
|
+
import { useTranslatedEventData } from 'domains/translations'
|
|
4
4
|
import CarouselMessageSlide from './components/slide'
|
|
5
5
|
|
|
6
6
|
const getItemKey = (item, idx, prefix = '') => `${prefix}${item.title}:${idx}`
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
useSeamlyServiceInfo,
|
|
6
6
|
useLastMessageEventId,
|
|
7
7
|
useGeneratedId,
|
|
8
|
-
} from '
|
|
9
|
-
import { className } from '
|
|
10
|
-
import { actionTypes } from '
|
|
11
|
-
import Icon from '
|
|
12
|
-
import { useI18n } from '
|
|
13
|
-
import { useTranslatedEventData } from '
|
|
14
|
-
import MessageContainer from '
|
|
8
|
+
} from 'ui/hooks/seamly-hooks'
|
|
9
|
+
import { className } from 'lib/css'
|
|
10
|
+
import { actionTypes } from 'ui/utils/seamly-utils'
|
|
11
|
+
import Icon from 'ui/components/layout/icon'
|
|
12
|
+
import { useI18n } from 'domains/i18n'
|
|
13
|
+
import { useTranslatedEventData } from 'domains/translations'
|
|
14
|
+
import MessageContainer from 'ui/components/conversation/message-container'
|
|
15
15
|
|
|
16
16
|
export const useChoicePrompt = (event) => {
|
|
17
17
|
const { payload } = event
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useCallback } from 'preact/hooks'
|
|
2
|
-
import { className } from '
|
|
3
|
-
import parseBody from '
|
|
4
|
-
import { useGeneratedId, useSeamlyCommands } from '
|
|
2
|
+
import { className } from 'lib/css'
|
|
3
|
+
import parseBody from 'lib/parse-body'
|
|
4
|
+
import { useGeneratedId, useSeamlyCommands } from 'ui/hooks/seamly-hooks'
|
|
5
5
|
import useEventLinkClickHandler from './hooks/use-event-link-click-handler'
|
|
6
|
-
import { actionTypes } from '
|
|
7
|
-
import MessageContainer from '
|
|
8
|
-
import { useTranslatedEventData } from '
|
|
6
|
+
import { actionTypes } from 'ui/utils/seamly-utils'
|
|
7
|
+
import MessageContainer from 'ui/components/conversation/message-container'
|
|
8
|
+
import { useTranslatedEventData } from 'domains/translations'
|
|
9
9
|
|
|
10
10
|
const Cta = ({ event }) => {
|
|
11
11
|
const [body] = useTranslatedEventData(event)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { dividerKeys } from '
|
|
2
|
-
import { useI18n } from '
|
|
3
|
-
import EventDivider from '
|
|
1
|
+
import { dividerKeys } from 'ui/utils/seamly-utils'
|
|
2
|
+
import { useI18n } from 'domains/i18n'
|
|
3
|
+
import EventDivider from 'ui/components/conversation/event-divider'
|
|
4
4
|
|
|
5
5
|
const dividerTypes = {
|
|
6
6
|
[dividerKeys.new_topic]: 'newtopic',
|
package/src/javascripts/ui/components/conversation/event/divider/variants/new-translation.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useMemo } from 'preact/hooks'
|
|
2
|
-
import { useI18n } from '
|
|
3
|
-
import EventDivider from '
|
|
4
|
-
import { className } from '
|
|
5
|
-
import { useTranslations } from '
|
|
2
|
+
import { useI18n } from 'domains/i18n'
|
|
3
|
+
import EventDivider from 'ui/components/conversation/event-divider'
|
|
4
|
+
import { className } from 'lib/css'
|
|
5
|
+
import { useTranslations } from 'domains/translations'
|
|
6
6
|
|
|
7
7
|
const NewTranslationDivider = ({ event }) => {
|
|
8
8
|
const { t } = useI18n()
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useEffect } from 'preact/hooks'
|
|
2
|
-
import EventDivider from '
|
|
3
|
-
import { className } from '
|
|
4
|
-
import { microsecondsToMilliseconds } from '
|
|
5
|
-
import { useFormattedDate } from '
|
|
6
|
-
import { useForceUpdate } from '
|
|
2
|
+
import EventDivider from 'ui/components/conversation/event-divider'
|
|
3
|
+
import { className } from 'lib/css'
|
|
4
|
+
import { microsecondsToMilliseconds } from 'ui/utils/general-utils'
|
|
5
|
+
import { useFormattedDate } from 'ui/components/conversation/event/hooks/use-formatted-date'
|
|
6
|
+
import { useForceUpdate } from 'ui/hooks/utility-hooks'
|
|
7
7
|
|
|
8
8
|
const TimeIndicator = ({ event }) => {
|
|
9
9
|
const forceUpdate = useForceUpdate()
|