@kindly/react-chat 2.76.1 → 2.76.4

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": "@kindly/react-chat",
3
- "version": "2.76.1",
3
+ "version": "2.76.4",
4
4
  "description": "Kindly Chat react component",
5
5
  "repository": "https://github.com/kindly-ai/kindly-chat/tree/main/packages/react-chat",
6
6
  "license": "MIT",
@@ -18,92 +18,74 @@
18
18
  "start:prod": "webpack-dev-server --env envConfig=production",
19
19
  "storybook": "storybook dev -p 6006",
20
20
  "test": "jest src",
21
- "test:storybook": "test-storybook",
22
- "update:browserslist": "npx browserslist@latest --update-db"
21
+ "test:storybook": "test-storybook"
23
22
  },
24
- "browserslist": [
25
- ">0.2% in alt-eu",
26
- ">0.2% in US",
27
- "last 4 years",
28
- "not dead",
29
- "not OperaMini all",
30
- "not Edge < 20",
31
- "not opera < 63",
32
- "not safari < 15.4",
33
- "not ios_saf < 15.4"
34
- ],
35
23
  "dependencies": {
36
- "@reduxjs/toolkit": "^2.7.0",
37
- "dompurify": "^3.2.5",
24
+ "@reduxjs/toolkit": "^2.8.2",
25
+ "dompurify": "^3.2.6",
38
26
  "lodash.merge": "^4.6.2",
39
27
  "prop-types": "^15.8.1",
40
28
  "react-children-utilities": "^2.10.0",
41
- "react-hook-form": "^7.56.0",
29
+ "react-hook-form": "^7.60.0",
42
30
  "react-idle-timer": "^5.7.2",
43
31
  "react-redux": "^9.2.0",
44
32
  "react-textarea-autosize": "^8.5.9",
45
33
  "redux-localstorage": "^0.4.1",
46
34
  "stream-browserify": "^3.0.0",
47
- "styled-components": "^5.3.11",
48
- "ua-parser-js": "^2.0.3",
35
+ "styled-components": "^6.1.19",
36
+ "ua-parser-js": "^2.0.4",
49
37
  "uuid": "^11.1.0"
50
38
  },
51
39
  "devDependencies": {
52
- "@babel/core": "^7.27.4",
40
+ "@babel/core": "^7.28.0",
53
41
  "@babel/plugin-proposal-class-properties": "^7.18.6",
54
- "@babel/plugin-transform-runtime": "^7.27.4",
55
- "@babel/preset-env": "^7.27.2",
42
+ "@babel/plugin-transform-runtime": "^7.28.0",
43
+ "@babel/preset-env": "^7.28.0",
56
44
  "@babel/preset-react": "^7.27.1",
57
- "@babel/runtime-corejs3": "^7.27.6",
58
- "@storybook/addon-a11y": "^7.6.20",
59
- "@storybook/addon-actions": "^7.6.20",
60
- "@storybook/addon-essentials": "^7.6.20",
61
- "@storybook/addon-interactions": "^7.6.20",
62
- "@storybook/addon-links": "^7.6.20",
63
- "@storybook/addon-mdx-gfm": "^7.6.20",
45
+ "@babel/runtime-corejs3": "^7.28.0",
46
+ "@storybook/addon-a11y": "9.0.16",
47
+ "@storybook/addon-docs": "9.0.16",
48
+ "@storybook/addon-links": "9.0.16",
49
+ "@storybook/addon-webpack5-compiler-babel": "^3.0.6",
64
50
  "@storybook/jest": "^0.2.3",
65
- "@storybook/react": "^7.6.20",
66
- "@storybook/react-webpack5": "^7.6.20",
67
- "@storybook/test-runner": "^0.13.0",
51
+ "@storybook/react-webpack5": "9.0.16",
52
+ "@storybook/test-runner": "^0.23.0",
68
53
  "@storybook/testing-library": "^0.2.2",
69
54
  "@testing-library/dom": "^10.4.0",
70
- "@testing-library/jest-dom": "^5.17.0",
55
+ "@testing-library/jest-dom": "^6.6.3",
71
56
  "@testing-library/react": "^16.3.0",
72
57
  "@types/react": "^18.3.23",
73
58
  "@types/react-dom": "^18.3.7",
74
- "@types/styled-components": "^5.1.34",
75
59
  "axe-playwright": "^2.1.0",
76
- "babel-jest": "^29.7.0",
77
- "babel-loader": "^9.2.1",
78
- "babel-plugin-styled-components": "^1.13.3",
60
+ "babel-jest": "^30.0.4",
61
+ "babel-loader": "^10.0.0",
79
62
  "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
80
63
  "babel-plugin-transform-remove-console": "^6.9.4",
81
- "browserslist": "^4.25.0",
82
- "chromatic": "^13.0.1",
64
+ "chromatic": "^13.1.2",
83
65
  "clean-webpack-plugin": "^4.0.0",
84
- "dotenv": "16.5.0",
66
+ "dotenv": "16.6.1",
85
67
  "express": "^5.1.0",
86
68
  "file-loader": "^6.2.0",
87
69
  "html-webpack-plugin": "^5.6.3",
88
- "husky": "3.1.0",
89
- "jest": "^29.7.0",
90
- "jest-environment-jsdom": "^29.7.0",
70
+ "jest": "^30.0.4",
71
+ "jest-environment-jsdom": "^30.0.4",
91
72
  "jest-junit": "^16.0.0",
92
73
  "jest-webpack-resolver": "^0.3.0",
93
74
  "lodash.clonedeep": "^4.5.0",
94
75
  "lodash.set": "^4.3.2",
95
76
  "mockdate": "^3.0.5",
77
+ "msw": "^2.10.4",
78
+ "msw-storybook-addon": "^2.0.5",
96
79
  "process": "^0.11.10",
97
80
  "pusher-js": "^8.4.0",
98
81
  "react": "^18.3.1",
99
82
  "react-dom": "^18.3.1",
100
83
  "react-test-renderer": "^18.3.1",
101
84
  "resolve-url-loader": "^5.0.0",
102
- "storybook": "^7.6.20",
103
- "storybook-addon-fetch-mock": "^1.0.1",
85
+ "storybook": "9.0.16",
104
86
  "type-fest": "^4.41.0",
105
87
  "url-loader": "^4.1.1",
106
- "webpack": "^5.99.9",
88
+ "webpack": "^5.100.0",
107
89
  "webpack-bundle-analyzer": "^4.10.2",
108
90
  "webpack-cli": "^6.0.1",
109
91
  "webpack-dev-server": "^5.2.2",
@@ -119,29 +101,16 @@
119
101
  "npm": ">=10"
120
102
  },
