@plone/volto 18.34.0 → 18.35.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.
Files changed (153) hide show
  1. package/.release-it.json +3 -0
  2. package/CHANGELOG.md +24 -0
  3. package/locales/af/LC_MESSAGES/volto.po +30 -0
  4. package/locales/af.json +1 -1
  5. package/locales/ar/LC_MESSAGES/volto.po +30 -0
  6. package/locales/ar.json +1 -1
  7. package/locales/bg/LC_MESSAGES/volto.po +30 -0
  8. package/locales/bg.json +1 -1
  9. package/locales/bn/LC_MESSAGES/volto.po +30 -0
  10. package/locales/bn.json +1 -1
  11. package/locales/ca/LC_MESSAGES/volto.po +32 -2
  12. package/locales/ca.json +1 -1
  13. package/locales/cs/LC_MESSAGES/volto.po +30 -0
  14. package/locales/cs.json +1 -1
  15. package/locales/cy/LC_MESSAGES/volto.po +30 -0
  16. package/locales/cy.json +1 -1
  17. package/locales/da/LC_MESSAGES/volto.po +30 -0
  18. package/locales/da.json +1 -1
  19. package/locales/de/LC_MESSAGES/volto.po +34 -4
  20. package/locales/de.json +1 -1
  21. package/locales/el/LC_MESSAGES/volto.po +30 -0
  22. package/locales/el.json +1 -1
  23. package/locales/en/LC_MESSAGES/volto.po +30 -0
  24. package/locales/en.json +1 -1
  25. package/locales/en_AU/LC_MESSAGES/volto.po +30 -0
  26. package/locales/en_AU.json +1 -1
  27. package/locales/en_GB/LC_MESSAGES/volto.po +30 -0
  28. package/locales/en_GB.json +1 -1
  29. package/locales/eo/LC_MESSAGES/volto.po +30 -0
  30. package/locales/eo.json +1 -1
  31. package/locales/es/LC_MESSAGES/volto.po +31 -1
  32. package/locales/es.json +1 -1
  33. package/locales/et/LC_MESSAGES/volto.po +30 -0
  34. package/locales/et.json +1 -1
  35. package/locales/eu/LC_MESSAGES/volto.po +33 -3
  36. package/locales/eu.json +1 -1
  37. package/locales/fa/LC_MESSAGES/volto.po +30 -0
  38. package/locales/fa.json +1 -1
  39. package/locales/fi/LC_MESSAGES/volto.po +30 -0
  40. package/locales/fi.json +1 -1
  41. package/locales/fr/LC_MESSAGES/volto.po +31 -1
  42. package/locales/fr.json +1 -1
  43. package/locales/fu/LC_MESSAGES/volto.po +30 -0
  44. package/locales/fu.json +1 -1
  45. package/locales/gl/LC_MESSAGES/volto.po +30 -0
  46. package/locales/gl.json +1 -1
  47. package/locales/he/LC_MESSAGES/volto.po +30 -0
  48. package/locales/he.json +1 -1
  49. package/locales/hi/LC_MESSAGES/volto.po +33 -3
  50. package/locales/hi.json +1 -1
  51. package/locales/hr/LC_MESSAGES/volto.po +30 -0
  52. package/locales/hr.json +1 -1
  53. package/locales/hu/LC_MESSAGES/volto.po +30 -0
  54. package/locales/hu.json +1 -1
  55. package/locales/hy/LC_MESSAGES/volto.po +30 -0
  56. package/locales/hy.json +1 -1
  57. package/locales/id/LC_MESSAGES/volto.po +30 -0
  58. package/locales/id.json +1 -1
  59. package/locales/it/LC_MESSAGES/volto.po +31 -1
  60. package/locales/it.json +1 -1
  61. package/locales/ja/LC_MESSAGES/volto.po +30 -0
  62. package/locales/ja.json +1 -1
  63. package/locales/ka/LC_MESSAGES/volto.po +30 -0
  64. package/locales/ka.json +1 -1
  65. package/locales/kn/LC_MESSAGES/volto.po +30 -0
  66. package/locales/kn.json +1 -1
  67. package/locales/ko/LC_MESSAGES/volto.po +30 -0
  68. package/locales/ko.json +1 -1
  69. package/locales/lt/LC_MESSAGES/volto.po +30 -0
  70. package/locales/lt.json +1 -1
  71. package/locales/lv/LC_MESSAGES/volto.po +30 -0
  72. package/locales/lv.json +1 -1
  73. package/locales/mi/LC_MESSAGES/volto.po +30 -0
  74. package/locales/mi.json +1 -1
  75. package/locales/mk/LC_MESSAGES/volto.po +30 -0
  76. package/locales/mk.json +1 -1
  77. package/locales/my/LC_MESSAGES/volto.po +30 -0
  78. package/locales/my.json +1 -1
  79. package/locales/nb_NO/LC_MESSAGES/volto.po +30 -0
  80. package/locales/nb_NO.json +1 -1
  81. package/locales/nl/LC_MESSAGES/volto.po +31 -1
  82. package/locales/nl.json +1 -1
  83. package/locales/nn/LC_MESSAGES/volto.po +30 -0
  84. package/locales/nn.json +1 -1
  85. package/locales/pl/LC_MESSAGES/volto.po +30 -0
  86. package/locales/pl.json +1 -1
  87. package/locales/pt/LC_MESSAGES/volto.po +30 -0
  88. package/locales/pt.json +1 -1
  89. package/locales/pt_BR/LC_MESSAGES/volto.po +44 -14
  90. package/locales/pt_BR.json +1 -1
  91. package/locales/rm/LC_MESSAGES/volto.po +30 -0
  92. package/locales/rm.json +1 -1
  93. package/locales/ro/LC_MESSAGES/volto.po +31 -1
  94. package/locales/ro.json +1 -1
  95. package/locales/ru/LC_MESSAGES/volto.po +31 -1
  96. package/locales/ru.json +1 -1
  97. package/locales/sk/LC_MESSAGES/volto.po +30 -0
  98. package/locales/sk.json +1 -1
  99. package/locales/sl/LC_MESSAGES/volto.po +30 -0
  100. package/locales/sl.json +1 -1
  101. package/locales/sm/LC_MESSAGES/volto.po +30 -0
  102. package/locales/sm.json +1 -1
  103. package/locales/sq/LC_MESSAGES/volto.po +30 -0
  104. package/locales/sq.json +1 -1
  105. package/locales/sr/LC_MESSAGES/volto.po +30 -0
  106. package/locales/sr.json +1 -1
  107. package/locales/sr@cyrl/LC_MESSAGES/volto.po +30 -0
  108. package/locales/sr@cyrl.json +1 -1
  109. package/locales/sr@latn/LC_MESSAGES/volto.po +30 -0
  110. package/locales/sr@latn.json +1 -1
  111. package/locales/sv/LC_MESSAGES/volto.po +30 -0
  112. package/locales/sv.json +1 -1
  113. package/locales/ta/LC_MESSAGES/volto.po +31 -1
  114. package/locales/ta.json +1 -1
  115. package/locales/te/LC_MESSAGES/volto.po +30 -0
  116. package/locales/te.json +1 -1
  117. package/locales/th/LC_MESSAGES/volto.po +30 -0
  118. package/locales/th.json +1 -1
  119. package/locales/to/LC_MESSAGES/volto.po +30 -0
  120. package/locales/to.json +1 -1
  121. package/locales/tr/LC_MESSAGES/volto.po +30 -0
  122. package/locales/tr.json +1 -1
  123. package/locales/uk/LC_MESSAGES/volto.po +30 -0
  124. package/locales/uk.json +1 -1
  125. package/locales/vi/LC_MESSAGES/volto.po +30 -0
  126. package/locales/vi.json +1 -1
  127. package/locales/volto.pot +31 -1
  128. package/locales/zh_CN/LC_MESSAGES/volto.po +30 -0
  129. package/locales/zh_CN.json +1 -1
  130. package/locales/zh_Hant/LC_MESSAGES/volto.po +30 -0
  131. package/locales/zh_Hant.json +1 -1
  132. package/locales/zh_Hant_HK/LC_MESSAGES/volto.po +30 -0
  133. package/locales/zh_Hant_HK.json +1 -1
  134. package/news/7308.fix +1 -0
  135. package/news/8084.fix +1 -0
  136. package/package.json +14 -14
  137. package/src/components/manage/Controlpanels/ContentTypes.jsx +9 -2
  138. package/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx +58 -5
  139. package/src/components/manage/Controlpanels/Users/UsersControlpanel.ssr.test.jsx +624 -0
  140. package/src/components/manage/Controlpanels/Users/UsersControlpanel.test.jsx +8 -0
  141. package/src/components/manage/Form/Form.jsx +6 -1
  142. package/src/components/manage/Form/ModalForm.jsx +165 -87
  143. package/src/components/manage/Sidebar/Sidebar.jsx +1 -0
  144. package/src/components/manage/Toast/Toast.jsx +35 -1
  145. package/src/components/manage/Toast/Toast.test.jsx +8 -5
  146. package/src/components/theme/Search/Search.jsx +24 -1
  147. package/src/helpers/FormValidation/validators.ts +15 -2
  148. package/theme/themes/pastanaga/collections/form.overrides +21 -0
  149. package/theme/themes/pastanaga/elements/button.overrides +30 -3
  150. package/theme/themes/pastanaga/extras/main.less +1 -0
  151. package/types/components/manage/Controlpanels/Users/UsersControlpanel.d.ts +2 -6
  152. package/types/components/manage/Controlpanels/Users/UsersControlpanel.ssr.test.d.ts +1 -0
  153. package/types/components/manage/Controlpanels/index.d.ts +1 -1
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "18.34.0",
12
+ "version": "18.35.0",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "git@github.com:plone/volto.git"
@@ -142,8 +142,8 @@
142
142
  "@dnd-kit/core": "6.0.8",
