@strapi/content-manager 5.12.4 → 5.12.5

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.
@@ -0,0 +1,161 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var strapiAdmin = require('@strapi/admin/strapi-admin');
5
+ var designSystem = require('@strapi/design-system');
6
+ var Icons = require('@strapi/icons');
7
+ var reactIntl = require('react-intl');
8
+ var reactRouterDom = require('react-router-dom');
9
+ var styledComponents = require('styled-components');
10
+ var DocumentStatus = require('../pages/EditView/components/DocumentStatus.js');
11
+ var homepage = require('../services/homepage.js');
12
+ var RelativeTime = require('./RelativeTime.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: 5,
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(DocumentStatus.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(RelativeTime.RelativeTime, {
82
+ timestamp: new Date(document.updatedAt)
83
+ })
84
+ })
85
+ }),
86
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
87
+ onClick: (e)=>e.stopPropagation(),
88
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
89
+ display: "inline-block",
90
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
91
+ tag: reactRouterDom.Link,
92
+ to: getEditViewLink(document),
93
+ onClick: ()=>trackUsage('willEditEntryFromHome'),
94
+ label: formatMessage({
95
+ id: 'content-manager.actions.edit.label',
96
+ defaultMessage: 'Edit'
97
+ }),
98
+ variant: "ghost",
99
+ children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Pencil, {})
100
+ })
101
+ })
102
+ })
103
+ ]
104
+ }, document.documentId))
105
+ })
106
+ });
107
+ };
108
+ /* -------------------------------------------------------------------------------------------------
109
+ * LastEditedWidget
110
+ * -----------------------------------------------------------------------------------------------*/ const LastEditedWidget = ()=>{
111
+ const { formatMessage } = reactIntl.useIntl();
112
+ const { data, isLoading, error } = homepage.useGetRecentDocumentsQuery({
113
+ action: 'update'
114
+ });
115
+ if (isLoading) {
116
+ return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Widget.Loading, {});
117
+ }
118
+ if (error || !data) {
119
+ return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Widget.Error, {});
120
+ }
121
+ if (data.length === 0) {
122
+ return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Widget.NoData, {
123
+ children: formatMessage({
124
+ id: 'content-manager.widget.last-edited.no-data',
125
+ defaultMessage: 'No edited entries'
126
+ })
127
+ });
128
+ }
129
+ return /*#__PURE__*/ jsxRuntime.jsx(RecentDocumentsTable, {
130
+ documents: data
131
+ });
132
+ };
133
+ /* -------------------------------------------------------------------------------------------------
134
+ * LastPublishedWidget
135
+ * -----------------------------------------------------------------------------------------------*/ const LastPublishedWidget = ()=>{
136
+ const { formatMessage } = reactIntl.useIntl();
137
+ const { data, isLoading, error } = homepage.useGetRecentDocumentsQuery({
138
+ action: 'publish'
139
+ });
140
+ if (isLoading) {
141
+ return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Widget.Loading, {});
142
+ }
143
+ if (error || !data) {
144
+ return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Widget.Error, {});
145
+ }
146
+ if (data.length === 0) {
147
+ return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Widget.NoData, {
148
+ children: formatMessage({
149
+ id: 'content-manager.widget.last-published.no-data',
150
+ defaultMessage: 'No published entries'
151
+ })
152
+ });
153
+ }
154
+ return /*#__PURE__*/ jsxRuntime.jsx(RecentDocumentsTable, {
155
+ documents: data
156
+ });
157
+ };
158
+
159
+ exports.LastEditedWidget = LastEditedWidget;
160
+ exports.LastPublishedWidget = LastPublishedWidget;
161
+ //# 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 { 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 { DocumentStatus } from '../pages/EditView/components/DocumentStatus';\nimport { useGetRecentDocumentsQuery } from '../services/homepage';\n\nimport { RelativeTime } from './RelativeTime';\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={5} 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 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 * LastEditedWidget\n * -----------------------------------------------------------------------------------------------*/\n\nconst LastEditedWidget = () => {\n const { formatMessage } = useIntl();\n const { data, isLoading, error } = useGetRecentDocumentsQuery({ action: 'update' });\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: 'content-manager.widget.last-edited.no-data',\n defaultMessage: 'No edited entries',\n })}\n </Widget.NoData>\n );\n }\n\n return <RecentDocumentsTable documents={data} />;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * LastPublishedWidget\n * -----------------------------------------------------------------------------------------------*/\n\nconst LastPublishedWidget = () => {\n const { formatMessage } = useIntl();\n const { data, isLoading, error } = useGetRecentDocumentsQuery({ action: 'publish' });\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: 'content-manager.widget.last-published.no-data',\n defaultMessage: 'No published entries',\n })}\n </Widget.NoData>\n );\n }\n\n return <RecentDocumentsTable documents={data} />;\n};\n\nexport { LastEditedWidget, LastPublishedWidget };\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","e","stopPropagation","IconButton","tag","Link","to","label","Pencil","LastEditedWidget","data","isLoading","error","useGetRecentDocumentsQuery","action","Widget","Loading","Error","NoData","LastPublishedWidget"],"mappings":";;;;;;;;;;;;;AAcA,MAAMA,cAAiBC,GAAAA,uBAAAA,CAAOC,uBAAYC,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,iBAAAA,EAAAA;IAC1B,MAAM,EAAEC,UAAU,EAAE,GAAGC,uBAAAA,EAAAA;AACvB,IAAA,MAAMC,QAAWC,GAAAA,0BAAAA,EAAAA;AAEjB,IAAA,MAAMC,kBAAkB,CAACC,QAAAA,GAAAA;QACvB,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EAAEmD,IAAI,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGC,mCAA2B,CAAA;QAAEC,MAAQ,EAAA;AAAU,KAAA,CAAA;AAElF,IAAA,IAAIH,SAAW,EAAA;QACb,qBAAOpC,cAAA,CAACwC,mBAAOC,OAAO,EAAA,EAAA,CAAA;AACxB;IAEA,IAAIJ,KAAAA,IAAS,CAACF,IAAM,EAAA;QAClB,qBAAOnC,cAAA,CAACwC,mBAAOE,KAAK,EAAA,EAAA,CAAA;AACtB;IAEA,IAAIP,IAAAA,CAAK/B,MAAM,KAAK,CAAG,EAAA;QACrB,qBACEJ,cAAA,CAACwC,mBAAOG,MAAM,EAAA;sBACX5D,aAAc,CAAA;gBACbgC,EAAI,EAAA,+CAAA;gBACJC,cAAgB,EAAA;AAClB,aAAA;;AAGN;AAEA,IAAA,qBAAOhB,cAACnB,CAAAA,oBAAAA,EAAAA;QAAqBC,SAAWqD,EAAAA;;AAC1C;;;;;"}
@@ -0,0 +1,158 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { Widget, useTracking } from '@strapi/admin/strapi-admin';
3
+ import { Typography, Table, Tbody, Tr, Td, Box, IconButton } from '@strapi/design-system';
4
+ import { Pencil } from '@strapi/icons';
5
+ import { useIntl } from 'react-intl';
6
+ import { useNavigate, Link } from 'react-router-dom';
7
+ import { styled } from 'styled-components';
8
+ import { DocumentStatus } from '../pages/EditView/components/DocumentStatus.mjs';
9
+ import { useGetRecentDocumentsQuery } from '../services/homepage.mjs';
10
+ import { RelativeTime } from './RelativeTime.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: 5,
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
+ onClick: (e)=>e.stopPropagation(),
86
+ children: /*#__PURE__*/ jsx(Box, {
87
+ display: "inline-block",
88
+ children: /*#__PURE__*/ jsx(IconButton, {
89
+ tag: Link,
90
+ to: getEditViewLink(document),
91
+ onClick: ()=>trackUsage('willEditEntryFromHome'),
92
+ label: formatMessage({
93
+ id: 'content-manager.actions.edit.label',
94
+ defaultMessage: 'Edit'
95
+ }),
96
+ variant: "ghost",
97
+ children: /*#__PURE__*/ jsx(Pencil, {})
98
+ })
99
+ })
100
+ })
101
+ ]
102
+ }, document.documentId))
103
+ })
104
+ });
105
+ };
106
+ /* -------------------------------------------------------------------------------------------------
107
+ * LastEditedWidget
108
+ * -----------------------------------------------------------------------------------------------*/ const LastEditedWidget = ()=>{
109
+ const { formatMessage } = useIntl();
110
+ const { data, isLoading, error } = useGetRecentDocumentsQuery({
111
+ action: 'update'
112
+ });
113
+ if (isLoading) {
114
+ return /*#__PURE__*/ jsx(Widget.Loading, {});
115
+ }
116
+ if (error || !data) {
117
+ return /*#__PURE__*/ jsx(Widget.Error, {});
118
+ }
119
+ if (data.length === 0) {
120
+ return /*#__PURE__*/ jsx(Widget.NoData, {
121
+ children: formatMessage({
122
+ id: 'content-manager.widget.last-edited.no-data',
123
+ defaultMessage: 'No edited entries'
124
+ })
125
+ });
126
+ }
127
+ return /*#__PURE__*/ jsx(RecentDocumentsTable, {
128
+ documents: data
129
+ });
130
+ };
131
+ /* -------------------------------------------------------------------------------------------------
132
+ * LastPublishedWidget
133
+ * -----------------------------------------------------------------------------------------------*/ const LastPublishedWidget = ()=>{
134
+ const { formatMessage } = useIntl();
135
+ const { data, isLoading, error } = useGetRecentDocumentsQuery({
136
+ action: 'publish'
137
+ });
138
+ if (isLoading) {
139
+ return /*#__PURE__*/ jsx(Widget.Loading, {});
140
+ }
141
+ if (error || !data) {
142
+ return /*#__PURE__*/ jsx(Widget.Error, {});
143
+ }
144
+ if (data.length === 0) {
145
+ return /*#__PURE__*/ jsx(Widget.NoData, {
146
+ children: formatMessage({
147
+ id: 'content-manager.widget.last-published.no-data',
148
+ defaultMessage: 'No published entries'
149
+ })
150
+ });
151
+ }
152
+ return /*#__PURE__*/ jsx(RecentDocumentsTable, {
153
+ documents: data
154
+ });
155
+ };
156
+
157
+ export { LastEditedWidget, LastPublishedWidget };
158
+ //# 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 { 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 { DocumentStatus } from '../pages/EditView/components/DocumentStatus';\nimport { useGetRecentDocumentsQuery } from '../services/homepage';\n\nimport { RelativeTime } from './RelativeTime';\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={5} 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 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 * LastEditedWidget\n * -----------------------------------------------------------------------------------------------*/\n\nconst LastEditedWidget = () => {\n const { formatMessage } = useIntl();\n const { data, isLoading, error } = useGetRecentDocumentsQuery({ action: 'update' });\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: 'content-manager.widget.last-edited.no-data',\n defaultMessage: 'No edited entries',\n })}\n </Widget.NoData>\n );\n }\n\n return <RecentDocumentsTable documents={data} />;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * LastPublishedWidget\n * -----------------------------------------------------------------------------------------------*/\n\nconst LastPublishedWidget = () => {\n const { formatMessage } = useIntl();\n const { data, isLoading, error } = useGetRecentDocumentsQuery({ action: 'publish' });\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: 'content-manager.widget.last-published.no-data',\n defaultMessage: 'No published entries',\n })}\n </Widget.NoData>\n );\n }\n\n return <RecentDocumentsTable documents={data} />;\n};\n\nexport { LastEditedWidget, LastPublishedWidget };\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","e","stopPropagation","IconButton","tag","Link","to","label","Pencil","LastEditedWidget","data","isLoading","error","useGetRecentDocumentsQuery","action","Widget","Loading","Error","NoData","LastPublishedWidget"],"mappings":";;;;;;;;;;;AAcA,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,G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D,IAAI,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGC,0BAA2B,CAAA;QAAEC,MAAQ,EAAA;AAAU,KAAA,CAAA;AAElF,IAAA,IAAIH,SAAW,EAAA;QACb,qBAAOpC,GAAA,CAACwC,OAAOC,OAAO,EAAA,EAAA,CAAA;AACxB;IAEA,IAAIJ,KAAAA,IAAS,CAACF,IAAM,EAAA;QAClB,qBAAOnC,GAAA,CAACwC,OAAOE,KAAK,EAAA,EAAA,CAAA;AACtB;IAEA,IAAIP,IAAAA,CAAK/B,MAAM,KAAK,CAAG,EAAA;QACrB,qBACEJ,GAAA,CAACwC,OAAOG,MAAM,EAAA;sBACX5D,aAAc,CAAA;gBACbgC,EAAI,EAAA,+CAAA;gBACJC,cAAgB,EAAA;AAClB,aAAA;;AAGN;AAEA,IAAA,qBAAOhB,GAACnB,CAAAA,oBAAAA,EAAAA;QAAqBC,SAAWqD,EAAAA;;AAC1C;;;;"}
@@ -20,7 +20,7 @@ var DocumentRBAC = require('./features/DocumentRBAC.js');
20
20
 
