@seamly/web-ui 20.7.0 → 20.8.0-alpha.1
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/CHANGELOG.md +212 -16
- package/build/dist/lib/hooks.js +1 -1
- package/build/dist/lib/hooks.min.js +1 -1
- package/build/dist/lib/index.debug.js +939 -784
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.debug.min.js.LICENSE.txt +186 -130
- package/build/dist/lib/index.js +24806 -19703
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/index.min.js.LICENSE.txt +38 -4
- package/build/dist/lib/standalone.js +32726 -26838
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/standalone.min.js.LICENSE.txt +39 -0
- package/build/dist/lib/storage.js +2 -2
- package/build/dist/lib/storage.min.js +1 -1
- package/build/dist/lib/style-guide.js +8649 -7863
- package/build/dist/lib/style-guide.min.js +2 -1
- package/build/dist/lib/style-guide.min.js.LICENSE.txt +38 -0
- package/build/dist/lib/utils.js +1 -2
- package/build/dist/lib/utils.min.js +1 -1
- package/package.json +19 -9
- package/src/icons/avatar_agent-32.svg +7 -0
- package/src/icons/avatar_bot-32.svg +6 -1
- package/src/javascripts/api/index.js +1 -1
- package/src/javascripts/{config.js → config.ts} +3 -1
- package/src/javascripts/config.types.ts +95 -0
- package/src/javascripts/domains/app/actions.ts +83 -0
- package/src/javascripts/domains/app/app.types.ts +3 -0
- package/src/javascripts/domains/app/hooks.js +3 -5
- package/src/javascripts/domains/app/selectors.ts +6 -0
- package/src/javascripts/domains/app/slice.ts +30 -0
- package/src/javascripts/domains/config/actions.ts +45 -0
- package/src/javascripts/domains/config/hooks.ts +19 -0
- package/src/javascripts/domains/config/selectors.ts +24 -0
- package/src/javascripts/domains/config/slice.ts +111 -0
- package/src/javascripts/domains/errors/index.js +13 -9
- package/src/javascripts/domains/forms/context.ts +14 -0
- package/src/javascripts/domains/forms/forms.types.ts +24 -0
- package/src/javascripts/domains/forms/{hooks.js → hooks.ts} +23 -26
- package/src/javascripts/domains/forms/{provider.js → provider.tsx} +20 -14
- package/src/javascripts/domains/forms/{selectors.js → selectors.ts} +7 -8
- package/src/javascripts/domains/forms/slice.ts +84 -0
- package/src/javascripts/domains/forms/utils.ts +15 -0
- package/src/javascripts/domains/i18n/actions.ts +24 -0
- package/src/javascripts/domains/i18n/{hooks.js → hooks.ts} +2 -2
- package/src/javascripts/domains/i18n/i18n.types.ts +6 -0
- package/src/javascripts/domains/i18n/selectors.ts +16 -0
- package/src/javascripts/domains/i18n/{reducer.js → slice.ts} +43 -37
- package/src/javascripts/domains/interrupt/{hooks.js → hooks.ts} +2 -2
- package/src/javascripts/domains/interrupt/{middleware.js → middleware.ts} +11 -8
- package/src/javascripts/domains/interrupt/selectors.ts +6 -0
- package/src/javascripts/domains/interrupt/slice.ts +40 -0
- package/src/javascripts/domains/options/middleware.js +9 -6
- package/src/javascripts/domains/redux/redux.types.ts +11 -0
- package/src/javascripts/domains/store/index.ts +53 -0
- package/src/javascripts/domains/store/slice.ts +639 -0
- package/src/javascripts/domains/store/store.types.ts +135 -0
- package/src/javascripts/domains/translations/components/chat-status.js +2 -2
- package/src/javascripts/domains/translations/components/options-button.js +1 -1
- package/src/javascripts/domains/translations/components/options-dialog/form.js +5 -5
- package/src/javascripts/domains/translations/components/options-dialog/index.js +2 -2
- package/src/javascripts/domains/translations/{hooks.js → hooks.ts} +28 -23
- package/src/javascripts/domains/translations/middleware.js +29 -27
- package/src/javascripts/domains/translations/selectors.js +4 -9
- package/src/javascripts/domains/translations/slice.ts +67 -0
- package/src/javascripts/domains/translations/translations.types.ts +12 -0
- package/src/javascripts/domains/visibility/{actions.js → actions.ts} +25 -19
- package/src/javascripts/domains/visibility/{hooks.js → hooks.ts} +13 -10
- package/src/javascripts/domains/visibility/{selectors.js → selectors.ts} +3 -6
- package/src/javascripts/domains/visibility/slice.ts +38 -0
- package/src/javascripts/domains/visibility/utils.js +0 -9
- package/src/javascripts/domains/visibility/visibility.types.ts +6 -0
- package/src/javascripts/index.ts +92 -0
- package/src/javascripts/lib/engine/index.js +15 -11
- package/src/javascripts/lib/external-api/initialize-api.js +1 -1
- package/src/javascripts/lib/id.js +5 -8
- package/src/javascripts/lib/mutex.js +3 -1
- package/src/javascripts/lib/store/providers/cookie-storage.js +1 -1
- package/src/javascripts/lib/store/providers/session-storage.js +1 -1
- package/src/javascripts/package/hooks.js +2 -2
- package/src/javascripts/package/utils.js +0 -1
- package/src/javascripts/schema.ts +1455 -0
- package/src/javascripts/style-guide/components/app.js +4 -4
- package/src/javascripts/style-guide/components/static-core.js +87 -65
- package/src/javascripts/style-guide/components/view.js +4 -4
- package/src/javascripts/style-guide/state-helpers/index.js +5 -5
- package/src/javascripts/style-guide/states.js +6 -4
- package/src/javascripts/style-guide.ts +5 -0
- package/src/javascripts/ui/components/app-options/index.js +2 -4
- package/src/javascripts/ui/components/conversation/component-filter.js +1 -1
- package/src/javascripts/ui/components/conversation/conversation.js +5 -5
- package/src/javascripts/ui/components/conversation/event/card-message.js +1 -1
- package/src/javascripts/ui/components/conversation/event/carousel-component/components/controls.js +1 -1
- package/src/javascripts/ui/components/conversation/event/carousel-message/components/slide.js +1 -1
- package/src/javascripts/ui/components/conversation/event/carousel-message/index.js +1 -1
- package/src/javascripts/ui/components/conversation/event/choice-prompt.js +2 -2
- package/src/javascripts/ui/components/conversation/event/conversation-suggestions.js +11 -14
- package/src/javascripts/ui/components/conversation/event/cta.js +1 -1
- package/src/javascripts/ui/components/conversation/event/divider/variants/default.js +1 -1
- package/src/javascripts/ui/components/conversation/event/divider/variants/new-translation.js +5 -2
- package/src/javascripts/ui/components/conversation/event/event-participant.js +2 -2
- package/src/javascripts/ui/components/conversation/event/hooks/use-formatted-date.js +2 -2
- package/src/javascripts/ui/components/conversation/event/image-lightbox.js +1 -1
- package/src/javascripts/ui/components/conversation/event/image.js +5 -7
- package/src/javascripts/ui/components/conversation/event/participant.js +1 -1
- package/src/javascripts/ui/components/conversation/event/splash.js +3 -3
- package/src/javascripts/ui/components/conversation/event/text.js +1 -1
- package/src/javascripts/ui/components/conversation/event/translation.js +2 -2
- package/src/javascripts/ui/components/conversation/event/upload.js +2 -2
- package/src/javascripts/ui/components/conversation/event/video.js +1 -1
- package/src/javascripts/ui/components/conversation/message-container.js +4 -4
- package/src/javascripts/ui/components/core/seamly-api-context.js +1 -1
- package/src/javascripts/ui/components/core/seamly-core.js +15 -14
- package/src/javascripts/ui/components/core/seamly-event-subscriber.js +96 -91
- package/src/javascripts/ui/components/core/seamly-file-upload.js +20 -24
- package/src/javascripts/ui/components/core/seamly-initializer.js +1 -1
- package/src/javascripts/ui/components/core/seamly-instance-functions-loader.js +5 -4
- package/src/javascripts/ui/components/core/seamly-new-notifications.js +2 -2
- package/src/javascripts/ui/components/core/seamly-read-state.js +10 -17
- package/src/javascripts/ui/components/entry/deprecated-toggle-button.js +3 -3
- package/src/javascripts/ui/components/entry/entry-container.js +4 -6
- package/src/javascripts/ui/components/entry/text-entry/hooks.js +3 -3
- package/src/javascripts/ui/components/entry/text-entry/index.js +3 -2
- package/src/javascripts/ui/components/entry/text-entry/text-entry-form.js +6 -10
- package/src/javascripts/ui/components/entry/upload/file-upload-form.js +2 -2
- package/src/javascripts/ui/components/entry/upload/index.js +10 -9
- package/src/javascripts/ui/components/entry/upload-toggle.js +2 -2
- package/src/javascripts/ui/components/faq/faq.js +6 -6
- package/src/javascripts/ui/components/form-controls/file-input.js +1 -1
- package/src/javascripts/ui/components/form-controls/form.js +1 -1
- 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/layout/agent-info.js +4 -4
- package/src/javascripts/ui/components/layout/chat-frame.js +3 -3
- package/src/javascripts/ui/components/layout/chat.js +11 -12
- package/src/javascripts/ui/components/layout/deprecated-app-frame.js +10 -9
- package/src/javascripts/ui/components/layout/header.js +1 -1
- package/src/javascripts/ui/components/layout/interrupt.js +23 -24
- package/src/javascripts/ui/components/layout/pre-chat-messages.js +11 -11
- package/src/javascripts/ui/components/layout/privacy-disclaimer.js +2 -2
- package/src/javascripts/ui/components/options/options-button.js +12 -10
- package/src/javascripts/ui/components/options/transcript/index.js +2 -2
- package/src/javascripts/ui/components/options/transcript/transcript-form.js +1 -1
- package/src/javascripts/ui/components/suggestions/index.js +9 -8
- package/src/javascripts/ui/components/view/deprecated-view.js +19 -16
- package/src/javascripts/ui/components/view/index.js +12 -12
- package/src/javascripts/ui/components/view/inline-view.js +2 -2
- package/src/javascripts/ui/components/view/window-view/collapse-button.js +3 -3
- package/src/javascripts/ui/components/view/window-view/index.js +13 -13
- package/src/javascripts/ui/components/view/window-view/window-open-button.js +13 -13
- package/src/javascripts/ui/components/warnings/idle-detach-warning.js +1 -1
- package/src/javascripts/ui/components/warnings/resume-conversation-prompt.js +1 -1
- package/src/javascripts/ui/components/widgets/lightbox.js +2 -2
- package/src/javascripts/ui/components/widgets/upload-progress.js +1 -1
- package/src/javascripts/ui/hooks/component-helper-hooks.js +1 -1
- package/src/javascripts/ui/hooks/file-upload-hooks.js +4 -6
- package/src/javascripts/ui/hooks/focus-helper-hooks.js +14 -12
- package/src/javascripts/ui/hooks/live-region-hooks.js +2 -0
- package/src/javascripts/ui/hooks/seamly-api-hooks.js +8 -3
- package/src/javascripts/ui/hooks/seamly-entry-hooks.js +28 -25
- package/src/javascripts/ui/hooks/seamly-hooks.js +25 -25
- package/src/javascripts/ui/hooks/seamly-option-hooks.js +17 -19
- package/src/javascripts/ui/hooks/seamly-state-hooks.js +14 -13
- package/src/javascripts/ui/hooks/use-seamly-chat.js +15 -25
- package/src/javascripts/ui/hooks/use-seamly-commands.js +46 -46
- package/src/javascripts/ui/hooks/use-seamly-idle-detach-countdown.js +22 -24
- package/src/javascripts/ui/hooks/use-seamly-resume-conversation-prompt.js +8 -9
- package/src/javascripts/ui/hooks/use-single-file-upload.js +4 -6
- package/src/javascripts/ui/hooks/utility-hooks.js +4 -4
- package/src/javascripts/ui/utils/form-utils.js +0 -145
- package/src/javascripts/ui/utils/general-utils.js +3 -4
- package/src/javascripts/ui/utils/seamly-utils.ts +73 -0
- package/webpack/config.common.js +16 -0
- package/webpack/config.dev.js +1 -0
- package/webpack/config.package.js +26 -5
- package/webpack/defaults.js +7 -2
- package/webpack/parts/babel-loader-browser-plugins.js +1 -0
- package/webpack/parts/dev-server.js +4 -3
- package/src/javascripts/domains/app/actions.js +0 -112
- package/src/javascripts/domains/app/index.js +0 -7
- package/src/javascripts/domains/app/reducer.js +0 -16
- package/src/javascripts/domains/app/selectors.js +0 -8
- package/src/javascripts/domains/app/utils.js +0 -4
- package/src/javascripts/domains/config/actions.js +0 -7
- package/src/javascripts/domains/config/hooks.js +0 -23
- package/src/javascripts/domains/config/index.js +0 -7
- package/src/javascripts/domains/config/reducer.js +0 -79
- package/src/javascripts/domains/config/selectors.js +0 -23
- package/src/javascripts/domains/config/utils.js +0 -4
- package/src/javascripts/domains/forms/actions.js +0 -21
- package/src/javascripts/domains/forms/context.js +0 -6
- package/src/javascripts/domains/forms/index.js +0 -8
- package/src/javascripts/domains/forms/reducer.js +0 -84
- package/src/javascripts/domains/forms/utils.js +0 -20
- package/src/javascripts/domains/i18n/actions.js +0 -20
- package/src/javascripts/domains/i18n/index.js +0 -7
- package/src/javascripts/domains/i18n/selectors.js +0 -15
- package/src/javascripts/domains/i18n/utils.js +0 -4
- package/src/javascripts/domains/interrupt/actions.js +0 -4
- package/src/javascripts/domains/interrupt/index.js +0 -9
- package/src/javascripts/domains/interrupt/reducer.js +0 -22
- package/src/javascripts/domains/interrupt/selectors.js +0 -6
- package/src/javascripts/domains/interrupt/utils.js +0 -4
- package/src/javascripts/domains/options/index.js +0 -1
- package/src/javascripts/domains/redux/context.js +0 -6
- package/src/javascripts/domains/redux/create-redux-store.js +0 -21
- package/src/javascripts/domains/redux/hooks.js +0 -80
- package/src/javascripts/domains/redux/index.js +0 -19
- package/src/javascripts/domains/redux/provider.js +0 -5
- package/src/javascripts/domains/redux/utils.js +0 -12
- package/src/javascripts/domains/store/index.js +0 -46
- package/src/javascripts/domains/store/state-reducer.js +0 -56
- package/src/javascripts/domains/translations/actions.js +0 -11
- package/src/javascripts/domains/translations/index.js +0 -10
- package/src/javascripts/domains/translations/reducer.js +0 -69
- package/src/javascripts/domains/translations/utils.js +0 -4
- package/src/javascripts/domains/visibility/index.js +0 -8
- package/src/javascripts/domains/visibility/reducer.js +0 -24
- package/src/javascripts/index.js +0 -153
- package/src/javascripts/lib/redux-helpers/index.js +0 -99
- package/src/javascripts/style-guide.js +0 -5
- package/src/javascripts/ui/hooks/use-seamly-dispatch.js +0 -3
- package/src/javascripts/ui/utils/seamly-utils.js +0 -832
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
|
|
2
|
+
import { VisibilityOptions } from 'config.types'
|
|
3
|
+
import { setVisibility } from 'domains/visibility/actions'
|
|
4
|
+
import { visibilityStates } from 'domains/visibility/constants'
|
|
5
|
+
import type { VisibilityState } from 'domains/visibility/visibility.types'
|
|
6
|
+
|
|
7
|
+
const initialState: VisibilityState = {
|
|
8
|
+
visibility: visibilityStates.initialize,
|
|
9
|
+
showInlineView: false,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const visibilitySlice = createSlice({
|
|
13
|
+
name: 'visibility',
|
|
14
|
+
initialState,
|
|
15
|
+
reducers: {
|
|
16
|
+
setFromStorage: (state, action) => {
|
|
17
|
+
state.visibility = action.payload
|
|
18
|
+
},
|
|
19
|
+
setShowInlineView: (state) => {
|
|
20
|
+
state.showInlineView = true
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
extraReducers: (builder) => {
|
|
24
|
+
builder.addCase(
|
|
25
|
+
setVisibility.fulfilled,
|
|
26
|
+
(state, { payload: visibility }: PayloadAction<VisibilityOptions>) => {
|
|
27
|
+
if (visibility) {
|
|
28
|
+
state.visibility = visibility
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
)
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
export const { setFromStorage } = visibilitySlice.actions
|
|
36
|
+
export const { setShowInlineView } = visibilitySlice.actions
|
|
37
|
+
|
|
38
|
+
export default visibilitySlice.reducer
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
import { createDomain } from 'lib/redux-helpers'
|
|
2
1
|
import { visibilityStates } from './constants'
|
|
3
2
|
|
|
4
|
-
export const {
|
|
5
|
-
createAction,
|
|
6
|
-
createActions,
|
|
7
|
-
createThunk,
|
|
8
|
-
createReducer,
|
|
9
|
-
selectState,
|
|
10
|
-
} = createDomain('visibility')
|
|
11
|
-
|
|
12
3
|
export const calculateVisibility = ({
|
|
13
4
|
hasResponded,
|
|
14
5
|
previousVisibility,
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// Used by: Client
|
|
2
|
+
import initializeExternalApi from './lib/external-api/initialize-api'
|
|
3
|
+
|
|
4
|
+
// Used by: Client
|
|
5
|
+
export default initializeExternalApi
|
|
6
|
+
|
|
7
|
+
// Used by: StyleGuide
|
|
8
|
+
export { API } from './api'
|
|
9
|
+
|
|
10
|
+
// Used by: StyleGuide
|
|
11
|
+
export { Provider as SeamlyStoreProvider } from 'react-redux'
|
|
12
|
+
// Used by: StyleGuide
|
|
13
|
+
export { default as SeamlyGeneralError } from './api/errors/seamly-general-error'
|
|
14
|
+
// Used by: StyleGuide
|
|
15
|
+
export { default as SeamlyOfflineError } from './api/errors/seamly-offline-error'
|
|
16
|
+
// Used by: Client
|
|
17
|
+
export { useConfig as useSeamlyConfig } from 'domains/config/hooks'
|
|
18
|
+
// Used by: Client
|
|
19
|
+
export { useI18n } from 'domains/i18n/hooks'
|
|
20
|
+
// Used by: Client
|
|
21
|
+
export {
|
|
22
|
+
useTranslatedEventData,
|
|
23
|
+
useTranslations,
|
|
24
|
+
useTranslationsContainer,
|
|
25
|
+
} from 'domains/translations/hooks'
|
|
26
|
+
// Used by: Client
|
|
27
|
+
export { useVisibility as useSeamlyVisibility } from 'domains/visibility/hooks'
|
|
28
|
+
export { visibilityStates } from 'domains/visibility/constants'
|
|
29
|
+
export { calculateVisibility } from 'domains/visibility/utils'
|
|
30
|
+
// Used by: Client
|
|
31
|
+
export { className } from './lib/css'
|
|
32
|
+
// Used by: StyleGuide
|
|
33
|
+
export { default as Engine } from './lib/engine'
|
|
34
|
+
// Used by: StyleGuide
|
|
35
|
+
export { default as ExternalApi } from './lib/external-api'
|
|
36
|
+
// Used by: StyleGuide
|
|
37
|
+
export { randomId } from './lib/id'
|
|
38
|
+
// Used by: StyleGuide
|
|
39
|
+
export { default as ComponentFilter } from 'ui/components/conversation/component-filter'
|
|
40
|
+
// Used by: Client
|
|
41
|
+
export { default as Conversation } from 'ui/components/conversation/conversation'
|
|
42
|
+
// Used by: Client
|
|
43
|
+
export { useChoicePrompt } from 'ui/components/conversation/event/choice-prompt'
|
|
44
|
+
// Used by: Demo
|
|
45
|
+
export { default as EventParticipant } from 'ui/components/conversation/event/event-participant'
|
|
46
|
+
// Used by: Client
|
|
47
|
+
export { default as Text } from 'ui/components/conversation/event/text'
|
|
48
|
+
// Used by: Client
|
|
49
|
+
export { default as MessageContainer } from 'ui/components/conversation/message-container'
|
|
50
|
+
// Used by: StyleGuide
|
|
51
|
+
export {
|
|
52
|
+
SeamlyApiContext,
|
|
53
|
+
SeamlyEventBusContext,
|
|
54
|
+
} from 'ui/components/core/seamly-api-context'
|
|
55
|
+
// Used by: StyleGuide
|
|
56
|
+
export { SeamlyLiveRegionContext } from 'ui/components/core/seamly-live-region-context'
|
|
57
|
+
// Used by: Client
|
|
58
|
+
export { default as DeprecatedToggleButton } from 'ui/components/entry/deprecated-toggle-button'
|
|
59
|
+
// Used by: Client
|
|
60
|
+
export { default as EntryContainer } from 'ui/components/entry/entry-container'
|
|
61
|
+
export { default as AgentInfo } from 'ui/components/layout/agent-info'
|
|
62
|
+
// Used by: Client
|
|
63
|
+
export { default as Chat } from 'ui/components/layout/chat'
|
|
64
|
+
// Used by: Client
|
|
65
|
+
export { default as ChatFrame } from 'ui/components/layout/chat-frame'
|
|
66
|
+
// Used by: Client
|
|
67
|
+
export { default as Header } from 'ui/components/layout/header'
|
|
68
|
+
// Used by: Client
|
|
69
|
+
export { default as Icon } from 'ui/components/layout/icon'
|
|
70
|
+
// Used by: Client
|
|
71
|
+
export { default as Interrupt } from 'ui/components/layout/interrupt'
|
|
72
|
+
// Used by: StyleGuide
|
|
73
|
+
// Used by: Client (with custom view)
|
|
74
|
+
export { default as View } from 'ui/components/view'
|
|
75
|
+
// Used by: Client
|
|
76
|
+
export { default as DeprecatedView } from 'ui/components/view/deprecated-view'
|
|
77
|
+
// Used by: Client
|
|
78
|
+
export {
|
|
79
|
+
useEvents,
|
|
80
|
+
useGeneratedId,
|
|
81
|
+
useSeamlyChat,
|
|
82
|
+
useSeamlyCommands,
|
|
83
|
+
useSeamlyDispatchContext,
|
|
84
|
+
useSeamlyEventStream,
|
|
85
|
+
useSeamlyIdleDetachCountdown,
|
|
86
|
+
useSeamlyMessageContainerClassNames,
|
|
87
|
+
useSeamlyOptions,
|
|
88
|
+
} from './ui/hooks/seamly-hooks'
|
|
89
|
+
// Used by: StyleGuide
|
|
90
|
+
export { getUrlParams, getUrlSearchString } from './ui/utils/general-utils'
|
|
91
|
+
// Used by: Client
|
|
92
|
+
export { eventTypes } from './ui/utils/seamly-utils'
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { API } from 'api'
|
|
2
|
+
import { initializeApp } from 'domains/app/actions'
|
|
3
|
+
|
|
4
|
+
import { initializeConfig } from 'domains/config/actions'
|
|
5
|
+
import { setConfig } from 'domains/config/slice'
|
|
6
|
+
|
|
7
|
+
import { createStore } from 'domains/store'
|
|
8
|
+
import { initializeVisibility } from 'domains/visibility/actions'
|
|
2
9
|
import Events from 'minivents'
|
|
10
|
+
import { render } from 'preact'
|
|
3
11
|
import ChatApp from 'ui/components/chat-app'
|
|
4
12
|
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
13
|
|
|
9
14
|
export default class Engine {
|
|
10
15
|
constructor(config, externalApi) {
|
|
@@ -55,18 +60,17 @@ export default class Engine {
|
|
|
55
60
|
api: this.api,
|
|
56
61
|
eventBus: this.eventBus,
|
|
57
62
|
config: renderConfig,
|
|
63
|
+
initialState: undefined,
|
|
58
64
|
})
|
|
59
65
|
|
|
60
|
-
|
|
66
|
+
store.dispatch(setConfig(renderConfig))
|
|
67
|
+
await store.dispatch(initializeConfig())
|
|
68
|
+
await store.dispatch(initializeApp())
|
|
69
|
+
store.dispatch(initializeVisibility())
|
|
61
70
|
|
|
62
71
|
if (View) {
|
|
63
72
|
render(
|
|
64
|
-
<SeamlyCore
|
|
65
|
-
config={renderConfig}
|
|
66
|
-
eventBus={this.eventBus}
|
|
67
|
-
store={store}
|
|
68
|
-
api={this.api}
|
|
69
|
-
>
|
|
73
|
+
<SeamlyCore eventBus={this.eventBus} store={store} api={this.api}>
|
|
70
74
|
<View />
|
|
71
75
|
</SeamlyCore>,
|
|
72
76
|
this.parentElement,
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
export function randomId() {
|
|
2
|
-
return (
|
|
3
|
-
|
|
4
|
-
(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Math.round(performance.now())
|
|
8
|
-
).toString(36)
|
|
9
|
-
)
|
|
2
|
+
return `_${(
|
|
3
|
+
Number(String(Math.random()).slice(2)) +
|
|
4
|
+
Date.now() +
|
|
5
|
+
Math.round(performance.now())
|
|
6
|
+
).toString(36)}`
|
|
10
7
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export {
|
|
2
2
|
useChoicePrompt,
|
|
3
|
-
useDispatch,
|
|
4
3
|
useEvents,
|
|
5
4
|
useGeneratedId,
|
|
6
5
|
useI18n,
|
|
7
6
|
useSeamlyChat,
|
|
8
7
|
useSeamlyCommands,
|
|
8
|
+
useSeamlyDispatchContext,
|
|
9
9
|
useSeamlyEventStream,
|
|
10
10
|
useSeamlyIdleDetachCountdown,
|
|
11
11
|
useSeamlyMessageContainerClassNames,
|
|
12
12
|
useSeamlyOptions,
|
|
13
|
-
useTranslations,
|
|
14
13
|
useTranslatedEventData,
|
|
14
|
+
useTranslations,
|
|
15
15
|
useTranslationsContainer,
|
|
16
16
|
} from '@seamly/web-ui'
|