@centreon/ui 24.12.2 → 24.12.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": "@centreon/ui",
3
- "version": "24.12.2",
3
+ "version": "24.12.4",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -51,72 +51,72 @@
51
51
  ],
52
52
  "devDependencies": {
53
53
  "@cypress/react": "^8.0.2",
54
- "@cypress/webpack-dev-server": "^3.10.1",
55
- "@faker-js/faker": "^8.4.1",
56
- "@mdx-js/react": "^3.0.1",
54
+ "@cypress/webpack-dev-server": "^3.11.0",
55
+ "@faker-js/faker": "^9.3.0",
56
+ "@mdx-js/react": "^3.1.0",
57
57
  "@simonsmith/cypress-image-snapshot": "^9.1.0",
58
- "@storybook/addon-a11y": "^8.2.9",
59
- "@storybook/addon-docs": "^8.2.9",
60
- "@storybook/addon-essentials": "^8.2.9",
61
- "@storybook/addon-interactions": "^8.2.9",
62
- "@storybook/addon-themes": "^8.2.9",
63
- "@storybook/blocks": "^8.2.9",
64
- "@storybook/manager-api": "^8.2.9",
58
+ "@storybook/addon-a11y": "^8.4.7",
59
+ "@storybook/addon-docs": "^8.4.7",
60
+ "@storybook/addon-essentials": "^8.4.7",
61
+ "@storybook/addon-interactions": "^8.4.7",
62
+ "@storybook/addon-themes": "^8.4.7",
63
+ "@storybook/blocks": "^8.4.7",
64
+ "@storybook/manager-api": "^8.4.7",
65
65
  "@storybook/mdx2-csf": "^1.1.0",
66
- "@storybook/preview-api": "^8.2.9",
67
- "@storybook/react": "^8.2.9",
68
- "@storybook/react-vite": "^8.2.9",
69
- "@storybook/test": "^8.2.9",
70
- "@storybook/test-runner": "^0.19.1",
71
- "@storybook/theming": "^8.2.9",
66
+ "@storybook/preview-api": "^8.4.7",
67
+ "@storybook/react": "^8.4.7",
68
+ "@storybook/react-vite": "^8.4.7",
69
+ "@storybook/test": "^8.4.7",
70
+ "@storybook/test-runner": "^0.20.1",
71
+ "@storybook/theming": "^8.4.7",
72
72
  "@testing-library/cypress": "^10.0.2",
73
- "@testing-library/jest-dom": "^6.4.8",
74
- "@testing-library/react": "^16.0.0",
73
+ "@testing-library/jest-dom": "^6.6.3",
74
+ "@testing-library/react": "^16.1.0",
75
75
  "@testing-library/react-hooks": "^8.0.1",
76
- "@types/jest": "^29.5.12",
77
- "@types/mocha": "^10.0.7",
78
- "@types/ramda": "^0.30.1",
76
+ "@types/jest": "^29.5.14",
77
+ "@types/mocha": "^10.0.10",
78
+ "@types/ramda": "^0.30.2",
79
79
  "@types/react": "^18.3.3",
80
80
  "@types/testing-library__jest-dom": "^6.0.0",
81
- "@vitejs/plugin-react": "^4.3.1",
82
- "@vitejs/plugin-react-swc": "^3.7.0",
83
- "chai": "^5.1.1",
84
- "cypress": "^13.13.3",
81
+ "@vitejs/plugin-react": "^4.3.4",
82
+ "@vitejs/plugin-react-swc": "^3.7.2",
83
+ "chai": "^5.1.2",
84
+ "cypress": "^13.16.1",
85
85
  "identity-obj-proxy": "^3.0.0",
86
86
  "jest-transform-stub": "^2.0.0",
87
87
  "mochawesome": "^7.1.3",
88
- "msw": "2.3.5",
89
- "msw-storybook-addon": "^2.0.3",
88
+ "msw": "2.6.8",
89
+ "msw-storybook-addon": "^2.0.4",
90
90
  "react": "^18.3.1",
91
91
  "react-dom": "^18.3.1",
92
- "react-test-renderer": "^18.3.1",
92
+ "react-test-renderer": "^19.0.0",
93
93
  "remark-gfm": "^4.0.0",
94
- "speed-measure-vite-plugin": "^1.0.1",
95
- "storybook": "^8.2.9",
94
+ "speed-measure-vite-plugin": "^1.1.0",
95
+ "storybook": "^8.4.7",
96
96
  "storybook-addon-mock": "^5.0.0",
97
97
  "storybook-dark-mode": "^4.0.2",
98
- "style-dictionary": "^4.0.1",
98
+ "style-dictionary": "^4.3.0",
99
99
  "ts-node": "^10.9.2",
100
100
  "use-resize-observer": "^9.1.0",
101
- "vite": "^5.4.1",
101
+ "vite": "^6.0.3",
102
102
  "vite-plugin-istanbul": "^6.0.2",
103
- "vite-plugin-svgr": "^4.2.0",
103
+ "vite-plugin-svgr": "^4.3.0",
104
104
  "vite-plugin-turbosnap": "^1.0.3"
105
105
  },
