@strapi/admin 4.9.0 → 4.10.0-beta.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 (184) hide show
  1. package/admin/src/content-manager/components/DynamicTable/CellContent/PublicationState/PublicationState.js +26 -0
  2. package/admin/src/content-manager/components/DynamicTable/CellContent/PublicationState/index.js +1 -0
  3. package/admin/src/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/ReviewWorkflowsStage.js +15 -0
  4. package/admin/src/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/index.js +1 -0
  5. package/admin/src/content-manager/components/DynamicTable/index.js +43 -49
  6. package/admin/src/content-manager/components/DynamicZone/components/DynamicComponent.js +2 -0
  7. package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +1 -3
  8. package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/findAllAndReplace.js +3 -10
  9. package/admin/src/content-manager/components/InputUID/endActionStyle.js +13 -4
  10. package/admin/src/content-manager/components/InputUID/index.js +71 -94
  11. package/admin/src/content-manager/pages/EditView/Information/index.js +77 -53
  12. package/admin/src/content-manager/pages/EditView/InformationBox/InformationBoxCE.js +13 -0
  13. package/admin/src/content-manager/pages/EditView/InformationBox/index.js +3 -0
  14. package/admin/src/content-manager/pages/EditView/index.js +3 -4
  15. package/admin/src/content-manager/pages/ListView/index.js +6 -9
  16. package/admin/src/hooks/useRegenerate/index.js +7 -12
  17. package/admin/src/index.js +1 -0
  18. package/admin/src/pages/AuthPage/components/Register/index.js +38 -46
  19. package/admin/src/pages/SettingsPage/components/Tokens/FormHead/index.js +0 -4
  20. package/admin/src/pages/SettingsPage/components/Tokens/Regenerate/index.js +3 -5
  21. package/admin/src/pages/SettingsPage/components/Tokens/TokenTypeSelect/index.js +5 -7
  22. package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/components/FormTransferTokenContainer/index.js +0 -41
  23. package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/index.js +9 -53
  24. package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/schema.js +0 -1
  25. package/admin/src/pages/SettingsPage/pages/TransferTokens/ListView/index.js +5 -27
  26. package/admin/src/translations/en.json +6 -1
  27. package/build/2263.4c5916f9.chunk.js +98 -0
  28. package/build/4049.64715f20.chunk.js +1 -0
  29. package/build/4649.213b8a3b.chunk.js +30 -0
  30. package/build/6985.66cca29c.chunk.js +1 -0
  31. package/build/7259.aefb51e8.chunk.js +1 -0
  32. package/build/8469.853c822b.chunk.js +1 -0
  33. package/build/9505.dbe702ab.chunk.js +14 -0
  34. package/build/9816.01ee964f.chunk.js +2 -0
  35. package/build/Admin-authenticatedApp.f50ad423.chunk.js +79 -0
  36. package/build/Admin_InternalErrorPage.4ad8b0df.chunk.js +1 -0
  37. package/build/Admin_homePage.1411fb7c.chunk.js +68 -0
  38. package/build/Admin_marketplace.02608d56.chunk.js +22 -0
  39. package/build/Admin_pluginsPage.15e3b0fd.chunk.js +1 -0
  40. package/build/Admin_profilePage.76afeca0.chunk.js +15 -0
  41. package/build/Admin_settingsPage.147755cd.chunk.js +9 -0
  42. package/build/Upload_ConfigureTheView.34dde278.chunk.js +1 -0
  43. package/build/admin-app.55dd7921.chunk.js +112 -0
  44. package/build/admin-edit-roles-page.cf543488.chunk.js +216 -0
  45. package/build/admin-edit-users.31c20712.chunk.js +10 -0
  46. package/build/admin-roles-list.489c501f.chunk.js +2 -0
  47. package/build/admin-users.3e111a7d.chunk.js +11 -0
  48. package/build/api-tokens-create-page.4328b852.chunk.js +1 -0
  49. package/build/api-tokens-edit-page.bce5050f.chunk.js +1 -0
  50. package/build/api-tokens-list-page.93f24348.chunk.js +16 -0
  51. package/build/audit-logs-settings-page.7be97e82.chunk.js +1 -0
  52. package/build/content-manager.4480ae88.chunk.js +1137 -0
  53. package/build/content-type-builder-list-view.cf38fe2f.chunk.js +191 -0
  54. package/build/content-type-builder-translation-en-json.7961593e.chunk.js +1 -0
  55. package/build/content-type-builder.af9abf1e.chunk.js +126 -0
  56. package/build/email-settings-page.4bdbef9a.chunk.js +3 -0
  57. package/build/en-json.697b4bcf.chunk.js +1 -0
  58. package/build/{highlight.js.28a1547e.chunk.js → highlight.js.26ef649f.chunk.js} +2 -2
  59. package/build/i18n-settings-page.2bb5be96.chunk.js +1 -0
  60. package/build/index.html +1 -1
  61. package/build/main.af8c0f31.js +3790 -0
  62. package/build/review-workflows-settings.7a7dc773.chunk.js +57 -0
  63. package/build/runtime~main.5a95bee6.js +2 -0
  64. package/build/sso-settings-page.272b87c8.chunk.js +1 -0
  65. package/build/transfer-tokens-create-page.a1f14bb1.chunk.js +1 -0
  66. package/build/transfer-tokens-edit-page.00ee1c74.chunk.js +1 -0
  67. package/build/transfer-tokens-list-page.ce37354b.chunk.js +16 -0
  68. package/build/upload-settings.0875e973.chunk.js +1 -0
  69. package/build/{upload-translation-th-json.98d35574.chunk.js → upload-translation-th-json.3847dae0.chunk.js} +1 -1
  70. package/build/upload.c7da1611.chunk.js +13 -0
  71. package/build/users-advanced-settings-page.1d3c14c7.chunk.js +1 -0
  72. package/build/users-email-settings-page.e8db68c4.chunk.js +1 -0
  73. package/build/users-providers-settings-page.14cac425.chunk.js +1 -0
  74. package/build/users-roles-settings-page.2ea4de84.chunk.js +30 -0
  75. package/build/webhook-edit-page.329141a5.chunk.js +23 -0
  76. package/build/webhook-list-page.029957a4.chunk.js +1 -0
  77. package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +92 -0
  78. package/ee/admin/content-manager/pages/EditView/InformationBox/index.js +3 -0
  79. package/ee/admin/hooks/useSettingsMenu/utils/customAdminLinks.js +12 -12
  80. package/ee/admin/hooks/useSettingsMenu/utils/customGlobalLinks.js +21 -13
  81. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/ReviewWorkflows.js +195 -0
  82. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/actions/index.js +42 -0
  83. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/AddStage/AddStage.js +87 -0
  84. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/AddStage/index.js +1 -0
  85. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/Stage.js +90 -0
  86. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/index.js +1 -0
  87. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stages.js +92 -0
  88. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/index.js +1 -0
  89. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/constants.js +6 -0
  90. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/hooks/useReviewWorkflows.js +35 -0
  91. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/index.js +3 -0
  92. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/reducer/index.js +121 -0
  93. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/utils/getWorkflowValidationSchema.js +25 -0
  94. package/ee/admin/pages/SettingsPage/utils/customRoutes.js +16 -2
  95. package/ee/admin/permissions/customPermissions.js +3 -0
  96. package/ee/server/bootstrap.js +13 -0
  97. package/ee/server/config/admin-actions.js +10 -0
  98. package/ee/server/constants/default-stages.json +14 -0
  99. package/ee/server/constants/default-workflow.json +1 -0
  100. package/ee/server/constants/workflows.js +8 -0
  101. package/ee/server/content-types/index.js +9 -0
  102. package/ee/server/content-types/workflow/index.js +34 -0
  103. package/ee/server/content-types/workflow-stage/index.js +41 -0
  104. package/ee/server/controllers/index.js +2 -0
  105. package/ee/server/controllers/workflows/index.js +36 -0
  106. package/ee/server/controllers/workflows/stages/index.js +95 -0
  107. package/ee/server/index.js +1 -0
  108. package/ee/server/middlewares/review-workflows.js +40 -0
  109. package/ee/server/migrations/review-workflows.js +39 -0
  110. package/ee/server/register.js +9 -3
  111. package/ee/server/routes/index.js +104 -0
  112. package/ee/server/services/audit-logs.js +16 -75
  113. package/ee/server/services/index.js +4 -0
  114. package/ee/server/services/review-workflows/entity-service-decorator.js +42 -0
  115. package/ee/server/services/review-workflows/review-workflows.js +175 -0
  116. package/ee/server/services/review-workflows/stages.js +148 -0
  117. package/ee/server/services/review-workflows/workflows.js +25 -0
  118. package/ee/server/utils/index.js +8 -0
  119. package/ee/server/utils/review-workflows.js +25 -0
  120. package/ee/server/utils/test.js +11 -0
  121. package/ee/server/validation/review-workflows.js +24 -0
  122. package/jest.config.front.js +6 -1
  123. package/package.json +15 -17
  124. package/server/controllers/transfer/runner.js +2 -4
  125. package/server/middlewares/data-transfer.js +1 -4
  126. package/server/routes/transfer.js +4 -13
  127. package/server/services/constants.js +0 -4
  128. package/server/services/transfer/permission.js +1 -1
  129. package/server/services/transfer/token.js +31 -33
  130. package/server/validation/transfer/token.js +2 -10
  131. package/webpack.config.js +1 -1
  132. package/.eslintignore +0 -4
  133. package/.eslintrc.js +0 -14
  134. package/admin/src/components/LocalesProvider/__mocks__/useLocalesProvider.js +0 -7
  135. package/admin/src/hooks/useConfigurations/__mocks__/index.js +0 -7
  136. package/build/1387.84b454d3.chunk.js +0 -1
  137. package/build/1657.45231968.chunk.js +0 -168
  138. package/build/3081.bcf9a12f.chunk.js +0 -108
  139. package/build/462.8fff7f3b.chunk.js +0 -71
  140. package/build/4628.20631dd1.chunk.js +0 -1
  141. package/build/5542.b8240e3f.chunk.js +0 -70
  142. package/build/5563.905daa13.chunk.js +0 -79
  143. package/build/6404.68405699.chunk.js +0 -100
  144. package/build/7259.b7d00cea.chunk.js +0 -1
  145. package/build/8694.6522968d.chunk.js +0 -247
  146. package/build/9347.058ddb22.chunk.js +0 -1
  147. package/build/Admin-authenticatedApp.31bf88ef.chunk.js +0 -79
  148. package/build/Admin_InternalErrorPage.15c6bf07.chunk.js +0 -1
  149. package/build/Admin_homePage.da2181fe.chunk.js +0 -73
  150. package/build/Admin_marketplace.d99044eb.chunk.js +0 -31
  151. package/build/Admin_pluginsPage.f6b52ee9.chunk.js +0 -6
  152. package/build/Admin_profilePage.9112cffc.chunk.js +0 -15
  153. package/build/Admin_settingsPage.cb63220f.chunk.js +0 -79
  154. package/build/Upload_ConfigureTheView.eaaec495.chunk.js +0 -1
  155. package/build/admin-app.8cde5b22.chunk.js +0 -110
  156. package/build/admin-edit-roles-page.4f1858e9.chunk.js +0 -280
  157. package/build/admin-edit-users.7e14d85f.chunk.js +0 -10
  158. package/build/admin-roles-list.97e198f9.chunk.js +0 -31
  159. package/build/admin-users.d02de059.chunk.js +0 -34
  160. package/build/api-tokens-create-page.97595e12.chunk.js +0 -1
  161. package/build/api-tokens-edit-page.cd36e30e.chunk.js +0 -1
  162. package/build/api-tokens-list-page.6757c7b9.chunk.js +0 -16
  163. package/build/audit-logs-settings-page.ca9a3c46.chunk.js +0 -76
  164. package/build/content-manager.de0ee3e5.chunk.js +0 -1132
  165. package/build/content-type-builder-list-view.9c2c020c.chunk.js +0 -214
  166. package/build/content-type-builder-translation-en-json.e577d595.chunk.js +0 -1
  167. package/build/content-type-builder.ec5ac7ab.chunk.js +0 -126
  168. package/build/email-settings-page.1095e1ab.chunk.js +0 -10
  169. package/build/en-json.b052667a.chunk.js +0 -1
  170. package/build/i18n-settings-page.7d80aae0.chunk.js +0 -60
  171. package/build/main.d40f9ca1.js +0 -2280
  172. package/build/runtime~main.7cdc9956.js +0 -2
  173. package/build/sso-settings-page.1dd4886e.chunk.js +0 -1
  174. package/build/transfer-tokens-create-page.ec2ca215.chunk.js +0 -1
  175. package/build/transfer-tokens-edit-page.22bf28e5.chunk.js +0 -1
  176. package/build/transfer-tokens-list-page.cf8c77f2.chunk.js +0 -16
  177. package/build/upload-settings.945fdcfa.chunk.js +0 -13
  178. package/build/upload.a86b1054.chunk.js +0 -33
  179. package/build/users-advanced-settings-page.5b5a9baa.chunk.js +0 -8
  180. package/build/users-email-settings-page.e5506eb4.chunk.js +0 -23
  181. package/build/users-providers-settings-page.e32089c2.chunk.js +0 -28
  182. package/build/users-roles-settings-page.a5c5b0df.chunk.js +0 -30
  183. package/build/webhook-edit-page.213f0075.chunk.js +0 -75
  184. package/build/webhook-list-page.5beb2a5c.chunk.js +0 -71
