@strapi/admin 4.0.0-beta.14 → 4.0.0-beta.15

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 (53) hide show
  1. package/admin/src/components/AuthenticatedApp/index.js +2 -1
  2. package/admin/src/components/{UpgradePlanModal → UpgradePlanModal}/index.js +0 -0
  3. package/admin/src/content-manager/components/DynamicTable/TableRows/index.js +2 -1
  4. package/admin/src/content-manager/components/EditViewDataManagerProvider/index.js +3 -1
  5. package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/schema.js +1 -1
  6. package/admin/src/content-manager/components/SelectMany/index.js +11 -2
  7. package/admin/src/content-manager/components/SelectOne/index.js +34 -21
  8. package/admin/src/content-manager/components/SelectWrapper/index.js +4 -7
  9. package/admin/src/content-manager/components/Wysiwyg/Editor.js +3 -2
  10. package/admin/src/content-manager/components/Wysiwyg/EditorStylesContainer.js +5 -2
  11. package/admin/src/content-manager/components/Wysiwyg/WysiwygNav.js +1 -1
  12. package/admin/src/content-manager/pages/EditView/Informations/index.js +3 -2
  13. package/admin/src/content-manager/pages/EditView/index.js +3 -6
  14. package/admin/src/pages/AuthPage/components/Register/index.js +0 -9
  15. package/admin/src/pages/AuthPage/utils/forms.js +2 -2
  16. package/admin/src/pages/ProfilePage/index.js +3 -2
  17. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/ContentBox/index.js +5 -2
  18. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +13 -1
  19. package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/DeleteButton/index.js +6 -2
  20. package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/index.js +12 -2
  21. package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +7 -0
  22. package/admin/src/pages/SettingsPage/pages/Roles/ListPage/index.js +1 -1
  23. package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +3 -3
  24. package/admin/src/pages/SettingsPage/pages/Users/ListPage/DynamicTable/TableRows/index.js +4 -3
  25. package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/schema.js +1 -1
  26. package/admin/src/pages/SettingsPage/pages/Users/utils/validations/users/edit.js +2 -2
  27. package/admin/src/pages/SettingsPage/pages/Users/utils/validations/users/profile.js +6 -2
  28. package/admin/src/utils/getFullName.js +9 -0
  29. package/admin/src/utils/index.js +1 -1
  30. package/build/3226.0dc582b2.chunk.js +2 -0
  31. package/build/3226.0dc582b2.chunk.js.LICENSE.txt +15 -0
  32. package/build/4362.fd69112c.chunk.js +1 -0
  33. package/build/4715.35096dd7.chunk.js +1 -0
  34. package/build/6250.11ba8b50.chunk.js +1 -0
  35. package/build/Admin-authenticatedApp.62e5ca51.chunk.js +1 -0
  36. package/build/Admin_profilePage.3aa61921.chunk.js +1 -0
  37. package/build/Admin_settingsPage.363ad01d.chunk.js +1 -0
  38. package/build/admin-edit-users.bcdd2e4d.chunk.js +1 -0
  39. package/build/admin-users.a2d08780.chunk.js +1 -0
  40. package/build/api-tokens-create-page.ac4285ba.chunk.js +1 -0
  41. package/build/api-tokens-edit-page.b8900ddd.chunk.js +1 -0
  42. package/build/api-tokens-list-page.d451255e.chunk.js +1 -0
  43. package/build/content-manager.d09d2a3a.chunk.js +1 -0
  44. package/build/index.html +1 -1
  45. package/build/main.3414cc4f.js +2 -0
  46. package/build/main.3414cc4f.js.LICENSE.txt +91 -0
  47. package/build/runtime~main.cc96a027.js +1 -0
  48. package/ee/server/controllers/authentication/middlewares.js +1 -1
  49. package/package.json +7 -7
  50. package/server/services/user.js +14 -0
  51. package/server/validation/authentication/register.js +2 -2
  52. package/server/validation/common-validators.js +1 -1
  53. package/server/validation/user.js +3 -3
@@ -11,6 +11,7 @@ import Trash from '@strapi/icons/Trash';
11
11
  import { useHistory } from 'react-router-dom';
12
12
  import { useIntl } from 'react-intl';
