@webiny/app-website-builder-workflows 6.6.0-alpha.12 → 6.6.0-alpha.13
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/ContentReviews/WbContentReviews.js.map +1 -1
- package/Components/ContentReviews/WbContentReviews.smoke.test.js +1 -1
- package/Components/ContentReviews/WbContentReviews.smoke.test.js.map +1 -1
- package/Components/ContentReviews/WbContentReviewsSidebarItem.js +17 -7
- package/Components/ContentReviews/WbContentReviewsSidebarItem.js.map +1 -1
- package/Components/ContentReviews/WbContentReviewsSidebarItem.test.js +122 -11
- package/Components/ContentReviews/WbContentReviewsSidebarItem.test.js.map +1 -1
- package/Components/PageEditor/PageBasePublishDecorator.js +1 -1
- package/Components/PageEditor/PageBasePublishDecorator.js.map +1 -1
- package/Components/PageEditor/PageEditorAutoSave.js +1 -1
- package/Components/PageEditor/PageEditorAutoSave.js.map +1 -1
- package/Components/PageEditor/PageEditorAutoSave.test.js +1 -1
- package/Components/PageEditor/PageEditorAutoSave.test.js.map +1 -1
- package/Components/PageEditor/PageEditorLayout.js +1 -1
- package/Components/PageEditor/PageEditorLayout.js.map +1 -1
- package/Components/PageEditor/PageEditorLayout.test.js +1 -1
- package/Components/PageEditor/PageEditorLayout.test.js.map +1 -1
- package/Components/PageEditor/PageEditorTopBar.js +1 -1
- package/Components/PageEditor/PageEditorTopBar.js.map +1 -1
- package/Components/PageEditor/PageEditorTopBar.test.js +1 -1
- package/Components/PageEditor/PageEditorTopBar.test.js.map +1 -1
- package/Components/PageEditor/PageNewRevisionDecorator.js +1 -1
- package/Components/PageEditor/PageNewRevisionDecorator.js.map +1 -1
- package/Components/PageEditor/PageNewRevisionDecorator.test.js +1 -1
- package/Components/PageEditor/PageNewRevisionDecorator.test.js.map +1 -1
- package/Components/PageEditor/PageReviewPublishAction.js +1 -1
- package/Components/PageEditor/PageReviewPublishAction.js.map +1 -1
- package/Components/PageEditor/PageScheduleDecorator.js +6 -2
- package/Components/PageEditor/PageScheduleDecorator.js.map +1 -1
- package/Components/PageEditor/PageScheduleDecorator.test.js +13 -3
- package/Components/PageEditor/PageScheduleDecorator.test.js.map +1 -1
- package/Components/PageEditor/getPageReadOnlyReason.js +1 -7
- package/Components/PageEditor/getPageReadOnlyReason.js.map +1 -1
- package/Components/PageEditor/getPageReadOnlyReason.test.js +4 -6
- package/Components/PageEditor/getPageReadOnlyReason.test.js.map +1 -1
- package/Components/PageEditor/pageReviewMatrix.test.js +5 -7
- package/Components/PageEditor/pageReviewMatrix.test.js.map +1 -1
- package/Components/PageEditor/publishMatrix.test.js +1 -1
- package/Components/PageEditor/publishMatrix.test.js.map +1 -1
- package/Components/PagesList/PageBulkPublishBlocked.d.ts +5 -0
- package/Components/PagesList/PageBulkPublishBlocked.js +23 -0
- package/Components/PagesList/PageBulkPublishBlocked.js.map +1 -0
- package/Components/PagesList/PageBulkPublishGate.d.ts +7 -0
- package/Components/PagesList/PageBulkPublishGate.js +33 -0
- package/Components/PagesList/PageBulkPublishGate.js.map +1 -0
- package/Components/PagesList/PageBulkPublishGate.test.d.ts +1 -0
- package/Components/PagesList/PageBulkPublishGate.test.js +148 -0
- package/Components/PagesList/PageBulkPublishGate.test.js.map +1 -0
- package/Components/PagesList/PageListReviewBulkPublishAction.d.ts +2 -0
- package/Components/PagesList/PageListReviewBulkPublishAction.js +16 -0
- package/Components/PagesList/PageListReviewBulkPublishAction.js.map +1 -0
- package/Components/PagesList/PageListReviewBulkPublishAction.test.d.ts +1 -0
- package/Components/PagesList/PageListReviewBulkPublishAction.test.js +44 -0
- package/Components/PagesList/PageListReviewBulkPublishAction.test.js.map +1 -0
- package/Components/PagesList/PageListReviewGatedActions.js +11 -15
- package/Components/PagesList/PageListReviewGatedActions.js.map +1 -1
- package/Components/PagesList/PageListReviewGatedActions.test.js +141 -27
- package/Components/PagesList/PageListReviewGatedActions.test.js.map +1 -1
- package/Components/PagesList/PageListReviewMoveAction.d.ts +2 -0
- package/Components/PagesList/PageListReviewMoveAction.js +16 -0
- package/Components/PagesList/PageListReviewMoveAction.js.map +1 -0
- package/Components/PagesList/PageListReviewMoveAction.test.d.ts +1 -0
- package/Components/PagesList/PageListReviewMoveAction.test.js +102 -0
- package/Components/PagesList/PageListReviewMoveAction.test.js.map +1 -0
- package/Components/PagesList/PageMoveBlocked.d.ts +2 -0
- package/Components/PagesList/PageMoveBlocked.js +26 -0
- package/Components/PagesList/PageMoveBlocked.js.map +1 -0
- package/Components/PagesList/PageMoveGate.d.ts +5 -0
- package/Components/PagesList/PageMoveGate.js +12 -0
- package/Components/PagesList/PageMoveGate.js.map +1 -0
- package/Components/PagesList/PagePublishBlocked.d.ts +5 -0
- package/Components/PagesList/PagePublishBlocked.js +26 -0
- package/Components/PagesList/PagePublishBlocked.js.map +1 -0
- package/Components/PagesList/PagePublishGate.d.ts +7 -0
- package/Components/PagesList/PagePublishGate.js +21 -0
- package/Components/PagesList/PagePublishGate.js.map +1 -0
- package/Components/PagesList/PageScheduleGate.d.ts +7 -0
- package/Components/PagesList/PageScheduleGate.js +13 -0
- package/Components/PagesList/PageScheduleGate.js.map +1 -0
- package/Components/PagesList/PagesList.js +3 -1
- package/Components/PagesList/PagesList.js.map +1 -1
- package/Components/PagesList/PagesList.test.js +18 -0
- package/Components/PagesList/PagesList.test.js.map +1 -1
- package/Components/PagesList/ignoreAction.d.ts +1 -0
- package/Components/PagesList/ignoreAction.js +4 -0
- package/Components/PagesList/ignoreAction.js.map +1 -0
- package/Components/PagesList/toListPublishRow.d.ts +8 -0
- package/Components/PagesList/toListPublishRow.js +10 -0
- package/Components/PagesList/toListPublishRow.js.map +1 -0
- package/Components/PagesList/toListPublishRow.test.d.ts +1 -0
- package/Components/PagesList/toListPublishRow.test.js +38 -0
- package/Components/PagesList/toListPublishRow.test.js.map +1 -0
- package/Components/PagesList/usePageRowPublishDisabledReason.d.ts +1 -0
- package/Components/PagesList/usePageRowPublishDisabledReason.js +25 -0
- package/Components/PagesList/usePageRowPublishDisabledReason.js.map +1 -0
- package/Routes/WebsiteBuilderWorkflowsMenu.test.js +1 -1
- package/Routes/WebsiteBuilderWorkflowsMenu.test.js.map +1 -1
- package/editorGlue.wiring.test.js +1 -1
- package/editorGlue.wiring.test.js.map +1 -1
- package/features/editorGateway/WbWorkflowEditorGateway/WbWorkflowEditorGateway.test.js +8 -0
- package/features/editorGateway/WbWorkflowEditorGateway/WbWorkflowEditorGateway.test.js.map +1 -1
- package/features/editorGateway/feature.test.js +1 -0
- package/features/editorGateway/feature.test.js.map +1 -1
- package/features/gateway/WbReviewGateway/WbReviewGateway.js +2 -3
- package/features/gateway/WbReviewGateway/WbReviewGateway.js.map +1 -1
- package/features/gateway/WbReviewGateway/WbReviewGateway.test.js +7 -10
- package/features/gateway/WbReviewGateway/WbReviewGateway.test.js.map +1 -1
- package/features/gateway/contentReviewsBindings.test.js +2 -2
- package/features/gateway/contentReviewsBindings.test.js.map +1 -1
- package/features/gateway/graphql/listWebsiteBuilderPageReviews.d.ts +1 -1
- package/features/gateway/graphql/listWebsiteBuilderPageReviews.js +2 -2
- package/features/gateway/graphql/listWebsiteBuilderPageReviews.js.map +1 -1
- package/features/gateway/graphql/listWebsiteBuilderPageWorkflows.d.ts +1 -1
- package/package.json +18 -18
- package/pageListChangeStatus.wiring.test.js +53 -15
- package/pageListChangeStatus.wiring.test.js.map +1 -1
- package/publishAutosave.wiring.test.js +1 -1
- package/publishAutosave.wiring.test.js.map +1 -1
- package/routes.d.ts +2 -1
- package/routes.js +2 -1
- package/routes.js.map +1 -1
- package/testing/WbEditorHarness.js +1 -1
- package/testing/WbEditorHarness.js.map +1 -1
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { cleanup, render, screen } from "@testing-library/react";
|
|
3
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
4
|
+
import { CompositionProvider } from "@webiny/react-composition";
|
|
5
|
+
import { AdminUiProvider } from "@webiny/admin-ui";
|
|
6
|
+
import { Page, PageDtoMapper } from "@webiny/app-website-builder/domain/Page/index.js";
|
|
7
|
+
import { PageListConfig } from "@webiny/app-website-builder/presentation/pages/PageList/configs/index.js";
|
|
8
|
+
import { PageProvider } from "@webiny/app-website-builder/presentation/pages/PageList/hooks/usePage.js";
|
|
9
|
+
import { ReviewState } from "@webiny/app-workflows/review/domain/ReviewState.js";
|
|
10
|
+
import { StepState } from "@webiny/app-workflows/review/domain/StepState.js";
|
|
11
|
+
import { MOVE_BLOCKED_IN_REVIEW } from "@webiny/app-workflows/review/presentation/targetReview/moveBlockedInReview.js";
|
|
12
|
+
import "../../types.js";
|
|
13
|
+
import { PageListReviewMoveAction } from "./PageListReviewMoveAction.js";
|
|
14
|
+
vi.mock("@webiny/app-website-builder/presentation/pages/PageList/configs/Browser/PageAction.js", async ()=>{
|
|
15
|
+
const { makeDecoratable } = await import("@webiny/react-composition");
|
|
16
|
+
const PageAction = makeDecoratable("PageAction", (props)=>props.element ?? null);
|
|
17
|
+
return {
|
|
18
|
+
PageAction
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
vi.mock("@webiny/app-admin", async (importOriginal)=>{
|
|
22
|
+
const actual = await importOriginal();
|
|
23
|
+
const React = await import("react");
|
|
24
|
+
return {
|
|
25
|
+
...actual,
|
|
26
|
+
OptionsMenuItem: (props)=>React.createElement("button", {
|
|
27
|
+
"data-testid": "blocked-move",
|
|
28
|
+
disabled: props.disabled ?? false
|
|
29
|
+
}, props.label)
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
const { Browser } = PageListConfig;
|
|
33
|
+
const createDto = (reviewState)=>{
|
|
34
|
+
const system = null === reviewState ? null : {
|
|
35
|
+
workflow: {
|
|
36
|
+
workflowId: "workflow-1",
|
|
37
|
+
reviewState,
|
|
38
|
+
stepId: "step-1",
|
|
39
|
+
stepName: "Legal",
|
|
40
|
+
stepState: StepState.InReview
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const page = Page.create({
|
|
44
|
+
id: "page-1#0001",
|
|
45
|
+
entryId: "page-1",
|
|
46
|
+
system
|
|
47
|
+
});
|
|
48
|
+
return PageDtoMapper.toDTO(page);
|
|
49
|
+
};
|
|
50
|
+
const mountActions = (reviewState)=>{
|
|
51
|
+
render(/*#__PURE__*/ react.createElement(AdminUiProvider, null, /*#__PURE__*/ react.createElement(CompositionProvider, null, /*#__PURE__*/ react.createElement(PageProvider, {
|
|
52
|
+
page: createDto(reviewState)
|
|
53
|
+
}, /*#__PURE__*/ react.createElement(PageListReviewMoveAction, null), /*#__PURE__*/ react.createElement(Browser.Page.Action, {
|
|
54
|
+
name: "moveToFolder",
|
|
55
|
+
element: /*#__PURE__*/ react.createElement("span", {
|
|
56
|
+
"data-testid": "move"
|
|
57
|
+
})
|
|
58
|
+
}), /*#__PURE__*/ react.createElement(Browser.Page.Action, {
|
|
59
|
+
name: "delete",
|
|
60
|
+
element: /*#__PURE__*/ react.createElement("span", {
|
|
61
|
+
"data-testid": "delete"
|
|
62
|
+
})
|
|
63
|
+
})))));
|
|
64
|
+
};
|
|
65
|
+
describe("PageListReviewMoveAction", ()=>{
|
|
66
|
+
afterEach(()=>{
|
|
67
|
+
cleanup();
|
|
68
|
+
});
|
|
69
|
+
it("replaces Move with a disabled item and its reason while the page is in review", ()=>{
|
|
70
|
+
mountActions(ReviewState.InProgress);
|
|
71
|
+
const blocked = screen.getByTestId("blocked-move");
|
|
72
|
+
expect(blocked.textContent).toBe("Move");
|
|
73
|
+
expect(blocked.hasAttribute("disabled")).toBe(true);
|
|
74
|
+
expect(screen.queryByTestId("move")).toBeNull();
|
|
75
|
+
const describedBy = blocked.closest("[aria-describedby]")?.getAttribute("aria-describedby");
|
|
76
|
+
expect(document.getElementById(describedBy ?? "")?.textContent).toBe(MOVE_BLOCKED_IN_REVIEW);
|
|
77
|
+
});
|
|
78
|
+
it("leaves the other row actions alone while the page is in review", ()=>{
|
|
79
|
+
mountActions(ReviewState.InProgress);
|
|
80
|
+
expect(screen.getByTestId("delete")).toBeTruthy();
|
|
81
|
+
});
|
|
82
|
+
it.each([
|
|
83
|
+
[
|
|
84
|
+
"approved",
|
|
85
|
+
ReviewState.Approved
|
|
86
|
+
],
|
|
87
|
+
[
|
|
88
|
+
"rejected",
|
|
89
|
+
ReviewState.Rejected
|
|
90
|
+
],
|
|
91
|
+
[
|
|
92
|
+
"missing",
|
|
93
|
+
null
|
|
94
|
+
]
|
|
95
|
+
])("keeps the original Move for a %s review", (_name, reviewState)=>{
|
|
96
|
+
mountActions(reviewState);
|
|
97
|
+
expect(screen.getByTestId("move")).toBeTruthy();
|
|
98
|
+
expect(screen.queryByTestId("blocked-move")).toBeNull();
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
//# sourceMappingURL=PageListReviewMoveAction.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Components/PagesList/PageListReviewMoveAction.test.js","sources":["../../../src/Components/PagesList/PageListReviewMoveAction.test.tsx"],"sourcesContent":["import React from \"react\";\nimport { cleanup } from \"@testing-library/react\";\nimport { render } from \"@testing-library/react\";\nimport { screen } from \"@testing-library/react\";\nimport { afterEach } from \"vitest\";\nimport { describe } from \"vitest\";\nimport { expect } from \"vitest\";\nimport { it } from \"vitest\";\nimport { vi } from \"vitest\";\nimport { CompositionProvider } from \"@webiny/react-composition\";\nimport { AdminUiProvider } from \"@webiny/admin-ui\";\nimport { Page } from \"@webiny/app-website-builder/domain/Page/index.js\";\nimport { PageDtoMapper } from \"@webiny/app-website-builder/domain/Page/index.js\";\nimport { PageListConfig } from \"@webiny/app-website-builder/presentation/pages/PageList/configs/index.js\";\nimport { PageProvider } from \"@webiny/app-website-builder/presentation/pages/PageList/hooks/usePage.js\";\nimport { ReviewState } from \"@webiny/app-workflows/review/domain/ReviewState.js\";\nimport type { ReviewStateValue } from \"@webiny/app-workflows/review/domain/ReviewState.js\";\nimport { StepState } from \"@webiny/app-workflows/review/domain/StepState.js\";\nimport { MOVE_BLOCKED_IN_REVIEW } from \"@webiny/app-workflows/review/presentation/targetReview/moveBlockedInReview.js\";\nimport \"~/types.js\";\nimport { PageListReviewMoveAction } from \"./PageListReviewMoveAction.js\";\n\ninterface FakeMenuItemProps {\n label: string;\n disabled?: boolean;\n}\n\nvi.mock(\n \"@webiny/app-website-builder/presentation/pages/PageList/configs/Browser/PageAction.js\",\n async () => {\n const { makeDecoratable } = await import(\"@webiny/react-composition\");\n interface StubProps {\n name: string;\n element?: React.ReactElement;\n }\n const PageAction = makeDecoratable(\"PageAction\", (props: StubProps) => {\n return props.element ?? null;\n });\n return { PageAction };\n }\n);\n\nvi.mock(\"@webiny/app-admin\", async importOriginal => {\n const actual = await importOriginal<typeof import(\"@webiny/app-admin\")>();\n const React = await import(\"react\");\n\n return {\n ...actual,\n OptionsMenuItem: (props: FakeMenuItemProps) => {\n return React.createElement(\n \"button\",\n { \"data-testid\": \"blocked-move\", disabled: props.disabled ?? false },\n props.label\n );\n }\n };\n});\n\nconst { Browser } = PageListConfig;\n\nconst createDto = (reviewState: ReviewStateValue | null) => {\n const system =\n reviewState === null\n ? null\n : {\n workflow: {\n workflowId: \"workflow-1\",\n reviewState,\n stepId: \"step-1\",\n stepName: \"Legal\",\n stepState: StepState.InReview\n }\n };\n const page = Page.create({ id: \"page-1#0001\", entryId: \"page-1\", system });\n return PageDtoMapper.toDTO(page);\n};\n\nconst mountActions = (reviewState: ReviewStateValue | null) => {\n render(\n <AdminUiProvider>\n <CompositionProvider>\n <PageProvider page={createDto(reviewState)}>\n <PageListReviewMoveAction />\n <Browser.Page.Action\n name={\"moveToFolder\"}\n element={<span data-testid={\"move\"} />}\n />\n <Browser.Page.Action\n name={\"delete\"}\n element={<span data-testid={\"delete\"} />}\n />\n </PageProvider>\n </CompositionProvider>\n </AdminUiProvider>\n );\n};\n\ndescribe(\"PageListReviewMoveAction\", () => {\n afterEach(() => {\n cleanup();\n });\n\n it(\"replaces Move with a disabled item and its reason while the page is in review\", () => {\n mountActions(ReviewState.InProgress);\n\n const blocked = screen.getByTestId(\"blocked-move\");\n expect(blocked.textContent).toBe(\"Move\");\n expect(blocked.hasAttribute(\"disabled\")).toBe(true);\n expect(screen.queryByTestId(\"move\")).toBeNull();\n const describedBy = blocked.closest(\"[aria-describedby]\")?.getAttribute(\"aria-describedby\");\n expect(document.getElementById(describedBy ?? \"\")?.textContent).toBe(\n MOVE_BLOCKED_IN_REVIEW\n );\n });\n\n it(\"leaves the other row actions alone while the page is in review\", () => {\n mountActions(ReviewState.InProgress);\n\n expect(screen.getByTestId(\"delete\")).toBeTruthy();\n });\n\n it.each([\n [\"approved\", ReviewState.Approved],\n [\"rejected\", ReviewState.Rejected],\n [\"missing\", null]\n ])(\"keeps the original Move for a %s review\", (_name, reviewState) => {\n mountActions(reviewState);\n\n expect(screen.getByTestId(\"move\")).toBeTruthy();\n expect(screen.queryByTestId(\"blocked-move\")).toBeNull();\n });\n});\n"],"names":["vi","makeDecoratable","PageAction","props","importOriginal","actual","React","Browser","PageListConfig","createDto","reviewState","system","StepState","page","Page","PageDtoMapper","mountActions","render","AdminUiProvider","CompositionProvider","PageProvider","PageListReviewMoveAction","describe","afterEach","cleanup","it","ReviewState","blocked","screen","expect","describedBy","document","MOVE_BLOCKED_IN_REVIEW","_name"],"mappings":";;;;;;;;;;;;;AA2BAA,GAAG,IAAI,CACH,yFACA;IACI,MAAM,EAAEC,eAAe,EAAE,GAAG,MAAM,MAAM,CAAC;IAKzC,MAAMC,aAAaD,gBAAgB,cAAc,CAACE,QACvCA,MAAM,OAAO,IAAI;IAE5B,OAAO;QAAED;IAAW;AACxB;AAGJF,GAAG,IAAI,CAAC,qBAAqB,OAAMI;IAC/B,MAAMC,SAAS,MAAMD;IACrB,MAAME,QAAQ,MAAM,MAAM,CAAC;IAE3B,OAAO;QACH,GAAGD,MAAM;QACT,iBAAiB,CAACF,QACPG,MAAM,aAAa,CACtB,UACA;gBAAE,eAAe;gBAAgB,UAAUH,MAAM,QAAQ,IAAI;Y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G,IAAI,CAAC;QACJ;YAAC;YAAYC,YAAY,QAAQ;SAAC;QAClC;YAAC;YAAYA,YAAY,QAAQ;SAAC;QAClC;YAAC;YAAW;SAAK;KACpB,EAAE,2CAA2C,CAACO,OAAOvB;QAClDM,aAAaN;QAEbmB,OAAOD,OAAO,WAAW,CAAC,SAAS,UAAU;QAC7CC,OAAOD,OAAO,aAAa,CAAC,iBAAiB,QAAQ;IACzD;AACJ"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import react, { useId } from "react";
|
|
2
|
+
import { Tooltip } from "@webiny/admin-ui";
|
|
3
|
+
import { OptionsMenuItem } from "@webiny/app-admin";
|
|
4
|
+
import { ReactComponent } from "@webiny/icons/exit_to_app.svg";
|
|
5
|
+
import { MOVE_BLOCKED_IN_REVIEW } from "@webiny/app-workflows/review/presentation/targetReview/moveBlockedInReview.js";
|
|
6
|
+
import { ignoreAction } from "./ignoreAction.js";
|
|
7
|
+
const PageMoveBlocked = ()=>{
|
|
8
|
+
const descriptionId = useId();
|
|
9
|
+
return /*#__PURE__*/ react.createElement("span", {
|
|
10
|
+
"aria-describedby": descriptionId
|
|
11
|
+
}, /*#__PURE__*/ react.createElement(Tooltip, {
|
|
12
|
+
content: MOVE_BLOCKED_IN_REVIEW,
|
|
13
|
+
trigger: /*#__PURE__*/ react.createElement(OptionsMenuItem, {
|
|
14
|
+
icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
|
|
15
|
+
label: "Move",
|
|
16
|
+
disabled: true,
|
|
17
|
+
onAction: ignoreAction
|
|
18
|
+
})
|
|
19
|
+
}), /*#__PURE__*/ react.createElement("span", {
|
|
20
|
+
id: descriptionId,
|
|
21
|
+
className: "sr-only"
|
|
22
|
+
}, MOVE_BLOCKED_IN_REVIEW));
|
|
23
|
+
};
|
|
24
|
+
export { PageMoveBlocked };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=PageMoveBlocked.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Components/PagesList/PageMoveBlocked.js","sources":["../../../src/Components/PagesList/PageMoveBlocked.tsx"],"sourcesContent":["import React, { useId } from \"react\";\nimport { Tooltip } from \"@webiny/admin-ui\";\nimport { OptionsMenuItem } from \"@webiny/app-admin\";\nimport { ReactComponent as MoveIcon } from \"@webiny/icons/exit_to_app.svg\";\nimport { MOVE_BLOCKED_IN_REVIEW } from \"@webiny/app-workflows/review/presentation/targetReview/moveBlockedInReview.js\";\nimport { ignoreAction } from \"./ignoreAction.js\";\n\n/*\n * The row's \"Move\" shown disabled while the page is in review (the Headless CMS list does the\n * same). A disabled menu item cannot take focus, so the reason is given on hover by the tooltip and\n * to assistive technology by `aria-describedby` on a visually hidden element.\n */\nexport const PageMoveBlocked = () => {\n const descriptionId = useId();\n\n return (\n <span aria-describedby={descriptionId}>\n <Tooltip\n content={MOVE_BLOCKED_IN_REVIEW}\n trigger={\n <OptionsMenuItem\n icon={<MoveIcon />}\n label={\"Move\"}\n disabled={true}\n onAction={ignoreAction}\n />\n }\n />\n <span id={descriptionId} className={\"sr-only\"}>\n {MOVE_BLOCKED_IN_REVIEW}\n </span>\n </span>\n );\n};\n"],"names":["PageMoveBlocked","descriptionId","useId","Tooltip","MOVE_BLOCKED_IN_REVIEW","OptionsMenuItem","MoveIcon","ignoreAction"],"mappings":";;;;;;AAYO,MAAMA,kBAAkB;IAC3B,MAAMC,gBAAgBC;IAEtB,OAAO,WAAP,GACI,oBAAC;QAAK,oBAAkBD;qBACpB,oBAACE,SAAOA;QACJ,SAASC;QACT,uBACI,oBAACC,iBAAeA;YACZ,oBAAM,oBAACC,gBAAQA;YACf,OAAO;YACP,UAAU;YACV,UAAUC;;sBAItB,oBAAC;QAAK,IAAIN;QAAe,WAAW;OAC/BG;AAIjB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { ReviewState } from "@webiny/app-workflows/review/domain/ReviewState.js";
|
|
3
|
+
import { usePage } from "../../hooks/usePage.js";
|
|
4
|
+
import { PageMoveBlocked } from "./PageMoveBlocked.js";
|
|
5
|
+
const PageMoveGate = (props)=>{
|
|
6
|
+
const { page } = usePage();
|
|
7
|
+
if (page.workflow?.reviewState === ReviewState.InProgress) return /*#__PURE__*/ react.createElement(PageMoveBlocked, null);
|
|
8
|
+
return props.element ?? null;
|
|
9
|
+
};
|
|
10
|
+
export { PageMoveGate };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=PageMoveGate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Components/PagesList/PageMoveGate.js","sources":["../../../src/Components/PagesList/PageMoveGate.tsx"],"sourcesContent":["import React from \"react\";\nimport { ReviewState } from \"@webiny/app-workflows/review/domain/ReviewState.js\";\nimport { usePage } from \"~/hooks/usePage.js\";\nimport { PageMoveBlocked } from \"./PageMoveBlocked.js\";\n\nexport interface PageMoveGateProps {\n element: React.ReactElement | undefined;\n}\n\n// The API refuses to move a page whose review is in progress (`Workflows/Review/TargetLocked`).\nexport const PageMoveGate = (props: PageMoveGateProps) => {\n const { page } = usePage();\n\n if (page.workflow?.reviewState === ReviewState.InProgress) {\n return <PageMoveBlocked />;\n }\n\n return props.element ?? null;\n};\n"],"names":["PageMoveGate","props","page","usePage","ReviewState","PageMoveBlocked"],"mappings":";;;;AAUO,MAAMA,eAAe,CAACC;IACzB,MAAM,EAAEC,IAAI,EAAE,GAAGC;IAEjB,IAAID,KAAK,QAAQ,EAAE,gBAAgBE,YAAY,UAAU,EACrD,OAAO,WAAP,GAAO,oBAACC,iBAAeA;IAG3B,OAAOJ,MAAM,OAAO,IAAI;AAC5B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import react, { useId } from "react";
|
|
2
|
+
import { Tooltip } from "@webiny/admin-ui";
|
|
3
|
+
import { OptionsMenuItem } from "@webiny/app-admin";
|
|
4
|
+
import { ReactComponent } from "@webiny/icons/visibility.svg";
|
|
5
|
+
import { ignoreAction } from "./ignoreAction.js";
|
|
6
|
+
const PagePublishBlocked = ({ reason })=>{
|
|
7
|
+
const descriptionId = useId();
|
|
8
|
+
return /*#__PURE__*/ react.createElement("span", {
|
|
9
|
+
"aria-describedby": descriptionId
|
|
10
|
+
}, /*#__PURE__*/ react.createElement(Tooltip, {
|
|
11
|
+
content: reason,
|
|
12
|
+
trigger: /*#__PURE__*/ react.createElement(OptionsMenuItem, {
|
|
13
|
+
icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
|
|
14
|
+
label: "Publish",
|
|
15
|
+
disabled: true,
|
|
16
|
+
onAction: ignoreAction,
|
|
17
|
+
"data-testid": "wb.page-list.page-action.publish.blocked"
|
|
18
|
+
})
|
|
19
|
+
}), /*#__PURE__*/ react.createElement("span", {
|
|
20
|
+
id: descriptionId,
|
|
21
|
+
className: "sr-only"
|
|
22
|
+
}, reason));
|
|
23
|
+
};
|
|
24
|
+
export { PagePublishBlocked };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=PagePublishBlocked.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Components/PagesList/PagePublishBlocked.js","sources":["../../../src/Components/PagesList/PagePublishBlocked.tsx"],"sourcesContent":["import React, { useId } from \"react\";\nimport { Tooltip } from \"@webiny/admin-ui\";\nimport { OptionsMenuItem } from \"@webiny/app-admin\";\nimport { ReactComponent as PublishIcon } from \"@webiny/icons/visibility.svg\";\nimport { ignoreAction } from \"./ignoreAction.js\";\n\nexport interface PagePublishBlockedProps {\n reason: string;\n}\n\n/*\n * The row's \"Publish\" shown disabled, with the reason on hover and for assistive technology (the\n * same pattern as the blocked \"Move\").\n */\nexport const PagePublishBlocked = ({ reason }: PagePublishBlockedProps) => {\n const descriptionId = useId();\n\n return (\n <span aria-describedby={descriptionId}>\n <Tooltip\n content={reason}\n trigger={\n <OptionsMenuItem\n icon={<PublishIcon />}\n label={\"Publish\"}\n disabled={true}\n onAction={ignoreAction}\n data-testid={\"wb.page-list.page-action.publish.blocked\"}\n />\n }\n />\n <span id={descriptionId} className={\"sr-only\"}>\n {reason}\n </span>\n </span>\n );\n};\n"],"names":["PagePublishBlocked","reason","descriptionId","useId","Tooltip","OptionsMenuItem","PublishIcon","ignoreAction"],"mappings":";;;;;AAcO,MAAMA,qBAAqB,CAAC,EAAEC,MAAM,EAA2B;IAClE,MAAMC,gBAAgBC;IAEtB,OAAO,WAAP,GACI,oBAAC;QAAK,oBAAkBD;qBACpB,oBAACE,SAAOA;QACJ,SAASH;QACT,uBACI,oBAACI,iBAAeA;YACZ,oBAAM,oBAACC,gBAAWA;YAClB,OAAO;YACP,UAAU;YACV,UAAUC;YACV,eAAa;;sBAIzB,oBAAC;QAAK,IAAIL;QAAe,WAAW;OAC/BD;AAIjB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface PagePublishGateProps {
|
|
3
|
+
element: React.ReactElement | undefined;
|
|
4
|
+
}
|
|
5
|
+
export declare const PagePublishGate: ((props: PagePublishGateProps) => React.JSX.Element | null) & React.NamedExoticComponent<PagePublishGateProps> & {
|
|
6
|
+
readonly type: (props: PagePublishGateProps) => React.JSX.Element | null;
|
|
7
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { createReactiveComponent } from "@webiny/app-admin";
|
|
3
|
+
import { usePage } from "@webiny/app-website-builder/presentation/pages/PageList/hooks/usePage.js";
|
|
4
|
+
import { HasPermission } from "@webiny/app-website-builder/presentation/security/HasPermission.js";
|
|
5
|
+
import { WbPageStatus } from "@webiny/app-website-builder/constants.js";
|
|
6
|
+
import { usePageRowPublishDisabledReason } from "./usePageRowPublishDisabledReason.js";
|
|
7
|
+
import { PagePublishBlocked } from "./PagePublishBlocked.js";
|
|
8
|
+
const PagePublishGate = createReactiveComponent((props)=>{
|
|
9
|
+
const { page } = usePage();
|
|
10
|
+
const reason = usePageRowPublishDisabledReason();
|
|
11
|
+
if (page.status === WbPageStatus.Published || null === reason) return props.element ?? null;
|
|
12
|
+
return /*#__PURE__*/ react.createElement(HasPermission, {
|
|
13
|
+
entity: "page",
|
|
14
|
+
action: "publish"
|
|
15
|
+
}, /*#__PURE__*/ react.createElement(PagePublishBlocked, {
|
|
16
|
+
reason: reason
|
|
17
|
+
}));
|
|
18
|
+
});
|
|
19
|
+
export { PagePublishGate };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=PagePublishGate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Components/PagesList/PagePublishGate.js","sources":["../../../src/Components/PagesList/PagePublishGate.tsx"],"sourcesContent":["import React from \"react\";\nimport { createReactiveComponent } from \"@webiny/app-admin\";\nimport { usePage } from \"@webiny/app-website-builder/presentation/pages/PageList/hooks/usePage.js\";\nimport { HasPermission } from \"@webiny/app-website-builder/presentation/security/HasPermission.js\";\nimport { WbPageStatus } from \"@webiny/app-website-builder/constants.js\";\nimport { usePageRowPublishDisabledReason } from \"./usePageRowPublishDisabledReason.js\";\nimport { PagePublishBlocked } from \"./PagePublishBlocked.js\";\n\nexport interface PagePublishGateProps {\n element: React.ReactElement | undefined;\n}\n\n/*\n * Leaves the base \"Change status\" action alone when it shows \"Unpublish\"; otherwise shows\n * \"Publish\" disabled with the reason whenever the API would refuse it\n * (`Workflows/Review/PublishBlocked`): a page whose review is in progress or rejected, or a page\n * with no approved review while a workflow binds the pages. Like the base action, the disabled\n * \"Publish\" needs the publish permission.\n */\nexport const PagePublishGate = createReactiveComponent((props: PagePublishGateProps) => {\n const { page } = usePage();\n const reason = usePageRowPublishDisabledReason();\n\n if (page.status === WbPageStatus.Published || reason === null) {\n return props.element ?? null;\n }\n\n return (\n <HasPermission entity={\"page\"} action={\"publish\"}>\n <PagePublishBlocked reason={reason} />\n </HasPermission>\n );\n});\n"],"names":["PagePublishGate","createReactiveComponent","props","page","usePage","reason","usePageRowPublishDisabledReason","WbPageStatus","HasPermission","PagePublishBlocked"],"mappings":";;;;;;;AAmBO,MAAMA,kBAAkBC,wBAAwB,CAACC;IACpD,MAAM,EAAEC,IAAI,EAAE,GAAGC;IACjB,MAAMC,SAASC;IAEf,IAAIH,KAAK,MAAM,KAAKI,aAAa,SAAS,IAAIF,AAAW,SAAXA,QAC1C,OAAOH,MAAM,OAAO,IAAI;IAG5B,OAAO,WAAP,GACI,oBAACM,eAAaA;QAAC,QAAQ;QAAQ,QAAQ;qBACnC,oBAACC,oBAAkBA;QAAC,QAAQJ;;AAGxC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
export interface PageScheduleGateProps {
|
|
3
|
+
element: React.ReactElement | undefined;
|
|
4
|
+
}
|
|
5
|
+
export declare const PageScheduleGate: ((props: PageScheduleGateProps) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null) & React.NamedExoticComponent<PageScheduleGateProps> & {
|
|
6
|
+
readonly type: (props: PageScheduleGateProps) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
|
|
7
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createReactiveComponent } from "@webiny/app-admin";
|
|
2
|
+
import { usePage } from "@webiny/app-website-builder/presentation/pages/PageList/hooks/usePage.js";
|
|
3
|
+
import { WbPageStatus } from "@webiny/app-website-builder/constants.js";
|
|
4
|
+
import { usePageRowPublishDisabledReason } from "./usePageRowPublishDisabledReason.js";
|
|
5
|
+
const PageScheduleGate = createReactiveComponent((props)=>{
|
|
6
|
+
const { page } = usePage();
|
|
7
|
+
const reason = usePageRowPublishDisabledReason();
|
|
8
|
+
if (page.status === WbPageStatus.Published || null === reason) return props.element ?? null;
|
|
9
|
+
return null;
|
|
10
|
+
});
|
|
11
|
+
export { PageScheduleGate };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=PageScheduleGate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Components/PagesList/PageScheduleGate.js","sources":["../../../src/Components/PagesList/PageScheduleGate.tsx"],"sourcesContent":["import type React from \"react\";\nimport { createReactiveComponent } from \"@webiny/app-admin\";\nimport { usePage } from \"@webiny/app-website-builder/presentation/pages/PageList/hooks/usePage.js\";\nimport { WbPageStatus } from \"@webiny/app-website-builder/constants.js\";\nimport { usePageRowPublishDisabledReason } from \"./usePageRowPublishDisabledReason.js\";\n\nexport interface PageScheduleGateProps {\n element: React.ReactElement | undefined;\n}\n\n/*\n * The scheduler's per-row \"Schedule publish\" needs what \"Publish\" needs\n * (`usePageRowPublishDisabledReason`; the API refuses the schedule with\n * `Workflows/Review/PublishBlocked` otherwise). It is hidden rather than disabled (R226).\n * \"Schedule unpublish\" on a published row is left alone.\n */\nexport const PageScheduleGate = createReactiveComponent((props: PageScheduleGateProps) => {\n const { page } = usePage();\n const reason = usePageRowPublishDisabledReason();\n\n if (page.status === WbPageStatus.Published || reason === null) {\n return props.element ?? null;\n }\n\n return null;\n});\n"],"names":["PageScheduleGate","createReactiveComponent","props","page","usePage","reason","usePageRowPublishDisabledReason","WbPageStatus"],"mappings":";;;;AAgBO,MAAMA,mBAAmBC,wBAAwB,CAACC;IACrD,MAAM,EAAEC,IAAI,EAAE,GAAGC;IACjB,MAAMC,SAASC;IAEf,IAAIH,KAAK,MAAM,KAAKI,aAAa,SAAS,IAAIF,AAAW,SAAXA,QAC1C,OAAOH,MAAM,OAAO,IAAI;IAG5B,OAAO;AACX"}
|
|
@@ -2,7 +2,9 @@ import react from "react";
|
|
|
2
2
|
import { PageListConfig } from "@webiny/app-website-builder";
|
|
3
3
|
import { WbContentReviewsSidebarItem } from "../ContentReviews/WbContentReviewsSidebarItem.js";
|
|
4
4
|
import { PageListReviewGatedActions } from "./PageListReviewGatedActions.js";
|
|
5
|
-
|
|
5
|
+
import { PageListReviewMoveAction } from "./PageListReviewMoveAction.js";
|
|
6
|
+
import { PageListReviewBulkPublishAction } from "./PageListReviewBulkPublishAction.js";
|
|
7
|
+
const PagesList = ()=>/*#__PURE__*/ react.createElement(PageListConfig, null, /*#__PURE__*/ react.createElement(WbContentReviewsSidebarItem, null), /*#__PURE__*/ react.createElement(PageListReviewGatedActions, null), /*#__PURE__*/ react.createElement(PageListReviewMoveAction, null), /*#__PURE__*/ react.createElement(PageListReviewBulkPublishAction, null));
|
|
6
8
|
export { PagesList };
|
|
7
9
|
|
|
8
10
|
//# sourceMappingURL=PagesList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Components/PagesList/PagesList.js","sources":["../../../src/Components/PagesList/PagesList.tsx"],"sourcesContent":["import React from \"react\";\nimport { PageListConfig } from \"@webiny/app-website-builder\";\nimport { WbContentReviewsSidebarItem } from \"~/Components/ContentReviews/WbContentReviewsSidebarItem.js\";\nimport { PageListReviewGatedActions } from \"./PageListReviewGatedActions.js\";\n\nexport const PagesList = () => {\n return (\n <PageListConfig>\n {/* Add a Content Reviews item to the footer of the sidebar. */}\n <WbContentReviewsSidebarItem />\n {/*
|
|
1
|
+
{"version":3,"file":"Components/PagesList/PagesList.js","sources":["../../../src/Components/PagesList/PagesList.tsx"],"sourcesContent":["import React from \"react\";\nimport { PageListConfig } from \"@webiny/app-website-builder\";\nimport { WbContentReviewsSidebarItem } from \"~/Components/ContentReviews/WbContentReviewsSidebarItem.js\";\nimport { PageListReviewGatedActions } from \"./PageListReviewGatedActions.js\";\nimport { PageListReviewMoveAction } from \"./PageListReviewMoveAction.js\";\nimport { PageListReviewBulkPublishAction } from \"./PageListReviewBulkPublishAction.js\";\n\nexport const PagesList = () => {\n return (\n <PageListConfig>\n {/* Add a Content Reviews item to the footer of the sidebar. */}\n <WbContentReviewsSidebarItem />\n {/* Disable Publish and hide Schedule publish for pages the API would refuse to publish. */}\n <PageListReviewGatedActions />\n {/* Disable the Move row action for pages in review. */}\n <PageListReviewMoveAction />\n {/* Disable the bulk Publish while a selected page may not be published. */}\n <PageListReviewBulkPublishAction />\n </PageListConfig>\n );\n};\n"],"names":["PagesList","PageListConfig","WbContentReviewsSidebarItem","PageListReviewGatedActions","PageListReviewMoveAction","PageListReviewBulkPublishAction"],"mappings":";;;;;;AAOO,MAAMA,YAAY,IACd,WAAP,GACI,oBAACC,gBAAcA,MAAAA,WAAAA,GAEX,oBAACC,6BAA2BA,OAAAA,WAAAA,GAE5B,oBAACC,4BAA0BA,OAAAA,WAAAA,GAE3B,oBAACC,0BAAwBA,OAAAA,WAAAA,GAEzB,oBAACC,iCAA+BA"}
|
|
@@ -25,6 +25,22 @@ vi.mock("./PageListReviewGatedActions.js", async ()=>{
|
|
|
25
25
|
})
|
|
26
26
|
};
|
|
27
27
|
});
|
|
28
|
+
vi.mock("./PageListReviewMoveAction.js", async ()=>{
|
|
29
|
+
const React = await import("react");
|
|
30
|
+
return {
|
|
31
|
+
PageListReviewMoveAction: ()=>React.createElement("div", {
|
|
32
|
+
"data-testid": "review-move-action"
|
|
33
|
+
})
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
vi.mock("./PageListReviewBulkPublishAction.js", async ()=>{
|
|
37
|
+
const React = await import("react");
|
|
38
|
+
return {
|
|
39
|
+
PageListReviewBulkPublishAction: ()=>React.createElement("div", {
|
|
40
|
+
"data-testid": "review-bulk-publish-action"
|
|
41
|
+
})
|
|
42
|
+
};
|
|
43
|
+
});
|
|
28
44
|
vi.mock("~/Components/ContentReviews/WbContentReviewsSidebarItem.js", async ()=>{
|
|
29
45
|
const React = await import("react");
|
|
30
46
|
return {
|
|
@@ -41,6 +57,8 @@ describe("PagesList", ()=>{
|
|
|
41
57
|
render(/*#__PURE__*/ react.createElement(PagesList, null));
|
|
42
58
|
expect(screen.getByTestId("wb-content-reviews-sidebar")).toBeTruthy();
|
|
43
59
|
expect(screen.getByTestId("review-gated-actions")).toBeTruthy();
|
|
60
|
+
expect(screen.getByTestId("review-move-action")).toBeTruthy();
|
|
61
|
+
expect(screen.getByTestId("review-bulk-publish-action")).toBeTruthy();
|
|
44
62
|
});
|
|
45
63
|
});
|
|
46
64
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Components/PagesList/PagesList.test.js","sources":["../../../src/Components/PagesList/PagesList.test.tsx"],"sourcesContent":["import React from \"react\";\nimport { afterEach } from \"vitest\";\nimport { describe } from \"vitest\";\nimport { expect } from \"vitest\";\nimport { it } from \"vitest\";\nimport { vi } from \"vitest\";\nimport { cleanup } from \"@testing-library/react\";\nimport { render } from \"@testing-library/react\";\nimport { screen } from \"@testing-library/react\";\nimport { PagesList } from \"./PagesList.js\";\n\ninterface ChildrenProps {\n children: React.ReactNode;\n}\n\nvi.mock(\"@webiny/app-website-builder\", async () => {\n const React = await import(\"react\");\n const Config = ({ children }: ChildrenProps) => {\n return React.createElement(\"div\", { \"data-testid\": \"page-list-config\" }, children);\n };\n return {\n PageListConfig: Object.assign(Config, { Browser: { Sidebar: { Footer: () => null } } })\n };\n});\n\nvi.mock(\"./PageListReviewGatedActions.js\", async () => {\n const React = await import(\"react\");\n return {\n PageListReviewGatedActions: () =>\n React.createElement(\"div\", { \"data-testid\": \"review-gated-actions\" })\n };\n});\n\nvi.mock(\"~/Components/ContentReviews/WbContentReviewsSidebarItem.js\", async () => {\n const React = await import(\"react\");\n return {\n WbContentReviewsSidebarItem: () =>\n React.createElement(\"div\", { \"data-testid\": \"wb-content-reviews-sidebar\" })\n };\n});\n\ndescribe(\"PagesList\", () => {\n afterEach(() => {\n cleanup();\n });\n\n it(\"mounts the Content Reviews sidebar item next to the review-gated row actions\", () => {\n render(<PagesList />);\n\n expect(screen.getByTestId(\"wb-content-reviews-sidebar\")).toBeTruthy();\n expect(screen.getByTestId(\"review-gated-actions\")).toBeTruthy();\n });\n});\n"],"names":["vi","React","Config","children","Object","describe","afterEach","cleanup","it","render","PagesList","expect","screen"],"mappings":";;;;AAeAA,GAAG,IAAI,CAAC,+BAA+B;IACnC,MAAMC,QAAQ,MAAM,MAAM,CAAC;IAC3B,MAAMC,SAAS,CAAC,EAAEC,QAAQ,EAAiB,GAChCF,MAAM,aAAa,CAAC,OAAO;YAAE,eAAe;QAAmB,GAAGE;IAE7E,OAAO;QACH,gBAAgBC,OAAO,MAAM,CAACF,QAAQ;YAAE,SAAS;gBAAE,SAAS;oBAAE,QAAQ,IAAM;gBAAK;YAAE;QAAE;IACzF;AACJ;AAEAF,GAAG,IAAI,CAAC,mCAAmC;IACvC,MAAMC,QAAQ,MAAM,MAAM,CAAC;IAC3B,OAAO;QACH,4BAA4B,IACxBA,MAAM,aAAa,CAAC,OAAO;gBAAE,eAAe;YAAuB;IAC3E;AACJ;AAEAD,GAAG,IAAI,CAAC,8DAA8D;IAClE,MAAMC,QAAQ,MAAM,MAAM,CAAC;IAC3B,OAAO;QACH,6BAA6B,IACzBA,MAAM,aAAa,CAAC,OAAO;gBAAE,eAAe;YAA6B;IACjF;AACJ;AAEAI,SAAS,aAAa;IAClBC,UAAU;QACNC;IACJ;IAEAC,GAAG,gFAAgF;QAC/EC,OAAO,WAADA,GAAC,oBAACC,WAASA;QAEjBC,OAAOC,OAAO,WAAW,CAAC,+BAA+B,UAAU;QACnED,OAAOC,OAAO,WAAW,CAAC,yBAAyB,UAAU;
|
|
1
|
+
{"version":3,"file":"Components/PagesList/PagesList.test.js","sources":["../../../src/Components/PagesList/PagesList.test.tsx"],"sourcesContent":["import React from \"react\";\nimport { afterEach } from \"vitest\";\nimport { describe } from \"vitest\";\nimport { expect } from \"vitest\";\nimport { it } from \"vitest\";\nimport { vi } from \"vitest\";\nimport { cleanup } from \"@testing-library/react\";\nimport { render } from \"@testing-library/react\";\nimport { screen } from \"@testing-library/react\";\nimport { PagesList } from \"./PagesList.js\";\n\ninterface ChildrenProps {\n children: React.ReactNode;\n}\n\nvi.mock(\"@webiny/app-website-builder\", async () => {\n const React = await import(\"react\");\n const Config = ({ children }: ChildrenProps) => {\n return React.createElement(\"div\", { \"data-testid\": \"page-list-config\" }, children);\n };\n return {\n PageListConfig: Object.assign(Config, { Browser: { Sidebar: { Footer: () => null } } })\n };\n});\n\nvi.mock(\"./PageListReviewGatedActions.js\", async () => {\n const React = await import(\"react\");\n return {\n PageListReviewGatedActions: () =>\n React.createElement(\"div\", { \"data-testid\": \"review-gated-actions\" })\n };\n});\n\nvi.mock(\"./PageListReviewMoveAction.js\", async () => {\n const React = await import(\"react\");\n return {\n PageListReviewMoveAction: () =>\n React.createElement(\"div\", { \"data-testid\": \"review-move-action\" })\n };\n});\n\nvi.mock(\"./PageListReviewBulkPublishAction.js\", async () => {\n const React = await import(\"react\");\n return {\n PageListReviewBulkPublishAction: () =>\n React.createElement(\"div\", { \"data-testid\": \"review-bulk-publish-action\" })\n };\n});\n\nvi.mock(\"~/Components/ContentReviews/WbContentReviewsSidebarItem.js\", async () => {\n const React = await import(\"react\");\n return {\n WbContentReviewsSidebarItem: () =>\n React.createElement(\"div\", { \"data-testid\": \"wb-content-reviews-sidebar\" })\n };\n});\n\ndescribe(\"PagesList\", () => {\n afterEach(() => {\n cleanup();\n });\n\n it(\"mounts the Content Reviews sidebar item next to the review-gated row actions\", () => {\n render(<PagesList />);\n\n expect(screen.getByTestId(\"wb-content-reviews-sidebar\")).toBeTruthy();\n expect(screen.getByTestId(\"review-gated-actions\")).toBeTruthy();\n expect(screen.getByTestId(\"review-move-action\")).toBeTruthy();\n expect(screen.getByTestId(\"review-bulk-publish-action\")).toBeTruthy();\n });\n});\n"],"names":["vi","React","Config","children","Object","describe","afterEach","cleanup","it","render","PagesList","expect","screen"],"mappings":";;;;AAeAA,GAAG,IAAI,CAAC,+BAA+B;IACnC,MAAMC,QAAQ,MAAM,MAAM,CAAC;IAC3B,MAAMC,SAAS,CAAC,EAAEC,QAAQ,EAAiB,GAChCF,MAAM,aAAa,CAAC,OAAO;YAAE,eAAe;QAAmB,GAAGE;IAE7E,OAAO;QACH,gBAAgBC,OAAO,MAAM,CAACF,QAAQ;YAAE,SAAS;gBAAE,SAAS;oBAAE,QAAQ,IAAM;gBAAK;YAAE;QAAE;IACzF;AACJ;AAEAF,GAAG,IAAI,CAAC,mCAAmC;IACvC,MAAMC,QAAQ,MAAM,MAAM,CAAC;IAC3B,OAAO;QACH,4BAA4B,IACxBA,MAAM,aAAa,CAAC,OAAO;gBAAE,eAAe;YAAuB;IAC3E;AACJ;AAEAD,GAAG,IAAI,CAAC,iCAAiC;IACrC,MAAMC,QAAQ,MAAM,MAAM,CAAC;IAC3B,OAAO;QACH,0BAA0B,IACtBA,MAAM,aAAa,CAAC,OAAO;gBAAE,eAAe;YAAqB;IACzE;AACJ;AAEAD,GAAG,IAAI,CAAC,wCAAwC;IAC5C,MAAMC,QAAQ,MAAM,MAAM,CAAC;IAC3B,OAAO;QACH,iCAAiC,IAC7BA,MAAM,aAAa,CAAC,OAAO;gBAAE,eAAe;YAA6B;IACjF;AACJ;AAEAD,GAAG,IAAI,CAAC,8DAA8D;IAClE,MAAMC,QAAQ,MAAM,MAAM,CAAC;IAC3B,OAAO;QACH,6BAA6B,IACzBA,MAAM,aAAa,CAAC,OAAO;gBAAE,eAAe;YAA6B;IACjF;AACJ;AAEAI,SAAS,aAAa;IAClBC,UAAU;QACNC;IACJ;IAEAC,GAAG,gFAAgF;QAC/EC,OAAO,WAADA,GAAC,oBAACC,WAASA;QAEjBC,OAAOC,OAAO,WAAW,CAAC,+BAA+B,UAAU;QACnED,OAAOC,OAAO,WAAW,CAAC,yBAAyB,UAAU;QAC7DD,OAAOC,OAAO,WAAW,CAAC,uBAAuB,UAAU;QAC3DD,OAAOC,OAAO,WAAW,CAAC,+BAA+B,UAAU;IACvE;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ignoreAction(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Components/PagesList/ignoreAction.js","sources":["../../../src/Components/PagesList/ignoreAction.ts"],"sourcesContent":["// A disabled action still needs a handler; it does nothing.\nexport function ignoreAction(): void {}\n"],"names":["ignoreAction"],"mappings":"AACO,SAASA,gBAAsB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ListPublishRow } from "@webiny/app-workflows/review/presentation/listActions/ListPublishRow.js";
|
|
2
|
+
import type { WbPageSystem } from "@webiny/app-website-builder/types.js";
|
|
3
|
+
import "~/types.js";
|
|
4
|
+
export interface PublishRowPage {
|
|
5
|
+
status: string;
|
|
6
|
+
system: WbPageSystem | null;
|
|
7
|
+
}
|
|
8
|
+
export declare const toListPublishRow: (page: PublishRowPage) => ListPublishRow;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WbPageStatus } from "@webiny/app-website-builder/constants.js";
|
|
2
|
+
import "../../types.js";
|
|
3
|
+
const toListPublishRow = (page)=>({
|
|
4
|
+
reviewState: page.system?.workflow?.reviewState ?? null,
|
|
5
|
+
isPublished: page.status === WbPageStatus.Published,
|
|
6
|
+
isUnpublished: page.status === WbPageStatus.Unpublished
|
|
7
|
+
});
|
|
8
|
+
export { toListPublishRow };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=toListPublishRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Components/PagesList/toListPublishRow.js","sources":["../../../src/Components/PagesList/toListPublishRow.ts"],"sourcesContent":["import type { ListPublishRow } from \"@webiny/app-workflows/review/presentation/listActions/ListPublishRow.js\";\nimport type { WbPageSystem } from \"@webiny/app-website-builder/types.js\";\nimport { WbPageStatus } from \"@webiny/app-website-builder/constants.js\";\nimport \"~/types.js\";\n\n// A pages list row: the list's `Page` and the row action's `PageDto` both have these.\nexport interface PublishRowPage {\n status: string;\n system: WbPageSystem | null;\n}\n\n// What the shared publish gates need to know about a pages list row. Pure.\nexport const toListPublishRow = (page: PublishRowPage): ListPublishRow => {\n return {\n reviewState: page.system?.workflow?.reviewState ?? null,\n isPublished: page.status === WbPageStatus.Published,\n isUnpublished: page.status === WbPageStatus.Unpublished\n };\n};\n"],"names":["toListPublishRow","page","WbPageStatus"],"mappings":";;AAYO,MAAMA,mBAAmB,CAACC,OACtB;QACH,aAAaA,KAAK,MAAM,EAAE,UAAU,eAAe;QACnD,aAAaA,KAAK,MAAM,KAAKC,aAAa,SAAS;QACnD,eAAeD,KAAK,MAAM,KAAKC,aAAa,WAAW;IAC3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "~/types.js";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { ReviewState } from "@webiny/app-workflows/review/domain/ReviewState.js";
|
|
3
|
+
import { StepState } from "@webiny/app-workflows/review/domain/StepState.js";
|
|
4
|
+
import "../../types.js";
|
|
5
|
+
import { toListPublishRow } from "./toListPublishRow.js";
|
|
6
|
+
describe("toListPublishRow", ()=>{
|
|
7
|
+
it("reads the review state and the status of a page", ()=>{
|
|
8
|
+
const row = toListPublishRow({
|
|
9
|
+
status: "published",
|
|
10
|
+
system: {
|
|
11
|
+
workflow: {
|
|
12
|
+
workflowId: "workflow-1",
|
|
13
|
+
reviewState: ReviewState.Approved,
|
|
14
|
+
stepId: "step-1",
|
|
15
|
+
stepName: "Legal",
|
|
16
|
+
stepState: StepState.InReview
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
expect(row).toEqual({
|
|
21
|
+
reviewState: ReviewState.Approved,
|
|
22
|
+
isPublished: true,
|
|
23
|
+
isUnpublished: false
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
it("reads a page with no review", ()=>{
|
|
27
|
+
expect(toListPublishRow({
|
|
28
|
+
status: "unpublished",
|
|
29
|
+
system: null
|
|
30
|
+
})).toEqual({
|
|
31
|
+
reviewState: null,
|
|
32
|
+
isPublished: false,
|
|
33
|
+
isUnpublished: true
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=toListPublishRow.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Components/PagesList/toListPublishRow.test.js","sources":["../../../src/Components/PagesList/toListPublishRow.test.ts"],"sourcesContent":["import { describe } from \"vitest\";\nimport { expect } from \"vitest\";\nimport { it } from \"vitest\";\nimport { ReviewState } from \"@webiny/app-workflows/review/domain/ReviewState.js\";\nimport { StepState } from \"@webiny/app-workflows/review/domain/StepState.js\";\nimport \"~/types.js\";\nimport { toListPublishRow } from \"./toListPublishRow.js\";\n\ndescribe(\"toListPublishRow\", () => {\n it(\"reads the review state and the status of a page\", () => {\n const row = toListPublishRow({\n status: \"published\",\n system: {\n workflow: {\n workflowId: \"workflow-1\",\n reviewState: ReviewState.Approved,\n stepId: \"step-1\",\n stepName: \"Legal\",\n stepState: StepState.InReview\n }\n }\n });\n\n expect(row).toEqual({\n reviewState: ReviewState.Approved,\n isPublished: true,\n isUnpublished: false\n });\n });\n\n it(\"reads a page with no review\", () => {\n expect(toListPublishRow({ status: \"unpublished\", system: null })).toEqual({\n reviewState: null,\n isPublished: false,\n isUnpublished: true\n });\n });\n});\n"],"names":["describe","it","row","toListPublishRow","ReviewState","StepState","expect"],"mappings":";;;;;AAQAA,SAAS,oBAAoB;IACzBC,GAAG,mDAAmD;QAClD,MAAMC,MAAMC,iBAAiB;YACzB,QAAQ;YACR,QAAQ;gBACJ,UAAU;oBACN,YAAY;oBACZ,aAAaC,YAAY,QAAQ;oBACjC,QAAQ;oBACR,UAAU;oBACV,WAAWC,UAAU,QAAQ;gBACjC;YACJ;QACJ;QAEAC,OAAOJ,KAAK,OAAO,CAAC;YAChB,aAAaE,YAAY,QAAQ;YACjC,aAAa;YACb,eAAe;QACnB;IACJ;IAEAH,GAAG,+BAA+B;QAC9BK,OAAOH,iBAAiB;YAAE,QAAQ;YAAe,QAAQ;QAAK,IAAI,OAAO,CAAC;YACtE,aAAa;YACb,aAAa;YACb,eAAe;QACnB;IACJ;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const usePageRowPublishDisabledReason: () => string | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useFeature } from "@webiny/app";
|
|
3
|
+
import { usePage } from "@webiny/app-website-builder/presentation/pages/PageList/hooks/usePage.js";
|
|
4
|
+
import { BoundWorkflowFeature } from "@webiny/app-workflows/review/presentation/boundWorkflow/feature.js";
|
|
5
|
+
import { getRowPublishDisabledReason } from "@webiny/app-workflows/review/presentation/listActions/getRowPublishDisabledReason.js";
|
|
6
|
+
import { WB_PAGE_APP } from "../../constants.js";
|
|
7
|
+
import { toListPublishRow } from "./toListPublishRow.js";
|
|
8
|
+
const usePageRowPublishDisabledReason = ()=>{
|
|
9
|
+
const { page } = usePage();
|
|
10
|
+
const { presenter } = useFeature(BoundWorkflowFeature);
|
|
11
|
+
useEffect(()=>{
|
|
12
|
+
presenter.load(WB_PAGE_APP);
|
|
13
|
+
}, [
|
|
14
|
+
presenter
|
|
15
|
+
]);
|
|
16
|
+
const row = toListPublishRow(page);
|
|
17
|
+
return getRowPublishDisabledReason({
|
|
18
|
+
workflowStatus: presenter.vm.status,
|
|
19
|
+
reviewState: row.reviewState,
|
|
20
|
+
isUnpublished: row.isUnpublished
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
export { usePageRowPublishDisabledReason };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=usePageRowPublishDisabledReason.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Components/PagesList/usePageRowPublishDisabledReason.js","sources":["../../../src/Components/PagesList/usePageRowPublishDisabledReason.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useFeature } from \"@webiny/app\";\nimport { usePage } from \"@webiny/app-website-builder/presentation/pages/PageList/hooks/usePage.js\";\nimport { BoundWorkflowFeature } from \"@webiny/app-workflows/review/presentation/boundWorkflow/feature.js\";\nimport { getRowPublishDisabledReason } from \"@webiny/app-workflows/review/presentation/listActions/getRowPublishDisabledReason.js\";\nimport { WB_PAGE_APP } from \"~/constants.js\";\nimport { toListPublishRow } from \"./toListPublishRow.js\";\n\n/*\n * Why the list row's page may not be published now (`getRowPublishDisabledReason`), loading\n * whether a workflow binds the pages (one cached lookup for the whole list); `null` when\n * publishing is allowed. Read it inside a reactive component.\n */\nexport const usePageRowPublishDisabledReason = (): string | null => {\n const { page } = usePage();\n const { presenter } = useFeature(BoundWorkflowFeature);\n\n useEffect(() => {\n void presenter.load(WB_PAGE_APP);\n }, [presenter]);\n\n const row = toListPublishRow(page);\n\n return getRowPublishDisabledReason({\n workflowStatus: presenter.vm.status,\n reviewState: row.reviewState,\n isUnpublished: row.isUnpublished\n });\n};\n"],"names":["usePageRowPublishDisabledReason","page","usePage","presenter","useFeature","BoundWorkflowFeature","useEffect","WB_PAGE_APP","row","toListPublishRow","getRowPublishDisabledReason"],"mappings":";;;;;;;AAaO,MAAMA,kCAAkC;IAC3C,MAAM,EAAEC,IAAI,EAAE,GAAGC;IACjB,MAAM,EAAEC,SAAS,EAAE,GAAGC,WAAWC;IAEjCC,UAAU;QACDH,UAAU,IAAI,CAACI;IACxB,GAAG;QAACJ;KAAU;IAEd,MAAMK,MAAMC,iBAAiBR;IAE7B,OAAOS,4BAA4B;QAC/B,gBAAgBP,UAAU,EAAE,CAAC,MAAM;QACnC,aAAaK,IAAI,WAAW;QAC5B,eAAeA,IAAI,aAAa;IACpC;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Routes/WebsiteBuilderWorkflowsMenu.test.js","sources":["../../src/Routes/WebsiteBuilderWorkflowsMenu.test.tsx"],"sourcesContent":["import React from \"react\";\nimport { afterEach } from \"vitest\";\nimport { beforeEach } from \"vitest\";\nimport { describe } from \"vitest\";\nimport { expect } from \"vitest\";\nimport { it } from \"vitest\";\nimport { vi } from \"vitest\";\nimport { cleanup } from \"@testing-library/react\";\nimport { render } from \"@testing-library/react\";\nimport { screen } from \"@testing-library/react\";\nimport { Container } from \"@webiny/di\";\nimport { DiContainerProvider } from \"@webiny/app\";\nimport { Route } from \"@webiny/app/features/router/Route.js\";\nimport { RouterWithConfig } from \"@webiny/app/config/RouterConfig.js\";\nimport { useRouterConfig } from \"@webiny/app/config/RouterConfig.js\";\nimport { AdminConfig } from \"@webiny/app-admin\";\nimport { AdminConfigPlugin } from \"@webiny/app-admin/config/AdminConfig.js\";\nimport { AdminWithConfig } from \"@webiny/app-admin/config/AdminConfig.js\";\nimport { useAdminConfig } from \"@webiny/app-admin/config/AdminConfig.js\";\nimport { CompositionProvider } from \"@webiny/react-composition\";\nimport { createFakeAppAdapter } from \"@webiny/app-workflows/editor/testing/fakeEditorAppAdapter.js\";\nimport { findElements } from \"@webiny/app-workflows/editor/testing/findElements.js\";\nimport { WorkflowEditorView } from \"@webiny/app-workflows/editor/presentation/editor/components/WorkflowEditorView.js\";\nimport { WbWorkflowEditorAppAdapter } from \"~/features/editorMounting/abstractions.js\";\nimport { WebsiteBuilderWorkflowsMenu } from \"./WebsiteBuilderWorkflowsMenu.js\";\n\ninterface RouteStub {\n path: string;\n}\n\nconst permission = vi.hoisted(() => {\n return { editor: true };\n});\n\nvi.mock(\"@webiny/app-workflows/presentation/permissions/useWorkflowsPermission.js\", () => {\n return {\n useWorkflowsPermission: () => {\n return { editor: permission.editor, reassign: false };\n }\n };\n});\n\nvi.mock(\"@webiny/app-workflows/editor/presentation/editor/components/WorkflowEditorView.js\", () => {\n return { WorkflowEditorView: () => null };\n});\n\nvi.mock(\"@webiny/app-admin\", async importOriginal => {\n const actual = await importOriginal<typeof import(\"@webiny/app-admin\")>();\n return {\n ...actual,\n useRouter: () => {\n return { getLink: (route: RouteStub) => route.path };\n }\n };\n});\n\ninterface CapturedRoute {\n name: string;\n element: React.ReactElement;\n}\n\ninterface CapturedMenu {\n name: string;\n parent: string | null;\n element: React.ReactElement<Record<string, unknown>> | undefined;\n}\n\ninterface Captured {\n routes: CapturedRoute[];\n menus: CapturedMenu[];\n}\n\nconst captured: Captured = { routes: [], menus: [] };\n\nconst Probe = () => {\n const routerConfig = useRouterConfig();\n const adminConfig = useAdminConfig();\n captured.routes = routerConfig.routes.map(item => {\n return { name: item.route.name, element: item.element };\n });\n captured.menus = adminConfig.menus.map(menu => {\n return {\n name: menu.name,\n parent: menu.parent ?? null,\n // A guard, not a cast: only an element whose props can be read is kept.\n element: React.isValidElement<Record<string, unknown>>(menu.element)\n ? menu.element\n : undefined\n };\n });\n const routeNames = captured.routes.map(item => item.name);\n const menuNames = captured.menus.map(item => `${item.name}:${item.parent ?? \"\"}`);\n\n return (\n <div\n data-testid=\"probe\"\n data-routes={routeNames.join(\",\")}\n data-menus={menuNames.join(\",\")}\n />\n );\n};\n\nconst app = createFakeAppAdapter(\"wb\");\n\nconst { Menu } = AdminConfig;\n\n// The router renders nothing without a route, so a sentinel keeps the probe mounted.\nconst sentinelRoute = new Route({ name: \"Test/Sentinel\", path: \"/test/sentinel\" });\n\n// The real mounting feature resolves the two tokens, which the test registers as instances.\nconst mount = async (): Promise<Captured> => {\n const container = new Container();\n container.registerInstance(WbWorkflowEditorAppAdapter, app);\n\n render(\n <DiContainerProvider container={container}>\n <CompositionProvider>\n <WebsiteBuilderWorkflowsMenu />\n <AdminConfig>\n <Menu name=\"test.sentinel\" element={<div />} />\n <AdminConfig.Route route={sentinelRoute} element={<div />} />\n </AdminConfig>\n <AdminWithConfig>\n {AdminConfigPlugin}\n <RouterWithConfig>\n <Probe />\n </RouterWithConfig>\n </AdminWithConfig>\n </CompositionProvider>\n </DiContainerProvider>\n );\n\n const probe = await screen.findByTestId(\"probe\");\n // The sentinel menu proves the configs flushed, so a missing editor route or menu is real.\n await vi.waitFor(() => {\n expect(probe.getAttribute(\"data-menus\")).toContain(\"test.sentinel\");\n });\n\n return captured;\n};\n\ndescribe(\"WebsiteBuilderWorkflowsMenu\", () => {\n beforeEach(() => {\n permission.editor = true;\n captured.routes = [];\n captured.menus = [];\n });\n\n afterEach(() => {\n cleanup();\n });\n\n it(\"registers the /website-builder/workflows route and the Website Builder menu item for an editor\", async () => {\n const result = await mount();\n const routeNames = result.routes.map(item => item.name);\n const menuNames = result.menus.map(item => `${item.name}:${item.parent ?? \"\"}`);\n\n expect(routeNames).toContain(\"WebsiteBuilder/PageWorkflow\");\n expect(menuNames).toContain(\"websiteBuilder.pages.workflows:wb\");\n });\n\n it(\"links the menu item to /website-builder/workflows\", async () => {\n const result = await mount();\n\n const menu = result.menus.find(item => item.name === \"websiteBuilder.pages.workflows\");\n\n expect(menu?.element?.props.text).toBe(\"Workflows\");\n expect(menu?.element?.props.to).toBe(\"/website-builder/workflows\");\n });\n\n it(\"gives the view the WB review use cases and the WB adapter, no editor use cases (R353)\", async () => {\n const result = await mount();\n const route = result.routes.find(item => item.name === \"WebsiteBuilder/PageWorkflow\");\n if (!route) {\n throw new Error(\"The editor route is not registered.\");\n }\n\n const views = findElements(route.element, WorkflowEditorView);\n\n expect(views).toHaveLength(1);\n expect(views[0].props).not.toHaveProperty(\"useCases\");\n expect(Object.keys(views[0].props)).toEqual([\"app\", \"breadcrumbName\"]);\n expect(views[0].props.app).toBe(app);\n });\n\n it(\"names the breadcrumbs Website Builder and Workflows\", async () => {\n const result = await mount();\n const route = result.routes.find(item => item.name === \"WebsiteBuilder/PageWorkflow\");\n if (!route) {\n throw new Error(\"The editor route is not registered.\");\n }\n\n const breadcrumbs = findElements(route.element, AdminConfig.Breadcrumb);\n const texts = breadcrumbs.map(item => `${item.props.name}:${item.props.label}`);\n\n expect(texts).toEqual([\"wb:Website Builder\", \"wb.workflows:Workflows\"]);\n });\n\n it(\"registers the route but not the menu item without the editor permission\", async () => {\n permission.editor = false;\n\n const result = await mount();\n const routeNames = result.routes.map(item => item.name);\n const menuNames = result.menus.map(item => item.name);\n\n expect(routeNames).toContain(\"WebsiteBuilder/PageWorkflow\");\n expect(menuNames).not.toContain(\"websiteBuilder.pages.workflows\");\n });\n});\n"],"names":["permission","vi","importOriginal","actual","route","captured","Probe","routerConfig","useRouterConfig","adminConfig","useAdminConfig","item","menu","React","undefined","routeNames","menuNames","app","createFakeAppAdapter","Menu","AdminConfig","sentinelRoute","Route","mount","container","Container","WbWorkflowEditorAppAdapter","render","DiContainerProvider","CompositionProvider","WebsiteBuilderWorkflowsMenu","AdminWithConfig","AdminConfigPlugin","RouterWithConfig","probe","screen","expect","describe","beforeEach","afterEach","cleanup","it","result","Error","views","findElements","WorkflowEditorView","Object","breadcrumbs","texts"],"mappings":";;;;;;;;;;;;;;;AA8BA,MAAMA,aAAaC,GAAG,OAAO,CAAC,IACnB;QAAE,QAAQ;IAAK;AAG1BA,GAAG,IAAI,CAAC,4EAA4E,IACzE;QACH,wBAAwB,IACb;gBAAE,QAAQD,WAAW,MAAM;gBAAE,UAAU;YAAM;IAE5D;AAGJC,GAAG,IAAI,CAAC,qFAAqF,IAClF;QAAE,oBAAoB,IAAM;IAAK;AAG5CA,GAAG,IAAI,CAAC,qBAAqB,OAAMC;IAC/B,MAAMC,SAAS,MAAMD;IACrB,OAAO;QACH,GAAGC,MAAM;QACT,WAAW,IACA;gBAAE,SAAS,CAACC,QAAqBA,MAAM,IAAI;YAAC;IAE3D;AACJ;AAkBA,MAAMC,WAAqB;IAAE,QAAQ,EAAE;IAAE,OAAO,EAAE;AAAC;AAEnD,MAAMC,QAAQ;IACV,MAAMC,eAAeC;IACrB,MAAMC,cAAcC;IACpBL,SAAS,MAAM,GAAGE,aAAa,MAAM,CAAC,GAAG,CAACI,CAAAA,OAC/B;YAAE,MAAMA,KAAK,KAAK,CAAC,IAAI;YAAE,SAASA,KAAK,OAAO;QAAC;IAE1DN,SAAS,KAAK,GAAGI,YAAY,KAAK,CAAC,GAAG,CAACG,CAAAA,OAC5B;YACH,MAAMA,KAAK,IAAI;YACf,QAAQA,KAAK,MAAM,IAAI;YAEvB,SAAS,WAAT,GAASC,MAAAA,cAAoB,CAA0BD,KAAK,OAAO,IAC7DA,KAAK,OAAO,GACZE;QACV;IAEJ,MAAMC,aAAaV,SAAS,MAAM,CAAC,GAAG,CAACM,CAAAA,OAAQA,KAAK,IAAI;IACxD,MAAMK,YAAYX,SAAS,KAAK,CAAC,GAAG,CAACM,CAAAA,OAAQ,GA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AAO,EAAEgB,YAAY,UAAU;QACtE,MAAM6B,QAAQD,YAAY,GAAG,CAACrC,CAAAA,OAAQ,GAAGA,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,EAAEA,KAAK,KAAK,CAAC,KAAK,EAAE;QAE9EyB,OAAOa,OAAO,OAAO,CAAC;YAAC;YAAsB;SAAyB;IAC1E;IAEAR,GAAG,2EAA2E;QAC1EzC,WAAW,MAAM,GAAG;QAEpB,MAAM0C,SAAS,MAAMnB;QACrB,MAAMR,aAAa2B,OAAO,MAAM,CAAC,GAAG,CAAC/B,CAAAA,OAAQA,KAAK,IAAI;QACtD,MAAMK,YAAY0B,OAAO,KAAK,CAAC,GAAG,CAAC/B,CAAAA,OAAQA,KAAK,IAAI;QAEpDyB,OAAOrB,YAAY,SAAS,CAAC;QAC7BqB,OAAOpB,WAAW,GAAG,CAAC,SAAS,CAAC;IACpC;AACJ"}
|
|
1
|
+
{"version":3,"file":"Routes/WebsiteBuilderWorkflowsMenu.test.js","sources":["../../src/Routes/WebsiteBuilderWorkflowsMenu.test.tsx"],"sourcesContent":["import React from \"react\";\nimport { afterEach } from \"vitest\";\nimport { beforeEach } from \"vitest\";\nimport { describe } from \"vitest\";\nimport { expect } from \"vitest\";\nimport { it } from \"vitest\";\nimport { vi } from \"vitest\";\nimport { cleanup } from \"@testing-library/react\";\nimport { render } from \"@testing-library/react\";\nimport { screen } from \"@testing-library/react\";\nimport { Container } from \"@webiny/di\";\nimport { DiContainerProvider } from \"@webiny/app\";\nimport { Route } from \"@webiny/app/features/router/Route.js\";\nimport { RouterWithConfig } from \"@webiny/app/config/RouterConfig.js\";\nimport { useRouterConfig } from \"@webiny/app/config/RouterConfig.js\";\nimport { AdminConfig } from \"@webiny/app-admin\";\nimport { AdminConfigPlugin } from \"@webiny/app-admin/config/AdminConfig.js\";\nimport { AdminWithConfig } from \"@webiny/app-admin/config/AdminConfig.js\";\nimport { useAdminConfig } from \"@webiny/app-admin/config/AdminConfig.js\";\nimport { CompositionProvider } from \"@webiny/react-composition\";\nimport { createFakeAppAdapter } from \"@webiny/app-workflows/editor/testing/fakeEditorAppAdapter.js\";\nimport { findElements } from \"@webiny/app-workflows/editor/testing/findElements.js\";\nimport { WorkflowEditorView } from \"@webiny/app-workflows/editor/presentation/editor/components/WorkflowEditorView.js\";\nimport { WbWorkflowEditorAppAdapter } from \"~/features/editorMounting/abstractions.js\";\nimport { WebsiteBuilderWorkflowsMenu } from \"./WebsiteBuilderWorkflowsMenu.js\";\n\ninterface RouteStub {\n path: string;\n}\n\nconst permission = vi.hoisted(() => {\n return { editor: true };\n});\n\nvi.mock(\"@webiny/app-workflows/presentation/permissions/useWorkflowsPermission.js\", () => {\n return {\n useWorkflowsPermission: () => {\n return { editor: permission.editor, reassign: false };\n }\n };\n});\n\nvi.mock(\"@webiny/app-workflows/editor/presentation/editor/components/WorkflowEditorView.js\", () => {\n return { WorkflowEditorView: () => null };\n});\n\nvi.mock(\"@webiny/app-admin\", async importOriginal => {\n const actual = await importOriginal<typeof import(\"@webiny/app-admin\")>();\n return {\n ...actual,\n useRouter: () => {\n return { getLink: (route: RouteStub) => route.path };\n }\n };\n});\n\ninterface CapturedRoute {\n name: string;\n element: React.ReactElement;\n}\n\ninterface CapturedMenu {\n name: string;\n parent: string | null;\n element: React.ReactElement<Record<string, unknown>> | undefined;\n}\n\ninterface Captured {\n routes: CapturedRoute[];\n menus: CapturedMenu[];\n}\n\nconst captured: Captured = { routes: [], menus: [] };\n\nconst Probe = () => {\n const routerConfig = useRouterConfig();\n const adminConfig = useAdminConfig();\n captured.routes = routerConfig.routes.map(item => {\n return { name: item.route.name, element: item.element };\n });\n captured.menus = adminConfig.menus.map(menu => {\n return {\n name: menu.name,\n parent: menu.parent ?? null,\n // A guard, not a cast: only an element whose props can be read is kept.\n element: React.isValidElement<Record<string, unknown>>(menu.element)\n ? menu.element\n : undefined\n };\n });\n const routeNames = captured.routes.map(item => item.name);\n const menuNames = captured.menus.map(item => `${item.name}:${item.parent ?? \"\"}`);\n\n return (\n <div\n data-testid=\"probe\"\n data-routes={routeNames.join(\",\")}\n data-menus={menuNames.join(\",\")}\n />\n );\n};\n\nconst app = createFakeAppAdapter(\"wb\");\n\nconst { Menu } = AdminConfig;\n\n// The router renders nothing without a route, so a sentinel keeps the probe mounted.\nconst sentinelRoute = new Route({ name: \"Test/Sentinel\", path: \"/test/sentinel\" });\n\n// The real mounting feature resolves the two tokens, which the test registers as instances.\nconst mount = async (): Promise<Captured> => {\n const container = new Container();\n container.registerInstance(WbWorkflowEditorAppAdapter, app);\n\n render(\n <DiContainerProvider container={container}>\n <CompositionProvider>\n <WebsiteBuilderWorkflowsMenu />\n <AdminConfig>\n <Menu name=\"test.sentinel\" element={<div />} />\n <AdminConfig.Route route={sentinelRoute} element={<div />} />\n </AdminConfig>\n <AdminWithConfig>\n {AdminConfigPlugin}\n <RouterWithConfig>\n <Probe />\n </RouterWithConfig>\n </AdminWithConfig>\n </CompositionProvider>\n </DiContainerProvider>\n );\n\n const probe = await screen.findByTestId(\"probe\");\n // The sentinel menu proves the configs flushed, so a missing editor route or menu is real.\n await vi.waitFor(() => {\n expect(probe.getAttribute(\"data-menus\")).toContain(\"test.sentinel\");\n });\n\n return captured;\n};\n\ndescribe(\"WebsiteBuilderWorkflowsMenu\", () => {\n beforeEach(() => {\n permission.editor = true;\n captured.routes = [];\n captured.menus = [];\n });\n\n afterEach(() => {\n cleanup();\n });\n\n it(\"registers the /website-builder/workflows route and the Website Builder menu item for an editor\", async () => {\n const result = await mount();\n const routeNames = result.routes.map(item => item.name);\n const menuNames = result.menus.map(item => `${item.name}:${item.parent ?? \"\"}`);\n\n expect(routeNames).toContain(\"WebsiteBuilder/PageWorkflow\");\n expect(menuNames).toContain(\"websiteBuilder.pages.workflows:wb\");\n });\n\n it(\"links the menu item to /website-builder/workflows\", async () => {\n const result = await mount();\n\n const menu = result.menus.find(item => item.name === \"websiteBuilder.pages.workflows\");\n\n expect(menu?.element?.props.text).toBe(\"Workflows\");\n expect(menu?.element?.props.to).toBe(\"/website-builder/workflows\");\n });\n\n it(\"gives the view the WB review use cases and the WB adapter, no editor use cases (R353)\", async () => {\n const result = await mount();\n const route = result.routes.find(item => item.name === \"WebsiteBuilder/PageWorkflow\");\n if (!route) {\n throw new Error(\"The editor route is not registered.\");\n }\n\n const views = findElements(route.element, WorkflowEditorView);\n\n expect(views).toHaveLength(1);\n expect(views[0].props).not.toHaveProperty(\"useCases\");\n expect(Object.keys(views[0].props)).toEqual([\"app\", \"breadcrumbName\"]);\n expect(views[0].props.app).toBe(app);\n });\n\n it(\"names the breadcrumbs Website Builder and Workflows\", async () => {\n const result = await mount();\n const route = result.routes.find(item => item.name === \"WebsiteBuilder/PageWorkflow\");\n if (!route) {\n throw new Error(\"The editor route is not registered.\");\n }\n\n const breadcrumbs = findElements(route.element, AdminConfig.Breadcrumb);\n const texts = breadcrumbs.map(item => `${item.props.name}:${item.props.label}`);\n\n expect(texts).toEqual([\"wb:Website Builder\", \"wb.workflows:Workflows\"]);\n });\n\n it(\"registers the route but not the menu item without the editor permission\", async () => {\n permission.editor = false;\n\n const result = await mount();\n const routeNames = result.routes.map(item => item.name);\n const menuNames = result.menus.map(item => item.name);\n\n expect(routeNames).toContain(\"WebsiteBuilder/PageWorkflow\");\n expect(menuNames).not.toContain(\"websiteBuilder.pages.workflows\");\n });\n});\n"],"names":["permission","vi","importOriginal","actual","route","captured","Probe","routerConfig","useRouterConfig","adminConfig","useAdminConfig","item","menu","React","undefined","routeNames","menuNames","app","createFakeAppAdapter","Menu","AdminConfig","sentinelRoute","Route","mount","container","Container","WbWorkflowEditorAppAdapter","render","DiContainerProvider","CompositionProvider","WebsiteBuilderWorkflowsMenu","AdminWithConfig","AdminConfigPlugin","RouterWithConfig","probe","screen","expect","describe","beforeEach","afterEach","cleanup","it","result","Error","views","findElements","WorkflowEditorView","Object","breadcrumbs","texts"],"mappings":";;;;;;;;;;;;;;;AA8BA,MAAMA,aAAaC,GAAG,OAAO,CAAC,I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G,2EAA2E;QAC1EzC,WAAW,MAAM,GAAG;QAEpB,MAAM0C,SAAS,MAAMnB;QACrB,MAAMR,aAAa2B,OAAO,MAAM,CAAC,GAAG,CAAC/B,CAAAA,OAAQA,KAAK,IAAI;QACtD,MAAMK,YAAY0B,OAAO,KAAK,CAAC,GAAG,CAAC/B,CAAAA,OAAQA,KAAK,IAAI;QAEpDyB,OAAOrB,YAAY,SAAS,CAAC;QAC7BqB,OAAOpB,WAAW,GAAG,CAAC,SAAS,CAAC;IACpC;AACJ"}
|
|
@@ -68,7 +68,7 @@ vi.mock("@webiny/app-workflows/review/editor/components/EditorReviewBar.js", asy
|
|
|
68
68
|
EditorReviewBar
|
|
69
69
|
};
|
|
70
70
|
});
|
|
71
|
-
const { Ui
|
|
71
|
+
const { Ui } = PageEditorConfig;
|
|
72
72
|
const mountRoot = (enabled)=>{
|
|
73
73
|
flags.enabled = enabled;
|
|
74
74
|
const handle = createFakeSession("inProgress");
|