@strapi/review-workflows 5.17.0 → 5.18.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.
- package/dist/admin/components/Widgets.js +138 -0
- package/dist/admin/components/Widgets.js.map +1 -0
- package/dist/admin/components/Widgets.mjs +136 -0
- package/dist/admin/components/Widgets.mjs.map +1 -0
- package/dist/admin/index.js +23 -2
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +23 -2
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/services/content-manager.js +18 -3
- package/dist/admin/services/content-manager.js.map +1 -1
- package/dist/admin/services/content-manager.mjs +18 -4
- package/dist/admin/services/content-manager.mjs.map +1 -1
- package/dist/admin/src/components/Widgets.d.ts +2 -0
- package/dist/admin/src/services/content-manager.d.ts +6 -5
- package/dist/admin/translations/en.json.js +3 -1
- package/dist/admin/translations/en.json.js.map +1 -1
- package/dist/admin/translations/en.json.mjs +3 -1
- package/dist/admin/translations/en.json.mjs.map +1 -1
- package/dist/server/controllers/index.js +3 -1
- package/dist/server/controllers/index.js.map +1 -1
- package/dist/server/controllers/index.mjs +3 -1
- package/dist/server/controllers/index.mjs.map +1 -1
- package/dist/server/homepage/controllers/homepage.js +15 -0
- package/dist/server/homepage/controllers/homepage.js.map +1 -0
- package/dist/server/homepage/controllers/homepage.mjs +13 -0
- package/dist/server/homepage/controllers/homepage.mjs.map +1 -0
- package/dist/server/homepage/controllers/index.js +10 -0
- package/dist/server/homepage/controllers/index.js.map +1 -0
- package/dist/server/homepage/controllers/index.mjs +8 -0
- package/dist/server/homepage/controllers/index.mjs.map +1 -0
- package/dist/server/homepage/index.js +14 -0
- package/dist/server/homepage/index.js.map +1 -0
- package/dist/server/homepage/index.mjs +12 -0
- package/dist/server/homepage/index.mjs.map +1 -0
- package/dist/server/homepage/routes/homepage.js +25 -0
- package/dist/server/homepage/routes/homepage.js.map +1 -0
- package/dist/server/homepage/routes/homepage.mjs +23 -0
- package/dist/server/homepage/routes/homepage.mjs.map +1 -0
- package/dist/server/homepage/routes/index.js +10 -0
- package/dist/server/homepage/routes/index.js.map +1 -0
- package/dist/server/homepage/routes/index.mjs +8 -0
- package/dist/server/homepage/routes/index.mjs.map +1 -0
- package/dist/server/homepage/services/homepage.js +24 -0
- package/dist/server/homepage/services/homepage.js.map +1 -0
- package/dist/server/homepage/services/homepage.mjs +22 -0
- package/dist/server/homepage/services/homepage.mjs.map +1 -0
- package/dist/server/homepage/services/index.js +10 -0
- package/dist/server/homepage/services/index.js.map +1 -0
- package/dist/server/homepage/services/index.mjs +8 -0
- package/dist/server/homepage/services/index.mjs.map +1 -0
- package/dist/server/routes/index.js +3 -1
- package/dist/server/routes/index.js.map +1 -1
- package/dist/server/routes/index.mjs +3 -1
- package/dist/server/routes/index.mjs.map +1 -1
- package/dist/server/services/index.js +3 -1
- package/dist/server/services/index.js.map +1 -1
- package/dist/server/services/index.mjs +3 -1
- package/dist/server/services/index.mjs.map +1 -1
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/homepage/controllers/homepage.d.ts +6 -0
- package/dist/server/src/homepage/controllers/homepage.d.ts.map +1 -0
- package/dist/server/src/homepage/controllers/index.d.ts +2 -0
- package/dist/server/src/homepage/controllers/index.d.ts.map +1 -0
- package/dist/server/src/homepage/index.d.ts +15 -0
- package/dist/server/src/homepage/index.d.ts.map +1 -0
- package/dist/server/src/homepage/routes/homepage.d.ts +4 -0
- package/dist/server/src/homepage/routes/homepage.d.ts.map +1 -0
- package/dist/server/src/homepage/routes/index.d.ts +4 -0
- package/dist/server/src/homepage/routes/index.d.ts.map +1 -0
- package/dist/server/src/homepage/services/homepage.d.ts +9 -0
- package/dist/server/src/homepage/services/homepage.d.ts.map +1 -0
- package/dist/server/src/homepage/services/index.d.ts +8 -0
- package/dist/server/src/homepage/services/index.d.ts.map +1 -0
- package/dist/server/src/index.d.ts +6 -0
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/routes/index.d.ts +1 -0
- package/dist/server/src/routes/index.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +5 -0
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/shared/contracts/homepage.d.ts +26 -0
- package/dist/shared/contracts/homepage.d.ts.map +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var strapiAdmin = require('@strapi/admin/strapi-admin');
|
|
5
|
+
var strapiAdmin$1 = require('@strapi/content-manager/strapi-admin');
|
|
6
|
+
var designSystem = require('@strapi/design-system');
|
|
7
|
+
var icons = require('@strapi/icons');
|
|
8
|
+
var reactIntl = require('react-intl');
|
|
9
|
+
var reactRouterDom = require('react-router-dom');
|
|
10
|
+
var styledComponents = require('styled-components');
|
|
11
|
+
var TableColumns = require('../routes/content-manager/model/components/TableColumns.js');
|
|
12
|
+
var contentManager = require('../services/content-manager.js');
|
|
13
|
+
|
|
14
|
+
const CellTypography = styledComponents.styled(designSystem.Typography).attrs({
|
|
15
|
+
maxWidth: '14.4rem',
|
|
16
|
+
display: 'block'
|
|
17
|
+
})`
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
text-overflow: ellipsis;
|
|
20
|
+
white-space: nowrap;
|
|
21
|
+
`;
|
|
22
|
+
const RecentDocumentsTable = ({ documents })=>{
|
|
23
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
24
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
25
|
+
const navigate = reactRouterDom.useNavigate();
|
|
26
|
+
const getEditViewLink = (document)=>{
|
|
27
|
+
const isSingleType = document.kind === 'singleType';
|
|
28
|
+
const kindPath = isSingleType ? 'single-types' : 'collection-types';
|
|
29
|
+
const queryParams = document.locale ? `?plugins[i18n][locale]=${document.locale}` : '';
|
|
30
|
+
return `/content-manager/${kindPath}/${document.contentTypeUid}${isSingleType ? '' : '/' + document.documentId}${queryParams}`;
|
|
31
|
+
};
|
|
32
|
+
const handleRowClick = (document)=>()=>{
|
|
33
|
+
trackUsage('willEditEntryFromHome');
|
|
34
|
+
const link = getEditViewLink(document);
|
|
35
|
+
navigate(link);
|
|
36
|
+
};
|
|
37
|
+
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Table, {
|
|
38
|
+
colCount: 6,
|
|
39
|
+
rowCount: documents?.length ?? 0,
|
|
40
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Tbody, {
|
|
41
|
+
children: documents?.map((document)=>/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Tr, {
|
|
42
|
+
onClick: handleRowClick(document),
|
|
43
|
+
cursor: "pointer",
|
|
44
|
+
children: [
|
|
45
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
|
|
46
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(CellTypography, {
|
|
47
|
+
title: document.title,
|
|
48
|
+
variant: "omega",
|
|
49
|
+
textColor: "neutral800",
|
|
50
|
+
children: document.title
|
|
51
|
+
})
|
|
52
|
+
}),
|
|
53
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
|
|
54
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(CellTypography, {
|
|
55
|
+
variant: "omega",
|
|
56
|
+
textColor: "neutral600",
|
|
57
|
+
children: document.kind === 'singleType' ? formatMessage({
|
|
58
|
+
id: 'content-manager.widget.last-edited.single-type',
|
|
59
|
+
defaultMessage: 'Single-Type'
|
|
60
|
+
}) : formatMessage({
|
|
61
|
+
id: document.contentTypeDisplayName,
|
|
62
|
+
defaultMessage: document.contentTypeDisplayName
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
}),
|
|
66
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
|
|
67
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
|
68
|
+
display: "inline-block",
|
|
69
|
+
children: document.status ? /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin$1.DocumentStatus, {
|
|
70
|
+
status: document.status
|
|
71
|
+
}) : /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
|
72
|
+
textColor: "neutral600",
|
|
73
|
+
"aria-hidden": true,
|
|
74
|
+
children: "-"
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
}),
|
|
78
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
|
|
79
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
|
80
|
+
textColor: "neutral600",
|
|
81
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin$1.RelativeTime, {
|
|
82
|
+
timestamp: new Date(document.updatedAt)
|
|
83
|
+
})
|
|
84
|
+
})
|
|
85
|
+
}),
|
|
86
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
|
|
87
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(TableColumns.StageColumn, {
|
|
88
|
+
strapi_stage: document.strapi_stage
|
|
89
|
+
})
|
|
90
|
+
}),
|
|
91
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
|
|
92
|
+
onClick: (e)=>e.stopPropagation(),
|
|
93
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
|
94
|
+
display: "inline-block",
|
|
95
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
|
|
96
|
+
tag: reactRouterDom.Link,
|
|
97
|
+
to: getEditViewLink(document),
|
|
98
|
+
onClick: ()=>trackUsage('willEditEntryFromHome'),
|
|
99
|
+
label: formatMessage({
|
|
100
|
+
id: 'content-manager.actions.edit.label',
|
|
101
|
+
defaultMessage: 'Edit'
|
|
102
|
+
}),
|
|
103
|
+
variant: "ghost",
|
|
104
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(icons.Pencil, {})
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
]
|
|
109
|
+
}, document.documentId))
|
|
110
|
+
})
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
/* -------------------------------------------------------------------------------------------------
|
|
114
|
+
* AssignedWidget
|
|
115
|
+
* -----------------------------------------------------------------------------------------------*/ const AssignedWidget = ()=>{
|
|
116
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
117
|
+
const { data, isLoading, error } = contentManager.useGetRecentlyAssignedDocumentsQuery();
|
|
118
|
+
if (isLoading) {
|
|
119
|
+
return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Widget.Loading, {});
|
|
120
|
+
}
|
|
121
|
+
if (error || !data) {
|
|
122
|
+
return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Widget.Error, {});
|
|
123
|
+
}
|
|
124
|
+
if (data.length === 0) {
|
|
125
|
+
return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Widget.NoData, {
|
|
126
|
+
children: formatMessage({
|
|
127
|
+
id: 'review-workflows.widget.assigned.no-data',
|
|
128
|
+
defaultMessage: 'No entries'
|
|
129
|
+
})
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return /*#__PURE__*/ jsxRuntime.jsx(RecentDocumentsTable, {
|
|
133
|
+
documents: data
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
exports.AssignedWidget = AssignedWidget;
|
|
138
|
+
//# sourceMappingURL=Widgets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Widgets.js","sources":["../../../admin/src/components/Widgets.tsx"],"sourcesContent":["import { Widget, useTracking } from '@strapi/admin/strapi-admin';\nimport { DocumentStatus, RelativeTime } from '@strapi/content-manager/strapi-admin';\nimport { Box, IconButton, Table, Tbody, Td, Tr, Typography } from '@strapi/design-system';\nimport { Pencil } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { Link, useNavigate } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { StageColumn } from '../routes/content-manager/model/components/TableColumns';\nimport { useGetRecentlyAssignedDocumentsQuery } from '../services/content-manager';\n\nimport type { RecentDocument } from '../../../shared/contracts/homepage';\n\nconst CellTypography = styled(Typography).attrs({ maxWidth: '14.4rem', display: 'block' })`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nconst RecentDocumentsTable = ({ documents }: { documents: RecentDocument[] }) => {\n const { formatMessage } = useIntl();\n const { trackUsage } = useTracking();\n const navigate = useNavigate();\n\n const getEditViewLink = (document: RecentDocument): string => {\n const isSingleType = document.kind === 'singleType';\n const kindPath = isSingleType ? 'single-types' : 'collection-types';\n const queryParams = document.locale ? `?plugins[i18n][locale]=${document.locale}` : '';\n\n return `/content-manager/${kindPath}/${document.contentTypeUid}${isSingleType ? '' : '/' + document.documentId}${queryParams}`;\n };\n\n const handleRowClick = (document: RecentDocument) => () => {\n trackUsage('willEditEntryFromHome');\n const link = getEditViewLink(document);\n navigate(link);\n };\n\n return (\n <Table colCount={6} rowCount={documents?.length ?? 0}>\n <Tbody>\n {documents?.map((document) => (\n <Tr onClick={handleRowClick(document)} cursor=\"pointer\" key={document.documentId}>\n <Td>\n <CellTypography title={document.title} variant=\"omega\" textColor=\"neutral800\">\n {document.title}\n </CellTypography>\n </Td>\n <Td>\n <CellTypography variant=\"omega\" textColor=\"neutral600\">\n {document.kind === 'singleType'\n ? formatMessage({\n id: 'content-manager.widget.last-edited.single-type',\n defaultMessage: 'Single-Type',\n })\n : formatMessage({\n id: document.contentTypeDisplayName,\n defaultMessage: document.contentTypeDisplayName,\n })}\n </CellTypography>\n </Td>\n <Td>\n <Box display=\"inline-block\">\n {document.status ? (\n <DocumentStatus status={document.status} />\n ) : (\n <Typography textColor=\"neutral600\" aria-hidden>\n -\n </Typography>\n )}\n </Box>\n </Td>\n <Td>\n <Typography textColor=\"neutral600\">\n <RelativeTime timestamp={new Date(document.updatedAt)} />\n </Typography>\n </Td>\n <Td>\n <StageColumn strapi_stage={document.strapi_stage} />\n </Td>\n <Td onClick={(e) => e.stopPropagation()}>\n <Box display=\"inline-block\">\n <IconButton\n tag={Link}\n to={getEditViewLink(document)}\n onClick={() => trackUsage('willEditEntryFromHome')}\n label={formatMessage({\n id: 'content-manager.actions.edit.label',\n defaultMessage: 'Edit',\n })}\n variant=\"ghost\"\n >\n <Pencil />\n </IconButton>\n </Box>\n </Td>\n </Tr>\n ))}\n </Tbody>\n </Table>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * AssignedWidget\n * -----------------------------------------------------------------------------------------------*/\n\nconst AssignedWidget = () => {\n const { formatMessage } = useIntl();\n const { data, isLoading, error } = useGetRecentlyAssignedDocumentsQuery();\n\n if (isLoading) {\n return <Widget.Loading />;\n }\n\n if (error || !data) {\n return <Widget.Error />;\n }\n\n if (data.length === 0) {\n return (\n <Widget.NoData>\n {formatMessage({\n id: 'review-workflows.widget.assigned.no-data',\n defaultMessage: 'No entries',\n })}\n </Widget.NoData>\n );\n }\n\n return <RecentDocumentsTable documents={data} />;\n};\n\nexport { AssignedWidget };\n"],"names":["CellTypography","styled","Typography","attrs","maxWidth","display","RecentDocumentsTable","documents","formatMessage","useIntl","trackUsage","useTracking","navigate","useNavigate","getEditViewLink","document","isSingleType","kind","kindPath","queryParams","locale","contentTypeUid","documentId","handleRowClick","link","_jsx","Table","colCount","rowCount","length","Tbody","map","_jsxs","Tr","onClick","cursor","Td","title","variant","textColor","id","defaultMessage","contentTypeDisplayName","Box","status","DocumentStatus","aria-hidden","RelativeTime","timestamp","Date","updatedAt","StageColumn","strapi_stage","e","stopPropagation","IconButton","tag","Link","to","label","Pencil","AssignedWidget","data","isLoading","error","useGetRecentlyAssignedDocumentsQuery","Widget","Loading","Error","NoData"],"mappings":";;;;;;;;;;;;;AAaA,MAAMA,cAAiBC,GAAAA,uBAAAA,CAAOC,uBAAYC,CAAAA,CAAAA,KAAK,CAAC;IAAEC,QAAU,EAAA,SAAA;IAAWC,OAAS,EAAA;AAAQ,CAAA,CAAE;;;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tB;IAEA,IAAIN,IAAAA,CAAKjC,MAAM,KAAK,CAAG,EAAA;QACrB,qBACEJ,cAAA,CAACyC,mBAAOG,MAAM,EAAA;sBACX7D,aAAc,CAAA;gBACbgC,EAAI,EAAA,0CAAA;gBACJC,cAAgB,EAAA;AAClB,aAAA;;AAGN;AAEA,IAAA,qBAAOhB,cAACnB,CAAAA,oBAAAA,EAAAA;QAAqBC,SAAWuD,EAAAA;;AAC1C;;;;"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { Widget, useTracking } from '@strapi/admin/strapi-admin';
|
|
3
|
+
import { DocumentStatus, RelativeTime } from '@strapi/content-manager/strapi-admin';
|
|
4
|
+
import { Typography, Table, Tbody, Tr, Td, Box, IconButton } from '@strapi/design-system';
|
|
5
|
+
import { Pencil } from '@strapi/icons';
|
|
6
|
+
import { useIntl } from 'react-intl';
|
|
7
|
+
import { useNavigate, Link } from 'react-router-dom';
|
|
8
|
+
import { styled } from 'styled-components';
|
|
9
|
+
import { StageColumn } from '../routes/content-manager/model/components/TableColumns.mjs';
|
|
10
|
+
import { useGetRecentlyAssignedDocumentsQuery } from '../services/content-manager.mjs';
|
|
11
|
+
|
|
12
|
+
const CellTypography = styled(Typography).attrs({
|
|
13
|
+
maxWidth: '14.4rem',
|
|
14
|
+
display: 'block'
|
|
15
|
+
})`
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
text-overflow: ellipsis;
|
|
18
|
+
white-space: nowrap;
|
|
19
|
+
`;
|
|
20
|
+
const RecentDocumentsTable = ({ documents })=>{
|
|
21
|
+
const { formatMessage } = useIntl();
|
|
22
|
+
const { trackUsage } = useTracking();
|
|
23
|
+
const navigate = useNavigate();
|
|
24
|
+
const getEditViewLink = (document)=>{
|
|
25
|
+
const isSingleType = document.kind === 'singleType';
|
|
26
|
+
const kindPath = isSingleType ? 'single-types' : 'collection-types';
|
|
27
|
+
const queryParams = document.locale ? `?plugins[i18n][locale]=${document.locale}` : '';
|
|
28
|
+
return `/content-manager/${kindPath}/${document.contentTypeUid}${isSingleType ? '' : '/' + document.documentId}${queryParams}`;
|
|
29
|
+
};
|
|
30
|
+
const handleRowClick = (document)=>()=>{
|
|
31
|
+
trackUsage('willEditEntryFromHome');
|
|
32
|
+
const link = getEditViewLink(document);
|
|
33
|
+
navigate(link);
|
|
34
|
+
};
|
|
35
|
+
return /*#__PURE__*/ jsx(Table, {
|
|
36
|
+
colCount: 6,
|
|
37
|
+
rowCount: documents?.length ?? 0,
|
|
38
|
+
children: /*#__PURE__*/ jsx(Tbody, {
|
|
39
|
+
children: documents?.map((document)=>/*#__PURE__*/ jsxs(Tr, {
|
|
40
|
+
onClick: handleRowClick(document),
|
|
41
|
+
cursor: "pointer",
|
|
42
|
+
children: [
|
|
43
|
+
/*#__PURE__*/ jsx(Td, {
|
|
44
|
+
children: /*#__PURE__*/ jsx(CellTypography, {
|
|
45
|
+
title: document.title,
|
|
46
|
+
variant: "omega",
|
|
47
|
+
textColor: "neutral800",
|
|
48
|
+
children: document.title
|
|
49
|
+
})
|
|
50
|
+
}),
|
|
51
|
+
/*#__PURE__*/ jsx(Td, {
|
|
52
|
+
children: /*#__PURE__*/ jsx(CellTypography, {
|
|
53
|
+
variant: "omega",
|
|
54
|
+
textColor: "neutral600",
|
|
55
|
+
children: document.kind === 'singleType' ? formatMessage({
|
|
56
|
+
id: 'content-manager.widget.last-edited.single-type',
|
|
57
|
+
defaultMessage: 'Single-Type'
|
|
58
|
+
}) : formatMessage({
|
|
59
|
+
id: document.contentTypeDisplayName,
|
|
60
|
+
defaultMessage: document.contentTypeDisplayName
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
}),
|
|
64
|
+
/*#__PURE__*/ jsx(Td, {
|
|
65
|
+
children: /*#__PURE__*/ jsx(Box, {
|
|
66
|
+
display: "inline-block",
|
|
67
|
+
children: document.status ? /*#__PURE__*/ jsx(DocumentStatus, {
|
|
68
|
+
status: document.status
|
|
69
|
+
}) : /*#__PURE__*/ jsx(Typography, {
|
|
70
|
+
textColor: "neutral600",
|
|
71
|
+
"aria-hidden": true,
|
|
72
|
+
children: "-"
|
|
73
|
+
})
|
|
74
|
+
})
|
|
75
|
+
}),
|
|
76
|
+
/*#__PURE__*/ jsx(Td, {
|
|
77
|
+
children: /*#__PURE__*/ jsx(Typography, {
|
|
78
|
+
textColor: "neutral600",
|
|
79
|
+
children: /*#__PURE__*/ jsx(RelativeTime, {
|
|
80
|
+
timestamp: new Date(document.updatedAt)
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
}),
|
|
84
|
+
/*#__PURE__*/ jsx(Td, {
|
|
85
|
+
children: /*#__PURE__*/ jsx(StageColumn, {
|
|
86
|
+
strapi_stage: document.strapi_stage
|
|
87
|
+
})
|
|
88
|
+
}),
|
|
89
|
+
/*#__PURE__*/ jsx(Td, {
|
|
90
|
+
onClick: (e)=>e.stopPropagation(),
|
|
91
|
+
children: /*#__PURE__*/ jsx(Box, {
|
|
92
|
+
display: "inline-block",
|
|
93
|
+
children: /*#__PURE__*/ jsx(IconButton, {
|
|
94
|
+
tag: Link,
|
|
95
|
+
to: getEditViewLink(document),
|
|
96
|
+
onClick: ()=>trackUsage('willEditEntryFromHome'),
|
|
97
|
+
label: formatMessage({
|
|
98
|
+
id: 'content-manager.actions.edit.label',
|
|
99
|
+
defaultMessage: 'Edit'
|
|
100
|
+
}),
|
|
101
|
+
variant: "ghost",
|
|
102
|
+
children: /*#__PURE__*/ jsx(Pencil, {})
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
}, document.documentId))
|
|
108
|
+
})
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
/* -------------------------------------------------------------------------------------------------
|
|
112
|
+
* AssignedWidget
|
|
113
|
+
* -----------------------------------------------------------------------------------------------*/ const AssignedWidget = ()=>{
|
|
114
|
+
const { formatMessage } = useIntl();
|
|
115
|
+
const { data, isLoading, error } = useGetRecentlyAssignedDocumentsQuery();
|
|
116
|
+
if (isLoading) {
|
|
117
|
+
return /*#__PURE__*/ jsx(Widget.Loading, {});
|
|
118
|
+
}
|
|
119
|
+
if (error || !data) {
|
|
120
|
+
return /*#__PURE__*/ jsx(Widget.Error, {});
|
|
121
|
+
}
|
|
122
|
+
if (data.length === 0) {
|
|
123
|
+
return /*#__PURE__*/ jsx(Widget.NoData, {
|
|
124
|
+
children: formatMessage({
|
|
125
|
+
id: 'review-workflows.widget.assigned.no-data',
|
|
126
|
+
defaultMessage: 'No entries'
|
|
127
|
+
})
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
return /*#__PURE__*/ jsx(RecentDocumentsTable, {
|
|
131
|
+
documents: data
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export { AssignedWidget };
|
|
136
|
+
//# sourceMappingURL=Widgets.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Widgets.mjs","sources":["../../../admin/src/components/Widgets.tsx"],"sourcesContent":["import { Widget, useTracking } from '@strapi/admin/strapi-admin';\nimport { DocumentStatus, RelativeTime } from '@strapi/content-manager/strapi-admin';\nimport { Box, IconButton, Table, Tbody, Td, Tr, Typography } from '@strapi/design-system';\nimport { Pencil } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { Link, useNavigate } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { StageColumn } from '../routes/content-manager/model/components/TableColumns';\nimport { useGetRecentlyAssignedDocumentsQuery } from '../services/content-manager';\n\nimport type { RecentDocument } from '../../../shared/contracts/homepage';\n\nconst CellTypography = styled(Typography).attrs({ maxWidth: '14.4rem', display: 'block' })`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nconst RecentDocumentsTable = ({ documents }: { documents: RecentDocument[] }) => {\n const { formatMessage } = useIntl();\n const { trackUsage } = useTracking();\n const navigate = useNavigate();\n\n const getEditViewLink = (document: RecentDocument): string => {\n const isSingleType = document.kind === 'singleType';\n const kindPath = isSingleType ? 'single-types' : 'collection-types';\n const queryParams = document.locale ? `?plugins[i18n][locale]=${document.locale}` : '';\n\n return `/content-manager/${kindPath}/${document.contentTypeUid}${isSingleType ? '' : '/' + document.documentId}${queryParams}`;\n };\n\n const handleRowClick = (document: RecentDocument) => () => {\n trackUsage('willEditEntryFromHome');\n const link = getEditViewLink(document);\n navigate(link);\n };\n\n return (\n <Table colCount={6} rowCount={documents?.length ?? 0}>\n <Tbody>\n {documents?.map((document) => (\n <Tr onClick={handleRowClick(document)} cursor=\"pointer\" key={document.documentId}>\n <Td>\n <CellTypography title={document.title} variant=\"omega\" textColor=\"neutral800\">\n {document.title}\n </CellTypography>\n </Td>\n <Td>\n <CellTypography variant=\"omega\" textColor=\"neutral600\">\n {document.kind === 'singleType'\n ? formatMessage({\n id: 'content-manager.widget.last-edited.single-type',\n defaultMessage: 'Single-Type',\n })\n : formatMessage({\n id: document.contentTypeDisplayName,\n defaultMessage: document.contentTypeDisplayName,\n })}\n </CellTypography>\n </Td>\n <Td>\n <Box display=\"inline-block\">\n {document.status ? (\n <DocumentStatus status={document.status} />\n ) : (\n <Typography textColor=\"neutral600\" aria-hidden>\n -\n </Typography>\n )}\n </Box>\n </Td>\n <Td>\n <Typography textColor=\"neutral600\">\n <RelativeTime timestamp={new Date(document.updatedAt)} />\n </Typography>\n </Td>\n <Td>\n <StageColumn strapi_stage={document.strapi_stage} />\n </Td>\n <Td onClick={(e) => e.stopPropagation()}>\n <Box display=\"inline-block\">\n <IconButton\n tag={Link}\n to={getEditViewLink(document)}\n onClick={() => trackUsage('willEditEntryFromHome')}\n label={formatMessage({\n id: 'content-manager.actions.edit.label',\n defaultMessage: 'Edit',\n })}\n variant=\"ghost\"\n >\n <Pencil />\n </IconButton>\n </Box>\n </Td>\n </Tr>\n ))}\n </Tbody>\n </Table>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * AssignedWidget\n * -----------------------------------------------------------------------------------------------*/\n\nconst AssignedWidget = () => {\n const { formatMessage } = useIntl();\n const { data, isLoading, error } = useGetRecentlyAssignedDocumentsQuery();\n\n if (isLoading) {\n return <Widget.Loading />;\n }\n\n if (error || !data) {\n return <Widget.Error />;\n }\n\n if (data.length === 0) {\n return (\n <Widget.NoData>\n {formatMessage({\n id: 'review-workflows.widget.assigned.no-data',\n defaultMessage: 'No entries',\n })}\n </Widget.NoData>\n );\n }\n\n return <RecentDocumentsTable documents={data} />;\n};\n\nexport { AssignedWidget };\n"],"names":["CellTypography","styled","Typography","attrs","maxWidth","display","RecentDocumentsTable","documents","formatMessage","useIntl","trackUsage","useTracking","navigate","useNavigate","getEditViewLink","document","isSingleType","kind","kindPath","queryParams","locale","contentTypeUid","documentId","handleRowClick","link","_jsx","Table","colCount","rowCount","length","Tbody","map","_jsxs","Tr","onClick","cursor","Td","title","variant","textColor","id","defaultMessage","contentTypeDisplayName","Box","status","DocumentStatus","aria-hidden","RelativeTime","timestamp","Date","updatedAt","StageColumn","strapi_stage","e","stopPropagation","IconButton","tag","Link","to","label","Pencil","AssignedWidget","data","isLoading","error","useGetRecentlyAssignedDocumentsQuery","Widget","Loading","Error","NoData"],"mappings":";;;;;;;;;;;AAaA,MAAMA,cAAiBC,GAAAA,MAAAA,CAAOC,UAAYC,CAAAA,CAAAA,KAAK,CAAC;IAAEC,QAAU,EAAA,SAAA;IAAWC,OAAS,EAAA;AAAQ,CAAA,CAAE;;;;AAI1F,CAAC;AAED,MAAMC,oBAAuB,GAAA,CAAC,EAAEC,SAAS,EAAmC,GAAA;IAC1E,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;IAC1B,MAAM,EAAEC,UAAU,EAAE,GAAGC,WAAAA,EAAAA;AACvB,IAAA,MAAMC,QAAWC,GAAAA,WAAAA,EAAAA;AAEjB,IAAA,MAAMC,kBAAkB,CAACC,QAAAA,GAAAA;QACvB,MAAMC,YAAAA,GAAeD,QAASE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
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var icons = require('@strapi/icons');
|
|
3
4
|
var constants = require('./constants.js');
|
|
4
5
|
var Header = require('./routes/content-manager/model/id/components/Header.js');
|
|
5
6
|
var Panel = require('./routes/content-manager/model/id/components/Panel.js');
|
|
@@ -8,7 +9,7 @@ var translations = require('./utils/translations.js');
|
|
|
8
9
|
|
|
9
10
|
function _interopNamespaceDefaultOnly (e) { return Object.freeze({ __proto__: null, default: e }); }
|
|
10
11
|
|
|
11
|
-
function
|
|
12
|
+
function __variableDynamicImportRuntime3__(path) {
|
|
12
13
|
switch (path) {
|
|
13
14
|
case './translations/en.json': return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./translations/en.json.js')); });
|
|
14
15
|
case './translations/uk.json': return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./translations/uk.json.js')); });
|
|
@@ -44,6 +45,26 @@ const admin = {
|
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
47
|
});
|
|
48
|
+
app.widgets.register([
|
|
49
|
+
{
|
|
50
|
+
icon: icons.SealCheck,
|
|
51
|
+
title: {
|
|
52
|
+
id: `${constants.PLUGIN_ID}.widget.assigned.title`,
|
|
53
|
+
defaultMessage: 'Assigned to me'
|
|
54
|
+
},
|
|
55
|
+
component: async ()=>{
|
|
56
|
+
const { AssignedWidget } = await Promise.resolve().then(function () { return require('./components/Widgets.js'); });
|
|
57
|
+
return AssignedWidget;
|
|
58
|
+
},
|
|
59
|
+
pluginId: constants.PLUGIN_ID,
|
|
60
|
+
id: 'assigned',
|
|
61
|
+
permissions: [
|
|
62
|
+
{
|
|
63
|
+
action: 'plugin::content-manager.explorer.read'
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
]);
|
|
47
68
|
} else if (!window.strapi.features.isEnabled(constants.FEATURE_ID) && window.strapi?.flags?.promoteEE) {
|
|
48
69
|
app.addSettingsLink('global', {
|
|
49
70
|
id: constants.PLUGIN_ID,
|
|
@@ -73,7 +94,7 @@ const admin = {
|
|
|
73
94
|
},
|
|
74
95
|
async registerTrads ({ locales }) {
|
|
75
96
|
const importedTrads = await Promise.all(locales.map((locale)=>{
|
|
76
|
-
return
|
|
97
|
+
return __variableDynamicImportRuntime3__(`./translations/${locale}.json`).then(({ default: data })=>{
|
|
77
98
|
return {
|
|
78
99
|
data: translations.prefixPluginTranslations(data, constants.PLUGIN_ID),
|
|
79
100
|
locale
|
package/dist/admin/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../admin/src/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../admin/src/index.ts"],"sourcesContent":["import { SealCheck } from '@strapi/icons';\n\nimport { PLUGIN_ID, FEATURE_ID } from './constants';\nimport { Header } from './routes/content-manager/model/id/components/Header';\nimport { Panel } from './routes/content-manager/model/id/components/Panel';\nimport { addColumnToTableHook } from './utils/cm-hooks';\nimport { prefixPluginTranslations } from './utils/translations';\n\nimport type { StrapiApp } from '@strapi/admin/strapi-admin';\nimport type { Plugin } from '@strapi/types';\n\nconst admin: Plugin.Config.AdminInput = {\n register(app: StrapiApp) {\n if (window.strapi.features.isEnabled(FEATURE_ID)) {\n app.registerHook('Admin/CM/pages/ListView/inject-column-in-table', addColumnToTableHook);\n\n const contentManagerPluginApis = app.getPlugin('content-manager').apis;\n\n if (\n 'addEditViewSidePanel' in contentManagerPluginApis &&\n typeof contentManagerPluginApis.addEditViewSidePanel === 'function'\n ) {\n contentManagerPluginApis.addEditViewSidePanel([Panel]);\n }\n\n app.addSettingsLink('global', {\n id: PLUGIN_ID,\n to: `review-workflows`,\n intlLabel: {\n id: `${PLUGIN_ID}.plugin.name`,\n defaultMessage: 'Review Workflows',\n },\n permissions: [],\n async Component() {\n const { Router } = await import('./router');\n return { default: Router };\n },\n });\n\n app.widgets.register([\n {\n icon: SealCheck,\n title: {\n id: `${PLUGIN_ID}.widget.assigned.title`,\n defaultMessage: 'Assigned to me',\n },\n component: async () => {\n const { AssignedWidget } = await import('./components/Widgets');\n return AssignedWidget;\n },\n pluginId: PLUGIN_ID,\n id: 'assigned',\n permissions: [{ action: 'plugin::content-manager.explorer.read' }],\n },\n ]);\n } else if (!window.strapi.features.isEnabled(FEATURE_ID) && window.strapi?.flags?.promoteEE) {\n app.addSettingsLink('global', {\n id: PLUGIN_ID,\n to: `purchase-review-workflows`,\n intlLabel: {\n id: `${PLUGIN_ID}.plugin.name`,\n defaultMessage: 'Review Workflows',\n },\n licenseOnly: true,\n permissions: [],\n async Component() {\n const { PurchaseReviewWorkflows } = await import('./routes/purchase-review-workflows');\n return { default: PurchaseReviewWorkflows };\n },\n });\n }\n },\n bootstrap(app: StrapiApp) {\n if (window.strapi.features.isEnabled(FEATURE_ID)) {\n app.getPlugin('content-manager').injectComponent('preview', 'actions', {\n name: 'review-workflows-assignee',\n Component: Header,\n });\n }\n },\n async registerTrads({ locales }: { locales: string[] }) {\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, PLUGIN_ID),\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\n// eslint-disable-next-line import/no-default-export\nexport default admin;\n"],"names":["admin","register","app","window","strapi","features","isEnabled","FEATURE_ID","registerHook","addColumnToTableHook","contentManagerPluginApis","getPlugin","apis","addEditViewSidePanel","Panel","addSettingsLink","id","PLUGIN_ID","to","intlLabel","defaultMessage","permissions","Component","Router","default","widgets","icon","SealCheck","title","component","AssignedWidget","pluginId","action","flags","promoteEE","licenseOnly","PurchaseReviewWorkflows","bootstrap","injectComponent","name","Header","registerTrads","locales","importedTrads","Promise","all","map","locale","then","data","prefixPluginTranslations","catch","resolve"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAWA,MA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gB,MAAMC,OAAQC,CAAAA,GAAG,CACrCH,OAAQI,CAAAA,GAAG,CAAC,CAACC,MAAAA,GAAAA;AACX,YAAA,OAAO,iCAAM,CAAC,CAAC,eAAe,EAAEA,MAAO,CAAA,KAAK,CAAC,CAAA,CAC1CC,IAAI,CAAC,CAAC,EAAExB,OAAAA,EAASyB,IAAI,EAAE,GAAA;gBACtB,OAAO;AACLA,oBAAAA,IAAAA,EAAMC,sCAAyBD,IAAMhC,EAAAA,mBAAAA,CAAAA;AACrC8B,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA,CACCI,KAAK,CAAC,IAAA;gBACL,OAAO;AACLF,oBAAAA,IAAAA,EAAM,EAAC;AACPF,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA;AACJ,SAAA,CAAA,CAAA;QAGF,OAAOH,OAAAA,CAAQQ,OAAO,CAACT,aAAAA,CAAAA;AACzB;AACF;;;;"}
|
package/dist/admin/index.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { SealCheck } from '@strapi/icons';
|
|
1
2
|
import { FEATURE_ID, PLUGIN_ID } from './constants.mjs';
|
|
2
3
|
import { Header } from './routes/content-manager/model/id/components/Header.mjs';
|
|
3
4
|
import { Panel } from './routes/content-manager/model/id/components/Panel.mjs';
|
|
4
5
|
import { addColumnToTableHook } from './utils/cm-hooks.mjs';
|
|
5
6
|
import { prefixPluginTranslations } from './utils/translations.mjs';
|
|
6
7
|
|
|
7
|
-
function
|
|
8
|
+
function __variableDynamicImportRuntime3__(path) {
|
|
8
9
|
switch (path) {
|
|
9
10
|
case './translations/en.json': return import('./translations/en.json.mjs');
|
|
10
11
|
case './translations/uk.json': return import('./translations/uk.json.mjs');
|
|
@@ -40,6 +41,26 @@ const admin = {
|
|
|
40
41
|
};
|
|
41
42
|
}
|
|
42
43
|
});
|
|
44
|
+
app.widgets.register([
|
|
45
|
+
{
|
|
46
|
+
icon: SealCheck,
|
|
47
|
+
title: {
|
|
48
|
+
id: `${PLUGIN_ID}.widget.assigned.title`,
|
|
49
|
+
defaultMessage: 'Assigned to me'
|
|
50
|
+
},
|
|
51
|
+
component: async ()=>{
|
|
52
|
+
const { AssignedWidget } = await import('./components/Widgets.mjs');
|
|
53
|
+
return AssignedWidget;
|
|
54
|
+
},
|
|
55
|
+
pluginId: PLUGIN_ID,
|
|
56
|
+
id: 'assigned',
|
|
57
|
+
permissions: [
|
|
58
|
+
{
|
|
59
|
+
action: 'plugin::content-manager.explorer.read'
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
]);
|
|
43
64
|
} else if (!window.strapi.features.isEnabled(FEATURE_ID) && window.strapi?.flags?.promoteEE) {
|
|
44
65
|
app.addSettingsLink('global', {
|
|
45
66
|
id: PLUGIN_ID,
|
|
@@ -69,7 +90,7 @@ const admin = {
|
|
|
69
90
|
},
|
|
70
91
|
async registerTrads ({ locales }) {
|
|
71
92
|
const importedTrads = await Promise.all(locales.map((locale)=>{
|
|
72
|
-
return
|
|
93
|
+
return __variableDynamicImportRuntime3__(`./translations/${locale}.json`).then(({ default: data })=>{
|
|
73
94
|
return {
|
|
74
95
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
|
75
96
|
locale
|
package/dist/admin/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../admin/src/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../admin/src/index.ts"],"sourcesContent":["import { SealCheck } from '@strapi/icons';\n\nimport { PLUGIN_ID, FEATURE_ID } from './constants';\nimport { Header } from './routes/content-manager/model/id/components/Header';\nimport { Panel } from './routes/content-manager/model/id/components/Panel';\nimport { addColumnToTableHook } from './utils/cm-hooks';\nimport { prefixPluginTranslations } from './utils/translations';\n\nimport type { StrapiApp } from '@strapi/admin/strapi-admin';\nimport type { Plugin } from '@strapi/types';\n\nconst admin: Plugin.Config.AdminInput = {\n register(app: StrapiApp) {\n if (window.strapi.features.isEnabled(FEATURE_ID)) {\n app.registerHook('Admin/CM/pages/ListView/inject-column-in-table', addColumnToTableHook);\n\n const contentManagerPluginApis = app.getPlugin('content-manager').apis;\n\n if (\n 'addEditViewSidePanel' in contentManagerPluginApis &&\n typeof contentManagerPluginApis.addEditViewSidePanel === 'function'\n ) {\n contentManagerPluginApis.addEditViewSidePanel([Panel]);\n }\n\n app.addSettingsLink('global', {\n id: PLUGIN_ID,\n to: `review-workflows`,\n intlLabel: {\n id: `${PLUGIN_ID}.plugin.name`,\n defaultMessage: 'Review Workflows',\n },\n permissions: [],\n async Component() {\n const { Router } = await import('./router');\n return { default: Router };\n },\n });\n\n app.widgets.register([\n {\n icon: SealCheck,\n title: {\n id: `${PLUGIN_ID}.widget.assigned.title`,\n defaultMessage: 'Assigned to me',\n },\n component: async () => {\n const { AssignedWidget } = await import('./components/Widgets');\n return AssignedWidget;\n },\n pluginId: PLUGIN_ID,\n id: 'assigned',\n permissions: [{ action: 'plugin::content-manager.explorer.read' }],\n },\n ]);\n } else if (!window.strapi.features.isEnabled(FEATURE_ID) && window.strapi?.flags?.promoteEE) {\n app.addSettingsLink('global', {\n id: PLUGIN_ID,\n to: `purchase-review-workflows`,\n intlLabel: {\n id: `${PLUGIN_ID}.plugin.name`,\n defaultMessage: 'Review Workflows',\n },\n licenseOnly: true,\n permissions: [],\n async Component() {\n const { PurchaseReviewWorkflows } = await import('./routes/purchase-review-workflows');\n return { default: PurchaseReviewWorkflows };\n },\n });\n }\n },\n bootstrap(app: StrapiApp) {\n if (window.strapi.features.isEnabled(FEATURE_ID)) {\n app.getPlugin('content-manager').injectComponent('preview', 'actions', {\n name: 'review-workflows-assignee',\n Component: Header,\n });\n }\n },\n async registerTrads({ locales }: { locales: string[] }) {\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, PLUGIN_ID),\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\n// eslint-disable-next-line import/no-default-export\nexport default admin;\n"],"names":["admin","register","app","window","strapi","features","isEnabled","FEATURE_ID","registerHook","addColumnToTableHook","contentManagerPluginApis","getPlugin","apis","addEditViewSidePanel","Panel","addSettingsLink","id","PLUGIN_ID","to","intlLabel","defaultMessage","permissions","Component","Router","default","widgets","icon","SealCheck","title","component","AssignedWidget","pluginId","action","flags","promoteEE","licenseOnly","PurchaseReviewWorkflows","bootstrap","injectComponent","name","Header","registerTrads","locales","importedTrads","Promise","all","map","locale","then","data","prefixPluginTranslations","catch","resolve"],"mappings":";;;;;;;;;;;;;;;;;;AAWA,MAAMA,KAAkC,GAAA;AACtCC,IAAAA,QAAAA,CAAAA,CAASC,GAAc,EAAA;AACrB,QAAA,IAAIC,OAAOC,MAAM,CAACC,QAAQ,CAACC,SAAS,CAACC,UAAa,CAAA,EAAA;YAChDL,GAAIM,CAAAA,YAAY,CAAC,gDAAkDC,EAAAA,oBAAAA,CAAAA;AAEnE,YAAA,MAAMC,wBAA2BR,GAAAA,GAAAA,CAAIS,SAAS,CAAC,mBAAmBC,IAAI;AAEtE,YAAA,IACE,0BAA0BF,wBAC1B,IAAA,OAAOA,wBAAyBG,CAAAA,oBAAoB,KAAK,UACzD,EAAA;AACAH,gBAAAA,wBAAAA,CAAyBG,oBAAoB,CAAC;AAACC,oBAAAA;AAAM,iBAAA,CAAA;AACvD;YAEAZ,GAAIa,CAAAA,eAAe,CAAC,QAAU,EAAA;gBAC5BC,EAAIC,EAAAA,SAAAA;gBACJC,EAAI,EAAA,CAAC,gBAAgB,CAAC;gBACtBC,SAAW,EAAA;AACTH,oBAAAA,EAAAA,EAAI,CAAC,EAAEC,SAAU,CAAA,YAAY,CAAC;oBAC9BG,cAAgB,EAAA;AAClB,iBAAA;AACAC,gBAAAA,WAAAA,EAAa,EAAE;gBACf,MAAMC,SAAAA,CAAAA,GAAAA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B,qBAAA;AAC5C;AACF,aAAA,CAAA;AACF;AACF,KAAA;AACAC,IAAAA,SAAAA,CAAAA,CAAUnC,GAAc,EAAA;AACtB,QAAA,IAAIC,OAAOC,MAAM,CAACC,QAAQ,CAACC,SAAS,CAACC,UAAa,CAAA,EAAA;AAChDL,YAAAA,GAAAA,CAAIS,SAAS,CAAC,iBAAA,CAAA,CAAmB2B,eAAe,CAAC,WAAW,SAAW,EAAA;gBACrEC,IAAM,EAAA,2BAAA;gBACNjB,SAAWkB,EAAAA;AACb,aAAA,CAAA;AACF;AACF,KAAA;IACA,MAAMC,aAAAA,CAAAA,CAAc,EAAEC,OAAO,EAAyB,EAAA;QACpD,MAAMC,aAAAA,GAAgB,MAAMC,OAAQC,CAAAA,GAAG,CACrCH,OAAQI,CAAAA,GAAG,CAAC,CAACC,MAAAA,GAAAA;AACX,YAAA,OAAO,iCAAM,CAAC,CAAC,eAAe,EAAEA,MAAO,CAAA,KAAK,CAAC,CAAA,CAC1CC,IAAI,CAAC,CAAC,EAAExB,OAAAA,EAASyB,IAAI,EAAE,GAAA;gBACtB,OAAO;AACLA,oBAAAA,IAAAA,EAAMC,yBAAyBD,IAAMhC,EAAAA,SAAAA,CAAAA;AACrC8B,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA,CACCI,KAAK,CAAC,IAAA;gBACL,OAAO;AACLF,oBAAAA,IAAAA,EAAM,EAAC;AACPF,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA;AACJ,SAAA,CAAA,CAAA;QAGF,OAAOH,OAAAA,CAAQQ,OAAO,CAACT,aAAAA,CAAAA;AACzB;AACF;;;;"}
|
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
var api = require('./api.js');
|
|
4
4
|
|
|
5
5
|
const SINGLE_TYPES = 'single-types';
|
|
6
|
-
const contentManagerApi = api.reviewWorkflowsApi.
|
|
6
|
+
const contentManagerApi = api.reviewWorkflowsApi.enhanceEndpoints({
|
|
7
|
+
addTagTypes: [
|
|
8
|
+
'RecentlyAssignedList',
|
|
9
|
+
'RecentDocumentList'
|
|
10
|
+
]
|
|
11
|
+
}).injectEndpoints({
|
|
7
12
|
endpoints: (builder)=>({
|
|
8
13
|
getStages: builder.query({
|
|
9
14
|
query: ({ model, slug, id, params })=>({
|
|
@@ -68,7 +73,8 @@ const contentManagerApi = api.reviewWorkflowsApi.injectEndpoints({
|
|
|
68
73
|
{
|
|
69
74
|
type: 'Document',
|
|
70
75
|
id: `${model}_LIST`
|
|
71
|
-
}
|
|
76
|
+
},
|
|
77
|
+
'RecentlyAssignedList'
|
|
72
78
|
];
|
|
73
79
|
}
|
|
74
80
|
}),
|
|
@@ -88,13 +94,22 @@ const contentManagerApi = api.reviewWorkflowsApi.injectEndpoints({
|
|
|
88
94
|
singleType: []
|
|
89
95
|
});
|
|
90
96
|
}
|
|
97
|
+
}),
|
|
98
|
+
getRecentlyAssignedDocuments: builder.query({
|
|
99
|
+
query: ()=>'/review-workflows/homepage/recently-assigned-documents',
|
|
100
|
+
transformResponse: (response)=>response.data,
|
|
101
|
+
providesTags: (_, _err)=>[
|
|
102
|
+
'RecentlyAssignedList',
|
|
103
|
+
'RecentDocumentList'
|
|
104
|
+
]
|
|
91
105
|
})
|
|
92
106
|
}),
|
|
93
107
|
overrideExisting: true
|
|
94
108
|
});
|
|
95
|
-
const { useGetStagesQuery, useUpdateStageMutation, useUpdateAssigneeMutation, useGetContentTypesQuery } = contentManagerApi;
|
|
109
|
+
const { useGetStagesQuery, useUpdateStageMutation, useUpdateAssigneeMutation, useGetContentTypesQuery, useGetRecentlyAssignedDocumentsQuery } = contentManagerApi;
|
|
96
110
|
|
|
97
111
|
exports.useGetContentTypesQuery = useGetContentTypesQuery;
|
|
112
|
+
exports.useGetRecentlyAssignedDocumentsQuery = useGetRecentlyAssignedDocumentsQuery;
|
|
98
113
|
exports.useGetStagesQuery = useGetStagesQuery;
|
|
99
114
|
exports.useUpdateAssigneeMutation = useUpdateAssigneeMutation;
|
|
100
115
|
exports.useUpdateStageMutation = useUpdateStageMutation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-manager.js","sources":["../../../admin/src/services/content-manager.ts"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport { reviewWorkflowsApi } from './api';\n\nimport type {\n GetStages,\n UpdateStage,\n UpdateAssignee,\n} from '../../../shared/contracts/review-workflows';\nimport type { Contracts } from '@strapi/content-manager/_internal/shared';\n\ntype ContentType = Contracts.ContentTypes.ContentType;\ninterface ContentTypes {\n collectionType: ContentType[];\n singleType: ContentType[];\n}\n\nconst SINGLE_TYPES = 'single-types';\n\nconst contentManagerApi = reviewWorkflowsApi.injectEndpoints({\n
|
|
1
|
+
{"version":3,"file":"content-manager.js","sources":["../../../admin/src/services/content-manager.ts"],"sourcesContent":["import * as Homepage from '../../../shared/contracts/homepage';\n\n/* eslint-disable check-file/filename-naming-convention */\nimport { reviewWorkflowsApi } from './api';\n\nimport type {\n GetStages,\n UpdateStage,\n UpdateAssignee,\n} from '../../../shared/contracts/review-workflows';\nimport type { Contracts } from '@strapi/content-manager/_internal/shared';\n\ntype ContentType = Contracts.ContentTypes.ContentType;\ninterface ContentTypes {\n collectionType: ContentType[];\n singleType: ContentType[];\n}\n\nconst SINGLE_TYPES = 'single-types';\n\nconst contentManagerApi = reviewWorkflowsApi\n .enhanceEndpoints({\n addTagTypes: ['RecentlyAssignedList', 'RecentDocumentList'],\n })\n .injectEndpoints({\n endpoints: (builder) => ({\n getStages: builder.query<\n {\n stages: NonNullable<GetStages.Response['data']>;\n meta: NonNullable<GetStages.Response['meta']>;\n },\n GetStages.Params & { slug: string; params?: object }\n >({\n query: ({ model, slug, id, params }) => ({\n url: `/review-workflows/content-manager/${slug}/${model}/${id}/stages`,\n method: 'GET',\n config: {\n params,\n },\n }),\n transformResponse: (res: GetStages.Response) => {\n return {\n meta: res.meta ?? { workflowCount: 0 },\n stages: res.data ?? [],\n };\n },\n providesTags: ['ReviewWorkflowStages'],\n }),\n updateStage: builder.mutation<\n UpdateStage.Response['data'],\n UpdateStage.Request['body'] & UpdateStage.Params & { slug: string; params?: object }\n >({\n query: ({ model, slug, id, params, ...data }) => ({\n url: `/review-workflows/content-manager/${slug}/${model}/${id}/stage`,\n method: 'PUT',\n data,\n config: {\n params,\n },\n }),\n transformResponse: (res: UpdateStage.Response) => res.data,\n invalidatesTags: (_result, _error, { slug, id, model }) => {\n return [\n {\n type: 'Document',\n id: slug !== SINGLE_TYPES ? `${model}_${id}` : model,\n },\n { type: 'Document', id: `${model}_LIST` },\n 'ReviewWorkflowStages',\n ];\n },\n }),\n updateAssignee: builder.mutation<\n UpdateAssignee.Response['data'],\n UpdateAssignee.Request['body'] & UpdateAssignee.Params & { slug: string; params?: object }\n >({\n query: ({ model, slug, id, params, ...data }) => ({\n url: `/review-workflows/content-manager/${slug}/${model}/${id}/assignee`,\n method: 'PUT',\n data,\n config: {\n params,\n },\n }),\n transformResponse: (res: UpdateAssignee.Response) => res.data,\n invalidatesTags: (_result, _error, { slug, id, model }) => {\n return [\n {\n type: 'Document',\n id: slug !== SINGLE_TYPES ? `${model}_${id}` : model,\n },\n { type: 'Document', id: `${model}_LIST` },\n 'RecentlyAssignedList',\n ];\n },\n }),\n getContentTypes: builder.query<ContentTypes, void>({\n query: () => ({\n url: `/content-manager/content-types`,\n method: 'GET',\n }),\n transformResponse: (res: { data: Contracts.ContentTypes.ContentType[] }) => {\n return res.data.reduce<ContentTypes>(\n (acc, curr) => {\n if (curr.isDisplayed) {\n acc[curr.kind].push(curr);\n }\n return acc;\n },\n {\n collectionType: [],\n singleType: [],\n }\n );\n },\n }),\n getRecentlyAssignedDocuments: builder.query<\n Homepage.GetRecentlyAssignedDocuments.Response['data'],\n void\n >({\n query: () => '/review-workflows/homepage/recently-assigned-documents',\n transformResponse: (response: Homepage.GetRecentlyAssignedDocuments.Response) =>\n response.data,\n providesTags: (_, _err) => ['RecentlyAssignedList', 'RecentDocumentList'],\n }),\n }),\n overrideExisting: true,\n });\n\nconst {\n useGetStagesQuery,\n useUpdateStageMutation,\n useUpdateAssigneeMutation,\n useGetContentTypesQuery,\n useGetRecentlyAssignedDocumentsQuery,\n} = contentManagerApi;\n\nexport {\n useGetStagesQuery,\n useUpdateStageMutation,\n useUpdateAssigneeMutation,\n useGetContentTypesQuery,\n useGetRecentlyAssignedDocumentsQuery,\n};\nexport type { ContentTypes, ContentType };\n"],"names":["SINGLE_TYPES","contentManagerApi","reviewWorkflowsApi","enhanceEndpoints","addTagTypes","injectEndpoints","endpoints","builder","getStages","query","model","slug","id","params","url","method","config","transformResponse","res","meta","workflowCount","stages","data","providesTags","updateStage","mutation","invalidatesTags","_result","_error","type","updateAssignee","getContentTypes","reduce","acc","curr","isDisplayed","kind","push","collectionType","singleType","getRecentlyAssignedDocuments","response","_","_err","overrideExisting","useGetStagesQuery","useUpdateStageMutation","useUpdateAssigneeMutation","useGetContentTypesQuery","useGetRecentlyAssignedDocumentsQuery"],"mappings":";;;;AAkBA,MAAMA,YAAe,GAAA,cAAA;AAErB,MAAMC,iBAAAA,GAAoBC,sBACvBC,CAAAA,gBAAgB,CAAC;IAChBC,WAAa,EAAA;AAAC,QAAA,sBAAA;AAAwB,QAAA;AAAqB;AAC7D,CAAA,CAAA,CACCC,eAAe,CAAC;IACfC,SAAW,EAAA,CAACC,WAAa;YACvBC,SAAWD,EAAAA,OAAAA,CAAQE,KAAK,CAMtB;gBACAA,KAAO,EAAA,CAAC,EAAEC,KAAK,EAAEC,IAAI,EAAEC,EAAE,EAAEC,MAAM,EAAE,IAAM;wBACvCC,GAAK,EAAA,CAAC,kCAAkC,EAAEH,IAAK,CAAA,CAAC,EAAED,KAAAA,CAAM,CAAC,EAAEE,EAAG,CAAA,OAAO,CAAC;wBACtEG,MAAQ,EAAA,KAAA;wBACRC,MAAQ,EAAA;AACNH,4BAAAA;AACF;qBACF,CAAA;AACAI,gBAAAA,iBAAAA,EAAmB,CAACC,GAAAA,GAAAA;oBAClB,OAAO;wBACLC,IAA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