13
13
  import { stopPropagation, onRowClick } from '@strapi/helper-plugin';
14
+ import { getFullName } from '../../../../../../../utils';
14
15
 
15
16
  const TableRows = ({
16
17
  canDelete,
@@ -49,7 +50,7 @@ const TableRows = ({
49
50
  id: 'app.component.table.select.one-entry',
50
51
  defaultMessage: `Select {target}`,
51
52
  },
52
- { target: `${data.firstname} ${data.lastname}` }
53
+ { target: getFullName(data.firstname, data.lastname) }
53
54
  )}
54
55
  checked={isChecked}
55
56
  onChange={() => {
@@ -77,7 +78,7 @@ const TableRows = ({
77
78
  onClick={() => push(`${pathname}/${data.id}`)}
78
79
  label={formatMessage(
79
80
  { id: 'app.component.table.edit', defaultMessage: 'Edit {target}' },
80
- { target: `${data.firstname} ${data.lastname}` }
81
+ { target: getFullName(data.firstname, data.lastname) }
81
82
  )}
82
83
  noBorder
83
84
  icon={<Pencil />}
@@ -89,7 +90,7 @@ const TableRows = ({
89
90
  onClick={() => onClickDelete(data.id)}
90
91
  label={formatMessage(
91
92
  { id: 'app.component.table.delete', defaultMessage: 'Delete {target}' },
92
- { target: `${data.firstname} ${data.lastname}` }
93
+ { target: getFullName(data.firstname, data.lastname) }
93
94
  )}
94
95
  noBorder
95
96
  icon={<Trash />}
@@ -3,7 +3,7 @@ import { translatedErrors } from '@strapi/helper-plugin';
3
3
 
4
4
  const schema = yup.object().shape({
5
5
  firstname: yup.string().required(translatedErrors.required),
6
- lastname: yup.string().required(translatedErrors.required),
6
+ lastname: yup.string(),
7
7
  email: yup
8
8
  .string()
9
9
  .email(translatedErrors.email)
@@ -1,9 +1,9 @@
1
1
  import * as yup from 'yup';
2
- import profileValidation from './profile';
2
+ import { commonUserSchema } from './profile';
3
3
  import rolesValidation from './roles';
4
4
 
5
5
  const schema = yup.object().shape({
6
- ...profileValidation,
6
+ ...commonUserSchema,
7
7
  isActive: yup.bool(),
8
8
  ...rolesValidation,
9
9
  });
@@ -1,9 +1,9 @@
1
1
  import * as yup from 'yup';
2
2
  import { translatedErrors } from '@strapi/helper-plugin';
3
3
 
4
- const schema = {
4
+ export const commonUserSchema = {
5
5
  firstname: yup.mixed().required(translatedErrors.required),
6
- lastname: yup.mixed().required(translatedErrors.required),
6
+ lastname: yup.mixed(),
7
7
  email: yup
8
8
  .string()
9
9
  .email(translatedErrors.email)
@@ -23,6 +23,10 @@ const schema = {
23
23
  .when('password', (password, passSchema) => {
24
24
  return password ? passSchema.required(translatedErrors.required) : passSchema;
25
25
  }),
26
+ };
27
+
28
+ const schema = {
29
+ ...commonUserSchema,
26
30
  currentPassword: yup
27
31
  .string()
28
32
  .when(['password', 'confirmPassword'], (password, confirmPassword, passSchema) => {
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Get fullname from firstname+lastname joined with a space
3
+ * Handle missing lastname
4
+ * @param {string} firstname
5
+ * @param {string} lastname
6
+ */
7
+ export default (firstname, lastname = '') => {
8
+ return [firstname, lastname].filter(str => str).join(' ');
9
+ };
@@ -5,5 +5,5 @@ export { default as getAttributesToDisplay } from './getAttributesToDisplay';
5
5
  export { default as makeUniqueRoutes } from './makeUniqueRoutes';
6
6
  export { default as sortLinks } from './sortLinks';
7
7
  export { default as getExistingActions } from './getExistingActions';
8
-
9
8
  export { default as getRequestUrl } from './getRequestUrl';
9
+ export { default as getFullName } from './getFullName';