@webiny/app-website-builder-scheduler 6.4.8-beta.0 → 6.4.9-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  import React from "react";
2
- export declare const PageEditorScheduleMenuItem: () => React.JSX.Element;
2
+ export declare const PageEditorScheduleMenuItem: () => React.JSX.Element | null;
@@ -4,10 +4,12 @@ import { PageEditorConfig, useDocumentEditor } from "@webiny/app-website-builder
4
4
  import { Icon } from "@webiny/admin-ui";
5
5
  import { useApolloClient } from "@apollo/react-hooks";
6
6
  import { useScheduleDialog } from "@webiny/app-scheduler";
7
+ import { usePermissions } from "../../hooks/usePermissions.js";
7
8
  import { WB_PAGE_NAMESPACE } from "../../utils/namespace.js";
8
9
  const { DropdownAction: DropdownAction } = PageEditorConfig.Ui.TopBar;
9
10
  const PageEditorScheduleMenuItem = ()=>{
10
11
  const documentEditor = useDocumentEditor();
12
+ const { canPublishPage, canUnpublishPage } = usePermissions();
11
13
  const state = documentEditor.getDocumentState().toJson();
12
14
  const status = state.status || "draft";
13
15
  const client = useApolloClient();
@@ -25,6 +27,7 @@ const PageEditorScheduleMenuItem = ()=>{
25
27
  }, [
26
28
  showSchedulerDialog
27
29
  ]);