143
143
  "@dnd-kit/sortable": "7.0.2",
144
144
  "@dnd-kit/utilities": "3.2.2",
145
- "@loadable/component": "5.14.1",
146
- "@loadable/server": "5.14.0",
145
+ "@loadable/component": "5.16.7",
146
+ "@loadable/server": "5.16.7",
147
147
  "@redux-devtools/extension": "^3.3.0",
148
148
  "classnames": "2.5.1",
149
149
  "connected-react-router": "6.8.0",
@@ -151,8 +151,8 @@
151
151
  "decorate-component-with-props": "1.2.1",
152
152
  "dependency-graph": "0.10.0",
153
153
  "detect-browser": "5.1.0",
154
- "diff": "3.5.0",
155
- "express": "4.19.2",
154
+ "diff": "3.5.1",
155
+ "express": "4.22.1",
156
156
  "filesize": "6",
157
157
  "full-icu": "1.4.0",
158
158
  "github-slugger": "1.4.0",
@@ -166,7 +166,7 @@
166
166
  "jwt-decode": "2.2.0",
167
167
  "linkify-it": "3.0.2",
168
168
  "locale": "0.1.0",
169
- "lodash": "4.17.23",
169
+ "lodash": "4.18.1",
170
170
  "lodash-move": "1.1.1",
