@seamly/web-ui 18.3.0 → 19.0.0-beta.3

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 (109) hide show
  1. package/build/dist/lib/index.debug.js +349 -74
  2. package/build/dist/lib/index.debug.min.js +1 -1
  3. package/build/dist/lib/index.debug.min.js.LICENSE.txt +108 -8
  4. package/build/dist/lib/index.js +6103 -5988
  5. package/build/dist/lib/index.min.js +1 -1
  6. package/build/dist/lib/index.min.js.LICENSE.txt +1 -1
  7. package/build/dist/lib/standalone.js +2414 -2226
  8. package/build/dist/lib/standalone.min.js +1 -1
  9. package/build/dist/lib/standalone.min.js.LICENSE.txt +1 -1
  10. package/build/dist/lib/storage.js +8 -1
  11. package/build/dist/lib/storage.min.js +1 -1
  12. package/build/dist/lib/style-guide.js +1517 -785
  13. package/build/dist/lib/style-guide.min.js +1 -1
  14. package/build/dist/lib/styles.css +1 -1
  15. package/package.json +27 -28
  16. package/src/javascripts/api/index.js +25 -40
  17. package/src/javascripts/api/producer.js +3 -6
  18. package/src/javascripts/config.js +3 -3
  19. package/src/javascripts/domains/app/actions.js +28 -11
  20. package/src/javascripts/domains/app/hooks.js +6 -0
  21. package/src/javascripts/domains/app/index.js +3 -0
  22. package/src/javascripts/domains/app/reducer.js +16 -0
  23. package/src/javascripts/domains/app/selectors.js +8 -0
  24. package/src/javascripts/domains/app/utils.js +4 -0
  25. package/src/javascripts/domains/config/actions.js +1 -3
  26. package/src/javascripts/domains/config/middleware.js +0 -4
  27. package/src/javascripts/domains/config/reducer.js +2 -13
  28. package/src/javascripts/domains/config/selectors.js +3 -3
  29. package/src/javascripts/domains/config/utils.js +4 -0
  30. package/src/javascripts/domains/forms/actions.js +1 -3
  31. package/src/javascripts/domains/forms/reducer.js +1 -2
  32. package/src/javascripts/domains/forms/selectors.js +2 -2
  33. package/src/javascripts/domains/forms/utils.js +5 -0
  34. package/src/javascripts/domains/i18n/actions.js +20 -0
  35. package/src/javascripts/domains/i18n/hooks.js +38 -0
  36. package/src/javascripts/domains/i18n/index.js +5 -84
  37. package/src/javascripts/domains/i18n/reducer.js +64 -0
  38. package/src/javascripts/domains/i18n/selectors.js +15 -0
  39. package/src/javascripts/domains/i18n/utils.js +4 -0
  40. package/src/javascripts/domains/interrupt/actions.js +1 -3
  41. package/src/javascripts/domains/interrupt/reducer.js +1 -2
  42. package/src/javascripts/domains/interrupt/selectors.js +3 -2
  43. package/src/javascripts/domains/interrupt/utils.js +4 -0
  44. package/src/javascripts/domains/redux/hooks.js +1 -0
  45. package/src/javascripts/domains/store/index.js +7 -1
  46. package/src/javascripts/domains/translations/actions.js +1 -3
  47. package/src/javascripts/domains/translations/components/chat-status.js +1 -1
  48. package/src/javascripts/domains/translations/components/options-dialog/form.js +11 -6
  49. package/src/javascripts/domains/translations/index.js +1 -0
  50. package/src/javascripts/domains/translations/middleware.js +43 -0
  51. package/src/javascripts/domains/translations/reducer.js +2 -9
  52. package/src/javascripts/domains/translations/selectors.js +2 -2
  53. package/src/javascripts/domains/translations/utils.js +4 -0
  54. package/src/javascripts/index.js +3 -0
  55. package/src/javascripts/lib/engine/index.js +1 -0
  56. package/src/javascripts/lib/mutex.js +30 -0
  57. package/src/javascripts/lib/redux-helpers/index.js +55 -16
  58. package/src/javascripts/lib/store/providers/session-storage.js +6 -1
  59. package/src/javascripts/style-guide/components/app.js +7 -2
  60. package/src/javascripts/style-guide/components/static-core.js +9 -3
  61. package/src/javascripts/style-guide/states.js +8 -8
  62. package/src/javascripts/style-guide/style-guide-engine.js +14 -11
  63. package/src/javascripts/ui/components/conversation/event/divider/variants/new-translation.js +1 -1
  64. package/src/javascripts/ui/components/conversation/event/upload.js +2 -2
  65. package/src/javascripts/ui/components/core/seamly-activity-monitor.js +2 -0
  66. package/src/javascripts/ui/components/core/seamly-event-subscriber.js +2 -0
  67. package/src/javascripts/ui/components/core/seamly-instance-functions-loader.js +1 -7
  68. package/src/javascripts/ui/components/core/seamly-new-notifications.js +5 -6
  69. package/src/javascripts/ui/components/core/seamly-read-state.js +6 -4
  70. package/src/javascripts/ui/components/entry/text-entry/hooks.js +6 -4
  71. package/src/javascripts/ui/components/entry/text-entry/text-entry-form.js +10 -3
  72. package/src/javascripts/ui/components/entry/upload/file-upload-form.js +6 -3
  73. package/src/javascripts/ui/components/entry/upload/index.js +8 -3
  74. package/src/javascripts/ui/components/faq/faq.js +2 -2
  75. package/src/javascripts/ui/components/layout/app-frame.js +11 -8
  76. package/src/javascripts/ui/components/layout/interrupt.js +6 -2
  77. package/src/javascripts/ui/components/warnings/resume-conversation-prompt.js +1 -1
  78. package/src/javascripts/ui/components/widgets/upload-progress.js +1 -1
  79. package/src/javascripts/ui/hooks/seamly-api-hooks.js +0 -6
  80. package/src/javascripts/ui/hooks/seamly-entry-hooks.js +17 -21
  81. package/src/javascripts/ui/hooks/seamly-hooks.js +0 -1
  82. package/src/javascripts/ui/hooks/use-seamly-commands.js +5 -6
  83. package/src/javascripts/ui/hooks/use-seamly-visibility.js +3 -5
  84. package/src/javascripts/ui/hooks/use-single-file-upload.js +4 -1
  85. package/src/javascripts/ui/utils/general-utils.js +6 -13
  86. package/src/stylesheets/1-settings/_config.scss +2 -1
  87. package/src/stylesheets/3-app/_app.scss +3 -4
  88. package/src/stylesheets/5-components/_faq.scss +3 -8
  89. package/src/stylesheets/5-components/_modal.scss +3 -3
  90. package/webpack/config.package.js +0 -18
  91. package/webpack/config.site.js +6 -0
  92. package/webpack/defaults.js +0 -3
  93. package/CHANGELOG.md +0 -573
  94. package/build/dist/translations/de-informal.js +0 -274
  95. package/build/dist/translations/de-informal.min.js +0 -1
  96. package/build/dist/translations/en.js +0 -274
  97. package/build/dist/translations/en.min.js +0 -1
  98. package/build/dist/translations/es-informal.js +0 -280
  99. package/build/dist/translations/es-informal.min.js +0 -1
  100. package/build/dist/translations/nl-formal.js +0 -274
  101. package/build/dist/translations/nl-formal.min.js +0 -1
  102. package/build/dist/translations/nl-informal.js +0 -274
  103. package/build/dist/translations/nl-informal.min.js +0 -1
  104. package/src/javascripts/lib/i18n.js +0 -46
  105. package/translations/de-informal.js +0 -235
  106. package/translations/en.js +0 -232
  107. package/translations/es-informal.js +0 -241
  108. package/translations/nl-formal.js +0 -228
  109. package/translations/nl-informal.js +0 -228