@@ -1,5 +1,5 @@
1
1
  import React, { useRef } from 'react';
2
- import propTypes from 'prop-types';
2
+ import PropTypes from 'prop-types';
3
3
  import { useIntl } from 'react-intl';
4
4
  import { useCMEditViewDataManager } from '@strapi/helper-plugin';
5
5
  import { Box, Divider, Flex, Typography } from '@strapi/design-system';
@@ -8,23 +8,44 @@ import { getTrad } from '../../../utils';
8
8
  import getUnits from './utils/getUnits';
9
9
  import { getFullName } from '../../../../utils';
10
10
 
11
+ const Title = () => {
12
+ const { formatMessage } = useIntl();
13
+
14
+ return (
15
+ <Flex direction="column" alignItems="stretch" gap={2}>
16
+ <Typography variant="sigma" textColor="neutral600" id="additional-information">
17
+ {formatMessage({
18
+ id: getTrad('containers.Edit.information'),
19
+ defaultMessage: 'Information',
20
+ })}
21
+ </Typography>
22
+
23
+ <Box>
24
+ <Divider />
25
+ </Box>
26
+ </Flex>
27
+ );
28
+ };
29
+
11
30
  const KeyValuePair = ({ label, value }) => {
12
31
  return (
13
32
  <Flex justifyContent="space-between">
14
- <Typography as="dt" fontWeight="bold" textColor="neutral600">
33
+ <Typography as="dt" fontWeight="bold" textColor="neutral800" variant="pi">
15
34
  {label}
16
35
  </Typography>
17
- <Typography as="dd">{value}</Typography>
36
+ <Typography as="dd" variant="pi" textColor="neutral600">
37
+ {value}
38
+ </Typography>
18
39
  </Flex>
19
40
  );
20
41
  };
