@webiny/app-website-builder-workflows 6.6.0-alpha.13 → 6.6.0-alpha.14
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.
|
@@ -10,7 +10,8 @@ import { AdminConfigPlugin, AdminWithConfig, useAdminConfig } from "@webiny/app-
|
|
|
10
10
|
import { CompositionProvider } from "@webiny/react-composition";
|
|
11
11
|
import { createFakeAppAdapter } from "@webiny/app-workflows/editor/testing/fakeEditorAppAdapter.js";
|
|
12
12
|
import { findElements } from "@webiny/app-workflows/editor/testing/findElements.js";
|
|
13
|
-
import {
|
|
13
|
+
import { WorkflowEditorRouteView } from "@webiny/app-workflows/editor/mounting/components/WorkflowEditorRouteView.js";
|
|
14
|
+
import { Routes } from "../routes.js";
|
|
14
15
|
import { WbWorkflowEditorAppAdapter } from "../features/editorMounting/abstractions.js";
|
|
15
16
|
import { WebsiteBuilderWorkflowsMenu } from "./WebsiteBuilderWorkflowsMenu.js";
|
|
16
17
|
const permission = vi.hoisted(()=>({
|
|
@@ -108,13 +109,15 @@ describe("WebsiteBuilderWorkflowsMenu", ()=>{
|
|
|
108
109
|
const result = await mount();
|
|
109
110
|
const route = result.routes.find((item)=>"WebsiteBuilder/PageWorkflow" === item.name);
|
|
110
111
|
if (!route) throw new Error("The editor route is not registered.");
|
|
111
|
-
const views = findElements(route.element,
|
|
112
|
+
const views = findElements(route.element, WorkflowEditorRouteView);
|
|
112
113
|
expect(views).toHaveLength(1);
|
|
113
114
|
expect(views[0].props).not.toHaveProperty("useCases");
|
|
114
115
|
expect(Object.keys(views[0].props)).toEqual([
|
|
116
|
+
"route",
|
|
115
117
|
"app",
|
|
116
118
|
"breadcrumbName"
|
|
117
119
|
]);
|
|
120
|
+
expect(views[0].props.route).toBe(Routes.Pages.Workflows);
|
|
118
121
|
expect(views[0].props.app).toBe(app);
|
|
119
122
|
});
|
|
120
123
|
it("names the breadcrumbs Website Builder and Workflows", async ()=>{
|
|
@@ -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,CA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,EAAE,GAAG,CAAC,cAAc,CAAC;QAC1CR,OAAOW,OAAO,IAAI,CAACH,KAAK,CAAC,EAAE,CAAC,KAAK,GAAG,OAAO,CAAC;YAAC;YAAO;SAAiB;QACrER,OAAOQ,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC3B;IACpC;IAEAwB,GAAG,uDAAuD;QACtD,MAAMC,SAAS,MAAMnB;QACrB,MAAMnB,QAAQsC,OAAO,MAAM,CAAC,IAAI,CAAC/B,CAAAA,OAAQA,AAAc,kCAAdA,KAAK,IAAI;QAClD,IAAI,CAACP,OACD,MAAM,IAAIuC,MAAM;QAGpB,MAAMK,cAAcH,aAAazC,MAAM,OAAO,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 { WorkflowEditorRouteView } from \"@webiny/app-workflows/editor/mounting/components/WorkflowEditorRouteView.js\";\nimport { Routes } from \"~/routes.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 // The route view reads the model to open from the route, then renders the editor view.\n const views = findElements(route.element, WorkflowEditorRouteView);\n\n expect(views).toHaveLength(1);\n expect(views[0].props).not.toHaveProperty(\"useCases\");\n expect(Object.keys(views[0].props)).toEqual([\"route\", \"app\", \"breadcrumbName\"]);\n expect(views[0].props.route).toBe(Routes.Pages.Workflows);\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","WorkflowEditorRouteView","Object","Routes","breadcrumbs","texts"],"mappings":";;;;;;;;;;;;;;;;AA+BA,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,KAA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S;YAAO;SAAiB;QAC9ER,OAAOQ,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAACI,OAAO,KAAK,CAAC,SAAS;QACxDZ,OAAOQ,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC3B;IACpC;IAEAwB,GAAG,uDAAuD;QACtD,MAAMC,SAAS,MAAMnB;QACrB,MAAMnB,QAAQsC,OAAO,MAAM,CAAC,IAAI,CAAC/B,CAAAA,OAAQA,AAAc,kCAAdA,KAAK,IAAI;QAClD,IAAI,CAACP,OACD,MAAM,IAAIuC,MAAM;QAGpB,MAAMM,cAAcJ,aAAazC,MAAM,OAAO,EAAEgB,YAAY,UAAU;QACtE,MAAM8B,QAAQD,YAAY,GAAG,CAACtC,CAAAA,OAAQ,GAAGA,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,EAAEA,KAAK,KAAK,CAAC,KAAK,EAAE;QAE9EyB,OAAOc,OAAO,OAAO,CAAC;YAAC;YAAsB;SAAyB;IAC1E;IAEAT,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app-website-builder-workflows",
|
|
3
|
-
"version": "6.6.0-alpha.
|
|
3
|
+
"version": "6.6.0-alpha.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -13,15 +13,15 @@
|
|
|
13
13
|
"author": "Webiny Ltd",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@webiny/admin-ui": "6.6.0-alpha.
|
|
17
|
-
"@webiny/app": "6.6.0-alpha.
|
|
18
|
-
"@webiny/app-aco": "6.6.0-alpha.
|
|
19
|
-
"@webiny/app-admin": "6.6.0-alpha.
|
|
20
|
-
"@webiny/app-website-builder": "6.6.0-alpha.
|
|
21
|
-
"@webiny/app-websockets": "6.6.0-alpha.
|
|
22
|
-
"@webiny/app-workflows": "6.6.0-alpha.
|
|
23
|
-
"@webiny/feature": "6.6.0-alpha.
|
|
24
|
-
"@webiny/icons": "6.6.0-alpha.
|
|
16
|
+
"@webiny/admin-ui": "6.6.0-alpha.14",
|
|
17
|
+
"@webiny/app": "6.6.0-alpha.14",
|
|
18
|
+
"@webiny/app-aco": "6.6.0-alpha.14",
|
|
19
|
+
"@webiny/app-admin": "6.6.0-alpha.14",
|
|
20
|
+
"@webiny/app-website-builder": "6.6.0-alpha.14",
|
|
21
|
+
"@webiny/app-websockets": "6.6.0-alpha.14",
|
|
22
|
+
"@webiny/app-workflows": "6.6.0-alpha.14",
|
|
23
|
+
"@webiny/feature": "6.6.0-alpha.14",
|
|
24
|
+
"@webiny/icons": "6.6.0-alpha.14",
|
|
25
25
|
"mobx": "7.1.7",
|
|
26
26
|
"react": "19.3.1",
|
|
27
27
|
"react-dom": "19.3.1"
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@testing-library/react": "16.3.3",
|
|
31
31
|
"@types/react": "19.3.0",
|
|
32
|
-
"@webiny/app-headless-cms-workflows": "6.6.0-alpha.
|
|
33
|
-
"@webiny/build-tools": "6.6.0-alpha.
|
|
32
|
+
"@webiny/app-headless-cms-workflows": "6.6.0-alpha.14",
|
|
33
|
+
"@webiny/build-tools": "6.6.0-alpha.14",
|
|
34
34
|
"@webiny/di": "2.0.0",
|
|
35
|
-
"@webiny/feature-flags": "6.6.0-alpha.
|
|
36
|
-
"@webiny/react-composition": "6.6.0-alpha.
|
|
37
|
-
"@webiny/website-builder-sdk": "6.6.0-alpha.
|
|
35
|
+
"@webiny/feature-flags": "6.6.0-alpha.14",
|
|
36
|
+
"@webiny/react-composition": "6.6.0-alpha.14",
|
|
37
|
+
"@webiny/website-builder-sdk": "6.6.0-alpha.14",
|
|
38
38
|
"rimraf": "6.1.4",
|
|
39
39
|
"typescript": "7.0.2",
|
|
40
40
|
"vitest": "5.1.1"
|