171
171
  "moment": "2.29.4",
172
172
  "object-assign": "4.1.1",
@@ -232,9 +232,9 @@
232
232
  "url": "^0.11.3",
233
233
  "use-deep-compare-effect": "1.8.1",
234
234
  "uuid": "^8.3.2",
235
+ "@plone/scripts": "3.10.6",
235
236
  "@plone/registry": "2.7.2",
236
- "@plone/scripts": "3.10.5",
237
- "@plone/volto-slate": "18.9.2"
237
+ "@plone/volto-slate": "18.10.0"
238
238
  },
239
239
  "devDependencies": {
240
240
  "@babel/core": "^7.0.0",
@@ -249,7 +249,7 @@
249
249
  "@babel/types": "7.20.5",
250
250
  "@fiverr/afterbuild-webpack-plugin": "^1.0.0",
251
251
  "@jest/globals": "^29.7.0",
252
- "@loadable/babel-plugin": "5.13.2",
252
+ "@loadable/babel-plugin": "5.16.1",
253
253
  "@loadable/webpack-plugin": "5.15.2",
254
254
  "@sinonjs/fake-timers": "^6.0.1",
255
255
  "@storybook/addon-actions": "^8.0.4",
@@ -268,7 +268,7 @@
268
268
  "@testing-library/react-hooks": "8.0.1",
269
269
  "@types/history": "^4.7.11",
270
270
  "@types/jest": "^29.5.8",
271
- "@types/loadable__component": "^5.13.9",
271
+ "@types/loadable__component": "^5.13.10",
272
272
  "@types/lodash": "^4.14.201",
273
273
  "@types/node": "^22",
274
274
  "@types/react": "^18",
@@ -308,7 +308,7 @@
308
308
  "eslint-plugin-prettier": "^5.1.3",
309
309
  "eslint-plugin-react": "^7.34.1",
310
310
  "eslint-plugin-react-hooks": "^4.6.0",
311
- "html-webpack-plugin": "5.5.0",
311
+ "html-webpack-plugin": "5.6.7",
312
312
  "identity-obj-proxy": "3.0.0",
313
313
  "jest": "26.6.3",
314
314
  "jest-environment-jsdom": "^26",
@@ -319,7 +319,7 @@
319
319
  "less": "3.13.1",
320
320
  "less-loader": "11.1.0",
321
321
  "lodash-webpack-plugin": "0.11.6",
322
- "mini-css-extract-plugin": "2.7.2",
322
+ "mini-css-extract-plugin": "2.10.2",
323
323
  "moment-locales-webpack-plugin": "1.2.0",
324
324
  "postcss": "8.4.31",
325
325
  "postcss-flexbugs-fixes": "5.0.2",
@@ -331,7 +331,7 @@
331
331
  "razzle": "4.2.18",
332
332
  "razzle-dev-utils": "4.2.18",
333
333
  "razzle-plugin-scss": "4.2.18",
334
- "react-docgen-typescript-plugin": "^1.0.5",
334
+ "react-docgen-typescript-plugin": "^1.0.8",
335
335
  "react-error-overlay": "6.0.9",
336
336
  "react-is": "^18.2.0",
337
337
  "release-it": "^19.0.5",
@@ -345,7 +345,7 @@
345
345
  "svg-loader": "0.0.2",
346
346
  "svgo": "^3.0.0",
347
347
  "svgo-loader": "3.0.3",
348
- "terser-webpack-plugin": "5.3.6",
348
+ "terser-webpack-plugin": "5.4.0",
349
349
  "ts-jest": "^26.4.2",
350
350
  "ts-loader": "9.4.4",
351
351
  "typescript": "^5.7.3",
@@ -227,6 +227,7 @@ class ContentTypes extends Component {
227
227
  addTypeError: undefined,
228
228
  addTypeSetFormDataCallback: undefined,
229
229
  });