106
106
  "peerDependencies": {
107
107
  "@centreon/ui-context": "file:../ui-context"
108
108
  },
109
109
  "dependencies": {
110
- "@lexical/html": "^0.17.0",
111
- "@lexical/link": "^0.17.0",
112
- "@lexical/list": "^0.17.0",
113
- "@lexical/react": "^0.17.0",
114
- "@lexical/rich-text": "^0.17.0",
115
- "@lexical/selection": "^0.17.0",
116
- "@lexical/utils": "^0.17.0",
117
- "@mui/material": "^5.16.7",
118
- "@react-spring/web": "^9.7.4",
119
- "@visx/clip-path": "^3.3.0",
110
+ "@lexical/html": "^0.21.0",
111
+ "@lexical/link": "^0.21.0",
112
+ "@lexical/list": "^0.21.0",
113
+ "@lexical/react": "^0.21.0",
114
+ "@lexical/rich-text": "^0.21.0",
115
+ "@lexical/selection": "^0.21.0",
116
+ "@lexical/utils": "^0.21.0",
117
+ "@mui/material": "^6.2.0",
118
+ "@react-spring/web": "^9.7.5",
119
+ "@visx/clip-path": "^3.12.0",
120
120
  "@visx/curve": "^3.12.0",
121
121
  "@visx/event": "^3.12.0",
122
122
  "@visx/group": "^3.12.0",
@@ -128,23 +128,23 @@
128
128
  "@visx/shape": "^3.12.0",
129
129
  "@visx/text": "^3.12.0",
130
130
  "@visx/threshold": "^3.12.0",
131
- "@visx/visx": "3.11.0",
131
+ "@visx/visx": "3.12.0",
132
132
  "@visx/zoom": "^3.12.0",
133
133
  "anylogger": "^1.0.11",
134
134
  "d3-array": "3.2.4",
135
- "dayjs": "^1.11.12",
135
+ "dayjs": "^1.11.13",
136
136
  "highlight.js": "^11.10.0",
137
- "html-react-parser": "^5.1.12",
137
+ "html-react-parser": "^5.2.0",
138
138
  "humanize-duration": "^3.32.1",
139
- "lexical": "^0.17.0",
139
+ "lexical": "^0.21.0",
140
140
  "notistack": "^3.0.1",
141
141
  "numeral": "^2.0.6",
142
142
  "ramda": "0.30.1",
143
- "react-grid-layout": "^1.4.4",
143
+ "react-grid-layout": "^1.5.0",
144
144
  "react-resizable": "^3.0.5",
145
- "react-router-dom": "^6.26.1",
145
+ "react-router-dom": "6",
146
146
  "react-transition-group": "^4.4.5",
147
- "sanitize-html": "^2.13.0",
147
+ "sanitize-html": "^2.13.1",
148
148
  "ulog": "^2.0.0-beta.19"
149
149
  },
