@webiny/app-scheduler 0.0.0-unstable.9f53ea597d → 0.0.0-unstable.a4f3e4ea8b
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/package.json +14 -14
- package/presentation/components/Cells/CellScheduledOn/CellScheduledOn.js +3 -1
- package/presentation/components/Cells/CellScheduledOn/CellScheduledOn.js.map +1 -1
- package/presentation/scheduleDialog/ScheduleDialogPresenter.d.ts +4 -1
- package/presentation/scheduleDialog/ScheduleDialogPresenter.js +18 -3
- package/presentation/scheduleDialog/ScheduleDialogPresenter.js.map +1 -1
- package/presentation/scheduleDialog/abstractions.d.ts +5 -0
- package/presentation/scheduleDialog/abstractions.js.map +1 -1
- package/presentation/scheduleDialog/components/FormComponent.js +9 -7
- package/presentation/scheduleDialog/components/FormComponent.js.map +1 -1
- package/presentation/scheduleDialog/components/ReschedulingAlert.d.ts +3 -4
- package/presentation/scheduleDialog/components/ReschedulingAlert.js +3 -6
- package/presentation/scheduleDialog/components/ReschedulingAlert.js.map +1 -1
- package/presentation/scheduleDialog/components/SchedulerDialogFormComponentDateTimeInput.js +1 -1
- package/presentation/scheduleDialog/components/SchedulerDialogFormComponentDateTimeInput.js.map +1 -1
- package/presentation/scheduleDialog/createMinDateValidator.d.ts +7 -0
- package/presentation/scheduleDialog/createMinDateValidator.js +14 -0
- package/presentation/scheduleDialog/createMinDateValidator.js.map +1 -0
- package/presentation/scheduleDialog/minDateValidator.d.ts +0 -2
- package/presentation/scheduleDialog/minDateValidator.js +0 -12
- package/presentation/scheduleDialog/minDateValidator.js.map +0 -1
- package/presentation/scheduleDialog/scheduleDateFormatter.d.ts +0 -1
- package/presentation/scheduleDialog/scheduleDateFormatter.js +0 -12
- package/presentation/scheduleDialog/scheduleDateFormatter.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app-scheduler",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.a4f3e4ea8b",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -16,18 +16,18 @@
|
|
|
16
16
|
"@emotion/react": "11.14.0",
|
|
17
17
|
"@emotion/styled": "11.14.1",
|
|
18
18
|
"@material-design-icons/svg": "0.14.15",
|
|
19
|
-
"@webiny/admin-ui": "0.0.0-unstable.
|
|
20
|
-
"@webiny/app": "0.0.0-unstable.
|
|
21
|
-
"@webiny/app-aco": "0.0.0-unstable.
|
|
22
|
-
"@webiny/app-admin": "0.0.0-unstable.
|
|
23
|
-
"@webiny/app-headless-cms-common": "0.0.0-unstable.
|
|
24
|
-
"@webiny/feature": "0.0.0-unstable.
|
|
25
|
-
"@webiny/form": "0.0.0-unstable.
|
|
26
|
-
"@webiny/icons": "0.0.0-unstable.
|
|
27
|
-
"@webiny/react-composition": "0.0.0-unstable.
|
|
28
|
-
"@webiny/react-properties": "0.0.0-unstable.
|
|
29
|
-
"@webiny/utils": "0.0.0-unstable.
|
|
30
|
-
"@webiny/validation": "0.0.0-unstable.
|
|
19
|
+
"@webiny/admin-ui": "0.0.0-unstable.a4f3e4ea8b",
|
|
20
|
+
"@webiny/app": "0.0.0-unstable.a4f3e4ea8b",
|
|
21
|
+
"@webiny/app-aco": "0.0.0-unstable.a4f3e4ea8b",
|
|
22
|
+
"@webiny/app-admin": "0.0.0-unstable.a4f3e4ea8b",
|
|
23
|
+
"@webiny/app-headless-cms-common": "0.0.0-unstable.a4f3e4ea8b",
|
|
24
|
+
"@webiny/feature": "0.0.0-unstable.a4f3e4ea8b",
|
|
25
|
+
"@webiny/form": "0.0.0-unstable.a4f3e4ea8b",
|
|
26
|
+
"@webiny/icons": "0.0.0-unstable.a4f3e4ea8b",
|
|
27
|
+
"@webiny/react-composition": "0.0.0-unstable.a4f3e4ea8b",
|
|
28
|
+
"@webiny/react-properties": "0.0.0-unstable.a4f3e4ea8b",
|
|
29
|
+
"@webiny/utils": "0.0.0-unstable.a4f3e4ea8b",
|
|
30
|
+
"@webiny/validation": "0.0.0-unstable.a4f3e4ea8b",
|
|
31
31
|
"lodash": "4.18.1",
|
|
32
32
|
"mobx": "6.16.1",
|
|
33
33
|
"mobx-react-lite": "4.1.1",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/react": "18.3.31",
|
|
40
|
-
"@webiny/build-tools": "0.0.0-unstable.
|
|
40
|
+
"@webiny/build-tools": "0.0.0-unstable.a4f3e4ea8b",
|
|
41
41
|
"rimraf": "6.1.3",
|
|
42
42
|
"typescript": "7.0.2"
|
|
43
43
|
},
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import react from "react";
|
|
2
2
|
import { SchedulerListConfig } from "../../../configs/index.js";
|
|
3
3
|
import { makeDecoratable } from "@webiny/react-composition";
|
|
4
|
+
import { useDateFormatter } from "@webiny/app-admin";
|
|
4
5
|
const CellScheduledOnLabel = makeDecoratable("Scheduler.CellScheduledOnLabel", ({ dateTime })=>{
|
|
6
|
+
const dateFormatter = useDateFormatter();
|
|
5
7
|
if (!dateTime) return /*#__PURE__*/ react.createElement(react.Fragment, null, "Missing publish or unpublish date.");
|
|
6
|
-
return /*#__PURE__*/ react.createElement(react.Fragment, null,
|
|
8
|
+
return /*#__PURE__*/ react.createElement(react.Fragment, null, dateFormatter.format(dateTime));
|
|
7
9
|
});
|
|
8
10
|
const CellScheduledOn = ()=>{
|
|
9
11
|
const { useTableRow } = SchedulerListConfig.Browser.Table.Column;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation/components/Cells/CellScheduledOn/CellScheduledOn.js","sources":["../../../../../src/presentation/components/Cells/CellScheduledOn/CellScheduledOn.tsx"],"sourcesContent":["import React from \"react\";\nimport { SchedulerListConfig } from \"~/presentation/configs/index.js\";\nimport { makeDecoratable } from \"@webiny/react-composition\";\n\nexport interface ICellScheduledOnLabelProps {\n dateTime: Date | undefined;\n}\n\nexport const CellScheduledOnLabel = makeDecoratable(\n \"Scheduler.CellScheduledOnLabel\",\n ({ dateTime }: ICellScheduledOnLabelProps) => {\n if (!dateTime) {\n return <>Missing publish or unpublish date.</>;\n }\n\n return <>{
|
|
1
|
+
{"version":3,"file":"presentation/components/Cells/CellScheduledOn/CellScheduledOn.js","sources":["../../../../../src/presentation/components/Cells/CellScheduledOn/CellScheduledOn.tsx"],"sourcesContent":["import React from \"react\";\nimport { SchedulerListConfig } from \"~/presentation/configs/index.js\";\nimport { makeDecoratable } from \"@webiny/react-composition\";\nimport { useDateFormatter } from \"@webiny/app-admin\";\n\nexport interface ICellScheduledOnLabelProps {\n dateTime: Date | undefined;\n}\n\nexport const CellScheduledOnLabel = makeDecoratable(\n \"Scheduler.CellScheduledOnLabel\",\n ({ dateTime }: ICellScheduledOnLabelProps) => {\n const dateFormatter = useDateFormatter();\n if (!dateTime) {\n return <>Missing publish or unpublish date.</>;\n }\n\n return <>{dateFormatter.format(dateTime)}</>;\n }\n);\n\nexport const CellScheduledOn = () => {\n const { useTableRow } = SchedulerListConfig.Browser.Table.Column;\n const { row } = useTableRow();\n\n return <CellScheduledOnLabel dateTime={row.data.publishOn || row.data.unpublishOn} />;\n};\n"],"names":["CellScheduledOnLabel","makeDecoratable","dateTime","dateFormatter","useDateFormatter","CellScheduledOn","useTableRow","SchedulerListConfig","row"],"mappings":";;;;AASO,MAAMA,uBAAuBC,gBAChC,kCACA,CAAC,EAAEC,QAAQ,EAA8B;IACrC,MAAMC,gBAAgBC;IACtB,IAAI,CAACF,UACD,OAAO,WAAP,GAAO,0CAAE;IAGb,OAAO,WAAP,GAAO,0CAAGC,cAAc,MAAM,CAACD;AACnC;AAGG,MAAMG,kBAAkB;IAC3B,MAAM,EAAEC,WAAW,EAAE,GAAGC,oBAAoB,OAAO,CAAC,KAAK,CAAC,MAAM;IAChE,MAAM,EAAEC,GAAG,EAAE,GAAGF;IAEhB,OAAO,WAAP,GAAO,oBAACN,sBAAoBA;QAAC,UAAUQ,IAAI,IAAI,CAAC,SAAS,IAAIA,IAAI,IAAI,CAAC,WAAW;;AACrF"}
|
|
@@ -2,16 +2,19 @@ import { GetScheduledActionGateway } from "../../features/getScheduledAction/abs
|
|
|
2
2
|
import { CancelScheduledActionGateway } from "../../features/cancelScheduledAction/abstractions.js";
|
|
3
3
|
import { SchedulePublishActionGateway } from "../../features/schedulePublishAction/abstractions.js";
|
|
4
4
|
import { ScheduleUnpublishActionGateway } from "../../features/scheduleUnpublishAction/abstractions.js";
|
|
5
|
+
import { DateFormatter } from "@webiny/app-admin";
|
|
5
6
|
import { type IScheduleDialogPresenter, type IScheduleDialogPresenterViewModel, type IScheduleDialogPresenterLoadParams, type IScheduleDialogPresenterScheduleParams, type IScheduleDialogPresenterCancelParams } from "./abstractions.js";
|
|
6
7
|
declare class ScheduleDialogPresenterImpl implements IScheduleDialogPresenter {
|
|
7
8
|
private readonly getGateway;
|
|
8
9
|
private readonly cancelGateway;
|
|
9
10
|
private readonly publishGateway;
|
|
10
11
|
private readonly unpublishGateway;
|
|
12
|
+
private readonly dateFormatter;
|
|
11
13
|
private loading;
|
|
12
14
|
private entry;
|
|
13
|
-
constructor(getGateway: GetScheduledActionGateway.Interface, cancelGateway: CancelScheduledActionGateway.Interface, publishGateway: SchedulePublishActionGateway.Interface, unpublishGateway: ScheduleUnpublishActionGateway.Interface);
|
|
15
|
+
constructor(getGateway: GetScheduledActionGateway.Interface, cancelGateway: CancelScheduledActionGateway.Interface, publishGateway: SchedulePublishActionGateway.Interface, unpublishGateway: ScheduleUnpublishActionGateway.Interface, dateFormatter: DateFormatter.Interface);
|
|
14
16
|
get vm(): IScheduleDialogPresenterViewModel;
|
|
17
|
+
private getRescheduling;
|
|
15
18
|
load(params: IScheduleDialogPresenterLoadParams): Promise<void>;
|
|
16
19
|
schedule(params: IScheduleDialogPresenterScheduleParams): Promise<void>;
|
|
17
20
|
cancel(params: IScheduleDialogPresenterCancelParams): Promise<void>;
|
|
@@ -4,13 +4,15 @@ import { CancelScheduledActionGateway } from "../../features/cancelScheduledActi
|
|
|
4
4
|
import { SchedulePublishActionGateway } from "../../features/schedulePublishAction/abstractions.js";
|
|
5
5
|
import { ScheduleUnpublishActionGateway } from "../../features/scheduleUnpublishAction/abstractions.js";
|
|
6
6
|
import { ScheduleActionType } from "../../types.js";
|
|
7
|
+
import { DateFormatter, formatUtcOffset } from "@webiny/app-admin";
|
|
7
8
|
import { ScheduleDialogPresenter } from "./abstractions.js";
|
|
8
9
|
class ScheduleDialogPresenterImpl {
|
|
9
|
-
constructor(getGateway, cancelGateway, publishGateway, unpublishGateway){
|
|
10
|
+
constructor(getGateway, cancelGateway, publishGateway, unpublishGateway, dateFormatter){
|
|
10
11
|
this.getGateway = getGateway;
|
|
11
12
|
this.cancelGateway = cancelGateway;
|
|
12
13
|
this.publishGateway = publishGateway;
|
|
13
14
|
this.unpublishGateway = unpublishGateway;
|
|
15
|
+
this.dateFormatter = dateFormatter;
|
|
14
16
|
this.loading = false;
|
|
15
17
|
this.entry = null;
|
|
16
18
|
makeAutoObservable(this);
|
|
@@ -18,7 +20,19 @@ class ScheduleDialogPresenterImpl {
|
|
|
18
20
|
get vm() {
|
|
19
21
|
return {
|
|
20
22
|
loading: this.loading,
|
|
21
|
-
entry: this.entry
|
|
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)} (${formatUtcOffset()})`
|
|
22
36
|
};
|
|
23
37
|
}
|
|
24
38
|
async load(params) {
|
|
@@ -92,7 +106,8 @@ const ScheduleDialogPresenter_ScheduleDialogPresenter = ScheduleDialogPresenter.
|
|
|
92
106
|
GetScheduledActionGateway,
|
|
93
107
|
CancelScheduledActionGateway,
|
|
94
108
|
SchedulePublishActionGateway,
|
|
95
|
-
ScheduleUnpublishActionGateway
|
|
109
|
+
ScheduleUnpublishActionGateway,
|
|
110
|
+
DateFormatter
|
|
96
111
|
]
|
|
97
112
|
});
|
|
98
113
|
export { ScheduleDialogPresenter_ScheduleDialogPresenter as ScheduleDialogPresenter };
|
|
@@ -1 +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 {\n ScheduleDialogPresenter as Abstraction,\n type IScheduleDialogPresenter,\n type IScheduleDialogPresenterViewModel,\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 ) {\n makeAutoObservable(this);\n }\n\n get vm(): IScheduleDialogPresenterViewModel {\n return {\n loading: this.loading,\n entry: this.entry\n };\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 ]\n});\n"],"names":["ScheduleDialogPresenterImpl","getGateway","cancelGateway","publishGateway","unpublishGateway","
|
|
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 { formatUtcOffset } 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 {\n actionName,\n scheduleOn: `${this.dateFormatter.format(scheduleOn)} (${formatUtcOffset()})`\n };\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","formatUtcOffset","params","runInAction","targetId","namespace","actionType","Error","ScheduleDialogPresenter","Abstraction","GetScheduledActionGateway","CancelScheduledActionGateway","SchedulePublishActionGateway","ScheduleUnpublishActionGateway","DateFormatter"],"mappings":";;;;;;;;AAmBA,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;YACHD;YACA,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAACD,YAAY,EAAE,EAAEG,kBAAkB,CAAC,CAAC;QACjF;IACJ;IAEA,MAAM,KAAKC,MAA0C,EAAiB;QAClE,IAAI,CAAC,OAAO,GAAG;QAEf,IAAI;YACA,MAAML,QAAQ,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAACK;YAC5CC,YAAY;gBACR,IAAI,CAAC,KAAK,GAAGN;gBACb,IAAI,CAAC,OAAO,GAAG;YACnB;QACJ,EAAE,OAAM;YACJM,YAAY;gBACR,IAAI,CAAC,OAAO,GAAG;YACnB;QACJ;IACJ;IAEA,MAAM,SAASD,MAA8C,EAAiB;QAC1E,MAAM,EAAEE,QAAQ,EAAEC,SAAS,EAAEP,UAAU,EAAEQ,UAAU,EAAE,GAAGJ;QACxD,IAAI,CAAC,OAAO,GAAG;QAEf,IAAI;YACA,OAAQI;gBACJ,KAAKN,mBAAmB,OAAO;oBAC3B,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;wBAAEK;wBAAWD;wBAAUN;oBAAW;oBACpE;gBACJ,KAAKE,mBAAmB,SAAS;oBAC7B,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;wBAAEK;wBAAWD;wBAAUN;oBAAW;oBACtE;gBACJ;oBACI,MAAM,IAAIS,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,gBAAgBnB;IAChB,cAAc;QACVoB;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { ScheduleActionType, SchedulerEntry } from "../../types.js";
|
|
2
|
+
export interface IScheduleDialogRescheduling {
|
|
3
|
+
actionName: string;
|
|
4
|
+
scheduleOn: string;
|
|
5
|
+
}
|
|
2
6
|
export interface IScheduleDialogPresenterViewModel {
|
|
3
7
|
loading: boolean;
|
|
4
8
|
entry: SchedulerEntry | null;
|
|
9
|
+
rescheduling: IScheduleDialogRescheduling | null;
|
|
5
10
|
}
|
|
6
11
|
export interface IScheduleDialogPresenterLoadParams {
|
|
7
12
|
namespace: string;
|
|
@@ -1 +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 IScheduleDialogPresenterViewModel {\n loading: boolean;\n entry: SchedulerEntry | 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":";
|
|
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"}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import react from "react";
|
|
1
|
+
import react, { useMemo } from "react";
|
|
2
2
|
import { observer } from "mobx-react-lite";
|
|
3
3
|
import { Grid } from "@webiny/admin-ui";
|
|
4
4
|
import { Bind } from "@webiny/form";
|
|
5
5
|
import { validation } from "@webiny/validation";
|
|
6
|
-
import {
|
|
6
|
+
import { createMinDateValidator } from "../createMinDateValidator.js";
|
|
7
|
+
import { useDateFormatter } from "@webiny/app-admin";
|
|
7
8
|
import { ReschedulingAlert } from "./ReschedulingAlert.js";
|
|
8
9
|
import { SchedulerDialogFormComponentDateTimeInput } from "./SchedulerDialogFormComponentDateTimeInput.js";
|
|
9
10
|
const FormComponent = observer(({ presenter })=>{
|
|
10
|
-
const {
|
|
11
|
-
const
|
|
12
|
-
const
|
|
11
|
+
const { rescheduling } = presenter.vm;
|
|
12
|
+
const dateFormatter = useDateFormatter();
|
|
13
|
+
const minDateValidator = useMemo(()=>createMinDateValidator(dateFormatter), [
|
|
14
|
+
dateFormatter
|
|
15
|
+
]);
|
|
13
16
|
return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(ReschedulingAlert, {
|
|
14
|
-
|
|
15
|
-
scheduleOn: scheduleOn
|
|
17
|
+
rescheduling: rescheduling
|
|
16
18
|
}), /*#__PURE__*/ react.createElement(Grid, null, /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
17
19
|
span: 12
|
|
18
20
|
}, /*#__PURE__*/ react.createElement(Bind, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation/scheduleDialog/components/FormComponent.js","sources":["../../../../src/presentation/scheduleDialog/components/FormComponent.tsx"],"sourcesContent":["import React 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 {
|
|
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"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import type { IScheduleDialogRescheduling } from "../abstractions.js";
|
|
3
3
|
interface IReschedulingAlertProps {
|
|
4
|
-
|
|
5
|
-
actionType: ScheduleActionType | undefined;
|
|
4
|
+
rescheduling: IScheduleDialogRescheduling | null;
|
|
6
5
|
}
|
|
7
|
-
export declare const ReschedulingAlert: ({
|
|
6
|
+
export declare const ReschedulingAlert: ({ rescheduling }: IReschedulingAlertProps) => React.JSX.Element | null;
|
|
8
7
|
export {};
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import react from "react";
|
|
2
2
|
import { Alert } from "@webiny/admin-ui";
|
|
3
3
|
import { ReactComponent } from "@webiny/icons/access_time.svg";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const ReschedulingAlert = ({ scheduleOn, actionType })=>{
|
|
7
|
-
if (!scheduleOn || !actionType) return null;
|
|
8
|
-
const actionName = actionType === ScheduleActionType.publish ? "publish" : "unpublish";
|
|
4
|
+
const ReschedulingAlert = ({ rescheduling })=>{
|
|
5
|
+
if (!rescheduling) return null;
|
|
9
6
|
return /*#__PURE__*/ react.createElement(Alert, {
|
|
10
7
|
type: "warning",
|
|
11
8
|
variant: "subtle",
|
|
12
9
|
icon: /*#__PURE__*/ react.createElement(ReactComponent, null)
|
|
13
|
-
}, /*#__PURE__*/ react.createElement(react.Fragment, null, "A ", actionName, " is already scheduled at", /*#__PURE__*/ react.createElement("br", null), /*#__PURE__*/ react.createElement("strong", 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), "."));
|
|
14
11
|
};
|
|
15
12
|
export { ReschedulingAlert };
|
|
16
13
|
|
|
@@ -1 +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
|
|
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"}
|
|
@@ -5,7 +5,7 @@ const SchedulerDialogFormComponentDateTimeInput = makeDecoratable("SchedulerDial
|
|
|
5
5
|
const { bind } = props;
|
|
6
6
|
return /*#__PURE__*/ react.createElement(DatePicker, {
|
|
7
7
|
...bind,
|
|
8
|
-
type: "
|
|
8
|
+
type: "dateTimeTz",
|
|
9
9
|
label: "Schedule On",
|
|
10
10
|
size: "lg"
|
|
11
11
|
});
|
package/presentation/scheduleDialog/components/SchedulerDialogFormComponentDateTimeInput.js.map
CHANGED
|
@@ -1 +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={\"
|
|
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={\"dateTimeTz\"} 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;QAAc,OAAO;QAAe,MAAM;;AACjF"}
|
|
@@ -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"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import validationError from "@webiny/validation/validationError.js";
|
|
2
|
-
import { scheduleDateFormatter } from "./scheduleDateFormatter.js";
|
|
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 ${scheduleDateFormatter.format(minDate)}.`);
|
|
8
|
-
};
|
|
9
|
-
minDateValidator.validatorName = "minDateValidator";
|
|
10
|
-
export { minDateValidator };
|
|
11
|
-
|
|
12
|
-
//# sourceMappingURL=minDateValidator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"presentation/scheduleDialog/minDateValidator.js","sources":["../../../src/presentation/scheduleDialog/minDateValidator.ts"],"sourcesContent":["import type { Validator } from \"@webiny/validation/types.js\";\nimport ValidationError from \"@webiny/validation/validationError.js\";\nimport { scheduleDateFormatter } from \"./scheduleDateFormatter.js\";\n\nexport 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 ${scheduleDateFormatter.format(\n minDate\n )}.`\n );\n};\n\nminDateValidator.validatorName = \"minDateValidator\";\n"],"names":["minDateValidator","input","value","Date","minDate","ValidationError","scheduleDateFormatter"],"mappings":";;AAIO,MAAMA,mBAA8B,CAACC;IACxC,MAAMC,QAAQ,IAAIC,KAAKF;IACvB,MAAMG,UAAU,IAAID,KAAK,IAAIA,OAAO,OAAO,KAAK;IAChD,IAAIC,UAAUF,OACV;IAEJ,MAAM,IAAIG,gBACN,CAAC,2EAA2E,EAAEC,sBAAsB,MAAM,CACtGF,SACF,CAAC,CAAC;AAEZ;AAEAJ,iBAAiB,aAAa,GAAG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const scheduleDateFormatter: Intl.DateTimeFormat;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const scheduleDateFormatter = new Intl.DateTimeFormat(void 0, {
|
|
2
|
-
year: "numeric",
|
|
3
|
-
month: "2-digit",
|
|
4
|
-
day: "2-digit",
|
|
5
|
-
hour: "2-digit",
|
|
6
|
-
minute: "2-digit",
|
|
7
|
-
second: void 0,
|
|
8
|
-
hour12: false
|
|
9
|
-
});
|
|
10
|
-
export { scheduleDateFormatter };
|
|
11
|
-
|
|
12
|
-
//# sourceMappingURL=scheduleDateFormatter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"presentation/scheduleDialog/scheduleDateFormatter.js","sources":["../../../src/presentation/scheduleDialog/scheduleDateFormatter.ts"],"sourcesContent":["export const scheduleDateFormatter = new Intl.DateTimeFormat(undefined, {\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: undefined,\n hour12: false\n});\n"],"names":["scheduleDateFormatter","Intl","undefined"],"mappings":"AAAO,MAAMA,wBAAwB,IAAIC,KAAK,cAAc,CAACC,QAAW;IACpE,MAAM;IACN,OAAO;IACP,KAAK;IACL,MAAM;IACN,QAAQ;IACR,QAAQA;IACR,QAAQ;AACZ"}
|