@strapi/plugin-documentation 4.20.4 → 5.0.0-alpha.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.
- package/admin/src/hooks/useDocumentation.js +10 -7
- package/admin/src/index.js +4 -18
- package/admin/src/pages/PluginPage/index.jsx +10 -24
- package/admin/src/pages/PluginPage/tests/index.test.jsx +13 -14
- package/admin/src/pages/SettingsPage/index.jsx +138 -142
- package/admin/src/pages/SettingsPage/tests/index.test.jsx +6 -13
- package/dist/_chunks/EditViewPage-xYzUSAwS-NigDiZi1.js +84396 -0
- package/dist/_chunks/EditViewPage-xYzUSAwS-NigDiZi1.js.map +1 -0
- package/dist/_chunks/EditViewPage-xYzUSAwS-OCSjk-Vt.mjs +84368 -0
- package/dist/_chunks/EditViewPage-xYzUSAwS-OCSjk-Vt.mjs.map +1 -0
- package/dist/_chunks/ListViewPage-xOVa04T_-JQSQJ0aH.js +1618 -0
- package/dist/_chunks/ListViewPage-xOVa04T_-JQSQJ0aH.js.map +1 -0
- package/dist/_chunks/ListViewPage-xOVa04T_-MAsyJIvQ.mjs +1595 -0
- package/dist/_chunks/ListViewPage-xOVa04T_-MAsyJIvQ.mjs.map +1 -0
- package/dist/_chunks/ReviewWorkflowsColumn-FDxVKdto-9EdyIGCi.js +33 -0
- package/dist/_chunks/ReviewWorkflowsColumn-FDxVKdto-9EdyIGCi.js.map +1 -0
- package/dist/_chunks/ReviewWorkflowsColumn-FDxVKdto-E7QaAVIp.mjs +33 -0
- package/dist/_chunks/ReviewWorkflowsColumn-FDxVKdto-E7QaAVIp.mjs.map +1 -0
- package/dist/_chunks/constants-WjN6I3sL-1yTyGpl5.mjs +190 -0
- package/dist/_chunks/constants-WjN6I3sL-1yTyGpl5.mjs.map +1 -0
- package/dist/_chunks/constants-WjN6I3sL-5vTd1Y1g.js +209 -0
- package/dist/_chunks/constants-WjN6I3sL-5vTd1Y1g.js.map +1 -0
- package/dist/_chunks/index--rtz8bZh.mjs +17798 -0
- package/dist/_chunks/index--rtz8bZh.mjs.map +1 -0
- package/dist/_chunks/index-FiShd2zI.js +17823 -0
- package/dist/_chunks/index-FiShd2zI.js.map +1 -0
- package/dist/_chunks/{index-RtHTnuE1.mjs → index-Qt8XLNQZ.mjs} +11 -8
- package/dist/_chunks/index-Qt8XLNQZ.mjs.map +1 -0
- package/dist/_chunks/{index-xwpmk0Y9.mjs → index-h-OcS50W.mjs} +19 -25
- package/dist/_chunks/index-h-OcS50W.mjs.map +1 -0
- package/dist/_chunks/{index-PR_fql8f.js → index-m8HLcGmV.js} +15 -12
- package/dist/_chunks/index-m8HLcGmV.js.map +1 -0
- package/dist/_chunks/{index-ku5QIWHo.js → index-vWzO1snG.js} +21 -27
- package/dist/_chunks/index-vWzO1snG.js.map +1 -0
- package/dist/_chunks/{useDocumentation-glNqpmZO.mjs → useDocumentation-EsufCjtn.mjs} +12 -9
- package/dist/_chunks/useDocumentation-EsufCjtn.mjs.map +1 -0
- package/dist/_chunks/{useDocumentation-jpgzaGlD.js → useDocumentation-hOQyphRS.js} +14 -11
- package/dist/_chunks/useDocumentation-hOQyphRS.js.map +1 -0
- package/dist/_chunks/useSyncRbac-Kt8Li0Yf-f6LRUqJf.js +57 -0
- package/dist/_chunks/useSyncRbac-Kt8Li0Yf-f6LRUqJf.js.map +1 -0
- package/dist/_chunks/useSyncRbac-Kt8Li0Yf-mDaHJCOQ.mjs +39 -0
- package/dist/_chunks/useSyncRbac-Kt8Li0Yf-mDaHJCOQ.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/style.css +84 -0
- package/package.json +15 -15
- package/server/controllers/documentation.js +2 -2
- package/server/middlewares/restrict-access.js +1 -1
- package/server/services/__mocks__/mock-content-types.js +0 -5
- package/server/services/documentation.js +2 -3
- package/server/services/override.js +1 -1
- package/dist/_chunks/index-990q37Xx.mjs +0 -167
- package/dist/_chunks/index-990q37Xx.mjs.map +0 -1
- package/dist/_chunks/index-PR_fql8f.js.map +0 -1
- package/dist/_chunks/index-RtHTnuE1.mjs.map +0 -1
- package/dist/_chunks/index-U4uH9lyg.js +0 -169
- package/dist/_chunks/index-U4uH9lyg.js.map +0 -1
- package/dist/_chunks/index-ku5QIWHo.js.map +0 -1
- package/dist/_chunks/index-xwpmk0Y9.mjs.map +0 -1
- package/dist/_chunks/useDocumentation-glNqpmZO.mjs.map +0 -1
- package/dist/_chunks/useDocumentation-jpgzaGlD.js.map +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { Main, HeaderLayout, Button, ContentLayout, Box, Flex, Typography, Grid, GridItem, ToggleInput, TextInput, FieldAction } from "@strapi/design-system";
|
|
4
|
-
import {
|
|
4
|
+
import { useFocusWhenNavigate, useRBAC } from "@strapi/helper-plugin";
|
|
5
5
|
import { Check, Eye, EyeStriked } from "@strapi/icons";
|
|
6
|
-
import {
|
|
6
|
+
import { translatedErrors, Page } from "@strapi/strapi/admin";
|
|
7
|
+
import { Formik, Form } from "formik";
|
|
7
8
|
import { useIntl } from "react-intl";
|
|
8
9
|
import styled from "styled-components";
|
|
9
10
|
import * as yup from "yup";
|
|
10
|
-
import { P as PERMISSIONS } from "./index-
|
|
11
|
-
import { u as useDocumentation, g as getTrad } from "./useDocumentation-
|
|
12
|
-
import "react-query";
|
|
11
|
+
import { P as PERMISSIONS } from "./index-h-OcS50W.mjs";
|
|
12
|
+
import { u as useDocumentation, g as getTrad } from "./useDocumentation-EsufCjtn.mjs";
|
|
13
13
|
const schema = yup.object().shape({
|
|
14
14
|
restrictedAccess: yup.boolean(),
|
|
15
15
|
password: yup.string().when("restrictedAccess", (value, initSchema) => {
|
|
16
|
-
return value ? initSchema.required(translatedErrors.required) : initSchema;
|
|
16
|
+
return value ? initSchema.required(translatedErrors.required.id) : initSchema;
|
|
17
17
|
})
|
|
18
18
|
});
|
|
19
19
|
const SettingsPage = () => {
|
|
@@ -28,7 +28,10 @@ const SettingsPage = () => {
|
|
|
28
28
|
body
|
|
29
29
|
});
|
|
30
30
|
};
|
|
31
|
-
|
|
31
|
+
if (isLoading) {
|
|
32
|
+
return /* @__PURE__ */ jsx(Page.Loading, {});
|
|
33
|
+
}
|
|
34
|
+
return /* @__PURE__ */ jsx(Main, { children: /* @__PURE__ */ jsx(
|
|
32
35
|
Formik,
|
|
33
36
|
{
|
|
34
37
|
initialValues: {
|
|
@@ -170,4 +173,4 @@ const FieldActionWrapper = styled(FieldAction)`
|
|
|
170
173
|
export {
|
|
171
174
|
SettingsPage as default
|
|
172
175
|
};
|
|
173
|
-
//# sourceMappingURL=index-
|
|
176
|
+
//# sourceMappingURL=index-Qt8XLNQZ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Qt8XLNQZ.mjs","sources":["../../admin/src/pages/SettingsPage/index.jsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport {\n Box,\n Button,\n ContentLayout,\n Flex,\n Grid,\n GridItem,\n HeaderLayout,\n Main,\n TextInput,\n ToggleInput,\n Typography,\n FieldAction,\n} from '@strapi/design-system';\nimport { useFocusWhenNavigate, useRBAC } from '@strapi/helper-plugin';\nimport { Check, Eye as Show, EyeStriked as Hide } from '@strapi/icons';\nimport { translatedErrors } from '@strapi/strapi/admin';\n// Strapi Icons\nimport { Page } from '@strapi/strapi/admin';\nimport { Form, Formik } from 'formik';\nimport { useIntl } from 'react-intl';\nimport styled from 'styled-components';\nimport * as yup from 'yup';\n\nimport { PERMISSIONS } from '../../constants';\nimport { useDocumentation } from '../../hooks/useDocumentation';\nimport { getTrad } from '../../utils';\n\nconst schema = yup.object().shape({\n restrictedAccess: yup.boolean(),\n password: yup.string().when('restrictedAccess', (value, initSchema) => {\n return value ? initSchema.required(translatedErrors.required.id) : initSchema;\n }),\n});\n\nconst SettingsPage = () => {\n useFocusWhenNavigate();\n const { formatMessage } = useIntl();\n const { submit, data, isLoading } = useDocumentation();\n const [passwordShown, setPasswordShown] = useState(false);\n const { allowedActions } = useRBAC(PERMISSIONS);\n\n const handleUpdateSettingsSubmit = (body) => {\n submit.mutate({\n prefix: data?.prefix,\n body,\n });\n };\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n return (\n <Main>\n <Formik\n initialValues={{\n restrictedAccess: data?.documentationAccess.restrictedAccess || false,\n password: '',\n }}\n onSubmit={handleUpdateSettingsSubmit}\n validationSchema={schema}\n >\n {({\n handleSubmit,\n values,\n handleChange,\n errors,\n setFieldTouched,\n setFieldValue,\n dirty,\n }) => {\n return (\n <Form noValidate onSubmit={handleSubmit}>\n <HeaderLayout\n title={formatMessage({\n id: getTrad('plugin.name'),\n defaultMessage: 'Documentation',\n })}\n subtitle={formatMessage({\n id: getTrad('pages.SettingsPage.header.description'),\n defaultMessage: 'Configure the documentation plugin',\n })}\n primaryAction={\n <Button\n type=\"submit\"\n startIcon={<Check />}\n disabled={!dirty && allowedActions.canUpdate}\n >\n {formatMessage({\n id: getTrad('pages.SettingsPage.Button.save'),\n defaultMessage: 'Save',\n })}\n </Button>\n }\n />\n <ContentLayout>\n <Box\n background=\"neutral0\"\n hasRadius\n shadow=\"filterShadow\"\n paddingTop={6}\n paddingBottom={6}\n paddingLeft={7}\n paddingRight={7}\n >\n <Flex direction=\"column\" alignItems=\"stretch\" gap={4}>\n <Typography variant=\"delta\" as=\"h2\">\n {formatMessage({\n id: 'global.settings',\n defaultMessage: 'Settings',\n })}\n </Typography>\n <Grid gap={4}>\n <GridItem col={6} s={12}>\n <ToggleInput\n name=\"restrictedAccess\"\n label={formatMessage({\n id: getTrad('pages.SettingsPage.toggle.label'),\n defaultMessage: 'Restricted Access',\n })}\n hint={formatMessage({\n id: getTrad('pages.SettingsPage.toggle.hint'),\n defaultMessage: 'Make the documentation endpoint private',\n })}\n checked={values.restrictedAccess}\n onChange={() => {\n if (values.restrictedAccess === true) {\n setFieldValue('password', '', false);\n setFieldTouched('password', false, false);\n }\n\n setFieldValue('restrictedAccess', !values.restrictedAccess, false);\n }}\n onLabel=\"On\"\n offLabel=\"Off\"\n />\n </GridItem>\n {values.restrictedAccess && (\n <GridItem col={6} s={12}>\n <TextInput\n label={formatMessage({\n id: 'global.password',\n defaultMessage: 'Password',\n })}\n name=\"password\"\n placeholder=\"**********\"\n type={passwordShown ? 'text' : 'password'}\n value={values.password}\n onChange={handleChange}\n error={\n errors.password\n ? formatMessage({\n id: errors.password,\n defaultMessage: 'Invalid value',\n })\n : null\n }\n endAction={\n <FieldActionWrapper\n onClick={(e) => {\n e.stopPropagation();\n setPasswordShown((prev) => !prev);\n }}\n label={formatMessage(\n passwordShown\n ? {\n id: 'Auth.form.password.show-password',\n defaultMessage: 'Show password',\n }\n : {\n id: 'Auth.form.password.hide-password',\n defaultMessage: 'Hide password',\n }\n )}\n >\n {passwordShown ? <Show /> : <Hide />}\n </FieldActionWrapper>\n }\n />\n </GridItem>\n )}\n </Grid>\n </Flex>\n </Box>\n </ContentLayout>\n </Form>\n );\n }}\n </Formik>\n </Main>\n );\n};\n\nconst FieldActionWrapper = styled(FieldAction)`\n svg {\n height: 1rem;\n width: 1rem;\n path {\n fill: ${({ theme }) => theme.colors.neutral600};\n }\n }\n`;\n\nexport default SettingsPage;\n"],"names":["Show","Hide"],"mappings":";;;;;;;;;;;;AA8BA,MAAM,SAAS,IAAI,OAAO,EAAE,MAAM;AAAA,EAChC,kBAAkB,IAAI,QAAQ;AAAA,EAC9B,UAAU,IAAI,OAAO,EAAE,KAAK,oBAAoB,CAAC,OAAO,eAAe;AACrE,WAAO,QAAQ,WAAW,SAAS,iBAAiB,SAAS,EAAE,IAAI;AAAA,EAAA,CACpE;AACH,CAAC;AAED,MAAM,eAAe,MAAM;AACJ;AACf,QAAA,EAAE,kBAAkB;AAC1B,QAAM,EAAE,QAAQ,MAAM,cAAc,iBAAiB;AACrD,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAS,KAAK;AACxD,QAAM,EA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AAA,wBACX,gBAAgB;AAAA,sBACjB,CAAA,IACD;AAAA,sBAEN,WACE;AAAA,wBAAC;AAAA,wBAAA;AAAA,0BACC,SAAS,CAAC,MAAM;AACd,8BAAE,gBAAgB;AACD,6CAAA,CAAC,SAAS,CAAC,IAAI;AAAA,0BAClC;AAAA,0BACA,OAAO;AAAA,4BACL,gBACI;AAAA,8BACE,IAAI;AAAA,8BACJ,gBAAgB;AAAA,4BAAA,IAElB;AAAA,8BACE,IAAI;AAAA,8BACJ,gBAAgB;AAAA,4BAClB;AAAA,0BACN;AAAA,0BAEC,UAAgB,gBAAA,oBAACA,KAAK,CAAA,CAAA,wBAAMC,YAAK,EAAA;AAAA,wBAAA;AAAA,sBACpC;AAAA,oBAAA;AAAA,kBAAA,GAGN;AAAA,gBAAA,GAEJ;AAAA,cAAA,GACF;AAAA,YAAA;AAAA,UAAA,GAEJ;AAAA,QACF,EAAA,CAAA;AAAA,MAEJ;AAAA,IAAA;AAAA,EAEJ,EAAA,CAAA;AAEJ;AAEA,MAAM,qBAAqB,OAAO,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA,cAK/B,CAAC,EAAE,MAAA,MAAY,MAAM,OAAO,UAAU;AAAA;AAAA;AAAA;"}
|
|
@@ -10,7 +10,7 @@ const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
12
|
const name$1 = "@strapi/plugin-documentation";
|
|
13
|
-
const version = "4.20.
|
|
13
|
+
const version = "4.20.5";
|
|
14
14
|
const description = "Create an OpenAPI Document and visualize your API with SWAGGER UI.";
|
|
15
15
|
const repository = {
|
|
16
16
|
type: "git",
|
|
@@ -55,20 +55,20 @@ const scripts = {
|
|
|
55
55
|
watch: "pack-up watch"
|
|
56
56
|
};
|
|
57
57
|
const dependencies = {
|
|
58
|
-
"@strapi/design-system": "1.
|
|
59
|
-
"@strapi/helper-plugin": "4.20.
|
|
60
|
-
"@strapi/icons": "1.
|
|
61
|
-
"@strapi/utils": "4.20.
|
|
58
|
+
"@strapi/design-system": "1.16.0",
|
|
59
|
+
"@strapi/helper-plugin": "4.20.5",
|
|
60
|
+
"@strapi/icons": "1.16.0",
|
|
61
|
+
"@strapi/utils": "4.20.5",
|
|
62
62
|
bcryptjs: "2.4.3",
|
|
63
63
|
cheerio: "^1.0.0-rc.12",
|
|
64
|
-
formik: "2.4.
|
|
65
|
-
"fs-extra": "10.
|
|
66
|
-
immer: "9.0.
|
|
64
|
+
formik: "2.4.5",
|
|
65
|
+
"fs-extra": "10.1.0",
|
|
66
|
+
immer: "9.0.21",
|
|
67
67
|
"koa-static": "^5.0.0",
|
|
68
68
|
lodash: "4.17.21",
|
|
69
69
|
"path-to-regexp": "6.2.1",
|
|
70
70
|
"react-helmet": "^6.1.0",
|
|
71
|
-
"react-intl": "6.
|
|
71
|
+
"react-intl": "6.6.2",
|
|
72
72
|
"react-query": "3.39.3",
|
|
73
73
|
"swagger-ui-dist": "4.19.0",
|
|
74
74
|
yaml: "1.10.2",
|
|
@@ -76,21 +76,21 @@ const dependencies = {
|
|
|
76
76
|
};
|
|
77
77
|
const devDependencies = {
|
|
78
78
|
"@apidevtools/swagger-parser": "^10.1.0",
|
|
79
|
-
"@strapi/pack-up": "4.20.
|
|
80
|
-
"@strapi/strapi": "4.20.
|
|
79
|
+
"@strapi/pack-up": "4.20.5",
|
|
80
|
+
"@strapi/strapi": "4.20.5",
|
|
81
81
|
"@testing-library/react": "14.0.0",
|
|
82
82
|
"@testing-library/user-event": "14.4.3",
|
|
83
83
|
msw: "1.3.0",
|
|
84
84
|
react: "^18.2.0",
|
|
85
85
|
"react-dom": "^18.2.0",
|
|
86
|
-
"react-router-dom": "
|
|
87
|
-
"styled-components": "5.3.
|
|
86
|
+
"react-router-dom": "6.22.3",
|
|
87
|
+
"styled-components": "5.3.11"
|
|
88
88
|
};
|
|
89
89
|
const peerDependencies = {
|
|
90
90
|
"@strapi/strapi": "^4.0.0",
|
|
91
91
|
react: "^17.0.0 || ^18.0.0",
|
|
92
92
|
"react-dom": "^17.0.0 || ^18.0.0",
|
|
93
|
-
"react-router-dom": "^
|
|
93
|
+
"react-router-dom": "^6.0.0",
|
|
94
94
|
"styled-components": "^5.2.1"
|
|
95
95
|
};
|
|
96
96
|
const engines = {
|
|
@@ -141,17 +141,14 @@ const name = pluginPkg.strapi.name;
|
|
|
141
141
|
const index = {
|
|
142
142
|
register(app) {
|
|
143
143
|
app.addMenuLink({
|
|
144
|
-
to:
|
|
144
|
+
to: `plugins/${pluginId}`,
|
|
145
145
|
icon: Information,
|
|
146
146
|
intlLabel: {
|
|
147
147
|
id: `${pluginId}.plugin.name`,
|
|
148
148
|
defaultMessage: "Documentation"
|
|
149
149
|
},
|
|
150
150
|
permissions: PERMISSIONS.main,
|
|
151
|
-
|
|
152
|
-
const component = await import("./index-990q37Xx.mjs");
|
|
153
|
-
return component;
|
|
154
|
-
}
|
|
151
|
+
Component: () => import("./index--rtz8bZh.mjs").then((n) => n.ao)
|
|
155
152
|
});
|
|
156
153
|
app.registerPlugin({
|
|
157
154
|
id: pluginId,
|
|
@@ -165,11 +162,8 @@ const index = {
|
|
|
165
162
|
defaultMessage: "Documentation"
|
|
166
163
|
},
|
|
167
164
|
id: "documentation",
|
|
168
|
-
to:
|
|
169
|
-
|
|
170
|
-
const component = await import("./index-RtHTnuE1.mjs");
|
|
171
|
-
return component;
|
|
172
|
-
},
|
|
165
|
+
to: pluginId,
|
|
166
|
+
Component: () => import("./index-Qt8XLNQZ.mjs"),
|
|
173
167
|
permissions: PERMISSIONS.main
|
|
174
168
|
});
|
|
175
169
|
},
|
|
@@ -197,4 +191,4 @@ export {
|
|
|
197
191
|
index as i,
|
|
198
192
|
pluginId as p
|
|
199
193
|
};
|
|
200
|
-
//# sourceMappingURL=index-
|
|
194
|
+
//# sourceMappingURL=index-h-OcS50W.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-h-OcS50W.mjs","sources":["../../admin/src/constants.js","../../admin/src/pluginId.js","../../admin/src/index.js"],"sourcesContent":["export const PERMISSIONS = {\n // This permission regards the main component (App) and is used to tell\n // If the plugin link should be displayed in the menu\n // And also if the plugin is accessible. This use case is found when a user types the url of the\n // plugin directly in the browser\n main: [\n { action: 'plugin::documentation.read', subject: null },\n { action: 'plugin::documentation.settings.regenerate', subject: null },\n { action: 'plugin::documentation.settings.update', subject: null },\n ],\n open: [\n { action: 'plugin::documentation.read', subject: null },\n { action: 'plugin::documentation.settings.regenerate', subject: null },\n ],\n regenerate: [{ action: 'plugin::documentation.settings.regenerate', subject: null }],\n update: [{ action: 'plugin::documentation.settings.update', subject: null }],\n};\n","import pluginPkg from '../../package.json';\n\nconst pluginId = pluginPkg.name.replace(/^@strapi\\/plugin-/i, '');\n\nexport default pluginId;\n","import { prefixPluginTranslations } from '@strapi/helper-plugin';\nimport { Information } from '@strapi/icons';\n\nimport pluginPkg from '../../package.json';\n\nimport { PERMISSIONS } from './constants';\nimport pluginId from './pluginId';\n\nconst name = pluginPkg.strapi.name;\n\nexport default {\n register(app) {\n app.addMenuLink({\n to: `plugins/${pluginId}`,\n icon: Information,\n intlLabel: {\n id: `${pluginId}.plugin.name`,\n defaultMessage: 'Documentation',\n },\n permissions: PERMISSIONS.main,\n Component: () => import('./pages/PluginPage'),\n });\n\n app.registerPlugin({\n id: pluginId,\n name,\n });\n },\n bootstrap(app) {\n app.addSettingsLink('global', {\n intlLabel: {\n id: `${pluginId}.plugin.name`,\n defaultMessage: 'Documentation',\n },\n id: 'documentation',\n to: pluginId,\n Component: () => import('./pages/SettingsPage'),\n permissions: PERMISSIONS.main,\n });\n },\n async registerTrads({ locales }) {\n const importedTrads = await Promise.all(\n locales.map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, pluginId),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return Promise.resolve(importedTrads);\n },\n};\n"],"names":[],"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AE;AAAA,YACR;AAAA,UACd;AAAA,QACA,CAAW;AAAA,MACX,CAAO;AAAA,IACP;AAEI,WAAO,QAAQ,QAAQ,aAAa;AAAA,EACrC;AACH;"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const
|
|
4
|
+
const React = require("react");
|
|
5
5
|
const designSystem = require("@strapi/design-system");
|
|
6
6
|
const helperPlugin = require("@strapi/helper-plugin");
|
|
7
|
-
const
|
|
7
|
+
const Icons = require("@strapi/icons");
|
|
8
|
+
const admin = require("@strapi/strapi/admin");
|
|
8
9
|
const formik = require("formik");
|
|
9
10
|
const reactIntl = require("react-intl");
|
|
10
11
|
const styled = require("styled-components");
|
|
11
12
|
const yup = require("yup");
|
|
12
|
-
const index = require("./index-
|
|
13
|
-
const useDocumentation = require("./useDocumentation-
|
|
14
|
-
require("react-query");
|
|
13
|
+
const index = require("./index-vWzO1snG.js");
|
|
14
|
+
const useDocumentation = require("./useDocumentation-hOQyphRS.js");
|
|
15
15
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
16
16
|
function _interopNamespace(e) {
|
|
17
17
|
if (e && e.__esModule)
|
|
@@ -36,14 +36,14 @@ const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
|
36
36
|
const schema = yup__namespace.object().shape({
|
|
37
37
|
restrictedAccess: yup__namespace.boolean(),
|
|
38
38
|
password: yup__namespace.string().when("restrictedAccess", (value, initSchema) => {
|
|
39
|
-
return value ? initSchema.required(
|
|
39
|
+
return value ? initSchema.required(admin.translatedErrors.required.id) : initSchema;
|
|
40
40
|
})
|
|
41
41
|
});
|
|
42
42
|
const SettingsPage = () => {
|
|
43
43
|
helperPlugin.useFocusWhenNavigate();
|
|
44
44
|
const { formatMessage } = reactIntl.useIntl();
|
|
45
45
|
const { submit, data, isLoading } = useDocumentation.useDocumentation();
|
|
46
|
-
const [passwordShown, setPasswordShown] =
|
|
46
|
+
const [passwordShown, setPasswordShown] = React.useState(false);
|
|
47
47
|
const { allowedActions } = helperPlugin.useRBAC(index.PERMISSIONS);
|
|
48
48
|
const handleUpdateSettingsSubmit = (body) => {
|
|
49
49
|
submit.mutate({
|
|
@@ -51,7 +51,10 @@ const SettingsPage = () => {
|
|
|
51
51
|
body
|
|
52
52
|
});
|
|
53
53
|
};
|
|
54
|
-
|
|
54
|
+
if (isLoading) {
|
|
55
|
+
return /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Loading, {});
|
|
56
|
+
}
|
|
57
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
55
58
|
formik.Formik,
|
|
56
59
|
{
|
|
57
60
|
initialValues: {
|
|
@@ -69,7 +72,7 @@ const SettingsPage = () => {
|
|
|
69
72
|
setFieldValue,
|
|
70
73
|
dirty
|
|
71
74
|
}) => {
|
|
72
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
75
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { noValidate: true, onSubmit: handleSubmit, children: [
|
|
73
76
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
74
77
|
designSystem.HeaderLayout,
|
|
75
78
|
{
|
|
@@ -85,7 +88,7 @@ const SettingsPage = () => {
|
|
|
85
88
|
designSystem.Button,
|
|
86
89
|
{
|
|
87
90
|
type: "submit",
|
|
88
|
-
startIcon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
91
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Check, {}),
|
|
89
92
|
disabled: !dirty && allowedActions.canUpdate,
|
|
90
93
|
children: formatMessage({
|
|
91
94
|
id: useDocumentation.getTrad("pages.SettingsPage.Button.save"),
|
|
@@ -167,7 +170,7 @@ const SettingsPage = () => {
|
|
|
167
170
|
defaultMessage: "Hide password"
|
|
168
171
|
}
|
|
169
172
|
),
|
|
170
|
-
children: passwordShown ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
173
|
+
children: passwordShown ? /* @__PURE__ */ jsxRuntime.jsx(Icons.Eye, {}) : /* @__PURE__ */ jsxRuntime.jsx(Icons.EyeStriked, {})
|
|
171
174
|
}
|
|
172
175
|
)
|
|
173
176
|
}
|
|
@@ -191,4 +194,4 @@ const FieldActionWrapper = styled__default.default(designSystem.FieldAction)`
|
|
|
191
194
|
}
|
|
192
195
|
`;
|
|
193
196
|
exports.default = SettingsPage;
|
|
194
|
-
//# sourceMappingURL=index-
|
|
197
|
+
//# sourceMappingURL=index-m8HLcGmV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-m8HLcGmV.js","sources":["../../admin/src/pages/SettingsPage/index.jsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport {\n Box,\n Button,\n ContentLayout,\n Flex,\n Grid,\n GridItem,\n HeaderLayout,\n Main,\n TextInput,\n ToggleInput,\n Typography,\n FieldAction,\n} from '@strapi/design-system';\nimport { useFocusWhenNavigate, useRBAC } from '@strapi/helper-plugin';\nimport { Check, Eye as Show, EyeStriked as Hide } from '@strapi/icons';\nimport { translatedErrors } from '@strapi/strapi/admin';\n// Strapi Icons\nimport { Page } from '@strapi/strapi/admin';\nimport { Form, Formik } from 'formik';\nimport { useIntl } from 'react-intl';\nimport styled from 'styled-components';\nimport * as yup from 'yup';\n\nimport { PERMISSIONS } from '../../constants';\nimport { useDocumentation } from '../../hooks/useDocumentation';\nimport { getTrad } from '../../utils';\n\nconst schema = yup.object().shape({\n restrictedAccess: yup.boolean(),\n password: yup.string().when('restrictedAccess', (value, initSchema) => {\n return value ? initSchema.required(translatedErrors.required.id) : initSchema;\n }),\n});\n\nconst SettingsPage = () => {\n useFocusWhenNavigate();\n const { formatMessage } = useIntl();\n const { submit, data, isLoading } = useDocumentation();\n const [passwordShown, setPasswordShown] = useState(false);\n const { allowedActions } = useRBAC(PERMISSIONS);\n\n const handleUpdateSettingsSubmit = (body) => {\n submit.mutate({\n prefix: data?.prefix,\n body,\n });\n };\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n return (\n <Main>\n <Formik\n initialValues={{\n restrictedAccess: data?.documentationAccess.restrictedAccess || false,\n password: '',\n }}\n onSubmit={handleUpdateSettingsSubmit}\n validationSchema={schema}\n >\n {({\n handleSubmit,\n values,\n handleChange,\n errors,\n setFieldTouched,\n setFieldValue,\n dirty,\n }) => {\n return (\n <Form noValidate onSubmit={handleSubmit}>\n <HeaderLayout\n title={formatMessage({\n id: getTrad('plugin.name'),\n defaultMessage: 'Documentation',\n })}\n subtitle={formatMessage({\n id: getTrad('pages.SettingsPage.header.description'),\n defaultMessage: 'Configure the documentation plugin',\n })}\n primaryAction={\n <Button\n type=\"submit\"\n startIcon={<Check />}\n disabled={!dirty && allowedActions.canUpdate}\n >\n {formatMessage({\n id: getTrad('pages.SettingsPage.Button.save'),\n defaultMessage: 'Save',\n })}\n </Button>\n }\n />\n <ContentLayout>\n <Box\n background=\"neutral0\"\n hasRadius\n shadow=\"filterShadow\"\n paddingTop={6}\n paddingBottom={6}\n paddingLeft={7}\n paddingRight={7}\n >\n <Flex direction=\"column\" alignItems=\"stretch\" gap={4}>\n <Typography variant=\"delta\" as=\"h2\">\n {formatMessage({\n id: 'global.settings',\n defaultMessage: 'Settings',\n })}\n </Typography>\n <Grid gap={4}>\n <GridItem col={6} s={12}>\n <ToggleInput\n name=\"restrictedAccess\"\n label={formatMessage({\n id: getTrad('pages.SettingsPage.toggle.label'),\n defaultMessage: 'Restricted Access',\n })}\n hint={formatMessage({\n id: getTrad('pages.SettingsPage.toggle.hint'),\n defaultMessage: 'Make the documentation endpoint private',\n })}\n checked={values.restrictedAccess}\n onChange={() => {\n if (values.restrictedAccess === true) {\n setFieldValue('password', '', false);\n setFieldTouched('password', false, false);\n }\n\n setFieldValue('restrictedAccess', !values.restrictedAccess, false);\n }}\n onLabel=\"On\"\n offLabel=\"Off\"\n />\n </GridItem>\n {values.restrictedAccess && (\n <GridItem col={6} s={12}>\n <TextInput\n label={formatMessage({\n id: 'global.password',\n defaultMessage: 'Password',\n })}\n name=\"password\"\n placeholder=\"**********\"\n type={passwordShown ? 'text' : 'password'}\n value={values.password}\n onChange={handleChange}\n error={\n errors.password\n ? formatMessage({\n id: errors.password,\n defaultMessage: 'Invalid value',\n })\n : null\n }\n endAction={\n <FieldActionWrapper\n onClick={(e) => {\n e.stopPropagation();\n setPasswordShown((prev) => !prev);\n }}\n label={formatMessage(\n passwordShown\n ? {\n id: 'Auth.form.password.show-password',\n defaultMessage: 'Show password',\n }\n : {\n id: 'Auth.form.password.hide-password',\n defaultMessage: 'Hide password',\n }\n )}\n >\n {passwordShown ? <Show /> : <Hide />}\n </FieldActionWrapper>\n }\n />\n </GridItem>\n )}\n </Grid>\n </Flex>\n </Box>\n </ContentLayout>\n </Form>\n );\n }}\n </Formik>\n </Main>\n );\n};\n\nconst FieldActionWrapper = styled(FieldAction)`\n svg {\n height: 1rem;\n width: 1rem;\n path {\n fill: ${({ theme }) => theme.colors.neutral600};\n }\n }\n`;\n\nexport default SettingsPage;\n"],"names":["yup","translatedErrors","useFocusWhenNavigate","useIntl","useDocumentation","useState","useRBAC","PERMISSIONS","jsx","Page","Main","Formik","jsxs","Form","HeaderLayout","getTrad","Button","Check","ContentLayout","Box","Flex","Typography","Grid","GridItem","ToggleInput","TextInput","Show","Hide","styled","FieldAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,SAASA,eAAI,OAAO,EAAE,MAAM;AAAA,EAChC,kBAAkBA,eAAI,QAAQ;AAAA,EAC9B,UAAUA,eAAI,OAAO,EAAE,KAAK,oBAAoB,CAAC,OAAO,eAAe;AACrE,WAAO,QAAQ,WAAW,SAASC,MAAiB,iBAAA,SAAS,EAAE,IAAI;AAAA,EAAA,CACpE;AACH,CAAC;AAED,MAAM,eAAe,MAAM;AACJC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ict";
|
|
2
2
|
const helperPlugin = require("@strapi/helper-plugin");
|
|
3
|
-
const
|
|
3
|
+
const Icons = require("@strapi/icons");
|
|
4
4
|
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
|
5
5
|
const v = glob[path];
|
|
6
6
|
if (v) {
|
|
@@ -11,7 +11,7 @@ const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
|
|
11
11
|
});
|
|
12
12
|
};
|
|
13
13
|
const name$1 = "@strapi/plugin-documentation";
|
|
14
|
-
const version = "4.20.
|
|
14
|
+
const version = "4.20.5";
|
|
15
15
|
const description = "Create an OpenAPI Document and visualize your API with SWAGGER UI.";
|
|
16
16
|
const repository = {
|
|
17
17
|
type: "git",
|
|
@@ -56,20 +56,20 @@ const scripts = {
|
|
|
56
56
|
watch: "pack-up watch"
|
|
57
57
|
};
|
|
58
58
|
const dependencies = {
|
|
59
|
-
"@strapi/design-system": "1.
|
|
60
|
-
"@strapi/helper-plugin": "4.20.
|
|
61
|
-
"@strapi/icons": "1.
|
|
62
|
-
"@strapi/utils": "4.20.
|
|
59
|
+
"@strapi/design-system": "1.16.0",
|
|
60
|
+
"@strapi/helper-plugin": "4.20.5",
|
|
61
|
+
"@strapi/icons": "1.16.0",
|
|
62
|
+
"@strapi/utils": "4.20.5",
|
|
63
63
|
bcryptjs: "2.4.3",
|
|
64
64
|
cheerio: "^1.0.0-rc.12",
|
|
65
|
-
formik: "2.4.
|
|
66
|
-
"fs-extra": "10.
|
|
67
|
-
immer: "9.0.
|
|
65
|
+
formik: "2.4.5",
|
|
66
|
+
"fs-extra": "10.1.0",
|
|
67
|
+
immer: "9.0.21",
|
|
68
68
|
"koa-static": "^5.0.0",
|
|
69
69
|
lodash: "4.17.21",
|
|
70
70
|
"path-to-regexp": "6.2.1",
|
|
71
71
|
"react-helmet": "^6.1.0",
|
|
72
|
-
"react-intl": "6.
|
|
72
|
+
"react-intl": "6.6.2",
|
|
73
73
|
"react-query": "3.39.3",
|
|
74
74
|
"swagger-ui-dist": "4.19.0",
|
|
75
75
|
yaml: "1.10.2",
|
|
@@ -77,21 +77,21 @@ const dependencies = {
|
|
|
77
77
|
};
|
|
78
78
|
const devDependencies = {
|
|
79
79
|
"@apidevtools/swagger-parser": "^10.1.0",
|
|
80
|
-
"@strapi/pack-up": "4.20.
|
|
81
|
-
"@strapi/strapi": "4.20.
|
|
80
|
+
"@strapi/pack-up": "4.20.5",
|
|
81
|
+
"@strapi/strapi": "4.20.5",
|
|
82
82
|
"@testing-library/react": "14.0.0",
|
|
83
83
|
"@testing-library/user-event": "14.4.3",
|
|
84
84
|
msw: "1.3.0",
|
|
85
85
|
react: "^18.2.0",
|
|
86
86
|
"react-dom": "^18.2.0",
|
|
87
|
-
"react-router-dom": "
|
|
88
|
-
"styled-components": "5.3.
|
|
87
|
+
"react-router-dom": "6.22.3",
|
|
88
|
+
"styled-components": "5.3.11"
|
|
89
89
|
};
|
|
90
90
|
const peerDependencies = {
|
|
91
91
|
"@strapi/strapi": "^4.0.0",
|
|
92
92
|
react: "^17.0.0 || ^18.0.0",
|
|
93
93
|
"react-dom": "^17.0.0 || ^18.0.0",
|
|
94
|
-
"react-router-dom": "^
|
|
94
|
+
"react-router-dom": "^6.0.0",
|
|
95
95
|
"styled-components": "^5.2.1"
|
|
96
96
|
};
|
|
97
97
|
const engines = {
|
|
@@ -142,17 +142,14 @@ const name = pluginPkg.strapi.name;
|
|
|
142
142
|
const index = {
|
|
143
143
|
register(app) {
|
|
144
144
|
app.addMenuLink({
|
|
145
|
-
to:
|
|
146
|
-
icon:
|
|
145
|
+
to: `plugins/${pluginId}`,
|
|
146
|
+
icon: Icons.Information,
|
|
147
147
|
intlLabel: {
|
|
148
148
|
id: `${pluginId}.plugin.name`,
|
|
149
149
|
defaultMessage: "Documentation"
|
|
150
150
|
},
|
|
151
151
|
permissions: PERMISSIONS.main,
|
|
152
|
-
|
|
153
|
-
const component = await Promise.resolve().then(() => require("./index-U4uH9lyg.js"));
|
|
154
|
-
return component;
|
|
155
|
-
}
|
|
152
|
+
Component: () => Promise.resolve().then(() => require("./index-FiShd2zI.js")).then((n) => n.index)
|
|
156
153
|
});
|
|
157
154
|
app.registerPlugin({
|
|
158
155
|
id: pluginId,
|
|
@@ -166,11 +163,8 @@ const index = {
|
|
|
166
163
|
defaultMessage: "Documentation"
|
|
167
164
|
},
|
|
168
165
|
id: "documentation",
|
|
169
|
-
to:
|
|
170
|
-
|
|
171
|
-
const component = await Promise.resolve().then(() => require("./index-PR_fql8f.js"));
|
|
172
|
-
return component;
|
|
173
|
-
},
|
|
166
|
+
to: pluginId,
|
|
167
|
+
Component: () => Promise.resolve().then(() => require("./index-m8HLcGmV.js")),
|
|
174
168
|
permissions: PERMISSIONS.main
|
|
175
169
|
});
|
|
176
170
|
},
|
|
@@ -196,4 +190,4 @@ const index = {
|
|
|
196
190
|
exports.PERMISSIONS = PERMISSIONS;
|
|
197
191
|
exports.index = index;
|
|
198
192
|
exports.pluginId = pluginId;
|
|
199
|
-
//# sourceMappingURL=index-
|
|
193
|
+
//# sourceMappingURL=index-vWzO1snG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-vWzO1snG.js","sources":["../../admin/src/constants.js","../../admin/src/pluginId.js","../../admin/src/index.js"],"sourcesContent":["export const PERMISSIONS = {\n // This permission regards the main component (App) and is used to tell\n // If the plugin link should be displayed in the menu\n // And also if the plugin is accessible. This use case is found when a user types the url of the\n // plugin directly in the browser\n main: [\n { action: 'plugin::documentation.read', subject: null },\n { action: 'plugin::documentation.settings.regenerate', subject: null },\n { action: 'plugin::documentation.settings.update', subject: null },\n ],\n open: [\n { action: 'plugin::documentation.read', subject: null },\n { action: 'plugin::documentation.settings.regenerate', subject: null },\n ],\n regenerate: [{ action: 'plugin::documentation.settings.regenerate', subject: null }],\n update: [{ action: 'plugin::documentation.settings.update', subject: null }],\n};\n","import pluginPkg from '../../package.json';\n\nconst pluginId = pluginPkg.name.replace(/^@strapi\\/plugin-/i, '');\n\nexport default pluginId;\n","import { prefixPluginTranslations } from '@strapi/helper-plugin';\nimport { Information } from '@strapi/icons';\n\nimport pluginPkg from '../../package.json';\n\nimport { PERMISSIONS } from './constants';\nimport pluginId from './pluginId';\n\nconst name = pluginPkg.strapi.name;\n\nexport default {\n register(app) {\n app.addMenuLink({\n to: `plugins/${pluginId}`,\n icon: Information,\n intlLabel: {\n id: `${pluginId}.plugin.name`,\n defaultMessage: 'Documentation',\n },\n permissions: PERMISSIONS.main,\n Component: () => import('./pages/PluginPage'),\n });\n\n app.registerPlugin({\n id: pluginId,\n name,\n });\n },\n bootstrap(app) {\n app.addSettingsLink('global', {\n intlLabel: {\n id: `${pluginId}.plugin.name`,\n defaultMessage: 'Documentation',\n },\n id: 'documentation',\n to: pluginId,\n Component: () => import('./pages/SettingsPage'),\n permissions: PERMISSIONS.main,\n });\n },\n async registerTrads({ locales }) {\n const importedTrads = await Promise.all(\n locales.map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, pluginId),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return Promise.resolve(importedTrads);\n },\n};\n"],"names":["Information","prefixPluginTranslations"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAY,MAAC,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA,EAKzB,MAAM;AAAA,IACJ,EAAE,QAAQ,8BAA8B,SAAS,KAAM;AAAA,IACvD,EAAE,QAAQ,6CAA6C,SAAS,KAAM;AAAA,IACtE,EAAE,QAAQ,yCAAyC,SAAS,KAAM;AAAA,EACnE;AAAA,EACD,MAAM;AAAA,IACJ,EAAE,QAAQ,8BAA8B,SAAS,KAAM;AAAA,IACvD,EAAE,QAAQ,6CAA6C,SAAS,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CAAA,GAAA,kBAAA,MAAA,OAAA,EAC3C,KAAK,CAAC,EAAE,SAAS,WAAW;AAC3B,iBAAO;AAAA,YACL,MAAMC,aAAAA,yBAAyB,MAAM,QAAQ;AAAA,YAC7C;AAAA,UACd;AAAA,QACA,CAAW,EACA,MAAM,MAAM;AACX,iBAAO;AAAA,YACL,MAAM,CAAE;AAAA,YACR;AAAA,UACd;AAAA,QACA,CAAW;AAAA,MACX,CAAO;AAAA,IACP;AAEI,WAAO,QAAQ,QAAQ,aAAa;AAAA,EACrC;AACH;;;;"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { useEffect } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { useFetchClient } from "@strapi/helper-plugin";
|
|
3
|
+
import { useNotification, useAPIErrorHandler } from "@strapi/strapi/admin";
|
|
4
|
+
import { useIntl } from "react-intl";
|
|
3
5
|
import { useQuery, useMutation } from "react-query";
|
|
4
|
-
import { p as pluginId } from "./index-
|
|
6
|
+
import { p as pluginId } from "./index-h-OcS50W.mjs";
|
|
5
7
|
const getTrad = (id) => `${pluginId}.${id}`;
|
|
6
8
|
const useDocumentation = () => {
|
|
7
|
-
const toggleNotification = useNotification();
|
|
9
|
+
const { toggleNotification } = useNotification();
|
|
10
|
+
const { formatMessage } = useIntl();
|
|
8
11
|
const { del, post, put, get } = useFetchClient();
|
|
9
12
|
const { formatAPIError } = useAPIErrorHandler();
|
|
10
13
|
const { isLoading, isError, data, refetch, error } = useQuery(
|
|
@@ -17,14 +20,14 @@ const useDocumentation = () => {
|
|
|
17
20
|
useEffect(() => {
|
|
18
21
|
if (isError && error) {
|
|
19
22
|
toggleNotification({
|
|
20
|
-
type: "
|
|
21
|
-
message: error ? formatAPIError(error) : { id: "notification.error" }
|
|
23
|
+
type: "danger",
|
|
24
|
+
message: error ? formatAPIError(error) : formatMessage({ id: "notification.error" })
|
|
22
25
|
});
|
|
23
26
|
}
|
|
24
|
-
}, [isError, error, toggleNotification, formatAPIError]);
|
|
27
|
+
}, [isError, error, toggleNotification, formatAPIError, formatMessage]);
|
|
25
28
|
const handleError = (err) => {
|
|
26
29
|
toggleNotification({
|
|
27
|
-
type: "
|
|
30
|
+
type: "danger",
|
|
28
31
|
message: formatAPIError(err)
|
|
29
32
|
});
|
|
30
33
|
};
|
|
@@ -32,7 +35,7 @@ const useDocumentation = () => {
|
|
|
32
35
|
refetch();
|
|
33
36
|
toggleNotification({
|
|
34
37
|
type,
|
|
35
|
-
message: { id: getTrad(tradId), defaultMessage }
|
|
38
|
+
message: formatMessage({ id: getTrad(tradId), defaultMessage })
|
|
36
39
|
});
|
|
37
40
|
};
|
|
38
41
|
const deleteMutation = useMutation(
|
|
@@ -63,4 +66,4 @@ export {
|
|
|
63
66
|
getTrad as g,
|
|
64
67
|
useDocumentation as u
|
|
65
68
|
};
|
|
66
|
-
//# sourceMappingURL=useDocumentation-
|
|
69
|
+
//# sourceMappingURL=useDocumentation-EsufCjtn.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDocumentation-EsufCjtn.mjs","sources":["../../admin/src/utils/getTrad.js","../../admin/src/hooks/useDocumentation.js"],"sourcesContent":["import pluginId from '../pluginId';\n\nconst getTrad = (id) => `${pluginId}.${id}`;\n\nexport default getTrad;\n","import { useEffect } from 'react';\n\nimport { useFetchClient } from '@strapi/helper-plugin';\nimport { useAPIErrorHandler, useNotification } from '@strapi/strapi/admin';\nimport { useIntl } from 'react-intl';\nimport { useMutation, useQuery } from 'react-query';\n\nimport pluginId from '../pluginId';\nimport getTrad from '../utils/getTrad';\n\nexport const useDocumentation = () => {\n const { toggleNotification } = useNotification();\n const { formatMessage } = useIntl();\n const { del, post, put, get } = useFetchClient();\n\n const { formatAPIError } = useAPIErrorHandler();\n\n const { isLoading, isError, data, refetch, error } = useQuery(\n ['get-documentation', pluginId],\n async () => {\n const { data } = await get(`/${pluginId}/getInfos`);\n\n return data;\n }\n );\n\n useEffect(() => {\n if (isError && error) {\n toggleNotification({\n type: 'danger',\n message: error ? formatAPIError(error) : formatMessage({ id: 'notification.error' }),\n });\n }\n }, [isError, error, toggleNotification, formatAPIError, formatMessage]);\n\n const handleError = (err) => {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(err),\n });\n };\n\n const handleSuccess = (type, tradId, defaultMessage) => {\n refetch();\n toggleNotification({\n type,\n message: formatMessage({ id: getTrad(tradId), defaultMessage }),\n });\n };\n\n const deleteMutation = useMutation(\n ({ prefix, version }) => del(`${prefix}/deleteDoc/${version}`),\n {\n onSuccess: () =>\n handleSuccess('info', 'notification.delete.success', 'Successfully deleted documentation'),\n onError: handleError,\n }\n );\n\n const submit = useMutation(({ prefix, body }) => put(`${prefix}/updateSettings`, body), {\n onSuccess: () =>\n handleSuccess('success', 'notification.update.success', 'Successfully updated settings'),\n onError: handleError,\n });\n\n const regenerate = useMutation(\n ({ prefix, version }) => post(`${prefix}/regenerateDoc`, { version }),\n {\n onSuccess: () =>\n handleSuccess(\n 'info',\n 'notification.generate.success',\n 'Successfully generated documentation'\n ),\n onError: handleError,\n }\n );\n\n return { data, isLoading, isError, remove: deleteMutation, submit, regenerate };\n};\n"],"names":["data"],"mappings":";;;;;;AAEK,MAAC,UAAU,CAAC,OAAO,GAAG,QAAQ,IAAI,EAAE;ACQ7B,MAAC,mBAAmB,MAAM;AACpC,QAAM,EAAE,uBAAuB;AAC/B,QAAM,EAAE,kBAAkB;AAC1B,QAAM,EAAE,KAAK,MAAM,KAAK,IAAG,IAAK;AAEhC,QAAM,EAAE,mBAAmB;AAE3B,QAAM,EAAE,WAAW,SAAS,MAAM,SAAS,MAAK,IAAK;AAAA,IACnD,CAAC,qBAAqB,QAAQ;AAAA,IAC9B,YAAY;AACV,YAAM,EAAE,MAAAA,MAAM,IAAG,MAAM,IAAI,IAAI,QAAQ,WAAW;AAElD,aAAOA;AAAA,IACR;AAAA,EACL;AAEE,YAAU,MAAM;AACd,QAAI,WAAW,OAAO;AACpB,yBAAmB;AAAA,QACjB,M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in = require("@strapi/helper-plugin");
|
|
4
|
+
const admin = require("@strapi/strapi/admin");
|
|
5
|
+
const reactIntl = require("react-intl");
|
|
4
6
|
const reactQuery = require("react-query");
|
|
5
|
-
const index = require("./index-
|
|
7
|
+
const index = require("./index-vWzO1snG.js");
|
|
6
8
|
const getTrad = (id) => `${index.pluginId}.${id}`;
|
|
7
9
|
const useDocumentation = () => {
|
|
8
|
-
const toggleNotification =
|
|
10
|
+
const { toggleNotification } = admin.useNotification();
|
|
11
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
9
12
|
const { del, post, put, get } = helperPlugin.useFetchClient();
|
|
10
|
-
const { formatAPIError } =
|
|
13
|
+
const { formatAPIError } = admin.useAPIErrorHandler();
|
|
11
14
|
const { isLoading, isError, data, refetch, error } = reactQuery.useQuery(
|
|
12
15
|
["get-documentation", index.pluginId],
|
|
13
16
|
async () => {
|
|
@@ -15,17 +18,17 @@ const useDocumentation = () => {
|
|
|
15
18
|
return data2;
|
|
16
19
|
}
|
|
17
20
|
);
|
|
18
|
-
|
|
21
|
+
React.useEffect(() => {
|
|
19
22
|
if (isError && error) {
|
|
20
23
|
toggleNotification({
|
|
21
|
-
type: "
|
|
22
|
-
message: error ? formatAPIError(error) : { id: "notification.error" }
|
|
24
|
+
type: "danger",
|
|
25
|
+
message: error ? formatAPIError(error) : formatMessage({ id: "notification.error" })
|
|
23
26
|
});
|
|
24
27
|
}
|
|
25
|
-
}, [isError, error, toggleNotification, formatAPIError]);
|
|
28
|
+
}, [isError, error, toggleNotification, formatAPIError, formatMessage]);
|
|
26
29
|
const handleError = (err) => {
|
|
27
30
|
toggleNotification({
|
|
28
|
-
type: "
|
|
31
|
+
type: "danger",
|
|
29
32
|
message: formatAPIError(err)
|
|
30
33
|
});
|
|
31
34
|
};
|
|
@@ -33,7 +36,7 @@ const useDocumentation = () => {
|
|
|
33
36
|
refetch();
|
|
34
37
|
toggleNotification({
|
|
35
38
|
type,
|
|
36
|
-
message: { id: getTrad(tradId), defaultMessage }
|
|
39
|
+
message: formatMessage({ id: getTrad(tradId), defaultMessage })
|
|
37
40
|
});
|
|
38
41
|
};
|
|
39
42
|
const deleteMutation = reactQuery.useMutation(
|
|
@@ -62,4 +65,4 @@ const useDocumentation = () => {
|
|
|
62
65
|
};
|
|
63
66
|
exports.getTrad = getTrad;
|
|
64
67
|
exports.useDocumentation = useDocumentation;
|
|
65
|
-
//# sourceMappingURL=useDocumentation-
|
|
68
|
+
//# sourceMappingURL=useDocumentation-hOQyphRS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDocumentation-hOQyphRS.js","sources":["../../admin/src/utils/getTrad.js","../../admin/src/hooks/useDocumentation.js"],"sourcesContent":["import pluginId from '../pluginId';\n\nconst getTrad = (id) => `${pluginId}.${id}`;\n\nexport default getTrad;\n","import { useEffect } from 'react';\n\nimport { useFetchClient } from '@strapi/helper-plugin';\nimport { useAPIErrorHandler, useNotification } from '@strapi/strapi/admin';\nimport { useIntl } from 'react-intl';\nimport { useMutation, useQuery } from 'react-query';\n\nimport pluginId from '../pluginId';\nimport getTrad from '../utils/getTrad';\n\nexport const useDocumentation = () => {\n const { toggleNotification } = useNotification();\n const { formatMessage } = useIntl();\n const { del, post, put, get } = useFetchClient();\n\n const { formatAPIError } = useAPIErrorHandler();\n\n const { isLoading, isError, data, refetch, error } = useQuery(\n ['get-documentation', pluginId],\n async () => {\n const { data } = await get(`/${pluginId}/getInfos`);\n\n return data;\n }\n );\n\n useEffect(() => {\n if (isError && error) {\n toggleNotification({\n type: 'danger',\n message: error ? formatAPIError(error) : formatMessage({ id: 'notification.error' }),\n });\n }\n }, [isError, error, toggleNotification, formatAPIError, formatMessage]);\n\n const handleError = (err) => {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(err),\n });\n };\n\n const handleSuccess = (type, tradId, defaultMessage) => {\n refetch();\n toggleNotification({\n type,\n message: formatMessage({ id: getTrad(tradId), defaultMessage }),\n });\n };\n\n const deleteMutation = useMutation(\n ({ prefix, version }) => del(`${prefix}/deleteDoc/${version}`),\n {\n onSuccess: () =>\n handleSuccess('info', 'notification.delete.success', 'Successfully deleted documentation'),\n onError: handleError,\n }\n );\n\n const submit = useMutation(({ prefix, body }) => put(`${prefix}/updateSettings`, body), {\n onSuccess: () =>\n handleSuccess('success', 'notification.update.success', 'Successfully updated settings'),\n onError: handleError,\n });\n\n const regenerate = useMutation(\n ({ prefix, version }) => post(`${prefix}/regenerateDoc`, { version }),\n {\n onSuccess: () =>\n handleSuccess(\n 'info',\n 'notification.generate.success',\n 'Successfully generated documentation'\n ),\n onError: handleError,\n }\n );\n\n return { data, isLoading, isError, remove: deleteMutation, submit, regenerate };\n};\n"],"names":["pluginId","useNotification","useIntl","useFetchClient","useAPIErrorHandler","useQuery","data","useEffect","useMutation"],"mappings":";;;;;;;AAEK,MAAC,UAAU,CAAC,OAAO,GAAGA,MAAAA,QAAQ,IAAI,EAAE;ACQ7B,MAAC,mBAAmB,MAAM;AACpC,QAAM,EAAE,uBAAuBC,MAAAA;AAC/B,QAAM,EAAE,kBAAkBC,UAAAA;AAC1B,QAAM,EAAE,KAAK,MAAM,KAAK,IAAG,IAAKC,aAAAA;AAEhC,QAAM,EAAE,mBAAmBC,MAAAA;AAE3B,QAAM,EAAE,WAAW,SAAS,MAAM,SAAS,MAAK,IAAKC,WAAQ;AAAA,IAC3D,CAAC,qBAAqBL,MAAAA,QAAQ;AAAA,IAC9B,YAAY;AACV,YAAM,EAAE,MAAAM,MAAM,IAAG,MAAM,IAAI,IAAIN,MAAQ,QAAA,WAAW;AAElD,aAAOM;AAAA,IACR;AAAA,EACL;AAEEC,QAAAA,UAAU,MAAM;AACd,QAAI,WAAW,OAAO;AACpB,yBAAmB;AAAA,QACjB,MAAM;AAAA,QACN,SAAS,QAAQ,eAAe,KAAK,IAAI,cAAc,EAAE,IAAI,sBAAsB;AAAA,MAC3F,CAAO;AAAA,IACF;AAAA,EACL,GAAK,CAAC,SAAS,OAAO,oBAAoB,gBAAgB,aAAa,CAAC;AAEtE,QAAM,cAAc,CAAC,QAAQ;AAC3B,uBAAmB;AAAA,MACjB,MAAM;AAAA,MACN,SAAS,eAAe,GAAG;AAAA,IACjC,CAAK;AAAA,EACL;AAEE,QAAM,gBAAgB,CAAC,MAAM,QAAQ,mBAAmB;AACtD;AACA,uBAAmB;AAAA,MACjB;AAAA,MACA,SAAS,cAAc,EAAE,IAAI,QAAQ,MAAM,GAAG,gBAAgB;AAAA,IACpE,CAAK;AAAA,EACL;AAEE,QAAM,iBAAiBC,WAAW;AAAA,IAChC,CAAC,EAAE,QAAQ,QAAO,MAAO,IAAI,GAAG,MAAM,cAAc,OAAO,EAAE;AAAA,IAC7D;AAAA,MACE,WAAW,MACT,cAAc,QAAQ,+BAA+B,oCAAoC;AAAA,MAC3F,SAAS;AAAA,IACV;AAAA,EACL;AAEE,QAAM,SAASA,WAAAA,YAAY,CAAC,EAAE,QAAQ,KAAI,MAAO,IAAI,GAAG,MAAM,mBAAmB,IAAI,GAAG;AAAA,IACtF,WAAW,MACT,cAAc,WAAW,+BAA+B,+BAA+B;AAAA,IACzF,SAAS;AAAA,EACb,CAAG;AAED,QAAM,aAAaA,WAAW;AAAA,IAC5B,CAAC,EAAE,QAAQ,QAAO,MAAO,KAAK,GAAG,MAAM,kBAAkB,EAAE,SAAS;AAAA,IACpE;AAAA,MACE,WAAW,MACT;AAAA,QACE;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAAA,MACH,SAAS;AAAA,IACV;AAAA,EACL;AAEE,SAAO,EAAE,MAAM,WAAW,SAAS,QAAQ,gBAAgB,QAAQ;AACrE;;;"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const React = require("react");
|
|
3
|
+
const index = require("./index-FiShd2zI.js");
|
|
4
|
+
function _interopNamespace(e) {
|
|
5
|
+
if (e && e.__esModule)
|
|
6
|
+
return e;
|
|
7
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
8
|
+
if (e) {
|
|
9
|
+
for (const k in e) {
|
|
10
|
+
if (k !== "default") {
|
|
11
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: () => e[k]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
n.default = e;
|
|
20
|
+
return Object.freeze(n);
|
|
21
|
+
}
|
|
22
|
+
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
23
|
+
const useSyncRbac = (collectionTypeUID, query, containerName = "listView") => {
|
|
24
|
+
const [isLoading, setIsLoading] = React__namespace.useState(true);
|
|
25
|
+
const dispatch = index.useTypedDispatch();
|
|
26
|
+
const collectionTypesRelatedPermissions = index.useTypedSelector(
|
|
27
|
+
(state) => state.rbacProvider.collectionTypesRelatedPermissions
|
|
28
|
+
);
|
|
29
|
+
const relatedPermissions = collectionTypesRelatedPermissions[collectionTypeUID];
|
|
30
|
+
React__namespace.useEffect(() => {
|
|
31
|
+
setIsLoading(true);
|
|
32
|
+
if (relatedPermissions) {
|
|
33
|
+
dispatch(
|
|
34
|
+
index.setPermissions({
|
|
35
|
+
permissions: relatedPermissions,
|
|
36
|
+
__meta__: {
|
|
37
|
+
plugins: query ? query.plugins : void 0,
|
|
38
|
+
containerName
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
setIsLoading(false);
|
|
44
|
+
return () => {
|
|
45
|
+
dispatch(index.resetPermissions());
|
|
46
|
+
};
|
|
47
|
+
}, [relatedPermissions, dispatch, query, containerName]);
|
|
48
|
+
const permissions = index.useTypedSelector((state) => state["content-manager"].rbac.permissions);
|
|
49
|
+
const isPermissionMismatch = permissions && permissions.some((permission) => permission.subject !== collectionTypeUID) ? true : false;
|
|
50
|
+
return {
|
|
51
|
+
isLoading,
|
|
52
|
+
isError: !isLoading && isPermissionMismatch,
|
|
53
|
+
permissions
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
exports.useSyncRbac = useSyncRbac;
|
|
57
|
+
//# sourceMappingURL=useSyncRbac-Kt8Li0Yf-f6LRUqJf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSyncRbac-Kt8Li0Yf-f6LRUqJf.js","sources":["../../../../core/admin/dist/_chunks/useSyncRbac-Kt8Li0Yf.mjs"],"sourcesContent":["import * as React from \"react\";\nimport { r as useTypedDispatch, q as useTypedSelector, aG as setPermissions, aH as resetPermissions } from \"./index-5ZvCaCyY.mjs\";\nconst useSyncRbac = (collectionTypeUID, query, containerName = \"listView\") => {\n const [isLoading, setIsLoading] = React.useState(true);\n const dispatch = useTypedDispatch();\n const collectionTypesRelatedPermissions = useTypedSelector(\n (state) => state.rbacProvider.collectionTypesRelatedPermissions\n );\n const relatedPermissions = collectionTypesRelatedPermissions[collectionTypeUID];\n React.useEffect(() => {\n setIsLoading(true);\n if (relatedPermissions) {\n dispatch(\n setPermissions({\n permissions: relatedPermissions,\n __meta__: {\n plugins: query ? query.plugins : void 0,\n containerName\n }\n })\n );\n }\n setIsLoading(false);\n return () => {\n dispatch(resetPermissions());\n };\n }, [relatedPermissions, dispatch, query, containerName]);\n const permissions = useTypedSelector((state) => state[\"content-manager\"].rbac.permissions);\n const isPermissionMismatch = permissions && permissions.some((permission) => permission.subject !== collectionTypeUID) ? true : false;\n return {\n isLoading,\n isError: !isLoading && isPermissionMismatch,\n permissions\n };\n};\nexport {\n useSyncRbac as u\n};\n//# sourceMappingURL=useSyncRbac-Kt8Li0Yf.mjs.map\n"],"names":["React","useTypedDispatch","useTypedSelector","setPermissions","resetPermissions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEK,MAAC,cAAc,CAAC,mBAAmB,OAAO,gBAAgB,eAAe;AAC5E,QAAM,CAAC,WAAW,YAAY,IAAIA,iBAAM,SAAS,IAAI;AACrD,QAAM,WAAWC,MAAAA;AACjB,QAAM,oCAAoCC,MAAgB;AAAA,IACxD,CAAC,UAAU,MAAM,aAAa;AAAA,EAClC;AACE,QAAM,qBAAqB,kCAAkC,iBAAiB;AAC9EF,mBAAM,UAAU,MAAM;AACpB,iBAAa,IAAI;AACjB,QAAI,oBAAoB;AACtB;AAAA,QACEG,qBAAe;AAAA,UACb,aAAa;AAAA,UACb,UAAU;AAAA,YACR,SAAS,QAAQ,MAAM,UAAU;AAAA,YACjC;AAAA,UACD;AAAA,QACX,CAAS;AAAA,MACT;AAAA,IACK;AACD,iBAAa,KAAK;AAClB,WAAO,MAAM;AACX,eAASC,MAAgB,iBAAA,CAAE;AAAA,IACjC;AAAA,EACG,GAAE,CAAC,oBAAoB,UAAU,OAAO,aAAa,CAAC;AACvD,QAAM,cAAcF,MAAgB,iBAAC,CAAC,UAAU,MAAM,iBAAiB,EAAE,KAAK,WAAW;AACzF,QAAM,uBAAuB,eAAe,YAAY,KAAK,CAAC,eAAe,WAAW,YAAY,iBAAiB,IAAI,OAAO;AAChI,SAAO;AAAA,IACL;AAAA,IACA,SAAS,CAAC,aAAa;AAAA,IACvB;AAAA,EACJ;AACA;;"}
|