@strapi/plugin-users-permissions 0.0.0-next.e9b6852d1c05518ff6e37d599321f7aa7aa0683b → 0.0.0-next.ea6e3b80ab37f554da4f8bde08dbfe9b57400d31

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 (244) hide show
  1. package/admin/src/components/BoundRoute/index.jsx +2 -2
  2. package/admin/src/components/FormModal/Input/index.jsx +32 -31
  3. package/admin/src/components/FormModal/index.jsx +57 -68
  4. package/admin/src/components/Permissions/PermissionRow/CheckboxWrapper.jsx +4 -3
  5. package/admin/src/components/Permissions/PermissionRow/SubCategory.jsx +13 -22
  6. package/admin/src/components/Permissions/index.jsx +27 -35
  7. package/admin/src/components/Permissions/reducer.js +1 -1
  8. package/admin/src/components/Policies/index.jsx +7 -5
  9. package/admin/src/components/UsersPermissions/index.jsx +15 -7
  10. package/admin/src/components/UsersPermissions/reducer.js +1 -1
  11. package/admin/src/index.js +15 -32
  12. package/admin/src/pages/AdvancedSettings/index.jsx +83 -128
  13. package/admin/src/pages/AdvancedSettings/utils/layout.js +20 -35
  14. package/admin/src/pages/AdvancedSettings/utils/schema.js +5 -2
  15. package/admin/src/pages/EmailTemplates/components/EmailForm.jsx +119 -139
  16. package/admin/src/pages/EmailTemplates/components/EmailTable.jsx +20 -17
  17. package/admin/src/pages/EmailTemplates/index.jsx +36 -62
  18. package/admin/src/pages/EmailTemplates/utils/schema.js +18 -6
  19. package/admin/src/pages/Providers/index.jsx +97 -112
  20. package/admin/src/pages/Providers/utils/forms.js +23 -11
  21. package/admin/src/pages/Roles/constants.js +3 -3
  22. package/admin/src/pages/Roles/hooks/usePlugins.js +4 -4
  23. package/admin/src/pages/Roles/index.jsx +9 -18
  24. package/admin/src/pages/Roles/pages/CreatePage.jsx +53 -58
  25. package/admin/src/pages/Roles/pages/EditPage.jsx +63 -68
  26. package/admin/src/pages/Roles/pages/ListPage/components/TableBody.jsx +27 -31
  27. package/admin/src/pages/Roles/pages/ListPage/index.jsx +79 -55
  28. package/admin/src/translations/en.json +1 -1
  29. package/admin/src/utils/prefixPluginTranslations.js +13 -0
  30. package/dist/_chunks/{ar-t5qTFaAD.js → ar-BguGUqwK.js} +1 -1
  31. package/dist/_chunks/ar-BguGUqwK.js.map +1 -0
  32. package/dist/_chunks/{ar-MvD8Ghac.mjs → ar-CK8BRRXB.mjs} +1 -1
  33. package/dist/_chunks/ar-CK8BRRXB.mjs.map +1 -0
  34. package/dist/_chunks/{cs-BMuXwxA1.mjs → cs-BVigMk0l.mjs} +1 -1
  35. package/dist/_chunks/cs-BVigMk0l.mjs.map +1 -0
  36. package/dist/_chunks/{cs-I8N4u-Sd.js → cs-BW8-K_GY.js} +1 -1
  37. package/dist/_chunks/cs-BW8-K_GY.js.map +1 -0
  38. package/dist/_chunks/{de-zs2qqc0W.mjs → de-BKUdRFI4.mjs} +1 -1
  39. package/dist/_chunks/de-BKUdRFI4.mjs.map +1 -0
  40. package/dist/_chunks/{de-YTjtq89K.js → de-owXpVluI.js} +1 -1
  41. package/dist/_chunks/de-owXpVluI.js.map +1 -0
  42. package/dist/_chunks/{dk-HctVBMsG.mjs → dk-BQiTK50l.mjs} +1 -1
  43. package/dist/_chunks/dk-BQiTK50l.mjs.map +1 -0
  44. package/dist/_chunks/{dk-TF-dWjzl.js → dk-LXAnbuBk.js} +1 -1
  45. package/dist/_chunks/dk-LXAnbuBk.js.map +1 -0
  46. package/dist/_chunks/{en-CE3wEy_c.mjs → en-DOHtPf-2.mjs} +2 -2
  47. package/dist/_chunks/en-DOHtPf-2.mjs.map +1 -0
  48. package/dist/_chunks/{en-m608rMZx.js → en-MHo5mcsU.js} +2 -2
  49. package/dist/_chunks/en-MHo5mcsU.js.map +1 -0
  50. package/dist/_chunks/{es-XBQsB8_9.js → es-BwLCLXAQ.js} +1 -1
  51. package/dist/_chunks/es-BwLCLXAQ.js.map +1 -0
  52. package/dist/_chunks/{es-9381tih_.mjs → es-DNgOVMjD.mjs} +1 -1
  53. package/dist/_chunks/es-DNgOVMjD.mjs.map +1 -0
  54. package/dist/_chunks/{fr-CMSc77If.mjs → fr-DkgRugiU.mjs} +1 -1
  55. package/dist/_chunks/fr-DkgRugiU.mjs.map +1 -0
  56. package/dist/_chunks/{fr-6cz3U-IF.js → fr-DkhpSjjm.js} +1 -1
  57. package/dist/_chunks/fr-DkhpSjjm.js.map +1 -0
  58. package/dist/_chunks/{id-RJ934rq-.js → id-BTemOeTZ.js} +1 -1
  59. package/dist/_chunks/id-BTemOeTZ.js.map +1 -0
  60. package/dist/_chunks/{id-SDuyIkZa.mjs → id-BdEsvnaF.mjs} +1 -1
  61. package/dist/_chunks/id-BdEsvnaF.mjs.map +1 -0
  62. package/dist/_chunks/index-BEjCN543-C1E7ADbJ.mjs +11984 -0
  63. package/dist/_chunks/index-BEjCN543-C1E7ADbJ.mjs.map +1 -0
  64. package/dist/_chunks/index-BEjCN543-fMZ4nmrb.js +12008 -0
  65. package/dist/_chunks/index-BEjCN543-fMZ4nmrb.js.map +1 -0
  66. package/dist/_chunks/index-BHbow3DP.js +281 -0
  67. package/dist/_chunks/index-BHbow3DP.js.map +1 -0
  68. package/dist/_chunks/index-BWP-UyKQ.mjs +344 -0
  69. package/dist/_chunks/index-BWP-UyKQ.mjs.map +1 -0
  70. package/dist/_chunks/{index-PIkWT4fR.js → index-CJPwJ4vq.js} +255 -274
  71. package/dist/_chunks/index-CJPwJ4vq.js.map +1 -0
  72. package/dist/_chunks/{index-V3CiTkmR.mjs → index-CKeAk04T.mjs} +239 -256
  73. package/dist/_chunks/index-CKeAk04T.mjs.map +1 -0
  74. package/dist/_chunks/{index-j8_HHqx2.js → index-CWG-Md7l.js} +107 -105
  75. package/dist/_chunks/index-CWG-Md7l.js.map +1 -0
  76. package/dist/_chunks/{index-f7pS9YU1.js → index-CwilIFCz.js} +47 -51
  77. package/dist/_chunks/index-CwilIFCz.js.map +1 -0
  78. package/dist/_chunks/{index-RINRWbs5.mjs → index-DPgyhRuN.mjs} +104 -102
  79. package/dist/_chunks/index-DPgyhRuN.mjs.map +1 -0
  80. package/dist/_chunks/index-DnPMwDrT.js +366 -0
  81. package/dist/_chunks/index-DnPMwDrT.js.map +1 -0
  82. package/dist/_chunks/{index-M6VUX9Xe.mjs → index-N8czFM4v.mjs} +46 -50
  83. package/dist/_chunks/index-N8czFM4v.mjs.map +1 -0
  84. package/dist/_chunks/index-WoqT4Vkv.mjs +262 -0
  85. package/dist/_chunks/index-WoqT4Vkv.mjs.map +1 -0
  86. package/dist/_chunks/{it-bvH7DgQo.mjs → it-B-rv0E24.mjs} +1 -1
  87. package/dist/_chunks/it-B-rv0E24.mjs.map +1 -0
  88. package/dist/_chunks/{it-YhZOlM2X.js → it-D1rH6V6_.js} +1 -1
  89. package/dist/_chunks/it-D1rH6V6_.js.map +1 -0
  90. package/dist/_chunks/{ja-o_-JPvQv.mjs → ja-C8K-VBPD.mjs} +1 -1
  91. package/dist/_chunks/ja-C8K-VBPD.mjs.map +1 -0
  92. package/dist/_chunks/{ja-xssHUXFv.js → ja-DqShgTMf.js} +1 -1
  93. package/dist/_chunks/ja-DqShgTMf.js.map +1 -0
  94. package/dist/_chunks/{ko-C3mHUSJa.js → ko-B9DGEPWH.js} +1 -1
  95. package/dist/_chunks/ko-B9DGEPWH.js.map +1 -0
  96. package/dist/_chunks/{ko-XJbPSez_.mjs → ko-Busb0wIY.mjs} +1 -1
  97. package/dist/_chunks/ko-Busb0wIY.mjs.map +1 -0
  98. package/dist/_chunks/{ms-II5Ea73J.mjs → ms-ByvsQjRt.mjs} +1 -1
  99. package/dist/_chunks/ms-ByvsQjRt.mjs.map +1 -0
  100. package/dist/_chunks/{ms-d0hfg65Z.js → ms-CPBU3LWf.js} +1 -1
  101. package/dist/_chunks/ms-CPBU3LWf.js.map +1 -0
  102. package/dist/_chunks/{nl-vEy6TN0K.mjs → nl-5qO8Rpcy.mjs} +1 -1
  103. package/dist/_chunks/nl-5qO8Rpcy.mjs.map +1 -0
  104. package/dist/_chunks/{nl-TA7TfK_5.js → nl-CwNB6YoO.js} +1 -1
  105. package/dist/_chunks/nl-CwNB6YoO.js.map +1 -0
  106. package/dist/_chunks/{pl-2VowaFGt.mjs → pl-BdIzifBE.mjs} +1 -1
  107. package/dist/_chunks/pl-BdIzifBE.mjs.map +1 -0
  108. package/dist/_chunks/{pl-0pUL9hdA.js → pl-Do9UD69f.js} +1 -1
  109. package/dist/_chunks/pl-Do9UD69f.js.map +1 -0
  110. package/dist/_chunks/{pt-Rf9W51IO.mjs → pt-BIO24ioG.mjs} +1 -1
  111. package/dist/_chunks/pt-BIO24ioG.mjs.map +1 -0
  112. package/dist/_chunks/{pt-BR-WNOhafR4.js → pt-BR-D7dZhxuP.js} +1 -1
  113. package/dist/_chunks/pt-BR-D7dZhxuP.js.map +1 -0
  114. package/dist/_chunks/{pt-BR-sS1Xp3Jt.mjs → pt-BR-f0p23AQZ.mjs} +1 -1
  115. package/dist/_chunks/pt-BR-f0p23AQZ.mjs.map +1 -0
  116. package/dist/_chunks/{pt-guNR9Gax.js → pt-fdvyOnUp.js} +1 -1
  117. package/dist/_chunks/pt-fdvyOnUp.js.map +1 -0
  118. package/dist/_chunks/{ru-X3BMXDds.js → ru-C94rjPGA.js} +1 -1
  119. package/dist/_chunks/ru-C94rjPGA.js.map +1 -0
  120. package/dist/_chunks/{ru-qKHnd5or.mjs → ru-VWy-IB7K.mjs} +1 -1
  121. package/dist/_chunks/ru-VWy-IB7K.mjs.map +1 -0
  122. package/dist/_chunks/{sk-NWPw1oTN.js → sk-BABEhykl.js} +1 -1
  123. package/dist/_chunks/sk-BABEhykl.js.map +1 -0
  124. package/dist/_chunks/{sk-_Ryr-eTT.mjs → sk-B_LIcepm.mjs} +1 -1
  125. package/dist/_chunks/sk-B_LIcepm.mjs.map +1 -0
  126. package/dist/_chunks/{sv-BqzScFXS.mjs → sv-ABLKOokl.mjs} +1 -1
  127. package/dist/_chunks/sv-ABLKOokl.mjs.map +1 -0
  128. package/dist/_chunks/{sv-76NnbB__.js → sv-Be43LhA9.js} +1 -1
  129. package/dist/_chunks/sv-Be43LhA9.js.map +1 -0
  130. package/dist/_chunks/{th-WsknMEpq.mjs → th-DKyP7ueR.mjs} +1 -1
  131. package/dist/_chunks/th-DKyP7ueR.mjs.map +1 -0
  132. package/dist/_chunks/{th-cbppX21D.js → th-DgVhVLhL.js} +1 -1
  133. package/dist/_chunks/th-DgVhVLhL.js.map +1 -0
  134. package/dist/_chunks/{tr-6mm_Fmz7.js → tr-B_idhkEs.js} +1 -1
  135. package/dist/_chunks/tr-B_idhkEs.js.map +1 -0
  136. package/dist/_chunks/{tr-_DB1F1GW.mjs → tr-qa1Q5UjC.mjs} +1 -1
  137. package/dist/_chunks/tr-qa1Q5UjC.mjs.map +1 -0
  138. package/dist/_chunks/{uk-yxMSQAwI.mjs → uk-BmRqbeQc.mjs} +1 -1
  139. package/dist/_chunks/uk-BmRqbeQc.mjs.map +1 -0
  140. package/dist/_chunks/{uk-sI2I1ogF.js → uk-LHOivnhP.js} +1 -1
  141. package/dist/_chunks/uk-LHOivnhP.js.map +1 -0
  142. package/dist/_chunks/{vi-A3zJxaiI.js → vi-CdVRdKDw.js} +1 -1
  143. package/dist/_chunks/vi-CdVRdKDw.js.map +1 -0
  144. package/dist/_chunks/{vi-xY0zCW3d.mjs → vi-HW-EdMea.mjs} +1 -1
  145. package/dist/_chunks/vi-HW-EdMea.mjs.map +1 -0
  146. package/dist/_chunks/{zh-OFeldzbX.mjs → zh-5hKkVPA4.mjs} +1 -1
  147. package/dist/_chunks/zh-5hKkVPA4.mjs.map +1 -0
  148. package/dist/_chunks/{zh-72SpmFXa.js → zh-Cuq8gMnF.js} +1 -1
  149. package/dist/_chunks/zh-Cuq8gMnF.js.map +1 -0
  150. package/dist/_chunks/{zh-Hans-E84cu4kP.mjs → zh-Hans-BHilK-yc.mjs} +1 -1
  151. package/dist/_chunks/zh-Hans-BHilK-yc.mjs.map +1 -0
  152. package/dist/_chunks/{zh-Hans-ArWWtyP4.js → zh-Hans-GQDMKtY4.js} +1 -1
  153. package/dist/_chunks/zh-Hans-GQDMKtY4.js.map +1 -0
  154. package/dist/admin/index.js +1 -2
  155. package/dist/admin/index.js.map +1 -1
  156. package/dist/admin/index.mjs +1 -2
  157. package/dist/admin/index.mjs.map +1 -1
  158. package/package.json +27 -28
  159. package/server/bootstrap/index.js +18 -51
  160. package/server/content-types/user/index.js +0 -1
  161. package/server/controllers/auth.js +40 -59
  162. package/server/controllers/content-manager-user.js +28 -30
  163. package/server/controllers/role.js +17 -4
  164. package/server/controllers/user.js +8 -9
  165. package/server/controllers/validation/auth.js +81 -25
  166. package/server/middlewares/rateLimit.js +1 -1
  167. package/server/register.js +1 -1
  168. package/server/services/jwt.js +3 -3
  169. package/server/services/permission.js +3 -7
  170. package/server/services/providers-registry.js +468 -279
  171. package/server/services/providers.js +10 -5
  172. package/server/services/role.js +15 -13
  173. package/server/services/user.js +56 -19
  174. package/server/services/users-permissions.js +15 -13
  175. package/server/utils/index.d.ts +2 -1
  176. package/server/utils/sanitize/sanitizers.js +7 -3
  177. package/server/utils/sanitize/visitors/remove-user-relation-from-role-entities.js +2 -2
  178. package/admin/src/pages/Roles/pages/ListPage/utils/api.js +0 -30
  179. package/dist/_chunks/ar-MvD8Ghac.mjs.map +0 -1
  180. package/dist/_chunks/ar-t5qTFaAD.js.map +0 -1
  181. package/dist/_chunks/cs-BMuXwxA1.mjs.map +0 -1
  182. package/dist/_chunks/cs-I8N4u-Sd.js.map +0 -1
  183. package/dist/_chunks/de-YTjtq89K.js.map +0 -1
  184. package/dist/_chunks/de-zs2qqc0W.mjs.map +0 -1
  185. package/dist/_chunks/dk-HctVBMsG.mjs.map +0 -1
  186. package/dist/_chunks/dk-TF-dWjzl.js.map +0 -1
  187. package/dist/_chunks/en-CE3wEy_c.mjs.map +0 -1
  188. package/dist/_chunks/en-m608rMZx.js.map +0 -1
  189. package/dist/_chunks/es-9381tih_.mjs.map +0 -1
  190. package/dist/_chunks/es-XBQsB8_9.js.map +0 -1
  191. package/dist/_chunks/fr-6cz3U-IF.js.map +0 -1
  192. package/dist/_chunks/fr-CMSc77If.mjs.map +0 -1
  193. package/dist/_chunks/id-RJ934rq-.js.map +0 -1
  194. package/dist/_chunks/id-SDuyIkZa.mjs.map +0 -1
  195. package/dist/_chunks/index--NjZI15Z.mjs +0 -301
  196. package/dist/_chunks/index--NjZI15Z.mjs.map +0 -1
  197. package/dist/_chunks/index-EFtzpYTe.mjs +0 -385
  198. package/dist/_chunks/index-EFtzpYTe.mjs.map +0 -1
  199. package/dist/_chunks/index-M6VUX9Xe.mjs.map +0 -1
  200. package/dist/_chunks/index-PIkWT4fR.js.map +0 -1
  201. package/dist/_chunks/index-RINRWbs5.mjs.map +0 -1
  202. package/dist/_chunks/index-V3CiTkmR.mjs.map +0 -1
  203. package/dist/_chunks/index-d2k7RBd6.js +0 -407
  204. package/dist/_chunks/index-d2k7RBd6.js.map +0 -1
  205. package/dist/_chunks/index-f7pS9YU1.js.map +0 -1
  206. package/dist/_chunks/index-j8_HHqx2.js.map +0 -1
  207. package/dist/_chunks/index-zhL5rDjK.js +0 -320
  208. package/dist/_chunks/index-zhL5rDjK.js.map +0 -1
  209. package/dist/_chunks/it-YhZOlM2X.js.map +0 -1
  210. package/dist/_chunks/it-bvH7DgQo.mjs.map +0 -1
  211. package/dist/_chunks/ja-o_-JPvQv.mjs.map +0 -1
  212. package/dist/_chunks/ja-xssHUXFv.js.map +0 -1
  213. package/dist/_chunks/ko-C3mHUSJa.js.map +0 -1
  214. package/dist/_chunks/ko-XJbPSez_.mjs.map +0 -1
  215. package/dist/_chunks/ms-II5Ea73J.mjs.map +0 -1
  216. package/dist/_chunks/ms-d0hfg65Z.js.map +0 -1
  217. package/dist/_chunks/nl-TA7TfK_5.js.map +0 -1
  218. package/dist/_chunks/nl-vEy6TN0K.mjs.map +0 -1
  219. package/dist/_chunks/pl-0pUL9hdA.js.map +0 -1
  220. package/dist/_chunks/pl-2VowaFGt.mjs.map +0 -1
  221. package/dist/_chunks/pt-BR-WNOhafR4.js.map +0 -1
  222. package/dist/_chunks/pt-BR-sS1Xp3Jt.mjs.map +0 -1
  223. package/dist/_chunks/pt-Rf9W51IO.mjs.map +0 -1
  224. package/dist/_chunks/pt-guNR9Gax.js.map +0 -1
  225. package/dist/_chunks/ru-X3BMXDds.js.map +0 -1
  226. package/dist/_chunks/ru-qKHnd5or.mjs.map +0 -1
  227. package/dist/_chunks/sk-NWPw1oTN.js.map +0 -1
  228. package/dist/_chunks/sk-_Ryr-eTT.mjs.map +0 -1
  229. package/dist/_chunks/sv-76NnbB__.js.map +0 -1
  230. package/dist/_chunks/sv-BqzScFXS.mjs.map +0 -1
  231. package/dist/_chunks/th-WsknMEpq.mjs.map +0 -1
  232. package/dist/_chunks/th-cbppX21D.js.map +0 -1
  233. package/dist/_chunks/tr-6mm_Fmz7.js.map +0 -1
  234. package/dist/_chunks/tr-_DB1F1GW.mjs.map +0 -1
  235. package/dist/_chunks/uk-sI2I1ogF.js.map +0 -1
  236. package/dist/_chunks/uk-yxMSQAwI.mjs.map +0 -1
  237. package/dist/_chunks/vi-A3zJxaiI.js.map +0 -1
  238. package/dist/_chunks/vi-xY0zCW3d.mjs.map +0 -1
  239. package/dist/_chunks/zh-72SpmFXa.js.map +0 -1
  240. package/dist/_chunks/zh-Hans-ArWWtyP4.js.map +0 -1
  241. package/dist/_chunks/zh-Hans-E84cu4kP.mjs.map +0 -1
  242. package/dist/_chunks/zh-OFeldzbX.mjs.map +0 -1
  243. package/server/bootstrap/grant-config.js +0 -140
  244. package/strapi-server.js +0 -3