30
+ if (!canPublishPage && !canUnpublishPage) return null;
28
31
  return /*#__PURE__*/ react.createElement(DropdownAction.MenuItem, {
29
32
  label: "Schedule",
30
33
  icon: /*#__PURE__*/ react.createElement(Icon, {
@@ -1 +1 @@
1
- {"version":3,"file":"components/editor/PageEditorScheduleMenuItem.js","sources":["../../../src/components/editor/PageEditorScheduleMenuItem.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport { ReactComponent as ScheduleIcon } from \"@webiny/icons/cell_tower.svg\";\nimport {\n PageEditorConfig,\n useDocumentEditor\n} from \"@webiny/app-website-builder/exports/admin/website-builder/page/editor.js\";\nimport { Icon } from \"@webiny/admin-ui\";\nimport { useApolloClient } from \"@apollo/react-hooks\";\nimport { useScheduleDialog } from \"@webiny/app-scheduler\";\nimport { WB_PAGE_NAMESPACE } from \"~/utils/namespace.js\";\n\nconst { DropdownAction } = PageEditorConfig.Ui.TopBar;\n\nexport const PageEditorScheduleMenuItem = () => {\n const documentEditor = useDocumentEditor();\n const state = documentEditor.getDocumentState().toJson();\n // @ts-expect-error status is not defined in the document interface, but we know it is there\n const status = (state.status || \"draft\") as string;\n\n const client = useApolloClient();\n const { showDialog: showSchedulerDialog } = useScheduleDialog({\n client,\n namespace: WB_PAGE_NAMESPACE,\n target: {\n id: state.id,\n title: state.properties.title || \"unknown\",\n status\n }\n });\n\n const showDialog = useCallback(() => {\n showSchedulerDialog();\n }, [showSchedulerDialog]);\n\n return (\n <DropdownAction.MenuItem\n label={\"Schedule\"}\n icon={<Icon label={\"Schedule\"} icon={<ScheduleIcon />} />}\n onAction={showDialog}\n disabled={!status}\n data-testid={\"wb.editor.header.schedule\"}\n />\n );\n};\n"],"names":["DropdownAction","PageEditorConfig","PageEditorScheduleMenuItem","documentEditor","useDocumentEditor","state","status","client","useApolloClient","showSchedulerDialog","useScheduleDialog","WB_PAGE_NAMESPACE","showDialog","useCallback","Icon","ScheduleIcon"],"mappings":";;;;;;;AAWA,MAAM,EAAEA,gBAAAA,cAAc,EAAE,GAAGC,iBAAiB,EAAE,CAAC,MAAM;AAE9C,MAAMC,6BAA6B;IACtC,MAAMC,iBAAiBC;IACvB,MAAMC,QAAQF,eAAe,gBAAgB,GAAG,MAAM;IAEtD,MAAMG,SAAUD,MAAM,MAAM,IAAI;IAEhC,MAAME,SAASC;IACf,MAAM,EAAE,YAAYC,mBAAmB,EAAE,GAAGC,kBAAkB;QAC1DH;QACA,WAAWI;QACX,QAAQ;YACJ,IAAIN,MAAM,EAAE;YACZ,OAAOA,MAAM,UAAU,CAAC,KAAK,IAAI;YACjCC;QACJ;IACJ;IAEA,MAAMM,aAAaC,YAAY;QAC3BJ;IACJ,GAAG;QAACA;KAAoB;IAExB,OAAO,WAAP,GACI,oBAACT,eAAe,QAAQ;QACpB,OAAO;QACP,oBAAM,oBAACc,MAAIA;YAAC,OAAO;YAAY,oBAAM,oBAACC,gBAAYA;;QAClD,UAAUH;QACV,UAAU,CAACN;QACX,eAAa;;AAGzB"}
1
+ {"version":3,"file":"components/editor/PageEditorScheduleMenuItem.js","sources":["../../../src/components/editor/PageEditorScheduleMenuItem.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport { ReactComponent as ScheduleIcon } from \"@webiny/icons/cell_tower.svg\";\nimport {\n PageEditorConfig,\n useDocumentEditor\n} from \"@webiny/app-website-builder/exports/admin/website-builder/page/editor.js\";\nimport { Icon } from \"@webiny/admin-ui\";\nimport { useApolloClient } from \"@apollo/react-hooks\";\nimport { useScheduleDialog } from \"@webiny/app-scheduler\";\nimport { usePermissions } from \"~/hooks/usePermissions.js\";\nimport { WB_PAGE_NAMESPACE } from \"~/utils/namespace.js\";\n\nconst { DropdownAction } = PageEditorConfig.Ui.TopBar;\n\nexport const PageEditorScheduleMenuItem = () => {\n const documentEditor = useDocumentEditor();\n const { canPublishPage, canUnpublishPage } = usePermissions();\n const state = documentEditor.getDocumentState().toJson();\n // @ts-expect-error status is not defined in the document interface, but we know it is there\n const status = (state.status || \"draft\") as string;\n\n const client = useApolloClient();\n const { showDialog: showSchedulerDialog } = useScheduleDialog({\n client,\n namespace: WB_PAGE_NAMESPACE,\n target: {\n id: state.id,\n title: state.properties.title || \"unknown\",\n status\n }\n });\n\n const showDialog = useCallback(() => {\n showSchedulerDialog();\n }, [showSchedulerDialog]);\n\n if (!canPublishPage && !canUnpublishPage) {\n return null;\n }\n\n return (\n <DropdownAction.MenuItem\n label={\"Schedule\"}\n icon={<Icon label={\"Schedule\"} icon={<ScheduleIcon />} />}\n onAction={showDialog}\n disabled={!status}\n data-testid={\"wb.editor.header.schedule\"}\n />\n );\n};\n"],"names":["DropdownAction","PageEditorConfig","PageEditorScheduleMenuItem","documentEditor","useDocumentEditor","canPublishPage","canUnpublishPage","usePermissions","state","status","client","useApolloClient","showSchedulerDialog","useScheduleDialog","WB_PAGE_NAMESPACE","showDialog","useCallback","Icon","ScheduleIcon"],"mappings":";;;;;;;;AAYA,MAAM,EAAEA,gBAAAA,cAAc,EAAE,GAAGC,iBAAiB,EAAE,CAAC,MAAM;AAE9C,MAAMC,6BAA6B;IACtC,MAAMC,iBAAiBC;IACvB,MAAM,EAAEC,cAAc,EAAEC,gBAAgB,EAAE,GAAGC;IAC7C,MAAMC,QAAQL,eAAe,gBAAgB,GAAG,MAAM;IAEtD,MAAMM,SAAUD,MAAM,MAAM,IAAI;IAEhC,MAAME,SAASC;IACf,MAAM,EAAE,YAAYC,mBAAmB,EAAE,GAAGC,kBAAkB;QAC1DH;QACA,WAAWI;QACX,QAAQ;YACJ,IAAIN,MAAM,EAAE;YACZ,OAAOA,MAAM,UAAU,CAAC,KAAK,IAAI;YACjCC;QACJ;IACJ;IAEA,MAAMM,aAAaC,YAAY;QAC3BJ;IACJ,GAAG;QAACA;KAAoB;IAExB,IAAI,CAACP,kBAAkB,CAACC,kBACpB,OAAO;IAGX,OAAO,WAAP,GACI,oBAACN,eAAe,QAAQ;QACpB,OAAO;QACP,oBAAM,oBAACiB,MAAIA;YAAC,OAAO;YAAY,oBAAM,oBAACC,gBAAYA;;QAClD,UAAUH;QACV,UAAU,CAACN;QACX,eAAa;;AAGzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/app-website-builder-scheduler",
3
- "version": "6.4.8-beta.0",
3
+ "version": "6.4.9-beta.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -14,16 +14,16 @@
14
14
  "license": "MIT",
15
15
  "dependencies": {
16
16
  "@apollo/react-hooks": "3.1.5",
17
- "@webiny/admin-ui": "6.4.8-beta.0",
18
- "@webiny/app-scheduler": "6.4.8-beta.0",
19
- "@webiny/app-website-builder": "6.4.8-beta.0",
20
- "@webiny/icons": "6.4.8-beta.0",
17
+ "@webiny/admin-ui": "6.4.9-beta.0",
18
+ "@webiny/app-scheduler": "6.4.9-beta.0",
19
+ "@webiny/app-website-builder": "6.4.9-beta.0",
20
+ "@webiny/icons": "6.4.9-beta.0",
21
21
  "react": "18.3.1",
22
22
  "react-dom": "18.3.1"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/react": "18.3.31",
26
- "@webiny/build-tools": "6.4.8-beta.0",
26
+ "@webiny/build-tools": "6.4.9-beta.0",
27
27
  "rimraf": "6.1.3",
28
28
  "typescript": "6.0.3"
29
29
  },