121
103
  "overrides": {
122
- "@storybook/react": {
123
- "react-element-to-jsx-string": {
124
- "react": "^18",
125
- "react-dom": "^18"
126
- }
127
- },
128
- "@storybook/addon-docs": {
129
- "@mdx-js/react": {
130
- "react": "^18",
131
- "react-dom": "^18"
132
- }
133
- },
134
- "@storybook/addon-actions": {
135
- "react-inspector": {
136
- "react": "^18",
137
- "react-dom": "^18"
138
- }
139
- },
140
104
  "jest-playwright-preset": {
141
- "jest": "^29"
105
+ "jest": "^30"
142
106
  }
143
107
  },
144
108
  "scriptsComments": {
145
109
  "test-a11y": "Runs the storybook test-runner. Currently running only axe-core for a11y tests."
110
+ },
111
+ "msw": {
112
+ "workerDirectory": [
113
+ "public"
114
+ ]
146
115
  }
147
116
  }
@@ -0,0 +1,344 @@
1
+ /* eslint-disable */
2
+ /* tslint:disable */
3
+
4
+ /**
5
+ * Mock Service Worker.
6
+ * @see https://github.com/mswjs/msw
7
+ * - Please do NOT modify this file.
8
+ */
9
+
10
+ const PACKAGE_VERSION = '2.10.4'
11
+ const INTEGRITY_CHECKSUM = 'f5825c521429caf22a4dd13b66e243af'
12
+ const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
13
+ const activeClientIds = new Set()
14
+
15
+ addEventListener('install', function () {
16
+ self.skipWaiting()
17
+ })
18
+
19
+ addEventListener('activate', function (event) {
20
+ event.waitUntil(self.clients.claim())
21
+ })
22
+
23
+ addEventListener('message', async function (event) {
24
+ const clientId = Reflect.get(event.source || {}, 'id')
25
+
26
+ if (!clientId || !self.clients) {
27
+ return
28
+ }
29
+
30
+ const client = await self.clients.get(clientId)
31
+
32
+ if (!client) {
33
+ return
34
+ }
35
+
36
+ const allClients = await self.clients.matchAll({
37
+ type: 'window',
38
+ })
39
+
40
+ switch (event.data) {
41
+ case 'KEEPALIVE_REQUEST': {
42
+ sendToClient(client, {
43
+ type: 'KEEPALIVE_RESPONSE',
44
+ })
45
+ break
46
+ }
47
+
48
+ case 'INTEGRITY_CHECK_REQUEST': {
49
+ sendToClient(client, {
50
+ type: 'INTEGRITY_CHECK_RESPONSE',
51
+ payload: {
52
+ packageVersion: PACKAGE_VERSION,
53
+ checksum: INTEGRITY_CHECKSUM,
54
+ },
55
+ })
56
+ break
57
+ }
58
+
59
+ case 'MOCK_ACTIVATE': {
60
+ activeClientIds.add(clientId)
61
+
62
+ sendToClient(client, {
63
+ type: 'MOCKING_ENABLED',
64
+ payload: {
65
+ client: {
66
+ id: client.id,
67
+ frameType: client.frameType,
68
+ },
69
+ },
70
+ })
71
+ break
72
+ }
73
+
74
+ case 'MOCK_DEACTIVATE': {
75
+ activeClientIds.delete(clientId)
76
+ break
77
+ }
78
+
79
+ case 'CLIENT_CLOSED': {
80
+ activeClientIds.delete(clientId)
81
+
82
+ const remainingClients = allClients.filter((client) => {
83
+ return client.id !== clientId
84
+ })
85
+
86
+ // Unregister itself when there are no more clients
87
+ if (remainingClients.length === 0) {
88
+ self.registration.unregister()
89
+ }
90
+
91
+ break
92
+ }
93
+ }
94
+ })
95
+
96
+ addEventListener('fetch', function (event) {
97
+ // Bypass navigation requests.
98
+ if (event.request.mode === 'navigate') {
99
+ return
100
+ }
101
+
102
+ // Opening the DevTools triggers the "only-if-cached" request
103
+ // that cannot be handled by the worker. Bypass such requests.
104
+ if (
105
+ event.request.cache === 'only-if-cached' &&
106
+ event.request.mode !== 'same-origin'
107
+ ) {
108
+ return
109
+ }
110
+
111
+ // Bypass all requests when there are no active clients.
112
+ // Prevents the self-unregistered worked from handling requests
113
+ // after it's been deleted (still remains active until the next reload).
114
+ if (activeClientIds.size === 0) {
115
+ return
116
+ }
117
+
118
+ const requestId = crypto.randomUUID()
119
+ event.respondWith(handleRequest(event, requestId))
120
+ })
121
+
122
+ /**
123
+ * @param {FetchEvent} event
124
+ * @param {string} requestId
125
+ */
126
+ async function handleRequest(event, requestId) {
127
+ const client = await resolveMainClient(event)
128
+ const requestCloneForEvents = event.request.clone()
129
+ const response = await getResponse(event, client, requestId)
130
+
131
+ // Send back the response clone for the "response:*" life-cycle events.
132
+ // Ensure MSW is active and ready to handle the message, otherwise
133
+ // this message will pend indefinitely.
134
+ if (client && activeClientIds.has(client.id)) {
135
+ const serializedRequest = await serializeRequest(requestCloneForEvents)
136
+
137
+ // Clone the response so both the client and the library could consume it.
138
+ const responseClone = response.clone()
139
+
140
+ sendToClient(
141
+ client,
142
+ {
143
+ type: 'RESPONSE',
144
+ payload: {
145
+ isMockedResponse: IS_MOCKED_RESPONSE in response,
146
+ request: {
147
+ id: requestId,
148
+ ...serializedRequest,
149
+ },
150
+ response: {
151
+ type: responseClone.type,
152
+ status: responseClone.status,
153
+ statusText: responseClone.statusText,
154
+ headers: Object.fromEntries(responseClone.headers.entries()),
155
+ body: responseClone.body,
156
+ },
157
+ },
158
+ },
159
+ responseClone.body ? [serializedRequest.body, responseClone.body] : [],
160
+ )
161
+ }
162
+
163
+ return response
164
+ }
165
+
166
+ /**
167
+ * Resolve the main client for the given event.
168
+ * Client that issues a request doesn't necessarily equal the client
169
+ * that registered the worker. It's with the latter the worker should
170
+ * communicate with during the response resolving phase.
171
+ * @param {FetchEvent} event
172
+ * @returns {Promise<Client | undefined>}
173
+ */
174
+ async function resolveMainClient(event) {
175
+ const client = await self.clients.get(event.clientId)
176
+
177
+ if (activeClientIds.has(event.clientId)) {
178
+ return client
179
+ }
180
+
181
+ if (client?.frameType === 'top-level') {
182
+ return client
183
+ }
184
+
185
+ const allClients = await self.clients.matchAll({
186
+ type: 'window',
187
+ })
188
+
189
+ return allClients
190
+ .filter((client) => {
191
+ // Get only those clients that are currently visible.
192
+ return client.visibilityState === 'visible'
193
+ })
194
+ .find((client) => {
195
+ // Find the client ID that's recorded in the
196
+ // set of clients that have registered the worker.
197
+ return activeClientIds.has(client.id)
198
+ })
199
+ }
200
+
201
+ /**
202
+ * @param {FetchEvent} event
203
+ * @param {Client | undefined} client
204
+ * @param {string} requestId
205
+ * @returns {Promise<Response>}
206
+ */
207
+ async function getResponse(event, client, requestId) {
208
+ // Clone the request because it might've been already used
209
+ // (i.e. its body has been read and sent to the client).
210
+ const requestClone = event.request.clone()
211
+
212
+ function passthrough() {
213
+ // Cast the request headers to a new Headers instance
214
+ // so the headers can be manipulated with.
215
+ const headers = new Headers(requestClone.headers)
216
+
217
+ // Remove the "accept" header value that marked this request as passthrough.
218
+ // This prevents request alteration and also keeps it compliant with the
219
+ // user-defined CORS policies.
220
+ const acceptHeader = headers.get('accept')
221
+ if (acceptHeader) {
222
+ const values = acceptHeader.split(',').map((value) => value.trim())
223
+ const filteredValues = values.filter(
224
+ (value) => value !== 'msw/passthrough',
225
+ )
226
+
227
+ if (filteredValues.length > 0) {
228
+ headers.set('accept', filteredValues.join(', '))
229
+ } else {
230
+ headers.delete('accept')
231
+ }
232
+ }
233
+
234
+ return fetch(requestClone, { headers })
235
+ }
236
+
237
+ // Bypass mocking when the client is not active.
238
+ if (!client) {
239
+ return passthrough()
240
+ }
241
+
242
+ // Bypass initial page load requests (i.e. static assets).
243
+ // The absence of the immediate/parent client in the map of the active clients
244
+ // means that MSW hasn't dispatched the "MOCK_ACTIVATE" event yet
245
+ // and is not ready to handle requests.
246
+ if (!activeClientIds.has(client.id)) {
247
+ return passthrough()
248
+ }
249
+
250
+ // Notify the client that a request has been intercepted.
251
+ const serializedRequest = await serializeRequest(event.request)
252
+ const clientMessage = await sendToClient(
253
+ client,
254
+ {
255
+ type: 'REQUEST',
256
+ payload: {
257
+ id: requestId,
258
+ ...serializedRequest,
259
+ },
260
+ },
261
+ [serializedRequest.body],
262
+ )
263
+
264
+ switch (clientMessage.type) {
265
+ case 'MOCK_RESPONSE': {
266
+ return respondWithMock(clientMessage.data)
267
+ }
268
+
269
+ case 'PASSTHROUGH': {
270
+ return passthrough()
271
+ }
272
+ }
273
+
274
+ return passthrough()
275
+ }
276
+
277
+ /**
278
+ * @param {Client} client
279
+ * @param {any} message
280
+ * @param {Array<Transferable>} transferrables
281
+ * @returns {Promise<any>}
282
+ */
283
+ function sendToClient(client, message, transferrables = []) {
284
+ return new Promise((resolve, reject) => {
285
+ const channel = new MessageChannel()
286
+
287
+ channel.port1.onmessage = (event) => {
288
+ if (event.data && event.data.error) {
289
+ return reject(event.data.error)
290
+ }
291
+
292
+ resolve(event.data)
293
+ }
294
+
295
+ client.postMessage(message, [
296
+ channel.port2,
297
+ ...transferrables.filter(Boolean),
298
+ ])
299
+ })
300
+ }
301
+
302
+ /**
303
+ * @param {Response} response
304
+ * @returns {Response}
305
+ */
306
+ function respondWithMock(response) {
307
+ // Setting response status code to 0 is a no-op.
308
+ // However, when responding with a "Response.error()", the produced Response
309
+ // instance will have status code set to 0. Since it's not possible to create
310
+ // a Response instance with status code 0, handle that use-case separately.
311
+ if (response.status === 0) {
312
+ return Response.error()
313
+ }
314
+
315
+ const mockedResponse = new Response(response.body, response)
316
+
317
+ Reflect.defineProperty(mockedResponse, IS_MOCKED_RESPONSE, {
318
+ value: true,
319
+ enumerable: true,
320
+ })
321
+
322
+ return mockedResponse
323
+ }
324
+
325
+ /**
326
+ * @param {Request} request
327
+ */
328
+ async function serializeRequest(request) {
329
+ return {
330
+ url: request.url,
331
+ mode: request.mode,
332
+ method: request.method,
333
+ headers: Object.fromEntries(request.headers.entries()),
334
+ cache: request.cache,
335
+ credentials: request.credentials,
336
+ destination: request.destination,
337
+ integrity: request.integrity,
338
+ redirect: request.redirect,
339
+ referrer: request.referrer,
340
+ referrerPolicy: request.referrerPolicy,
341
+ body: await request.arrayBuffer(),
342
+ keepalive: request.keepalive,
343
+ }
344
+ }