@seamly/web-ui 22.3.0-beta.1 → 22.3.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 (51) hide show
  1. package/build/dist/lib/components.js +342 -314
  2. package/build/dist/lib/components.js.map +1 -1
  3. package/build/dist/lib/components.min.js +1 -1
  4. package/build/dist/lib/components.min.js.map +1 -1
  5. package/build/dist/lib/hooks.js +312 -297
  6. package/build/dist/lib/hooks.js.map +1 -1
  7. package/build/dist/lib/hooks.min.js +1 -1
  8. package/build/dist/lib/hooks.min.js.map +1 -1
  9. package/build/dist/lib/index.debug.js +192 -120
  10. package/build/dist/lib/index.debug.js.map +1 -1
  11. package/build/dist/lib/index.debug.min.js +1 -1
  12. package/build/dist/lib/index.debug.min.js.LICENSE.txt +4 -4
  13. package/build/dist/lib/index.debug.min.js.map +1 -1
  14. package/build/dist/lib/index.js +433 -250
  15. package/build/dist/lib/index.js.map +1 -1
  16. package/build/dist/lib/index.min.js +1 -1
  17. package/build/dist/lib/index.min.js.map +1 -1
  18. package/build/dist/lib/standalone.js +849 -262
  19. package/build/dist/lib/standalone.js.map +1 -1
  20. package/build/dist/lib/standalone.min.js +1 -1
  21. package/build/dist/lib/standalone.min.js.map +1 -1
  22. package/build/dist/lib/storage.min.js.map +1 -1
  23. package/build/dist/lib/style-guide.js +293 -248
  24. package/build/dist/lib/style-guide.js.map +1 -1
  25. package/build/dist/lib/style-guide.min.js +1 -1
  26. package/build/dist/lib/style-guide.min.js.map +1 -1
  27. package/build/dist/lib/styles-default-implementation.css +1 -1
  28. package/build/dist/lib/styles.css +1 -1
  29. package/build/dist/lib/utils.js +381 -341
  30. package/build/dist/lib/utils.js.map +1 -1
  31. package/build/dist/lib/utils.min.js +1 -1
  32. package/build/dist/lib/utils.min.js.map +1 -1
  33. package/package.json +1 -1
  34. package/src/javascripts/api/conversation-connector.ts +6 -9
  35. package/src/javascripts/domains/translations/components/options-dialog/translation-option.tsx +1 -1
  36. package/src/javascripts/style-guide/states.js +8 -0
  37. package/src/javascripts/ui/components/chat-status/chat-status-action.tsx +2 -2
  38. package/src/javascripts/ui/components/conversation/event/carousel-component/components/controls.js +2 -2
  39. package/src/javascripts/ui/components/conversation/event/choice-prompt.js +1 -1
  40. package/src/javascripts/ui/components/conversation/event/image-lightbox.js +1 -1
  41. package/src/javascripts/ui/components/conversation/event-divider.js +6 -1
  42. package/src/javascripts/ui/components/core/seamly-event-subscriber.ts +20 -15
  43. package/src/javascripts/ui/components/form-controls/error.js +1 -1
  44. package/src/javascripts/ui/components/form-controls/file-input.js +1 -1
  45. package/src/javascripts/ui/components/layout/agent-info.js +1 -1
  46. package/src/javascripts/ui/components/layout/{icon.js → icon.tsx} +74 -37
  47. package/src/javascripts/ui/components/options/options-button.js +1 -1
  48. package/src/javascripts/ui/components/suggestions/suggestions-item.js +1 -1
  49. package/src/javascripts/ui/components/view/window-view/window-open-button.js +1 -1
  50. package/src/javascripts/ui/components/widgets/lightbox.js +1 -1
  51. package/src/stylesheets/5-components/_message-card.scss +4 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamly/web-ui",
3
- "version": "22.3.0-beta.1",
3
+ "version": "22.3.0-beta.3",
4
4
  "main": "build/dist/lib/index.js",
5
5
  "types": "build/src/javascripts/index.d.ts",
6
6
  "module": "",
@@ -46,11 +46,12 @@ export default class ConversationConnector {
46
46
  this.channelTopic = channelTopic
47
47
  const { url: splittedUrl, params } = splitUrlParams(this.url)
48
48
 
49
- this.socket = new Socket(splittedUrl, {
50
- params: { ...params, v: apiVersion },
51
- })
52
-
53
- this.socket.connect()
49
+ if (!this.socket) {
50
+ this.socket = new Socket(splittedUrl, {
51
+ params: { ...params, v: apiVersion },
52
+ })
53
+ this.socket.connect()
54
+ }
54
55
 
55
56
  this.channel = this.socket.channel(this.channelTopic, {
56
57
  authorization: `Bearer ${this.accessToken}`,
@@ -138,8 +139,6 @@ export default class ConversationConnector {
138
139
  ready: false,
139
140
  currentState: 'join_channel_erred',
140
141
  })
141
- // @ts-ignore
142
- this.channel.socket.disconnect()
143
142
  })
