@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
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useCallback, useEffect, useState } from 'preact/hooks'
|
|
2
1
|
import { getUrlParams, getUrlSearchString, randomId } from '@seamly/web-ui'
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import { useCallback, useEffect, useState } from 'preact/hooks'
|
|
3
|
+
import StyleGuideLinks from 'style-guide/components/links'
|
|
4
|
+
import StyleGuideView from 'style-guide/components/view'
|
|
5
|
+
import { getDeprecatedStateObj, getStateObj } from 'style-guide/states'
|
|
6
6
|
|
|
7
7
|
const StyleGuideApp = ({
|
|
8
8
|
config,
|
|
@@ -1,101 +1,123 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import thunkMiddleware from 'redux-thunk'
|
|
3
|
-
|
|
1
|
+
import { configureStore } from '@reduxjs/toolkit'
|
|
4
2
|
import {
|
|
5
|
-
|
|
3
|
+
ComponentFilter,
|
|
6
4
|
SeamlyApiContext,
|
|
5
|
+
SeamlyEventBusContext,
|
|
7
6
|
SeamlyLiveRegionContext,
|
|
8
|
-
|
|
9
|
-
ComponentFilter,
|
|
10
|
-
createReduxStore,
|
|
7
|
+
SeamlyStoreProvider,
|
|
11
8
|
} from '@seamly/web-ui'
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} from 'domains/
|
|
22
|
-
import
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
|
|
9
|
+
import appReducer from 'domains/app/slice'
|
|
10
|
+
import configReducer, {
|
|
11
|
+
setPreChatEvents,
|
|
12
|
+
setConfig,
|
|
13
|
+
} from 'domains/config/slice'
|
|
14
|
+
import formsReducer from 'domains/forms/slice'
|
|
15
|
+
import i18nReducer, {
|
|
16
|
+
setInitialLocale,
|
|
17
|
+
setTranslations,
|
|
18
|
+
} from 'domains/i18n/slice'
|
|
19
|
+
import interruptReducer from 'domains/interrupt/slice'
|
|
20
|
+
import stateReducer, { setParticipant } from 'domains/store/slice'
|
|
21
|
+
import translationReducer from 'domains/translations/slice'
|
|
22
|
+
import visibilityReducer from 'domains/visibility/slice'
|
|
23
|
+
import { useMemo, useRef } from 'preact/hooks'
|
|
26
24
|
|
|
27
25
|
const bareApi = {
|
|
28
|
-
send: () => {
|
|
26
|
+
send: () => {
|
|
27
|
+
// do nothing
|
|
28
|
+
},
|
|
29
29
|
reset: () => {
|
|
30
30
|
return Promise.resolve({})
|
|
31
31
|
},
|
|
32
|
-
store: {
|
|
32
|
+
store: {
|
|
33
|
+
get: () => {
|
|
34
|
+
// do nothing
|
|
35
|
+
},
|
|
36
|
+
set: () => {
|
|
37
|
+
// do nothing
|
|
38
|
+
},
|
|
39
|
+
},
|
|
33
40
|
hasConversation: () => false,
|
|
34
41
|
}
|
|
35
42
|
|
|
36
|
-
const
|
|
43
|
+
const SeamlyStaticCore = ({
|
|
37
44
|
state,
|
|
38
45
|
translations,
|
|
39
46
|
participants = [],
|
|
40
47
|
children,
|
|
41
48
|
}) => {
|
|
42
|
-
const liveMsgRef = useRef(() => {
|
|
43
|
-
|
|
49
|
+
const liveMsgRef = useRef(() => {
|
|
50
|
+
// do nothing
|
|
51
|
+
})
|
|
52
|
+
const eventBusRef = useRef({
|
|
53
|
+
emit: () => {
|
|
54
|
+
// do nothing
|
|
55
|
+
},
|
|
56
|
+
})
|
|
44
57
|
|
|
45
58
|
const store = useMemo(() => {
|
|
46
59
|
const {
|
|
47
|
-
translations:
|
|
48
|
-
interrupt:
|
|
49
|
-
config:
|
|
50
|
-
visibility:
|
|
51
|
-
...
|
|
60
|
+
translations: initialTranslations,
|
|
61
|
+
interrupt: initialInterrupt,
|
|
62
|
+
config: initialConfig = {},
|
|
63
|
+
visibility: initialVisibility,
|
|
64
|
+
...initialState
|
|
52
65
|
} = state || {}
|
|
53
|
-
|
|
54
|
-
|
|
66
|
+
|
|
67
|
+
const newStore = configureStore({
|
|
68
|
+
reducer: {
|
|
55
69
|
state: stateReducer,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
70
|
+
app: appReducer,
|
|
71
|
+
config: configReducer,
|
|
72
|
+
i18n: i18nReducer,
|
|
73
|
+
translations: translationReducer,
|
|
74
|
+
visibility: visibilityReducer,
|
|
75
|
+
forms: formsReducer,
|
|
76
|
+
interrupt: interruptReducer,
|
|
63
77
|
},
|
|
64
|
-
|
|
65
|
-
state:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
78
|
+
preloadedState: {
|
|
79
|
+
state: initialState,
|
|
80
|
+
config: initialConfig,
|
|
81
|
+
translations: initialTranslations,
|
|
82
|
+
interrupt: initialInterrupt,
|
|
83
|
+
visibility: initialVisibility,
|
|
69
84
|
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
85
|
+
middleware: (getDefaultMiddleWare) =>
|
|
86
|
+
getDefaultMiddleWare({
|
|
87
|
+
thunk: {
|
|
88
|
+
extraArgument: {
|
|
89
|
+
api: bareApi,
|
|
90
|
+
eventBus: eventBusRef.current,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
serializableCheck: false,
|
|
74
94
|
}),
|
|
75
|
-
],
|
|
76
95
|
})
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
96
|
+
|
|
97
|
+
const { config } = newStore.getState()
|
|
98
|
+
|
|
99
|
+
newStore.dispatch(setConfig(config))
|
|
100
|
+
if (config.preChatEvents) {
|
|
101
|
+
newStore.dispatch(setPreChatEvents(config.preChatEvents))
|
|
82
102
|
}
|
|
83
|
-
newStore.dispatch(
|
|
103
|
+
newStore.dispatch(setInitialLocale('en-GB'))
|
|
104
|
+
newStore.dispatch(setTranslations(translations))
|
|
84
105
|
|
|
85
106
|
participants.forEach((participant) => {
|
|
86
|
-
newStore.dispatch(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
107
|
+
newStore.dispatch(
|
|
108
|
+
setParticipant({
|
|
109
|
+
participant,
|
|
110
|
+
fromClient: participant.id === 'user',
|
|
111
|
+
}),
|
|
112
|
+
)
|
|
91
113
|
})
|
|
92
114
|
|
|
93
115
|
return newStore
|
|
94
|
-
}, [state, translations
|
|
116
|
+
}, [participants, state, translations])
|
|
95
117
|
|
|
96
118
|
return (
|
|
97
119
|
state && (
|
|
98
|
-
<
|
|
120
|
+
<SeamlyStoreProvider store={store}>
|
|
99
121
|
<SeamlyEventBusContext.Provider value={eventBusRef.current}>
|
|
100
122
|
<SeamlyLiveRegionContext.Provider value={liveMsgRef.current}>
|
|
101
123
|
<SeamlyApiContext.Provider value={bareApi}>
|
|
@@ -103,9 +125,9 @@ const SeamlyTestCore = ({
|
|
|
103
125
|
</SeamlyApiContext.Provider>
|
|
104
126
|
</SeamlyLiveRegionContext.Provider>
|
|
105
127
|
</SeamlyEventBusContext.Provider>
|
|
106
|
-
</
|
|
128
|
+
</SeamlyStoreProvider>
|
|
107
129
|
)
|
|
108
130
|
)
|
|
109
131
|
}
|
|
110
132
|
|
|
111
|
-
export default
|
|
133
|
+
export default SeamlyStaticCore
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useState, useEffect } from 'preact/hooks'
|
|
2
2
|
import { View } from '@seamly/web-ui'
|
|
3
|
+
import { timeout } from 'ui/hooks/focus-helper-hooks'
|
|
3
4
|
import StyleGuideStaticCore from './static-core'
|
|
4
5
|
|
|
5
6
|
const StyleGuideView = ({
|
|
@@ -18,10 +19,9 @@ const StyleGuideView = ({
|
|
|
18
19
|
// renders showing up.
|
|
19
20
|
useEffect(() => {
|
|
20
21
|
setRenderView(false)
|
|
21
|
-
requestAnimationFrame(() => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
})
|
|
22
|
+
requestAnimationFrame(async () => {
|
|
23
|
+
await timeout(60)
|
|
24
|
+
setRenderView(true)
|
|
25
25
|
})
|
|
26
26
|
}, [state])
|
|
27
27
|
|
|
@@ -33,24 +33,24 @@ export function addTranslationData(event) {
|
|
|
33
33
|
data: {
|
|
34
34
|
...event.payload.body,
|
|
35
35
|
text: event.payload.body.text
|
|
36
|
-
?
|
|
36
|
+
? `NL - ${event.payload.body.text}`
|
|
37
37
|
: undefined,
|
|
38
38
|
description: event.payload.body.description
|
|
39
|
-
?
|
|
39
|
+
? `NL - ${event.payload.body.description}`
|
|
40
40
|
: undefined,
|
|
41
41
|
buttonText: event.payload.body.buttonText
|
|
42
|
-
?
|
|
42
|
+
? `NL - ${event.payload.body.buttonText}`
|
|
43
43
|
: undefined,
|
|
44
44
|
choices: event.payload.body.choices
|
|
45
45
|
? event.payload.body.choices.map((choice) => ({
|
|
46
46
|
...choice,
|
|
47
|
-
text:
|
|
47
|
+
text: `NL - ${choice.text}`,
|
|
48
48
|
}))
|
|
49
49
|
: undefined,
|
|
50
50
|
prompt: event.payload.body.prompt
|
|
51
51
|
? {
|
|
52
52
|
...event.payload.body.prompt,
|
|
53
|
-
text:
|
|
53
|
+
text: `NL - ${event.payload.body.prompt.text}`,
|
|
54
54
|
}
|
|
55
55
|
: undefined,
|
|
56
56
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
visibilityStates,
|
|
3
2
|
randomId,
|
|
4
|
-
SeamlyOfflineError,
|
|
5
3
|
SeamlyGeneralError,
|
|
4
|
+
SeamlyOfflineError,
|
|
5
|
+
visibilityStates,
|
|
6
6
|
} from '@seamly/web-ui'
|
|
7
7
|
import { addTranslationData } from './state-helpers'
|
|
8
8
|
|
|
@@ -713,7 +713,9 @@ const uploadBusy = {
|
|
|
713
713
|
complete: false,
|
|
714
714
|
error: '',
|
|
715
715
|
uploadHandle: {
|
|
716
|
-
abort: () => {
|
|
716
|
+
abort: () => {
|
|
717
|
+
// do nothing
|
|
718
|
+
},
|
|
717
719
|
},
|
|
718
720
|
}
|
|
719
721
|
|
|
@@ -725,7 +727,7 @@ const uploadError = {
|
|
|
725
727
|
complete: false,
|
|
726
728
|
error: 'Something went wrong with the upload',
|
|
727
729
|
uploadHandle: {
|
|
728
|
-
abort: () =>
|
|
730
|
+
abort: () => undefined,
|
|
729
731
|
},
|
|
730
732
|
}
|
|
731
733
|
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { useSeamlyOptions } from 'ui/hooks/seamly-hooks'
|
|
2
2
|
import { className } from 'lib/css'
|
|
3
3
|
import OptionsButton from 'ui/components/options/options-button'
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
OptionsButton as TranslationsOptionsButton,
|
|
7
|
-
} from 'domains/translations'
|
|
4
|
+
import { useTranslations } from 'domains/translations/hooks'
|
|
5
|
+
import TranslationsOptionsButton from 'domains/translations/components/options-button'
|
|
8
6
|
|
|
9
7
|
export default function AppOptions() {
|
|
10
8
|
const { menuOptions, allowOptionSelection } = useSeamlyOptions()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMemo } from 'preact/hooks'
|
|
2
|
-
import { useConfig } from 'domains/config'
|
|
2
|
+
import { useConfig } from 'domains/config/hooks'
|
|
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
|
-
import {
|
|
1
|
+
import { useI18n } from 'domains/i18n/hooks'
|
|
2
|
+
import { useVisibility } from 'domains/visibility/hooks'
|
|
2
3
|
import { className } from 'lib/css'
|
|
3
|
-
import {
|
|
4
|
+
import { useEffect, useRef } from 'preact/hooks'
|
|
5
|
+
import PrivacyDisclaimer from 'ui/components/layout/privacy-disclaimer'
|
|
4
6
|
import {
|
|
5
7
|
useSeamlyIsLoading,
|
|
6
8
|
useSkiplink,
|
|
7
9
|
useSkiplinkTargetFocusing,
|
|
8
10
|
} from 'ui/hooks/seamly-hooks'
|
|
9
11
|
import { useEvents, useLoadedImageEventIds } from 'ui/hooks/seamly-state-hooks'
|
|
10
|
-
import
|
|
11
|
-
import { useVisibility } from 'domains/visibility'
|
|
12
|
+
import ComponentFilter from './component-filter'
|
|
12
13
|
import Event from './event/event'
|
|
13
14
|
import Loader from './loader'
|
|
14
|
-
import ComponentFilter from './component-filter'
|
|
15
15
|
|
|
16
16
|
const Events = () => {
|
|
17
17
|
const events = useEvents()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useGeneratedId } from 'ui/hooks/seamly-hooks'
|
|
2
2
|
import MessageContainer from 'ui/components/conversation/message-container'
|
|
3
|
-
import { useTranslatedEventData } from 'domains/translations'
|
|
3
|
+
import { useTranslatedEventData } from 'domains/translations/hooks'
|
|
4
4
|
import CardComponent from './card-component'
|
|
5
5
|
|
|
6
6
|
const CardMessage = ({ event }) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import MessageContainer from 'ui/components/conversation/message-container'
|
|
2
2
|
import CarouselComponent from 'ui/components/conversation/event/carousel-component'
|
|
3
|
-
import { useTranslatedEventData } from 'domains/translations'
|
|
3
|
+
import { useTranslatedEventData } from 'domains/translations/hooks'
|
|
4
4
|
import CarouselMessageSlide from './components/slide'
|
|
5
5
|
|
|
6
6
|
const getItemKey = (item, idx, prefix = '') => `${prefix}${item.title}:${idx}`
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
import { className } from 'lib/css'
|
|
10
10
|
import { actionTypes } from 'ui/utils/seamly-utils'
|
|
11
11
|
import Icon from 'ui/components/layout/icon'
|
|
12
|
-
import { useI18n } from 'domains/i18n'
|
|
13
|
-
import { useTranslatedEventData } from 'domains/translations'
|
|
12
|
+
import { useI18n } from 'domains/i18n/hooks'
|
|
13
|
+
import { useTranslatedEventData } from 'domains/translations/hooks'
|
|
14
14
|
import MessageContainer from 'ui/components/conversation/message-container'
|
|
15
15
|
|
|
16
16
|
export const useChoicePrompt = (event) => {
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useUserHasResponded } from 'domains/app/hooks'
|
|
2
|
+
import { setHasResponded } from 'domains/app/slice'
|
|
3
|
+
import { useI18n } from 'domains/i18n/hooks'
|
|
4
|
+
import { useTranslatedEventData } from 'domains/translations/hooks'
|
|
2
5
|
import { className } from 'lib/css'
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
useSeamlyCommands,
|
|
6
|
-
useSeamlyDispatchContext,
|
|
7
|
-
} from 'ui/hooks/seamly-hooks'
|
|
8
|
-
import { useI18n } from 'domains/i18n'
|
|
9
|
-
import { useTranslatedEventData } from 'domains/translations'
|
|
10
|
-
import { useUserHasResponded } from 'domains/app'
|
|
11
|
-
import { setHasResponded } from 'domains/app/actions'
|
|
12
|
-
import { actionTypes } from 'ui/utils/seamly-utils'
|
|
6
|
+
import { useCallback, useMemo, useState } from 'preact/hooks'
|
|
7
|
+
import { useDispatch } from 'react-redux'
|
|
13
8
|
import MessageContainer from 'ui/components/conversation/message-container'
|
|
14
9
|
import SuggestionsList from 'ui/components/suggestions/suggestions-list'
|
|
10
|
+
import { useEvents, useSeamlyCommands } from 'ui/hooks/seamly-hooks'
|
|
11
|
+
import { actionTypes } from 'ui/utils/seamly-utils'
|
|
15
12
|
|
|
16
13
|
export const useSuggestions = (event) => {
|
|
17
14
|
const { payload } = event
|
|
@@ -25,8 +22,8 @@ export const useSuggestions = (event) => {
|
|
|
25
22
|
|
|
26
23
|
const ConversationSuggestions = ({ event, ...props }) => {
|
|
27
24
|
const [isExpanded, setIsExpanded] = useState(true)
|
|
28
|
-
const dispatch =
|
|
29
|
-
const
|
|
25
|
+
const dispatch = useDispatch()
|
|
26
|
+
const userHasResponded = useUserHasResponded()
|
|
30
27
|
const { sendAction, addMessageBubble } = useSeamlyCommands()
|
|
31
28
|
const { suggestions, payload } = useSuggestions(event)
|
|
32
29
|
const events = useEvents()
|
|
@@ -66,7 +63,7 @@ const ConversationSuggestions = ({ event, ...props }) => {
|
|
|
66
63
|
[dispatch, sendAction, payload.id, addMessageBubble],
|
|
67
64
|
)
|
|
68
65
|
|
|
69
|
-
if (!isExpanded ||
|
|
66
|
+
if (!isExpanded || userHasResponded || !hasLastTransactionEvent) {
|
|
70
67
|
return null
|
|
71
68
|
}
|
|
72
69
|
|
|
@@ -3,7 +3,7 @@ import { className } from 'lib/css'
|
|
|
3
3
|
import { useGeneratedId, useSeamlyCommands } from 'ui/hooks/seamly-hooks'
|
|
4
4
|
import { actionTypes } from 'ui/utils/seamly-utils'
|
|
5
5
|
import MessageContainer from 'ui/components/conversation/message-container'
|
|
6
|
-
import { useTranslatedEventData } from 'domains/translations'
|
|
6
|
+
import { useTranslatedEventData } from 'domains/translations/hooks'
|
|
7
7
|
import useEventLinkClickHandler from './hooks/use-event-link-click-handler'
|
|
8
8
|
|
|
9
9
|
const Cta = ({ event }) => {
|
package/src/javascripts/ui/components/conversation/event/divider/variants/new-translation.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { useI18n } from 'domains/i18n'
|
|
1
|
+
import { useI18n } from 'domains/i18n/hooks'
|
|
2
2
|
import EventDivider from 'ui/components/conversation/event-divider'
|
|
3
3
|
import { className } from 'lib/css'
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
useTranslations,
|
|
6
|
+
useLocaleNativeName,
|
|
7
|
+
} from 'domains/translations/hooks'
|
|
5
8
|
|
|
6
9
|
const NewTranslationDivider = ({ event }) => {
|
|
7
10
|
const { t } = useI18n()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useSeamlyParticipant } from 'ui/hooks/seamly-hooks'
|
|
2
2
|
import { className } from 'lib/css'
|
|
3
|
-
import { useConfig } from 'domains/config'
|
|
4
|
-
import { useI18n } from 'domains/i18n'
|
|
3
|
+
import { useConfig } from 'domains/config/hooks'
|
|
4
|
+
import { useI18n } from 'domains/i18n/hooks'
|
|
5
5
|
|
|
6
6
|
const EventParticipant = ({ eventPayload }) => {
|
|
7
7
|
const { t } = useI18n()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useI18n } from 'domains/i18n'
|
|
1
|
+
import { useI18n } from 'domains/i18n/hooks'
|
|
2
2
|
import { getRelativeDate } from 'ui/utils/general-utils'
|
|
3
|
-
import { useConfig } from 'domains/config'
|
|
3
|
+
import { useConfig } from 'domains/config/hooks'
|
|
4
4
|
|
|
5
5
|
const dateFormatOptions = { month: 'long', day: 'numeric', year: 'numeric' }
|
|
6
6
|
const timeFormatOptions = { hour: 'numeric', minute: 'numeric' }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState } from 'preact/hooks'
|
|
2
2
|
import Lightbox from 'ui/components/widgets/lightbox'
|
|
3
|
-
import { useI18n } from 'domains/i18n'
|
|
3
|
+
import { useI18n } from 'domains/i18n/hooks'
|
|
4
4
|
import { className } from 'lib/css'
|
|
5
5
|
import Icon from 'ui/components/layout/icon'
|
|
6
6
|
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
+
import { setLoadedImageEventIds } from 'domains/store/slice'
|
|
2
|
+
import { useTranslatedEventData } from 'domains/translations/hooks'
|
|
1
3
|
import { useState } from 'preact/hooks'
|
|
4
|
+
import { useDispatch } from 'react-redux'
|
|
2
5
|
import MessageContainer from 'ui/components/conversation/message-container'
|
|
3
|
-
import { useTranslatedEventData } from 'domains/translations'
|
|
4
|
-
import { useStoreDispatch } from 'domains/redux'
|
|
5
6
|
import ImageLightbox from './image-lightbox'
|
|
6
|
-
import { seamlyActions } from '../../../utils/seamly-utils'
|
|
7
|
-
|
|
8
|
-
const { SET_LOADED_IMAGE_EVENT_IDS } = seamlyActions
|
|
9
7
|
|
|
10
8
|
const Image = ({ event, descriptorId, ...props }) => {
|
|
11
9
|
const [body] = useTranslatedEventData(event)
|
|
12
10
|
const { description, url, isZoomable } = body
|
|
13
11
|
const [showLighbox, setShowLightbox] = useState(false)
|
|
14
|
-
const dispatch =
|
|
12
|
+
const dispatch = useDispatch()
|
|
15
13
|
|
|
16
14
|
const handleOnLoad = () => {
|
|
17
|
-
dispatch(
|
|
15
|
+
dispatch(setLoadedImageEventIds(event.payload.id))
|
|
18
16
|
setShowLightbox(true)
|
|
19
17
|
}
|
|
20
18
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import EventDivider from 'ui/components/conversation/event-divider'
|
|
2
|
-
import { useTranslatedEventData } from 'domains/translations'
|
|
2
|
+
import { useTranslatedEventData } from 'domains/translations/hooks'
|
|
3
3
|
|
|
4
4
|
const Participant = ({ event }) => {
|
|
5
5
|
const { participant } = event.payload
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { useTranslatedEventData } from 'domains/translations/hooks'
|
|
2
|
+
import useEventLinkClickHandler from 'ui/components/conversation/event/hooks/use-event-link-click-handler'
|
|
3
|
+
import MessageContainer from 'ui/components/conversation/message-container'
|
|
4
4
|
|
|
5
5
|
const Splash = ({ event, ...props }) => {
|
|
6
6
|
const { payload } = event
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo } from 'preact/hooks'
|
|
2
2
|
import MessageContainer from 'ui/components/conversation/message-container'
|
|
3
|
-
import { useTranslatedEventData } from 'domains/translations'
|
|
3
|
+
import { useTranslatedEventData } from 'domains/translations/hooks'
|
|
4
4
|
import useEventLinkClickHandler from './hooks/use-event-link-click-handler'
|
|
5
5
|
|
|
6
6
|
const Text = ({ event, ...props }) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useI18n } from 'domains/i18n'
|
|
1
|
+
import { useI18n } from 'domains/i18n/hooks'
|
|
2
2
|
import MessageContainer from 'ui/components/conversation/message-container'
|
|
3
|
-
import { useTranslatedEventData } from 'domains/translations'
|
|
3
|
+
import { useTranslatedEventData } from 'domains/translations/hooks'
|
|
4
4
|
|
|
5
5
|
const Translation = ({ event, ...props }) => {
|
|
6
6
|
const { t } = useI18n()
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useMemo } from 'preact/hooks'
|
|
2
2
|
import { className } from 'lib/css'
|
|
3
3
|
import Icon from 'ui/components/layout/icon'
|
|
4
|
-
import { useI18n } from 'domains/i18n'
|
|
4
|
+
import { useI18n } from 'domains/i18n/hooks'
|
|
5
5
|
import MessageContainer from 'ui/components/conversation/message-container'
|
|
6
|
-
import { useTranslatedEventData } from 'domains/translations'
|
|
6
|
+
import { useTranslatedEventData } from 'domains/translations/hooks'
|
|
7
7
|
|
|
8
8
|
const UploadContent = ({ children, url, target }) =>
|
|
9
9
|
url ? (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { className } from 'lib/css'
|
|
2
2
|
import { useSeamlyMessageContainerClassNames } from 'ui/hooks/seamly-hooks'
|
|
3
|
-
import { useTranslatedEventData } from 'domains/translations'
|
|
3
|
+
import { useTranslatedEventData } from 'domains/translations/hooks'
|
|
4
4
|
import MessageContainer from 'ui/components/conversation/message-container'
|
|
5
5
|
|
|
6
6
|
const Video = ({ event, descriptorId, ...props }) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { className } from 'lib/css'
|
|
2
2
|
import { useSeamlyMessageContainerClassNames } from 'ui/hooks/component-helper-hooks'
|
|
3
|
-
import { useTranslatedEventData } from 'domains/translations'
|
|
4
|
-
import { useI18n } from 'domains/i18n'
|
|
3
|
+
import { useTranslatedEventData } from 'domains/translations/hooks'
|
|
4
|
+
import { useI18n } from 'domains/i18n/hooks'
|
|
5
5
|
import EventParticipant from './event/event-participant'
|
|
6
6
|
|
|
7
7
|
function MessageContainer({
|
|
@@ -22,7 +22,7 @@ function MessageContainer({
|
|
|
22
22
|
useTranslatedEventData(event)
|
|
23
23
|
|
|
24
24
|
if (type) {
|
|
25
|
-
classNames.push(
|
|
25
|
+
classNames.push(`message--type-${type}`)
|
|
26
26
|
}
|
|
27
27
|
if (modifiers) {
|
|
28
28
|
if (typeof modifiers === 'string') {
|
|
@@ -30,7 +30,7 @@ function MessageContainer({
|
|
|
30
30
|
modifiers = modifiers.split(' ').filter((v) => v.length)
|
|
31
31
|
}
|
|
32
32
|
modifiers.forEach((modifier) => {
|
|
33
|
-
classNames.push(
|
|
33
|
+
classNames.push(`message--${modifier}`)
|
|
34
34
|
})
|
|
35
35
|
}
|
|
36
36
|
if (isTranslated) {
|