@@ -1,34 +1,17 @@
1
1
  import React from 'react';
2
2
 
3
+ import { Box, Button, Flex, Grid, Typography, useNotifyAT } from '@strapi/design-system';
4
+ import { Check } from '@strapi/icons';
3
5
  import {
4
- Box,
5
- Button,
6
- ContentLayout,
7
- Flex,
8
- Grid,
9
- GridItem,
10
- HeaderLayout,
11
- Main,
12
- Option,
13
- Select,
14
- Typography,
15
- useNotifyAT,
16
- } from '@strapi/design-system';
17
- import {
18
- CheckPagePermissions,
19
- Form,
20
- GenericInput,
21
- LoadingIndicatorPage,
22
- SettingsPageTitle,
23
6
  useAPIErrorHandler,
24
- useFetchClient,
25
- useFocusWhenNavigate,
7
+ Page,
8
+ Form,
9
+ InputRenderer,
26
10
  useNotification,
27
- useOverlayBlocker,
11
+ useFetchClient,
28
12
  useRBAC,
29
- } from '@strapi/helper-plugin';
30
- import { Check } from '@strapi/icons';
31
- import { Formik } from 'formik';
13
+ Layouts,
14
+ } from '@strapi/strapi/admin';
32
15
  import { useIntl } from 'react-intl';
