@webiny/app-scheduler 0.0.0-unstable.0d717d18dd

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -0
  3. package/domain/schedulerEntry.d.ts +16 -0
  4. package/domain/schedulerEntry.js +19 -0
  5. package/domain/schedulerEntry.js.map +1 -0
  6. package/features/cancelScheduledAction/CancelScheduledActionGateway.d.ts +11 -0
  7. package/features/cancelScheduledAction/CancelScheduledActionGateway.js +41 -0
  8. package/features/cancelScheduledAction/CancelScheduledActionGateway.js.map +1 -0
  9. package/features/cancelScheduledAction/abstractions.d.ts +11 -0
  10. package/features/cancelScheduledAction/abstractions.js +5 -0
  11. package/features/cancelScheduledAction/abstractions.js.map +1 -0
  12. package/features/cancelScheduledAction/feature.d.ts +1 -0
  13. package/features/cancelScheduledAction/feature.js +11 -0
  14. package/features/cancelScheduledAction/feature.js.map +1 -0
  15. package/features/feature.d.ts +1 -0
  16. package/features/feature.js +19 -0
  17. package/features/feature.js.map +1 -0
  18. package/features/getScheduledAction/GetScheduledActionGateway.d.ts +11 -0
  19. package/features/getScheduledAction/GetScheduledActionGateway.js +57 -0
  20. package/features/getScheduledAction/GetScheduledActionGateway.js.map +1 -0
  21. package/features/getScheduledAction/abstractions.d.ts +13 -0
  22. package/features/getScheduledAction/abstractions.js +5 -0
  23. package/features/getScheduledAction/abstractions.js.map +1 -0
  24. package/features/getScheduledAction/feature.d.ts +1 -0
  25. package/features/getScheduledAction/feature.js +11 -0
  26. package/features/getScheduledAction/feature.js.map +1 -0
  27. package/features/graphqlFields.d.ts +2 -0
  28. package/features/graphqlFields.js +23 -0
  29. package/features/graphqlFields.js.map +1 -0
  30. package/features/listScheduledActions/ListScheduledActionsGateway.d.ts +11 -0
  31. package/features/listScheduledActions/ListScheduledActionsGateway.js +84 -0
  32. package/features/listScheduledActions/ListScheduledActionsGateway.js.map +1 -0
  33. package/features/listScheduledActions/abstractions.d.ts +30 -0
  34. package/features/listScheduledActions/abstractions.js +5 -0
  35. package/features/listScheduledActions/abstractions.js.map +1 -0
  36. package/features/listScheduledActions/feature.d.ts +1 -0
  37. package/features/listScheduledActions/feature.js +11 -0
  38. package/features/listScheduledActions/feature.js.map +1 -0
  39. package/features/schedulePublishAction/SchedulePublishActionGateway.d.ts +11 -0
  40. package/features/schedulePublishAction/SchedulePublishActionGateway.js +67 -0
  41. package/features/schedulePublishAction/SchedulePublishActionGateway.js.map +1 -0
  42. package/features/schedulePublishAction/abstractions.d.ts +16 -0
  43. package/features/schedulePublishAction/abstractions.js +5 -0
  44. package/features/schedulePublishAction/abstractions.js.map +1 -0
  45. package/features/schedulePublishAction/feature.d.ts +1 -0
  46. package/features/schedulePublishAction/feature.js +11 -0
  47. package/features/schedulePublishAction/feature.js.map +1 -0
  48. package/features/scheduleUnpublishAction/ScheduleUnpublishActionGateway.d.ts +11 -0
  49. package/features/scheduleUnpublishAction/ScheduleUnpublishActionGateway.js +71 -0
  50. package/features/scheduleUnpublishAction/ScheduleUnpublishActionGateway.js.map +1 -0
  51. package/features/scheduleUnpublishAction/abstractions.d.ts +16 -0
  52. package/features/scheduleUnpublishAction/abstractions.js +5 -0
  53. package/features/scheduleUnpublishAction/abstractions.js.map +1 -0
  54. package/features/scheduleUnpublishAction/feature.d.ts +1 -0
  55. package/features/scheduleUnpublishAction/feature.js +11 -0
  56. package/features/scheduleUnpublishAction/feature.js.map +1 -0
  57. package/index.d.ts +9 -0
  58. package/index.js +17 -0
  59. package/index.js.map +1 -0
  60. package/package.json +56 -0
  61. package/presentation/SchedulerConfigs/SchedulerConfigs.d.ts +2 -0
  62. package/presentation/SchedulerConfigs/SchedulerConfigs.js +52 -0
  63. package/presentation/SchedulerConfigs/SchedulerConfigs.js.map +1 -0
  64. package/presentation/SchedulerConfigs/index.d.ts +1 -0
  65. package/presentation/SchedulerConfigs/index.js +1 -0
  66. package/presentation/components/Actions/CancelItem/CancelItem.d.ts +2 -0
  67. package/presentation/components/Actions/CancelItem/CancelItem.js +18 -0
  68. package/presentation/components/Actions/CancelItem/CancelItem.js.map +1 -0
  69. package/presentation/components/Actions/CancelItem/index.d.ts +1 -0
  70. package/presentation/components/Actions/CancelItem/index.js +1 -0
  71. package/presentation/components/Actions/index.d.ts +1 -0
  72. package/presentation/components/Actions/index.js +1 -0
  73. package/presentation/components/BottomInfoBar/BottomInfoBar.styled.d.ts +20 -0
  74. package/presentation/components/BottomInfoBar/BottomInfoBar.styled.js +43 -0
  75. package/presentation/components/BottomInfoBar/BottomInfoBar.styled.js.map +1 -0
  76. package/presentation/components/BottomInfoBar/ListMeta.d.ts +7 -0
  77. package/presentation/components/BottomInfoBar/ListMeta.js +9 -0
  78. package/presentation/components/BottomInfoBar/ListMeta.js.map +1 -0
  79. package/presentation/components/BottomInfoBar/ListStatus.d.ts +5 -0
  80. package/presentation/components/BottomInfoBar/ListStatus.js +12 -0
  81. package/presentation/components/BottomInfoBar/ListStatus.js.map +1 -0
  82. package/presentation/components/Cells/CellActions/CellActions.d.ts +2 -0
  83. package/presentation/components/Cells/CellActions/CellActions.js +18 -0
  84. package/presentation/components/Cells/CellActions/CellActions.js.map +1 -0
  85. package/presentation/components/Cells/CellActions/index.d.ts +1 -0
  86. package/presentation/components/Cells/CellActions/index.js +1 -0
  87. package/presentation/components/Cells/CellRevision/CellRevision.d.ts +2 -0
  88. package/presentation/components/Cells/CellRevision/CellRevision.js +15 -0
  89. package/presentation/components/Cells/CellRevision/CellRevision.js.map +1 -0
  90. package/presentation/components/Cells/CellRevision/CellRevision.styled.d.ts +11 -0
  91. package/presentation/components/Cells/CellRevision/CellRevision.styled.js +18 -0
  92. package/presentation/components/Cells/CellRevision/CellRevision.styled.js.map +1 -0
  93. package/presentation/components/Cells/CellRevision/index.d.ts +1 -0
  94. package/presentation/components/Cells/CellRevision/index.js +1 -0
  95. package/presentation/components/Cells/CellScheduledBy/CellScheduledBy.d.ts +2 -0
  96. package/presentation/components/Cells/CellScheduledBy/CellScheduledBy.js +10 -0
  97. package/presentation/components/Cells/CellScheduledBy/CellScheduledBy.js.map +1 -0
  98. package/presentation/components/Cells/CellScheduledBy/index.d.ts +1 -0
  99. package/presentation/components/Cells/CellScheduledBy/index.js +1 -0
  100. package/presentation/components/Cells/CellScheduledOn/CellScheduledOn.d.ts +24 -0
  101. package/presentation/components/Cells/CellScheduledOn/CellScheduledOn.js +19 -0
  102. package/presentation/components/Cells/CellScheduledOn/CellScheduledOn.js.map +1 -0
  103. package/presentation/components/Cells/CellScheduledOn/index.d.ts +1 -0
  104. package/presentation/components/Cells/CellScheduledOn/index.js +1 -0
  105. package/presentation/components/Cells/CellTitle/CellTitle.d.ts +2 -0
  106. package/presentation/components/Cells/CellTitle/CellTitle.js +14 -0
  107. package/presentation/components/Cells/CellTitle/CellTitle.js.map +1 -0
  108. package/presentation/components/Cells/CellTitle/CellTitle.styled.d.ts +11 -0
  109. package/presentation/components/Cells/CellTitle/CellTitle.styled.js +18 -0
  110. package/presentation/components/Cells/CellTitle/CellTitle.styled.js.map +1 -0
  111. package/presentation/components/Cells/CellTitle/index.d.ts +1 -0
  112. package/presentation/components/Cells/CellTitle/index.js +1 -0
  113. package/presentation/components/Cells/CellType/CellActionType.d.ts +2 -0
  114. package/presentation/components/Cells/CellType/CellActionType.js +15 -0
  115. package/presentation/components/Cells/CellType/CellActionType.js.map +1 -0
  116. package/presentation/components/Cells/CellType/CellActionType.styled.d.ts +11 -0
  117. package/presentation/components/Cells/CellType/CellActionType.styled.js +18 -0
  118. package/presentation/components/Cells/CellType/CellActionType.styled.js.map +1 -0
  119. package/presentation/components/Cells/CellType/index.d.ts +1 -0
  120. package/presentation/components/Cells/CellType/index.js +1 -0
  121. package/presentation/components/Cells/index.d.ts +6 -0
  122. package/presentation/components/Cells/index.js +6 -0
  123. package/presentation/components/Empty/Empty.styled.d.ts +8 -0
  124. package/presentation/components/Empty/Empty.styled.js +16 -0
  125. package/presentation/components/Empty/Empty.styled.js.map +1 -0
  126. package/presentation/components/Title/Title.d.ts +5 -0
  127. package/presentation/components/Title/Title.js +10 -0
  128. package/presentation/components/Title/Title.js.map +1 -0
  129. package/presentation/components/Title/Title.styled.d.ts +3 -0
  130. package/presentation/components/Title/Title.styled.js +13 -0
  131. package/presentation/components/Title/Title.styled.js.map +1 -0
  132. package/presentation/components/Title/index.d.ts +1 -0
  133. package/presentation/components/Title/index.js +1 -0
  134. package/presentation/configs/index.d.ts +1 -0
  135. package/presentation/configs/index.js +1 -0
  136. package/presentation/configs/list/Browser/EntryAction.d.ts +8 -0
  137. package/presentation/configs/list/Browser/EntryAction.js +13 -0
  138. package/presentation/configs/list/Browser/EntryAction.js.map +1 -0
  139. package/presentation/configs/list/Browser/Table/Column.d.ts +15 -0
  140. package/presentation/configs/list/Browser/Table/Column.js +11 -0
  141. package/presentation/configs/list/Browser/Table/Column.js.map +1 -0
  142. package/presentation/configs/list/Browser/Table/Sorting.d.ts +5 -0
  143. package/presentation/configs/list/Browser/Table/Sorting.js +7 -0
  144. package/presentation/configs/list/Browser/Table/Sorting.js.map +1 -0
  145. package/presentation/configs/list/Browser/Table/index.d.ts +19 -0
  146. package/presentation/configs/list/Browser/Table/index.js +9 -0
  147. package/presentation/configs/list/Browser/Table/index.js.map +1 -0
  148. package/presentation/configs/list/Browser/index.d.ts +23 -0
  149. package/presentation/configs/list/Browser/index.js +9 -0
  150. package/presentation/configs/list/Browser/index.js.map +1 -0
  151. package/presentation/configs/list/SchedulerListConfig.d.ts +35 -0
  152. package/presentation/configs/list/SchedulerListConfig.js +30 -0
  153. package/presentation/configs/list/SchedulerListConfig.js.map +1 -0
  154. package/presentation/configs/list/index.d.ts +1 -0
  155. package/presentation/configs/list/index.js +1 -0
  156. package/presentation/hooks/index.d.ts +2 -0
  157. package/presentation/hooks/index.js +2 -0
  158. package/presentation/hooks/useCancelSchedulerItem.d.ts +8 -0
  159. package/presentation/hooks/useCancelSchedulerItem.js +32 -0
  160. package/presentation/hooks/useCancelSchedulerItem.js.map +1 -0
  161. package/presentation/hooks/useSchedulerItem.d.ts +11 -0
  162. package/presentation/hooks/useSchedulerItem.js +7 -0
  163. package/presentation/hooks/useSchedulerItem.js.map +1 -0
  164. package/presentation/scheduleDialog/ScheduleDialogPresenter.d.ts +26 -0
  165. package/presentation/scheduleDialog/ScheduleDialogPresenter.js +115 -0
  166. package/presentation/scheduleDialog/ScheduleDialogPresenter.js.map +1 -0
  167. package/presentation/scheduleDialog/abstractions.d.ts +35 -0
  168. package/presentation/scheduleDialog/abstractions.js +5 -0
  169. package/presentation/scheduleDialog/abstractions.js.map +1 -0
  170. package/presentation/scheduleDialog/components/CancelButtonComponent.d.ts +10 -0
  171. package/presentation/scheduleDialog/components/CancelButtonComponent.js +20 -0
  172. package/presentation/scheduleDialog/components/CancelButtonComponent.js.map +1 -0
  173. package/presentation/scheduleDialog/components/FormComponent.d.ts +9 -0
  174. package/presentation/scheduleDialog/components/FormComponent.js +32 -0
  175. package/presentation/scheduleDialog/components/FormComponent.js.map +1 -0
  176. package/presentation/scheduleDialog/components/ReschedulingAlert.d.ts +7 -0
  177. package/presentation/scheduleDialog/components/ReschedulingAlert.js +14 -0
  178. package/presentation/scheduleDialog/components/ReschedulingAlert.js.map +1 -0
  179. package/presentation/scheduleDialog/components/SchedulerDialogFormComponentDateTimeInput.d.ts +24 -0
  180. package/presentation/scheduleDialog/components/SchedulerDialogFormComponentDateTimeInput.js +15 -0
  181. package/presentation/scheduleDialog/components/SchedulerDialogFormComponentDateTimeInput.js.map +1 -0
  182. package/presentation/scheduleDialog/createMinDateValidator.d.ts +7 -0
  183. package/presentation/scheduleDialog/createMinDateValidator.js +14 -0
  184. package/presentation/scheduleDialog/createMinDateValidator.js.map +1 -0
  185. package/presentation/scheduleDialog/feature.d.ts +3 -0
  186. package/presentation/scheduleDialog/feature.js +17 -0
  187. package/presentation/scheduleDialog/feature.js.map +1 -0
  188. package/presentation/scheduleDialog/useScheduleDialog.d.ts +20 -0
  189. package/presentation/scheduleDialog/useScheduleDialog.js +128 -0
  190. package/presentation/scheduleDialog/useScheduleDialog.js.map +1 -0
  191. package/presentation/schedulerList/Scheduler.d.ts +18 -0
  192. package/presentation/schedulerList/Scheduler.js +28 -0
  193. package/presentation/schedulerList/Scheduler.js.map +1 -0
  194. package/presentation/schedulerList/SchedulerListDataSource.d.ts +15 -0
  195. package/presentation/schedulerList/SchedulerListDataSource.js +41 -0
  196. package/presentation/schedulerList/SchedulerListDataSource.js.map +1 -0
  197. package/presentation/schedulerList/SchedulerListPresenter.d.ts +21 -0
  198. package/presentation/schedulerList/SchedulerListPresenter.js +47 -0
  199. package/presentation/schedulerList/SchedulerListPresenter.js.map +1 -0
  200. package/presentation/schedulerList/abstractions.d.ts +13 -0
  201. package/presentation/schedulerList/abstractions.js +5 -0
  202. package/presentation/schedulerList/abstractions.js.map +1 -0
  203. package/presentation/schedulerList/components/BottomInfoBar.d.ts +9 -0
  204. package/presentation/schedulerList/components/BottomInfoBar.js +18 -0
  205. package/presentation/schedulerList/components/BottomInfoBar.js.map +1 -0
  206. package/presentation/schedulerList/components/Empty.d.ts +9 -0
  207. package/presentation/schedulerList/components/Empty.js +21 -0
  208. package/presentation/schedulerList/components/Empty.js.map +1 -0
  209. package/presentation/schedulerList/components/SchedulerListView.d.ts +8 -0
  210. package/presentation/schedulerList/components/SchedulerListView.js +40 -0
  211. package/presentation/schedulerList/components/SchedulerListView.js.map +1 -0
  212. package/presentation/schedulerList/components/SchedulerOverlay.d.ts +11 -0
  213. package/presentation/schedulerList/components/SchedulerOverlay.js +38 -0
  214. package/presentation/schedulerList/components/SchedulerOverlay.js.map +1 -0
  215. package/presentation/schedulerList/components/SchedulerTable.d.ts +9 -0
  216. package/presentation/schedulerList/components/SchedulerTable.js +48 -0
  217. package/presentation/schedulerList/components/SchedulerTable.js.map +1 -0
  218. package/presentation/schedulerList/components/SearchInput.d.ts +9 -0
  219. package/presentation/schedulerList/components/SearchInput.js +30 -0
  220. package/presentation/schedulerList/components/SearchInput.js.map +1 -0
  221. package/presentation/schedulerList/feature.d.ts +3 -0
  222. package/presentation/schedulerList/feature.js +17 -0
  223. package/presentation/schedulerList/feature.js.map +1 -0
  224. package/presentation/schedulerList/useSchedulerListPresenter.d.ts +1 -0
  225. package/presentation/schedulerList/useSchedulerListPresenter.js +6 -0
  226. package/presentation/schedulerList/useSchedulerListPresenter.js.map +1 -0
  227. package/types.d.ts +30 -0
  228. package/types.js +8 -0
  229. package/types.js.map +1 -0