@@ -4,7 +4,7 @@ import { useSeamlyStateContext } from './seamly-state-hooks'
4
4
  import useSeamlyDispatchContext from './use-seamly-dispatch'
5
5
  import { useSeamlyOptions } from './seamly-option-hooks'
6
6
  import useSeamlyCommands from './use-seamly-commands'
7
- import { useConfig } from '../../domains/config'
7
+ import { typingTimeout } from '../../config'
8
8
 
9
9
  const {
10
10
  SET_BLOCK_AUTO_ENTRY_SWITCH,
@@ -14,19 +14,18 @@ const {
14
14
 
15
15
  export const useSeamlyTyping = () => {
16
16
  const { sendAction } = useSeamlyCommands()
17
- const { typing: typingConfig } = useConfig()
18
17
  const { features } = useSeamlyOptions()
19
18
  const { typingPeekahead } = features || {}
20
- const typingTimeout = useRef(null)
21
- const sendEndTypingTimeout = useRef(null)
19
+ const typingTimerId = useRef(null)
20
+ const sendEndTypingTimerId = useRef(null)
22
21
  const isTyping = useRef(false)
23
- const typingInterval = useRef(null)
22
+ const typingIntervalId = useRef(null)
24
23
 
25
24
  useEffect(() => {
26
25
  return () => {
27
- clearInterval(typingInterval.current)
28
- clearTimeout(typingTimeout.current)
29
- clearTimeout(sendEndTypingTimeout.current)
26
+ clearInterval(typingIntervalId.current)
27
+ clearTimeout(typingTimerId.current)
28
+ clearTimeout(sendEndTypingTimerId.current)
30
29
  }
31
30
  }, [])
32
31
 
@@ -48,33 +47,30 @@ export const useSeamlyTyping = () => {
48
47
  if ((e.code && e.code === 'Enter') || e.keyCode === 13) {
49
48
  return
50
49
  }
51
- if (!typingConfig) {
52
- return
53
- }
54
50
 
55
51
  isTyping.current = true
56
- if (!typingInterval.current) {
52
+ if (!typingIntervalId.current) {
57
53
  sendTypingState(true, e.target.value)
58
- typingInterval.current = setInterval(() => {
54
+ typingIntervalId.current = setInterval(() => {
59
55
  if (!isTyping.current) {
60
- clearInterval(typingInterval.current)
61
- typingInterval.current = null
56
+ clearInterval(typingIntervalId.current)
57
+ typingIntervalId.current = null
62
58
  } else if (typingPeekahead && typingPeekahead.enabled) {
63
59
  sendTypingState(true, e.target.value)
64
60
  }
65
- }, typingConfig.timeout)
61
+ }, typingTimeout)
66
62
  }
67
63
 
68
- clearTimeout(typingTimeout.current)
69
- clearTimeout(sendEndTypingTimeout.current)
64
+ clearTimeout(typingTimerId.current)
65
+ clearTimeout(sendEndTypingTimerId.current)
70
66
 
71
- typingTimeout.current = setTimeout(() => {
67
+ typingTimerId.current = setTimeout(() => {
72
68
  isTyping.current = false
73
69
  }, 300)
74
70
 
75
- sendEndTypingTimeout.current = setTimeout(() => {
71
+ sendEndTypingTimerId.current = setTimeout(() => {
76
72
  sendTypingState(false, e.target.value)
77
- }, typingConfig.timeout)
73
+ }, typingTimeout)
78
74
  }
79
75
  }
80
76
 
@@ -24,7 +24,6 @@ export {
24
24
  export {
25
25
  useSeamlyApiContext,
26
26
  useSeamlyConversationUrl,
27
- useSeamlyHasUserResponded,
28
27
  } from './seamly-api-hooks'
29
28
  export { default as useSeamlyDispatchContext } from './use-seamly-dispatch'
30
29
  export {
@@ -2,7 +2,6 @@ import { useCallback, useContext } from 'preact/hooks'
2
2
  import {
3
3
  useSeamlyApiContext,
4
4
  useSeamlyHasConversation,
5
- useSeamlyHasUserResponded,
6
5
  } from './seamly-api-hooks'
7
6
  import {
8
7
  useSeamlyStateContext,
@@ -17,6 +16,7 @@ import { actionTypes, seamlyActions } from '../utils/seamly-utils'
17
16
  import { useStableCallback } from './utility-hooks'
18
17
  import { Actions as InterruptActions } from '../../domains/interrupt'
19
18
  import { useConfig } from '../../domains/config'
19
+ import { useUserHasResponded } from '../../domains/app'
20
20
 
21
21
  const {
22
22
  ADD_EVENT,
@@ -37,7 +37,7 @@ const useSeamlyCommands = () => {
37
37
  const dispatch = useSeamlyDispatchContext()
38
38
  const eventBus = useContext(SeamlyEventBusContext)
39
39
 
40
- const hasResponded = useSeamlyHasUserResponded()
40
+ const hasResponded = useUserHasResponded()
41
41
  const hasConversation = useSeamlyHasConversation()
42
42
  const { visible: visibility } = useSeamlyStateContext()
43
43
  const unreadMessageCount = useSeamlyUnreadCount()
@@ -75,8 +75,8 @@ const useSeamlyCommands = () => {
75
75
  ])
76
76
 
77
77
  const reset = useCallback(async () => {
78
- dispatch({ type: CLEAR_EVENTS })
79
78
  dispatch(InterruptActions.clear())
79
+ dispatch({ type: CLEAR_EVENTS })
80
80
  dispatch({
81
81
  type: SET_IS_LOADING,
82
82
  isLoading: true,
@@ -96,11 +96,10 @@ const useSeamlyCommands = () => {
96
96
  })
97
97
 
98
98
  try {
99
- const { accountConfig = {}, initialState = {} } = await api.reset()
100
- const { features } = accountConfig || {}
99
+ const { features } = await api.reset()
101
100
 
102
101
  dispatch({ type: SET_FEATURES, features })
103
- dispatch({ type: SET_INITIAL_STATE, initialState })
102
+ dispatch({ type: SET_INITIAL_STATE, initialState: {} })
104
103
  } catch (error) {
105
104
  dispatch(InterruptActions.set(error))
106
105
  }
@@ -5,10 +5,7 @@ import {
5
5
  } from './seamly-state-hooks'
6
6
  import useSeamlyCommands from './use-seamly-commands'
7
7
  import useSeamlyDispatchContext from './use-seamly-dispatch'
8
- import {
9
- useSeamlyHasConversation,
10
- useSeamlyHasUserResponded,
11
- } from './seamly-api-hooks'
8
+ import { useSeamlyHasConversation } from './seamly-api-hooks'
12
9
  import useSeamlyStoredVisibility from './use-seamly-stored-visibility'
13
10
  import {
14
11
  calculateVisibility,
@@ -16,6 +13,7 @@ import {
16
13
  visibilityStates,
17
14
  } from '../utils/seamly-utils'
18
15
  import { useConfig } from '../../domains/config'
16
+ import { useUserHasResponded } from '../../domains/app'
19
17
 
20
18
  const { SET_VISIBILITY } = seamlyActions
21
19
 
@@ -26,7 +24,7 @@ const useSeamlyVisibility = () => {
26
24
  const { emitEvent } = useSeamlyCommands()
27
25
  const dispatch = useSeamlyDispatchContext()
28
26
  const [storedVisibility, setStoredVisibility] = useSeamlyStoredVisibility()
29
- const hasResponded = useSeamlyHasUserResponded()
27
+ const hasResponded = useUserHasResponded()
30
28
  const hasConversation = useSeamlyHasConversation()
31
29
  const unreadMessageCount = useSeamlyUnreadCount()
32
30
  const isVisible = visible ? visible !== visibilityStates.hidden : false
@@ -13,6 +13,8 @@ const useSingleFileUpload = (formId, name) => {
13
13
  // This hook HAS to be used inside the FormBoundary of the file upload.
14
14
  const { currentUploads } = useFileUploads()
15
15
 
16
+ const hasFile = fileList && fileList.length > 0
17
+
16
18
  let uploadHandle = null
17
19
  let hasServerError = false
18
20
  let progress = 0
@@ -24,7 +26,8 @@ const useSingleFileUpload = (formId, name) => {
24
26
  }
25
27
 
26
28
  return {
27
- selectedFileName: fileList && fileList.length > 0 ? fileList[0].name : '',
29
+ hasFile,
30
+ selectedFileName: hasFile ? fileList[0].name : '',
28
31
  uploadHandle,
29
32
  hasServerError,
30
33
  progress,
@@ -195,21 +195,14 @@ export const getRelativeDate = (date, currentDate) => {
195
195
  }
196
196
  }
197
197
 
198
- export const flattenObject = (obj, prefix = '') =>
199
- Object.keys(obj).reduce((acc, k) => {
200
- const pre = prefix.length ? `${prefix}.` : ''
201
- if (
202
- typeof obj[k] === 'object' &&
203
- obj[k] !== null &&
204
- Object.keys(obj[k]).length > 0
205
- )
206
- Object.assign(acc, flattenObject(obj[k], pre + k))
207
- else acc[pre + k] = obj[k]
208
- return acc
209
- }, {})
210
-
211
198
  export const pick = (obj, keys) =>
212
199
  keys.reduce((accum, key) => {
213
200
  if (key in obj) accum[key] = obj[key]
214
201
  return accum
215
202
  }, {})
203
+
204
+ export const omit = (obj, keys) =>
205
+ Object.keys(obj).reduce((accum, key) => {
206
+ if (!keys.includes(key)) accum[key] = obj[key]
207
+ return accum
208
+ }, {})
@@ -81,7 +81,8 @@ $app-started-width: 375px !default;
81
81
  $app-full-height: 720px !default;
82
82
  $app-collapsed-height: 54px !default;
83
83
 
84
- $app-inline-height: 480px !default;
84
+ $app-inline-min-height: 480px !default;
85
+ $app-inline-max-height: 720px !default;
85
86
 
86
87
  $post-full-height: 170px !default;
87
88
  $post-collapsed-height: 65px !default;
@@ -31,16 +31,15 @@ $app-header-bgcolor: $brand3;
31
31
  right: auto;
32
32
  bottom: auto;
33
33
  width: auto;
34
- height: 100vh;
35
- min-height: $spacer * 24;
36
- max-height: $spacer * 32;
34
+ height: 90vh;
35
+ min-height: $app-inline-min-height;
36
+ max-height: $app-inline-max-height;
37
37
  transition: height $transition, width $transition;
38
38
  background-color: initial;
39
39
  box-shadow: none;
40
40
 
41
41
  @include media('>phablet-l') {
42
42
  display: block;
43
- height: $app-inline-height;
44
43
  border: 0 none;
45
44
  }
46
45
  }
@@ -9,8 +9,6 @@
9
9
 
10
10
  &.#{$n}-app--layout-window .#{$n}-faqs {
11
11
  overscroll-behavior: contain;
12
- /* stylelint-disable-next-line property-no-vendor-prefix */
13
- -ms-scroll-chaining: none;
14
12
  }
15
13
 
16
14
  &.#{$n}-app--layout-inline .#{$n}-faqs {
@@ -20,9 +18,9 @@
20
18
  left: 50%;
21
19
  flex-direction: column;
22
20
  width: 50%;
23
- height: $app-inline-height;
24
- min-height: $spacer * 24;
25
- max-height: 100%;
21
+ height: 100%;
22
+ min-height: 100%;
23
+ overflow: hidden;
26
24
  transform: translateX(-100%);
27
25
  border: $thin-border solid set-border-color($app-bg);
28
26
  border-left: 0;
@@ -59,9 +57,6 @@
59
57
 
60
58
  &.#{$n}-app--layout-inline .#{$n}-faqs.#{$n}-transition--in {
61
59
  @include media('>phablet-l') {
62
- height: $app-inline-height;
63
- min-height: $spacer * 24;
64
- max-height: 100%;
65
60
  overflow-y: initial;
66
61
  transform: translateX(0%);
67
62
  }
@@ -130,9 +130,9 @@ $button-transition: $transition;
130
130
 
131
131
  &:hover {
132
132
  background-color: $brand3;
133
+ }
133
134
 
134
- svg path {
135
- fill: $app-bg;
136
- }
135
+ &:hover .cvco-icon svg path {
136
+ fill: $white;
137
137
  }
138
138
  }
@@ -16,7 +16,6 @@ module.exports = (env = {}, argv = {}, configOverrides = {}) => {
16
16
  const {
17
17
  BUILD_ROOT,
18
18
  SRC_ROOT,
19
- TRANSLATIONS_ROOT,
20
19
 
21
20
  ROOT,
22
21
 
@@ -43,7 +42,6 @@ module.exports = (env = {}, argv = {}, configOverrides = {}) => {
43
42
  ...Object.keys(pkg.peerDependencies || {}).map(
44
43
  (key) => new RegExp(`^${key}(\\/.*)`, 'i'),
45
44
  ),
46
- /^@seamly\/web-ui\/translations(\/.*)?/i,
47
45
  ],
48
46
  module: {
49
47
  rules: [
@@ -101,21 +99,6 @@ module.exports = (env = {}, argv = {}, configOverrides = {}) => {
101
99
  externals: [/^@seamly\/web-ui(\/.*)?/i],
102
100
  })
103
101
 
104
- const translationFiles = glob.sync(path.join(TRANSLATIONS_ROOT, '*.js'))
105
- const translationEntries = translationFiles.reduce((entries, file) => {
106
- const fileName = path.parse(file).name
107
- return {
108
- ...entries,
109
- [fileName]: file,
110
- }
111
- }, {})
112
- const translationsConfig = webpackMerge(baseConfig, {
113
- entry: translationEntries,
114
- output: {
115
- path: path.join(BUILD_ROOT, '/dist/translations'),
116
- },
117
- })
118
-
119
102
  const standalonePackageConfig = {
120
103
  ...packageConfig,
121
104
  output: {
@@ -193,7 +176,6 @@ module.exports = (env = {}, argv = {}, configOverrides = {}) => {
193
176
  standalonePackageConfig,
194
177
  styleguideConfig,
195
178
  externalsConfig,
196
- translationsConfig,
197
179
  ]
198
180
 
199
181
  const configsMinimized = configs.map((config) =>
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable */
2
2
  const path = require('path')
3
3
  const site = require('@seamly/doc-site/lib/config/site')
4
+ const CopyPlugin = require('copy-webpack-plugin')
4
5
  const webpackMerge = require('webpack-merge').merge
5
6
  const defaultConfig = require('./defaults')
6
7
  const generateCommonConfig = require('./config.common')
@@ -24,6 +25,11 @@ module.exports = (env = {}, argv = {}, configOverrides = {}, options = {}) => {
24
25
  implConfig
25
26
 
26
27
  let config = {
28
+ plugins: [
29
+ new CopyPlugin({
30
+ patterns: [{ from: 'public/static', to: 'static' }],
31
+ }),
32
+ ],
27
33
  entry: {
28
34
  // Changelog
29
35
  changelog: path.join(ROOT, 'CHANGELOG.md'),
@@ -6,7 +6,6 @@ const BROWSERS = 'last 1 version, > 1%, not dead, not ie 11, not ie_mob 11'
6
6
  const ROOT = path.resolve(__dirname, '..')
7
7
  const BUILD_ROOT = path.join(ROOT, 'build')
8
8
  const SRC_ROOT = path.join(ROOT, 'src')
9
- const TRANSLATIONS_ROOT = path.join(ROOT, 'translations')
10
9
  const PUBLIC_ROOT = path.join(ROOT, 'public')
11
10
  const PUBLIC_TEST_ROOT = path.join(PUBLIC_ROOT, 'test')
12
11
  const PUBLIC_STYLEGUIDE_ROOT = path.join(PUBLIC_ROOT, 'style-guide')
@@ -43,7 +42,6 @@ const ALIASSES = {
43
42
  SRC_ROOT,
44
43
  'javascripts/style-guide.js',
45
44
  ),
46
- '@seamly/web-ui/translations': TRANSLATIONS_ROOT,
47
45
  '@seamly/web-ui/src/stylesheets/styles.scss': path.resolve(
48
46
  SRC_ROOT,
49
47
  'stylesheets',
@@ -64,7 +62,6 @@ module.exports = {
64
62
  ROOT,
65
63
  BUILD_ROOT,
66
64
  SRC_ROOT,
67
- TRANSLATIONS_ROOT,
68
65
  PUBLIC_ROOT,
69
66
 
70
67
  PUBLIC_TEST_ROOT,