33
16
  import { useMutation, useQuery, useQueryClient } from 'react-query';
34
17
 
@@ -39,22 +22,19 @@ import layout from './utils/layout';
39
22
  import schema from './utils/schema';
40
23
 
41
24
  const ProtectedAdvancedSettingsPage = () => (
42
- <CheckPagePermissions permissions={PERMISSIONS.readAdvancedSettings}>
25
+ <Page.Protect permissions={PERMISSIONS.readAdvancedSettings}>
43
26
  <AdvancedSettingsPage />
44
- </CheckPagePermissions>
27
+ </Page.Protect>
45
28
  );
46
29
 
47
30
  const AdvancedSettingsPage = () => {
48
31
  const { formatMessage } = useIntl();
49
- const toggleNotification = useNotification();
50
- const { lockApp, unlockApp } = useOverlayBlocker();
32
+ const { toggleNotification } = useNotification();
51
33
  const { notifyStatus } = useNotifyAT();
52
34
  const queryClient = useQueryClient();
53
35
  const { get, put } = useFetchClient();
54
36
  const { formatAPIError } = useAPIErrorHandler();
55
37
 
56
- useFocusWhenNavigate();
57
-
58
38
  const {
59
39
  isLoading: isLoadingForPermissions,
60
40
  allowedActions: { canUpdate },
@@ -78,8 +58,11 @@ const AdvancedSettingsPage = () => {
78
58
  },
79
59
  onError() {
80
60
  toggleNotification({
81
- type: 'warning',
82
- message: { id: getTrad('notification.error'), defaultMessage: 'An error occured' },
61
+ type: 'danger',
62
+ message: formatMessage({
63
+ id: getTrad('notification.error'),
64
+ defaultMessage: 'An error occured',
65
+ }),
83
66
  });
84
67
  },
85
68
  }
@@ -93,18 +76,17 @@ const AdvancedSettingsPage = () => {
93
76
 
94
77
  toggleNotification({
95
78
  type: 'success',
96
- message: { id: getTrad('notification.success.saved'), defaultMessage: 'Saved' },
79
+ message: formatMessage({
80
+ id: getTrad('notification.success.saved'),
81
+ defaultMessage: 'Saved',
82
+ }),
97
83
  });
98
-
99
- unlockApp();
100
84
  },
101
85
  onError(error) {
102
86
  toggleNotification({
103
- type: 'warning',
87
+ type: 'danger',
104
88
  message: formatAPIError(error),
105
89
  });
106
-
107
- unlockApp();
108
90
  },
109
91
  refetchActive: true,
110
92
  });
