@strapi/admin 4.13.0-beta.0 → 4.13.1

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 (156) hide show
  1. package/admin/src/components/NpsSurvey/hooks/useNpsSurveySettings.js +17 -0
  2. package/admin/src/components/NpsSurvey/index.js +365 -0
  3. package/admin/src/content-manager/components/DynamicZone/components/DynamicZoneLabel.js +1 -1
  4. package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +7 -9
  5. package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/cleanData.js +6 -0
  6. package/admin/src/content-manager/components/Filter/Filter.js +21 -23
  7. package/admin/src/content-manager/components/InputUID/index.js +222 -216
  8. package/admin/src/content-manager/components/RelationInput/RelationInput.js +4 -0
  9. package/admin/src/content-manager/components/RepeatableComponent/index.js +32 -2
  10. package/admin/src/content-manager/components/Wysiwyg/Editor.js +432 -68
  11. package/admin/src/content-manager/components/Wysiwyg/WysiwygNav.js +7 -30
  12. package/admin/src/content-manager/components/Wysiwyg/WysiwygStyles.js +0 -7
  13. package/admin/src/content-manager/components/Wysiwyg/index.js +147 -152
  14. package/admin/src/content-manager/constants/attributes.js +3 -0
  15. package/admin/src/content-manager/hooks/useAllowedAttributes.js +3 -7
  16. package/admin/src/content-manager/pages/CollectionTypeRecursivePath/index.js +1 -1
  17. package/admin/src/content-manager/pages/ListSettingsView/index.js +16 -41
  18. package/admin/src/content-manager/pages/ListView/components/ViewSettingsMenu/index.js +7 -1
  19. package/admin/src/content-manager/pages/ListView/index.js +14 -5
  20. package/admin/src/pages/Admin/index.js +3 -1
  21. package/admin/src/pages/AuthPage/components/Register/index.js +5 -0
  22. package/admin/src/pages/MarketplacePage/index.js +0 -1
  23. package/admin/src/pages/SettingsPage/components/SettingsNav/index.js +3 -3
  24. package/admin/src/pages/SettingsPage/index.js +16 -26
  25. package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +24 -31
  26. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +69 -35
  27. package/admin/src/pages/SettingsPage/pages/TransferTokens/ListView/index.js +11 -6
  28. package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +2 -0
  29. package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +1 -0
  30. package/admin/src/plugins.js +7 -8
  31. package/admin/src/translations/en.json +7 -0
  32. package/build/{1049.f76cb14b.chunk.js → 1049.ec69f5e0.chunk.js} +1 -1
  33. package/build/1227.9f37e1dc.chunk.js +1 -0
  34. package/build/{1386.879bcd90.chunk.js → 1386.ea73b677.chunk.js} +1 -1
  35. package/build/1504.eff012f7.chunk.js +95 -0
  36. package/build/{2225.c6244756.chunk.js → 2225.649fb7bc.chunk.js} +11 -11
  37. package/build/2237.b832ae6e.chunk.js +114 -0
  38. package/build/2379.1f98a31a.chunk.js +1 -0
  39. package/build/2395.0e5e8ded.chunk.js +26 -0
  40. package/build/2801.8e1aa82a.chunk.js +1 -0
  41. package/build/{3483.03c24f96.chunk.js → 3483.19381b40.chunk.js} +1 -1
  42. package/build/{4174.fa8f9954.chunk.js → 4174.f1f39e40.chunk.js} +1 -1
  43. package/build/{4546.ff09eeda.chunk.js → 4546.a5946d22.chunk.js} +1 -1
  44. package/build/4724.aea5c8c1.chunk.js +6 -0
  45. package/build/502.7bba43b1.chunk.js +1 -0
  46. package/build/7464.eb057bec.chunk.js +1 -0
  47. package/build/8276.be3ed581.chunk.js +26 -0
  48. package/build/{Admin-authenticatedApp.53a24d28.chunk.js → Admin-authenticatedApp.baece4ac.chunk.js} +2 -2
  49. package/build/{Admin_InternalErrorPage.f45f2462.chunk.js → Admin_InternalErrorPage.38155af3.chunk.js} +1 -1
  50. package/build/{Admin_homePage.ac9dfb86.chunk.js → Admin_homePage.6f128523.chunk.js} +1 -1
  51. package/build/{Admin_marketplace.dde9c148.chunk.js → Admin_marketplace.061a6e5a.chunk.js} +2 -2
  52. package/build/{Admin_pluginsPage.bbe79434.chunk.js → Admin_pluginsPage.16f837b8.chunk.js} +1 -1
  53. package/build/{Admin_profilePage.192edc52.chunk.js → Admin_profilePage.678bce24.chunk.js} +2 -2
  54. package/build/Admin_settingsPage.af7309e4.chunk.js +111 -0
  55. package/build/{Upload_ConfigureTheView.345ac1e0.chunk.js → Upload_ConfigureTheView.3fc1c100.chunk.js} +1 -1
  56. package/build/admin-app.d63bd229.chunk.js +36 -0
  57. package/build/{admin-edit-roles-page.6d567273.chunk.js → admin-edit-roles-page.38a6c863.chunk.js} +3 -3
  58. package/build/admin-edit-users.545fc882.chunk.js +10 -0
  59. package/build/{admin-roles-list.23ddff26.chunk.js → admin-roles-list.1e2e814d.chunk.js} +1 -1
  60. package/build/{admin-users.123aa08e.chunk.js → admin-users.b8ea5677.chunk.js} +2 -2
  61. package/build/{api-tokens-create-page.46c2ea84.chunk.js → api-tokens-create-page.e0c15627.chunk.js} +1 -1
  62. package/build/{api-tokens-edit-page.58139df9.chunk.js → api-tokens-edit-page.9f2dce47.chunk.js} +1 -1
  63. package/build/api-tokens-list-page.d747051c.chunk.js +16 -0
  64. package/build/{audit-logs-settings-page.0f73ccf8.chunk.js → audit-logs-settings-page.96f9d608.chunk.js} +1 -1
  65. package/build/content-manager.2d676432.chunk.js +1097 -0
  66. package/build/{content-type-builder-list-view.bf9be456.chunk.js → content-type-builder-list-view.b71cf240.chunk.js} +1 -1
  67. package/build/{content-type-builder.cd999f6e.chunk.js → content-type-builder.e5669749.chunk.js} +2 -2
  68. package/build/email-settings-page.2809f0bf.chunk.js +11 -0
  69. package/build/en-json.e12fd5fc.chunk.js +1 -0
  70. package/build/{i18n-settings-page.47f78016.chunk.js → i18n-settings-page.5f716172.chunk.js} +1 -1
  71. package/build/index.html +1 -1
  72. package/build/main.c6c9e04c.js +2859 -0
  73. package/build/review-workflows-settings-create-view.4a156a19.chunk.js +1 -0
  74. package/build/review-workflows-settings-edit-view.ce984d1f.chunk.js +1 -0
  75. package/build/review-workflows-settings-list-view.419b8deb.chunk.js +56 -0
  76. package/build/{runtime~main.b16af570.js → runtime~main.a883e1c1.js} +2 -2
  77. package/build/{sso-settings-page.12b6d8ae.chunk.js → sso-settings-page.45153df5.chunk.js} +1 -1
  78. package/build/{transfer-tokens-create-page.1597e6ab.chunk.js → transfer-tokens-create-page.ebba16d8.chunk.js} +1 -1
  79. package/build/{transfer-tokens-edit-page.8741529f.chunk.js → transfer-tokens-edit-page.d7bb2b3e.chunk.js} +1 -1
  80. package/build/transfer-tokens-list-page.cfe1736c.chunk.js +16 -0
  81. package/build/{upload-settings.7f93d4c0.chunk.js → upload-settings.cc5ad813.chunk.js} +1 -1
  82. package/build/{upload.37488080.chunk.js → upload.756efc28.chunk.js} +1 -1
  83. package/build/users-advanced-settings-page.818d84eb.chunk.js +9 -0
  84. package/build/users-email-settings-page.c1967c09.chunk.js +9 -0
  85. package/build/users-providers-settings-page.11893e08.chunk.js +14 -0
  86. package/build/users-roles-settings-page.2b051e6a.chunk.js +55 -0
  87. package/build/{webhook-edit-page.6cb479ff.chunk.js → webhook-edit-page.de45c635.chunk.js} +2 -2
  88. package/build/{webhook-list-page.65e1b5bb.chunk.js → webhook-list-page.ca91df8b.chunk.js} +1 -1
  89. package/ee/admin/content-manager/pages/EditView/InformationBox/components/AssigneeSelect/AssigneeSelect.js +69 -71
  90. package/ee/admin/content-manager/pages/EditView/InformationBox/components/StageSelect/StageSelect.js +3 -1
  91. package/ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn/ReviewWorkflowsAssigneeEE.js +8 -38
  92. package/ee/admin/hooks/useAuthProviders.js +25 -0
  93. package/ee/admin/hooks/{useLicenseLimitNotification/index.js → useLicenseLimitNotification.js} +2 -4
  94. package/ee/admin/hooks/{useLicenseLimits/useLicenseLimits.js → useLicenseLimits.js} +4 -1
  95. package/ee/admin/pages/AuthPage/components/Login/index.js +8 -4
  96. package/ee/admin/pages/AuthPage/components/Providers/index.js +8 -5
  97. package/ee/admin/pages/HomePage/index.js +1 -1
  98. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/CreateView/CreateView.js +1 -1
  99. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/EditView/EditView.js +1 -1
  100. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/ListView/ListView.js +1 -1
  101. package/ee/admin/pages/SettingsPage/pages/Users/ListPage/CreateAction/index.js +1 -1
  102. package/ee/admin/pages/SettingsPage/pages/Users/ListPage/index.js +1 -1
  103. package/index.js +2 -6
  104. package/package.json +9 -9
  105. package/scripts/build.js +15 -15
  106. package/scripts/create-dev-plugins-file.js +5 -38
  107. package/server/controllers/role.js +2 -0
  108. package/server/controllers/user.js +2 -0
  109. package/server/services/permission/permissions-manager/index.js +3 -1
  110. package/server/services/permission/permissions-manager/sanitize.js +7 -7
  111. package/server/services/permission/permissions-manager/validate.js +218 -0
  112. package/utils/create-cache-dir.js +62 -16
  113. package/utils/create-plugins-exclude-path.js +3 -23
  114. package/utils/get-plugins.js +110 -0
  115. package/utils/index.js +1 -1
  116. package/webpack.config.js +10 -13
  117. package/admin/src/content-manager/components/Wysiwyg/EditorStylesContainer.js +0 -344
  118. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +0 -23
  119. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/prefixAllUrls.js +0 -17
  120. package/admin/src/pages/SettingsPage/utils/createSectionsRoutes.js +0 -11
  121. package/admin/src/pages/SettingsPage/utils/getSectionsToDisplay.js +0 -5
  122. package/admin/src/pages/SettingsPage/utils/index.js +0 -2
  123. package/build/1227.32fe57ce.chunk.js +0 -1
  124. package/build/2379.f1641312.chunk.js +0 -1
  125. package/build/2395.46f8d0c1.chunk.js +0 -26
  126. package/build/2801.5cef5ec8.chunk.js +0 -1
  127. package/build/3929.5632f24d.chunk.js +0 -114
  128. package/build/4724.baf7c5b1.chunk.js +0 -6
  129. package/build/502.8ae8ef60.chunk.js +0 -1
  130. package/build/5542.2415a393.chunk.js +0 -63
  131. package/build/7464.3e64a1d5.chunk.js +0 -1
  132. package/build/8276.10a3f883.chunk.js +0 -26
  133. package/build/Admin_settingsPage.97cb9d41.chunk.js +0 -111
  134. package/build/admin-app.91898385.chunk.js +0 -36
  135. package/build/admin-edit-users.79eeb125.chunk.js +0 -10
  136. package/build/api-tokens-list-page.505bf7e0.chunk.js +0 -16
  137. package/build/content-manager.7f96a2f1.chunk.js +0 -1097
  138. package/build/email-settings-page.d494d1eb.chunk.js +0 -11
  139. package/build/en-json.4f06fe03.chunk.js +0 -1
  140. package/build/main.40b94779.js +0 -2859
  141. package/build/review-workflows-settings-create-view.cb08cfa2.chunk.js +0 -1
  142. package/build/review-workflows-settings-edit-view.3c7cbe63.chunk.js +0 -1
  143. package/build/review-workflows-settings-list-view.1611dc1f.chunk.js +0 -56
  144. package/build/transfer-tokens-list-page.22147d2c.chunk.js +0 -16
  145. package/build/users-advanced-settings-page.f0760eb8.chunk.js +0 -9
  146. package/build/users-email-settings-page.ff4b32f3.chunk.js +0 -9
  147. package/build/users-providers-settings-page.48de0306.chunk.js +0 -14
  148. package/build/users-roles-settings-page.9d9a1eff.chunk.js +0 -30
  149. package/ee/admin/hooks/index.js +0 -4
  150. package/ee/admin/hooks/useAuthProviders/index.js +0 -50
  151. package/ee/admin/hooks/useAuthProviders/reducer.js +0 -26
  152. package/ee/admin/hooks/useLicenseLimits/index.js +0 -1
  153. package/scripts/create-plugins-file.js +0 -92
  154. package/utils/get-plugins-path.js +0 -41
  155. /package/ee/admin/hooks/{useLicenseLimits/__mocks__/index.js → __mocks__/useLicenseLimits.js} +0 -0
  156. /package/server/services/permission/permissions-manager/{query-builers.js → query-builders.js} +0 -0
