@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.
Files changed (171) hide show
  1. package/build/dist/lib/deprecated-view.css +1 -1
  2. package/build/dist/lib/index.debug.js +138 -149
  3. package/build/dist/lib/index.debug.min.js +1 -1
  4. package/build/dist/lib/index.debug.min.js.LICENSE.txt +0 -4
  5. package/build/dist/lib/index.js +669 -655
  6. package/build/dist/lib/index.min.js +1 -1
  7. package/build/dist/lib/standalone.js +702 -688
  8. package/build/dist/lib/standalone.min.js +1 -1
  9. package/build/dist/lib/style-guide.js +7288 -7266
  10. package/build/dist/lib/style-guide.min.js +1 -1
  11. package/build/dist/lib/styles-default-implementation.css +1 -1
  12. package/build/dist/lib/styles.css +1 -1
  13. package/package.json +1 -2
  14. package/src/javascripts/api/errors/seamly-base-error.js +1 -0
  15. package/src/javascripts/api/index.js +24 -19
  16. package/src/javascripts/api/producer.js +3 -3
  17. package/src/javascripts/domains/app/actions.js +30 -8
  18. package/src/javascripts/domains/app/hooks.js +1 -1
  19. package/src/javascripts/domains/app/utils.js +1 -1
  20. package/src/javascripts/domains/config/hooks.js +18 -1
  21. package/src/javascripts/domains/config/index.js +0 -1
  22. package/src/javascripts/domains/config/reducer.js +7 -3
  23. package/src/javascripts/domains/config/selectors.js +1 -1
  24. package/src/javascripts/domains/config/utils.js +1 -1
  25. package/src/javascripts/domains/errors/index.js +2 -2
  26. package/src/javascripts/domains/forms/hooks.js +1 -1
  27. package/src/javascripts/domains/forms/provider.js +5 -3
  28. package/src/javascripts/domains/forms/reducer.js +1 -1
  29. package/src/javascripts/domains/forms/selectors.js +1 -1
  30. package/src/javascripts/domains/forms/utils.js +1 -1
  31. package/src/javascripts/domains/i18n/actions.js +1 -1
  32. package/src/javascripts/domains/i18n/hooks.js +1 -1
  33. package/src/javascripts/domains/i18n/reducer.js +1 -1
  34. package/src/javascripts/domains/i18n/utils.js +1 -1
  35. package/src/javascripts/domains/interrupt/hooks.js +2 -2
  36. package/src/javascripts/domains/interrupt/middleware.js +6 -6
  37. package/src/javascripts/domains/interrupt/reducer.js +1 -1
  38. package/src/javascripts/domains/interrupt/utils.js +1 -1
  39. package/src/javascripts/domains/options/middleware.js +1 -1
  40. package/src/javascripts/domains/store/index.js +10 -14
  41. package/src/javascripts/domains/store/state-reducer.js +3 -3
  42. package/src/javascripts/domains/translations/components/chat-status.js +8 -5
  43. package/src/javascripts/domains/translations/components/options-button.js +6 -6
  44. package/src/javascripts/domains/translations/components/options-dialog/form.js +5 -5
  45. package/src/javascripts/domains/translations/components/options-dialog/index.js +10 -7
  46. package/src/javascripts/domains/translations/hooks.js +7 -3
  47. package/src/javascripts/domains/translations/middleware.js +5 -2
  48. package/src/javascripts/domains/translations/reducer.js +4 -4
  49. package/src/javascripts/domains/translations/selectors.js +1 -1
  50. package/src/javascripts/domains/translations/utils.js +1 -1
  51. package/src/javascripts/domains/visibility/actions.js +3 -3
  52. package/src/javascripts/domains/visibility/hooks.js +1 -1
  53. package/src/javascripts/domains/visibility/utils.js +1 -1
  54. package/src/javascripts/lib/css.js +1 -1
  55. package/src/javascripts/lib/engine/index.js +6 -5
  56. package/src/javascripts/lib/external-api/index.js +1 -1
  57. package/src/javascripts/lib/redux-helpers/index.js +1 -1
  58. package/src/javascripts/style-guide/components/app.js +9 -5
  59. package/src/javascripts/style-guide/components/links.js +6 -6
  60. package/src/javascripts/style-guide/components/static-core.js +27 -13
  61. package/src/javascripts/style-guide/components/view.js +16 -3
  62. package/src/javascripts/style-guide/states.js +23 -41
  63. package/src/javascripts/style-guide/style-guide-engine.js +13 -1
  64. package/src/javascripts/style-guide.js +2 -0
  65. package/src/javascripts/ui/components/app-options/index.js +4 -4
  66. package/src/javascripts/ui/components/chat-status/index.js +2 -2
  67. package/src/javascripts/ui/components/conversation/component-filter.js +1 -1
  68. package/src/javascripts/ui/components/conversation/conversation.js +6 -6
  69. package/src/javascripts/ui/components/conversation/event/card-component.js +4 -4
  70. package/src/javascripts/ui/components/conversation/event/card-message.js +3 -3
  71. package/src/javascripts/ui/components/conversation/event/carousel-component/components/controls.js +3 -3
  72. package/src/javascripts/ui/components/conversation/event/carousel-component/components/pagination.js +1 -1
  73. package/src/javascripts/ui/components/conversation/event/carousel-component/index.js +3 -3
  74. package/src/javascripts/ui/components/conversation/event/carousel-message/components/slide.js +3 -3
  75. package/src/javascripts/ui/components/conversation/event/carousel-message/index.js +3 -3
  76. package/src/javascripts/ui/components/conversation/event/choice-prompt.js +7 -7
  77. package/src/javascripts/ui/components/conversation/event/cta.js +6 -6
  78. package/src/javascripts/ui/components/conversation/event/divider/index.js +1 -1
  79. package/src/javascripts/ui/components/conversation/event/divider/variants/default.js +3 -3
  80. package/src/javascripts/ui/components/conversation/event/divider/variants/new-translation.js +4 -4
  81. package/src/javascripts/ui/components/conversation/event/divider/variants/time-indicator.js +5 -5
  82. package/src/javascripts/ui/components/conversation/event/event-participant.js +13 -10
  83. package/src/javascripts/ui/components/conversation/event/event.js +2 -2
  84. package/src/javascripts/ui/components/conversation/event/hooks/use-event-link-click-handler.js +2 -2
  85. package/src/javascripts/ui/components/conversation/event/hooks/use-formatted-date.js +3 -3
  86. package/src/javascripts/ui/components/conversation/event/image-lightbox.js +4 -4
  87. package/src/javascripts/ui/components/conversation/event/image.js +2 -2
  88. package/src/javascripts/ui/components/conversation/event/participant.js +6 -6
  89. package/src/javascripts/ui/components/conversation/event/text.js +3 -3
  90. package/src/javascripts/ui/components/conversation/event/translation.js +3 -3
  91. package/src/javascripts/ui/components/conversation/event/upload.js +18 -15
  92. package/src/javascripts/ui/components/conversation/event/video.js +4 -4
  93. package/src/javascripts/ui/components/conversation/event-divider.js +2 -2
  94. package/src/javascripts/ui/components/conversation/loader.js +2 -2
  95. package/src/javascripts/ui/components/conversation/message-container.js +4 -4
  96. package/src/javascripts/ui/components/core/seamly-activity-monitor.js +4 -4
  97. package/src/javascripts/ui/components/core/seamly-core.js +2 -2
  98. package/src/javascripts/ui/components/core/seamly-event-subscriber.js +8 -8
  99. package/src/javascripts/ui/components/core/seamly-file-upload.js +5 -5
  100. package/src/javascripts/ui/components/core/seamly-idle-detach-counter.js +2 -2
  101. package/src/javascripts/ui/components/core/seamly-initializer.js +2 -2
  102. package/src/javascripts/ui/components/core/seamly-instance-functions-loader.js +5 -5
  103. package/src/javascripts/ui/components/core/seamly-live-region.js +2 -2
  104. package/src/javascripts/ui/components/core/seamly-new-notifications.js +5 -5
  105. package/src/javascripts/ui/components/core/seamly-read-state.js +6 -6
  106. package/src/javascripts/ui/components/entry/deprecated-toggle-button.js +5 -5
  107. package/src/javascripts/ui/components/entry/entry-container.js +8 -8
  108. package/src/javascripts/ui/components/entry/text-entry/hooks.js +6 -9
  109. package/src/javascripts/ui/components/entry/text-entry/index.js +2 -2
  110. package/src/javascripts/ui/components/entry/text-entry/text-entry-form.js +8 -8
  111. package/src/javascripts/ui/components/entry/upload/file-upload-form.js +5 -5
  112. package/src/javascripts/ui/components/entry/upload/index.js +10 -10
  113. package/src/javascripts/ui/components/entry/upload-toggle.js +9 -9
  114. package/src/javascripts/ui/components/faq/faq.js +16 -16
  115. package/src/javascripts/ui/components/form-controls/error.js +2 -2
  116. package/src/javascripts/ui/components/form-controls/file-input.js +4 -4
  117. package/src/javascripts/ui/components/form-controls/form.js +2 -2
  118. package/src/javascripts/ui/components/form-controls/input.js +1 -1
  119. package/src/javascripts/ui/components/form-controls/select.js +1 -1
  120. package/src/javascripts/ui/components/form-controls/wrapper.js +1 -1
  121. package/src/javascripts/ui/components/layout/agent-info.js +13 -17
  122. package/src/javascripts/ui/components/layout/chat-frame.js +6 -6
  123. package/src/javascripts/ui/components/layout/deprecated-app-frame.js +7 -7
  124. package/src/javascripts/ui/components/layout/header.js +3 -3
  125. package/src/javascripts/ui/components/layout/icon.js +1 -1
  126. package/src/javascripts/ui/components/layout/interrupt.js +3 -3
  127. package/src/javascripts/ui/components/layout/privacy-disclaimer.js +3 -3
  128. package/src/javascripts/ui/components/options/options-button.js +8 -13
  129. package/src/javascripts/ui/components/options/options-frame.js +4 -4
  130. package/src/javascripts/ui/components/options/options.js +1 -1
  131. package/src/javascripts/ui/components/options/transcript/index.js +8 -8
  132. package/src/javascripts/ui/components/options/transcript/transcript-form.js +4 -4
  133. package/src/javascripts/ui/components/view/window-view/window-open-button.js +7 -7
  134. package/src/javascripts/ui/components/warnings/idle-detach-warning.js +6 -6
  135. package/src/javascripts/ui/components/warnings/prompt.js +2 -2
  136. package/src/javascripts/ui/components/warnings/resume-conversation-prompt.js +5 -5
  137. package/src/javascripts/ui/components/widgets/in-out-transition.js +3 -3
  138. package/src/javascripts/ui/components/widgets/lightbox.js +6 -6
  139. package/src/javascripts/ui/components/widgets/modal.js +2 -2
  140. package/src/javascripts/ui/components/widgets/upload-progress.js +4 -4
  141. package/src/javascripts/ui/hooks/component-helper-hooks.js +1 -1
  142. package/src/javascripts/ui/hooks/file-upload-hooks.js +2 -3
  143. package/src/javascripts/ui/hooks/focus-helper-hooks.js +3 -3
  144. package/src/javascripts/ui/hooks/live-region-hooks.js +2 -2
  145. package/src/javascripts/ui/hooks/seamly-api-hooks.js +1 -1
  146. package/src/javascripts/ui/hooks/seamly-entry-hooks.js +2 -2
  147. package/src/javascripts/ui/hooks/seamly-option-hooks.js +2 -2
  148. package/src/javascripts/ui/hooks/seamly-state-hooks.js +5 -5
  149. package/src/javascripts/ui/hooks/use-event-component-mapping.js +2 -2
  150. package/src/javascripts/ui/hooks/use-seamly-activity-event-handler.js +1 -1
  151. package/src/javascripts/ui/hooks/use-seamly-chat.js +3 -3
  152. package/src/javascripts/ui/hooks/use-seamly-commands.js +12 -12
  153. package/src/javascripts/ui/hooks/use-seamly-dispatch.js +1 -1
  154. package/src/javascripts/ui/hooks/use-seamly-idle-detach-countdown.js +9 -9
  155. package/src/javascripts/ui/hooks/use-seamly-resume-conversation-prompt.js +2 -2
  156. package/src/javascripts/ui/hooks/use-single-file-upload.js +2 -2
  157. package/src/javascripts/ui/hooks/utility-hooks.js +1 -1
  158. package/src/javascripts/ui/utils/seamly-utils.js +9 -2
  159. package/src/stylesheets/4-base/_formelements.scss +3 -3
  160. package/src/stylesheets/5-components/_buttons.scss +1 -1
  161. package/src/stylesheets/5-components/_input.scss +2 -2
  162. package/src/stylesheets/5-components/_message-body.scss +19 -12
  163. package/src/stylesheets/6-default-implementation/_hover.scss +24 -12
  164. package/src/stylesheets/7-deprecated/4-base/_formelements.scss +4 -4
  165. package/src/stylesheets/7-deprecated/5-components/_buttons.scss +1 -1
  166. package/src/stylesheets/7-deprecated/5-components/_input.scss +1 -1
  167. package/src/stylesheets/7-deprecated/5-components/_message.scss +4 -3
  168. package/src/stylesheets/7-deprecated/5-components/_options.scss +2 -2
  169. package/webpack/config.common.js +5 -0
  170. package/webpack/config.package.js +3 -0
  171. package/src/javascripts/domains/config/middleware.js +0 -22
