@seamly/web-ui 25.4.1-beta → 25.5.0

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": "25.4.1-beta",
3
+ "version": "25.5.0",
4
4
  "main": "build/dist/lib/index.js",
5
5
  "types": "build/src/javascripts/index.d.ts",
6
6
  "exports": {
@@ -32,11 +32,11 @@
32
32
  "reconnecting-websocket": "^4.4.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@babel/core": "^7.28.5",
36
- "@babel/preset-env": "^7.28.5",
35
+ "@babel/core": "^7.29.0",
36
+ "@babel/preset-env": "^7.29.3",
37
37
  "@babel/preset-react": "^7.28.5",
38
38
  "@babel/preset-typescript": "^7.28.5",
39
- "@playwright/test": "^1.58.2",
39
+ "@playwright/test": "^1.59.1",
40
40
  "@seamly/doc-site": "^4.1.1",
41
41
  "@seamly/eslint-config": "^4.0.0",
42
42
  "@seamly/prettier-config": "^3.2.0",
@@ -45,7 +45,7 @@
45
45
  "@testing-library/preact": "^3.2.4",
46
46
  "@types/core-js": "^2.5.8",
47
47
  "@types/jest": "^30.0.0",
48
- "@types/node": "^25.5.0",
48
+ "@types/node": "^25.6.0",
49
49
  "babel-jest": "30.3.0",
50
50
  "babel-loader": "^10.1.1",
51
51
  "copy-webpack-plugin": "^14.0.0",
@@ -59,14 +59,14 @@
59
59
  "nyc": "^18.0.0",
60
60
  "openapi-typescript": "6.7.6",
61
61
  "playwright-test-coverage": "^1.2.12",
62
- "postcss": "^8.5.8",
63
- "preact": "^10.29.0",
64
- "prettier": "^3.8.1",
62
+ "postcss": "^8.5.13",
63
+ "preact": "^10.29.1",
64
+ "prettier": "^3.8.3",
65
65
  "rimraf": "^6.1.3",
66
66
  "style-loader": "^4.0.0",
67
- "stylelint": "^17.6.0",
68
- "typescript": "^6.0.2",
69
- "webpack": "^5.105.4",
67
+ "stylelint": "^17.10.0",
68
+ "typescript": "^6.0.3",
69
+ "webpack": "^5.106.2",
70
70
  "webpack-cli": "^7.0.2",
71
71
  "webpack-dev-server": "^5.2.3",
72
72
  "webpack-merge": "^6.0.1"
@@ -77,7 +77,7 @@
77
77
  "undici": "^7.22.0"
78
78
  },
79
79
  "peerDependencies": {
80
- "preact": "^10.29.0"
80
+ "preact": "^10.29.1"
81
81
  },
82
82
  "scripts": {
83
83
  "build:clean": "rimraf build; mkdir -p build",
@@ -55,7 +55,19 @@ export const setVisibility = createAsyncThunk<
55
55
  }
56
56
  }
57
57
 
58
+ const visibility = (api.store.get(StoreKey) || {}) as Record<
59
+ string,
60
+ VisibilityOptions | boolean | null | undefined
61
+ >
62
+
58
63
  if (previousVisibility === calculatedVisibility) {
64
+ api.store.set(StoreKey, {
65
+ ...visibility,
66
+ [layoutMode]: requestedVisibility,
67
+ ...(typeof showPreChat !== 'undefined' ? { showPreChat } : {}),
68
+ ...(typeof showContinueChat !== 'undefined' ? { showContinueChat } : {}),
69
+ })
70
+
59
71
  return {
60
72
  visibility: null,
61
73
  setInputFocus: args.setInputFocus,
@@ -64,12 +76,12 @@ export const setVisibility = createAsyncThunk<
64
76
  }
65
77
  }
66
78
 
67
- const visibility = api.store.get(StoreKey) as object | undefined
68
-
69
79
  // Store the user-requested visibility in order to reinitialize after refresh
70
80
  api.store.set(StoreKey, {
71
- ...(visibility || {}),
81
+ ...visibility,
72
82
  [layoutMode]: requestedVisibility,
83
+ ...(typeof showPreChat !== 'undefined' ? { showPreChat } : {}),
84
+ ...(typeof showContinueChat !== 'undefined' ? { showContinueChat } : {}),
73
85
  })
74
86
  if (requestedVisibility) {
75
87
  eventBus.emit('ui.visible', requestedVisibility, {
@@ -94,10 +106,39 @@ export const initializeVisibility = createAsyncThunk<any, void, ThunkAPI>(
94
106
  // initialize stored visibility
95
107
  const { layoutMode } = ConfigSelectors.selectConfig(getState())
96
108
 
97
- const storedVisibility =
98
- api.store.get(StoreKey)?.[layoutMode] || visibilityStates.initialize
109
+ const storedVisibilitySettings = (api.store.get(StoreKey) || {}) as Record<
110
+ string,
111
+ VisibilityOptions | boolean | null | undefined
112
+ >
113
+ const storedVisibilityValue = storedVisibilitySettings[layoutMode]
99
114
 
100
- dispatch(setVisibility({ visibility: storedVisibility }))
115
+ const storedVisibility = isPersistedVisibilityState(storedVisibilityValue)
116
+ ? storedVisibilityValue
117
+ : visibilityStates.initialize
118
+
119
+ const storedShowPreChat = storedVisibilitySettings.showPreChat
120
+ const storedShowContinueChat = storedVisibilitySettings.showContinueChat
121
+
122
+ dispatch(
123
+ setVisibility({
124
+ visibility: storedVisibility,
125
+ showPreChat:
126
+ typeof storedShowPreChat === 'boolean'
127
+ ? storedShowPreChat
128
+ : undefined,
129
+ showContinueChat:
130
+ typeof storedShowContinueChat === 'boolean'
131
+ ? storedShowContinueChat
132
+ : undefined,
133
+ }),
134
+ )
101
135
  return storedVisibility
102
136
  },
103
137
  )
138
+
139
+ const isPersistedVisibilityState = (
140
+ value: VisibilityOptions | boolean | undefined,
141
+ ): value is (typeof validVisibilityStates)[number] =>
142
+ value === visibilityStates.open ||
143
+ value === visibilityStates.minimized ||
144
+ value === visibilityStates.hidden