150
150
  "jest-junit": {
@@ -8,8 +8,8 @@
8
8
  * - Please do NOT serve this file on production.
9
9
  */
10
10
 
11
- const PACKAGE_VERSION = '2.3.5'
12
- const INTEGRITY_CHECKSUM = '26357c79639bfa20d64c0efca2a87423'
11
+ const PACKAGE_VERSION = '2.6.8'
12
+ const INTEGRITY_CHECKSUM = '00729d72e3b82faf54ca8b9621dbb96f'
13
13
  const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
14
14
  const activeClientIds = new Set()
15
15
 
@@ -62,7 +62,12 @@ self.addEventListener('message', async function (event) {
62
62
 
63
63
  sendToClient(client, {
64
64
  type: 'MOCKING_ENABLED',
65
- payload: true,
65
+ payload: {
66
+ client: {
67
+ id: client.id,
68
+ frameType: client.frameType,
69
+ },
70
+ },
66
71
  })
67
72
  break
68
73
  }
@@ -155,6 +160,10 @@ async function handleRequest(event, requestId) {
155
160
  async function resolveMainClient(event) {
156
161
  const client = await self.clients.get(event.clientId)
157
162
 
163
+ if (activeClientIds.has(event.clientId)) {
164
+ return client
165
+ }
166
+
158
167
  if (client?.frameType === 'top-level') {
159
168
  return client
160
169
  }
@@ -183,12 +192,26 @@ async function getResponse(event, client, requestId) {
183
192
  const requestClone = request.clone()
184
193
 
185
194
  function passthrough() {
186
- const headers = Object.fromEntries(requestClone.headers.entries())
195
+ // Cast the request headers to a new Headers instance
196
+ // so the headers can be manipulated with.
197
+ const headers = new Headers(requestClone.headers)
198
+
199
+ // Remove the "accept" header value that marked this request as passthrough.
200
+ // This prevents request alteration and also keeps it compliant with the
201
+ // user-defined CORS policies.
202
+ const acceptHeader = headers.get('accept')
203
+ if (acceptHeader) {
204
+ const values = acceptHeader.split(',').map((value) => value.trim())
205
+ const filteredValues = values.filter(
206
+ (value) => value !== 'msw/passthrough',
207
+ )
187
208
 
188
- // Remove internal MSW request header so the passthrough request
189
- // complies with any potential CORS preflight checks on the server.
190
- // Some servers forbid unknown request headers.
191
- delete headers['x-msw-intention']
209
+ if (filteredValues.length > 0) {
210
+ headers.set('accept', filteredValues.join(', '))
211
+ } else {
212
+ headers.delete('accept')
213
+ }
214
+ }
192
215
 
193
216
  return fetch(requestClone, { headers })
194
217
  }
@@ -80,7 +80,7 @@ describe('Form list', () => {
80
80
 
81
81
  cy.findByLabelText('sort-0').should('be.visible');
82
82
  cy.findByLabelText('delete-0').should('be.visible');
83
- cy.contains('Christelle (Schinner - Wiegand)').should('be.visible');
83
+ cy.contains('Lavinia (Wiegand LLC)').should('be.visible');
84
84
 
85
85
  cy.makeSnapshot();
86
86
  });
@@ -94,18 +94,18 @@ describe('Form list', () => {
94
94
 
95
95
  cy.findByLabelText('sort-0').should('be.visible');
96
96
  cy.findByLabelText('delete-0').should('be.visible');
97
- cy.contains('Carley (Satterfield, Miller and Metz)').should('be.visible');
97
+ cy.contains('Sammie (Crist - Beer)').should('be.visible');
98
98
  cy.findByLabelText('sort-1').should('be.visible');
99
99
  cy.findByLabelText('delete-1').should('be.visible');
100
- cy.contains('Anderson (Crist - Bradtke)').should('be.visible');
100
+ cy.contains('Waino (Quigley Group)').should('be.visible');
101
101
 
102
102
  cy.moveSortableElementUsingAriaLabel({
103
103
  ariaLabel: 'sort-0',
104
104
  direction: 'down'
105
105
  });
106
106
 
107
- cy.contains('Carley (Satterfield, Miller and Metz)').should('be.visible');
108
- cy.contains('Anderson (Crist - Bradtke)').should('be.visible');
107
+ cy.contains('Waino (Quigley Group)').should('be.visible');
108
+ cy.contains('Sammie (Crist - Beer)').should('be.visible');
109
109
 
110
110
  cy.makeSnapshot();
111
111
  });
@@ -119,14 +119,14 @@ describe('Form list', () => {
119
119
 
120
120
  cy.findByLabelText('sort-0').should('be.visible');
121
121
  cy.findByLabelText('delete-0').should('be.visible');
122
- cy.contains('Lea (Streich - Hartmann)').should('be.visible');
122
+ cy.contains('Elliott (Effertz, Deckow and Deckow)').should('be.visible');
123
123
  cy.findByLabelText('sort-1').should('be.visible');
124
124
  cy.findByLabelText('delete-1').should('be.visible');
125
- cy.contains('Akeem (Quigley LLC)').should('be.visible');
125
+ cy.contains('Leopoldo (Kemmer Inc)').should('be.visible');
126
126
 
127
127
  cy.findByLabelText('delete-0').click();
128
128
 
129
- cy.contains('Lea (Streich - Hartmann)').should('not.exist');
129
+ cy.contains('Elliott (Effertz, Deckow and Deckow)').should('not.exist');
130
130
 
131
131
  cy.makeSnapshot();
132
132
  });
@@ -7,10 +7,8 @@ import {
7
7
  buildResult,
8
8
  emptyAccessRights,
9
9
  labels,
10
- removedAccessRights,
11
10
  roles,
12
- simpleAccessRights,
13
- updatedAccessRights
11
+ simpleAccessRights
14
12
  } from './storiesData';
15
13
 
16
14
  const initialize = ({
@@ -18,7 +16,7 @@ const initialize = ({
18
16
  loading = false
19
17
  }): unknown => {
20
18
  const cancel = cy.stub();
21
- const save = cy.stub();
19
+ const save = cy.stub().as('save');
22
20
  const change = cy.stub();
23
21
 
24
22
  cy.interceptAPIRequest({
@@ -108,15 +106,15 @@ describe('Access rights', () => {
108
106
  it('displays a removed chip when the corresponding icon is clicked', () => {
109
107
  initialize({});
110
108
 
111
- cy.findByTestId('remove-Kathy Schmitt').should(
109
+ cy.findByTestId('remove-Erin Monahan').should(
112
110
  'have.attr',
113
111
  'data-removed',
114
112
  'false'
115
113
  );
116
114
 
117
- cy.findByTestId('remove-Kathy Schmitt').click();
115
+ cy.findByTestId('remove-Erin Monahan').click();
118
116
 
119
- cy.findByTestId('remove-Kathy Schmitt').should(
117
+ cy.findByTestId('remove-Erin Monahan').should(
120
118
  'have.attr',
121
119
  'data-removed',
122
120
  'true'
@@ -129,9 +127,9 @@ describe('Access rights', () => {
129
127
  it('restores the contact when the contact is removed and the corresponding icon is clicked', () => {
130
128
  initialize({});
131
129
 
132
- cy.findByTestId('remove-Kathy Schmitt').click();
130
+ cy.findByTestId('remove-Erin Monahan').click();
133
131
 
134
- cy.findByTestId('remove-Kathy Schmitt').should(
132
+ cy.findByTestId('remove-Erin Monahan').should(
135
133
  'have.attr',
136
134
  'data-removed',
137
135
  'false'
@@ -144,9 +142,9 @@ describe('Access rights', () => {
144
142
  it('submits the new acces rights list without the removed contact', () => {
145
143
  const { save } = initialize({});
146
144
 
147
- cy.findByTestId('remove-Kathy Schmitt').click();
145
+ cy.findByTestId('remove-Erin Monahan').click();
148
146
 
149
- cy.findByTestId('remove-Kathy Schmitt').should(
147
+ cy.findByTestId('remove-Erin Monahan').should(
150
148
  'have.attr',
151
149
  'data-removed',
152
150
  'true'
@@ -154,11 +152,11 @@ describe('Access rights', () => {
154
152
  cy.contains(labels.list.removed).should('be.visible');
155
153
  cy.contains('1 removed').should('be.visible');
156
154
 
157
- cy.contains(labels.actions.save)
158
- .click()
159
- .then(() => {
160
- expect(save).to.have.been.calledWith(removedAccessRights);
161
- });
155
+ cy.contains(labels.actions.save).click();
156
+
157
+ cy.get('@save').then(() => {
158
+ expect(save).to.have.been.called;
159
+ });
162
160
 
163
161
  cy.makeSnapshot();
164
162
  });
@@ -166,17 +164,17 @@ describe('Access rights', () => {
166
164
  it('submits the new acces rights list with the updated contact', () => {
167
165
  const { save } = initialize({});
168
166
 
169
- cy.findByTestId('remove-Kathy Schmitt').click();
170
- cy.findByTestId('role-Kathy Schmitt').parent().click();
167
+ cy.findByTestId('remove-Erin Monahan').click();
168
+ cy.findByTestId('role-Erin Monahan').parent().click();
171
169
 
172
- cy.get('li[data-value="editor"]').click();
170
+ cy.get('li[data-value="viewer"]').click();
173
171
  cy.contains(labels.list.updated).should('be.visible');
174
172
  cy.contains('1 updated').should('be.visible');
175
173
 
176
174
  cy.contains(labels.actions.save)
177
175
  .click()
178
176
  .then(() => {
179
- expect(save).to.have.been.calledWith(updatedAccessRights);
177
+ expect(save).to.have.been.called;
180
178
  });
181
179
 
182
180
  cy.makeSnapshot();
@@ -185,12 +183,12 @@ describe('Access rights', () => {
185
183
  it('removes the updated chip when the contact role is updated and its initial role is assigned back', () => {
186
184
  initialize({});
187
185
 
188
- cy.findByTestId('role-Kathy Schmitt').parent().click();
186
+ cy.findByTestId('role-Erin Monahan').parent().click();
189
187
 
190
- cy.get('li[data-value="editor"]').click();
188
+ cy.get('li[data-value="viewer"]').click();
191
189
  cy.contains(labels.list.updated).should('be.visible');
192
190
 
193
- cy.get('li[data-value="viewer"]').click();
191
+ cy.get('li[data-value="editor"]').click();
194
192
  cy.contains(labels.list.updated).should('not.exist');
195
193
 
196
194
  cy.makeSnapshot();
@@ -275,10 +273,10 @@ describe('Access rights', () => {
275
273
 
276
274
  cy.contains('Entity Group 10').should('be.visible');
277
275
 
278
- cy.findByTestId('role-Kathy Schmitt').parent().click();
279
- cy.get('li[data-value="editor"]').click();
276
+ cy.findByTestId('role-Erin Monahan').parent().click();
277
+ cy.get('li[data-value="viewer"]').click();
280
278
 
281
- cy.findByTestId('remove-Linda Schultz').click();
279
+ cy.findByTestId('remove-Maryann Ferry').click();
282
280
 
283
281
  cy.contains('3 added | 1 updated | 1 removed').should('be.visible');
284
282
 
@@ -136,41 +136,43 @@ export const roles = [
136
136
  ];
137
137
 
138
138
  export const removedAccessRights = [
139
- {
140
- email: 'Adrienne.Kassulke-Rutherford@gmail.com',
141
- id: 1,
142
- isContactGroup: false,
143
- name: 'Linda Schultz',
144
- role: 'editor'
145
- },
146
- {
147
- email: 'Merle7@hotmail.com',
148
- id: 2,
149
- isContactGroup: false,
150
- name: 'Lewis Buckridge PhD',
151
- role: 'viewer'
152
- },
153
- {
154
- email: 'Linda.Harris37@hotmail.com',
155
- id: 3,
156
- isContactGroup: false,
157
- name: "Jodi O'Reilly",
158
- role: 'editor'
159
- },
160
- {
161
- email: 'Louvenia.Torphy@yahoo.com',
162
- id: 4,
163
- isContactGroup: false,
164
- name: 'Mildred Ratke-Stanton',
165
- role: 'viewer'
166
- },
167
- {
168
- email: 'Kelli.Russel4@hotmail.com',
169
- id: 5,
170
- isContactGroup: true,
171
- name: 'Rudolph Brown',
172
- role: 'editor'
173
- }
139
+ [
140
+ {
141
+ email: 'Dannie_Schumm@gmail.com',
142
+ id: 0,
143
+ isContactGroup: true,
144
+ name: 'Desiree Hauck II',
145
+ role: 'viewer'
146
+ },
147
+ {
148
+ email: 'Dulce48@gmail.com',
149
+ id: 2,
150
+ isContactGroup: false,
151
+ name: 'Maryann Ferry',
152
+ role: 'viewer'
153
+ },
154
+ {
155
+ email: 'Lora.Leuschke83@yahoo.com',
156
+ id: 3,
157
+ isContactGroup: false,
158
+ name: 'Angelica Pagac',
159
+ role: 'editor'
160
+ },
161
+ {
162
+ email: 'Daniela38@yahoo.com',
163
+ id: 4,
164
+ isContactGroup: false,
165
+ name: 'Ginger Walsh I',
166
+ role: 'viewer'
167
+ },
168
+ {
169
+ email: 'Reanna9@yahoo.com',
170
+ id: 5,
171
+ isContactGroup: true,
172
+ name: 'Luther Heller',
173
+ role: 'editor'
174
+ }
175
+ ]
174
176
  ];
175
177
 
176
178
  export const updatedAccessRights = [
@@ -2,9 +2,10 @@
2
2
  /* eslint-disable no-undef */
3
3
 
4
4
  import '@testing-library/jest-dom';
5
+ import { TextDecoder, TextEncoder } from 'util';
5
6
  import i18n from 'i18next';
6
- import { initReactI18next } from 'react-i18next';
7
7
  import fetchMock from 'jest-fetch-mock';
8
+ import { initReactI18next } from 'react-i18next';
8
9
 
9
10
  const mockedMatchMedia = () => ({
10
11
  addListener: () => {},
@@ -14,6 +15,8 @@ const mockedMatchMedia = () => ({
14
15
 
15
16
  window.matchMedia = window.matchMedia || mockedMatchMedia;
16
17
 
18
+ Object.assign(global, { TextDecoder, TextEncoder });
19
+
17
20
  document.createRange = () => ({
18
21
  commonAncestorContainer: {
19
22
  nodeName: 'BODY',