21
42
 
22
43
  KeyValuePair.propTypes = {
23
- label: propTypes.string.isRequired,
24
- value: propTypes.string.isRequired,
44
+ label: PropTypes.string.isRequired,
45
+ value: PropTypes.string.isRequired,
25
46
  };
26
47
 
27
- const Information = () => {
48
+ const Body = () => {
28
49
  const { formatMessage, formatRelativeTime } = useIntl();
29
50
  const { initialData, isCreatingEntry } = useCMEditViewDataManager();
30
51
  const currentTime = useRef(Date.now());
@@ -49,57 +70,60 @@ const Information = () => {
49
70
  const created = getFieldInfo('createdAt', 'createdBy');
50
71
 
51
72
  return (
52
- <Flex direction="column" alignItems="stretch" gap={2}>
53
- <Typography variant="sigma" textColor="neutral600" id="additional-information">
54
- {formatMessage({
55
- id: getTrad('containers.Edit.information'),
56
- defaultMessage: 'Information',
57
- })}
58
- </Typography>
73
+ <Flex direction="column" alignItems="stretch" gap={4}>
74
+ <Flex direction="column" alignItems="stretch" gap={2} as="dl">
75
+ <KeyValuePair
76
+ label={formatMessage({
77
+ id: getTrad('containers.Edit.information.created'),
78
+ defaultMessage: 'Created',
79
+ })}
80
+ value={created.at}
81
+ />
59
82
 
60
- <Box paddingBottom={4}>
61
- <Divider />
62
- </Box>
83
+ <KeyValuePair
84
+ label={formatMessage({
85
+ id: getTrad('containers.Edit.information.by'),
86
+ defaultMessage: 'By',
87
+ })}
88
+ value={created.by}
89
+ />
90
+ </Flex>
63
91
 
64
- <Flex direction="column" alignItems="stretch" gap={4}>
65
- <Flex direction="column" alignItems="stretch" gap={2} as="dl">
66
- <KeyValuePair
67
- label={formatMessage({
68
- id: getTrad('containers.Edit.information.created'),
69
- defaultMessage: 'Created',
70
- })}
71
- value={created.at}
72
- />
73
-
74
- <KeyValuePair
75
- label={formatMessage({
76
- id: getTrad('containers.Edit.information.by'),
77
- defaultMessage: 'By',
78
- })}
79
- value={created.by}
80
- />
81
- </Flex>
82
-
83
- <Flex direction="column" alignItems="stretch" gap={2} as="dl">
84
- <KeyValuePair
85
- label={formatMessage({
86
- id: getTrad('containers.Edit.information.lastUpdate'),
87
- defaultMessage: 'Last update',
88
- })}
89
- value={updated.at}
90
- />
91
-
92
- <KeyValuePair
93
- label={formatMessage({
94
- id: getTrad('containers.Edit.information.by'),
95
- defaultMessage: 'By',
96
- })}
97
- value={updated.by}
98
- />
99
- </Flex>
92
+ <Flex direction="column" alignItems="stretch" gap={2} as="dl">
93
+ <KeyValuePair
94
+ label={formatMessage({
95
+ id: getTrad('containers.Edit.information.lastUpdate'),
96
+ defaultMessage: 'Last update',
97
+ })}
98
+ value={updated.at}
99
+ />
100
+
101
+ <KeyValuePair
102
+ label={formatMessage({
103
+ id: getTrad('containers.Edit.information.by'),
104
+ defaultMessage: 'By',
105
+ })}
106
+ value={updated.by}
107
+ />
100
108
  </Flex>
101
109
  </Flex>
102
110
  );
103
111
  };
104
112
 
105
- export default Information;
113
+ const Root = ({ children }) => {
114
+ return (
115
+ <Flex direction="column" alignItems="stretch" gap={4}>
116
+ {children}
117
+ </Flex>
118
+ );
119
+ };
120
+
121
+ Root.propTypes = {
122
+ children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
123
+ };
124
+
125
+ export default {
126
+ Root,
127
+ Title,
128
+ Body,
129
+ };
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+
3
+ import Information from '../Information';
4
+
5
+ // This component is overwritten by the EE counterpart
6
+ export function InformationBoxCE() {
7
+ return (
8
+ <Information.Root>
9
+ <Information.Title />
10
+ <Information.Body />
11
+ </Information.Root>
12
+ );
13
+ }
@@ -0,0 +1,3 @@
1
+ import { InformationBoxCE } from './InformationBoxCE';
2
+
3
+ export default InformationBoxCE;
@@ -8,19 +8,18 @@ import {
8
8
  LoadingIndicatorPage,
9
9
  } from '@strapi/helper-plugin';
10
10
  import { useIntl } from 'react-intl';
11
- import { ContentLayout, Box, Grid, GridItem, Main, Flex } from '@strapi/design-system';
11
+ import { ContentLayout, Box, Flex, Grid, GridItem, Main } from '@strapi/design-system';
12
12
  import { Pencil, Layer } from '@strapi/icons';
13
+ import InformationBox from 'ee_else_ce/content-manager/pages/EditView/InformationBox';
13
14
  import { InjectionZone } from '../../../shared/components';
14
15
  import permissions from '../../../permissions';
15
16
  import DynamicZone from '../../components/DynamicZone';
16
-
17
17
  import CollectionTypeFormWrapper from '../../components/CollectionTypeFormWrapper';
18
18
  import EditViewDataManagerProvider from '../../components/EditViewDataManagerProvider';
19
19
  import SingleTypeFormWrapper from '../../components/SingleTypeFormWrapper';
20
20
  import { getTrad } from '../../utils';
21
21
  import useLazyComponents from '../../hooks/useLazyComponents';
22
22
  import DraftAndPublishBadge from './DraftAndPublishBadge';
23
- import Information from './Information';
24
23
  import Header from './Header';
25
24
  import { getFieldsActionMatchingPermissions } from './utils';
26
25
  import DeleteLink from './DeleteLink';
@@ -180,7 +179,7 @@ const EditView = ({ allowedActions, isSingleType, goBack, slug, id, origin, user
180
179
  paddingTop={6}
181
180
  shadow="tableShadow"
182
181
  >
183
- <Information />
182
+ <InformationBox />
184
183
  <InjectionZone area="contentManager.editView.informations" />
185
184
  </Box>
186
185
  <Box as="aside" aria-labelledby="links">
@@ -6,7 +6,6 @@ import isEqual from 'react-fast-compare';
6
6
  import { bindActionCreators, compose } from 'redux';
7
7
  import { useIntl } from 'react-intl';
8
8
  import { useHistory, useLocation, Link as ReactRouterLink } from 'react-router-dom';
9
- import get from 'lodash/get';
10
9
  import { stringify } from 'qs';
11
10
  import axios from 'axios';
12
11
 
@@ -74,12 +73,11 @@ function ListView({
74
73
  slug,
75
74
  }) {
76
75
  const { total } = pagination;
76
+ const { contentType } = layout;
77
77
  const {
78
- contentType: {
79
- metadatas,
80
- settings: { bulkable: isBulkable, filterable: isFilterable, searchable: isSearchable },
81
- },
82
- } = layout;
78
+ metadatas,
79
+ settings: { bulkable: isBulkable, filterable: isFilterable, searchable: isSearchable },
80
+ } = contentType;
83
81
 
84
82
  const toggleNotification = useNotification();
85
83
  const { trackUsage } = useTracking();
@@ -98,8 +96,7 @@ function ListView({
98
96
  const { pathname } = useLocation();
99
97
  const { push } = useHistory();
100
98
  const { formatMessage } = useIntl();
101
- const contentType = layout.contentType;
102
- const hasDraftAndPublish = get(contentType, 'options.draftAndPublish', false);
99
+ const hasDraftAndPublish = contentType.options?.draftAndPublish ?? false;
103
100
  const fetchClient = useFetchClient();
104
101
  const { post, del } = fetchClient;
105
102
 
@@ -137,7 +134,7 @@ function ListView({
137
134
  return;
138
135
  }
139
136
 
140
- const resStatus = get(err, 'response.status', null);
137
+ const resStatus = err?.response?.status ?? null;
141
138
 
142
139
  if (resStatus === 403) {
143
140
  await fetchPermissionsRef.current();
@@ -1,11 +1,11 @@
1
1
  import { useState } from 'react';
2
- import { useFetchClient, useNotification, useAPIErrorHandler } from '@strapi/helper-plugin';
2
+ import get from 'lodash/get';
3
+ import { useFetchClient, useNotification } from '@strapi/helper-plugin';
3
4
 
4
- const useRegenerate = (url, id, onRegenerate, onError) => {
5
+ const useRegenerate = (url, id, onRegenerate) => {
5
6
  const [isLoadingConfirmation, setIsLoadingConfirmation] = useState(false);
6
7
  const toggleNotification = useNotification();
7
8
  const { post } = useFetchClient();
8
- const { formatAPIError } = useAPIErrorHandler();
9
9
 
10
10
  const regenerateData = async () => {
11
11
  try {
@@ -18,15 +18,10 @@ const useRegenerate = (url, id, onRegenerate, onError) => {
18
18
  onRegenerate(accessKey);
19
19
  } catch (error) {
20
20
  setIsLoadingConfirmation(false);
21
-
22
- if (onError) {
23
- onError(error);
24
- } else {
25
- toggleNotification({
26
- type: 'warning',
27
- message: formatAPIError(error),
28
- });
29
- }
21
+ toggleNotification({
22
+ type: 'warning',
23
+ message: get(error, 'response.data.message', 'notification.error'),
24
+ });
30
25
  }
31
26
  };
32
27
 
@@ -13,6 +13,7 @@ window.strapi = {
13
13
  features: {
14
14
  SSO: 'sso',
15
15
  AUDIT_LOGS: 'audit-logs',
16
+ REVIEW_WORKFLOWS: 'review-workflows',
16
17
  },
17
18
  projectType: 'Community',
18
19
  };
@@ -1,6 +1,7 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import { useIntl } from 'react-intl';
3
3
  import styled from 'styled-components';
4
+ import get from 'lodash/get';
4
5
  import omit from 'lodash/omit';
5
6
  import { useHistory } from 'react-router-dom';
6
7
  import PropTypes from 'prop-types';
@@ -13,7 +14,6 @@ import {
13
14
  useTracking,
14
15
  getYupInnerErrors,
15
16
  Link,
16
- useAPIErrorHandler,
17
17
  } from '@strapi/helper-plugin';
18
18
  import {
19
19
  Box,
@@ -27,10 +27,17 @@ import {
27
27
  Typography,
28
28
  } from '@strapi/design-system';
29
29
  import { EyeStriked, Eye } from '@strapi/icons';
30
- import UnauthenticatedLayout, { LayoutContent } from '../../../../layouts/UnauthenticatedLayout';
30
+ import UnauthenticatedLayout, {
31
+ Column,
32
+ LayoutContent,
33
+ } from '../../../../layouts/UnauthenticatedLayout';
31
34
  import Logo from '../../../../components/UnauthenticatedLogo';
32
35
  import FieldActionWrapper from '../FieldActionWrapper';
33
36
 
37
+ const CenteredBox = styled(Box)`
38
+ text-align: center;
39
+ `;
40
+
34
41
  const A = styled.a`
35
42
  color: ${({ theme }) => theme.colors.primary600};
36
43
  `;
@@ -51,8 +58,6 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
51
58
  const { trackUsage } = useTracking();
52
59
  const { formatMessage } = useIntl();
53
60
  const query = useQuery();
54
- const { formatAPIError } = useAPIErrorHandler();
55
-
56
61
  const registrationToken = query.get('registrationToken');
57
62
 
58
63
  useEffect(() => {
@@ -68,17 +73,17 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
68
73
  if (data) {
69
74
  setUserInfo(data);
70
75
  }
71
- } catch (error) {
72
- const message = formatAPIError(error);
76
+ } catch (err) {
77
+ const errorMessage = get(err, ['response', 'data', 'message'], 'An error occurred');
73
78
 
74
79
  toggleNotification({
75
80
  type: 'warning',
76
- message,
81
+ message: errorMessage,
77
82
  });
78
83
 
79
84
  // Redirect to the oops page in case of an invalid token
80
85
  // @alexandrebodin @JAB I am not sure it is the wanted behavior
81
- push(`/auth/oops?info=${encodeURIComponent(message)}`);
86
+ push(`/auth/oops?info=${encodeURIComponent(errorMessage)}`);
82
87
  }
83
88
  };
84
89
 
@@ -87,20 +92,6 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
87
92
  // eslint-disable-next-line react-hooks/exhaustive-deps
88
93
  }, [registrationToken]);
89
94
 
90
- function normalizeData(data) {
91
- return Object.entries(data).reduce((acc, [key, value]) => {
92
- let normalizedvalue = value;
93
-
94
- if (!['password', 'confirmPassword'].includes(key) && typeof value === 'string') {
95
- normalizedvalue = normalizedvalue.trim();
96
- }
97
-
98
- acc[key] = normalizedvalue;
99
-
100
- return acc;
101
- }, {});
102
- }
103
-
104
95
  return (
105
96
  <UnauthenticatedLayout>
106
97
  <LayoutContent>
@@ -116,10 +107,8 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
116
107
  news: false,
117
108
  }}
118
109
  onSubmit={async (data, formik) => {
119
- const normalizedData = normalizeData(data);
120
-
121
110
  try {
122
- await schema.validate(normalizedData, { abortEarly: false });
111
+ await schema.validate(data, { abortEarly: false });
123
112
 
124
113
  if (submitCount > 0 && authType === 'register-admin') {
125
114
  trackUsage('didSubmitWithErrorsFirstAdmin', { count: submitCount.toString() });
@@ -128,11 +117,11 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
128
117
  if (registrationToken) {
129
118
  // We need to pass the registration token in the url param to the api in order to submit another admin user
130
119
  onSubmit(
131
- { userInfo: omit(normalizedData, ['registrationToken']), registrationToken },
120
+ { userInfo: omit(data, ['registrationToken']), registrationToken },
132
121
  formik
133
122
  );
134
123
  } else {
135
- onSubmit(normalizedData, formik);
124
+ onSubmit(data, formik);
136
125
  }
137
126
  } catch (err) {
138
127
  const errors = getYupInnerErrors(err);
@@ -149,26 +138,27 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
149
138
  return (
150
139
  <Form noValidate>
151
140
  <Main>
152
- <Flex direction="column" alignItems="stretch" gap={3}>
141
+ <Column>
153
142
  <Logo />
154
-
155
- <Typography as="h1" variant="alpha" textAlign="center">
156
- {formatMessage({
157
- id: 'Auth.form.welcome.title',
158
- defaultMessage: 'Welcome to Strapi!',
159
- })}
160
- </Typography>
161
-
162
- <Typography variant="epsilon" textColor="neutral600" textAlign="center">
163
- {formatMessage({
164
- id: 'Auth.form.register.subtitle',
165
- defaultMessage:
166
- 'Credentials are only used to authenticate in Strapi. All saved data will be stored in your database.',
167
- })}
168
- </Typography>
169
- </Flex>
170
-
171
- <Flex direction="column" alignItems="stretch" gap={6} marginTop={7}>
143
+ <Box paddingTop={6} paddingBottom={1}>
144
+ <Typography as="h1" variant="alpha">
145
+ {formatMessage({
146
+ id: 'Auth.form.welcome.title',
147
+ defaultMessage: 'Welcome to Strapi!',
148
+ })}
149
+ </Typography>
150
+ </Box>
151
+ <CenteredBox paddingBottom={7}>
152
+ <Typography variant="epsilon" textColor="neutral600">
153
+ {formatMessage({
154
+ id: 'Auth.form.register.subtitle',
155
+ defaultMessage:
156
+ 'Credentials are only used to authenticate in Strapi. All saved data will be stored in your database.',
157
+ })}
158
+ </Typography>
159
+ </CenteredBox>
160
+ </Column>
161
+ <Flex direction="column" alignItems="stretch" gap={6}>
172
162
  <Grid gap={4}>
173
163
  <GridItem col={6}>
174
164
  <TextInput
@@ -214,6 +204,7 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
214
204
  value={values.password}
215
205
  error={errors.password ? formatMessage(errors.password) : undefined}
216
206
  endAction={
207
+ // eslint-disable-next-line react/jsx-wrap-multilines
217
208
  <FieldActionWrapper
218
209
  onClick={(e) => {
219
210
  e.preventDefault();
@@ -254,6 +245,7 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
254
245
  errors.confirmPassword ? formatMessage(errors.confirmPassword) : undefined
255
246
  }
256
247
  endAction={
248
+ // eslint-disable-next-line react/jsx-wrap-multilines
257
249
  <FieldActionWrapper
258
250
  onClick={(e) => {
259
251
  e.preventDefault();
@@ -15,7 +15,6 @@ const FormHead = ({
15
15
  isSubmitting,
16
16
  backUrl,
17
17
  regenerateUrl,
18
- onErrorRegenerate,
19
18
  }) => {
20
19
  const { formatMessage } = useIntl();
21
20
  const handleRegenerate = (newKey) => {
@@ -36,7 +35,6 @@ const FormHead = ({
36
35
  backUrl={regenerateUrl}
37
36
  onRegenerate={handleRegenerate}
38
37
  idToRegenerate={token?.id}
39
- onError={onErrorRegenerate}
40
38
  />
41
39
  )}
42
40
  <Button
@@ -97,12 +95,10 @@ FormHead.propTypes = {
97
95
  label: PropTypes.string,
98
96
  }).isRequired,
99
97
  regenerateUrl: PropTypes.string.isRequired,
100
- onErrorRegenerate: PropTypes.func,
101
98
  };
102
99
 
103
100
  FormHead.defaultProps = {
104
101
  token: undefined,
105
- onErrorRegenerate: undefined,
106
102
  };
107
103
 
108
104
  export default FormHead;
@@ -6,14 +6,13 @@ import { Refresh } from '@strapi/icons';
6
6
  import { ConfirmDialog } from '@strapi/helper-plugin';
7
7
  import { useRegenerate } from '../../../../../hooks';
8
8
 
9
- export const Regenerate = ({ onRegenerate, idToRegenerate, backUrl, onError }) => {
9
+ export const Regenerate = ({ onRegenerate, idToRegenerate, backUrl }) => {
10
10
  const { formatMessage } = useIntl();
11
11
  const [showConfirmDialog, setShowConfirmDialog] = useState(false);
12
12
  const { regenerateData, isLoadingConfirmation } = useRegenerate(
13
13
  backUrl,
14
14
  idToRegenerate,
15
- onRegenerate,
16
- onError
15
+ onRegenerate
17
16
  );
18
17
  const handleConfirmRegeneration = async () => {
19
18
  regenerateData();
@@ -63,13 +62,12 @@ export const Regenerate = ({ onRegenerate, idToRegenerate, backUrl, onError }) =
63
62
  );
64
63
  };
65
64
 
66
- Regenerate.defaultProps = { onRegenerate() {}, onError: undefined };
65
+ Regenerate.defaultProps = { onRegenerate() {} };
67
66
 
68
67
  Regenerate.propTypes = {
69
68
  onRegenerate: PropTypes.func,
70
69
  idToRegenerate: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
71
70
  backUrl: PropTypes.string.isRequired,
72
- onError: PropTypes.func,
73
71
  };
74
72
 
75
73
  export default Regenerate;
@@ -4,21 +4,21 @@ import { useIntl } from 'react-intl';
4
4
 
5
5
  import { Select, Option } from '@strapi/design-system';
6
6
 
7
- const TokenTypeSelect = ({ name, errors, values, onChange, canEditInputs, options, label }) => {
7
+ const TokenTypeSelect = ({ errors, values, onChange, canEditInputs, options, label }) => {
8
8
  const { formatMessage } = useIntl();
9
9
 
10
10
  return (
11
11
  <Select
12
- name={name}
12
+ name="type"
13
13
  label={formatMessage({
14
14
  id: label.id,
15
15
  defaultMessage: label.defaultMessage,
16
16
  })}
17
- value={values && values[name]}
17
+ value={values?.type}
18
18
  error={
19
- errors[name]
19
+ errors.type
20
20
  ? formatMessage(
21
- errors[name]?.id ? errors[name] : { id: errors[name], defaultMessage: errors[name] }
21
+ errors.type?.id ? errors.type : { id: errors.type, defaultMessage: errors.type }
22
22
  )
23
23
  : null
24
24
  }
@@ -38,7 +38,6 @@ const TokenTypeSelect = ({ name, errors, values, onChange, canEditInputs, option
38
38
  };
39
39
 
40
40
  TokenTypeSelect.propTypes = {
41
- name: PropTypes.string,
42
41
  options: PropTypes.arrayOf(
43
42
  PropTypes.shape({
44
43
  label: PropTypes.shape({
@@ -63,7 +62,6 @@ TokenTypeSelect.propTypes = {
63
62
  };
64
63
 
65
64
  TokenTypeSelect.defaultProps = {
66
- name: 'type',
67
65
  errors: {},
68
66
  options: [],
69
67
  };
@@ -5,7 +5,6 @@ import { Box, Grid, GridItem, Flex, Typography } from '@strapi/design-system';
5
5
  import LifeSpanInput from '../../../../../components/Tokens/LifeSpanInput';
6
6
  import TokenName from '../../../../../components/Tokens/TokenName';
7
7
  import TokenDescription from '../../../../../components/Tokens/TokenDescription';
8
- import TokenTypeSelect from '../../../../../components/Tokens/TokenTypeSelect';
9
8
 
10
9
  const FormTransferTokenContainer = ({
11
10
  errors,
@@ -17,30 +16,6 @@ const FormTransferTokenContainer = ({
17
16
  }) => {
18
17
  const { formatMessage } = useIntl();
19
18
 
20
- const typeOptions = [
21
- {
22
- value: 'push',
23
- label: {
24
- id: 'Settings.transferTokens.types.push',
25
- defaultMessage: 'Push',
26
- },
27
- },
28
- {
29
- value: 'pull',
30
- label: {
31
- id: 'Settings.transferTokens.types.pull',
32
- defaultMessage: 'Pull',
33
- },
34
- },
35
- {
36
- value: 'push-pull',
37
- label: {
38
- id: 'Settings.transferTokens.types.push-pull',
39
- defaultMessage: 'Full Access',
40
- },
41
- },
42
- ];
43
-
44
19
  return (
45
20
  <Box
46
21
  background="neutral0"
@@ -84,22 +59,6 @@ const FormTransferTokenContainer = ({
84
59
  token={transferToken}
85
60
  />
86
61
  </GridItem>
87
- <GridItem key="permissions" col={6} xs={12}>
88
- <TokenTypeSelect
89
- name="permissions"
90
- values={values}
91
- errors={errors}
92
- label={{
93
- id: 'Settings.tokens.form.type',
94
- defaultMessage: 'Token type',
95
- }}
96
- onChange={(value) => {
97
- onChange({ target: { name: 'permissions', value } });
98
- }}
99
- options={typeOptions}
100
- canEditInputs={canEditInputs}
101
- />
102
- </GridItem>
103
62
  </Grid>
104
63
  </Flex>
105
64
  </Box>