@strapi/plugin-documentation 4.0.0-beta.2 → 4.0.0-beta.20

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 (70) hide show
  1. package/admin/src/components/FieldActionWrapper/index.js +14 -0
  2. package/admin/src/components/PluginIcon/index.js +12 -0
  3. package/admin/src/index.js +23 -11
  4. package/admin/src/pages/PluginPage/index.js +199 -0
  5. package/admin/src/pages/PluginPage/tests/index.test.js +873 -0
  6. package/admin/src/pages/PluginPage/tests/server.js +23 -0
  7. package/admin/src/pages/SettingsPage/index.js +181 -0
  8. package/admin/src/pages/SettingsPage/tests/index.test.js +612 -0
  9. package/admin/src/pages/SettingsPage/tests/server.js +18 -0
  10. package/admin/src/pages/{HomePage/utils → utils}/api.js +5 -4
  11. package/admin/src/pages/{HomePage/utils → utils}/schema.js +0 -0
  12. package/admin/src/pages/utils/useReactQuery.js +46 -0
  13. package/admin/src/translations/ar.json +0 -3
  14. package/admin/src/translations/cs.json +0 -3
  15. package/admin/src/translations/de.json +0 -3
  16. package/admin/src/translations/en.json +13 -3
  17. package/admin/src/translations/es.json +0 -3
  18. package/admin/src/translations/fr.json +0 -3
  19. package/admin/src/translations/id.json +0 -3
  20. package/admin/src/translations/it.json +0 -3
  21. package/admin/src/translations/ko.json +0 -3
  22. package/admin/src/translations/ms.json +0 -3
  23. package/admin/src/translations/nl.json +0 -3
  24. package/admin/src/translations/pl.json +0 -3
  25. package/admin/src/translations/pt-BR.json +0 -3
  26. package/admin/src/translations/pt.json +0 -3
  27. package/admin/src/translations/ru.json +0 -3
  28. package/admin/src/translations/sk.json +0 -3
  29. package/admin/src/translations/th.json +0 -3
  30. package/admin/src/translations/tr.json +0 -3
  31. package/admin/src/translations/uk.json +0 -3
  32. package/admin/src/translations/vi.json +0 -3
  33. package/admin/src/translations/zh-Hans.json +0 -3
  34. package/admin/src/translations/zh.json +0 -3
  35. package/package.json +26 -46
  36. package/server/bootstrap.js +22 -105
  37. package/server/config/default-config.js +12 -15
  38. package/server/config/index.js +10 -2
  39. package/server/controllers/documentation.js +49 -111
  40. package/server/index.js +17 -0
  41. package/server/middlewares/documentation.js +24 -55
  42. package/server/{policies/index-policy.js → middlewares/restrict-access.js} +2 -10
  43. package/{public → server/public}/index.html +0 -0
  44. package/{public → server/public}/login.html +0 -0
  45. package/server/register.js +11 -0
  46. package/server/routes/index.js +10 -17
  47. package/server/services/documentation.js +125 -1831
  48. package/server/utils/builders/build-api-endpoint-path.js +174 -0
  49. package/server/utils/builders/build-api-requests.js +41 -0
  50. package/server/utils/builders/build-api-responses.js +108 -0
  51. package/server/utils/builders/index.js +11 -0
  52. package/server/utils/clean-schema-attributes.js +205 -0
  53. package/server/utils/error-response.js +22 -0
  54. package/server/utils/get-schema-data.js +32 -0
  55. package/server/utils/query-params.js +84 -0
  56. package/strapi-server.js +1 -19
  57. package/admin/src/assets/images/logo.svg +0 -1
  58. package/admin/src/components/Block/components.js +0 -26
  59. package/admin/src/components/Block/index.js +0 -39
  60. package/admin/src/components/Copy/index.js +0 -36
  61. package/admin/src/components/Header/index.js +0 -72
  62. package/admin/src/components/Row/ButtonContainer.js +0 -67
  63. package/admin/src/components/Row/components.js +0 -83
  64. package/admin/src/components/Row/index.js +0 -51
  65. package/admin/src/pages/App/index.js +0 -52
  66. package/admin/src/pages/HomePage/components.js +0 -59
  67. package/admin/src/pages/HomePage/index.js +0 -175
  68. package/admin/src/pages/HomePage/useHomePage.js +0 -56
  69. package/server/policies/index.js +0 -7
  70. package/server/services/utils/forms.json +0 -29
@@ -1,56 +0,0 @@
1
- import { useQuery, useMutation, useQueryClient } from 'react-query';
2
- import { useNotification } from '@strapi/helper-plugin';
3
- import { fetchData, deleteDoc, regenerateDoc, submit } from './utils/api';
4
- import getTrad from '../../utils/getTrad';
5
-
6
- const useHomePage = () => {
7
- const queryClient = useQueryClient();
8
- const toggleNotification = useNotification();
9
- const { isLoading, data } = useQuery('get-documentation', () => fetchData(toggleNotification));
10
-
11
- const handleError = err => {
12
- toggleNotification({
13
- type: 'warning',
14
- message: err.response.payload.message,
15
- });
16
- };
17
-
18
- const deleteMutation = useMutation(deleteDoc, {
19
- onSuccess: async () => {
20
- await queryClient.invalidateQueries('get-documentation');
21
- toggleNotification({
22
- type: 'info',
23
- message: { id: getTrad('notification.delete.success') },
24
- });
25
- },
26
- onError: handleError,
27
- });
28
-
29
- const submitMutation = useMutation(submit, {
30
- onSuccess: () => {
31
- queryClient.invalidateQueries('get-documentation');
32
-
33
- toggleNotification({
34
- type: 'success',
35
- message: { id: getTrad('notification.update.success') },
36
- });
37
- },
38
- onError: handleError,
39
- });
40
-
41
- const regenerateDocMutation = useMutation(regenerateDoc, {
42
- onSuccess: () => {
43
- queryClient.invalidateQueries('get-documentation');
44
-
45
- toggleNotification({
46
- type: 'info',
47
- message: { id: getTrad('notification.generate.success') },
48
- });
49
- },
50
- onError: handleError,
51
- });
52
-
53
- return { data, isLoading, deleteMutation, submitMutation, regenerateDocMutation };
54
- };
55
-
56
- export default useHomePage;
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index-policy');
4
-
5
- module.exports = {
6
- index,
7
- };
@@ -1,29 +0,0 @@
1
- [
2
- [
3
- {
4
- "name": "restrictedAccess",
5
- "label": {
6
- "id": "documentation.containers.HomePage.form.restrictedAccess"
7
- },
8
- "type": "toggle",
9
- "inputDescription": {
10
- "id": "documentation.containers.HomePage.form.restrictedAccess.inputDescription"
11
- },
12
- "inputDescriptionStyle": { "marginBottom": "2px"},
13
- "value": false
14
- },
15
- {
16
- "name": "password",
17
- "label": {
18
- "id": "documentation.containers.HomePage.form.password"
19
- },
20
- "customBootstrapClass": "col-md-4",
21
- "type": "password",
22
- "inputDescription": {
23
- "id": "documentation.containers.HomePage.form.password.inputDescription"
24
- },
25
- "validations": { "required": true },
26
- "value": ""
27
- }
28
- ]
29
- ]