144
143
  .receive('timeout', () => {
145
144
  log('[CHANEL][JOIN] Networking issue. Still waiting...')
@@ -149,8 +148,6 @@ export default class ConversationConnector {
149
148
  disconnect() {
150
149
  this.channel?.leave().receive('ok', () => {
151
150
  log('[CHANNEL][LEAVE] OK')
152
- this.socket?.remove(this.channel)
153
- this.socket?.disconnect()
154
151
  this.#connectionListeners = []
155
152
  })
156
153
  }
@@ -36,7 +36,7 @@ const TranslationOption: FC<TranslationOptionProps> = ({
36
36
  onKeyDown={onKeyDown}
37
37
  id={id}
38
38
  >
39
- <Icon alt="" name="check" size="16" />
39
+ <Icon name="check" size="16" alt="" />
40
40
  {label} {description && <span>({description})</span>}
41
41
  </li>
42
42
  )
@@ -1280,6 +1280,7 @@ const standardState = {
1280
1280
  cardAskText.payload.body,
1281
1281
  cardNavigate.payload.body,
1282
1282
  cardTopic.payload.body,
1283
+ cardNoImage.payload.body,
1283
1284
  ],
1284
1285
  },
1285
1286
  },
@@ -1612,6 +1613,13 @@ const standardState = {
1612
1613
  sendTranscript: { enabled: true },
1613
1614
  },
1614
1615
  },
1616
+ config: {
1617
+ ...baseState.config,
1618
+ context: {
1619
+ ...baseState.context,
1620
+ locale: 'nl',
1621
+ },
1622
+ },
1615
1623
  translations: {
1616
1624
  ...translationsSlice,
1617
1625
  isAvailable: true,
@@ -1,9 +1,9 @@
1
- import Icon from 'ui/components/layout/icon'
1
+ import Icon, { IconProps } from 'ui/components/layout/icon'
2
2
  import { className } from 'lib/css'
3
3
 
4
4
  type ChatStatusActionProps = {
5
5
  handleClick: () => void
6
- icon: string
6
+ icon: IconProps['name']
7
7
  title: string
8
8
  srButtonText?: string
9
9
  }
@@ -24,7 +24,7 @@ export default function CarouselControls({
24
24
  aria-label={t('carousel.controls.previous')}
25
25
  onClick={handlePrevious}
26
26
  >
27
- <Icon name="arrowLeft" size="16" />
27
+ <Icon name="arrowLeft" size="16" alt="" />
28
28
  </button>
29
29
  {children}
30
30
  <button
@@ -32,7 +32,7 @@ export default function CarouselControls({
32
32
  aria-label={t('carousel.controls.next')}
33
33
  onClick={handleNext}
34
34
  >
35
- <Icon name="arrowRight" size="16" />
35
+ <Icon name="arrowRight" size="16" alt="" />
36
36
  </button>
37
37
  </div>
38
38
  )
@@ -119,7 +119,7 @@ const ChoicePrompt = ({ event, children, ...props }) => {
119
119
  {showOptions
120
120
  ? t('message.choicePrompts.cancelChooseAgain')
121
121
  : t('message.choicePrompts.chooseAgain')}
122
- <Icon name="chevronDown" size="8" />
122
+ <Icon name="chevronDown" size="8" alt="" />
123
123
  </button>
124
124
  )}
125
125
  {showOptions && (
@@ -24,7 +24,7 @@ const ImageLightbox = ({ description, url }) => {
24
24
  onClick={onOpenLightboxHandler}
25
25
  >
26
26
  {t('message.image.srTextEnlargeButtonLabel', { description })}
27
- <Icon name="enlarge" size="32" />
27
+ <Icon name="enlarge" size="32" alt="" />
28
28
  </button>
29
29
  {showLightBox && (
30
30
  <Lightbox
@@ -31,7 +31,12 @@ export default function EventDivider({
31
31
  {hasGraphic && (
32
32
  <span className={className('divider__graphic')}>
33
33
  {iconName ? (
34
- <Icon name={iconName} size={iconSize} className={iconClassName} />
34
+ <Icon
35
+ name={iconName}
36
+ size={iconSize}
37
+ className={iconClassName}
38
+ alt=""
39
+ />
35
40
  ) : (
36
41
  <img
37
42
  src={graphicSrc}
@@ -71,21 +71,26 @@ const SeamlyEventSubscriber = () => {
71
71
  }, [api, api.connectionInfo, api.conversation.socket, dispatch])
72
72
 
73
73
  useEffect(() => {
74
- api.conversation.onConnection(({ currentState }) => {
75
- if (currentState === 'join_channel_erred') {
76
- const seamlyGeneralError = new SeamlyGeneralError()
77
- dispatch(
78
- setInterrupt({
79
- name: seamlyGeneralError.name,
80
- message: seamlyGeneralError.message,
81
- langKey: seamlyGeneralError.langKey,
82
- originalEvent: seamlyGeneralError.originalEvent,
83
- originalError: seamlyGeneralError.originalError,
84
- action: seamlyGeneralError.action,
85
- }),
86
- )
87
- }
88
- })
74
+ if (api.connectionInfo && api.conversation.socket) {
75
+ api.conversation.onConnection(({ currentState }) => {
76
+ if (currentState === 'join_channel_erred') {
77
+ const seamlyGeneralError = new SeamlyGeneralError()
78
+ dispatch(
79
+ setInterrupt({
80
+ name: seamlyGeneralError.name,
81
+ message: seamlyGeneralError.message,
82
+ langKey: seamlyGeneralError.langKey,
83
+ originalEvent: seamlyGeneralError.originalEvent,
84
+ originalError: seamlyGeneralError.originalError,
85
+ action: seamlyGeneralError.action,
86
+ }),
87
+ )
88
+
89
+ return true
90
+ }
91
+ return false
92
+ })
93
+ }
89
94
  }, [api, api.connectionInfo, api.conversation.channel, dispatch])
90
95
 
91
96
  useEffect(() => {
@@ -17,7 +17,7 @@ export default function Error({ id, error }) {
17
17
  >
18
18
  {isAvailable && error && (
19
19
  <span id={id} className={className('error__message')}>
20
- <Icon name="error" size="16" />
20
+ <Icon name="error" size="16" alt="" />
21
21
  {error}
22
22
  </span>
23
23
  )}
@@ -66,7 +66,7 @@ export default function FileInput({
66
66
  ])}
67
67
  >
68
68
  <label htmlFor={id} className={className('upload__label')}>
69
- <Icon name="upload" size="32" />
69
+ <Icon name="upload" size="32" alt="" />
70
70
  <div>
71
71
  <span className={className(['upload__label--text'])}>
72
72
  {labelText}
@@ -43,7 +43,7 @@ const AgentInfo = () => {
43
43
  alt=""
44
44
  />
45
45
  ) : (
46
- <Icon name="avatar" size="32" />
46
+ <Icon name="avatar" size="32" alt="" />
47
47
  )}
48
48
  <span className={className(classNames)} aria-hidden="true">
49
49
  {unreadMessageCount}
@@ -27,44 +27,81 @@ import { className as classNameFn } from 'lib/css'
27
27
 
28
28
  /* eslint-enable import/no-webpack-loader-syntax */
29
29
 
30
- const ICONS = {
31
- send32: iconSend32,
32
- balloon32: iconBalloon32,
33
- newTopic32: iconNewTopic32,
34
- newTranslation16: iconNewTranslation16,
35
- newTranslation32: iconNewTranslation32,
36
- avatar32: iconAvatar32,
37
- chevronDown8: iconChevronDown8,
38
- chevronDown32: iconChevronDown32,
39
- chevronRight8: iconChevronRight8,
40
- chevronRight16: iconChevronRight16,
41
- close8: iconClose8,
42
- close16: iconClose16,
43
- enlarge32: iconEnlarge32,
44
- options32: iconOptions32,
45
- file32: iconFile32,
46
- upload32: iconUpload32,
47
- download16: iconDownload16,
48
- error16: iconError16,
49
- arrowLeft16: iconArrowLeft16,
50
- arrowRight16: iconArrowRight16,
51
- check32: iconCheck32,
52
- check16: iconCheck16,
53
- }
54
-
55
- const Icon = ({ name, size = '32', className = undefined, alt }) => {
56
- const iconName = `${name}${size}`
30
+ export const ICONS = {
31
+ send: {
32
+ 32: iconSend32,
33
+ },
34
+ balloon: {
35
+ 32: iconBalloon32,
36
+ },
37
+ newTopic: {
38
+ 32: iconNewTopic32,
39
+ },
40
+ newTranslation: {
41
+ 16: iconNewTranslation16,
42
+ 32: iconNewTranslation32,
43
+ },
44
+ avatar: {
45
+ 32: iconAvatar32,
46
+ },
47
+ chevronDown: {
48
+ 8: iconChevronDown8,
49
+ 32: iconChevronDown32,
50
+ },
51
+ chevronRight: {
52
+ 8: iconChevronRight8,
53
+ 16: iconChevronRight16,
54
+ },
55
+ close: {
56
+ 8: iconClose8,
57
+ 16: iconClose16,
58
+ },
59
+ enlarge: {
60
+ 32: iconEnlarge32,
61
+ },
62
+ options: {
63
+ 32: iconOptions32,
64
+ },
65
+ file: {
66
+ 32: iconFile32,
67
+ },
68
+ upload: {
69
+ 32: iconUpload32,
70
+ },
71
+ download: {
72
+ 16: iconDownload16,
73
+ },
74
+ error: {
75
+ 16: iconError16,
76
+ },
77
+ arrowLeft: {
78
+ 16: iconArrowLeft16,
79
+ },
80
+ arrowRight: {
81
+ 16: iconArrowRight16,
82
+ },
83
+ check: {
84
+ 16: iconCheck16,
85
+ 32: iconCheck32,
86
+ },
87
+ } as const
57
88
 
58
- return (
59
- <>
60
- <div
61
- aria-hidden="true"
62
- className={className || classNameFn('icon')}
63
- dangerouslySetInnerHTML={{ __html: ICONS[iconName] }}
64
- />
65
- {alt && <span className={classNameFn('visually-hidden')}>{alt}</span>}
66
- </>
67
- )
89
+ export type IconProps = {
90
+ name: keyof typeof ICONS
91
+ size?: '8' | '16' | '32'
92
+ className?: string
93
+ alt: string
68
94
  }
69
95
 
96
+ const Icon = ({ name, size = '32', className, alt }: IconProps) => (
97
+ <>
98
+ <div
99
+ aria-hidden="true"
100
+ className={className || classNameFn('icon')}
101
+ dangerouslySetInnerHTML={{ __html: ICONS[name][size] }}
102
+ />
103
+ {alt && <span className={classNameFn('visually-hidden')}>{alt}</span>}
104
+ </>
105
+ )
106
+
70
107
  export default Icon
@@ -236,7 +236,7 @@ const OptionsButton = () => {
236
236
  aria-expanded={multiMenu ? menuIsOpen.toString() : null}
237
237
  aria-disabled={!multiMenu && !firstOption.available ? 'true' : null}
238
238
  >
239
- {multiMenu && <Icon name="options" size="32" />}
239
+ {multiMenu && <Icon name="options" size="32" alt="" />}
240
240
  <span className={className('button__text')}>
241
241
  {multiMenu
242
242
  ? t('options.openButtonText')
@@ -30,7 +30,7 @@ const SuggestionsItem = ({
30
30
  onClick={handleClick}
31
31
  className={className('button', 'button--primary')}
32
32
  >
33
- {hasIcon && <Icon name="chevronRight" size="8" />}
33
+ {hasIcon && <Icon name="chevronRight" size="8" alt="" />}
34
34
  {question}
35
35
  </button>
36
36
  </li>
@@ -29,7 +29,7 @@ const ButtonIcon = () => {
29
29
  alt=""
30
30
  />
31
31
  ) : (
32
- <Icon name="avatar" size="32" />
32
+ <Icon name="avatar" size="32" alt="" />
33
33
  )
34
34
  }
35
35
 
@@ -66,7 +66,7 @@ const Lightbox = ({ url, description, onClose: onCloseHandler }) => {
66
66
  className={className('modal__close')}
67
67
  onClick={onClose}
68
68
  >
69
- <Icon name="close" size="16" />
69
+ <Icon name="close" size="16" alt="" />
70
70
  {t('lightbox.closeLabel')}
71
71
  </button>
72
72
  </div>
@@ -18,15 +18,15 @@
18
18
  .#{$n}-card__content {
19
19
  display: flex;
20
20
  flex: 1 1 auto;
21
- flex-wrap: wrap;
21
+ flex-direction: column;
22
22
  gap: $spacer * 0.5;
23
23
  padding: $spacer * 0.5 $spacer * 0.75 $spacer * 0.75;
24
24
  }
25
25
 
26
26
  .#{$n}-card__title {
27
27
  display: block;
28
- flex: 0 0 100%;
29
28
  width: 100%;
29
+ height: fit-content;
30
30
  margin: 0;
31
31
  padding: 0;
32
32
  font-size: $fontsize-default;
@@ -36,12 +36,13 @@
36
36
  .#{$n}-card__description {
37
37
  display: block;
38
38
  width: 100%;
39
+ height: fit-content;
39
40
  }
40
41
 
41
42
  .#{$n}-card__content .#{$n}-button {
42
43
  display: block;
43
- align-self: flex-end;
44
44
  width: 100%;
45
+ margin-top: auto;
45
46
  font-weight: $fontweight-bold;
46
47
  text-decoration: none;
47
48
  }