@@ -1,4 +1,4 @@
1
- import { seamlyActions } from '../../ui/utils/seamly-utils'
1
+ import { seamlyActions } from 'ui/utils/seamly-utils'
2
2
 
3
3
  export default function createMiddleware({ api }) {
4
4
  return () => (next) => (action) => {
@@ -1,23 +1,20 @@
1
1
  import thunkMiddleware from 'redux-thunk'
2
- import { createReduxStore } from '../redux'
3
- import { Reducer as appReducer } from '../app'
4
- import {
5
- createMiddleware as createConfigMiddleware,
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 '../translations'
13
- import { Reducer as i18nReducer } from '../i18n'
14
- import { Reducer as visibilityReducer } from '../visibility'
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 '../interrupt'
19
- import { createMiddleware as createOptionsMiddleware } from '../options'
20
- import { createMiddleware as createErrorsMiddleware } from '../errors'
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 '../../lib/id'
4
- import { entryTypes, seamlyStateReducer } from '../../ui/utils/seamly-utils'
5
- import * as AppActions from '../app/actions'
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 '../../../ui/components/chat-status'
3
- import { useI18n } from '../../i18n'
4
- import { useSkiplinkTargetFocusing } from '../../../ui/hooks/seamly-hooks'
5
- import { useTranslationsContainer, useTranslations } from '../hooks'
6
- import { useInterrupt } from '../../interrupt'
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 '../../../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 '../../i18n'
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 '../../../ui/components/widgets/in-out-transition'
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 '../../../../ui/components/form-controls/form'
3
- import { className } from '../../../../lib/css'
4
- import { useI18n } from '../../../i18n'
5
- import { useTranslations } from '../../hooks'
6
- import Select from '../../../../ui/components/form-controls/select'
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 '../../../../ui/components/options/options-frame'
3
- import { FormProvider } from '../../../forms'
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 '../../ui/hooks/seamly-hooks'
6
- import { actionTypes } from '../../ui/utils/seamly-utils'
7
- import { useSelector, useSelectorWithProps, useStoreDispatch } from '../redux'
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 { createReducer } from './utils'
2
- import { seamlyActions } from '../../ui/utils/seamly-utils'
3
- import { randomId } from '../../lib/id'
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 * as AppActions from '../app/actions'
5
+ import { createReducer } from './utils'
6
6
 
7
7
  const initialState = {
8
8
  isActive: false,
@@ -1,5 +1,5 @@
1
1
  import { createSelector } from 'reselect'
2
- import { getPropSelector } from '../redux/utils'
2
+ import { getPropSelector } from 'domains/redux/utils'
3
3
  import { selectState } from './utils'
4
4
 
5
5
  export const getState = selectState
@@ -1,4 +1,4 @@
1
- import { createDomain } from '../../lib/redux-helpers'
1
+ import { createDomain } from 'lib/redux-helpers'
2
2
 
3
3
  export const { createActions, createReducer, selectState } =
4
4
  createDomain('translations')
@@ -1,10 +1,10 @@
1
- import * as ConfigSelectors from '../config/selectors'
2
- import * as AppSelectors from '../app/selectors'
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 '../redux'
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 '../../lib/redux-helpers'
1
+ import { createDomain } from 'lib/redux-helpers'
2
2
  import { visibilityStates } from './constants'
3
3
 
4
4
  export const {
@@ -1,4 +1,4 @@
1
- import { CSS_NAME } from '../config'
1
+ import { CSS_NAME } from 'config'
2
2
 
3
3
  /**
4
4
  * Generate a className with all classes prefixed with the CSS_NAME
@@ -1,10 +1,10 @@
1
1
  import { render, h } from 'preact'
2
2
  import Events from 'minivents'
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'
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 '../engine'
1
+ import Engine from 'lib/engine'
2
2
 
3
3
  const isActionObject = (actionObj) =>
4
4
  typeof actionObj === 'object' && 'action' in actionObj
@@ -1,4 +1,4 @@
1
- import { randomId } from '../id'
1
+ import { randomId } from 'lib/id'
2
2
 
3
3
  export const SLICE_DELIMITER = '/'
4
4
  export const DOMAIN_DELIMITER = '//'
@@ -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 { agentName } = defaults || {}
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: agentName || bareState.headerTitles.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 '../states'
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
- setTimeout(() => {
81
- document
82
- .querySelector('section.cvco-app')
83
- .scrollIntoView()
84
- }, 300)
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 '../../domains/store/state-reducer'
13
- import { Reducer as formReducer } from '../../domains/forms'
14
- import { Reducer as translationsReducer } from '../../domains/translations'
15
- import {
16
- Reducer as i18nReducer,
17
- Actions as I18nActions,
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 '../../domains/config'
25
- import { Reducer as visibilityReducer } from '../../domains/visibility'
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 = ({ state, translations, children }) => {
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 = ({ state, customComponents = {}, translations }) => {
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 state={state} translations={translations}>
33
+ <StyleGuideStaticCore
34
+ state={state}
35
+ translations={translations}
36
+ participants={participants}
37
+ >
29
38
  <CustomView />
30
39
  </StyleGuideStaticCore>
31
40
  ) : (
32
- <StyleGuideStaticCore state={state} translations={translations}>
41
+ <StyleGuideStaticCore
42
+ state={state}
43
+ translations={translations}
44
+ participants={participants}
45
+ >
33
46
  <View />
34
47
  </StyleGuideStaticCore>
35
48
  )