@gooddata/sdk-ui-dashboard 11.44.0-alpha.1 → 11.44.0-alpha.2
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/esm/__version.d.ts +1 -1
- package/esm/__version.js +1 -1
- package/esm/presentation/automations/connectors/ScheduledEmailConnector.d.ts +27 -0
- package/esm/presentation/automations/connectors/ScheduledEmailConnector.d.ts.map +1 -0
- package/esm/presentation/automations/connectors/ScheduledEmailConnector.js +107 -0
- package/esm/presentation/automations/connectors/hooks/useBuildAlertingDialogContext.d.ts.map +1 -1
- package/esm/presentation/automations/connectors/hooks/useBuildAlertingDialogContext.js +16 -55
- package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.d.ts.map +1 -1
- package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.js +7 -1
- package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.test.js +15 -0
- package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailDialogContext.d.ts +8 -0
- package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailDialogContext.d.ts.map +1 -0
- package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailDialogContext.js +102 -0
- package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailDialogContext.test.d.ts +2 -0
- package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailDialogContext.test.d.ts.map +1 -0
- package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailDialogContext.test.js +156 -0
- package/esm/presentation/automations/connectors/hooks/useCommandAsPromise.d.ts +26 -0
- package/esm/presentation/automations/connectors/hooks/useCommandAsPromise.d.ts.map +1 -0
- package/esm/presentation/automations/connectors/hooks/useCommandAsPromise.js +47 -0
- package/esm/presentation/automations/contexts/AutomationsContext.d.ts +2 -0
- package/esm/presentation/automations/contexts/AutomationsContext.d.ts.map +1 -1
- package/esm/presentation/automations/contexts/ScheduledEmailDialogContext.d.ts +54 -0
- package/esm/presentation/automations/contexts/ScheduledEmailDialogContext.d.ts.map +1 -0
- package/esm/presentation/automations/contexts/ScheduledEmailDialogContext.js +11 -0
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.js +11 -37
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.d.ts +6 -5
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.js +7 -23
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useFiltersForDashboardScheduledExportInfo.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useFiltersForDashboardScheduledExportInfo.js +2 -7
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useSaveScheduledEmailToBackend.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useSaveScheduledEmailToBackend.js +37 -37
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useScheduleValidation.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useScheduleValidation.js +3 -4
- package/esm/presentation/automations/scheduledEmail/types.d.ts +5 -3
- package/esm/presentation/automations/scheduledEmail/types.d.ts.map +1 -1
- package/esm/presentation/automations/shared/automationFilters/components/AutomationDateFilter.test.js +2 -0
- package/esm/presentation/dashboard/DashboardHeader/DashboardHeader.d.ts.map +1 -1
- package/esm/presentation/dashboard/DashboardHeader/DashboardHeader.js +2 -2
- package/esm/presentation/localization/bundles/de-DE.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/de-DE.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/de-DE.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/en-AU.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/en-AU.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/en-AU.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/en-GB.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/en-GB.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/en-GB.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/es-419.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/es-419.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/es-419.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/es-ES.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/es-ES.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/es-ES.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/fi-FI.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/fi-FI.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/fi-FI.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/fr-CA.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/fr-CA.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/fr-CA.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/fr-FR.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/fr-FR.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/fr-FR.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/id-ID.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/id-ID.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/id-ID.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/it-IT.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/it-IT.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/it-IT.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/ja-JP.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/ja-JP.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/ja-JP.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/ko-KR.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/ko-KR.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/ko-KR.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/nl-NL.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/nl-NL.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/nl-NL.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/pl-PL.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/pl-PL.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/pl-PL.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/pt-BR.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/pt-BR.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/pt-BR.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/pt-PT.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/pt-PT.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/pt-PT.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/ru-RU.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/ru-RU.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/ru-RU.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/sl-SI.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/sl-SI.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/sl-SI.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/th-TH.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/th-TH.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/th-TH.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/tr-TR.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/tr-TR.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/tr-TR.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/uk-UA.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/uk-UA.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/uk-UA.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/vi-VN.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/vi-VN.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/vi-VN.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/zh-HK.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/zh-HK.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/zh-HK.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/zh-Hans.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/zh-Hans.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/zh-Hans.localization-bundle.js +4 -0
- package/esm/presentation/localization/bundles/zh-Hant.localization-bundle.d.ts +4 -0
- package/esm/presentation/localization/bundles/zh-Hant.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/zh-Hant.localization-bundle.js +4 -0
- package/esm/sdk-ui-dashboard.d.ts +4 -1
- package/package.json +20 -20
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useCreateScheduledEmail.d.ts +0 -11
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useCreateScheduledEmail.d.ts.map +0 -1
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useCreateScheduledEmail.js +0 -27
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useUpdateScheduledEmail.d.ts +0 -11
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useUpdateScheduledEmail.d.ts.map +0 -1
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useUpdateScheduledEmail.js +0 -27
- package/esm/presentation/automations/scheduledEmail/hooks/useWidgetAutomationFilters.d.ts +0 -3
- package/esm/presentation/automations/scheduledEmail/hooks/useWidgetAutomationFilters.d.ts.map +0 -1
- package/esm/presentation/automations/scheduledEmail/hooks/useWidgetAutomationFilters.js +0 -5
- package/esm/presentation/dashboard/DashboardHeader/ScheduledEmailDialogProvider.d.ts +0 -2
- package/esm/presentation/dashboard/DashboardHeader/ScheduledEmailDialogProvider.d.ts.map +0 -1
- package/esm/presentation/dashboard/DashboardHeader/ScheduledEmailDialogProvider.js +0 -45
package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailDialogContext.test.js
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { act, renderHook } from "@testing-library/react";
|
|
3
|
+
import { describe, expect, it, vi } from "vitest";
|
|
4
|
+
import { idRef, } from "@gooddata/sdk-model";
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
// Hoisted mocks — must be before any import that resolves these modules
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
const runCreateMock = vi.fn();
|
|
9
|
+
const runSaveMock = vi.fn();
|
|
10
|
+
vi.mock("@gooddata/sdk-ui", () => ({
|
|
11
|
+
useBackendStrict: vi.fn(() => ({ workspace: () => ({ automations: () => ({}) }) })),
|
|
12
|
+
useWorkspaceStrict: vi.fn(() => "workspace"),
|
|
13
|
+
}));
|
|
14
|
+
vi.mock("../../../../model/react/DashboardStoreProvider.js", () => ({
|
|
15
|
+
useDashboardSelector: vi.fn((selector) => selector()),
|
|
16
|
+
}));
|
|
17
|
+
vi.mock("../../../../model/react/useDashboardCommandProcessing.js", () => ({
|
|
18
|
+
useDashboardCommandProcessing: vi.fn(({ commandCreator, successEvent, onSuccess, onError, }) => {
|
|
19
|
+
const run = successEvent === "GDC.DASH/EVT.SCHEDULED_EMAIL.CREATED" ? runCreateMock : runSaveMock;
|
|
20
|
+
// Simulate the real useDashboardCommandProcessing: invoke commandCreator when run is called
|
|
21
|
+
// so that sanitizeAutomationForSave (called inside commandCreator) fires.
|
|
22
|
+
run.mockImplementation((input) => commandCreator(input));
|
|
23
|
+
run.__onSuccess = onSuccess;
|
|
24
|
+
run.__onError = onError;
|
|
25
|
+
return { run };
|
|
26
|
+
}),
|
|
27
|
+
}));
|
|
28
|
+
vi.mock("../../../../model/commands/scheduledEmail.js", () => ({
|
|
29
|
+
createScheduledEmail: vi.fn((se) => ({ type: "CREATE", se })),
|
|
30
|
+
saveScheduledEmail: vi.fn((se) => ({ type: "SAVE", se })),
|
|
31
|
+
}));
|
|
32
|
+
vi.mock("../../../../model/store/filtering/dashboardFilterSelectors.js", () => ({
|
|
33
|
+
selectAutomationCommonDateFilterId: () => "common-date-id",
|
|
34
|
+
selectAutomationDefaultSelectedFilters: () => [{ id: "filter-1" }],
|
|
35
|
+
selectDashboardHiddenFilters: () => [],
|
|
36
|
+
}));
|
|
37
|
+
vi.mock("../../../../model/store/meta/metaSelectors.js", () => ({
|
|
38
|
+
selectDashboardId: () => "dashboard-1",
|
|
39
|
+
selectDashboardTitle: () => "My Dashboard",
|
|
40
|
+
}));
|
|
41
|
+
vi.mock("../../../../model/store/config/configSelectors.js", () => ({
|
|
42
|
+
selectDateFormat: () => "MM/dd/yyyy",
|
|
43
|
+
}));
|
|
44
|
+
vi.mock("../../../../model/store/drill/drillSelectors.js", () => ({
|
|
45
|
+
selectIsCrossFiltering: () => false,
|
|
46
|
+
}));
|
|
47
|
+
vi.mock("../../../../model/store/tabs/layout/layoutSelectors.js", () => ({
|
|
48
|
+
selectWidgetLocalIdToTabIdMap: () => ({ widgetId: "tab-1" }),
|
|
49
|
+
selectWidgetsMap: () => ({ get: () => undefined }),
|
|
50
|
+
}));
|
|
51
|
+
vi.mock("../../../../model/store/tabs/dateFilterConfig/dateFilterConfigSelectors.js", () => ({
|
|
52
|
+
selectEffectiveDateFilterMode: () => "active",
|
|
53
|
+
}));
|
|
54
|
+
vi.mock("../../../../model/store/tabs/dateFilterConfigs/dateFilterConfigsSelectors.js", () => ({
|
|
55
|
+
selectEffectiveDateFiltersModeMap: () => new Map(),
|
|
56
|
+
}));
|
|
57
|
+
vi.mock("../../../../model/store/tabs/attributeFilterConfigs/attributeFilterConfigsSelectors.js", () => ({
|
|
58
|
+
selectEffectiveAttributeFiltersModeMap: () => new Map(),
|
|
59
|
+
}));
|
|
60
|
+
vi.mock("../../../../model/store/tabs/tabsSelectors.js", () => ({
|
|
61
|
+
selectTabs: () => [],
|
|
62
|
+
}));
|
|
63
|
+
vi.mock("../../../../model/store/tabs/parameters/parametersSelectors.js", () => ({
|
|
64
|
+
selectExportEffectiveParameters: () => () => ({}),
|
|
65
|
+
}));
|
|
66
|
+
vi.mock("../../../../model/react/useExportTemplates.js", () => ({
|
|
67
|
+
useExportTemplates: () => [],
|
|
68
|
+
}));
|
|
69
|
+
vi.mock("../../../../model/utils/dashboardItemUtils.js", () => ({
|
|
70
|
+
getWidgetTitle: () => "widget title",
|
|
71
|
+
}));
|
|
72
|
+
vi.mock("./sanitizeAutomationForSave.js", () => ({
|
|
73
|
+
sanitizeAutomationForSave: vi.fn((automation) => ({
|
|
74
|
+
...automation,
|
|
75
|
+
__sanitized: true,
|
|
76
|
+
})),
|
|
77
|
+
}));
|
|
78
|
+
import { createScheduledEmail as createScheduledEmailCmd, saveScheduledEmail as saveScheduledEmailCmd, } from "../../../../model/commands/scheduledEmail.js";
|
|
79
|
+
import { sanitizeAutomationForSave } from "./sanitizeAutomationForSave.js";
|
|
80
|
+
import { useBuildScheduledEmailDialogContext } from "./useBuildScheduledEmailDialogContext.js";
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
// Tests
|
|
83
|
+
// ---------------------------------------------------------------------------
|
|
84
|
+
describe("useBuildScheduledEmailDialogContext", () => {
|
|
85
|
+
it("exposes dashboardId, dashboardTitle, and dashboardFilters from the store selectors", () => {
|
|
86
|
+
const { result } = renderHook(() => useBuildScheduledEmailDialogContext({}));
|
|
87
|
+
expect(result.current.dashboardId).toBe("dashboard-1");
|
|
88
|
+
expect(result.current.dashboardTitle).toBe("My Dashboard");
|
|
89
|
+
expect(result.current.dashboardFilters).toEqual([{ id: "filter-1" }]);
|
|
90
|
+
});
|
|
91
|
+
it("createScheduledEmail applies sanitizeAutomationForSave before dispatching the command", async () => {
|
|
92
|
+
const { result } = renderHook(() => useBuildScheduledEmailDialogContext({}));
|
|
93
|
+
const draft = {
|
|
94
|
+
type: "automation",
|
|
95
|
+
title: "New Schedule",
|
|
96
|
+
};
|
|
97
|
+
// Kick off the create (do not await yet)
|
|
98
|
+
let promise;
|
|
99
|
+
act(() => {
|
|
100
|
+
promise = result.current.createScheduledEmail(draft);
|
|
101
|
+
});
|
|
102
|
+
// sanitizeAutomationForSave must have been called with the raw draft
|
|
103
|
+
expect(sanitizeAutomationForSave).toHaveBeenCalledWith(draft);
|
|
104
|
+
// The command creator must have received the sanitized draft (sanitize runs inside commandCreator)
|
|
105
|
+
expect(createScheduledEmailCmd).toHaveBeenCalledWith(expect.objectContaining({ __sanitized: true }));
|
|
106
|
+
// Simulate the CREATED event resolving
|
|
107
|
+
const createdSE = {
|
|
108
|
+
type: "automation",
|
|
109
|
+
id: "se-1",
|
|
110
|
+
title: "New Schedule",
|
|
111
|
+
ref: idRef("se-1"),
|
|
112
|
+
};
|
|
113
|
+
act(() => {
|
|
114
|
+
runCreateMock.__onSuccess({
|
|
115
|
+
payload: { scheduledEmail: createdSE },
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
await expect(promise).resolves.toEqual(createdSE);
|
|
119
|
+
});
|
|
120
|
+
it("saveScheduledEmail applies sanitizeAutomationForSave before dispatching the command", async () => {
|
|
121
|
+
const { result } = renderHook(() => useBuildScheduledEmailDialogContext({}));
|
|
122
|
+
const existing = {
|
|
123
|
+
type: "automation",
|
|
124
|
+
id: "se-2",
|
|
125
|
+
title: "Existing Schedule",
|
|
126
|
+
ref: idRef("se-2"),
|
|
127
|
+
};
|
|
128
|
+
let promise;
|
|
129
|
+
act(() => {
|
|
130
|
+
promise = result.current.saveScheduledEmail(existing);
|
|
131
|
+
});
|
|
132
|
+
expect(sanitizeAutomationForSave).toHaveBeenCalledWith(existing);
|
|
133
|
+
expect(saveScheduledEmailCmd).toHaveBeenCalledWith(expect.objectContaining({ __sanitized: true }));
|
|
134
|
+
// Simulate SAVED event — no payload on the SE saved event, so resolve with input
|
|
135
|
+
act(() => {
|
|
136
|
+
runSaveMock.__onSuccess({});
|
|
137
|
+
});
|
|
138
|
+
await expect(promise).resolves.toEqual(existing);
|
|
139
|
+
});
|
|
140
|
+
it("createScheduledEmail rejects with error when the command fails", async () => {
|
|
141
|
+
const { result } = renderHook(() => useBuildScheduledEmailDialogContext({}));
|
|
142
|
+
const draft = {
|
|
143
|
+
type: "automation",
|
|
144
|
+
title: "Fail Schedule",
|
|
145
|
+
};
|
|
146
|
+
let promise;
|
|
147
|
+
act(() => {
|
|
148
|
+
promise = result.current.createScheduledEmail(draft);
|
|
149
|
+
});
|
|
150
|
+
const err = new Error("Backend failure");
|
|
151
|
+
act(() => {
|
|
152
|
+
runCreateMock.__onError({ payload: { error: err } });
|
|
153
|
+
});
|
|
154
|
+
await expect(promise).rejects.toThrow("Backend failure");
|
|
155
|
+
});
|
|
156
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { IAutomationMetadataObject, IAutomationMetadataObjectDefinition } from "@gooddata/sdk-model";
|
|
2
|
+
import type { DashboardCommands } from "../../../../model/commands/index.js";
|
|
3
|
+
import type { DashboardEventType } from "../../../../model/events/base.js";
|
|
4
|
+
import type { DashboardEvents } from "../../../../model/events/index.js";
|
|
5
|
+
type AutomationInput = IAutomationMetadataObjectDefinition | IAutomationMetadataObject;
|
|
6
|
+
/**
|
|
7
|
+
* Wraps a Redux dashboard command in a promise-based API using a single-slot pending ref.
|
|
8
|
+
* Sanitizes the input via sanitizeAutomationForSave before dispatching the command.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function useCommandAsPromise<TIn extends AutomationInput, TSuccessEventType extends DashboardEventType, TOut>({ commandCreator, successEvent, resolveWith }: {
|
|
13
|
+
commandCreator: (input: TIn) => DashboardCommands;
|
|
14
|
+
successEvent: TSuccessEventType;
|
|
15
|
+
resolveWith: (event: Extract<DashboardEvents, {
|
|
16
|
+
type: TSuccessEventType;
|
|
17
|
+
}>, input: TIn) => TOut;
|
|
18
|
+
}): (input: TIn) => Promise<TOut>;
|
|
19
|
+
/**
|
|
20
|
+
* Returns a stable callback that deletes an automation via the backend directly (no Redux command).
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export declare function useDeleteAutomation(): (automation: IAutomationMetadataObject) => Promise<void>;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=useCommandAsPromise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCommandAsPromise.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/connectors/hooks/useCommandAsPromise.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,yBAAyB,EAAE,mCAAmC,EAAE,MAAM,qBAAqB,CAAC;AAG1G,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAKzE,KAAK,eAAe,GAAG,mCAAmC,GAAG,yBAAyB,CAAC;AAEvF;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAC/B,GAAG,SAAS,eAAe,EAC3B,iBAAiB,SAAS,kBAAkB,EAC5C,IAAI,EACN,EACE,cAAc,EACd,YAAY,EACZ,WAAW,EACd,EAAE;IACC,cAAc,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,iBAAiB,CAAC;IAClD,YAAY,EAAE,iBAAiB,CAAC;IAChC,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,eAAe,EAAE;QAAE,IAAI,EAAE,iBAAiB,CAAA;KAAE,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;CACnG,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAgChC;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,CAAC,UAAU,EAAE,yBAAyB,KAAK,OAAO,CAAC,IAAI,CAAC,CAW9F"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { useCallback, useRef } from "react";
|
|
3
|
+
import { useBackendStrict, useWorkspaceStrict } from "@gooddata/sdk-ui";
|
|
4
|
+
import { useDashboardCommandProcessing } from "../../../../model/react/useDashboardCommandProcessing.js";
|
|
5
|
+
import { sanitizeAutomationForSave } from "./sanitizeAutomationForSave.js";
|
|
6
|
+
/**
|
|
7
|
+
* Wraps a Redux dashboard command in a promise-based API using a single-slot pending ref.
|
|
8
|
+
* Sanitizes the input via sanitizeAutomationForSave before dispatching the command.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export function useCommandAsPromise({ commandCreator, successEvent, resolveWith, }) {
|
|
13
|
+
const pendingRef = useRef(null);
|
|
14
|
+
const { run } = useDashboardCommandProcessing({
|
|
15
|
+
commandCreator: (input) => commandCreator(sanitizeAutomationForSave(input)),
|
|
16
|
+
successEvent,
|
|
17
|
+
errorEvent: "GDC.DASH/EVT.COMMAND.FAILED",
|
|
18
|
+
onSuccess: (event) => {
|
|
19
|
+
if (pendingRef.current) {
|
|
20
|
+
pendingRef.current.resolve(resolveWith(event, pendingRef.current.input));
|
|
21
|
+
pendingRef.current = null;
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
onError: (event) => {
|
|
25
|
+
const error = event.payload.error ?? new Error(event.payload.message);
|
|
26
|
+
pendingRef.current?.reject(error);
|
|
27
|
+
pendingRef.current = null;
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
return useCallback((input) => new Promise((resolve, reject) => {
|
|
31
|
+
pendingRef.current = { input, resolve, reject };
|
|
32
|
+
run(input);
|
|
33
|
+
}), [run]);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Returns a stable callback that deletes an automation via the backend directly (no Redux command).
|
|
37
|
+
*
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
export function useDeleteAutomation() {
|
|
41
|
+
const backend = useBackendStrict();
|
|
42
|
+
const workspace = useWorkspaceStrict();
|
|
43
|
+
return useCallback(async (automation) => {
|
|
44
|
+
const automationService = backend.workspace(workspace).automations();
|
|
45
|
+
await automationService.deleteAutomation(automation.id);
|
|
46
|
+
}, [backend, workspace]);
|
|
47
|
+
}
|
|
@@ -61,6 +61,8 @@ export interface IAutomationsContextValue {
|
|
|
61
61
|
enableExternalRecipients: boolean;
|
|
62
62
|
enableAlertAttributes: boolean;
|
|
63
63
|
canManageWorkspace: boolean;
|
|
64
|
+
enableCustomizableCsvDelimiter: boolean;
|
|
65
|
+
enableAutomationEvaluationMode: boolean;
|
|
64
66
|
};
|
|
65
67
|
getCatalogAttributeByRef: (ref: ObjRef) => ICatalogAttribute | ICatalogDateAttribute | undefined;
|
|
66
68
|
getAttributeFilterDisplayForm: (displayForm: ObjRef) => IAttributeDisplayFormMetadataObject | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutomationsContext.d.ts","sourceRoot":"","sources":["../../../../src/presentation/automations/contexts/AutomationsContext.ts"],"names":[],"mappings":"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
|
|
1
|
+
{"version":3,"file":"AutomationsContext.d.ts","sourceRoot":"","sources":["../../../../src/presentation/automations/contexts/AutomationsContext.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { DashboardAttributeFilterConfigMode, DashboardDateFilterConfigMode, FilterContextItem, IAutomationMetadataObject, IAutomationMetadataObjectDefinition, IDashboardExportParameter, IExportTemplate, IInsight, IWidget, ObjRef } from "@gooddata/sdk-model";
|
|
2
|
+
/**
|
|
3
|
+
* Sub-context for the scheduled-email create/edit dialog.
|
|
4
|
+
* Shape grows during Phase 2 migration as DefaultScheduledEmailDialog and its hooks are migrated.
|
|
5
|
+
* The connector hydrates this from dashboard state and provides the CRUD callbacks.
|
|
6
|
+
*/
|
|
7
|
+
export interface IScheduledEmailDialogContextValue {
|
|
8
|
+
widget?: IWidget;
|
|
9
|
+
insight?: IInsight;
|
|
10
|
+
widgetTitle?: string;
|
|
11
|
+
dashboardId?: string;
|
|
12
|
+
dashboardTitle: string;
|
|
13
|
+
dashboardFilters?: FilterContextItem[];
|
|
14
|
+
/**
|
|
15
|
+
* Raw dashboard hidden filters (selectDashboardHiddenFilters). Combined with edited filters via
|
|
16
|
+
* getAppliedDashboardFilters/getAppliedWidgetFilters inside the dialog, mirroring the alerting context.
|
|
17
|
+
*/
|
|
18
|
+
hiddenFilters: FilterContextItem[];
|
|
19
|
+
widgetLocalIdToTabIdMap: Record<string, string>;
|
|
20
|
+
commonDateFilterId?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Effective export parameter overrides keyed by tab, scoped to the dialog's widget when present.
|
|
23
|
+
* Replaces the direct selectExportEffectiveParameters read in useEditScheduledEmail.
|
|
24
|
+
*/
|
|
25
|
+
exportParametersByTab: Record<string, IDashboardExportParameter[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Organization-level export templates fetched in the connector (replaces the useExportTemplates
|
|
28
|
+
* react hook read in the dialog).
|
|
29
|
+
*/
|
|
30
|
+
exportTemplates: IExportTemplate[];
|
|
31
|
+
/** Workspace date format (e.g. "MM/dd/yyyy"); from selectDateFormat. */
|
|
32
|
+
dateFormat: string | undefined;
|
|
33
|
+
/** Whether cross-filtering is active on the dashboard; from selectIsCrossFiltering. */
|
|
34
|
+
isCrossFiltering: boolean;
|
|
35
|
+
/** Whether the dashboard has more than one tab; derived from selectTabs. */
|
|
36
|
+
hasMultipleTabs: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Returns true when a widget with the given ref still exists on the dashboard layout.
|
|
39
|
+
* Bridges identifier↔URI mismatches the same way as selectWidgetByRef.
|
|
40
|
+
*/
|
|
41
|
+
widgetExistsByRef: (ref: ObjRef | undefined) => boolean;
|
|
42
|
+
/** Effective mode for the common (dashboard-level) date filter. */
|
|
43
|
+
commonDateFilterMode: DashboardDateFilterConfigMode;
|
|
44
|
+
/** Effective mode map for per-dataset date filters (localIdentifier → mode). */
|
|
45
|
+
dateFiltersModeMap: Map<string, DashboardDateFilterConfigMode>;
|
|
46
|
+
/** Effective mode map for attribute filters (localIdentifier → mode). */
|
|
47
|
+
attributeFiltersModeMap: Map<string, DashboardAttributeFilterConfigMode>;
|
|
48
|
+
createScheduledEmail(se: IAutomationMetadataObjectDefinition): Promise<IAutomationMetadataObject>;
|
|
49
|
+
saveScheduledEmail(se: IAutomationMetadataObject): Promise<IAutomationMetadataObject>;
|
|
50
|
+
deleteScheduledEmail(se: IAutomationMetadataObject): Promise<void>;
|
|
51
|
+
}
|
|
52
|
+
export declare const ScheduledEmailDialogContextProvider: import("react").Provider<IScheduledEmailDialogContextValue | undefined>;
|
|
53
|
+
export declare function useScheduledEmailDialogContext(): IScheduledEmailDialogContextValue;
|
|
54
|
+
//# sourceMappingURL=ScheduledEmailDialogContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScheduledEmailDialogContext.d.ts","sourceRoot":"","sources":["../../../../src/presentation/automations/contexts/ScheduledEmailDialogContext.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACR,kCAAkC,EAClC,6BAA6B,EAC7B,iBAAiB,EACjB,yBAAyB,EACzB,mCAAmC,EACnC,yBAAyB,EACzB,eAAe,EACf,QAAQ,EACR,OAAO,EACP,MAAM,EACT,MAAM,qBAAqB,CAAC;AAE7B;;;;GAIG;AACH,MAAM,WAAW,iCAAiC;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACvC;;;OAGG;IACH,aAAa,EAAE,iBAAiB,EAAE,CAAC;IACnC,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,EAAE,CAAC,CAAC;IACnE;;;OAGG;IACH,eAAe,EAAE,eAAe,EAAE,CAAC;IACnC,wEAAwE;IACxE,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,uFAAuF;IACvF,gBAAgB,EAAE,OAAO,CAAC;IAC1B,4EAA4E;IAC5E,eAAe,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,iBAAiB,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,KAAK,OAAO,CAAC;IACxD,mEAAmE;IACnE,oBAAoB,EAAE,6BAA6B,CAAC;IACpD,kFAAgF;IAChF,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;IAC/D,2EAAyE;IACzE,uBAAuB,EAAE,GAAG,CAAC,MAAM,EAAE,kCAAkC,CAAC,CAAC;IAEzE,oBAAoB,CAAC,EAAE,EAAE,mCAAmC,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAClG,kBAAkB,CAAC,EAAE,EAAE,yBAAyB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACtF,oBAAoB,CAAC,EAAE,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtE;AAID,eAAO,MAAM,mCAAmC,yEAAuC,CAAC;AAExF,wBAAgB,8BAA8B,IAAI,iCAAiC,CAQlF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
const ScheduledEmailDialogContext = createContext(undefined);
|
|
4
|
+
export const ScheduledEmailDialogContextProvider = ScheduledEmailDialogContext.Provider;
|
|
5
|
+
export function useScheduledEmailDialogContext() {
|
|
6
|
+
const ctx = useContext(ScheduledEmailDialogContext);
|
|
7
|
+
if (!ctx) {
|
|
8
|
+
throw new Error("useScheduledEmailDialogContext must be used within ScheduledEmailDialogContextProvider");
|
|
9
|
+
}
|
|
10
|
+
return ctx;
|
|
11
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultScheduledEmailDialog.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DefaultScheduledEmailDialog.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.tsx"],"names":[],"mappings":"AA4CA,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,aAAa,CAAC;AA8D9D,wBAAgB,2BAA2B,CAAC,EACxC,qBAAqB,EACrB,KAAK,EACL,UAAU,EACV,oBAAoB,EACpB,OAAO,EACP,MAAM,EACN,gBAAgB,EAChB,aAAa,EACb,MAAM,EACN,QAAQ,EACR,eAAe,EACf,aAAa,EACb,OAAO,EACP,MAAM,EACN,WAAW,EACX,aAAa,EACb,QAAQ,EACR,SAAS,EACZ,EAAE,0BAA0B,2CA2kB5B;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,0BAA0B,2CAW5E"}
|
|
@@ -5,20 +5,10 @@ import cx from "classnames";
|
|
|
5
5
|
import { defineMessage, useIntl } from "react-intl";
|
|
6
6
|
import { ValidationContextStore, createInvalidNode, useValidationContextValue } from "@gooddata/sdk-ui";
|
|
7
7
|
import { Button, ConfirmDialogBase, ContentDivider, Hyperlink, Message, Overlay, OverlayController, OverlayControllerProvider, RecurrenceForm, ScrollablePanel, UiIcon, UiTabs, isEnterKey, useIdPrefixed, } from "@gooddata/sdk-ui-kit";
|
|
8
|
-
import { useDashboardSelector } from "../../../../model/react/DashboardStoreProvider.js";
|
|
9
|
-
import { useExportTemplates } from "../../../../model/react/useExportTemplates.js";
|
|
10
|
-
import { selectDateFormat, selectEnableAutomationManagement, selectEnableCustomizableCsvDelimiter, selectEnableNewScheduledExport, selectExternalRecipient, selectIsWhiteLabeled, selectLocale, selectSettings, selectWeekStart, } from "../../../../model/store/config/configSelectors.js";
|
|
11
|
-
import { selectIsCrossFiltering } from "../../../../model/store/drill/drillSelectors.js";
|
|
12
|
-
import { selectEntitlementMinimumRecurrenceMinutes, selectMaxAutomationRecipients, } from "../../../../model/store/entitlements/entitlementsSelectors.js";
|
|
13
|
-
import { selectDashboardTitle } from "../../../../model/store/meta/metaSelectors.js";
|
|
14
|
-
import { selectTabs } from "../../../../model/store/tabs/tabsSelectors.js";
|
|
15
|
-
import { selectIsAutomationDialogSecondaryTitleVisible } from "../../../../model/store/topBar/topBarSelectors.js";
|
|
16
|
-
import { selectExecutionTimestamp } from "../../../../model/store/ui/uiSelectors.js";
|
|
17
|
-
import { getWidgetTitle } from "../../../../model/utils/dashboardItemUtils.js";
|
|
18
8
|
import { DASHBOARD_DIALOG_OVERS_Z_INDEX } from "../../../constants/zIndex.js";
|
|
19
9
|
import { IntlWrapper } from "../../../localization/IntlWrapper.js";
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
10
|
+
import { useAutomationsContext } from "../../contexts/AutomationsContext.js";
|
|
11
|
+
import { useScheduledEmailDialogContext } from "../../contexts/ScheduledEmailDialogContext.js";
|
|
22
12
|
import { ApplyCurrentFiltersConfirmDialog } from "../../shared/automationFilters/components/ApplyLatestFiltersConfirmDialog.js";
|
|
23
13
|
import { AutomationFiltersSelect } from "../../shared/automationFilters/components/AutomationFiltersSelect.js";
|
|
24
14
|
import { useValidateExistingAutomationFilters } from "../../shared/automationFilters/hooks/useValidateExistingAutomationFilters.js";
|
|
@@ -42,7 +32,6 @@ import { SCHEDULED_EMAIL_DIALOG_ID } from "./constants.js";
|
|
|
42
32
|
import { DefaultLoadingScheduledEmailDialog } from "./DefaultLoadingScheduledEmailDialog.js";
|
|
43
33
|
import { useEditScheduledEmail } from "./hooks/useEditScheduledEmail.js";
|
|
44
34
|
import { useSaveScheduledEmailToBackend } from "./hooks/useSaveScheduledEmailToBackend.js";
|
|
45
|
-
const DEFAULT_MIN_RECURRENCE_MINUTES = "60";
|
|
46
35
|
const OVERLAY_POSITION_TYPE = "sameAsTarget";
|
|
47
36
|
const CLOSE_ON_PARENT_SCROLL = true;
|
|
48
37
|
const overlayController = OverlayController.getInstance(DASHBOARD_DIALOG_OVERS_Z_INDEX);
|
|
@@ -58,13 +47,8 @@ export function ScheduledMailDialogRenderer({ scheduledExportToEdit, users, user
|
|
|
58
47
|
const [scheduledEmailToDelete, setScheduledEmailToDelete] = useState(null);
|
|
59
48
|
const [selectedTabId, setSelectedTabId] = useState("general");
|
|
60
49
|
const [tabContentHeight, setTabContentHeight] = useState(undefined);
|
|
61
|
-
const isWhiteLabeled =
|
|
62
|
-
const
|
|
63
|
-
const isSecondaryTitleVisible = useDashboardSelector(selectIsAutomationDialogSecondaryTitleVisible);
|
|
64
|
-
const enableAutomationManagement = useDashboardSelector(selectEnableAutomationManagement);
|
|
65
|
-
const dashboardTabs = useDashboardSelector(selectTabs);
|
|
66
|
-
const hasMultipleTabs = (dashboardTabs?.length ?? 0) > 1;
|
|
67
|
-
const exportTemplates = useExportTemplates();
|
|
50
|
+
const { isWhiteLabeled, externalRecipient: externalRecipientOverride, isSecondaryTitleVisible, features: { enableAutomationManagement }, } = useAutomationsContext();
|
|
51
|
+
const { exportTemplates, widgetTitle, hasMultipleTabs } = useScheduledEmailDialogContext();
|
|
68
52
|
const handleScheduleDeleteSuccess = () => {
|
|
69
53
|
onDeleteSuccess?.();
|
|
70
54
|
setScheduledEmailToDelete(null);
|
|
@@ -80,6 +64,7 @@ export function ScheduledMailDialogRenderer({ scheduledExportToEdit, users, user
|
|
|
80
64
|
notificationChannels,
|
|
81
65
|
insight,
|
|
82
66
|
widget,
|
|
67
|
+
users,
|
|
83
68
|
scheduledExportToEdit,
|
|
84
69
|
storeFilters,
|
|
85
70
|
editedAutomationFilters,
|
|
@@ -142,7 +127,7 @@ export function ScheduledMailDialogRenderer({ scheduledExportToEdit, users, user
|
|
|
142
127
|
const { secondaryTitle, secondaryTitleIcon } = useMemo(() => {
|
|
143
128
|
if (widget) {
|
|
144
129
|
return {
|
|
145
|
-
secondaryTitle:
|
|
130
|
+
secondaryTitle: widgetTitle,
|
|
146
131
|
secondaryTitleIcon: (_jsx(UiIcon, { type: "visualization", size: 16, color: "complementary-6", accessibilityConfig: {
|
|
147
132
|
ariaLabel: intl.formatMessage({
|
|
148
133
|
id: "dialogs.automation.icon.ariaLabel.sourceVisualization",
|
|
@@ -158,7 +143,7 @@ export function ScheduledMailDialogRenderer({ scheduledExportToEdit, users, user
|
|
|
158
143
|
}),
|
|
159
144
|
} })),
|
|
160
145
|
};
|
|
161
|
-
}, [widget, dashboardTitle, intl]);
|
|
146
|
+
}, [widget, widgetTitle, dashboardTitle, intl]);
|
|
162
147
|
const tabs = useMemo(() => [
|
|
163
148
|
{
|
|
164
149
|
id: "general",
|
|
@@ -251,24 +236,13 @@ export function DefaultScheduledEmailDialog(props) {
|
|
|
251
236
|
return _jsx(DefaultScheduledEmailDialogBody, { ...props });
|
|
252
237
|
}
|
|
253
238
|
function DefaultScheduledEmailDialogBody(props) {
|
|
254
|
-
const locale =
|
|
255
|
-
|
|
256
|
-
return (_jsx(AutomationsContextProvider, { value: automationsContext, children: _jsx(IntlWrapper, { locale: locale, children: _jsx(ScheduledMailDialogRenderer, { ...props }) }) }));
|
|
239
|
+
const { locale } = useAutomationsContext();
|
|
240
|
+
return (_jsx(IntlWrapper, { locale: locale, children: _jsx(ScheduledMailDialogRenderer, { ...props }) }));
|
|
257
241
|
}
|
|
258
242
|
function useDefaultScheduledEmailDialogData() {
|
|
259
|
-
const locale =
|
|
260
|
-
const dashboardTitle =
|
|
261
|
-
const dateFormat = useDashboardSelector(selectDateFormat);
|
|
262
|
-
const settings = useDashboardSelector(selectSettings);
|
|
243
|
+
const { locale, settings, weekStart, maxAutomationsRecipients, allowHourlyRecurrence, isExecutionTimestampMode, enableNewScheduledExport, features: { enableCustomizableCsvDelimiter }, } = useAutomationsContext();
|
|
244
|
+
const { dashboardTitle, dateFormat, isCrossFiltering } = useScheduledEmailDialogContext();
|
|
263
245
|
const formatLocale = settings?.formatLocale;
|
|
264
|
-
const weekStart = useDashboardSelector(selectWeekStart);
|
|
265
|
-
const maxAutomationsRecipients = useDashboardSelector(selectMaxAutomationRecipients);
|
|
266
|
-
const minimumRecurrenceMinutesEntitlement = useDashboardSelector(selectEntitlementMinimumRecurrenceMinutes);
|
|
267
|
-
const allowHourlyRecurrence = parseInt(minimumRecurrenceMinutesEntitlement?.value ?? DEFAULT_MIN_RECURRENCE_MINUTES, 10) === 60;
|
|
268
|
-
const isCrossFiltering = useDashboardSelector(selectIsCrossFiltering);
|
|
269
|
-
const isExecutionTimestampMode = !!useDashboardSelector(selectExecutionTimestamp);
|
|
270
|
-
const enableNewScheduledExport = useDashboardSelector(selectEnableNewScheduledExport);
|
|
271
|
-
const enableCustomizableCsvDelimiter = useDashboardSelector(selectEnableCustomizableCsvDelimiter);
|
|
272
246
|
const defaultPdfPageSize = getDefaultPdfPageSize(formatLocale);
|
|
273
247
|
return {
|
|
274
248
|
locale,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { type DashboardAttachmentType, type FilterContextItem, type IAutomationMetadataObject, type IAutomationMetadataObjectDefinition, type IAutomationRecipient, type IAutomationVisibleFilter, type IDashboardExportParameter, type IExportDefinitionVisualizationObjectSettings, type IFilter, type IInsight, type INotificationChannelIdentifier, type INotificationChannelMetadataObject, type WidgetAttachmentType } from "@gooddata/sdk-model";
|
|
1
|
+
import { type DashboardAttachmentType, type FilterContextItem, type IAutomationMetadataObject, type IAutomationMetadataObjectDefinition, type IAutomationRecipient, type IAutomationVisibleFilter, type IDashboardExportParameter, type IExportDefinitionVisualizationObjectSettings, type IFilter, type IInsight, type INotificationChannelIdentifier, type INotificationChannelMetadataObject, type IWidget, type IWorkspaceUser, type WidgetAttachmentType } from "@gooddata/sdk-model";
|
|
2
2
|
import type { IAutomationFiltersTab } from "../../../../../model/store/filtering/types.js";
|
|
3
|
-
import { type ExtendedDashboardWidget } from "../../../../../model/types/layoutTypes.js";
|
|
4
3
|
export interface IUseEditScheduledEmailProps {
|
|
5
4
|
scheduledExportToEdit?: IAutomationMetadataObject;
|
|
6
5
|
notificationChannels: INotificationChannelIdentifier[] | INotificationChannelMetadataObject[];
|
|
7
6
|
maxAutomationsRecipients: number;
|
|
8
|
-
|
|
7
|
+
/** Workspace users, lazy-loaded in the connector and passed via dialog props. */
|
|
8
|
+
users: IWorkspaceUser[];
|
|
9
|
+
widget?: IWidget;
|
|
9
10
|
insight?: IInsight;
|
|
10
11
|
widgetFilters?: IFilter[];
|
|
11
12
|
editedAutomationFilters?: FilterContextItem[];
|
|
@@ -31,8 +32,8 @@ export interface IUseEditScheduledEmailProps {
|
|
|
31
32
|
enableNewScheduledExport: boolean;
|
|
32
33
|
defaultPdfPageSize?: IExportDefinitionVisualizationObjectSettings["pageSize"];
|
|
33
34
|
}
|
|
34
|
-
export declare function useEditScheduledEmail({ scheduledExportToEdit, notificationChannels, insight, widget, editedAutomationFilters, dashboardFilters, editedAutomationFiltersByTab, maxAutomationsRecipients, setEditedAutomationFilters, setEditedAutomationFiltersByTab, availableFiltersAsVisibleFilters, storeFilters, setStoreFilters, filtersForNewAutomation, externalRecipientOverride, enableNewScheduledExport, defaultPdfPageSize, filtersDataByTab, availableFiltersAsVisibleFiltersByTab }: IUseEditScheduledEmailProps): {
|
|
35
|
-
defaultUser:
|
|
35
|
+
export declare function useEditScheduledEmail({ scheduledExportToEdit, notificationChannels, insight, widget, users, editedAutomationFilters, dashboardFilters, editedAutomationFiltersByTab, maxAutomationsRecipients, setEditedAutomationFilters, setEditedAutomationFiltersByTab, availableFiltersAsVisibleFilters, storeFilters, setStoreFilters, filtersForNewAutomation, externalRecipientOverride, enableNewScheduledExport, defaultPdfPageSize, filtersDataByTab, availableFiltersAsVisibleFiltersByTab }: IUseEditScheduledEmailProps): {
|
|
36
|
+
defaultUser: IWorkspaceUser;
|
|
36
37
|
areDashboardFiltersChanged: boolean;
|
|
37
38
|
originalAutomation: IAutomationMetadataObjectDefinition;
|
|
38
39
|
editedAutomation: IAutomationMetadataObjectDefinition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditScheduledEmail.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.ts"],"names":[],"mappings":"AAOA,OAAO,EAGH,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAE9B,KAAK,mCAAmC,EACxC,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAE9B,KAAK,4CAA4C,EACjD,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EACvC,KAAK,oBAAoB,
|
|
1
|
+
{"version":3,"file":"useEditScheduledEmail.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.ts"],"names":[],"mappings":"AAOA,OAAO,EAGH,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAE9B,KAAK,mCAAmC,EACxC,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAE9B,KAAK,4CAA4C,EACjD,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EACvC,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAQ5B,MAAM,qBAAqB,CAAC;AAM7B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AA2B3F,MAAM,WAAW,2BAA2B;IACxC,qBAAqB,CAAC,EAAE,yBAAyB,CAAC;IAClD,oBAAoB,EAAE,8BAA8B,EAAE,GAAG,kCAAkC,EAAE,CAAC;IAC9F,wBAAwB,EAAE,MAAM,CAAC;IACjC,iFAAiF;IACjF,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC;IAC1B,uBAAuB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC9C,gBAAgB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACvC,0BAA0B,EAAE,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,IAAI,CAAC;IAEnE;;;OAGG;IACH,4BAA4B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;IACnE;;;OAGG;IACH,+BAA+B,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,KAAK,IAAI,CAAC;IACzF,gBAAgB,CAAC,EAAE,qBAAqB,EAAE,GAAG,SAAS,CAAC;IACvD,gCAAgC,CAAC,EAAE,wBAAwB,EAAE,GAAG,SAAS,CAAC;IAC1E,qCAAqC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,EAAE,CAAC,CAAC;IAEnF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,CAAC,YAAY,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,uBAAuB,EAAE,iBAAiB,EAAE,CAAC;IAC7C,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,wBAAwB,EAAE,OAAO,CAAC;IAClC,kBAAkB,CAAC,EAAE,4CAA4C,CAAC,UAAU,CAAC,CAAC;CACjF;AAED,wBAAgB,qBAAqB,CAAC,EAClC,qBAAqB,EACrB,oBAAoB,EACpB,OAAO,EACP,MAAM,EACN,KAAK,EACL,uBAAuB,EACvB,gBAAgB,EAChB,4BAA4B,EAC5B,wBAAwB,EACxB,0BAA0B,EAC1B,+BAA+B,EAC/B,gCAAgC,EAChC,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,EAChB,qCAAqC,EACxC,EAAE,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA42B7B"}
|
|
@@ -2,16 +2,10 @@
|
|
|
2
2
|
import { useCallback, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
4
|
import { invariant } from "ts-invariant";
|
|
5
|
-
import { DEFAULT_CSV_DELIMITER, insightProperties, isAutomationExternalUserRecipient, isAutomationUnknownUserRecipient, isAutomationUserRecipient, isExportDefinitionDashboardRequestPayload, isExportDefinitionVisualizationObjectRequestPayload, isInsightWidget,
|
|
5
|
+
import { DEFAULT_CSV_DELIMITER, insightProperties, isAutomationExternalUserRecipient, isAutomationUnknownUserRecipient, isAutomationUserRecipient, isExportDefinitionDashboardRequestPayload, isExportDefinitionVisualizationObjectRequestPayload, isInsightWidget, } from "@gooddata/sdk-model";
|
|
6
6
|
import { getAutomationExportParametersByTab, setExportParametersByTab, } from "../../../../../_staging/automation/index.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { selectAutomationCommonDateFilterId, selectDashboardHiddenFilters, } from "../../../../../model/store/filtering/dashboardFilterSelectors.js";
|
|
10
|
-
import { selectDashboardId, selectDashboardTitle } from "../../../../../model/store/meta/metaSelectors.js";
|
|
11
|
-
import { selectWidgetLocalIdToTabIdMap } from "../../../../../model/store/tabs/layout/layoutSelectors.js";
|
|
12
|
-
import { selectExportEffectiveParameters } from "../../../../../model/store/tabs/parameters/parametersSelectors.js";
|
|
13
|
-
import { selectCurrentUser } from "../../../../../model/store/user/userSelectors.js";
|
|
14
|
-
import { selectUsers } from "../../../../../model/store/users/usersSelectors.js";
|
|
7
|
+
import { useAutomationsContext } from "../../../contexts/AutomationsContext.js";
|
|
8
|
+
import { useScheduledEmailDialogContext } from "../../../contexts/ScheduledEmailDialogContext.js";
|
|
15
9
|
import { shouldStoreExportParameters } from "../../../shared/automationFilters/automationParameters.js";
|
|
16
10
|
import { getDefaultSelectedFiltersFromFiltersByTab } from "../../../shared/automationFilters/useAutomationFiltersSelect.js";
|
|
17
11
|
import { getAppliedDashboardFilters, getAppliedWidgetFilters, getVisibleFiltersByFilters, getVisibleFiltersByFiltersByTab, } from "../../../shared/automationFilters/utils.js";
|
|
@@ -20,32 +14,23 @@ import { toModifiedISOStringToTimezone, toNormalizedFirstRunAndCron, toNormalize
|
|
|
20
14
|
import { getUserTimezone } from "../../utils/timezone.js";
|
|
21
15
|
import { isEmail } from "../../utils/validate.js";
|
|
22
16
|
import { useScheduleValidation } from "./useScheduleValidation.js";
|
|
23
|
-
export function useEditScheduledEmail({ scheduledExportToEdit, notificationChannels, insight, widget, editedAutomationFilters, dashboardFilters, editedAutomationFiltersByTab, maxAutomationsRecipients, setEditedAutomationFilters, setEditedAutomationFiltersByTab, availableFiltersAsVisibleFilters, storeFilters, setStoreFilters, filtersForNewAutomation, externalRecipientOverride, enableNewScheduledExport, defaultPdfPageSize, filtersDataByTab, availableFiltersAsVisibleFiltersByTab, }) {
|
|
17
|
+
export function useEditScheduledEmail({ scheduledExportToEdit, notificationChannels, insight, widget, users, editedAutomationFilters, dashboardFilters, editedAutomationFiltersByTab, maxAutomationsRecipients, setEditedAutomationFilters, setEditedAutomationFiltersByTab, availableFiltersAsVisibleFilters, storeFilters, setStoreFilters, filtersForNewAutomation, externalRecipientOverride, enableNewScheduledExport, defaultPdfPageSize, filtersDataByTab, availableFiltersAsVisibleFiltersByTab, }) {
|
|
24
18
|
const intl = useIntl();
|
|
19
|
+
const { settings, timezone, currentUser, features: { enableExternalRecipients: enabledExternalRecipients, enableAutomationEvaluationMode }, } = useAutomationsContext();
|
|
20
|
+
const { dashboardId, dashboardTitle, hiddenFilters: dashboardHiddenFilters, commonDateFilterId, widgetLocalIdToTabIdMap: widgetTabMap, exportParametersByTab: effectiveExportParametersByTab, } = useScheduledEmailDialogContext();
|
|
25
21
|
const [isCronValid, setIsCronValid] = useState(true);
|
|
26
22
|
const [isTitleValid, setIsTitleValid] = useState(true);
|
|
27
23
|
const [isSubjectValid, setIsSubjectValid] = useState(true);
|
|
28
24
|
const [isOnMessageValid, setIsOnMessageValid] = useState(true);
|
|
29
25
|
const isWidget = !!widget && !!insight;
|
|
30
26
|
// Dashboard
|
|
31
|
-
const dashboardId = useDashboardSelector(selectDashboardId);
|
|
32
|
-
const dashboardTitle = useDashboardSelector(selectDashboardTitle);
|
|
33
|
-
const settings = useDashboardSelector(selectSettings);
|
|
34
|
-
const timezone = useDashboardSelector(selectTimezone);
|
|
35
27
|
const resolvedDefaultCsvDelimiter = settings?.exportCsvCustomDelimiter ?? DEFAULT_CSV_DELIMITER;
|
|
36
28
|
const areDashboardFiltersChanged = !!dashboardFilters;
|
|
37
|
-
const currentUser = useDashboardSelector(selectCurrentUser);
|
|
38
|
-
const users = useDashboardSelector(selectUsers);
|
|
39
29
|
const defaultUser = convertCurrentUserToWorkspaceUser(users ?? [], currentUser);
|
|
40
30
|
const defaultRecipient = externalRecipientOverride
|
|
41
31
|
? convertExternalRecipientToAutomationRecipient(externalRecipientOverride)
|
|
42
32
|
: convertCurrentUserToAutomationRecipient(users ?? [], currentUser);
|
|
43
|
-
const enabledExternalRecipients = useDashboardSelector(selectEnableExternalRecipients);
|
|
44
|
-
const enableAutomationEvaluationMode = useDashboardSelector(selectEnableAutomationEvaluationMode);
|
|
45
33
|
const firstChannel = notificationChannels[0]?.id;
|
|
46
|
-
const dashboardHiddenFilters = useDashboardSelector(selectDashboardHiddenFilters);
|
|
47
|
-
const commonDateFilterId = useDashboardSelector(selectAutomationCommonDateFilterId);
|
|
48
|
-
const widgetTabMap = useDashboardSelector(selectWidgetLocalIdToTabIdMap);
|
|
49
34
|
// Determine target tab ID if widget is present
|
|
50
35
|
const targetTabId = widget?.localIdentifier ? widgetTabMap[widget.localIdentifier] : undefined;
|
|
51
36
|
const effectiveWidgetFilters = getAppliedWidgetFilters(editedAutomationFilters ?? [], dashboardHiddenFilters, widget, insight, commonDateFilterId, false);
|
|
@@ -70,7 +55,6 @@ export function useEditScheduledEmail({ scheduledExportToEdit, notificationChann
|
|
|
70
55
|
}, [editedAutomationFiltersByTab, filtersDataByTab, storeFilters]);
|
|
71
56
|
const effectiveVisibleDashboardFilters = getVisibleFiltersByFilters(editedAutomationFilters ?? [], availableFiltersAsVisibleFilters, storeFilters);
|
|
72
57
|
const effectiveVisibleDashboardFiltersByTab = getVisibleFiltersByFiltersByTab(editedAutomationFiltersByTab, availableFiltersAsVisibleFiltersByTab, storeFilters);
|
|
73
|
-
const effectiveExportParametersByTab = useDashboardSelector(selectExportEffectiveParameters(widget ? [objRefToString(widget.ref)] : undefined));
|
|
74
58
|
// Mirrors the filters seed above, for parameters.
|
|
75
59
|
const parametersByTabForNewAutomation = shouldStoreExportParameters(isWidget, storeFilters) &&
|
|
76
60
|
Object.keys(effectiveExportParametersByTab).length > 0
|
|
@@ -670,7 +654,7 @@ function newDashboardExportDefinitionMetadataObjectDefinition({ dashboardId, das
|
|
|
670
654
|
};
|
|
671
655
|
}
|
|
672
656
|
function newWidgetExportDefinitionMetadataObjectDefinition({ insight, widget, dashboardId, format, widgetFilters, widgetFiltersWithInsight, dashboardFilters, enableNewScheduledExport, defaultPdfPageSize, defaultCsvDelimiter, }) {
|
|
673
|
-
const widgetTitle =
|
|
657
|
+
const widgetTitle = widget.title;
|
|
674
658
|
// Determine which filters to use based on format:
|
|
675
659
|
// - CSV: Use widgetFiltersWithInsight (insight filters merged on frontend)
|
|
676
660
|
// - CSV_RAW: Use widgetFilters (insight filters merged on backend)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFiltersForDashboardScheduledExportInfo.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useFiltersForDashboardScheduledExportInfo.ts"],"names":[],"mappings":"AAIA,OAAO,EAKH,KAAK,iBAAiB,EAKzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"useFiltersForDashboardScheduledExportInfo.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useFiltersForDashboardScheduledExportInfo.ts"],"names":[],"mappings":"AAIA,OAAO,EAKH,KAAK,iBAAiB,EAKzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAKjE,MAAM,WAAW,qBAAqB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,qBAAqB,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IAC1C,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACvC;AAED,UAAU,+CAA+C;IACrD;;OAEG;IACH,gBAAgB,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAC1C;AAED,eAAO,MAAM,yCAAyC,iJAcrD,CAAC"}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
// (C) 2024-2026 GoodData Corporation
|
|
2
2
|
import { compact } from "lodash-es";
|
|
3
3
|
import { DashboardAttributeFilterConfigModeValues, DashboardDateFilterConfigModeValues, dashboardAttributeFilterItemLocalIdentifier, isDashboardAttributeFilterItem, isDashboardCommonDateFilter, isDashboardDateFilter, } from "@gooddata/sdk-model";
|
|
4
|
-
import {
|
|
5
|
-
import { selectEffectiveAttributeFiltersModeMap } from "../../../../../model/store/tabs/attributeFilterConfigs/attributeFilterConfigsSelectors.js";
|
|
6
|
-
import { selectEffectiveDateFilterMode } from "../../../../../model/store/tabs/dateFilterConfig/dateFilterConfigSelectors.js";
|
|
7
|
-
import { selectEffectiveDateFiltersModeMap } from "../../../../../model/store/tabs/dateFilterConfigs/dateFilterConfigsSelectors.js";
|
|
4
|
+
import { useScheduledEmailDialogContext } from "../../../contexts/ScheduledEmailDialogContext.js";
|
|
8
5
|
import { useFiltersNamings } from "../../../shared/hooks/useFiltersNamings.js";
|
|
9
6
|
export const useFiltersForDashboardScheduledExportInfo = ({ effectiveFilters = [], }) => {
|
|
10
7
|
// Remove hidden dashboard filters, we don't want to display them.
|
|
11
|
-
const commonDateFilterMode =
|
|
12
|
-
const dateFiltersModeMap = useDashboardSelector(selectEffectiveDateFiltersModeMap);
|
|
13
|
-
const attributeFiltersModeMap = useDashboardSelector(selectEffectiveAttributeFiltersModeMap);
|
|
8
|
+
const { commonDateFilterMode, dateFiltersModeMap, attributeFiltersModeMap } = useScheduledEmailDialogContext();
|
|
14
9
|
const filtersToDisplay = removeHiddenFilters(effectiveFilters, commonDateFilterMode, dateFiltersModeMap, attributeFiltersModeMap);
|
|
15
10
|
return compact(useFiltersNamings(filtersToDisplay));
|
|
16
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSaveScheduledEmailToBackend.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useSaveScheduledEmailToBackend.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,KAAK,yBAAyB,EAC9B,KAAK,mCAAmC,EAO3C,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"useSaveScheduledEmailToBackend.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useSaveScheduledEmailToBackend.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,KAAK,yBAAyB,EAC9B,KAAK,mCAAmC,EAO3C,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAEjE,wBAAgB,8BAA8B,CAC1C,UAAU,EAAE,yBAAyB,GAAG,mCAAmC,EAC3E,EACI,SAAS,EACT,OAAO,EACP,QAAQ,EACR,aAAa,EACb,WAAW,EACX,MAAM,EACT,EAAE,IAAI,CACH,0BAA0B,EAC1B,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,eAAe,GAAG,aAAa,GAAG,QAAQ,CACpF;;;;EAwEJ"}
|