@@ -0,0 +1,35 @@
1
+ import React from "react";
2
+ declare const ScopedSchedulerListConfig: {
3
+ ({ children }: {
4
+ children: React.ReactNode;
5
+ }): React.JSX.Element;
6
+ displayName: string;
7
+ };
8
+ export declare const SchedulerListConfig: typeof ScopedSchedulerListConfig & {
9
+ Browser: {
10
+ EntryAction: ((props: import("@webiny/app-aco/config/record/Action.js").ActionProps) => React.JSX.Element) & {
11
+ OptionsMenuItem: (props: import("@webiny/app-admin/index.js").OptionsMenuItemProps) => React.JSX.Element;
12
+ };
13
+ Table: {
14
+ Column: ((props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => React.JSX.Element) & {
15
+ useTableRow: {
16
+ (): import("@webiny/app-admin/index.js").TableRowContextData<import("../../../types.js").SchedulerEntryTableRow>;
17
+ <TUserRow>(): import("@webiny/app-admin/index.js").TableRowContextData<import("../../../types.js").SchedulerEntryTableRow & {
18
+ data: TUserRow;
19
+ }>;
20
+ };
21
+ isFolderRow: (row: import("@webiny/app-aco").TableRow) => row is import("@webiny/app-aco").FolderTableRow;
22
+ };
23
+ Sorting: typeof import("./Browser/Table/Sorting.js").Sorting;
24
+ };
25
+ };
26
+ };
27
+ export declare const SchedulerListWithConfig: ({ onProperties, children }: import("@webiny/react-properties").WithConfigProps) => React.JSX.Element;
28
+ export declare function useSchedulerListConfig(): {
29
+ browser: {
30
+ table: import("@webiny/app-aco/config/table/index.js").TableConfig;
31
+ entryActions: import("@webiny/app-aco").RecordActionConfig[];
32
+ bulkActions: never[];
33
+ };
34
+ };
35
+ export {};
@@ -0,0 +1,30 @@
1
+ import react, { useMemo } from "react";
2
+ import { createConfigurableComponent } from "@webiny/react-properties";
3
+ import { Browser } from "./Browser/index.js";
4
+ import { CompositionScope } from "@webiny/react-composition";
5
+ import { useAcoConfig } from "@webiny/app-aco";
6
+ const base = createConfigurableComponent("SchedulerListConfig");
7
+ const ScopedSchedulerListConfig = ({ children })=>/*#__PURE__*/ react.createElement(CompositionScope, {
8
+ name: "scheduler"
9
+ }, /*#__PURE__*/ react.createElement(base.Config, null, children));
10
+ ScopedSchedulerListConfig.displayName = "SchedulerListConfig";
11
+ const SchedulerListConfig = Object.assign(ScopedSchedulerListConfig, {
12
+ Browser: Browser
13
+ });
14
+ const SchedulerListWithConfig = base.WithConfig;
15
+ function useSchedulerListConfig() {
16
+ const config = base.useConfig();
17
+ const acoConfig = useAcoConfig(config);
18
+ return useMemo(()=>({
19
+ browser: {
20
+ table: acoConfig.table,
21
+ entryActions: acoConfig.record.actions,
22
+ bulkActions: []
23
+ }
24
+ }), [
25
+ config
26
+ ]);
27
+ }
28
+ export { SchedulerListConfig, SchedulerListWithConfig, useSchedulerListConfig };
29
+
30
+ //# sourceMappingURL=SchedulerListConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation/configs/list/SchedulerListConfig.js","sources":["../../../../src/presentation/configs/list/SchedulerListConfig.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { createConfigurableComponent } from \"@webiny/react-properties\";\nimport type { BrowserConfig } from \"./Browser/index.js\";\nimport { Browser } from \"./Browser/index.js\";\nimport { CompositionScope } from \"@webiny/react-composition\";\nimport { useAcoConfig } from \"@webiny/app-aco\";\n\nconst base = createConfigurableComponent<SchedulerListConfig>(\"SchedulerListConfig\");\n\nconst ScopedSchedulerListConfig = ({ children }: { children: React.ReactNode }) => {\n return (\n <CompositionScope name={\"scheduler\"}>\n <base.Config>{children}</base.Config>\n </CompositionScope>\n );\n};\n\nScopedSchedulerListConfig.displayName = \"SchedulerListConfig\";\n\nexport const SchedulerListConfig = Object.assign(ScopedSchedulerListConfig, { Browser });\nexport const SchedulerListWithConfig = base.WithConfig;\n\ninterface SchedulerListConfig {\n browser: BrowserConfig;\n}\n\nexport function useSchedulerListConfig() {\n const config = base.useConfig();\n const acoConfig = useAcoConfig(config);\n\n return useMemo(\n () => ({\n browser: {\n table: acoConfig.table,\n entryActions: acoConfig.record.actions,\n bulkActions: []\n }\n }),\n [config]\n );\n}\n"],"names":["base","createConfigurableComponent","ScopedSchedulerListConfig","children","CompositionScope","SchedulerListConfig","Object","Browser","SchedulerListWithConfig","useSchedulerListConfig","config","acoConfig","useAcoConfig","useMemo"],"mappings":";;;;;AAOA,MAAMA,OAAOC,4BAAiD;AAE9D,MAAMC,4BAA4B,CAAC,EAAEC,QAAQ,EAAiC,GACnE,WAAP,GACI,oBAACC,kBAAgBA;QAAC,MAAM;qBACpB,oBAACJ,KAAK,MAAM,QAAEG;AAK1BD,0BAA0B,WAAW,GAAG;AAEjC,MAAMG,sBAAsBC,OAAO,MAAM,CAACJ,2BAA2B;IAAEK,SAAOA;AAAC;AAC/E,MAAMC,0BAA0BR,KAAK,UAAU;AAM/C,SAASS;IACZ,MAAMC,SAASV,KAAK,SAAS;IAC7B,MAAMW,YAAYC,aAAaF;IAE/B,OAAOG,QACH,IAAO;YACH,SAAS;gBACL,OAAOF,UAAU,KAAK;gBACtB,cAAcA,UAAU,MAAM,CAAC,OAAO;gBACtC,aAAa,EAAE;YACnB;QACJ,IACA;QAACD;KAAO;AAEhB"}
@@ -0,0 +1 @@
1
+ export * from "./SchedulerListConfig.js";
@@ -0,0 +1 @@
1
+ export * from "./SchedulerListConfig.js";
@@ -0,0 +1,2 @@
1
+ export * from "./useSchedulerItem.js";
2
+ export * from "./useCancelSchedulerItem.js";
@@ -0,0 +1,2 @@
1
+ export * from "./useSchedulerItem.js";
2
+ export * from "./useCancelSchedulerItem.js";
@@ -0,0 +1,8 @@
1
+ import type { SchedulerEntry } from "../../types.js";
2
+ interface UseCancelScheduleItemParams {
3
+ item: Pick<SchedulerEntry, "id" | "title" | "actionType">;
4
+ }
5
+ export declare const useCancelSchedulerItem: ({ item }: UseCancelScheduleItemParams) => {
6
+ openDialogCancelSchedulerItem: () => void;
7
+ };
8
+ export {};
@@ -0,0 +1,32 @@
1
+ import react, { useCallback } from "react";
2
+ import { useConfirmationDialog } from "@webiny/app-admin";
3
+ import { useSchedulerListPresenter } from "../schedulerList/useSchedulerListPresenter.js";
4
+ import { useToast } from "@webiny/admin-ui";
5
+ const useCancelSchedulerItem = ({ item })=>{
6
+ const presenter = useSchedulerListPresenter();
7
+ const toast = useToast();
8
+ const { showConfirmation } = useConfirmationDialog({
9
+ title: "Cancel scheduled action?",
10
+ message: /*#__PURE__*/ react.createElement("p", null, "You are about to cancel scheduled action for this item!", /*#__PURE__*/ react.createElement("br", null), "Are you sure you want to cancel scheduled ", /*#__PURE__*/ react.createElement("strong", null, item.actionType), " for", " ", /*#__PURE__*/ react.createElement("strong", null, item.title), "?")
11
+ });
12
+ const openDialogCancelSchedulerItem = useCallback(()=>showConfirmation(async ()=>{
13
+ try {
14
+ await presenter.cancelItem(item.id);
15
+ toast.showSuccessToast({
16
+ title: `Action on item "${item.title}" was canceled successfully!`
17
+ });
18
+ } catch (ex) {
19
+ toast.showWarningToast({
20
+ title: ex.message || `Error while canceling action for "${item.title}".`
21
+ });
22
+ }
23
+ }), [
24
+ item
25
+ ]);
26
+ return {
27
+ openDialogCancelSchedulerItem
28
+ };
29
+ };
30
+ export { useCancelSchedulerItem };
31
+
32
+ //# sourceMappingURL=useCancelSchedulerItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation/hooks/useCancelSchedulerItem.js","sources":["../../../src/presentation/hooks/useCancelSchedulerItem.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport { useConfirmationDialog } from \"@webiny/app-admin\";\nimport type { SchedulerEntry } from \"~/types.js\";\nimport { useSchedulerListPresenter } from \"~/presentation/schedulerList/useSchedulerListPresenter.js\";\nimport { useToast } from \"@webiny/admin-ui\";\n\ninterface UseCancelScheduleItemParams {\n item: Pick<SchedulerEntry, \"id\" | \"title\" | \"actionType\">;\n}\n\nexport const useCancelSchedulerItem = ({ item }: UseCancelScheduleItemParams) => {\n const presenter = useSchedulerListPresenter();\n const toast = useToast();\n\n const { showConfirmation } = useConfirmationDialog({\n title: \"Cancel scheduled action?\",\n message: (\n <p>\n You are about to cancel scheduled action for this item!\n <br />\n Are you sure you want to cancel scheduled <strong>{item.actionType}</strong> for{\" \"}\n <strong>{item.title}</strong>?\n </p>\n )\n });\n\n const openDialogCancelSchedulerItem = useCallback(\n () =>\n showConfirmation(async () => {\n try {\n await presenter.cancelItem(item.id);\n toast.showSuccessToast({\n title: `Action on item \"${item.title}\" was canceled successfully!`\n });\n } catch (ex) {\n toast.showWarningToast({\n title: ex.message || `Error while canceling action for \"${item.title}\".`\n });\n }\n }),\n [item]\n );\n\n return { openDialogCancelSchedulerItem };\n};\n"],"names":["useCancelSchedulerItem","item","presenter","useSchedulerListPresenter","toast","useToast","showConfirmation","useConfirmationDialog","openDialogCancelSchedulerItem","useCallback","ex"],"mappings":";;;;AAUO,MAAMA,yBAAyB,CAAC,EAAEC,IAAI,EAA+B;IACxE,MAAMC,YAAYC;IAClB,MAAMC,QAAQC;IAEd,MAAM,EAAEC,gBAAgB,EAAE,GAAGC,sBAAsB;QAC/C,OAAO;QACP,SAAS,WAAT,GACI,oBAAC,WAAE,yEAEC,oBAAC,aAAK,4DACoC,oBAAC,gBAAQN,KAAK,UAAU,GAAU,QAAK,mBACjF,oBAAC,gBAAQA,KAAK,KAAK,GAAU;IAGzC;IAEA,MAAMO,gCAAgCC,YAClC,IACIH,iBAAiB;YACb,IAAI;gBACA,MAAMJ,UAAU,UAAU,CAACD,KAAK,EAAE;gBAClCG,MAAM,gBAAgB,CAAC;oBACnB,OAAO,CAAC,gBAAgB,EAAEH,KAAK,KAAK,CAAC,4BAA4B,CAAC;gBACtE;YACJ,EAAE,OAAOS,IAAI;gBACTN,MAAM,gBAAgB,CAAC;oBACnB,OAAOM,GAAG,OAAO,IAAI,CAAC,kCAAkC,EAAET,KAAK,KAAK,CAAC,EAAE,CAAC;gBAC5E;YACJ;QACJ,IACJ;QAACA;KAAK;IAGV,OAAO;QAAEO;IAA8B;AAC3C"}
@@ -0,0 +1,11 @@
1
+ import type { SchedulerEntry } from "../../types.js";
2
+ export interface SchedulerItemContext {
3
+ item: SchedulerEntry;
4
+ }
5
+ export declare const useSchedulerItem: () => SchedulerItemContext;
6
+ export declare const SchedulerItemProvider: {
7
+ ({ children, ...props }: SchedulerItemContext & {
8
+ children: React.ReactNode;
9
+ }): React.JSX.Element;
10
+ displayName: string;
11
+ };
@@ -0,0 +1,7 @@
1
+ import { createGenericContext } from "@webiny/app-admin";
2
+ const { Provider: Provider, useHook: useHook } = createGenericContext("SchedulerItemContext");
3
+ const useSchedulerItem = useHook;
4
+ const SchedulerItemProvider = Provider;
5
+ export { SchedulerItemProvider, useSchedulerItem };
6
+
7
+ //# sourceMappingURL=useSchedulerItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation/hooks/useSchedulerItem.js","sources":["../../../src/presentation/hooks/useSchedulerItem.tsx"],"sourcesContent":["import { createGenericContext } from \"@webiny/app-admin\";\nimport type { SchedulerEntry } from \"~/types.js\";\n\nexport interface SchedulerItemContext {\n item: SchedulerEntry;\n}\n\nconst { Provider, useHook } = createGenericContext<SchedulerItemContext>(\"SchedulerItemContext\");\n\nexport const useSchedulerItem = useHook;\nexport const SchedulerItemProvider = Provider;\n"],"names":["Provider","useHook","createGenericContext","useSchedulerItem","SchedulerItemProvider"],"mappings":";AAOA,MAAM,EAAEA,UAAAA,QAAQ,EAAEC,SAAAA,OAAO,EAAE,GAAGC,qBAA2C;AAElE,MAAMC,mBAAmBF;AACzB,MAAMG,wBAAwBJ"}
@@ -0,0 +1,26 @@
1
+ import { GetScheduledActionGateway } from "../../features/getScheduledAction/abstractions.js";
2
+ import { CancelScheduledActionGateway } from "../../features/cancelScheduledAction/abstractions.js";
3
+ import { SchedulePublishActionGateway } from "../../features/schedulePublishAction/abstractions.js";
4
+ import { ScheduleUnpublishActionGateway } from "../../features/scheduleUnpublishAction/abstractions.js";
5
+ import { DateFormatter } from "@webiny/app-admin";
6
+ import { type IScheduleDialogPresenter, type IScheduleDialogPresenterViewModel, type IScheduleDialogPresenterLoadParams, type IScheduleDialogPresenterScheduleParams, type IScheduleDialogPresenterCancelParams } from "./abstractions.js";
7
+ declare class ScheduleDialogPresenterImpl implements IScheduleDialogPresenter {
8
+ private readonly getGateway;
9
+ private readonly cancelGateway;
10
+ private readonly publishGateway;
11
+ private readonly unpublishGateway;
12
+ private readonly dateFormatter;
13
+ private loading;
14
+ private entry;
15
+ constructor(getGateway: GetScheduledActionGateway.Interface, cancelGateway: CancelScheduledActionGateway.Interface, publishGateway: SchedulePublishActionGateway.Interface, unpublishGateway: ScheduleUnpublishActionGateway.Interface, dateFormatter: DateFormatter.Interface);
16
+ get vm(): IScheduleDialogPresenterViewModel;
17
+ private getRescheduling;
18
+ load(params: IScheduleDialogPresenterLoadParams): Promise<void>;
19
+ schedule(params: IScheduleDialogPresenterScheduleParams): Promise<void>;
20
+ cancel(params: IScheduleDialogPresenterCancelParams): Promise<void>;
21
+ reset(): void;
22
+ }
23
+ export declare const ScheduleDialogPresenter: typeof ScheduleDialogPresenterImpl & {
24
+ __abstraction: import("@webiny/di").Abstraction<IScheduleDialogPresenter>;
25
+ };
26
+ export {};
@@ -0,0 +1,115 @@
1
+ import { makeAutoObservable, runInAction } from "mobx";
2
+ import { GetScheduledActionGateway } from "../../features/getScheduledAction/abstractions.js";
3
+ import { CancelScheduledActionGateway } from "../../features/cancelScheduledAction/abstractions.js";
4
+ import { SchedulePublishActionGateway } from "../../features/schedulePublishAction/abstractions.js";
5
+ import { ScheduleUnpublishActionGateway } from "../../features/scheduleUnpublishAction/abstractions.js";
6
+ import { ScheduleActionType } from "../../types.js";
7
+ import { DateFormatter } from "@webiny/app-admin";
8
+ import { ScheduleDialogPresenter } from "./abstractions.js";
9
+ class ScheduleDialogPresenterImpl {
10
+ constructor(getGateway, cancelGateway, publishGateway, unpublishGateway, dateFormatter){
11
+ this.getGateway = getGateway;
12
+ this.cancelGateway = cancelGateway;
13
+ this.publishGateway = publishGateway;
14
+ this.unpublishGateway = unpublishGateway;
15
+ this.dateFormatter = dateFormatter;
16
+ this.loading = false;
17
+ this.entry = null;
18
+ makeAutoObservable(this);
19
+ }
20
+ get vm() {
21
+ return {
22
+ loading: this.loading,
23
+ entry: this.entry,
24
+ rescheduling: this.getRescheduling()
25
+ };
26
+ }
27
+ getRescheduling() {
28
+ const entry = this.entry;
29
+ if (!entry) return null;
30
+ const scheduleOn = entry.publishOn || entry.unpublishOn;
31
+ if (!scheduleOn) return null;
32
+ const actionName = entry.actionType === ScheduleActionType.publish ? "publish" : "unpublish";
33
+ return {
34
+ actionName,
35
+ scheduleOn: this.dateFormatter.format(scheduleOn)
36
+ };
37
+ }
38
+ async load(params) {
39
+ this.loading = true;
40
+ try {
41
+ const entry = await this.getGateway.execute(params);
42
+ runInAction(()=>{
43
+ this.entry = entry;
44
+ this.loading = false;
45
+ });
46
+ } catch {
47
+ runInAction(()=>{
48
+ this.loading = false;
49
+ });
50
+ }
51
+ }
52
+ async schedule(params) {
53
+ const { targetId, namespace, scheduleOn, actionType } = params;
54
+ this.loading = true;
55
+ try {
56
+ switch(actionType){
57
+ case ScheduleActionType.publish:
58
+ await this.publishGateway.execute({
59
+ namespace,
60
+ targetId,
61
+ scheduleOn
62
+ });
63
+ break;
64
+ case ScheduleActionType.unpublish:
65
+ await this.unpublishGateway.execute({
66
+ namespace,
67
+ targetId,
68
+ scheduleOn
69
+ });
70
+ break;
71
+ default:
72
+ throw new Error(`Unsupported action type "${actionType}".`);
73
+ }
74
+ runInAction(()=>{
75
+ this.entry = null;
76
+ this.loading = false;
77
+ });
78
+ } catch {
79
+ runInAction(()=>{
80
+ this.loading = false;
81
+ });
82
+ }
83
+ }
84
+ async cancel(params) {
85
+ this.loading = true;
86
+ try {
87
+ await this.cancelGateway.execute(params);
88
+ runInAction(()=>{
89
+ this.entry = null;
90
+ this.loading = false;
91
+ });
92
+ } catch {
93
+ runInAction(()=>{
94
+ this.loading = false;
95
+ });
96
+ }
97
+ }
98
+ reset() {
99
+ this.entry = null;
100
+ this.loading = false;
101
+ }
102
+ }
103
+ const ScheduleDialogPresenter_ScheduleDialogPresenter = ScheduleDialogPresenter.createImplementation({
104
+ implementation: ScheduleDialogPresenterImpl,
105
+ dependencies: [
106
+ GetScheduledActionGateway,
107
+ CancelScheduledActionGateway,
108
+ SchedulePublishActionGateway,
109
+ ScheduleUnpublishActionGateway,
110
+ DateFormatter
111
+ ]
112
+ });
113
+ export { ScheduleDialogPresenter_ScheduleDialogPresenter as ScheduleDialogPresenter };
114
+
115
+ //# sourceMappingURL=ScheduleDialogPresenter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation/scheduleDialog/ScheduleDialogPresenter.js","sources":["../../../src/presentation/scheduleDialog/ScheduleDialogPresenter.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from \"mobx\";\nimport { GetScheduledActionGateway } from \"~/features/getScheduledAction/abstractions.js\";\nimport { CancelScheduledActionGateway } from \"~/features/cancelScheduledAction/abstractions.js\";\nimport { SchedulePublishActionGateway } from \"~/features/schedulePublishAction/abstractions.js\";\nimport { ScheduleUnpublishActionGateway } from \"~/features/scheduleUnpublishAction/abstractions.js\";\nimport { ScheduleActionType } from \"~/types.js\";\nimport type { SchedulerEntry } from \"~/types.js\";\nimport { DateFormatter } from \"@webiny/app-admin\";\nimport {\n ScheduleDialogPresenter as Abstraction,\n type IScheduleDialogPresenter,\n type IScheduleDialogPresenterViewModel,\n type IScheduleDialogRescheduling,\n type IScheduleDialogPresenterLoadParams,\n type IScheduleDialogPresenterScheduleParams,\n type IScheduleDialogPresenterCancelParams\n} from \"./abstractions.js\";\n\nclass ScheduleDialogPresenterImpl implements IScheduleDialogPresenter {\n private loading = false;\n private entry: SchedulerEntry | null = null;\n\n constructor(\n private readonly getGateway: GetScheduledActionGateway.Interface,\n private readonly cancelGateway: CancelScheduledActionGateway.Interface,\n private readonly publishGateway: SchedulePublishActionGateway.Interface,\n private readonly unpublishGateway: ScheduleUnpublishActionGateway.Interface,\n private readonly dateFormatter: DateFormatter.Interface\n ) {\n makeAutoObservable(this);\n }\n\n get vm(): IScheduleDialogPresenterViewModel {\n return {\n loading: this.loading,\n entry: this.entry,\n rescheduling: this.getRescheduling()\n };\n }\n\n private getRescheduling(): IScheduleDialogRescheduling | null {\n const entry = this.entry;\n if (!entry) {\n return null;\n }\n const scheduleOn = entry.publishOn || entry.unpublishOn;\n if (!scheduleOn) {\n return null;\n }\n const actionName =\n entry.actionType === ScheduleActionType.publish ? \"publish\" : \"unpublish\";\n return { actionName, scheduleOn: this.dateFormatter.format(scheduleOn) };\n }\n\n async load(params: IScheduleDialogPresenterLoadParams): Promise<void> {\n this.loading = true;\n\n try {\n const entry = await this.getGateway.execute(params);\n runInAction(() => {\n this.entry = entry;\n this.loading = false;\n });\n } catch {\n runInAction(() => {\n this.loading = false;\n });\n }\n }\n\n async schedule(params: IScheduleDialogPresenterScheduleParams): Promise<void> {\n const { targetId, namespace, scheduleOn, actionType } = params;\n this.loading = true;\n\n try {\n switch (actionType) {\n case ScheduleActionType.publish:\n await this.publishGateway.execute({ namespace, targetId, scheduleOn });\n break;\n case ScheduleActionType.unpublish:\n await this.unpublishGateway.execute({ namespace, targetId, scheduleOn });\n break;\n default:\n throw new Error(`Unsupported action type \"${actionType}\".`);\n }\n runInAction(() => {\n this.entry = null;\n this.loading = false;\n });\n } catch {\n runInAction(() => {\n this.loading = false;\n });\n }\n }\n\n async cancel(params: IScheduleDialogPresenterCancelParams): Promise<void> {\n this.loading = true;\n\n try {\n await this.cancelGateway.execute(params);\n runInAction(() => {\n this.entry = null;\n this.loading = false;\n });\n } catch {\n runInAction(() => {\n this.loading = false;\n });\n }\n }\n\n reset(): void {\n this.entry = null;\n this.loading = false;\n }\n}\n\nexport const ScheduleDialogPresenter = Abstraction.createImplementation({\n implementation: ScheduleDialogPresenterImpl,\n dependencies: [\n GetScheduledActionGateway,\n CancelScheduledActionGateway,\n SchedulePublishActionGateway,\n ScheduleUnpublishActionGateway,\n DateFormatter\n ]\n});\n"],"names":["ScheduleDialogPresenterImpl","getGateway","cancelGateway","publishGateway","unpublishGateway","dateFormatter","makeAutoObservable","entry","scheduleOn","actionName","ScheduleActionType","params","runInAction","targetId","namespace","actionType","Error","ScheduleDialogPresenter","Abstraction","GetScheduledActionGateway","CancelScheduledActionGateway","SchedulePublishActionGateway","ScheduleUnpublishActionGateway","DateFormatter"],"mappings":";;;;;;;;AAkBA,MAAMA;IAIF,YACqBC,UAA+C,EAC/CC,aAAqD,EACrDC,cAAsD,EACtDC,gBAA0D,EAC1DC,aAAsC,CACzD;aALmBJ,UAAU,GAAVA;aACAC,aAAa,GAAbA;aACAC,cAAc,GAAdA;aACAC,gBAAgB,GAAhBA;aACAC,aAAa,GAAbA;aARb,OAAO,GAAG;aACV,KAAK,GAA0B;QASnCC,mBAAmB,IAAI;IAC3B;IAEA,IAAI,KAAwC;QACxC,OAAO;YACH,SAAS,IAAI,CAAC,OAAO;YACrB,OAAO,IAAI,CAAC,KAAK;YACjB,cAAc,IAAI,CAAC,eAAe;QACtC;IACJ;IAEQ,kBAAsD;QAC1D,MAAMC,QAAQ,IAAI,CAAC,KAAK;QACxB,IAAI,CAACA,OACD,OAAO;QAEX,MAAMC,aAAaD,MAAM,SAAS,IAAIA,MAAM,WAAW;QACvD,IAAI,CAACC,YACD,OAAO;QAEX,MAAMC,aACFF,MAAM,UAAU,KAAKG,mBAAmB,OAAO,GAAG,YAAY;QAClE,OAAO;YAAED;YAAY,YAAY,IAAI,CAAC,aAAa,CAAC,MAAM,CAACD;QAAY;IAC3E;IAEA,MAAM,KAAKG,MAA0C,EAAiB;QAClE,IAAI,CAAC,OAAO,GAAG;QAEf,IAAI;YACA,MAAMJ,QAAQ,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAACI;YAC5CC,YAAY;gBACR,IAAI,CAAC,KAAK,GAAGL;gBACb,IAAI,CAAC,OAAO,GAAG;YACnB;QACJ,EAAE,OAAM;YACJK,YAAY;gBACR,IAAI,CAAC,OAAO,GAAG;YACnB;QACJ;IACJ;IAEA,MAAM,SAASD,MAA8C,EAAiB;QAC1E,MAAM,EAAEE,QAAQ,EAAEC,SAAS,EAAEN,UAAU,EAAEO,UAAU,EAAE,GAAGJ;QACxD,IAAI,CAAC,OAAO,GAAG;QAEf,IAAI;YACA,OAAQI;gBACJ,KAAKL,mBAAmB,OAAO;oBAC3B,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;wBAAEI;wBAAWD;wBAAUL;oBAAW;oBACpE;gBACJ,KAAKE,mBAAmB,SAAS;oBAC7B,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;wBAAEI;wBAAWD;wBAAUL;oBAAW;oBACtE;gBACJ;oBACI,MAAM,IAAIQ,MAAM,CAAC,yBAAyB,EAAED,WAAW,EAAE,CAAC;YAClE;YACAH,YAAY;gBACR,IAAI,CAAC,KAAK,GAAG;gBACb,IAAI,CAAC,OAAO,GAAG;YACnB;QACJ,EAAE,OAAM;YACJA,YAAY;gBACR,IAAI,CAAC,OAAO,GAAG;YACnB;QACJ;IACJ;IAEA,MAAM,OAAOD,MAA4C,EAAiB;QACtE,IAAI,CAAC,OAAO,GAAG;QAEf,IAAI;YACA,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAACA;YACjCC,YAAY;gBACR,IAAI,CAAC,KAAK,GAAG;gBACb,IAAI,CAAC,OAAO,GAAG;YACnB;QACJ,EAAE,OAAM;YACJA,YAAY;gBACR,IAAI,CAAC,OAAO,GAAG;YACnB;QACJ;IACJ;IAEA,QAAc;QACV,IAAI,CAAC,KAAK,GAAG;QACb,IAAI,CAAC,OAAO,GAAG;IACnB;AACJ;AAEO,MAAMK,kDAA0BC,wBAAAA,oBAAgC,CAAC;IACpE,gBAAgBlB;IAChB,cAAc;QACVmB;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -0,0 +1,35 @@
1
+ import type { ScheduleActionType, SchedulerEntry } from "../../types.js";
2
+ export interface IScheduleDialogRescheduling {
3
+ actionName: string;
4
+ scheduleOn: string;
5
+ }
6
+ export interface IScheduleDialogPresenterViewModel {
7
+ loading: boolean;
8
+ entry: SchedulerEntry | null;
9
+ rescheduling: IScheduleDialogRescheduling | null;
10
+ }
11
+ export interface IScheduleDialogPresenterLoadParams {
12
+ namespace: string;
13
+ id: string;
14
+ }
15
+ export interface IScheduleDialogPresenterScheduleParams {
16
+ targetId: string;
17
+ namespace: string;
18
+ scheduleOn: Date;
19
+ actionType: ScheduleActionType;
20
+ }
21
+ export interface IScheduleDialogPresenterCancelParams {
22
+ id: string;
23
+ namespace: string;
24
+ }
25
+ export interface IScheduleDialogPresenter {
26
+ get vm(): IScheduleDialogPresenterViewModel;
27
+ load(params: IScheduleDialogPresenterLoadParams): Promise<void>;
28
+ schedule(params: IScheduleDialogPresenterScheduleParams): Promise<void>;
29
+ cancel(params: IScheduleDialogPresenterCancelParams): Promise<void>;
30
+ reset(): void;
31
+ }
32
+ export declare const ScheduleDialogPresenter: import("@webiny/di").Abstraction<IScheduleDialogPresenter>;
33
+ export declare namespace ScheduleDialogPresenter {
34
+ type Interface = IScheduleDialogPresenter;
35
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/admin";
2
+ const ScheduleDialogPresenter = createAbstraction("Scheduler/ScheduleDialogPresenter");
3
+ export { ScheduleDialogPresenter };
4
+
5
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation/scheduleDialog/abstractions.js","sources":["../../../src/presentation/scheduleDialog/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { ScheduleActionType, SchedulerEntry } from \"~/types.js\";\n\nexport interface IScheduleDialogRescheduling {\n actionName: string;\n scheduleOn: string;\n}\n\nexport interface IScheduleDialogPresenterViewModel {\n loading: boolean;\n entry: SchedulerEntry | null;\n rescheduling: IScheduleDialogRescheduling | null;\n}\n\nexport interface IScheduleDialogPresenterLoadParams {\n namespace: string;\n id: string;\n}\n\nexport interface IScheduleDialogPresenterScheduleParams {\n targetId: string;\n namespace: string;\n scheduleOn: Date;\n actionType: ScheduleActionType;\n}\n\nexport interface IScheduleDialogPresenterCancelParams {\n id: string;\n namespace: string;\n}\n\nexport interface IScheduleDialogPresenter {\n get vm(): IScheduleDialogPresenterViewModel;\n load(params: IScheduleDialogPresenterLoadParams): Promise<void>;\n schedule(params: IScheduleDialogPresenterScheduleParams): Promise<void>;\n cancel(params: IScheduleDialogPresenterCancelParams): Promise<void>;\n reset(): void;\n}\n\nexport const ScheduleDialogPresenter = createAbstraction<IScheduleDialogPresenter>(\n \"Scheduler/ScheduleDialogPresenter\"\n);\n\nexport namespace ScheduleDialogPresenter {\n export type Interface = IScheduleDialogPresenter;\n}\n"],"names":["ScheduleDialogPresenter","createAbstraction"],"mappings":";AAuCO,MAAMA,0BAA0BC,kBACnC"}
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import type { IScheduleDialogPresenter } from "../abstractions.js";
3
+ interface ICancelButtonComponentProps {
4
+ presenter: IScheduleDialogPresenter;
5
+ onCancel: () => Promise<void>;
6
+ }
7
+ export declare const CancelButtonComponent: (({ presenter, onCancel }: ICancelButtonComponentProps) => React.JSX.Element | null) & React.NamedExoticComponent<ICancelButtonComponentProps> & {
8
+ readonly type: ({ presenter, onCancel }: ICancelButtonComponentProps) => React.JSX.Element | null;
9
+ };
10
+ export {};
@@ -0,0 +1,20 @@
1
+ import react from "react";
2
+ import { observer } from "mobx-react-lite";
3
+ import { Button } from "@webiny/admin-ui";
4
+ import { ReactComponent } from "@webiny/icons/delete.svg";
5
+ const CancelButtonComponent = observer(({ presenter, onCancel })=>{
6
+ const { entry } = presenter.vm;
7
+ const scheduleOn = entry?.publishOn || entry?.unpublishOn;
8
+ if (!scheduleOn) return null;
9
+ return /*#__PURE__*/ react.createElement(Button, {
10
+ variant: "ghost",
11
+ onClick: onCancel,
12
+ text: "Cancel Schedule",
13
+ size: "md",
14
+ icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
15
+ iconPosition: "start"
16
+ });
17
+ });
18
+ export { CancelButtonComponent };
19
+
20
+ //# sourceMappingURL=CancelButtonComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation/scheduleDialog/components/CancelButtonComponent.js","sources":["../../../../src/presentation/scheduleDialog/components/CancelButtonComponent.tsx"],"sourcesContent":["import React from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { Button } from \"@webiny/admin-ui\";\nimport { ReactComponent as DeleteIcon } from \"@webiny/icons/delete.svg\";\nimport type { IScheduleDialogPresenter } from \"../abstractions.js\";\n\ninterface ICancelButtonComponentProps {\n presenter: IScheduleDialogPresenter;\n onCancel: () => Promise<void>;\n}\n\nexport const CancelButtonComponent = observer(\n ({ presenter, onCancel }: ICancelButtonComponentProps) => {\n const { entry } = presenter.vm;\n const scheduleOn = entry?.publishOn || entry?.unpublishOn;\n\n if (!scheduleOn) {\n return null;\n }\n return (\n <Button\n variant=\"ghost\"\n onClick={onCancel}\n text={\"Cancel Schedule\"}\n size=\"md\"\n icon={<DeleteIcon />}\n iconPosition=\"start\"\n />\n );\n }\n);\n"],"names":["CancelButtonComponent","observer","presenter","onCancel","entry","scheduleOn","Button","DeleteIcon"],"mappings":";;;;AAWO,MAAMA,wBAAwBC,SACjC,CAAC,EAAEC,SAAS,EAAEC,QAAQ,EAA+B;IACjD,MAAM,EAAEC,KAAK,EAAE,GAAGF,UAAU,EAAE;IAC9B,MAAMG,aAAaD,OAAO,aAAaA,OAAO;IAE9C,IAAI,CAACC,YACD,OAAO;IAEX,OAAO,WAAP,GACI,oBAACC,QAAMA;QACH,SAAQ;QACR,SAASH;QACT,MAAM;QACN,MAAK;QACL,oBAAM,oBAACI,gBAAUA;QACjB,cAAa;;AAGzB"}
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import type { IScheduleDialogPresenter } from "../abstractions.js";
3
+ interface FormComponentProps {
4
+ presenter: IScheduleDialogPresenter;
5
+ }
6
+ export declare const FormComponent: (({ presenter }: FormComponentProps) => React.JSX.Element) & React.NamedExoticComponent<FormComponentProps> & {
7
+ readonly type: ({ presenter }: FormComponentProps) => React.JSX.Element;
8
+ };
9
+ export {};
@@ -0,0 +1,32 @@
1
+ import react, { useMemo } from "react";
2
+ import { observer } from "mobx-react-lite";
3
+ import { Grid } from "@webiny/admin-ui";
4
+ import { Bind } from "@webiny/form";
5
+ import { validation } from "@webiny/validation";
6
+ import { createMinDateValidator } from "../createMinDateValidator.js";
7
+ import { useDateFormatter } from "@webiny/app-admin";
8
+ import { ReschedulingAlert } from "./ReschedulingAlert.js";
9
+ import { SchedulerDialogFormComponentDateTimeInput } from "./SchedulerDialogFormComponentDateTimeInput.js";
10
+ const FormComponent = observer(({ presenter })=>{
11
+ const { rescheduling } = presenter.vm;
12
+ const dateFormatter = useDateFormatter();
13
+ const minDateValidator = useMemo(()=>createMinDateValidator(dateFormatter), [
14
+ dateFormatter
15
+ ]);
16
+ return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(ReschedulingAlert, {
17
+ rescheduling: rescheduling
18
+ }), /*#__PURE__*/ react.createElement(Grid, null, /*#__PURE__*/ react.createElement(Grid.Column, {
19
+ span: 12
20
+ }, /*#__PURE__*/ react.createElement(Bind, {
21
+ name: "scheduleOn",
22
+ validators: [
23
+ validation.create("required"),
24
+ minDateValidator
25
+ ]
26
+ }, (bind)=>/*#__PURE__*/ react.createElement(SchedulerDialogFormComponentDateTimeInput, {
27
+ bind: bind
28
+ })))));
29
+ });
30
+ export { FormComponent };
31
+
32
+ //# sourceMappingURL=FormComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation/scheduleDialog/components/FormComponent.js","sources":["../../../../src/presentation/scheduleDialog/components/FormComponent.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { Grid } from \"@webiny/admin-ui\";\nimport { Bind } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport type { IScheduleDialogPresenter } from \"../abstractions.js\";\nimport { createMinDateValidator } from \"../createMinDateValidator.js\";\nimport { useDateFormatter } from \"@webiny/app-admin\";\nimport { ReschedulingAlert } from \"./ReschedulingAlert.js\";\nimport { SchedulerDialogFormComponentDateTimeInput } from \"./SchedulerDialogFormComponentDateTimeInput.js\";\n\ninterface FormComponentProps {\n presenter: IScheduleDialogPresenter;\n}\n\nexport const FormComponent = observer(({ presenter }: FormComponentProps) => {\n const { rescheduling } = presenter.vm;\n const dateFormatter = useDateFormatter();\n const minDateValidator = useMemo(() => createMinDateValidator(dateFormatter), [dateFormatter]);\n\n return (\n <>\n <ReschedulingAlert rescheduling={rescheduling} />\n <Grid>\n <Grid.Column span={12}>\n <Bind\n name={\"scheduleOn\"}\n validators={[validation.create(\"required\"), minDateValidator]}\n >\n {bind => {\n return <SchedulerDialogFormComponentDateTimeInput bind={bind} />;\n }}\n </Bind>\n </Grid.Column>\n </Grid>\n </>\n );\n});\n"],"names":["FormComponent","observer","presenter","rescheduling","dateFormatter","useDateFormatter","minDateValidator","useMemo","createMinDateValidator","ReschedulingAlert","Grid","Bind","validation","bind","SchedulerDialogFormComponentDateTimeInput"],"mappings":";;;;;;;;;AAeO,MAAMA,gBAAgBC,SAAS,CAAC,EAAEC,SAAS,EAAsB;IACpE,MAAM,EAAEC,YAAY,EAAE,GAAGD,UAAU,EAAE;IACrC,MAAME,gBAAgBC;IACtB,MAAMC,mBAAmBC,QAAQ,IAAMC,uBAAuBJ,gBAAgB;QAACA;KAAc;IAE7F,OAAO,WAAP,GACI,wDACI,oBAACK,mBAAiBA;QAAC,cAAcN;sBACjC,oBAACO,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,MAAIA;QACD,MAAM;QACN,YAAY;YAACC,WAAW,MAAM,CAAC;YAAaN;SAAiB;OAE5DO,CAAAA,OACU,WAAP,GAAO,oBAACC,2CAAyCA;YAAC,MAAMD;;AAOpF"}
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import type { IScheduleDialogRescheduling } from "../abstractions.js";
3
+ interface IReschedulingAlertProps {
4
+ rescheduling: IScheduleDialogRescheduling | null;
5
+ }
6
+ export declare const ReschedulingAlert: ({ rescheduling }: IReschedulingAlertProps) => React.JSX.Element | null;
7
+ export {};
@@ -0,0 +1,14 @@
1
+ import react from "react";
2
+ import { Alert } from "@webiny/admin-ui";
3
+ import { ReactComponent } from "@webiny/icons/access_time.svg";
4
+ const ReschedulingAlert = ({ rescheduling })=>{
5
+ if (!rescheduling) return null;
6
+ return /*#__PURE__*/ react.createElement(Alert, {
7
+ type: "warning",
8
+ variant: "subtle",
9
+ icon: /*#__PURE__*/ react.createElement(ReactComponent, null)
10
+ }, /*#__PURE__*/ react.createElement(react.Fragment, null, "A ", rescheduling.actionName, " is already scheduled at", /*#__PURE__*/ react.createElement("br", null), /*#__PURE__*/ react.createElement("strong", null, rescheduling.scheduleOn), "."));
11
+ };
12
+ export { ReschedulingAlert };
13
+
14
+ //# sourceMappingURL=ReschedulingAlert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation/scheduleDialog/components/ReschedulingAlert.js","sources":["../../../../src/presentation/scheduleDialog/components/ReschedulingAlert.tsx"],"sourcesContent":["import React from \"react\";\nimport { Alert } from \"@webiny/admin-ui\";\nimport { ReactComponent as ScheduledIcon } from \"@webiny/icons/access_time.svg\";\nimport type { IScheduleDialogRescheduling } from \"../abstractions.js\";\n\ninterface IReschedulingAlertProps {\n rescheduling: IScheduleDialogRescheduling | null;\n}\n\nexport const ReschedulingAlert = ({ rescheduling }: IReschedulingAlertProps) => {\n if (!rescheduling) {\n return null;\n }\n return (\n <Alert type={\"warning\"} variant={\"subtle\"} icon={<ScheduledIcon />}>\n <>\n A {rescheduling.actionName} is already scheduled at\n <br />\n <strong>{rescheduling.scheduleOn}</strong>.\n </>\n </Alert>\n );\n};\n"],"names":["ReschedulingAlert","rescheduling","Alert","ScheduledIcon"],"mappings":";;;AASO,MAAMA,oBAAoB,CAAC,EAAEC,YAAY,EAA2B;IACvE,IAAI,CAACA,cACD,OAAO;IAEX,OAAO,WAAP,GACI,oBAACC,OAAKA;QAAC,MAAM;QAAW,SAAS;QAAU,oBAAM,oBAACC,gBAAaA;qBAC3D,0CAAE,MACKF,aAAa,UAAU,EAAC,0CAC3B,oBAAC,2BACD,oBAAC,gBAAQA,aAAa,UAAU,GAAU;AAI1D"}
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import type { BindComponentRenderProp } from "@webiny/form";
3
+ export interface ISchedulerDialogFormComponentDateTimeInputProps {
4
+ bind: BindComponentRenderProp<Date>;
5
+ }
6
+ export declare const SchedulerDialogFormComponentDateTimeInput: ((props: ISchedulerDialogFormComponentDateTimeInputProps) => React.JSX.Element) & {
7
+ original: (props: ISchedulerDialogFormComponentDateTimeInputProps) => React.JSX.Element;
8
+ originalName: string;
9
+ displayName: string;
10
+ } & {
11
+ original: ((props: ISchedulerDialogFormComponentDateTimeInputProps) => React.JSX.Element) & {
12
+ original: (props: ISchedulerDialogFormComponentDateTimeInputProps) => React.JSX.Element;
13
+ originalName: string;
14
+ displayName: string;
15
+ };
16
+ originalName: string;
17
+ displayName: string;
18
+ } & {
19
+ createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<((props: ISchedulerDialogFormComponentDateTimeInputProps) => React.JSX.Element) & {
20
+ original: (props: ISchedulerDialogFormComponentDateTimeInputProps) => React.JSX.Element;
21
+ originalName: string;
22
+ displayName: string;
23
+ }>) => (props: unknown) => React.JSX.Element;
24
+ };
@@ -0,0 +1,15 @@
1
+ import react from "react";
2
+ import { DatePicker } from "@webiny/admin-ui";
3
+ import { makeDecoratable } from "@webiny/react-composition";
4
+ const SchedulerDialogFormComponentDateTimeInput = makeDecoratable("SchedulerDialogFormComponentDateTimeInput", (props)=>{
5
+ const { bind } = props;
6
+ return /*#__PURE__*/ react.createElement(DatePicker, {
7
+ ...bind,
8
+ type: "dateTimeLocal",
9
+ label: "Schedule On",
10
+ size: "lg"
11
+ });
12
+ });
13
+ export { SchedulerDialogFormComponentDateTimeInput };
14
+
15
+ //# sourceMappingURL=SchedulerDialogFormComponentDateTimeInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation/scheduleDialog/components/SchedulerDialogFormComponentDateTimeInput.js","sources":["../../../../src/presentation/scheduleDialog/components/SchedulerDialogFormComponentDateTimeInput.tsx"],"sourcesContent":["import React from \"react\";\nimport { DatePicker } from \"@webiny/admin-ui\";\nimport { makeDecoratable } from \"@webiny/react-composition\";\nimport type { BindComponentRenderProp } from \"@webiny/form\";\n\nexport interface ISchedulerDialogFormComponentDateTimeInputProps {\n bind: BindComponentRenderProp<Date>;\n}\n\nexport const SchedulerDialogFormComponentDateTimeInput = makeDecoratable(\n \"SchedulerDialogFormComponentDateTimeInput\",\n (props: ISchedulerDialogFormComponentDateTimeInputProps) => {\n const { bind } = props;\n\n return <DatePicker {...bind} type={\"dateTimeLocal\"} label={\"Schedule On\"} size={\"lg\"} />;\n }\n);\n"],"names":["SchedulerDialogFormComponentDateTimeInput","makeDecoratable","props","bind","DatePicker"],"mappings":";;;AASO,MAAMA,4CAA4CC,gBACrD,6CACA,CAACC;IACG,MAAM,EAAEC,IAAI,EAAE,GAAGD;IAEjB,OAAO,WAAP,GAAO,oBAACE,YAAUA;QAAE,GAAGD,IAAI;QAAE,MAAM;QAAiB,OAAO;QAAe,MAAM;;AACpF"}
@@ -0,0 +1,7 @@
1
+ import type { Validator } from "@webiny/validation/types.js";
2
+ import type { DateFormatter } from "@webiny/app-admin";
3
+ /**
4
+ * Builds a validator that requires the scheduled date to be at least 2 minutes in the future. The
5
+ * formatter is injected so the error message's date matches the format used everywhere else.
6
+ */
7
+ export declare const createMinDateValidator: (dateFormatter: DateFormatter.Interface) => Validator;
@@ -0,0 +1,14 @@
1
+ import validationError from "@webiny/validation/validationError.js";
2
+ const createMinDateValidator = (dateFormatter)=>{
3
+ const minDateValidator = (input)=>{
4
+ const value = new Date(input);
5
+ const minDate = new Date(new Date().getTime() + 120000);
6
+ if (minDate < value) return;
7
+ throw new validationError(`The date must be at least 2 minutes in the future. Current minimum date is ${dateFormatter.format(minDate)}.`);
8
+ };
9
+ minDateValidator.validatorName = "minDateValidator";
10
+ return minDateValidator;
11
+ };
12
+ export { createMinDateValidator };
13
+
14
+ //# sourceMappingURL=createMinDateValidator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation/scheduleDialog/createMinDateValidator.js","sources":["../../../src/presentation/scheduleDialog/createMinDateValidator.ts"],"sourcesContent":["import type { Validator } from \"@webiny/validation/types.js\";\nimport ValidationError from \"@webiny/validation/validationError.js\";\nimport type { DateFormatter } from \"@webiny/app-admin\";\n\n/**\n * Builds a validator that requires the scheduled date to be at least 2 minutes in the future. The\n * formatter is injected so the error message's date matches the format used everywhere else.\n */\nexport const createMinDateValidator = (dateFormatter: DateFormatter.Interface): Validator => {\n const minDateValidator: Validator = (input: string) => {\n const value = new Date(input);\n const minDate = new Date(new Date().getTime() + 120 * 1000);\n if (minDate < value) {\n return;\n }\n throw new ValidationError(\n `The date must be at least 2 minutes in the future. Current minimum date is ${dateFormatter.format(\n minDate\n )}.`\n );\n };\n\n minDateValidator.validatorName = \"minDateValidator\";\n\n return minDateValidator;\n};\n"],"names":["createMinDateValidator","dateFormatter","minDateValidator","input","value","Date","minDate","ValidationError"],"mappings":";AAQO,MAAMA,yBAAyB,CAACC;IACnC,MAAMC,mBAA8B,CAACC;QACjC,MAAMC,QAAQ,IAAIC,KAAKF;QACvB,MAAMG,UAAU,IAAID,KAAK,IAAIA,OAAO,OAAO,KAAK;QAChD,IAAIC,UAAUF,OACV;QAEJ,MAAM,IAAIG,gBACN,CAAC,2EAA2E,EAAEN,cAAc,MAAM,CAC9FK,SACF,CAAC,CAAC;IAEZ;IAEAJ,iBAAiB,aAAa,GAAG;IAEjC,OAAOA;AACX"}
@@ -0,0 +1,3 @@
1
+ export declare const ScheduleDialogPresenterFeature: import("@webiny/feature/admin").FeatureDefinition<{
2
+ presenter: import("./abstractions.js").IScheduleDialogPresenter;
3
+ }, []>;
@@ -0,0 +1,17 @@
1
+ import { createFeature } from "@webiny/feature/admin";
2
+ import { ScheduleDialogPresenter } from "./abstractions.js";
3
+ import { ScheduleDialogPresenter as external_ScheduleDialogPresenter_js_ScheduleDialogPresenter } from "./ScheduleDialogPresenter.js";
4
+ const ScheduleDialogPresenterFeature = createFeature({
5
+ name: "Scheduler/ScheduleDialogPresenter",
6
+ register (container) {
7
+ container.register(external_ScheduleDialogPresenter_js_ScheduleDialogPresenter);
8
+ },
9
+ resolve (container) {
10
+ return {
11
+ presenter: container.resolve(ScheduleDialogPresenter)
12
+ };
13
+ }
14
+ });
15
+ export { ScheduleDialogPresenterFeature };
16
+
17
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation/scheduleDialog/feature.js","sources":["../../../src/presentation/scheduleDialog/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { ScheduleDialogPresenter as PresenterAbstraction } from \"./abstractions.js\";\nimport { ScheduleDialogPresenter } from \"./ScheduleDialogPresenter.js\";\n\nexport const ScheduleDialogPresenterFeature = createFeature({\n name: \"Scheduler/ScheduleDialogPresenter\",\n register(container) {\n container.register(ScheduleDialogPresenter);\n },\n resolve(container) {\n return { presenter: container.resolve(PresenterAbstraction) };\n }\n});\n"],"names":["ScheduleDialogPresenterFeature","createFeature","container","ScheduleDialogPresenter","PresenterAbstraction"],"mappings":";;;AAIO,MAAMA,iCAAiCC,cAAc;IACxD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;IACA,SAAQD,SAAS;QACb,OAAO;YAAE,WAAWA,UAAU,OAAO,CAACE;QAAsB;IAChE;AACJ"}