230
+ this._addTypeTrigger?.focus();
230
231
  toast.success(
231
232
  <Toast
232
233
  success
@@ -369,10 +370,13 @@ class ContentTypes extends Component {
369
370
  />
370
371
  <ModalForm
371
372
  open={this.state.showAddType}
372
- className="modal"
373
+ className="modal add-content-type"
373
374
  onSubmit={this.onAddTypeSubmit}
374
375
  submitError={this.state.addTypeError}
375
- onCancel={() => this.setState({ showAddType: false })}
376
+ onCancel={() => {
377
+ this.setState({ showAddType: false });
378
+ this._addTypeTrigger?.focus();
379
+ }}
376
380
  title={this.props.intl.formatMessage(messages.addTypeFormTitle)}
377
381
  loading={this.props.cpanelRequest.post.loading}
378
382
  schema={{
@@ -474,6 +478,9 @@ class ContentTypes extends Component {
474
478
  aria-label={this.props.intl.formatMessage(messages.add)}
475
479
  tabIndex={0}
476
480
  id="toolbar-add"
481
+ ref={(el) => {
482
+ this._addTypeTrigger = el;
483
+ }}
477
484
  onClick={() => {
478
485
  this.setState({ showAddType: true });
479
486
  }}
@@ -13,6 +13,7 @@ import { listRoles } from '@plone/volto/actions/roles/roles';
13
13
  import { listGroups, updateGroup } from '@plone/volto/actions/groups/groups';
14
14
  import { getControlpanel } from '@plone/volto/actions/controlpanels/controlpanels';
15
15
  import { getUserSchema } from '@plone/volto/actions/userschema/userschema';
16
+ import { asyncConnect } from '@plone/volto/helpers/AsyncConnect';
16
17
  import jwtDecode from 'jwt-decode';
17
18
  import Icon from '@plone/volto/components/theme/Icon/Icon';
18
19
  import Toast from '@plone/volto/components/manage/Toast/Toast';
@@ -57,7 +58,8 @@ import {
57
58
  * UsersControlpanel functional component.
58
59
  * @function UsersControlpanel
59
60
  */
60
- const UsersControlpanel = () => {
61
+ const UsersControlpanel = (props) => {
62
+ const { staticContext } = props;
61
63
  const intl = useIntl();
62
64
  const dispatch = useDispatch();
63
65
 
@@ -143,7 +145,10 @@ const UsersControlpanel = () => {
143
145
  await listUsersAction();
144
146
  setEntries(users);
145
147
  }
146
- await getUserSchemaAction();
148
+ // Only fetch user schema if it hasn't been loaded yet (e.g. by asyncConnect SSR)
149
+ if (!userschema?.loaded) {
150
+ await getUserSchemaAction();
151
+ }
147
152
  await getUserAction(userId);
148
153
  }, [
149
154
  getControlpanelAction,
@@ -152,6 +157,7 @@ const UsersControlpanel = () => {
152
157
  listGroupsAction,
153
158
  listUsersAction,
154
159
  users,
160
+ userschema,
155
161
  getUserSchemaAction,
156
162
  getUserAction,
157
163
  userId,
@@ -451,6 +457,8 @@ const UsersControlpanel = () => {
451
457
 
452
458
  useEffect(() => {
453
459
  setIsClient(true);
460
+ // Skip fetching if the store already has an error.
461
+ if (loadRolesRequest?.error) return;
454
462
  fetchData();
455
463
  checkLoginUsingEmailStatus();
456
464
  }, []); // eslint-disable-line react-hooks/exhaustive-deps
@@ -471,8 +479,14 @@ const UsersControlpanel = () => {
471
479
  }
472
480
  }, [loadRolesRequest?.error, loadRolesRequest?.loading]);
473
481
 
474
- if (error) {
475
- return <Error error={error} />;
482
+ const effectiveError =
483
+ error ||
484
+ (loadRolesRequest?.error && !loadRolesRequest?.loading
485
+ ? loadRolesRequest.error
486
+ : null);
487
+
488
+ if (effectiveError) {
489
+ return <Error error={effectiveError} staticContext={staticContext} />;
476
490
  }
477
491
 
478
492
  const usernameToDelete = userToDelete ? userToDelete.username : '';
@@ -729,4 +743,43 @@ const UsersControlpanel = () => {
729
743
  );
730
744
  };
731
745
 
732
- export default UsersControlpanel;
746
+ export default asyncConnect([
747
+ {
748
+ key: 'controlpanels',
749
+ promise: ({ store: { dispatch, getState } }) => {
750
+ return dispatch(getControlpanel('usergroup')).then(() => {
751
+ const state = getState();
752
+ const many_users = state.controlpanels?.controlpanel?.data?.many_users;
753
+ if (!many_users) {
754
+ dispatch(listUsers());
755
+ dispatch(listGroups());
756
+ }
757
+ });
758
+ },
759
+ },
760
+ {
761
+ key: 'roles',
762
+ promise: ({ store: { dispatch } }) => {
763
+ return dispatch(listRoles());
764
+ },
765
+ },
766
+ {
767
+ key: 'userschema',
768
+ promise: ({ store: { dispatch } }) => {
769
+ return dispatch(getUserSchema());
770
+ },
771
+ },
772
+ {
773
+ key: 'user',
774
+ promise: ({ store: { dispatch, getState } }) => {
775
+ const state = getState();
776
+ const token = state.userSession.token;
777
+ if (token) {
778
+ const userId = jwtDecode(token).sub;
779
+ if (userId) {
780
+ return dispatch(getUser(userId));
781
+ }
782
+ }
783
+ },
784
+ },
785
+ ])(UsersControlpanel);