21
21
  function _interopNamespaceDefaultOnly (e) { return Object.freeze({ __proto__: null, default: e }); }
22
22
 
23
- function __variableDynamicImportRuntime1__(path) {
23
+ function __variableDynamicImportRuntime3__(path) {
24
24
  switch (path) {
25
25
  case './translations/ar.json': return Promise.resolve().then(function () { return require('./translations/ar.json.js'); });
26
26
  case './translations/ca.json': return Promise.resolve().then(function () { return require('./translations/ca.json.js'); });
@@ -88,6 +88,45 @@ var index = {
88
88
  children: router.routes
89
89
  });
90
90
  app.registerPlugin(cm.config);
91
+ // Register homepage widgets
92
+ app.widgets.register([
93
+ {
94
+ icon: Icons.Pencil,
95
+ title: {
96
+ id: `${plugin.PLUGIN_ID}.widget.last-edited.title`,
97
+ defaultMessage: 'Last edited entries'
98
+ },
99
+ component: async ()=>{
100
+ const { LastEditedWidget } = await Promise.resolve().then(function () { return require('./components/Widgets.js'); });
101
+ return LastEditedWidget;
102
+ },
103
+ pluginId: plugin.PLUGIN_ID,
104
+ id: 'last-edited-entries',
105
+ permissions: [
106
+ {
107
+ action: 'plugin::content-manager.explorer.read'
108
+ }
109
+ ]
110
+ },
111
+ {
112
+ icon: Icons.CheckCircle,
113
+ title: {
114
+ id: `${plugin.PLUGIN_ID}.widget.last-published.title`,
115
+ defaultMessage: 'Last published entries'
116
+ },
117
+ component: async ()=>{
118
+ const { LastPublishedWidget } = await Promise.resolve().then(function () { return require('./components/Widgets.js'); });
119
+ return LastPublishedWidget;
120
+ },
121
+ pluginId: plugin.PLUGIN_ID,
122
+ id: 'last-published-entries',
123
+ permissions: [
124
+ {
125
+ action: 'plugin::content-manager.explorer.read'
126
+ }
127
+ ]
128
+ }
129
+ ]);
91
130
  },
92
131
  bootstrap (app) {
93
132
  if (typeof index$1.historyAdmin.bootstrap === 'function') {
@@ -99,7 +138,7 @@ var index = {
99
138
  },
100
139
  async registerTrads ({ locales }) {
101
140
  const importedTrads = await Promise.all(locales.map((locale)=>{
102
- return __variableDynamicImportRuntime1__(`./translations/${locale}.json`).then(({ default: data })=>{
141
+ return __variableDynamicImportRuntime3__(`./translations/${locale}.json`).then(({ default: data })=>{
103
142
  return {
104
143
  data: translations.prefixPluginTranslations(data, plugin.PLUGIN_ID),
105
144
  locale
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../admin/src/index.ts"],"sourcesContent":["import { Feather } from '@strapi/icons';\n\nimport { PLUGIN_ID } from './constants/plugin';\nimport { ContentManagerPlugin } from './content-manager';\nimport { historyAdmin } from './history';\nimport { reducer } from './modules/reducers';\nimport { previewAdmin } from './preview';\nimport { routes } from './router';\nimport { prefixPluginTranslations } from './utils/translations';\n\n// NOTE: we have to preload it to ensure chunks will have it available as global\nimport 'prismjs';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n register(app: any) {\n const cm = new ContentManagerPlugin();\n\n app.addReducers({\n [PLUGIN_ID]: reducer,\n });\n\n app.addMenuLink({\n to: PLUGIN_ID,\n icon: Feather,\n intlLabel: {\n id: `content-manager.plugin.name`,\n defaultMessage: 'Content Manager',\n },\n permissions: [],\n position: 1,\n });\n\n app.router.addRoute({\n path: 'content-manager/*',\n lazy: async () => {\n const { Layout } = await import('./layout');\n\n return {\n Component: Layout,\n };\n },\n children: routes,\n });\n\n app.registerPlugin(cm.config);\n },\n bootstrap(app: any) {\n if (typeof historyAdmin.bootstrap === 'function') {\n historyAdmin.bootstrap(app);\n }\n if (typeof previewAdmin.bootstrap === 'function') {\n previewAdmin.bootstrap(app);\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\nexport * from './exports';\n"],"names":["register","app","cm","ContentManagerPlugin","addReducers","PLUGIN_ID","reducer","addMenuLink","to","icon","Feather","intlLabel","id","defaultMessage","permissions","position","router","addRoute","path","lazy","Layout","Component","children","routes","registerPlugin","config","bootstrap","historyAdmin","previewAdmin","registerTrads","locales","importedTrads","Promise","all","map","locale","then","default","data","prefixPluginTranslations","catch","resolve"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA;AACA,YAAe;AACbA,IAAAA,QAAAA,CAAAA,CAASC,GAAQ,EAAA;AACf,QAAA,MAAMC,KAAK,IAAIC,mCAAAA,EAAAA;AAEfF,QAAAA,GAAAA,CAAIG,WAAW,CAAC;AACd,YAAA,CAACC,mBAAYC;AACf,SAAA,CAAA;AAEAL,QAAAA,GAAAA,CAAIM,WAAW,CAAC;YACdC,EAAIH,EAAAA,gBAAAA;YACJI,IAAMC,EAAAA,aAAAA;YACNC,SAAW,EAAA;gBACTC,EAAI,EAAA,CAAC,2BAA2B,CAAC;gBACjCC,cAAgB,EAAA;A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A,IAAAA,EAAM,EAAC;AACPH,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA;AACJ,SAAA,CAAA,CAAA;QAGF,OAAOH,OAAAA,CAAQS,OAAO,CAACV,aAAAA,CAAAA;AACzB;AACF,CAAE;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../admin/src/index.ts"],"sourcesContent":["import { CheckCircle, Feather, Pencil } from '@strapi/icons';\n\nimport { PLUGIN_ID } from './constants/plugin';\nimport { ContentManagerPlugin } from './content-manager';\nimport { historyAdmin } from './history';\nimport { reducer } from './modules/reducers';\nimport { previewAdmin } from './preview';\nimport { routes } from './router';\nimport { prefixPluginTranslations } from './utils/translations';\n\n// NOTE: we have to preload it to ensure chunks will have it available as global\nimport 'prismjs';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n register(app: any) {\n const cm = new ContentManagerPlugin();\n\n app.addReducers({\n [PLUGIN_ID]: reducer,\n });\n\n app.addMenuLink({\n to: PLUGIN_ID,\n icon: Feather,\n intlLabel: {\n id: `content-manager.plugin.name`,\n defaultMessage: 'Content Manager',\n },\n permissions: [],\n position: 1,\n });\n\n app.router.addRoute({\n path: 'content-manager/*',\n lazy: async () => {\n const { Layout } = await import('./layout');\n\n return {\n Component: Layout,\n };\n },\n children: routes,\n });\n\n app.registerPlugin(cm.config);\n\n // Register homepage widgets\n app.widgets.register([\n {\n icon: Pencil,\n title: {\n id: `${PLUGIN_ID}.widget.last-edited.title`,\n defaultMessage: 'Last edited entries',\n },\n component: async () => {\n const { LastEditedWidget } = await import('./components/Widgets');\n return LastEditedWidget;\n },\n pluginId: PLUGIN_ID,\n id: 'last-edited-entries',\n permissions: [{ action: 'plugin::content-manager.explorer.read' }],\n },\n {\n icon: CheckCircle,\n title: {\n id: `${PLUGIN_ID}.widget.last-published.title`,\n defaultMessage: 'Last published entries',\n },\n component: async () => {\n const { LastPublishedWidget } = await import('./components/Widgets');\n return LastPublishedWidget;\n },\n pluginId: PLUGIN_ID,\n id: 'last-published-entries',\n permissions: [{ action: 'plugin::content-manager.explorer.read' }],\n },\n ]);\n },\n bootstrap(app: any) {\n if (typeof historyAdmin.bootstrap === 'function') {\n historyAdmin.bootstrap(app);\n }\n if (typeof previewAdmin.bootstrap === 'function') {\n previewAdmin.bootstrap(app);\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\nexport * from './exports';\n"],"names":["register","app","cm","ContentManagerPlugin","addReducers","PLUGIN_ID","reducer","addMenuLink","to","icon","Feather","intlLabel","id","defaultMessage","permissions","position","router","addRoute","path","lazy","Layout","Component","children","routes","registerPlugin","config","widgets","Pencil","title","component","LastEditedWidget","pluginId","action","CheckCircle","LastPublishedWidget","bootstrap","historyAdmin","previewAdmin","registerTrads","locales","importedTrads","Promise","all","map","locale","then","default","data","prefixPluginTranslations","catch","resolve"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA;AACA,YAAe;AACbA,IAAAA,QAAAA,CAAAA,CAASC,GAAQ,EAAA;AACf,QAAA,MAAMC,KAAK,IAAIC,mCAAAA,EAAAA;AAEfF,QAAAA,GAAAA,CAAIG,WAAW,CAAC;AACd,YAAA,CAACC,mBAAYC;AACf,SAAA,CAAA;AAEAL,QAAAA,GAAAA,CAAIM,WAAW,CAAC;YACdC,EAAIH,EAAAA,gBAAAA;YACJI,IAAMC,EAAAA,aAAAA;YACNC,SAAW,EAAA;gBACTC,EAAI,EAAA,CAAC,2BAA2B,CAAC;gBACjCC,cAAgB,EAAA;AAClB,aAAA;AACAC,YAAAA,WAAAA,EAAa,EAAE;YACfC,QAAU,EAAA;AACZ,SAAA,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B,MAAQ,EAAA;AAAwC;AAAE;AACpE;AACD,SAAA,CAAA;AACH,KAAA;AACAG,IAAAA,SAAAA,CAAAA,CAAUlC,GAAQ,EAAA;AAChB,QAAA,IAAI,OAAOmC,oBAAAA,CAAaD,SAAS,KAAK,UAAY,EAAA;AAChDC,YAAAA,oBAAAA,CAAaD,SAAS,CAAClC,GAAAA,CAAAA;AACzB;AACA,QAAA,IAAI,OAAOoC,oBAAAA,CAAaF,SAAS,KAAK,UAAY,EAAA;AAChDE,YAAAA,oBAAAA,CAAaF,SAAS,CAAClC,GAAAA,CAAAA;AACzB;AACF,KAAA;IACA,MAAMqC,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,EAAEC,OAAAA,EAASC,IAAI,EAAE,GAAA;gBACtB,OAAO;AACLA,oBAAAA,IAAAA,EAAMC,sCAAyBD,IAAM1C,EAAAA,gBAAAA,CAAAA;AACrCuC,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA,CACCK,KAAK,CAAC,IAAA;gBACL,OAAO;AACLF,oBAAAA,IAAAA,EAAM,EAAC;AACPH,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA;AACJ,SAAA,CAAA,CAAA;QAGF,OAAOH,OAAAA,CAAQS,OAAO,CAACV,aAAAA,CAAAA;AACzB;AACF,CAAE;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { Feather } from '@strapi/icons';
1
+ import { Feather, Pencil, CheckCircle } from '@strapi/icons';
2
2
  import { PLUGIN_ID } from './constants/plugin.mjs';
3
3
  import { ContentManagerPlugin } from './content-manager.mjs';
4
4
  import { historyAdmin } from './history/index.mjs';
@@ -14,7 +14,7 @@ export { useDocumentActions as unstable_useDocumentActions } from './hooks/useDo
14
14
  export { useDocumentLayout as unstable_useDocumentLayout } from './hooks/useDocumentLayout.mjs';
15
15
  export { DocumentRBAC, useDocumentRBAC } from './features/DocumentRBAC.mjs';
16
16
 
17
- function __variableDynamicImportRuntime1__(path) {
17
+ function __variableDynamicImportRuntime3__(path) {
18
18
  switch (path) {
19
19
  case './translations/ar.json': return import('./translations/ar.json.mjs');
20
20
  case './translations/ca.json': return import('./translations/ca.json.mjs');
@@ -82,6 +82,45 @@ var index = {
82
82
  children: routes
83
83
  });
84
84
  app.registerPlugin(cm.config);
85
+ // Register homepage widgets
86
+ app.widgets.register([
87
+ {
88
+ icon: Pencil,
89
+ title: {
90
+ id: `${PLUGIN_ID}.widget.last-edited.title`,
91
+ defaultMessage: 'Last edited entries'
92
+ },
93
+ component: async ()=>{
94
+ const { LastEditedWidget } = await import('./components/Widgets.mjs');
95
+ return LastEditedWidget;
96
+ },
97
+ pluginId: PLUGIN_ID,
98
+ id: 'last-edited-entries',
99
+ permissions: [
100
+ {
101
+ action: 'plugin::content-manager.explorer.read'
102
+ }
103
+ ]
104
+ },
105
+ {
106
+ icon: CheckCircle,
107
+ title: {
108
+ id: `${PLUGIN_ID}.widget.last-published.title`,
109
+ defaultMessage: 'Last published entries'
110
+ },
111
+ component: async ()=>{
112
+ const { LastPublishedWidget } = await import('./components/Widgets.mjs');
113
+ return LastPublishedWidget;
114
+ },
115
+ pluginId: PLUGIN_ID,
116
+ id: 'last-published-entries',
117
+ permissions: [
118
+ {
119
+ action: 'plugin::content-manager.explorer.read'
120
+ }
121
+ ]
122
+ }
123
+ ]);
85
124
  },
86
125
  bootstrap (app) {
87
126
  if (typeof historyAdmin.bootstrap === 'function') {
@@ -93,7 +132,7 @@ var index = {
93
132
  },
94
133
  async registerTrads ({ locales }) {
95
134
  const importedTrads = await Promise.all(locales.map((locale)=>{
96
- return __variableDynamicImportRuntime1__(`./translations/${locale}.json`).then(({ default: data })=>{
135
+ return __variableDynamicImportRuntime3__(`./translations/${locale}.json`).then(({ default: data })=>{
97
136
  return {
98
137
  data: prefixPluginTranslations(data, PLUGIN_ID),
99
138
  locale
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../admin/src/index.ts"],"sourcesContent":["import { Feather } from '@strapi/icons';\n\nimport { PLUGIN_ID } from './constants/plugin';\nimport { ContentManagerPlugin } from './content-manager';\nimport { historyAdmin } from './history';\nimport { reducer } from './modules/reducers';\nimport { previewAdmin } from './preview';\nimport { routes } from './router';\nimport { prefixPluginTranslations } from './utils/translations';\n\n// NOTE: we have to preload it to ensure chunks will have it available as global\nimport 'prismjs';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n register(app: any) {\n const cm = new ContentManagerPlugin();\n\n app.addReducers({\n [PLUGIN_ID]: reducer,\n });\n\n app.addMenuLink({\n to: PLUGIN_ID,\n icon: Feather,\n intlLabel: {\n id: `content-manager.plugin.name`,\n defaultMessage: 'Content Manager',\n },\n permissions: [],\n position: 1,\n });\n\n app.router.addRoute({\n path: 'content-manager/*',\n lazy: async () => {\n const { Layout } = await import('./layout');\n\n return {\n Component: Layout,\n };\n },\n children: routes,\n });\n\n app.registerPlugin(cm.config);\n },\n bootstrap(app: any) {\n if (typeof historyAdmin.bootstrap === 'function') {\n historyAdmin.bootstrap(app);\n }\n if (typeof previewAdmin.bootstrap === 'function') {\n previewAdmin.bootstrap(app);\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\nexport * from './exports';\n"],"names":["register","app","cm","ContentManagerPlugin","addReducers","PLUGIN_ID","reducer","addMenuLink","to","icon","Feather","intlLabel","id","defaultMessage","permissions","position","router","addRoute","path","lazy","Layout","Component","children","routes","registerPlugin","config","bootstrap","historyAdmin","previewAdmin","registerTrads","locales","importedTrads","Promise","all","map","locale","then","default","data","prefixPluginTranslations","catch","resolve"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA;AACA,YAAe;AACbA,IAAAA,QAAAA,CAAAA,CAASC,GAAQ,EAAA;AACf,QAAA,MAAMC,KAAK,IAAIC,oBAAAA,EAAAA;AAEfF,QAAAA,GAAAA,CAAIG,WAAW,CAAC;AACd,YAAA,CAACC,YAAYC;AACf,SAAA,CAAA;AAEAL,QAAAA,GAAAA,CAAIM,WAAW,CAAC;YACdC,EAAIH,EAAAA,SAAAA;YACJI,IAAMC,EAAAA,OAAAA;YACNC,SAAW,EAAA;gBACTC,EAAI,EAAA,CAAC,2BAA2B,CAAC;gBACjCC,cAAgB,EAAA;AAClB,aAAA;AACAC,YAAAA,WAAAA,EAAa,EAAE;YACfC,QAAU,EAAA;AACZ,SAAA,CAAA;QAEAd,GAAIe,CAAAA,MAAM,CAACC,QAAQ,CAAC;YAClBC,IAAM,EAAA,mBAAA;YACNC,IAAM,EAAA,UAAA;AACJ,gBAAA,MAAM,EAAEC,MAAM,EAAE,GAAG,MAAM,OAAO,cAAA,CAAA;gBAEhC,OAAO;oBACLC,SAAWD,EAAAA;AACb,iBAAA;AACF,aAAA;YACAE,QAAUC,EAAAA;AACZ,SAAA,CAAA;QAEAtB,GAAIuB,CAAAA,cAAc,CAACtB,EAAAA,CAAGuB,MAAM,CAAA;AAC9B,KAAA;AACAC,IAAAA,SAAAA,CAAAA,CAAUzB,GAAQ,EAAA;AAChB,QAAA,IAAI,OAAO0B,YAAAA,CAAaD,SAAS,KAAK,UAAY,EAAA;AAChDC,YAAAA,YAAAA,CAAaD,SAAS,CAACzB,GAAAA,CAAAA;AACzB;AACA,QAAA,IAAI,OAAO2B,YAAAA,CAAaF,SAAS,KAAK,UAAY,EAAA;AAChDE,YAAAA,YAAAA,CAAaF,SAAS,CAACzB,GAAAA,CAAAA;AACzB;AACF,KAAA;IACA,MAAM4B,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,EAAEC,OAAAA,EAASC,IAAI,EAAE,GAAA;gBACtB,OAAO;AACLA,oBAAAA,IAAAA,EAAMC,yBAAyBD,IAAMjC,EAAAA,SAAAA,CAAAA;AACrC8B,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA,CACCK,KAAK,CAAC,IAAA;gBACL,OAAO;AACLF,oBAAAA,IAAAA,EAAM,EAAC;AACPH,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA;AACJ,SAAA,CAAA,CAAA;QAGF,OAAOH,OAAAA,CAAQS,OAAO,CAACV,aAAAA,CAAAA;AACzB;AACF,CAAE;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../admin/src/index.ts"],"sourcesContent":["import { CheckCircle, Feather, Pencil } from '@strapi/icons';\n\nimport { PLUGIN_ID } from './constants/plugin';\nimport { ContentManagerPlugin } from './content-manager';\nimport { historyAdmin } from './history';\nimport { reducer } from './modules/reducers';\nimport { previewAdmin } from './preview';\nimport { routes } from './router';\nimport { prefixPluginTranslations } from './utils/translations';\n\n// NOTE: we have to preload it to ensure chunks will have it available as global\nimport 'prismjs';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n register(app: any) {\n const cm = new ContentManagerPlugin();\n\n app.addReducers({\n [PLUGIN_ID]: reducer,\n });\n\n app.addMenuLink({\n to: PLUGIN_ID,\n icon: Feather,\n intlLabel: {\n id: `content-manager.plugin.name`,\n defaultMessage: 'Content Manager',\n },\n permissions: [],\n position: 1,\n });\n\n app.router.addRoute({\n path: 'content-manager/*',\n lazy: async () => {\n const { Layout } = await import('./layout');\n\n return {\n Component: Layout,\n };\n },\n children: routes,\n });\n\n app.registerPlugin(cm.config);\n\n // Register homepage widgets\n app.widgets.register([\n {\n icon: Pencil,\n title: {\n id: `${PLUGIN_ID}.widget.last-edited.title`,\n defaultMessage: 'Last edited entries',\n },\n component: async () => {\n const { LastEditedWidget } = await import('./components/Widgets');\n return LastEditedWidget;\n },\n pluginId: PLUGIN_ID,\n id: 'last-edited-entries',\n permissions: [{ action: 'plugin::content-manager.explorer.read' }],\n },\n {\n icon: CheckCircle,\n title: {\n id: `${PLUGIN_ID}.widget.last-published.title`,\n defaultMessage: 'Last published entries',\n },\n component: async () => {\n const { LastPublishedWidget } = await import('./components/Widgets');\n return LastPublishedWidget;\n },\n pluginId: PLUGIN_ID,\n id: 'last-published-entries',\n permissions: [{ action: 'plugin::content-manager.explorer.read' }],\n },\n ]);\n },\n bootstrap(app: any) {\n if (typeof historyAdmin.bootstrap === 'function') {\n historyAdmin.bootstrap(app);\n }\n if (typeof previewAdmin.bootstrap === 'function') {\n previewAdmin.bootstrap(app);\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\nexport * from './exports';\n"],"names":["register","app","cm","ContentManagerPlugin","addReducers","PLUGIN_ID","reducer","addMenuLink","to","icon","Feather","intlLabel","id","defaultMessage","permissions","position","router","addRoute","path","lazy","Layout","Component","children","routes","registerPlugin","config","widgets","Pencil","title","component","LastEditedWidget","pluginId","action","CheckCircle","LastPublishedWidget","bootstrap","historyAdmin","previewAdmin","registerTrads","locales","importedTrads","Prom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GAAA;gBACtB,OAAO;AACLA,oBAAAA,IAAAA,EAAMC,yBAAyBD,IAAM1C,EAAAA,SAAAA,CAAAA;AACrCuC,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA,CACCK,KAAK,CAAC,IAAA;gBACL,OAAO;AACLF,oBAAAA,IAAAA,EAAM,EAAC;AACPH,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA;AACJ,SAAA,CAAA,CAAA;QAGF,OAAOH,OAAAA,CAAQS,OAAO,CAACV,aAAAA,CAAAA;AACzB;AACF,CAAE;;;;"}
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ var api = require('./api.js');
4
+
5
+ const homepageService = api.contentManagerApi.injectEndpoints({
6
+ /**
7
+ * TODO: Remove overrideExisting when we remove the future flag
8
+ * and delete the old homepage service in the admin
9
+ */ overrideExisting: true,
10
+ endpoints: (builder)=>({
11
+ getRecentDocuments: builder.query({
12
+ query: (params)=>`/admin/homepage/recent-documents?action=${params.action}`,
13
+ transformResponse: (response)=>response.data,
14
+ providesTags: (res, _err, { action })=>[
15
+ {
16
+ type: 'RecentDocumentList',
17
+ id: action
18
+ }
19
+ ]
20
+ })
21
+ })
22
+ });
23
+ const { useGetRecentDocumentsQuery } = homepageService;
24
+
25
+ exports.useGetRecentDocumentsQuery = useGetRecentDocumentsQuery;
26
+ //# sourceMappingURL=homepage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"homepage.js","sources":["../../../admin/src/services/homepage.ts"],"sourcesContent":["import * as Homepage from '../../../shared/contracts/homepage';\n\nimport { contentManagerApi } from './api';\n\nconst homepageService = contentManagerApi.injectEndpoints({\n /**\n * TODO: Remove overrideExisting when we remove the future flag\n * and delete the old homepage service in the admin\n */\n overrideExisting: true,\n endpoints: (builder) => ({\n getRecentDocuments: builder.query<\n Homepage.GetRecentDocuments.Response['data'],\n Homepage.GetRecentDocuments.Request['query']\n >({\n query: (params) => `/admin/homepage/recent-documents?action=${params.action}`,\n transformResponse: (response: Homepage.GetRecentDocuments.Response) => response.data,\n providesTags: (res, _err, { action }) => [\n { type: 'RecentDocumentList' as const, id: action },\n ],\n }),\n }),\n});\n\nconst { useGetRecentDocumentsQuery } = homepageService;\n\nexport { useGetRecentDocumentsQuery };\n"],"names":["homepageService","contentManagerApi","injectEndpoints","overrideExisting","endpoints","builder","getRecentDocuments","query","params","action","transformResponse","response","data","providesTags","res","_err","type","id","useGetRecentDocumentsQuery"],"mappings":";;;;AAIA,MAAMA,eAAAA,GAAkBC,qBAAkBC,CAAAA,eAAe,CAAC;AACxD;;;AAGC,MACDC,gBAAkB,EAAA,IAAA;IAClBC,SAAW,EAAA,CAACC,WAAa;YACvBC,kBAAoBD,EAAAA,OAAAA,CAAQE,KAAK,CAG/B;gBACAA,KAAO,EAAA,CAACC,SAAW,CAAC,wCAAwC,EAAEA,MAAOC,CAAAA,MAAM,CAAC,CAAC;gBAC7EC,iBAAmB,EAAA,CAACC,QAAmDA,GAAAA,QAAAA,CAASC,IAAI;AACpFC,gBAAAA,YAAAA,EAAc,CAACC,GAAKC,EAAAA,IAAAA,EAAM,EAAEN,MAAM,EAAE,GAAK;AACvC,wBAAA;4BAAEO,IAAM,EAAA,oBAAA;4BAA+BC,EAAIR,EAAAA;AAAO;AACnD;AACH,aAAA;SACF;AACF,CAAA,CAAA;AAEM,MAAA,EAAES,0BAA0B,EAAE,GAAGlB;;;;"}
@@ -0,0 +1,24 @@
1
+ import { contentManagerApi } from './api.mjs';
2
+
3
+ const homepageService = contentManagerApi.injectEndpoints({
4
+ /**
5
+ * TODO: Remove overrideExisting when we remove the future flag
6
+ * and delete the old homepage service in the admin
7
+ */ overrideExisting: true,
8
+ endpoints: (builder)=>({
9
+ getRecentDocuments: builder.query({
10
+ query: (params)=>`/admin/homepage/recent-documents?action=${params.action}`,
11
+ transformResponse: (response)=>response.data,
12
+ providesTags: (res, _err, { action })=>[
13
+ {
14
+ type: 'RecentDocumentList',
15
+ id: action
16
+ }
17
+ ]
18
+ })
19
+ })
20
+ });
21
+ const { useGetRecentDocumentsQuery } = homepageService;
22
+
23
+ export { useGetRecentDocumentsQuery };
24
+ //# sourceMappingURL=homepage.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"homepage.mjs","sources":["../../../admin/src/services/homepage.ts"],"sourcesContent":["import * as Homepage from '../../../shared/contracts/homepage';\n\nimport { contentManagerApi } from './api';\n\nconst homepageService = contentManagerApi.injectEndpoints({\n /**\n * TODO: Remove overrideExisting when we remove the future flag\n * and delete the old homepage service in the admin\n */\n overrideExisting: true,\n endpoints: (builder) => ({\n getRecentDocuments: builder.query<\n Homepage.GetRecentDocuments.Response['data'],\n Homepage.GetRecentDocuments.Request['query']\n >({\n query: (params) => `/admin/homepage/recent-documents?action=${params.action}`,\n transformResponse: (response: Homepage.GetRecentDocuments.Response) => response.data,\n providesTags: (res, _err, { action }) => [\n { type: 'RecentDocumentList' as const, id: action },\n ],\n }),\n }),\n});\n\nconst { useGetRecentDocumentsQuery } = homepageService;\n\nexport { useGetRecentDocumentsQuery };\n"],"names":["homepageService","contentManagerApi","injectEndpoints","overrideExisting","endpoints","builder","getRecentDocuments","query","params","action","transformResponse","response","data","providesTags","res","_err","type","id","useGetRecentDocumentsQuery"],"mappings":";;AAIA,MAAMA,eAAAA,GAAkBC,iBAAkBC,CAAAA,eAAe,CAAC;AACxD;;;AAGC,MACDC,gBAAkB,EAAA,IAAA;IAClBC,SAAW,EAAA,CAACC,WAAa;YACvBC,kBAAoBD,EAAAA,OAAAA,CAAQE,KAAK,CAG/B;gBACAA,KAAO,EAAA,CAACC,SAAW,CAAC,wCAAwC,EAAEA,MAAOC,CAAAA,MAAM,CAAC,CAAC;gBAC7EC,iBAAmB,EAAA,CAACC,QAAmDA,GAAAA,QAAAA,CAASC,IAAI;AACpFC,gBAAAA,YAAAA,EAAc,CAACC,GAAKC,EAAAA,IAAAA,EAAM,EAAEN,MAAM,EAAE,GAAK;AACvC,wBAAA;4BAAEO,IAAM,EAAA,oBAAA;4BAA+BC,EAAIR,EAAAA;AAAO;AACnD;AACH,aAAA;SACF;AACF,CAAA,CAAA;AAEM,MAAA,EAAES,0BAA0B,EAAE,GAAGlB;;;;"}
@@ -0,0 +1,3 @@
1
+ declare const LastEditedWidget: () => import("react/jsx-runtime").JSX.Element;
2
+ declare const LastPublishedWidget: () => import("react/jsx-runtime").JSX.Element;
3
+ export { LastEditedWidget, LastPublishedWidget };
@@ -0,0 +1,5 @@
1
+ import * as Homepage from '../../../shared/contracts/homepage';
2
+ declare const useGetRecentDocumentsQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseQuery<import("@reduxjs/toolkit/query").QueryDefinition<{
3
+ action: "update" | "publish";
4
+ }, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@strapi/admin/strapi-admin").QueryArguments, unknown, import("@strapi/admin/strapi-admin").BaseQueryError, {}, {}>, "ComponentConfiguration" | "ContentTypesConfiguration" | "ContentTypeSettings" | "Document" | "InitialData" | "HistoryVersion" | "Relations" | "UidAvailability" | "RecentDocumentList", Homepage.RecentDocument[], "adminApi">>;
5
+ export { useGetRecentDocumentsQuery };
@@ -0,0 +1,11 @@
1
+ /// <reference types="node" />
2
+ import type { Core } from '@strapi/types';
3
+ import type { GetRecentDocuments } from '../../../shared/contracts/homepage';
4
+ declare const createHomepageService: ({ strapi }: {
5
+ strapi: Core.Strapi;
6
+ }) => {
7
+ getRecentlyPublishedDocuments(): Promise<GetRecentDocuments.Response['data']>;
8
+ getRecentlyUpdatedDocuments(): Promise<GetRecentDocuments.Response['data']>;
9
+ };
10
+ export { createHomepageService };
11
+ //# sourceMappingURL=homepage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"homepage.d.ts","sourceRoot":"","sources":["../../../../server/src/services/homepage.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,IAAI,EAAmB,MAAM,eAAe,CAAC;AAG3D,OAAO,KAAK,EAAE,kBAAkB,EAAkB,MAAM,oCAAoC,CAAC;AAE7F,QAAA,MAAM,qBAAqB,eAAgB;IAAE,MAAM,EAAE,KAAK,MAAM,CAAA;CAAE;qCAiJvB,QAAQ,2BAA2B,CAAC,MAAM,CAAC,CAAC;mCAoC9C,QAAQ,2BAA2B,CAAC,MAAM,CAAC,CAAC;CA+BpF,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { errors } from '@strapi/utils';
2
+ import type { Struct, UID } from '@strapi/types';
3
+ export interface RecentDocument {
4
+ kind: Struct.ContentTypeKind;
5
+ contentTypeUid: UID.ContentType;
6
+ contentTypeDisplayName: string;
7
+ documentId: string;
8
+ locale: string | null;
9
+ status?: 'draft' | 'published' | 'modified';
10
+ title: string;
11
+ updatedAt: Date;
12
+ publishedAt?: Date | null;
13
+ }
14
+ export declare namespace GetRecentDocuments {
15
+ interface Request {
16
+ body: {};
17
+ query: {
18
+ action: 'update' | 'publish';
19
+ };
20
+ }
21
+ interface Response {
22
+ data: RecentDocument[];
23
+ error?: errors.ApplicationError;
24
+ }
25
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"homepage.d.ts","sourceRoot":"","sources":["../../../shared/contracts/homepage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGjD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC,eAAe,CAAC;IAC7B,cAAc,EAAE,GAAG,CAAC,WAAW,CAAC;IAChC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,GAAG,WAAW,GAAG,UAAU,CAAC;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;IAChB,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,CAAC,OAAO,WAAW,kBAAkB,CAAC;IAC1C,UAAiB,OAAO;QACtB,IAAI,EAAE,EAAE,CAAC;QACT,KAAK,EAAE;YACL,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC;SAC9B,CAAC;KACH;IAED,UAAiB,QAAQ;QACvB,IAAI,EAAE,cAAc,EAAE,CAAC;QACvB,KAAK,CAAC,EAAE,MAAM,CAAC,gBAAgB,CAAC;KACjC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/content-manager",
3
- "version": "5.12.4",
3
+ "version": "5.12.5",
4
4
  "description": "A powerful UI to easily manage your data.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -66,8 +66,8 @@
66
66
  "@sindresorhus/slugify": "1.1.0",
67
67
  "@strapi/design-system": "2.0.0-rc.21",
68
68
  "@strapi/icons": "2.0.0-rc.21",
69
- "@strapi/types": "5.12.4",
70
- "@strapi/utils": "5.12.4",
69
+ "@strapi/types": "5.12.5",
70
+ "@strapi/utils": "5.12.5",
71
71
  "codemirror5": "npm:codemirror@^5.65.11",
72
72
  "date-fns": "2.30.0",
73
73
  "fractional-indexing": "3.2.0",
@@ -102,8 +102,8 @@
102
102
  "yup": "0.32.9"
103
103
  },
104
104
  "devDependencies": {
105
- "@strapi/admin": "5.12.4",
106
- "@strapi/database": "5.12.4",
105
+ "@strapi/admin": "5.12.5",
106
+ "@strapi/database": "5.12.5",
107
107
  "@testing-library/react": "15.0.7",
108
108
  "@types/jest": "29.5.2",
109
109
  "@types/lodash": "^4.14.191",