@webiny/app-headless-cms-scheduler 6.1.0-beta.3 → 6.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,16 +5,12 @@ import { useApolloClient } from "@apollo/react-hooks";
|
|
|
5
5
|
import { useScheduleDialog } from "@webiny/app-scheduler";
|
|
6
6
|
import { usePermissions } from "../../hooks/usePermissions.js";
|
|
7
7
|
import { createNamespace } from "../../utils/index.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const {
|
|
15
|
-
canPublish,
|
|
16
|
-
canUnpublish
|
|
17
|
-
} = usePermissions();
|
|
8
|
+
/* Rendered only when entry.id exists; hooks that depend on entry.id live here. */
|
|
9
|
+
const MenuItemWithId = ({
|
|
10
|
+
entry,
|
|
11
|
+
contentModel,
|
|
12
|
+
loading
|
|
13
|
+
}) => {
|
|
18
14
|
const client = useApolloClient();
|
|
19
15
|
const {
|
|
20
16
|
showDialog: showSchedulerDialog
|
|
@@ -33,9 +29,6 @@ export const MenuItem = () => {
|
|
|
33
29
|
const showDialog = useCallback(() => {
|
|
34
30
|
showSchedulerDialog();
|
|
35
31
|
}, [showSchedulerDialog]);
|
|
36
|
-
if (!canPublish && !canUnpublish) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
32
|
const action = entry.meta?.status === "published" ? "unpublish" : "publish";
|
|
40
33
|
return /*#__PURE__*/React.createElement(OptionsMenuItem, {
|
|
41
34
|
icon: /*#__PURE__*/React.createElement(ScheduleIcon, null),
|
|
@@ -45,5 +38,39 @@ export const MenuItem = () => {
|
|
|
45
38
|
"data-testid": "cms.content-form.header.schedule"
|
|
46
39
|
});
|
|
47
40
|
};
|
|
41
|
+
export const MenuItem = () => {
|
|
42
|
+
const {
|
|
43
|
+
entry,
|
|
44
|
+
loading,
|
|
45
|
+
contentModel
|
|
46
|
+
} = useContentEntryEditor();
|
|
47
|
+
const {
|
|
48
|
+
canPublish,
|
|
49
|
+
canUnpublish
|
|
50
|
+
} = usePermissions();
|
|
51
|
+
const {
|
|
52
|
+
OptionsMenuItem
|
|
53
|
+
} = ContentEntryEditorConfig.Actions.MenuItemAction.useOptionsMenuItem();
|
|
54
|
+
if (!canPublish && !canUnpublish) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* When entry.id is missing (e.g. new unsaved entry), render a disabled item
|
|
59
|
+
* without invoking hooks that require a persisted entry. */
|
|
60
|
+
if (!entry.id) {
|
|
61
|
+
return /*#__PURE__*/React.createElement(OptionsMenuItem, {
|
|
62
|
+
icon: /*#__PURE__*/React.createElement(ScheduleIcon, null),
|
|
63
|
+
label: "Schedule",
|
|
64
|
+
onAction: () => void 0,
|
|
65
|
+
disabled: true,
|
|
66
|
+
"data-testid": "cms.content-form.header.schedule"
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return /*#__PURE__*/React.createElement(MenuItemWithId, {
|
|
70
|
+
entry: entry,
|
|
71
|
+
contentModel: contentModel,
|
|
72
|
+
loading: loading
|
|
73
|
+
});
|
|
74
|
+
};
|
|
48
75
|
|
|
49
76
|
//# sourceMappingURL=MenuItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","ContentEntryEditorConfig","useContentEntryEditor","ReactComponent","ScheduleIcon","useApolloClient","useScheduleDialog","usePermissions","createNamespace","
|
|
1
|
+
{"version":3,"names":["React","useCallback","ContentEntryEditorConfig","useContentEntryEditor","ReactComponent","ScheduleIcon","useApolloClient","useScheduleDialog","usePermissions","createNamespace","MenuItemWithId","entry","contentModel","loading","client","showDialog","showSchedulerDialog","namespace","target","id","title","meta","status","OptionsMenuItem","Actions","MenuItemAction","useOptionsMenuItem","action","createElement","icon","label","onAction","disabled","MenuItem","canPublish","canUnpublish"],"sources":["MenuItem.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport {\n ContentEntryEditorConfig,\n useContentEntryEditor\n} from \"@webiny/app-headless-cms/exports/admin/cms/entry/editor.js\";\nimport { ReactComponent as ScheduleIcon } from \"@webiny/icons/cell_tower.svg\";\nimport { useApolloClient } from \"@apollo/react-hooks\";\nimport { useScheduleDialog } from \"@webiny/app-scheduler\";\nimport { usePermissions } from \"~/hooks/usePermissions.js\";\nimport { createNamespace } from \"~/utils/index.js\";\n\ninterface MenuItemWithIdProps {\n entry: ReturnType<typeof useContentEntryEditor>[\"entry\"];\n contentModel: ReturnType<typeof useContentEntryEditor>[\"contentModel\"];\n loading: boolean;\n}\n\n/* Rendered only when entry.id exists; hooks that depend on entry.id live here. */\nconst MenuItemWithId = ({ entry, contentModel, loading }: MenuItemWithIdProps) => {\n const client = useApolloClient();\n\n const { showDialog: showSchedulerDialog } = useScheduleDialog({\n client,\n namespace: createNamespace(contentModel),\n target: {\n id: entry.id,\n title: entry.meta.title,\n status: entry.meta.status\n }\n });\n\n const { OptionsMenuItem } =\n ContentEntryEditorConfig.Actions.MenuItemAction.useOptionsMenuItem();\n\n const showDialog = useCallback(() => {\n showSchedulerDialog();\n }, [showSchedulerDialog]);\n\n const action = entry.meta?.status === \"published\" ? \"unpublish\" : \"publish\";\n\n return (\n <OptionsMenuItem\n icon={<ScheduleIcon />}\n label={`Schedule ${action}`}\n onAction={showDialog}\n disabled={!entry?.meta?.status || loading}\n data-testid={\"cms.content-form.header.schedule\"}\n />\n );\n};\n\nexport const MenuItem = () => {\n const { entry, loading, contentModel } = useContentEntryEditor();\n const { canPublish, canUnpublish } = usePermissions();\n\n const { OptionsMenuItem } =\n ContentEntryEditorConfig.Actions.MenuItemAction.useOptionsMenuItem();\n\n if (!canPublish && !canUnpublish) {\n return null;\n }\n\n /* When entry.id is missing (e.g. new unsaved entry), render a disabled item\n * without invoking hooks that require a persisted entry. */\n if (!entry.id) {\n return (\n <OptionsMenuItem\n icon={<ScheduleIcon />}\n label={\"Schedule\"}\n onAction={() => void 0}\n disabled={true}\n data-testid={\"cms.content-form.header.schedule\"}\n />\n );\n }\n\n return <MenuItemWithId entry={entry} contentModel={contentModel} loading={loading} />;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAC1C,SACIC,wBAAwB,EACxBC,qBAAqB,QAClB,4DAA4D;AACnE,SAASC,cAAc,IAAIC,YAAY,QAAQ,8BAA8B;AAC7E,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,iBAAiB,QAAQ,uBAAuB;AACzD,SAASC,cAAc;AACvB,SAASC,eAAe;AAQxB;AACA,MAAMC,cAAc,GAAGA,CAAC;EAAEC,KAAK;EAAEC,YAAY;EAAEC;AAA6B,CAAC,KAAK;EAC9E,MAAMC,MAAM,GAAGR,eAAe,CAAC,CAAC;EAEhC,MAAM;IAAES,UAAU,EAAEC;EAAoB,CAAC,GAAGT,iBAAiB,CAAC;IAC1DO,MAAM;IACNG,SAAS,EAAER,eAAe,CAACG,YAAY,CAAC;IACxCM,MAAM,EAAE;MACJC,EAAE,EAAER,KAAK,CAACQ,EAAE;MACZC,KAAK,EAAET,KAAK,CAACU,IAAI,CAACD,KAAK;MACvBE,MAAM,EAAEX,KAAK,CAACU,IAAI,CAACC;IACvB;EACJ,CAAC,CAAC;EAEF,MAAM;IAAEC;EAAgB,CAAC,GACrBrB,wBAAwB,CAACsB,OAAO,CAACC,cAAc,CAACC,kBAAkB,CAAC,CAAC;EAExE,MAAMX,UAAU,GAAGd,WAAW,CAAC,MAAM;IACjCe,mBAAmB,CAAC,CAAC;EACzB,CAAC,EAAE,CAACA,mBAAmB,CAAC,CAAC;EAEzB,MAAMW,MAAM,GAAGhB,KAAK,CAACU,IAAI,EAAEC,MAAM,KAAK,WAAW,GAAG,WAAW,GAAG,SAAS;EAE3E,oBACItB,KAAA,CAAA4B,aAAA,CAACL,eAAe;IACZM,IAAI,eAAE7B,KAAA,CAAA4B,aAAA,CAACvB,YAAY,MAAE,CAAE;IACvByB,KAAK,EAAE,YAAYH,MAAM,EAAG;IAC5BI,QAAQ,EAAEhB,UAAW;IACrBiB,QAAQ,EAAE,CAACrB,KAAK,EAAEU,IAAI,EAAEC,MAAM,IAAIT,OAAQ;IAC1C,eAAa;EAAmC,CACnD,CAAC;AAEV,CAAC;AAED,OAAO,MAAMoB,QAAQ,GAAGA,CAAA,KAAM;EAC1B,MAAM;IAAEtB,KAAK;IAAEE,OAAO;IAAED;EAAa,CAAC,GAAGT,qBAAqB,CAAC,CAAC;EAChE,MAAM;IAAE+B,UAAU;IAAEC;EAAa,CAAC,GAAG3B,cAAc,CAAC,CAAC;EAErD,MAAM;IAAEe;EAAgB,CAAC,GACrBrB,wBAAwB,CAACsB,OAAO,CAACC,cAAc,CAACC,kBAAkB,CAAC,CAAC;EAExE,IAAI,CAACQ,UAAU,IAAI,CAACC,YAAY,EAAE;IAC9B,OAAO,IAAI;EACf;;EAEA;AACJ;EACI,IAAI,CAACxB,KAAK,CAACQ,EAAE,EAAE;IACX,oBACInB,KAAA,CAAA4B,aAAA,CAACL,eAAe;MACZM,IAAI,eAAE7B,KAAA,CAAA4B,aAAA,CAACvB,YAAY,MAAE,CAAE;MACvByB,KAAK,EAAE,UAAW;MAClBC,QAAQ,EAAEA,CAAA,KAAM,KAAK,CAAE;MACvBC,QAAQ,EAAE,IAAK;MACf,eAAa;IAAmC,CACnD,CAAC;EAEV;EAEA,oBAAOhC,KAAA,CAAA4B,aAAA,CAAClB,cAAc;IAACC,KAAK,EAAEA,KAAM;IAACC,YAAY,EAAEA,YAAa;IAACC,OAAO,EAAEA;EAAQ,CAAE,CAAC;AACzF,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app-headless-cms-scheduler",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0-beta.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -11,18 +11,18 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@apollo/react-hooks": "3.1.5",
|
|
14
|
-
"@webiny/admin-ui": "6.
|
|
15
|
-
"@webiny/app-headless-cms": "6.
|
|
16
|
-
"@webiny/app-headless-cms-common": "6.
|
|
17
|
-
"@webiny/app-scheduler": "6.
|
|
18
|
-
"@webiny/icons": "6.
|
|
19
|
-
"react": "18.
|
|
20
|
-
"react-dom": "18.
|
|
14
|
+
"@webiny/admin-ui": "6.2.0-beta.0",
|
|
15
|
+
"@webiny/app-headless-cms": "6.2.0-beta.0",
|
|
16
|
+
"@webiny/app-headless-cms-common": "6.2.0-beta.0",
|
|
17
|
+
"@webiny/app-scheduler": "6.2.0-beta.0",
|
|
18
|
+
"@webiny/icons": "6.2.0-beta.0",
|
|
19
|
+
"react": "18.3.1",
|
|
20
|
+
"react-dom": "18.3.1"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@emotion/babel-plugin": "11.13.5",
|
|
24
|
-
"@types/react": "18.
|
|
25
|
-
"@webiny/build-tools": "6.
|
|
24
|
+
"@types/react": "18.3.28",
|
|
25
|
+
"@webiny/build-tools": "6.2.0-beta.0",
|
|
26
26
|
"rimraf": "6.1.3",
|
|
27
27
|
"typescript": "5.9.3"
|
|
28
28
|
},
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"removeViewBox": false
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "3d3148358b6febbc857371930871743bec3b3939"
|
|
39
39
|
}
|