@webiny/app-headless-cms-workflows 0.0.0-unstable.0d717d18dd
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/Components/CmsEntriesWorkflowStateList/CmsEntriesWorkflowStateListFooterMenu.d.ts +2 -0
- package/Components/CmsEntriesWorkflowStateList/CmsEntriesWorkflowStateListFooterMenu.js +34 -0
- package/Components/CmsEntriesWorkflowStateList/CmsEntriesWorkflowStateListFooterMenu.js.map +1 -0
- package/Components/CmsEntriesWorkflowStateList/index.d.ts +1 -0
- package/Components/CmsEntriesWorkflowStateList/index.js +1 -0
- package/Components/ContentEntryForm/CmsEntryFormCreateNewRevisionButton.d.ts +2 -0
- package/Components/ContentEntryForm/CmsEntryFormCreateNewRevisionButton.js +47 -0
- package/Components/ContentEntryForm/CmsEntryFormCreateNewRevisionButton.js.map +1 -0
- package/Components/ContentEntryForm/CmsEntryFormScheduleMenuItemAction.d.ts +5 -0
- package/Components/ContentEntryForm/CmsEntryFormScheduleMenuItemAction.js +22 -0
- package/Components/ContentEntryForm/CmsEntryFormScheduleMenuItemAction.js.map +1 -0
- package/Components/ContentEntryForm/CmsEntryFormTooltipButton.d.ts +2 -0
- package/Components/ContentEntryForm/CmsEntryFormTooltipButton.js +13 -0
- package/Components/ContentEntryForm/CmsEntryFormTooltipButton.js.map +1 -0
- package/Components/ContentEntryForm/ContentEntryFormWorkflow.d.ts +2 -0
- package/Components/ContentEntryForm/ContentEntryFormWorkflow.js +24 -0
- package/Components/ContentEntryForm/ContentEntryFormWorkflow.js.map +1 -0
- package/Components/ContentEntryForm/index.d.ts +4 -0
- package/Components/ContentEntryForm/index.js +4 -0
- package/Components/OptionItem/OpenInNewWindow.d.ts +2 -0
- package/Components/OptionItem/OpenInNewWindow.js +36 -0
- package/Components/OptionItem/OpenInNewWindow.js.map +1 -0
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/Routes/CmsWorkflowsEditor.d.ts +2 -0
- package/Routes/CmsWorkflowsEditor.js +32 -0
- package/Routes/CmsWorkflowsEditor.js.map +1 -0
- package/Routes/index.d.ts +1 -0
- package/Routes/index.js +1 -0
- package/features/WorkflowStateCacheHandler.d.ts +11 -0
- package/features/WorkflowStateCacheHandler.js +50 -0
- package/features/WorkflowStateCacheHandler.js.map +1 -0
- package/features/feature.d.ts +1 -0
- package/features/feature.js +11 -0
- package/features/feature.js.map +1 -0
- package/index.d.ts +2 -0
- package/index.js +20 -0
- package/index.js.map +1 -0
- package/package.json +50 -0
- package/presentation/CmsWorkflowsEditorView.d.ts +5 -0
- package/presentation/CmsWorkflowsEditorView.js +90 -0
- package/presentation/CmsWorkflowsEditorView.js.map +1 -0
- package/presentation/ContentEntryFormPresenterWorkflowDecorator.d.ts +24 -0
- package/presentation/ContentEntryFormPresenterWorkflowDecorator.js +67 -0
- package/presentation/ContentEntryFormPresenterWorkflowDecorator.js.map +1 -0
- package/presentation/TableRowMapperWorkflowDecorator.d.ts +11 -0
- package/presentation/TableRowMapperWorkflowDecorator.js +25 -0
- package/presentation/TableRowMapperWorkflowDecorator.js.map +1 -0
- package/presentation/WorkflowStateGetEntryFieldSelection.d.ts +8 -0
- package/presentation/WorkflowStateGetEntryFieldSelection.js +24 -0
- package/presentation/WorkflowStateGetEntryFieldSelection.js.map +1 -0
- package/presentation/WorkflowStateListEntriesFieldSelection.d.ts +8 -0
- package/presentation/WorkflowStateListEntriesFieldSelection.js +24 -0
- package/presentation/WorkflowStateListEntriesFieldSelection.js.map +1 -0
- package/presentation/cmsWorkflowsEditor/CmsWorkflowsEditorPresenter.d.ts +15 -0
- package/presentation/cmsWorkflowsEditor/CmsWorkflowsEditorPresenter.js +50 -0
- package/presentation/cmsWorkflowsEditor/CmsWorkflowsEditorPresenter.js.map +1 -0
- package/presentation/cmsWorkflowsEditor/abstractions.d.ts +19 -0
- package/presentation/cmsWorkflowsEditor/abstractions.js +5 -0
- package/presentation/cmsWorkflowsEditor/abstractions.js.map +1 -0
- package/presentation/cmsWorkflowsEditor/feature.d.ts +3 -0
- package/presentation/cmsWorkflowsEditor/feature.js +17 -0
- package/presentation/cmsWorkflowsEditor/feature.js.map +1 -0
- package/presentation/feature.d.ts +1 -0
- package/presentation/feature.js +21 -0
- package/presentation/feature.js.map +1 -0
- package/routes.d.ts +11 -0
- package/routes.js +21 -0
- package/routes.js.map +1 -0
- package/types.d.ts +10 -0
- package/types.js +0 -0
- package/utils/appName.d.ts +4 -0
- package/utils/appName.js +13 -0
- package/utils/appName.js.map +1 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { Sidebar } from "@webiny/admin-ui";
|
|
3
|
+
import { ReactComponent } from "@webiny/icons/flowchart.svg";
|
|
4
|
+
import { Components } from "@webiny/app-workflows";
|
|
5
|
+
import { ContentEntryListConfig } from "@webiny/app-headless-cms/admin/config/contentEntries/index.js";
|
|
6
|
+
import { IsModelPublishable } from "@webiny/app-headless-cms/exports/admin/cms.js";
|
|
7
|
+
import { useContentEntriesPresenter } from "@webiny/app-headless-cms/exports/admin/cms/entry/list.js";
|
|
8
|
+
import { createAppName } from "../../utils/appName.js";
|
|
9
|
+
const { Overlay: { WorkflowStateListAppOverlay: WorkflowStateListAppOverlay } } = Components;
|
|
10
|
+
const { Browser: Browser } = ContentEntryListConfig;
|
|
11
|
+
const ContentReviewsMenuItem = ()=>{
|
|
12
|
+
const presenter = useContentEntriesPresenter();
|
|
13
|
+
const model = presenter.vm.model;
|
|
14
|
+
const app = createAppName(model);
|
|
15
|
+
return /*#__PURE__*/ react.createElement(IsModelPublishable, null, /*#__PURE__*/ react.createElement(WorkflowStateListAppOverlay, {
|
|
16
|
+
app: app
|
|
17
|
+
}, ({ showOverlay })=>/*#__PURE__*/ react.createElement("div", {
|
|
18
|
+
className: "list-none"
|
|
19
|
+
}, /*#__PURE__*/ react.createElement(Sidebar.Item, {
|
|
20
|
+
onClick: showOverlay,
|
|
21
|
+
text: "Content Reviews",
|
|
22
|
+
icon: /*#__PURE__*/ react.createElement(Sidebar.Item.Icon, {
|
|
23
|
+
element: /*#__PURE__*/ react.createElement(ReactComponent, null),
|
|
24
|
+
label: "Content Reviews"
|
|
25
|
+
})
|
|
26
|
+
}))));
|
|
27
|
+
};
|
|
28
|
+
const CmsEntriesWorkflowStateListFooterMenu = ()=>/*#__PURE__*/ react.createElement(ContentEntryListConfig, null, /*#__PURE__*/ react.createElement(Browser.Sidebar.Footer, {
|
|
29
|
+
name: "content-reviews",
|
|
30
|
+
element: /*#__PURE__*/ react.createElement(ContentReviewsMenuItem, null)
|
|
31
|
+
}));
|
|
32
|
+
export { CmsEntriesWorkflowStateListFooterMenu };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=CmsEntriesWorkflowStateListFooterMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Components/CmsEntriesWorkflowStateList/CmsEntriesWorkflowStateListFooterMenu.js","sources":["../../../src/Components/CmsEntriesWorkflowStateList/CmsEntriesWorkflowStateListFooterMenu.tsx"],"sourcesContent":["import React from \"react\";\nimport { Sidebar } from \"@webiny/admin-ui\";\nimport { ReactComponent as WorkflowStateListIcon } from \"@webiny/icons/flowchart.svg\";\nimport { Components as WorkflowsComponents } from \"@webiny/app-workflows\";\nimport { ContentEntryListConfig } from \"@webiny/app-headless-cms/admin/config/contentEntries/index.js\";\nimport { IsModelPublishable } from \"@webiny/app-headless-cms/exports/admin/cms.js\";\nimport { useContentEntriesPresenter } from \"@webiny/app-headless-cms/exports/admin/cms/entry/list.js\";\nimport { createAppName } from \"~/utils/appName.js\";\n\nconst {\n Overlay: { WorkflowStateListAppOverlay }\n} = WorkflowsComponents;\n\nconst { Browser } = ContentEntryListConfig;\n\nconst ContentReviewsMenuItem = () => {\n const presenter = useContentEntriesPresenter();\n\n const model = presenter.vm.model;\n const app = createAppName(model);\n\n return (\n <IsModelPublishable>\n <WorkflowStateListAppOverlay app={app}>\n {({ showOverlay }) => {\n return (\n <div className={\"list-none\"}>\n <Sidebar.Item\n onClick={showOverlay}\n text={\"Content Reviews\"}\n icon={\n <Sidebar.Item.Icon\n element={<WorkflowStateListIcon />}\n label={\"Content Reviews\"}\n />\n }\n />\n </div>\n );\n }}\n </WorkflowStateListAppOverlay>\n </IsModelPublishable>\n );\n};\n\nexport const CmsEntriesWorkflowStateListFooterMenu = () => {\n return (\n <ContentEntryListConfig>\n <Browser.Sidebar.Footer name={\"content-reviews\"} element={<ContentReviewsMenuItem />} />\n </ContentEntryListConfig>\n );\n};\n"],"names":["WorkflowStateListAppOverlay","WorkflowsComponents","Browser","ContentEntryListConfig","ContentReviewsMenuItem","presenter","useContentEntriesPresenter","model","app","createAppName","IsModelPublishable","showOverlay","Sidebar","WorkflowStateListIcon","CmsEntriesWorkflowStateListFooterMenu"],"mappings":";;;;;;;;AASA,MAAM,EACF,SAAS,EAAEA,6BAAAA,2BAA2B,EAAE,EAC3C,GAAGC;AAEJ,MAAM,EAAEC,SAAAA,OAAO,EAAE,GAAGC;AAEpB,MAAMC,yBAAyB;IAC3B,MAAMC,YAAYC;IAElB,MAAMC,QAAQF,UAAU,EAAE,CAAC,KAAK;IAChC,MAAMG,MAAMC,cAAcF;IAE1B,OAAO,WAAP,GACI,oBAACG,oBAAkBA,MAAAA,WAAAA,GACf,oBAACV,6BAA2BA;QAAC,KAAKQ;OAC7B,CAAC,EAAEG,WAAW,EAAE,GACN,WAAP,GACI,oBAAC;YAAI,WAAW;yBACZ,oBAACC,QAAQ,IAAI;YACT,SAASD;YACT,MAAM;YACN,oBACI,oBAACC,QAAQ,IAAI,CAAC,IAAI;gBACd,uBAAS,oBAACC,gBAAqBA;gBAC/B,OAAO;;;AAU/C;AAEO,MAAMC,wCAAwC,IAC1C,WAAP,GACI,oBAACX,wBAAsBA,MAAAA,WAAAA,GACnB,oBAACD,QAAQ,OAAO,CAAC,MAAM;QAAC,MAAM;QAAmB,uBAAS,oBAACE,wBAAsBA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CmsEntriesWorkflowStateListFooterMenu } from "./CmsEntriesWorkflowStateListFooterMenu.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CmsEntriesWorkflowStateListFooterMenu } from "./CmsEntriesWorkflowStateListFooterMenu.js";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import react, { useCallback } from "react";
|
|
2
|
+
import { useFeature, useRoute } from "@webiny/app";
|
|
3
|
+
import { useToast } from "@webiny/admin-ui";
|
|
4
|
+
import { InternalContentEntryEditorConfig, usePermission } from "@webiny/app-headless-cms";
|
|
5
|
+
import { useContentEntryFormPresenter } from "@webiny/app-headless-cms/presentation/contentEntries/form/useContentEntryFormPresenter.js";
|
|
6
|
+
import { RevisionsListFeature } from "@webiny/app-headless-cms/presentation/contentEntries/revisionsList/feature.js";
|
|
7
|
+
import { ReactComponent } from "@webiny/icons/new_releases.svg";
|
|
8
|
+
import { IsModelPublishable } from "@webiny/app-headless-cms/exports/admin/cms.js";
|
|
9
|
+
import { OptionsMenuItem } from "@webiny/app-admin";
|
|
10
|
+
const { Actions: Actions } = InternalContentEntryEditorConfig;
|
|
11
|
+
const CreateNewRevisionMenuItem = ()=>{
|
|
12
|
+
const toast = useToast();
|
|
13
|
+
const { setRouteParams } = useRoute();
|
|
14
|
+
const { canEdit } = usePermission();
|
|
15
|
+
const formPresenter = useContentEntryFormPresenter();
|
|
16
|
+
const { presenter: revisionsPresenter } = useFeature(RevisionsListFeature);
|
|
17
|
+
const entry = formPresenter.vm.entry;
|
|
18
|
+
const onClick = useCallback(async ()=>{
|
|
19
|
+
if (!entry) return;
|
|
20
|
+
const newEntry = await revisionsPresenter.createRevision(entry.id);
|
|
21
|
+
if (!newEntry) return void toast.showWarningToast({
|
|
22
|
+
title: "Could not create a new revision."
|
|
23
|
+
});
|
|
24
|
+
setRouteParams((params)=>({
|
|
25
|
+
...params,
|
|
26
|
+
id: newEntry.id
|
|
27
|
+
}));
|
|
28
|
+
}, [
|
|
29
|
+
entry,
|
|
30
|
+
revisionsPresenter
|
|
31
|
+
]);
|
|
32
|
+
if (!entry || !canEdit(entry, "cms.contentEntry")) return null;
|
|
33
|
+
return /*#__PURE__*/ react.createElement(OptionsMenuItem, {
|
|
34
|
+
icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
|
|
35
|
+
disabled: !entry.id,
|
|
36
|
+
label: "Create New Revision",
|
|
37
|
+
onAction: onClick,
|
|
38
|
+
"data-testid": "cms.content-form.header.createNewRevision"
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
const CmsEntryFormCreateNewRevisionButton = ()=>/*#__PURE__*/ react.createElement(InternalContentEntryEditorConfig, null, /*#__PURE__*/ react.createElement(IsModelPublishable, null, /*#__PURE__*/ react.createElement(Actions.MenuItemAction, {
|
|
42
|
+
name: "createNewRevision",
|
|
43
|
+
element: /*#__PURE__*/ react.createElement(CreateNewRevisionMenuItem, null)
|
|
44
|
+
})));
|
|
45
|
+
export { CmsEntryFormCreateNewRevisionButton };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=CmsEntryFormCreateNewRevisionButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Components/ContentEntryForm/CmsEntryFormCreateNewRevisionButton.js","sources":["../../../src/Components/ContentEntryForm/CmsEntryFormCreateNewRevisionButton.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport { useFeature } from \"@webiny/app\";\nimport { useRoute } from \"@webiny/app\";\nimport { useToast } from \"@webiny/admin-ui\";\nimport { InternalContentEntryEditorConfig, usePermission } from \"@webiny/app-headless-cms\";\nimport { useContentEntryFormPresenter } from \"@webiny/app-headless-cms/presentation/contentEntries/form/useContentEntryFormPresenter.js\";\nimport { RevisionsListFeature } from \"@webiny/app-headless-cms/presentation/contentEntries/revisionsList/feature.js\";\nimport { ReactComponent as NewReleaseIcon } from \"@webiny/icons/new_releases.svg\";\nimport { IsModelPublishable } from \"@webiny/app-headless-cms/exports/admin/cms.js\";\nimport { OptionsMenuItem } from \"@webiny/app-admin\";\n\nconst { Actions } = InternalContentEntryEditorConfig;\n\nconst CreateNewRevisionMenuItem = () => {\n const toast = useToast();\n const { setRouteParams } = useRoute();\n const { canEdit } = usePermission();\n const formPresenter = useContentEntryFormPresenter();\n const { presenter: revisionsPresenter } = useFeature(RevisionsListFeature);\n\n const entry = formPresenter.vm.entry;\n\n const onClick = useCallback(async () => {\n if (!entry) {\n return;\n }\n\n const newEntry = await revisionsPresenter.createRevision(entry.id);\n\n if (!newEntry) {\n toast.showWarningToast({\n title: \"Could not create a new revision.\"\n });\n return;\n }\n\n setRouteParams(params => {\n return { ...params, id: newEntry.id };\n });\n }, [entry, revisionsPresenter]);\n\n if (!entry || !canEdit(entry, \"cms.contentEntry\")) {\n return null;\n }\n\n return (\n <OptionsMenuItem\n icon={<NewReleaseIcon />}\n disabled={!entry.id}\n label={`Create New Revision`}\n onAction={onClick}\n data-testid={\"cms.content-form.header.createNewRevision\"}\n />\n );\n};\n\nexport const CmsEntryFormCreateNewRevisionButton = () => {\n return (\n <InternalContentEntryEditorConfig>\n <IsModelPublishable>\n <Actions.MenuItemAction\n name={\"createNewRevision\"}\n element={<CreateNewRevisionMenuItem />}\n />\n </IsModelPublishable>\n </InternalContentEntryEditorConfig>\n );\n};\n"],"names":["Actions","InternalContentEntryEditorConfig","CreateNewRevisionMenuItem","toast","useToast","setRouteParams","useRoute","canEdit","usePermission","formPresenter","useContentEntryFormPresenter","revisionsPresenter","useFeature","RevisionsListFeature","entry","onClick","useCallback","newEntry","params","OptionsMenuItem","NewReleaseIcon","CmsEntryFormCreateNewRevisionButton","IsModelPublishable"],"mappings":";;;;;;;;;AAWA,MAAM,EAAEA,SAAAA,OAAO,EAAE,GAAGC;AAEpB,MAAMC,4BAA4B;IAC9B,MAAMC,QAAQC;IACd,MAAM,EAAEC,cAAc,EAAE,GAAGC;IAC3B,MAAM,EAAEC,OAAO,EAAE,GAAGC;IACpB,MAAMC,gBAAgBC;IACtB,MAAM,EAAE,WAAWC,kBAAkB,EAAE,GAAGC,WAAWC;IAErD,MAAMC,QAAQL,cAAc,EAAE,CAAC,KAAK;IAEpC,MAAMM,UAAUC,YAAY;QACxB,IAAI,CAACF,OACD;QAGJ,MAAMG,WAAW,MAAMN,mBAAmB,cAAc,CAACG,MAAM,EAAE;QAEjE,IAAI,CAACG,UAAU,YACXd,MAAM,gBAAgB,CAAC;YACnB,OAAO;QACX;QAIJE,eAAea,CAAAA,SACJ;gBAAE,GAAGA,MAAM;gBAAE,IAAID,SAAS,EAAE;YAAC;IAE5C,GAAG;QAACH;QAAOH;KAAmB;IAE9B,IAAI,CAACG,SAAS,CAACP,QAAQO,OAAO,qBAC1B,OAAO;IAGX,OAAO,WAAP,GACI,oBAACK,iBAAeA;QACZ,oBAAM,oBAACC,gBAAcA;QACrB,UAAU,CAACN,MAAM,EAAE;QACnB,OAAO;QACP,UAAUC;QACV,eAAa;;AAGzB;AAEO,MAAMM,sCAAsC,IACxC,WAAP,GACI,oBAACpB,kCAAgCA,MAAAA,WAAAA,GAC7B,oBAACqB,oBAAkBA,MAAAA,WAAAA,GACf,oBAACtB,QAAQ,cAAc;QACnB,MAAM;QACN,uBAAS,oBAACE,2BAAyBA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { ContentEntryEditorConfig } from "@webiny/app-headless-cms";
|
|
3
|
+
import { useWorkflowState } from "@webiny/app-workflows";
|
|
4
|
+
const { Actions: Actions } = ContentEntryEditorConfig;
|
|
5
|
+
const { MenuItemAction: MenuItemAction } = Actions;
|
|
6
|
+
const OverrideScheduleMenuItemAction = (props)=>{
|
|
7
|
+
const { presenter } = useWorkflowState();
|
|
8
|
+
if (!presenter.vm.hasWorkflow || presenter.vm.isApproved) ;
|
|
9
|
+
else if ("schedule" === props.name) return null;
|
|
10
|
+
return props.children;
|
|
11
|
+
};
|
|
12
|
+
const CmsEntryFormScheduleMenuItemAction = MenuItemAction.createDecorator((Original)=>function(props) {
|
|
13
|
+
return /*#__PURE__*/ react.createElement(Original, {
|
|
14
|
+
...props,
|
|
15
|
+
element: /*#__PURE__*/ react.createElement(OverrideScheduleMenuItemAction, {
|
|
16
|
+
name: props.name
|
|
17
|
+
}, props.element)
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
export { CmsEntryFormScheduleMenuItemAction };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=CmsEntryFormScheduleMenuItemAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Components/ContentEntryForm/CmsEntryFormScheduleMenuItemAction.js","sources":["../../../src/Components/ContentEntryForm/CmsEntryFormScheduleMenuItemAction.tsx"],"sourcesContent":["import React from \"react\";\nimport { ContentEntryEditorConfig } from \"@webiny/app-headless-cms\";\nimport { useWorkflowState } from \"@webiny/app-workflows\";\n\nconst { Actions } = ContentEntryEditorConfig;\nconst { MenuItemAction } = Actions;\n\ninterface IOverrideScheduleMenuItemActionProps {\n name: string;\n children: React.ReactElement;\n}\n\nconst OverrideScheduleMenuItemAction = (props: IOverrideScheduleMenuItemActionProps) => {\n const { presenter } = useWorkflowState();\n /**\n * If there is no workflow state or state is approved, we simply render the original element.\n * This is to ensure that no button will be shown if workflow state is active.\n */\n if (!presenter.vm.hasWorkflow || presenter.vm.isApproved) {\n return props.children;\n } else if (props.name === \"schedule\") {\n return null;\n }\n return props.children;\n};\n/**\n * There is a possibility that this decorator will not do anything, because scheduler is not turned on.\n */\nexport const CmsEntryFormScheduleMenuItemAction = MenuItemAction.createDecorator(Original => {\n return function WorkflowCmsEntryScheduleMenuItemAction(props) {\n return (\n <Original\n {...props}\n element={\n <OverrideScheduleMenuItemAction name={props.name}>\n {props.element}\n </OverrideScheduleMenuItemAction>\n }\n />\n );\n };\n});\n"],"names":["Actions","ContentEntryEditorConfig","MenuItemAction","OverrideScheduleMenuItemAction","props","presenter","useWorkflowState","CmsEntryFormScheduleMenuItemAction","Original"],"mappings":";;;AAIA,MAAM,EAAEA,SAAAA,OAAO,EAAE,GAAGC;AACpB,MAAM,EAAEC,gBAAAA,cAAc,EAAE,GAAGF;AAO3B,MAAMG,iCAAiC,CAACC;IACpC,MAAM,EAAEC,SAAS,EAAE,GAAGC;IAKtB,IAAI,CAACD,UAAU,EAAE,CAAC,WAAW,IAAIA,UAAU,EAAE,CAAC,UAAU;SAEjD,IAAID,AAAe,eAAfA,MAAM,IAAI,EACjB,OAAO;IAEX,OAAOA,MAAM,QAAQ;AACzB;AAIO,MAAMG,qCAAqCL,eAAe,eAAe,CAACM,CAAAA,WACtE,SAAgDJ,KAAK;QACxD,OAAO,WAAP,GACI,oBAACI,UAAAA;YACI,GAAGJ,KAAK;YACT,uBACI,oBAACD,gCAA8BA;gBAAC,MAAMC,MAAM,IAAI;eAC3CA,MAAM,OAAO;;IAKlC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { Components } from "@webiny/app-workflows";
|
|
3
|
+
import { InternalContentEntryEditorConfig } from "@webiny/app-headless-cms";
|
|
4
|
+
const { ContentReview: { WorkflowStateTooltip: WorkflowStateTooltip } } = Components;
|
|
5
|
+
const { Actions: Actions } = InternalContentEntryEditorConfig;
|
|
6
|
+
const CmsEntryFormTooltipButton = ()=>/*#__PURE__*/ react.createElement(InternalContentEntryEditorConfig, null, /*#__PURE__*/ react.createElement(Actions.ButtonAction, {
|
|
7
|
+
before: "save",
|
|
8
|
+
name: "workflowStateTooltip",
|
|
9
|
+
element: /*#__PURE__*/ react.createElement(WorkflowStateTooltip, null)
|
|
10
|
+
}));
|
|
11
|
+
export { CmsEntryFormTooltipButton };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=CmsEntryFormTooltipButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Components/ContentEntryForm/CmsEntryFormTooltipButton.js","sources":["../../../src/Components/ContentEntryForm/CmsEntryFormTooltipButton.tsx"],"sourcesContent":["import React from \"react\";\nimport { Components } from \"@webiny/app-workflows\";\nimport { InternalContentEntryEditorConfig } from \"@webiny/app-headless-cms\";\n\nconst {\n ContentReview: { WorkflowStateTooltip }\n} = Components;\n\nconst { Actions } = InternalContentEntryEditorConfig;\n\nexport const CmsEntryFormTooltipButton = () => {\n return (\n <InternalContentEntryEditorConfig>\n <Actions.ButtonAction\n before={\"save\"}\n name={\"workflowStateTooltip\"}\n element={<WorkflowStateTooltip />}\n />\n </InternalContentEntryEditorConfig>\n );\n};\n"],"names":["WorkflowStateTooltip","Components","Actions","InternalContentEntryEditorConfig","CmsEntryFormTooltipButton"],"mappings":";;;AAIA,MAAM,EACF,eAAe,EAAEA,sBAAAA,oBAAoB,EAAE,EAC1C,GAAGC;AAEJ,MAAM,EAAEC,SAAAA,OAAO,EAAE,GAAGC;AAEb,MAAMC,4BAA4B,IAC9B,WAAP,GACI,oBAACD,kCAAgCA,MAAAA,WAAAA,GAC7B,oBAACD,QAAQ,YAAY;QACjB,QAAQ;QACR,MAAM;QACN,uBAAS,oBAACF,sBAAoBA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { observer } from "mobx-react-lite";
|
|
3
|
+
import { Alert } from "@webiny/admin-ui";
|
|
4
|
+
import { ContentEntryFormContent } from "@webiny/app-headless-cms/presentation/contentEntries/views/layout/index.js";
|
|
5
|
+
import { useContentEntryFormPresenter } from "@webiny/app-headless-cms/presentation/contentEntries/form/useContentEntryFormPresenter.js";
|
|
6
|
+
import { Components, useWorkflowState } from "@webiny/app-workflows";
|
|
7
|
+
import { CMS_MODEL_SINGLETON_TAG } from "@webiny/app-headless-cms-common";
|
|
8
|
+
const { ContentReview: { WorkflowStateBar: WorkflowStateBar } } = Components;
|
|
9
|
+
const ContentEntryFormWorkflow = ContentEntryFormContent.createDecorator((Original)=>observer(function(props) {
|
|
10
|
+
const formPresenter = useContentEntryFormPresenter();
|
|
11
|
+
const { presenter } = useWorkflowState();
|
|
12
|
+
const model = formPresenter.vm.model;
|
|
13
|
+
const isSingleton = model.tags.includes(CMS_MODEL_SINGLETON_TAG);
|
|
14
|
+
if (isSingleton || formPresenter.vm.isNewEntry || !presenter.vm.hasWorkflow) return /*#__PURE__*/ react.createElement(Original, props);
|
|
15
|
+
return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement("div", {
|
|
16
|
+
className: "max-w-screen bg-white p-sm border-solid border-b-sm border-neutral-dimmed"
|
|
17
|
+
}, /*#__PURE__*/ react.createElement(WorkflowStateBar, null), presenter.vm.hasState ? /*#__PURE__*/ react.createElement(Alert, {
|
|
18
|
+
type: "danger",
|
|
19
|
+
className: "mt-sm"
|
|
20
|
+
}, "Any changes you do on the entry will not be stored!") : null), /*#__PURE__*/ react.createElement(Original, props));
|
|
21
|
+
}));
|
|
22
|
+
export { ContentEntryFormWorkflow };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=ContentEntryFormWorkflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Components/ContentEntryForm/ContentEntryFormWorkflow.js","sources":["../../../src/Components/ContentEntryForm/ContentEntryFormWorkflow.tsx"],"sourcesContent":["import React from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { Alert } from \"@webiny/admin-ui\";\nimport { ContentEntryFormContent } from \"@webiny/app-headless-cms/presentation/contentEntries/views/layout/index.js\";\nimport { useContentEntryFormPresenter } from \"@webiny/app-headless-cms/presentation/contentEntries/form/useContentEntryFormPresenter.js\";\nimport { useWorkflowState } from \"@webiny/app-workflows\";\nimport { Components } from \"@webiny/app-workflows\";\nimport { CMS_MODEL_SINGLETON_TAG } from \"@webiny/app-headless-cms-common\";\n\nconst {\n ContentReview: { WorkflowStateBar }\n} = Components;\n\nexport const ContentEntryFormWorkflow = ContentEntryFormContent.createDecorator(Original => {\n return observer(function ContentEntryFormWorkflowDecorator(props) {\n const formPresenter = useContentEntryFormPresenter();\n const { presenter } = useWorkflowState();\n const model = formPresenter.vm.model;\n\n const isSingleton = model.tags.includes(CMS_MODEL_SINGLETON_TAG);\n\n if (isSingleton || formPresenter.vm.isNewEntry || !presenter.vm.hasWorkflow) {\n return <Original {...props} />;\n }\n\n return (\n <>\n <div\n className={\n \"max-w-screen bg-white p-sm border-solid border-b-sm border-neutral-dimmed\"\n }\n >\n <WorkflowStateBar />\n {presenter.vm.hasState ? (\n <Alert type=\"danger\" className={\"mt-sm\"}>\n Any changes you do on the entry will not be stored!\n </Alert>\n ) : null}\n </div>\n <Original {...props} />\n </>\n );\n });\n});\n"],"names":["WorkflowStateBar","Components","ContentEntryFormWorkflow","ContentEntryFormContent","Original","observer","props","formPresenter","useContentEntryFormPresenter","presenter","useWorkflowState","model","isSingleton","CMS_MODEL_SINGLETON_TAG","Alert"],"mappings":";;;;;;;AASA,MAAM,EACF,eAAe,EAAEA,kBAAAA,gBAAgB,EAAE,EACtC,GAAGC;AAEG,MAAMC,2BAA2BC,wBAAwB,eAAe,CAACC,CAAAA,WACrEC,SAAS,SAA2CC,KAAK;QAC5D,MAAMC,gBAAgBC;QACtB,MAAM,EAAEC,SAAS,EAAE,GAAGC;QACtB,MAAMC,QAAQJ,cAAc,EAAE,CAAC,KAAK;QAEpC,MAAMK,cAAcD,MAAM,IAAI,CAAC,QAAQ,CAACE;QAExC,IAAID,eAAeL,cAAc,EAAE,CAAC,UAAU,IAAI,CAACE,UAAU,EAAE,CAAC,WAAW,EACvE,OAAO,WAAP,GAAO,oBAACL,UAAaE;QAGzB,OAAO,WAAP,GACI,wDACI,oBAAC;YACG,WACI;yBAGJ,oBAACN,kBAAgBA,OAChBS,UAAU,EAAE,CAAC,QAAQ,GAAG,WAAH,GAClB,oBAACK,OAAKA;YAAC,MAAK;YAAS,WAAW;WAAS,yDAGzC,qBAER,oBAACV,UAAaE;IAG1B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { ContentEntryFormWorkflow } from "./ContentEntryFormWorkflow.js";
|
|
2
|
+
export { CmsEntryFormTooltipButton } from "./CmsEntryFormTooltipButton.js";
|
|
3
|
+
export { CmsEntryFormScheduleMenuItemAction } from "./CmsEntryFormScheduleMenuItemAction.js";
|
|
4
|
+
export { CmsEntryFormCreateNewRevisionButton } from "./CmsEntryFormCreateNewRevisionButton.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { ContentEntryFormWorkflow } from "./ContentEntryFormWorkflow.js";
|
|
2
|
+
export { CmsEntryFormTooltipButton } from "./CmsEntryFormTooltipButton.js";
|
|
3
|
+
export { CmsEntryFormScheduleMenuItemAction } from "./CmsEntryFormScheduleMenuItemAction.js";
|
|
4
|
+
export { CmsEntryFormCreateNewRevisionButton } from "./CmsEntryFormCreateNewRevisionButton.js";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import react, { useCallback } from "react";
|
|
2
|
+
import { DropdownMenu, Icon } from "@webiny/admin-ui";
|
|
3
|
+
import { Components } from "@webiny/app-workflows";
|
|
4
|
+
import { ReactComponent } from "@webiny/icons/open_in_new.svg";
|
|
5
|
+
import { useRouter } from "@webiny/app";
|
|
6
|
+
import { Routes } from "@webiny/app-headless-cms/routes.js";
|
|
7
|
+
import { isCmsAppName, parseAppName } from "../../utils/appName.js";
|
|
8
|
+
const { OpenInNewWindow: OpenInNewWindow } = Components.List.Options;
|
|
9
|
+
const OpenInNewWindow_ListOpenInNewWindow = OpenInNewWindow.createDecorator((Original)=>function(props) {
|
|
10
|
+
const { state } = props;
|
|
11
|
+
const { getLink } = useRouter();
|
|
12
|
+
const onClick = useCallback(()=>{
|
|
13
|
+
const modelId = parseAppName(state.app);
|
|
14
|
+
const url = getLink(Routes.ContentEntries.List, {
|
|
15
|
+
modelId,
|
|
16
|
+
id: state.targetRevisionId,
|
|
17
|
+
folderId: "root"
|
|
18
|
+
});
|
|
19
|
+
const goTo = `${window.location.origin}${url}`;
|
|
20
|
+
window.open(goTo, "_blank");
|
|
21
|
+
}, [
|
|
22
|
+
state.id
|
|
23
|
+
]);
|
|
24
|
+
if (false === isCmsAppName(state.app)) return /*#__PURE__*/ react.createElement(Original, props);
|
|
25
|
+
return /*#__PURE__*/ react.createElement(DropdownMenu.Item, {
|
|
26
|
+
icon: /*#__PURE__*/ react.createElement(Icon, {
|
|
27
|
+
icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
|
|
28
|
+
label: "Open In New Window"
|
|
29
|
+
}),
|
|
30
|
+
text: "Open in New Window",
|
|
31
|
+
onClick: onClick
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
export { OpenInNewWindow_ListOpenInNewWindow as ListOpenInNewWindow };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=OpenInNewWindow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Components/OptionItem/OpenInNewWindow.js","sources":["../../../src/Components/OptionItem/OpenInNewWindow.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport { DropdownMenu, Icon } from \"@webiny/admin-ui\";\nimport { Components } from \"@webiny/app-workflows\";\nimport { ReactComponent as OpenInNewIcon } from \"@webiny/icons/open_in_new.svg\";\nimport { useRouter } from \"@webiny/app\";\nimport { Routes } from \"@webiny/app-headless-cms/routes.js\";\nimport { isCmsAppName, parseAppName } from \"~/utils/appName.js\";\n\nconst { OpenInNewWindow } = Components.List.Options;\n\nexport const ListOpenInNewWindow = OpenInNewWindow.createDecorator(Original => {\n return function ListOpenInNewWindow(props) {\n const { state } = props;\n\n const { getLink } = useRouter();\n const onClick = useCallback(() => {\n const modelId = parseAppName(state.app);\n const url = getLink(Routes.ContentEntries.List, {\n modelId,\n id: state.targetRevisionId,\n // TODO figure out how to load folderId\n folderId: \"root\"\n });\n\n const goTo = `${window.location.origin}${url}`;\n\n window.open(goTo, \"_blank\");\n }, [state.id]);\n\n if (isCmsAppName(state.app) === false) {\n return <Original {...props} />;\n }\n\n return (\n <DropdownMenu.Item\n icon={<Icon icon={<OpenInNewIcon />} label={\"Open In New Window\"} />}\n text={\"Open in New Window\"}\n onClick={onClick}\n />\n );\n };\n});\n"],"names":["OpenInNewWindow","Components","ListOpenInNewWindow","Original","props","state","getLink","useRouter","onClick","useCallback","modelId","parseAppName","url","Routes","goTo","window","isCmsAppName","DropdownMenu","Icon","OpenInNewIcon"],"mappings":";;;;;;;AAQA,MAAM,EAAEA,iBAAAA,eAAe,EAAE,GAAGC,WAAW,IAAI,CAAC,OAAO;AAE5C,MAAMC,sCAAsBF,gBAAgB,eAAe,CAACG,CAAAA,WACxD,SAA6BC,KAAK;QACrC,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAElB,MAAM,EAAEE,OAAO,EAAE,GAAGC;QACpB,MAAMC,UAAUC,YAAY;YACxB,MAAMC,UAAUC,aAAaN,MAAM,GAAG;YACtC,MAAMO,MAAMN,QAAQO,OAAO,cAAc,CAAC,IAAI,EAAE;gBAC5CH;gBACA,IAAIL,MAAM,gBAAgB;gBAE1B,UAAU;YACd;YAEA,MAAMS,OAAO,GAAGC,OAAO,QAAQ,CAAC,MAAM,GAAGH,KAAK;YAE9CG,OAAO,IAAI,CAACD,MAAM;QACtB,GAAG;YAACT,MAAM,EAAE;SAAC;QAEb,IAAIW,AAA4B,UAA5BA,aAAaX,MAAM,GAAG,GACtB,OAAO,WAAP,GAAO,oBAACF,UAAaC;QAGzB,OAAO,WAAP,GACI,oBAACa,aAAa,IAAI;YACd,oBAAM,oBAACC,MAAIA;gBAAC,oBAAM,oBAACC,gBAAaA;gBAAK,OAAO;;YAC5C,MAAM;YACN,SAASX;;IAGrB"}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Webiny
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @webiny/app-headless-cms-workflows
|
|
2
|
+
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
> This package is part of the [Webiny](https://www.webiny.com) monorepo.
|
|
5
|
+
> It’s **included in every Webiny project by default** and is not meant to be used as a standalone package.
|
|
6
|
+
|
|
7
|
+
📘 **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
_This README file is automatically generated during the publish process._
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import react, { Suspense } from "react";
|
|
2
|
+
import { Routes } from "../routes.js";
|
|
3
|
+
import react_helmet from "react-helmet";
|
|
4
|
+
import { i18n } from "@webiny/app/i18n/index.js";
|
|
5
|
+
import { AdminConfig, AdminLayout, SecureRoute } from "@webiny/app-admin";
|
|
6
|
+
import { OverlayLoader } from "@webiny/admin-ui";
|
|
7
|
+
import { useCanUseWorkflows } from "@webiny/app-workflows";
|
|
8
|
+
import { CmsWorkflowsEditorMenu, CmsWorkflowsEditorView } from "../presentation/CmsWorkflowsEditorView.js";
|
|
9
|
+
const t = i18n.namespace("HeadlessCms.Workflows.Editor");
|
|
10
|
+
const Loader = ({ children, ...props })=>/*#__PURE__*/ react.createElement(Suspense, {
|
|
11
|
+
fallback: /*#__PURE__*/ react.createElement(OverlayLoader, null)
|
|
12
|
+
}, /*#__PURE__*/ react.cloneElement(children, props));
|
|
13
|
+
const { Route: Route } = AdminConfig;
|
|
14
|
+
const CmsWorkflowsEditor = ()=>{
|
|
15
|
+
const { canUseWorkflows } = useCanUseWorkflows();
|
|
16
|
+
if (!canUseWorkflows) return null;
|
|
17
|
+
return /*#__PURE__*/ react.createElement(AdminConfig, null, /*#__PURE__*/ react.createElement(Route, {
|
|
18
|
+
route: Routes.ContentModels.Workflows,
|
|
19
|
+
element: /*#__PURE__*/ react.createElement(SecureRoute, {
|
|
20
|
+
permission: "cms.contentModel"
|
|
21
|
+
}, /*#__PURE__*/ react.createElement(AdminLayout, null, /*#__PURE__*/ react.createElement(react_helmet, null, /*#__PURE__*/ react.createElement("title", null, t`Workflows`)), /*#__PURE__*/ react.createElement(AdminConfig.Breadcrumb, {
|
|
22
|
+
name: "cms",
|
|
23
|
+
label: "Headless CMS"
|
|
24
|
+
}), /*#__PURE__*/ react.createElement(AdminConfig.Breadcrumb, {
|
|
25
|
+
name: "cms.workflows",
|
|
26
|
+
label: "Workflows"
|
|
27
|
+
}), /*#__PURE__*/ react.createElement(Loader, null, /*#__PURE__*/ react.createElement(CmsWorkflowsEditorView, null))))
|
|
28
|
+
}), /*#__PURE__*/ react.createElement(CmsWorkflowsEditorMenu, null));
|
|
29
|
+
};
|
|
30
|
+
export { CmsWorkflowsEditor };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=CmsWorkflowsEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Routes/CmsWorkflowsEditor.js","sources":["../../src/Routes/CmsWorkflowsEditor.tsx"],"sourcesContent":["import React, { Suspense } from \"react\";\nimport { Routes } from \"~/routes.js\";\nimport Helmet from \"react-helmet\";\nimport { i18n } from \"@webiny/app/i18n/index.js\";\nimport { SecureRoute } from \"@webiny/app-admin\";\nimport { OverlayLoader } from \"@webiny/admin-ui\";\nimport { AdminConfig, AdminLayout } from \"@webiny/app-admin\";\nimport { useCanUseWorkflows } from \"@webiny/app-workflows\";\nimport { CmsWorkflowsEditorView } from \"~/presentation/CmsWorkflowsEditorView.js\";\nimport { CmsWorkflowsEditorMenu } from \"~/presentation/CmsWorkflowsEditorView.js\";\n\nconst t = i18n.namespace(\"HeadlessCms.Workflows.Editor\");\n\ninterface LoaderProps {\n children: React.ReactNode;\n}\n\nconst Loader = ({ children, ...props }: LoaderProps) => (\n <Suspense fallback={<OverlayLoader />}>\n {React.cloneElement(children as unknown as React.ReactElement, props)}\n </Suspense>\n);\n\nconst { Route } = AdminConfig;\n\nexport const CmsWorkflowsEditor = () => {\n const { canUseWorkflows } = useCanUseWorkflows();\n if (!canUseWorkflows) {\n return null;\n }\n return (\n <AdminConfig>\n <Route\n route={Routes.ContentModels.Workflows}\n element={\n <SecureRoute permission={\"cms.contentModel\"}>\n <AdminLayout>\n <Helmet>\n <title>{t`Workflows`}</title>\n </Helmet>\n <AdminConfig.Breadcrumb name={\"cms\"} label={\"Headless CMS\"} />\n <AdminConfig.Breadcrumb name={\"cms.workflows\"} label={\"Workflows\"} />\n <Loader>\n <CmsWorkflowsEditorView />\n </Loader>\n </AdminLayout>\n </SecureRoute>\n }\n />\n <CmsWorkflowsEditorMenu />\n </AdminConfig>\n );\n};\n"],"names":["t","i18n","Loader","children","props","Suspense","OverlayLoader","React","Route","AdminConfig","CmsWorkflowsEditor","canUseWorkflows","useCanUseWorkflows","Routes","SecureRoute","AdminLayout","Helmet","CmsWorkflowsEditorView","CmsWorkflowsEditorMenu"],"mappings":";;;;;;;;AAWA,MAAMA,IAAIC,KAAK,SAAS,CAAC;AAMzB,MAAMC,SAAS,CAAC,EAAEC,QAAQ,EAAE,GAAGC,OAAoB,iBAC/C,oBAACC,UAAQA;QAAC,wBAAU,oBAACC,eAAaA;qBAC7BC,MAAAA,YAAkB,CAACJ,UAA2CC;AAIvE,MAAM,EAAEI,OAAAA,KAAK,EAAE,GAAGC;AAEX,MAAMC,qBAAqB;IAC9B,MAAM,EAAEC,eAAe,EAAE,GAAGC;IAC5B,IAAI,CAACD,iBACD,OAAO;IAEX,OAAO,WAAP,GACI,oBAACF,aAAWA,MAAAA,WAAAA,GACR,oBAACD,OAAKA;QACF,OAAOK,OAAO,aAAa,CAAC,SAAS;QACrC,uBACI,oBAACC,aAAWA;YAAC,YAAY;yBACrB,oBAACC,aAAWA,MAAAA,WAAAA,GACR,oBAACC,cAAMA,MAAAA,WAAAA,GACH,oBAAC,eAAOhB,CAAC,CAAC,SAAS,CAAC,kBAExB,oBAACS,YAAY,UAAU;YAAC,MAAM;YAAO,OAAO;0BAC5C,oBAACA,YAAY,UAAU;YAAC,MAAM;YAAiB,OAAO;0BACtD,oBAACP,QAAMA,MAAAA,WAAAA,GACH,oBAACe,wBAAsBA;sBAM3C,oBAACC,wBAAsBA;AAGnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CmsWorkflowsEditor } from "./CmsWorkflowsEditor.js";
|
package/Routes/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CmsWorkflowsEditor } from "./CmsWorkflowsEditor.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ContentEntriesCacheProvider } from "@webiny/app-headless-cms/features/contentEntry/abstractions.js";
|
|
2
|
+
import { WorkflowStateChangedHandler, type WorkflowStateChangedEvent } from "@webiny/app-workflows/domain/events.js";
|
|
3
|
+
declare class WorkflowStateCacheHandlerImpl implements WorkflowStateChangedHandler.Interface {
|
|
4
|
+
private cacheProvider;
|
|
5
|
+
constructor(cacheProvider: ContentEntriesCacheProvider.Interface);
|
|
6
|
+
handle(event: WorkflowStateChangedEvent): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare const WorkflowStateCacheHandler: typeof WorkflowStateCacheHandlerImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/app/features/eventPublisher").IEventHandler<WorkflowStateChangedEvent>>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { parseIdentifier } from "@webiny/utils/parseIdentifier.js";
|
|
2
|
+
import { ContentEntriesCacheProvider } from "@webiny/app-headless-cms/features/contentEntry/abstractions.js";
|
|
3
|
+
import { WorkflowStateChangedHandler } from "@webiny/app-workflows/domain/events.js";
|
|
4
|
+
function getModelIdFromAppName(app) {
|
|
5
|
+
const matched = app.match(/^cms\.([a-zA-Z0-9_-]+)$/);
|
|
6
|
+
return matched ? matched[1] : null;
|
|
7
|
+
}
|
|
8
|
+
function toWorkflowStateValues(state) {
|
|
9
|
+
if (!state) return null;
|
|
10
|
+
return {
|
|
11
|
+
workflowId: state.id,
|
|
12
|
+
stepId: state.currentStep.id,
|
|
13
|
+
stepName: state.currentStep.title,
|
|
14
|
+
state: state.state
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
class WorkflowStateCacheHandlerImpl {
|
|
18
|
+
constructor(cacheProvider){
|
|
19
|
+
this.cacheProvider = cacheProvider;
|
|
20
|
+
}
|
|
21
|
+
async handle(event) {
|
|
22
|
+
const { app, targetRevisionId, state } = event.payload;
|
|
23
|
+
const modelId = getModelIdFromAppName(app);
|
|
24
|
+
if (!modelId) return;
|
|
25
|
+
const { id: entryId } = parseIdentifier(targetRevisionId);
|
|
26
|
+
const cache = this.cacheProvider.get(modelId);
|
|
27
|
+
const workflowValues = toWorkflowStateValues(state);
|
|
28
|
+
cache.updateItems((entry)=>{
|
|
29
|
+
if (entry.entryId !== entryId) return entry;
|
|
30
|
+
return {
|
|
31
|
+
...entry,
|
|
32
|
+
meta: {
|
|
33
|
+
...entry.meta,
|
|
34
|
+
system: {
|
|
35
|
+
workflow: workflowValues
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const WorkflowStateCacheHandler = WorkflowStateChangedHandler.createImplementation({
|
|
43
|
+
implementation: WorkflowStateCacheHandlerImpl,
|
|
44
|
+
dependencies: [
|
|
45
|
+
ContentEntriesCacheProvider
|
|
46
|
+
]
|
|
47
|
+
});
|
|
48
|
+
export { WorkflowStateCacheHandler };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=WorkflowStateCacheHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/WorkflowStateCacheHandler.js","sources":["../../src/features/WorkflowStateCacheHandler.ts"],"sourcesContent":["import { parseIdentifier } from \"@webiny/utils/parseIdentifier.js\";\nimport { ContentEntriesCacheProvider } from \"@webiny/app-headless-cms/features/contentEntry/abstractions.js\";\nimport {\n WorkflowStateChangedHandler,\n type WorkflowStateChangedEvent\n} from \"@webiny/app-workflows/domain/events.js\";\nimport type { CmsContentEntry } from \"@webiny/app-headless-cms-common/types/index.js\";\nimport type { ICmsEntryWorkflowState } from \"~/types.js\";\n\nfunction getModelIdFromAppName(app: string): string | null {\n const matched = app.match(/^cms\\.([a-zA-Z0-9_-]+)$/);\n return matched ? matched[1] : null;\n}\n\nfunction toWorkflowStateValues(\n state: WorkflowStateChangedEvent[\"payload\"][\"state\"]\n): ICmsEntryWorkflowState | null {\n if (!state) {\n return null;\n }\n\n return {\n workflowId: state.id,\n stepId: state.currentStep.id,\n stepName: state.currentStep.title,\n state: state.state\n };\n}\n\nclass WorkflowStateCacheHandlerImpl implements WorkflowStateChangedHandler.Interface {\n constructor(private cacheProvider: ContentEntriesCacheProvider.Interface) {}\n\n async handle(event: WorkflowStateChangedEvent): Promise<void> {\n const { app, targetRevisionId, state } = event.payload;\n\n const modelId = getModelIdFromAppName(app);\n if (!modelId) {\n return;\n }\n\n const { id: entryId } = parseIdentifier(targetRevisionId);\n const cache = this.cacheProvider.get(modelId);\n const workflowValues = toWorkflowStateValues(state);\n\n cache.updateItems((entry: CmsContentEntry) => {\n if (entry.entryId !== entryId) {\n return entry;\n }\n\n return {\n ...entry,\n meta: {\n ...entry.meta,\n system: {\n workflow: workflowValues\n }\n }\n };\n });\n }\n}\n\nexport const WorkflowStateCacheHandler = WorkflowStateChangedHandler.createImplementation({\n implementation: WorkflowStateCacheHandlerImpl,\n dependencies: [ContentEntriesCacheProvider]\n});\n"],"names":["getModelIdFromAppName","app","matched","toWorkflowStateValues","state","WorkflowStateCacheHandlerImpl","cacheProvider","event","targetRevisionId","modelId","entryId","parseIdentifier","cache","workflowValues","entry","WorkflowStateCacheHandler","WorkflowStateChangedHandler","ContentEntriesCacheProvider"],"mappings":";;;AASA,SAASA,sBAAsBC,GAAW;IACtC,MAAMC,UAAUD,IAAI,KAAK,CAAC;IAC1B,OAAOC,UAAUA,OAAO,CAAC,EAAE,GAAG;AAClC;AAEA,SAASC,sBACLC,KAAoD;IAEpD,IAAI,CAACA,OACD,OAAO;IAGX,OAAO;QACH,YAAYA,MAAM,EAAE;QACpB,QAAQA,MAAM,WAAW,CAAC,EAAE;QAC5B,UAAUA,MAAM,WAAW,CAAC,KAAK;QACjC,OAAOA,MAAM,KAAK;IACtB;AACJ;AAEA,MAAMC;IACF,YAAoBC,aAAoD,CAAE;aAAtDA,aAAa,GAAbA;IAAuD;IAE3E,MAAM,OAAOC,KAAgC,EAAiB;QAC1D,MAAM,EAAEN,GAAG,EAAEO,gBAAgB,EAAEJ,KAAK,EAAE,GAAGG,MAAM,OAAO;QAEtD,MAAME,UAAUT,sBAAsBC;QACtC,IAAI,CAACQ,SACD;QAGJ,MAAM,EAAE,IAAIC,OAAO,EAAE,GAAGC,gBAAgBH;QACxC,MAAMI,QAAQ,IAAI,CAAC,aAAa,CAAC,GAAG,CAACH;QACrC,MAAMI,iBAAiBV,sBAAsBC;QAE7CQ,MAAM,WAAW,CAAC,CAACE;YACf,IAAIA,MAAM,OAAO,KAAKJ,SAClB,OAAOI;YAGX,OAAO;gBACH,GAAGA,KAAK;gBACR,MAAM;oBACF,GAAGA,MAAM,IAAI;oBACb,QAAQ;wBACJ,UAAUD;oBACd;gBACJ;YACJ;QACJ;IACJ;AACJ;AAEO,MAAME,4BAA4BC,4BAA4B,oBAAoB,CAAC;IACtF,gBAAgBX;IAChB,cAAc;QAACY;KAA4B;AAC/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CmsWorkflowsCacheFeature: import("@webiny/feature/admin").FeatureDefinition<any, []>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/admin";
|
|
2
|
+
import { WorkflowStateCacheHandler } from "./WorkflowStateCacheHandler.js";
|
|
3
|
+
const CmsWorkflowsCacheFeature = createFeature({
|
|
4
|
+
name: "CmsWorkflows/Cache",
|
|
5
|
+
register (container) {
|
|
6
|
+
container.register(WorkflowStateCacheHandler);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export { CmsWorkflowsCacheFeature };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/feature.js","sources":["../../src/features/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { WorkflowStateCacheHandler } from \"./WorkflowStateCacheHandler.js\";\n\nexport const CmsWorkflowsCacheFeature = createFeature({\n name: \"CmsWorkflows/Cache\",\n register(container) {\n container.register(WorkflowStateCacheHandler);\n }\n});\n"],"names":["CmsWorkflowsCacheFeature","createFeature","container","WorkflowStateCacheHandler"],"mappings":";;AAGO,MAAMA,2BAA2BC,cAAc;IAClD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
|
package/index.d.ts
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { RegisterFeature, Wcp } from "@webiny/app-admin";
|
|
3
|
+
import { CmsWorkflowsEditor } from "./Routes/index.js";
|
|
4
|
+
import { CmsEntryFormScheduleMenuItemAction, CmsEntryFormTooltipButton, ContentEntryFormWorkflow } from "./Components/ContentEntryForm/index.js";
|
|
5
|
+
import { CmsEntriesWorkflowStateListFooterMenu } from "./Components/CmsEntriesWorkflowStateList/index.js";
|
|
6
|
+
import { ListOpenInNewWindow } from "./Components/OptionItem/OpenInNewWindow.js";
|
|
7
|
+
import { CmsEntryFormCreateNewRevisionButton } from "./Components/ContentEntryForm/CmsEntryFormCreateNewRevisionButton.js";
|
|
8
|
+
import { CmsWorkflowsFeature } from "./presentation/feature.js";
|
|
9
|
+
import { CmsWorkflowsCacheFeature } from "./features/feature.js";
|
|
10
|
+
import { CmsWorkflowsEditorPresenterFeature } from "./presentation/cmsWorkflowsEditor/feature.js";
|
|
11
|
+
const CmsWorkflows = ()=>/*#__PURE__*/ react.createElement(Wcp.CanUseWorkflows, null, /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
12
|
+
feature: CmsWorkflowsFeature
|
|
13
|
+
}), /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
14
|
+
feature: CmsWorkflowsCacheFeature
|
|
15
|
+
}), /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
16
|
+
feature: CmsWorkflowsEditorPresenterFeature
|
|
17
|
+
}), /*#__PURE__*/ react.createElement(ListOpenInNewWindow, null), /*#__PURE__*/ react.createElement(CmsEntriesWorkflowStateListFooterMenu, null), /*#__PURE__*/ react.createElement(CmsWorkflowsEditor, null), /*#__PURE__*/ react.createElement(ContentEntryFormWorkflow, null), /*#__PURE__*/ react.createElement(CmsEntryFormTooltipButton, null), /*#__PURE__*/ react.createElement(CmsEntryFormScheduleMenuItemAction, null), /*#__PURE__*/ react.createElement(CmsEntryFormCreateNewRevisionButton, null));
|
|
18
|
+
export { CmsWorkflows };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.tsx"],"sourcesContent":["import React from \"react\";\nimport { RegisterFeature, Wcp } from \"@webiny/app-admin\";\nimport { CmsWorkflowsEditor } from \"~/Routes/index.js\";\nimport {\n CmsEntryFormScheduleMenuItemAction,\n CmsEntryFormTooltipButton,\n ContentEntryFormWorkflow\n} from \"~/Components/ContentEntryForm/index.js\";\nimport { CmsEntriesWorkflowStateListFooterMenu } from \"~/Components/CmsEntriesWorkflowStateList/index.js\";\nimport { ListOpenInNewWindow } from \"~/Components/OptionItem/OpenInNewWindow.js\";\nimport { CmsEntryFormCreateNewRevisionButton } from \"~/Components/ContentEntryForm/CmsEntryFormCreateNewRevisionButton.js\";\nimport { CmsWorkflowsFeature } from \"~/presentation/feature.js\";\nimport { CmsWorkflowsCacheFeature } from \"~/features/feature.js\";\nimport { CmsWorkflowsEditorPresenterFeature } from \"~/presentation/cmsWorkflowsEditor/feature.js\";\n\nexport const CmsWorkflows = () => {\n return (\n <Wcp.CanUseWorkflows>\n <RegisterFeature feature={CmsWorkflowsFeature} />\n <RegisterFeature feature={CmsWorkflowsCacheFeature} />\n <RegisterFeature feature={CmsWorkflowsEditorPresenterFeature} />\n <ListOpenInNewWindow />\n <CmsEntriesWorkflowStateListFooterMenu />\n <CmsWorkflowsEditor />\n <ContentEntryFormWorkflow />\n <CmsEntryFormTooltipButton />\n <CmsEntryFormScheduleMenuItemAction />\n <CmsEntryFormCreateNewRevisionButton />\n </Wcp.CanUseWorkflows>\n );\n};\n"],"names":["CmsWorkflows","Wcp","RegisterFeature","CmsWorkflowsFeature","CmsWorkflowsCacheFeature","CmsWorkflowsEditorPresenterFeature","ListOpenInNewWindow","CmsEntriesWorkflowStateListFooterMenu","CmsWorkflowsEditor","ContentEntryFormWorkflow","CmsEntryFormTooltipButton","CmsEntryFormScheduleMenuItemAction","CmsEntryFormCreateNewRevisionButton"],"mappings":";;;;;;;;;;AAeO,MAAMA,eAAe,IACjB,WAAP,GACI,oBAACC,IAAI,eAAe,sBAChB,oBAACC,iBAAeA;QAAC,SAASC;sBAC1B,oBAACD,iBAAeA;QAAC,SAASE;sBAC1B,oBAACF,iBAAeA;QAAC,SAASG;sBAC1B,oBAACC,qBAAmBA,OAAAA,WAAAA,GACpB,oBAACC,uCAAqCA,OAAAA,WAAAA,GACtC,oBAACC,oBAAkBA,OAAAA,WAAAA,GACnB,oBAACC,0BAAwBA,OAAAA,WAAAA,GACzB,oBAACC,2BAAyBA,OAAAA,WAAAA,GAC1B,oBAACC,oCAAkCA,OAAAA,WAAAA,GACnC,oBAACC,qCAAmCA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@webiny/app-headless-cms-workflows",
|
|
3
|
+
"version": "0.0.0-unstable.0d717d18dd",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": "./index.js",
|
|
7
|
+
"./*": "./*"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/webiny/webiny-js.git"
|
|
12
|
+
},
|
|
13
|
+
"author": "Webiny Ltd",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@fortawesome/react-fontawesome": "3.5.0",
|
|
17
|
+
"@webiny/admin-ui": "0.0.0-unstable.0d717d18dd",
|
|
18
|
+
"@webiny/app": "0.0.0-unstable.0d717d18dd",
|
|
19
|
+
"@webiny/app-admin": "0.0.0-unstable.0d717d18dd",
|
|
20
|
+
"@webiny/app-headless-cms": "0.0.0-unstable.0d717d18dd",
|
|
21
|
+
"@webiny/app-headless-cms-common": "0.0.0-unstable.0d717d18dd",
|
|
22
|
+
"@webiny/app-workflows": "0.0.0-unstable.0d717d18dd",
|
|
23
|
+
"@webiny/feature": "0.0.0-unstable.0d717d18dd",
|
|
24
|
+
"@webiny/icons": "0.0.0-unstable.0d717d18dd",
|
|
25
|
+
"@webiny/utils": "0.0.0-unstable.0d717d18dd",
|
|
26
|
+
"mobx": "7.0.0",
|
|
27
|
+
"mobx-react-lite": "5.0.0",
|
|
28
|
+
"react": "18.3.1",
|
|
29
|
+
"react-dom": "18.3.1",
|
|
30
|
+
"react-helmet": "6.1.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/react": "18.3.31",
|
|
34
|
+
"@webiny/build-tools": "0.0.0-unstable.0d717d18dd",
|
|
35
|
+
"rimraf": "6.1.3",
|
|
36
|
+
"typescript": "7.0.2"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"svgo": {
|
|
42
|
+
"plugins": {
|
|
43
|
+
"removeViewBox": false
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"gitHead": "b8aec8a1be3f25c3b428b357fe1e352c7cbff9ae",
|
|
47
|
+
"webiny": {
|
|
48
|
+
"publishFrom": "dist"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare const CmsWorkflowsEditorMenu: () => React.JSX.Element | null;
|
|
3
|
+
export declare const CmsWorkflowsEditorView: (() => React.JSX.Element | null) & React.NamedExoticComponent<unknown> & {
|
|
4
|
+
readonly type: () => React.JSX.Element | null;
|
|
5
|
+
};
|