@@ -1,4 +1,4 @@
1
- import React, { useRef, useState } from 'react';
1
+ import React, { forwardRef, useRef, useState } from 'react';
2
2
 
3
3
  import { Box, Flex, Typography } from '@strapi/design-system';
4
4
  import { prefixFileUrlWithBackendUrl, useLibrary } from '@strapi/helper-plugin';
@@ -30,160 +30,155 @@ const TypographyAsterisk = styled(Typography)`
30
30
  line-height: 0;
31
31
  `;
32
32
 
33
- const Wysiwyg = ({
34
- hint,
35
- disabled,
36
- error,
37
- intlLabel,
38
- labelAction,
39
- name,
40
- onChange,
41
- placeholder,
42
- value,
43
- required,
44
- }) => {
45
- const { formatMessage } = useIntl();
46
- const textareaRef = useRef(null);
47
- const editorRef = useRef(null);
48
- const [isPreviewMode, setIsPreviewMode] = useState(false);
49
- const [mediaLibVisible, setMediaLibVisible] = useState(false);
50
- const [isExpandMode, setIsExpandMode] = useState(false);
51
- const { components } = useLibrary();
52
-
53
- const MediaLibraryDialog = components['media-library'];
54
-
55
- const handleToggleMediaLib = () => setMediaLibVisible((prev) => !prev);
56
- const handleTogglePreviewMode = () => setIsPreviewMode((prev) => !prev);
57
- const handleToggleExpand = () => {
58
- setIsPreviewMode(false);
59
- setIsExpandMode((prev) => !prev);
60
- };
61
-
62
- const handleActionClick = (value, currentEditorRef, togglePopover) => {
63
- switch (value) {
64
- case 'Link':
65
- case 'Strikethrough': {
66
- markdownHandler(currentEditorRef, value);
67
- togglePopover();
68
- break;
33
+ const Wysiwyg = forwardRef(
34
+ (
35
+ { hint, disabled, error, intlLabel, labelAction, name, onChange, placeholder, value, required },
36
+ forwardedRef
37
+ ) => {
38
+ const { formatMessage } = useIntl();
39
+ const textareaRef = useRef(null);
40
+ const editorRef = useRef(null);
41
+ const [isPreviewMode, setIsPreviewMode] = useState(false);
42
+ const [mediaLibVisible, setMediaLibVisible] = useState(false);
43
+ const [isExpandMode, setIsExpandMode] = useState(false);
44
+ const { components } = useLibrary();
45
+
46
+ const MediaLibraryDialog = components['media-library'];
47
+
48
+ const handleToggleMediaLib = () => setMediaLibVisible((prev) => !prev);
49
+ const handleTogglePreviewMode = () => setIsPreviewMode((prev) => !prev);
50
+ const handleToggleExpand = () => {
51
+ setIsPreviewMode(false);
52
+ setIsExpandMode((prev) => !prev);
53
+ };
54
+
55
+ const handleActionClick = (value, currentEditorRef, togglePopover) => {
56
+ switch (value) {
57
+ case 'Link':
58
+ case 'Strikethrough': {
59
+ markdownHandler(currentEditorRef, value);
60
+ togglePopover();
61
+ break;
62
+ }
63
+ case 'Code':
64
+ case 'Quote': {
65
+ quoteAndCodeHandler(currentEditorRef, value);
66
+ togglePopover();
67
+ break;
68
+ }
69
+ case 'Bold':
70
+ case 'Italic':
71
+ case 'Underline': {
72
+ markdownHandler(currentEditorRef, value);
73
+ break;
74
+ }
75
+ case 'BulletList':
76
+ case 'NumberList': {
77
+ listHandler(currentEditorRef, value);
78
+ togglePopover();
79
+ break;
80
+ }
81
+ case 'h1':
82
+ case 'h2':
83
+ case 'h3':
84
+ case 'h4':
85
+ case 'h5':
86
+ case 'h6': {
87
+ titleHandler(currentEditorRef, value);
88
+ break;
89
+ }
90
+ default: {
91
+ // Nothing
92
+ }
69
93
  }
70
- case 'Code':
71
- case 'Quote': {
72
- quoteAndCodeHandler(currentEditorRef, value);
73
- togglePopover();
74
- break;
75
- }
76
- case 'Bold':
77
- case 'Italic':
78
- case 'Underline': {
79
- markdownHandler(currentEditorRef, value);
80
- break;
81
- }
82
- case 'BulletList':
83
- case 'NumberList': {
84
- listHandler(currentEditorRef, value);
85
- togglePopover();
86
- break;
87
- }
88
- case 'h1':
89
- case 'h2':
90
- case 'h3':
91
- case 'h4':
92
- case 'h5':
93
- case 'h6': {
94
- titleHandler(currentEditorRef, value);
95
- break;
96
- }
97
- default: {
98
- // Nothing
99
- }
100
- }
101
- };
102
-
103
- const handleSelectAssets = (files) => {
104
- const formattedFiles = files.map((f) => ({
105
- alt: f.alternativeText || f.name,
106
- url: prefixFileUrlWithBackendUrl(f.url),
107
- mime: f.mime,
108
- }));
109
-
110
- insertFile(editorRef, formattedFiles);
111
- setMediaLibVisible(false);
112
- };
113
-
114
- const formattedPlaceholder = placeholder
115
- ? formatMessage(
116
- { id: placeholder.id, defaultMessage: placeholder.defaultMessage },
117
- { ...placeholder.values }
118
- )
119
- : '';
120
-
121
- const label = intlLabel.id
122
- ? formatMessage(
123
- { id: intlLabel.id, defaultMessage: intlLabel.defaultMessage },
124
- { ...intlLabel.values }
125
- )
126
- : name;
127
-
128
- return (
129
- <>
130
- <Flex direction="column" alignItems="stretch" gap={1}>
131
- <Flex gap={1}>
132
- <Typography variant="pi" fontWeight="bold" textColor="neutral800">
133
- {label}
134
- {required && <TypographyAsterisk textColor="danger600">*</TypographyAsterisk>}
135
- </Typography>
136
- {labelAction && <LabelAction paddingLeft={1}>{labelAction}</LabelAction>}
137
- </Flex>
138
-
139
- <EditorLayout
140
- isExpandMode={isExpandMode}
141
- error={error}
142
- previewContent={value}
143
- onCollapse={handleToggleExpand}
144
- >
145
- <WysiwygNav
146
- isExpandMode={isExpandMode}
147
- editorRef={editorRef}
148
- isPreviewMode={isPreviewMode}
149
- onActionClick={handleActionClick}
150
- onToggleMediaLib={handleToggleMediaLib}
151
- onTogglePreviewMode={isExpandMode ? undefined : handleTogglePreviewMode}
152
- disabled={disabled}
153
- />
154
-
155
- <Editor
156
- disabled={disabled}
94
+ };
95
+
96
+ const handleSelectAssets = (files) => {
97
+ const formattedFiles = files.map((f) => ({
98
+ alt: f.alternativeText || f.name,
99
+ url: prefixFileUrlWithBackendUrl(f.url),
100
+ mime: f.mime,
101
+ }));
102
+
103
+ insertFile(editorRef, formattedFiles);
104
+ setMediaLibVisible(false);
105
+ };
106
+
107
+ const formattedPlaceholder = placeholder
108
+ ? formatMessage(
109
+ { id: placeholder.id, defaultMessage: placeholder.defaultMessage },
110
+ { ...placeholder.values }
111
+ )
112
+ : '';
113
+
114
+ const label = intlLabel.id
115
+ ? formatMessage(
116
+ { id: intlLabel.id, defaultMessage: intlLabel.defaultMessage },
117
+ { ...intlLabel.values }
118
+ )
119
+ : name;
120
+
121
+ return (
122
+ <>
123
+ <Flex direction="column" alignItems="stretch" gap={1}>
124
+ <Flex gap={1}>
125
+ <Typography variant="pi" fontWeight="bold" textColor="neutral800">
126
+ {label}
127
+ {required && <TypographyAsterisk textColor="danger600">*</TypographyAsterisk>}
128
+ </Typography>
129
+ {labelAction && <LabelAction paddingLeft={1}>{labelAction}</LabelAction>}
130
+ </Flex>
131
+
132
+ <EditorLayout
157
133
  isExpandMode={isExpandMode}
158
- editorRef={editorRef}
159
134
  error={error}
160
- isPreviewMode={isPreviewMode}
161
- name={name}
162
- onChange={onChange}
163
- placeholder={formattedPlaceholder}
164
- textareaRef={textareaRef}
165
- value={value}
166
- />
167
-
168
- {!isExpandMode && <WysiwygFooter onToggleExpand={handleToggleExpand} />}
169
- </EditorLayout>
170
- <Hint hint={hint} name={name} error={error} />
171
- </Flex>
172
-
173
- {error && (
174
- <Box paddingTop={1}>
175
- <Typography variant="pi" textColor="danger600" data-strapi-field-error>
176
- {error}
177
- </Typography>
178
- </Box>
179
- )}
180
-
181
- {mediaLibVisible && (
182
- <MediaLibraryDialog onClose={handleToggleMediaLib} onSelectAssets={handleSelectAssets} />
183
- )}
184
- </>
185
- );
186
- };
135
+ previewContent={value}
136
+ onCollapse={handleToggleExpand}
137
+ >
138
+ <WysiwygNav
139
+ isExpandMode={isExpandMode}
140
+ editorRef={editorRef}
141
+ isPreviewMode={isPreviewMode}
142
+ onActionClick={handleActionClick}
143
+ onToggleMediaLib={handleToggleMediaLib}
144
+ onTogglePreviewMode={isExpandMode ? undefined : handleTogglePreviewMode}
145
+ disabled={disabled}
146
+ />
147
+
148
+ <Editor
149
+ disabled={disabled}
150
+ isExpandMode={isExpandMode}
151
+ editorRef={editorRef}
152
+ error={error}
153
+ isPreviewMode={isPreviewMode}
154
+ name={name}
155
+ onChange={onChange}
156
+ placeholder={formattedPlaceholder}
157
+ textareaRef={textareaRef}
158
+ value={value}
159
+ ref={forwardedRef}
160
+ />
161
+
162
+ {!isExpandMode && <WysiwygFooter onToggleExpand={handleToggleExpand} />}
163
+ </EditorLayout>
164
+ <Hint hint={hint} name={name} error={error} />
165
+ </Flex>
166
+
167
+ {error && (
168
+ <Box paddingTop={1}>
169
+ <Typography variant="pi" textColor="danger600" data-strapi-field-error>
170
+ {error}
171
+ </Typography>
172
+ </Box>
173
+ )}
174
+
175
+ {mediaLibVisible && (
176
+ <MediaLibraryDialog onClose={handleToggleMediaLib} onSelectAssets={handleSelectAssets} />
177
+ )}
178
+ </>
179
+ );
180
+ }
181
+ );
187
182
 
188
183
  Wysiwyg.defaultProps = {
189
184
  disabled: false,
@@ -0,0 +1,3 @@
1
+ const CREATOR_FIELDS = ['createdBy', 'updatedBy'];
2
+
3
+ export { CREATOR_FIELDS };
@@ -1,8 +1,9 @@
1
1
  import { useRBACProvider, findMatchingPermissions } from '@strapi/helper-plugin';
2
2
 
3
+ import { CREATOR_FIELDS } from '../constants/attributes';
4
+
3
5
  const NOT_ALLOWED_FILTERS = ['json', 'component', 'media', 'richtext', 'dynamiczone', 'password'];
4
6
  const TIMESTAMPS = ['createdAt', 'updatedAt'];
5
- const CREATOR_ATTRIBUTES = ['createdBy', 'updatedBy'];
6
7
 
7
8
  export const useAllowedAttributes = (contentType, slug) => {
8
9
  const { allPermissions } = useRBACProvider();
@@ -38,10 +39,5 @@ export const useAllowedAttributes = (contentType, slug) => {
38
39
  return true;
39
40
  });
40
41
 
41
- return [
42
- 'id',
43
- ...allowedAttributes,
44
- ...TIMESTAMPS,
45
- ...(canReadAdminUsers ? CREATOR_ATTRIBUTES : []),
46
- ];
42
+ return ['id', ...allowedAttributes, ...TIMESTAMPS, ...(canReadAdminUsers ? CREATOR_FIELDS : [])];
47
43
  };
@@ -12,7 +12,7 @@ import { useFetchContentTypeLayout } from '../../hooks';
12
12
  import { formatLayoutToApi } from '../../utils';
13
13
  import EditSettingsView from '../EditSettingsView';
14
14
  import EditViewLayoutManager from '../EditViewLayoutManager';
15
- import ListSettingsView from '../ListSettingsView';
15
+ import { ListSettingsView } from '../ListSettingsView';
16
16
  import ListViewLayout from '../ListViewLayoutManager';
17
17
 
18
18
  import ErrorFallback from './components/ErrorFallback';
@@ -1,4 +1,4 @@
1
- import React, { useContext, useReducer, useState } from 'react';
1
+ import * as React from 'react';
2
2
 
3
3
  import {
4
4
  Button,
@@ -9,13 +9,7 @@ import {
9
9
  Layout,
10
10
  Main,
11
11
  } from '@strapi/design-system';
12
- import {
13
- ConfirmDialog,
14
- Link,
15
- useFetchClient,
16
- useNotification,
17
- useTracking,
18
- } from '@strapi/helper-plugin';
12
+ import { Link, useFetchClient, useNotification, useTracking } from '@strapi/helper-plugin';
19
13
  import { ArrowLeft, Check } from '@strapi/icons';
20
14
  import isEqual from 'lodash/isEqual';
21
15
  import upperFirst from 'lodash/upperFirst';
@@ -34,16 +28,14 @@ import { SortDisplayedFields } from './components/SortDisplayedFields';
34
28
  import { EXCLUDED_SORT_ATTRIBUTE_TYPES } from './constants';
35
29
  import reducer, { initialState } from './reducer';
36
30
 
37
- const ListSettingsView = ({ layout, slug }) => {
31
+ export const ListSettingsView = ({ layout, slug }) => {
38
32
  const { put } = useFetchClient();
39
33
  const { formatMessage } = useIntl();
40
34
  const { trackUsage } = useTracking();
41
35
  const pluginsQueryParams = usePluginsQueryParams();
42
36
  const toggleNotification = useNotification();
43
- const { refetchData } = useContext(ModelsContext);
44
- const [showWarningSubmit, setWarningSubmit] = useState(false);
45
- const toggleWarningSubmit = () => setWarningSubmit((prevState) => !prevState);
46
- const [{ fieldToEdit, fieldForm, initialData, modifiedData }, dispatch] = useReducer(
37
+ const { refetchData } = React.useContext(ModelsContext);
38
+ const [{ fieldToEdit, fieldForm, initialData, modifiedData }, dispatch] = React.useReducer(
47
39
  reducer,
48
40
  initialState,
49
41
  () => ({
@@ -101,16 +93,6 @@ const ListSettingsView = ({ layout, slug }) => {
101
93
  }
102
94
  );
103
95
 
104
- const handleConfirm = async () => {
105
- const { layouts, settings, metadatas } = modifiedData;
106
-
107
- mutate({
108
- layouts,
109
- settings,
110
- metadatas,
111
- });
112
- };
113
-
114
96
  const handleAddField = (item) => {
115
97
  dispatch({
116
98
  type: 'ADD_FIELD',
@@ -134,9 +116,17 @@ const ListSettingsView = ({ layout, slug }) => {
134
116
  }
135
117
  };
136
118
 
137
- const handleSubmit = (e) => {
138
- e.preventDefault();
139
- toggleWarningSubmit();
119
+ const handleSubmit = (event) => {
120
+ event.preventDefault();
121
+
122
+ const { layouts, settings, metadatas } = modifiedData;
123
+
124
+ mutate({
125
+ layouts,
126
+ settings,
127
+ metadatas,
128
+ });
129
+
140
130
  trackUsage('willSaveContentTypeLayout');
141
131
  };
142
132
 
@@ -257,19 +247,6 @@ const ListSettingsView = ({ layout, slug }) => {
257
247
  />
258
248
  </Flex>
259
249
  </ContentLayout>
260
-
261
- <ConfirmDialog
262
- bodyText={{
263
- id: getTrad('popUpWarning.warning.updateAllSettings'),
264
- defaultMessage: 'This will modify all your settings',
265
- }}
266
- iconRightButton={<Check />}
267
- isConfirmButtonLoading={isSubmittingForm}
268
- isOpen={showWarningSubmit}
269
- onToggleDialog={toggleWarningSubmit}
270
- onConfirm={handleConfirm}
271
- variantRightButton="success-light"
272
- />
273
250
  </form>
274
251
 
275
252
  {isModalFormOpen && (
@@ -309,5 +286,3 @@ ListSettingsView.propTypes = {
309
286
  }).isRequired,
310
287
  slug: PropTypes.string.isRequired,
311
288
  };
312
-
313
- export default ListSettingsView;
@@ -32,7 +32,13 @@ export const ViewSettingsMenu = ({ slug, layout }) => {
32
32
  onClick={handleToggle}
33
33
  />
34
34
  {isVisible && (
35
- <Popover placement="bottom-end" source={cogButtonRef} onDismiss={handleToggle} padding={2}>
35
+ <Popover
36
+ placement="bottom-end"
37
+ source={cogButtonRef}
38
+ onDismiss={handleToggle}
39
+ spacing={4}
40
+ padding={3}
41
+ >
36
42
  <Flex alignItems="stretch" direction="column" gap={3}>
37
43
  <CheckPermissions
38
44
  permissions={permissions.contentManager.collectionTypesConfigurations}
@@ -49,6 +49,7 @@ import { useEnterprise } from '../../../hooks/useEnterprise';
49
49
  import { InjectionZone } from '../../../shared/components';
50
50
  import { Filter } from '../../components/Filter';
51
51
  import { AdminUsersFilter } from '../../components/Filter/CustomInputs/AdminUsersFilter';
52
+ import { CREATOR_FIELDS } from '../../constants/attributes';
52
53
  import { useAllowedAttributes } from '../../hooks/useAllowedAttributes';
53
54
  import { getTrad, getDisplayName } from '../../utils';
54
55
 
@@ -63,8 +64,7 @@ import { buildValidGetParams } from './utils';
63
64
  const REVIEW_WORKFLOW_COLUMNS_CE = null;
64
65
  const REVIEW_WORKFLOW_COLUMNS_CELL_CE = () => null;
65
66
  const REVIEW_WORKFLOW_FILTER_CE = [];
66
- const CREATOR_ATTRIBUTES = ['createdBy', 'updatedBy'];
67
- const USER_FILTER_ATTRIBUTES = [...CREATOR_ATTRIBUTES, 'strapi_assignee'];
67
+ const USER_FILTER_ATTRIBUTES = [...CREATOR_FIELDS, 'strapi_assignee'];
68
68
 
69
69
  function ListView({
70
70
  canCreate,
@@ -785,9 +785,7 @@ function ListView({
785
785
  <Td key={key}>
786
786
  {rowData.strapi_assignee ? (
787
787
  <ReviewWorkflowsColumns.ReviewWorkflowsAssigneeEE
788
- firstname={rowData.strapi_assignee.firstname}
789
- lastname={rowData?.strapi_assignee?.lastname}
790
- displayname={rowData?.strapi_assignee?.username}
788
+ user={rowData.strapi_assignee}
791
789
  />
792
790
  ) : (
793
791
  <Typography textColor="neutral800">-</Typography>
@@ -808,6 +806,17 @@ function ListView({
808
806
  );
809
807
  }
810
808
 
809
+ if (['createdBy', 'updatedBy'].includes(name.split('.')[0])) {
810
+ // Display the users full name
811
+ return (
812
+ <Td key={key}>
813
+ <Typography textColor="neutral800">
814
+ {getDisplayName(rowData[name.split('.')[0]], formatMessage)}
815
+ </Typography>
816
+ </Td>
817
+ );
818
+ }
819
+
811
820
  if (typeof cellFormatter === 'function') {
812
821
  return (
813
822
  <Td key={key}>{cellFormatter(rowData, { key, name, ...rest })}</Td>
@@ -42,7 +42,9 @@ const ProfilePage = lazy(() =>
42
42
  import(/* webpackChunkName: "Admin_profilePage" */ '../ProfilePage')
43
43
  );
44
44
  const SettingsPage = lazy(() =>
45
- import(/* webpackChunkName: "Admin_settingsPage" */ '../SettingsPage')
45
+ import(/* webpackChunkName: "Admin_settingsPage" */ '../SettingsPage').then((module) => ({
46
+ default: module.SettingsPage,
47
+ }))
46
48
  );
47
49
 
48
50
  // Simple hook easier for testing
@@ -29,6 +29,7 @@ import { useIntl } from 'react-intl';
29
29
  import { useHistory } from 'react-router-dom';
30
30
  import styled from 'styled-components';
31
31
 
32
+ import { useNpsSurveySettings } from '../../../../components/NpsSurvey/hooks/useNpsSurveySettings';
32
33
  import Logo from '../../../../components/UnauthenticatedLogo';
33
34
  import UnauthenticatedLayout, { LayoutContent } from '../../../../layouts/UnauthenticatedLayout';
34
35
  import FieldActionWrapper from '../FieldActionWrapper';
@@ -55,6 +56,7 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
55
56
  const query = useQuery();
56
57
  const { formatAPIError } = useAPIErrorHandler();
57
58
  const { get } = useFetchClient();
59
+ const { setNpsSurveySettings } = useNpsSurveySettings();
58
60
 
59
61
  const registrationToken = query.get('registrationToken');
60
62
 
@@ -143,6 +145,9 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
143
145
  } else {
144
146
  onSubmit(normalizedData, formik);
145
147
  }
148
+
149
+ // Only enable EE survey if user accepted the newsletter
150
+ setNpsSurveySettings({ enabled: data.news });
146
151
  } catch (err) {
147
152
  const errors = getYupInnerErrors(err);
148
153
  setSubmitCount(submitCount + 1);
@@ -70,7 +70,6 @@ const MarketPlacePage = () => {
70
70
  id: 'admin.pages.MarketPlacePage.production',
71
71
  defaultMessage: 'Manage plugins from the development environment',
72
72
  },
73
- blockTransition: true,
74
73
  });
75
74
  }
76
75
  }, [toggleNotification, isInDevelopmentMode]);
@@ -12,14 +12,14 @@ import PropTypes from 'prop-types';
12
12
  import { useIntl } from 'react-intl';
13
13
  import { NavLink, useLocation } from 'react-router-dom';
14
14
 
15
- import { getSectionsToDisplay } from '../../utils';
16
-
17
15
  const SettingsNav = ({ menu }) => {
18
16
  const { formatMessage } = useIntl();
19
17
  const { trackUsage } = useTracking();
20
18
  const { pathname } = useLocation();
21
19
 
22
- const filteredMenu = getSectionsToDisplay(menu);
20
+ const filteredMenu = menu.filter(
21
+ (section) => !section.links.every((link) => link.isDisplayed === false)
22
+ );
23
23
 
24
24
  const sections = filteredMenu.map((section) => {
25
25
  return {
@@ -1,15 +1,4 @@
1
- /**
2
- *
3
- * SettingsPage
4
- *
5
- */
6
-
7
- // NOTE TO PLUGINS DEVELOPERS:
8
- // If you modify this file you also need to update the documentation accordingly
9
- // Here's the file: strapi/docs/3.0.0-beta.x/plugin-development/frontend-settings-api.md
10
- // IF THE DOC IS NOT UPDATED THE PULL REQUEST WILL NOT BE MERGED
11
-
12
- import React, { memo, useMemo } from 'react';
1
+ import * as React from 'react';
13
2
 
14
3
  import { Layout } from '@strapi/design-system';
15
4
  import { LoadingIndicatorPage, useStrapiApp } from '@strapi/helper-plugin';
@@ -19,14 +8,14 @@ import { Redirect, Route, Switch, useParams } from 'react-router-dom';
19
8
 
20
9
  import { useSettingsMenu } from '../../hooks';
21
10
  import { useEnterprise } from '../../hooks/useEnterprise';
22
- import { createRoute, makeUniqueRoutes } from '../../utils';
11
+ import createRoute from '../../utils/createRoute';
12
+ import makeUniqueRoutes from '../../utils/makeUniqueRoutes';
23
13
 
24
14
  import SettingsNav from './components/SettingsNav';
25
15
  import { ROUTES_CE } from './constants';
26
16
  import ApplicationInfosPage from './pages/ApplicationInfosPage';
27
- import { createSectionsRoutes } from './utils';
28
17
 
29
- function SettingsPage() {
18
+ export function SettingsPage() {
30
19
  const { settingId } = useParams();
31
20
  const { settings } = useStrapiApp();
32
21
  const { formatMessage } = useIntl();
@@ -43,13 +32,17 @@ function SettingsPage() {
43
32
  );
44
33
 
45
34
  // Creates the admin routes
46
- const adminRoutes = useMemo(() => {
35
+ const adminRoutes = React.useMemo(() => {
47
36
  return makeUniqueRoutes(
48
37
  routes.map(({ to, Component, exact }) => createRoute(Component, to, exact))
49
38
  );
50
39
  }, [routes]);
51
40
 
52
- const pluginsRoutes = createSectionsRoutes(settings);
41
+ const pluginsRoutes = Object.values(settings).flatMap((section) => {
42
+ const { links } = section;
43
+
44
+ return links.map((link) => createRoute(link.Component, link.to, link.exact || false));
45
+ });
53
46
 
54
47
  // Since the useSettingsMenu hook can make API calls in order to check the links permissions
55
48
  // We need to add a loading state to prevent redirecting the user while permissions are being checked
@@ -61,14 +54,14 @@ function SettingsPage() {
61
54
  return <Redirect to="/settings/application-infos" />;
62
55
  }
63
56
 
64
- const settingTitle = formatMessage({
65
- id: 'global.settings',
66
- defaultMessage: 'Settings',
67
- });
68
-
69
57
  return (
70
58
  <Layout sideNav={<SettingsNav menu={menu} />}>
71
- <Helmet title={settingTitle} />
59
+ <Helmet
60
+ title={formatMessage({
61
+ id: 'global.settings',
62
+ defaultMessage: 'Settings',
63
+ })}
64
+ />
72
65
 
73
66
  <Switch>
74
67
  <Route path="/settings/application-infos" component={ApplicationInfosPage} exact />
@@ -78,6 +71,3 @@ function SettingsPage() {
78
71
  </Layout>
79
72
  );
80
73
  }
81
-
82
- export default memo(SettingsPage);
83
- export { SettingsPage };