@seamly/web-ui 24.3.0 → 24.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamly/web-ui",
3
- "version": "24.3.0",
3
+ "version": "24.3.1",
4
4
  "main": "build/dist/lib/index.js",
5
5
  "types": "build/src/javascripts/index.d.ts",
6
6
  "exports": {
@@ -21,9 +21,9 @@
21
21
  "webpack/*"
22
22
  ],
23
23
  "dependencies": {
24
- "@reduxjs/toolkit": "^2.5.1",
24
+ "@reduxjs/toolkit": "^2.6.1",
25
25
  "@ultraq/icu-message-formatter": "^0.14.3",
26
- "core-js": "^3.40.0",
26
+ "core-js": "^3.41.0",
27
27
  "focus-trap": "^7.6.4",
28
28
  "include-media": "^2.0.0",
29
29
  "js-cookie": "^3.0.5",
@@ -32,11 +32,11 @@
32
32
  "reconnecting-websocket": "^4.4.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@babel/core": "^7.26.7",
36
- "@babel/preset-env": "^7.26.7",
35
+ "@babel/core": "^7.26.10",
36
+ "@babel/preset-env": "^7.26.9",
37
37
  "@babel/preset-react": "^7.26.3",
38
38
  "@babel/preset-typescript": "^7.26.0",
39
- "@playwright/test": "^1.50.1",
39
+ "@playwright/test": "^1.51.0",
40
40
  "@seamly/doc-site": "^4.0.0",
41
41
  "@seamly/eslint-config": "^3.1.0",
42
42
  "@seamly/prettier-config": "^3.1.0",
@@ -45,15 +45,15 @@
45
45
  "@testing-library/preact": "^3.2.4",
46
46
  "@types/core-js": "^2.5.8",
47
47
  "@types/jest": "^29.5.12",
48
- "@typescript-eslint/eslint-plugin": "^8.23.0",
49
- "@typescript-eslint/parser": "^8.23.0",
48
+ "@typescript-eslint/eslint-plugin": "^8.26.1",
49
+ "@typescript-eslint/parser": "^8.26.1",
50
50
  "babel-jest": "^29.7.0",
51
51
  "babel-loader": "^9.2.1",
52
52
  "copy-webpack-plugin": "^12.0.2",
53
- "dd-trace": "^5.28.0",
53
+ "dd-trace": "^5.42.0",
54
54
  "eslint": "^8.57.0",
55
55
  "eslint-config-prettier": "^9.1.0",
56
- "eslint-import-resolver-typescript": "^3.7.0",
56
+ "eslint-import-resolver-typescript": "^3.9.1",
57
57
  "eslint-plugin-filenames": "^1.3.2",
58
58
  "eslint-plugin-import": "^2.29.1",
59
59
  "eslint-plugin-jest": "^28.11.0",
@@ -69,14 +69,14 @@
69
69
  "nyc": "^17.0.0",
70
70
  "openapi-typescript": "^6.7",
71
71
  "playwright-test-coverage": "^1.2.12",
72
- "postcss": "^8.4.49",
73
- "preact": "^10.25.1",
74
- "prettier": "^3.4.2",
72
+ "postcss": "^8.5.3",
73
+ "preact": "^10.26.4",
74
+ "prettier": "^3.5.3",
75
75
  "rimraf": "^6.0.1",
76
76
  "style-loader": "^4.0.0",
77
- "stylelint": "^16.14.1",
78
- "typescript": "^5.7.3",
79
- "webpack": "^5.97.1",
77
+ "stylelint": "^16.16.0",
78
+ "typescript": "^5.8.2",
79
+ "webpack": "^5.98.0",
80
80
  "webpack-bundle-analyzer": "^4.10.2",
81
81
  "webpack-cli": "^6.0.1",
82
82
  "webpack-dev-server": "^5.1.0",
@@ -233,13 +233,10 @@ export default class API {
233
233
  return undefined
234
234
  }
235
235
 
236
- // Destructure the server locale from the payload
237
- const localContentLocale = this.#config.context?.contentLocale
238
236
  const localUserLocale = this.#config.context?.userLocale
239
237
 
240
238
  return {
241
- // Only send locale if explicitly set in the config.
242
- ...(localContentLocale ? { contentLocale: localContentLocale } : {}),
239
+ // Only send userLocale if explicitly set in the config (should be overridable by provided context)
243
240
  ...(localUserLocale ? { userLocale: localUserLocale } : {}),
244
241
  ...context,
245
242
  }
@@ -361,8 +361,13 @@ export const storeSlice = createSlice({
361
361
  Object.entries(participants).map(([_, value]) => [value.id, value]),
362
362
  )
363
363
 
364
- const lastParticipantEvent = events.find((m) => m.type === 'participant')
365
- const lastParticipantId = lastParticipantEvent?.payload.participant?.id
364
+ // Use the messages from the payload, as `events` only contains displayable ones.
365
+ // The first participant message found is the 'last', as we receive them from newest to oldest.
366
+ const lastParticipantEvent = messages.find(
367
+ (m) => m.type === 'participant',
368
+ )
369
+ // @ts-ignore TypeScript incorrectly assumes that the payload can be any of info/message/participant
370
+ const lastParticipantId = lastParticipantEvent?.payload?.participant?.id
366
371
 
367
372
  const { entry } = service?.settings || {}
368
373
 
@@ -4,9 +4,6 @@ const debug =
4
4
  (...msg) =>
5
5
  // eslint-disable-next-line
6
6
  console.debug(namespace, ...msg)
7
- : (namespace) =>
8
- (...msg) =>
9
- // eslint-disable-next-line
10
- console.debug(namespace, ...msg)
7
+ : () => () => null
11
8
 
12
9
  export default debug
@@ -20,8 +20,7 @@ import type { MessageChoicePrompt } from 'domains/store/store.types'
20
20
  export const useChoicePrompt = (event: MessageChoicePrompt) => {
21
21
  const { payload } = event
22
22
  const [showOptions, setShowOptions] = useState(false)
23
- const { addMessageBubble, addDivider, emitEvent, sendAction } =
24
- useSeamlyCommands()
23
+ const { addMessageBubble, emitEvent, sendAction } = useSeamlyCommands()
25
24
  const { activeServiceSessionId } = useSeamlyServiceInfo()
26
25
  const lastEventId = useLastMessageEventId()
27
26
  const { body } = useTranslatedEventData(event)
@@ -64,9 +63,6 @@ export const useChoicePrompt = (event: MessageChoicePrompt) => {
64
63
  transactionId,
65
64
  }
66
65
 
67
- if (chooseAgain) {
68
- addDivider('new_topic', transactionId)
69
- }
70
66
  addMessageBubble(choice.text, transactionId)
71
67
  sendAction(action)
72
68
  setShowOptions(false)
@@ -163,27 +163,6 @@ const useSeamlyCommands = () => {
163
163
  [dispatch],
164
164
  )
165
165
 
166
- const addDivider = useCallback(
167
- (subtype: 'new_topic', transactionId = randomId()) => {
168
- dispatch(
169
- addEvent({
170
- type: 'info',
171
- payload: {
172
- type: 'divider',
173
- body: {
174
- subtype,
175
- },
176
- fromClient: false,
177
- participant: null,
178
- id: randomId(),
179
- transactionId,
180
- },
181
- }),
182
- )
183
- },
184
- [dispatch],
185
- )
186
-
187
166
  const sendAction = useCallback(
188
167
  (body) => {
189
168
  if (!body) {
@@ -245,7 +224,6 @@ const useSeamlyCommands = () => {
245
224
  emitEvent,
246
225
  addMessageBubble,
247
226
  addUploadBubble,
248
- addDivider,
249
227
  apiConnected: api.connected,
250
228
  apiConfigReady: api.configReady,
251
229
  }
@@ -660,7 +660,7 @@ const choicePromptMessage = {
660
660
  ],
661
661
  chooseAgain: true,
662
662
  prompt: {
663
- text: 'Type "start" at any time to see this menu again',
663
+ text: 'Here are some choice prompt options to choose from',
664
664
  type: 'text',
665
665
  variables: {},
666
666
  },
@@ -1236,6 +1236,25 @@ const standardState = {
1236
1236
  choicePromptMessage,
1237
1237
  ],
1238
1238
  },
1239
+ choicePromptMessageWithoutManualInput: {
1240
+ category: categoryKeys.messages,
1241
+ headingText: 'Choice prompt message without manual input',
1242
+ description: '',
1243
+ ...baseState,
1244
+ entryMeta: {
1245
+ ...baseState.entryMeta,
1246
+ options: {
1247
+ text: {
1248
+ allowManualInput: false,
1249
+ },
1250
+ },
1251
+ },
1252
+ events: [choicePromptMessage],
1253
+ participantInfo,
1254
+ serviceInfo: {
1255
+ activeServiceSessionId: '3942159e-9878-469e-9120-f44fd6be0f35',
1256
+ },
1257
+ },
1239
1258
  timeIndicators: {
1240
1259
  category: categoryKeys.messages,
1241
1260
  headingText: 'Time Indicators',