@@ -112,8 +94,6 @@ const AdvancedSettingsPage = () => {
112
94
  const { isLoading: isSubmittingForm } = submitMutation;
113
95
 
114
96
  const handleSubmit = async (body) => {
115
- lockApp();
116
-
117
97
  submitMutation.mutate({
118
98
  ...body,
119
99
  email_confirmation_redirection: body.email_confirmation
@@ -123,46 +103,27 @@ const AdvancedSettingsPage = () => {
123
103
  };
124
104
 
125
105
  if (isLoading) {
126
- return (
127
- <Main aria-busy="true">
128
- <SettingsPageTitle
129
- name={formatMessage({
130
- id: getTrad('HeaderNav.link.advancedSettings'),
131
- defaultMessage: 'Advanced Settings',
132
- })}
133
- />
134
- <HeaderLayout
135
- title={formatMessage({
136
- id: getTrad('HeaderNav.link.advancedSettings'),
137
- defaultMessage: 'Advanced Settings',
138
- })}
139
- />
140
- <ContentLayout>
141
- <LoadingIndicatorPage />
142
- </ContentLayout>
143
- </Main>
144
- );
106
+ return <Page.Loading />;
145
107
  }
146
108
 
147
109
  return (
148
- <Main aria-busy={isSubmittingForm}>
149
- <SettingsPageTitle
150
- name={formatMessage({
151
- id: getTrad('HeaderNav.link.advancedSettings'),
152
- defaultMessage: 'Advanced Settings',
153
- })}
154
- />
155
- <Formik
156
- onSubmit={handleSubmit}
157
- initialValues={data.settings}
158
- validateOnChange={false}
159
- validationSchema={schema}
160
- enableReinitialize
161
- >
162
- {({ errors, values, handleChange, isSubmitting, dirty }) => {
110
+ <Page.Main aria-busy={isSubmittingForm}>
111
+ <Page.Title>
112
+ {formatMessage(
113
+ { id: 'Settings.PageTitle', defaultMessage: 'Settings - {name}' },
114
+ {
115
+ name: formatMessage({
116
+ id: getTrad('HeaderNav.link.advancedSettings'),
117
+ defaultMessage: 'Advanced Settings',
118
+ }),
119
+ }
120
+ )}
121
+ </Page.Title>
122
+ <Form onSubmit={handleSubmit} initialValues={data.settings} validationSchema={schema}>
123
+ {({ values, isSubmitting, modified }) => {
163
124
  return (
164
- <Form>
165
- <HeaderLayout
125
+ <>
126
+ <Layouts.Header
166
127
  title={formatMessage({
167
128
  id: getTrad('HeaderNav.link.advancedSettings'),
168
129
  defaultMessage: 'Advanced Settings',
@@ -171,7 +132,7 @@ const AdvancedSettingsPage = () => {
171
132
  <Button
172
133
  loading={isSubmitting}
173
134
  type="submit"
174
- disabled={canUpdate ? !dirty : !canUpdate}
135
+ disabled={!modified || !canUpdate}
175
136
  startIcon={<Check />}
176
137
  size="S"
177
138
  >
@@ -179,7 +140,7 @@ const AdvancedSettingsPage = () => {
179
140
  </Button>
180
141
  }
181
142
  />
182
- <ContentLayout>
143
+ <Layouts.Content>
183
144
  <Box
184
145
  background="neutral0"
185
146
  hasRadius
@@ -190,70 +151,64 @@ const AdvancedSettingsPage = () => {
190
151
  paddingRight={7}
191
152
  >
192
153
  <Flex direction="column" alignItems="stretch" gap={4}>
193
- <Typography variant="delta" as="h2">
154
+ <Typography variant="delta" tag="h2">
194
155
  {formatMessage({
195
156
  id: 'global.settings',
196
157
  defaultMessage: 'Settings',
197
158
  })}
198
159
  </Typography>
199
- <Grid gap={6}>
200
- <GridItem col={6} s={12}>
201
- <Select
202
- label={formatMessage({
160
+ <Grid.Root gap={6}>
161
+ {[
162
+ {
163
+ label: {
203
164
  id: getTrad('EditForm.inputSelect.label.role'),
204
165
  defaultMessage: 'Default role for authenticated users',
205
- })}
206
- value={values.default_role}
207
- hint={formatMessage({
166
+ },
167
+ hint: {
208
168
  id: getTrad('EditForm.inputSelect.description.role'),
209
169
  defaultMessage:
210
170
  'It will attach the new authenticated user to the selected role.',
211
- })}
212
- onChange={(e) =>
213
- handleChange({ target: { name: 'default_role', value: e } })
214
- }
171
+ },
172
+ options: data.roles.map((role) => ({
173
+ label: role.name,
174
+ value: role.type,
175
+ })),
176
+ name: 'default_role',
177
+ size: 6,
178
+ type: 'enumeration',
179
+ },
180
+ ...layout,
181
+ ].map(({ size, ...field }) => (
182
+ <Grid.Item
183
+ key={field.name}
184
+ col={size}
185
+ direction="column"
186
+ alignItems="stretch"
215
187
  >
216
- {data.roles.map((role) => {
217
- return (
218
- <Option key={role.type} value={role.type}>
219
- {role.name}
220
- </Option>
221
- );
222
- })}
223
- </Select>
224
- </GridItem>
225
- {layout.map((input) => {
226
- let value = values[input.name];
227
-
228
- if (!value) {
229
- value = input.type === 'bool' ? false : '';
230
- }
231
-
232
- return (
233
- <GridItem key={input.name} {...input.size}>
234
- <GenericInput
235
- {...input}
236
- value={value}
237
- error={errors[input.name]}
238
- disabled={
239
- input.name === 'email_confirmation_redirection' &&
240
- values.email_confirmation === false
241
- }
242
- onChange={handleChange}
243
- />
244
- </GridItem>
245
- );
246
- })}
247
- </Grid>
188
+ <InputRenderer
189
+ {...field}
190
+ disabled={
191
+ field.name === 'email_confirmation_redirection' &&
192
+ values.email_confirmation === false
193
+ }
194
+ label={formatMessage(field.label)}
195
+ hint={field.hint ? formatMessage(field.hint) : undefined}
196
+ placeholder={
197
+ field.placeholder ? formatMessage(field.placeholder) : undefined
198
+ }
199
+ />
200
+ </Grid.Item>
201
+ ))}
202
+ </Grid.Root>
248
203
  </Flex>
249
204
  </Box>
250
- </ContentLayout>
251
- </Form>
205
+ </Layouts.Content>
206
+ </>
252
207
  );
253
208
  }}
254
- </Formik>
255
- </Main>
209
+ </Form>
210
+ </Page.Main>
256
211
  );
257
212
  };
258
213
 
259
- export default ProtectedAdvancedSettingsPage;
214
+ export { ProtectedAdvancedSettingsPage, AdvancedSettingsPage };
@@ -2,45 +2,39 @@ import { getTrad } from '../../../utils';
2
2
 
3
3
  const layout = [
4
4
  {
5
- intlLabel: {
5
+ label: {
6
6
  id: getTrad('EditForm.inputToggle.label.email'),
7
7
  defaultMessage: 'One account per email address',
8
8
  },
9
- description: {
9
+ hint: {
10
10
  id: getTrad('EditForm.inputToggle.description.email'),
11
11
  defaultMessage:
12
12
  'Disallow the user to create multiple accounts using the same email address with different authentication providers.',
13
13
  },
14
14
  name: 'unique_email',
15
- type: 'bool',
16
- size: {
17
- col: 12,
18
- xs: 12,
19
- },
15
+ type: 'boolean',
16
+ size: 12,
20
17
  },
21
18
  {
22
- intlLabel: {
19
+ label: {
23
20
  id: getTrad('EditForm.inputToggle.label.sign-up'),
24
21
  defaultMessage: 'Enable sign-ups',
25
22
  },
26
- description: {
23
+ hint: {
27
24
  id: getTrad('EditForm.inputToggle.description.sign-up'),
28
25
  defaultMessage:
29
26
  'When disabled (OFF), the registration process is forbidden. No one can subscribe anymore no matter the used provider.',
30
27
  },
31
28
  name: 'allow_register',
32
- type: 'bool',
33
- size: {
34
- col: 12,
35
- xs: 12,
36
- },
29
+ type: 'boolean',
30
+ size: 12,
37
31
  },
38
32
  {
39
- intlLabel: {
33
+ label: {
40
34
  id: getTrad('EditForm.inputToggle.label.email-reset-password'),
41
35
  defaultMessage: 'Reset password page',
42
36
  },
43
- description: {
37
+ hint: {
44
38
  id: getTrad('EditForm.inputToggle.description.email-reset-password'),
45
39
  defaultMessage: "URL of your application's reset password page.",
46
40
  },
@@ -49,34 +43,28 @@ const layout = [
49
43
  defaultMessage: 'ex: https://youtfrontend.com/reset-password',
50
44
  },
51
45
  name: 'email_reset_password',
52
- type: 'text',
53
- size: {
54
- col: 6,
55
- xs: 12,
56
- },
46
+ type: 'string',
47
+ size: 12,
57
48
  },
58
49
  {
59
- intlLabel: {
50
+ label: {
60
51
  id: getTrad('EditForm.inputToggle.label.email-confirmation'),
61
52
  defaultMessage: 'Enable email confirmation',
62
53
  },
63
- description: {
54
+ hint: {
64
55
  id: getTrad('EditForm.inputToggle.description.email-confirmation'),
65
56
  defaultMessage: 'When enabled (ON), new registered users receive a confirmation email.',
66
57
  },
67
58
  name: 'email_confirmation',
68
- type: 'bool',
69
- size: {
70
- col: 12,
71
- xs: 12,
72
- },
59
+ type: 'boolean',
60
+ size: 12,
73
61
  },
74
62
  {
75
- intlLabel: {
63
+ label: {
76
64
  id: getTrad('EditForm.inputToggle.label.email-confirmation-redirection'),
77
65
  defaultMessage: 'Redirection url',
78
66
  },
79
- description: {
67
+ hint: {
80
68
  id: getTrad('EditForm.inputToggle.description.email-confirmation-redirection'),
81
69
  defaultMessage: 'After you confirmed your email, choose where you will be redirected.',
82
70
  },
@@ -85,11 +73,8 @@ const layout = [
85
73
  defaultMessage: 'ex: https://youtfrontend.com/email-confirmation',
86
74
  },
87
75
  name: 'email_confirmation_redirection',
88
- type: 'text',
89
- size: {
90
- col: 6,
91
- xs: 12,
92
- },
76
+ type: 'string',
77
+ size: 12,
93
78
  },
94
79
  ];
95
80
 
@@ -1,4 +1,4 @@
1
- import { translatedErrors } from '@strapi/helper-plugin';
1
+ import { translatedErrors } from '@strapi/strapi/admin';
2
2
  import * as yup from 'yup';
3
3
 
4
4
  // eslint-disable-next-line prefer-regex-literals
@@ -12,7 +12,10 @@ const schema = yup.object().shape({
12
12
  }),
13
13
  email_reset_password: yup
14
14
  .string(translatedErrors.string)
15
- .matches(URL_REGEX, translatedErrors.regex)
15
+ .matches(URL_REGEX, {
16
+ id: translatedErrors.regex.id,
17
+ defaultMessage: 'This is not a valid URL',
18
+ })
16
19
  .nullable(),
17
20
  });
18
21