@gooddata/sdk-ui-dashboard 11.53.0-alpha.5 → 11.53.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/esm/__version.d.ts +1 -1
  2. package/esm/__version.js +1 -1
  3. package/esm/index.d.ts +3 -3
  4. package/esm/index.d.ts.map +1 -1
  5. package/esm/index.js +2 -2
  6. package/esm/model/commandHandlers/dashboard/exportDashboardToPdfHandler.d.ts.map +1 -1
  7. package/esm/model/commandHandlers/dashboard/exportDashboardToPdfHandler.js +3 -1
  8. package/esm/model/commandHandlers/dashboard/exportDashboardToPdfPresentationHandler.d.ts.map +1 -1
  9. package/esm/model/commandHandlers/dashboard/exportDashboardToPdfPresentationHandler.js +3 -1
  10. package/esm/model/commandHandlers/dashboard/exportDashboardToPptPresentationHandler.d.ts.map +1 -1
  11. package/esm/model/commandHandlers/dashboard/exportDashboardToPptPresentationHandler.js +3 -1
  12. package/esm/model/commandHandlers/dashboard/exportToTabularHandler.d.ts.map +1 -1
  13. package/esm/model/commandHandlers/dashboard/exportToTabularHandler.js +5 -3
  14. package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/index.d.ts.map +1 -1
  15. package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/index.js +9 -2
  16. package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/loadExportTimezone.d.ts +12 -0
  17. package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/loadExportTimezone.d.ts.map +1 -0
  18. package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/loadExportTimezone.js +25 -0
  19. package/esm/model/commandHandlers/timezone/changeDashboardTimezoneOverrideHandler.d.ts.map +1 -1
  20. package/esm/model/commandHandlers/timezone/changeDashboardTimezoneOverrideHandler.js +4 -3
  21. package/esm/model/commandHandlers/widgets/exportImageInsightWidgetHandler.d.ts.map +1 -1
  22. package/esm/model/commandHandlers/widgets/exportImageInsightWidgetHandler.js +3 -1
  23. package/esm/model/commandHandlers/widgets/exportInsightWidgetHandler.d.ts.map +1 -1
  24. package/esm/model/commandHandlers/widgets/exportInsightWidgetHandler.js +4 -2
  25. package/esm/model/commandHandlers/widgets/exportRawInsightWidgetHandler.d.ts.map +1 -1
  26. package/esm/model/commandHandlers/widgets/exportRawInsightWidgetHandler.js +7 -1
  27. package/esm/model/commandHandlers/widgets/exportSlidesInsightWidgetHandler.d.ts.map +1 -1
  28. package/esm/model/commandHandlers/widgets/exportSlidesInsightWidgetHandler.js +3 -1
  29. package/esm/model/store/config/configSelectors.d.ts +6 -0
  30. package/esm/model/store/config/configSelectors.d.ts.map +1 -1
  31. package/esm/model/store/config/configSelectors.js +8 -0
  32. package/esm/model/store/meta/metaSelectors.d.ts +16 -0
  33. package/esm/model/store/meta/metaSelectors.d.ts.map +1 -1
  34. package/esm/model/store/meta/metaSelectors.js +28 -1
  35. package/esm/presentation/automations/alerting/DefaultAlertingDialog/utils/convertors.d.ts +1 -1
  36. package/esm/presentation/automations/alerting/DefaultAlertingDialog/utils/convertors.d.ts.map +1 -1
  37. package/esm/presentation/automations/alerting/DefaultAlertingDialog/utils/convertors.js +6 -1
  38. package/esm/presentation/automations/alerting/state/useAlertFormState.d.ts.map +1 -1
  39. package/esm/presentation/automations/alerting/state/useAlertFormState.js +6 -2
  40. package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.d.ts.map +1 -1
  41. package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.js +29 -3
  42. package/esm/presentation/automations/contexts/AutomationsContext.d.ts +39 -0
  43. package/esm/presentation/automations/contexts/AutomationsContext.d.ts.map +1 -1
  44. package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.d.ts.map +1 -1
  45. package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.js +33 -10
  46. package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/components/ScheduleTimezoneSelect/ScheduleTimezoneSelect.d.ts +15 -0
  47. package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/components/ScheduleTimezoneSelect/ScheduleTimezoneSelect.d.ts.map +1 -0
  48. package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/components/ScheduleTimezoneSelect/ScheduleTimezoneSelect.js +58 -0
  49. package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useExportTimezones.d.ts +52 -0
  50. package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useExportTimezones.d.ts.map +1 -0
  51. package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useExportTimezones.js +46 -0
  52. package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useScheduleTimezone.d.ts +47 -0
  53. package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useScheduleTimezone.d.ts.map +1 -0
  54. package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useScheduleTimezone.js +90 -0
  55. package/esm/presentation/automations/scheduledEmail/state/ScheduledEmailDialogStateProvider.d.ts.map +1 -1
  56. package/esm/presentation/automations/scheduledEmail/state/ScheduledEmailDialogStateProvider.js +21 -0
  57. package/esm/presentation/automations/scheduledEmail/state/ScheduledExportActionsContext.d.ts +2 -1
  58. package/esm/presentation/automations/scheduledEmail/state/ScheduledExportActionsContext.d.ts.map +1 -1
  59. package/esm/presentation/automations/scheduledEmail/state/ScheduledExportDraftContext.d.ts +5 -2
  60. package/esm/presentation/automations/scheduledEmail/state/ScheduledExportDraftContext.d.ts.map +1 -1
  61. package/esm/presentation/automations/scheduledEmail/state/exportDefinitions.d.ts +19 -2
  62. package/esm/presentation/automations/scheduledEmail/state/exportDefinitions.d.ts.map +1 -1
  63. package/esm/presentation/automations/scheduledEmail/state/exportDefinitions.js +35 -2
  64. package/esm/presentation/automations/scheduledEmail/state/useScheduledEmailExportSettings.d.ts +9 -1
  65. package/esm/presentation/automations/scheduledEmail/state/useScheduledEmailExportSettings.d.ts.map +1 -1
  66. package/esm/presentation/automations/scheduledEmail/state/useScheduledEmailExportSettings.js +10 -1
  67. package/esm/presentation/automations/scheduledEmail/state/useScheduledEmailFormState.d.ts.map +1 -1
  68. package/esm/presentation/automations/scheduledEmail/state/useScheduledEmailFormState.js +14 -2
  69. package/esm/presentation/automations/scheduledEmail/types.d.ts +64 -0
  70. package/esm/presentation/automations/scheduledEmail/types.d.ts.map +1 -1
  71. package/esm/presentation/automations/shared/automationFilters/components/ApplyLatestFiltersConfirmDialog.d.ts +12 -1
  72. package/esm/presentation/automations/shared/automationFilters/components/ApplyLatestFiltersConfirmDialog.d.ts.map +1 -1
  73. package/esm/presentation/automations/shared/automationFilters/components/ApplyLatestFiltersConfirmDialog.js +17 -2
  74. package/esm/presentation/dashboardSettingsDialog/DefaultDashboardSettingsDialog.d.ts.map +1 -1
  75. package/esm/presentation/dashboardSettingsDialog/DefaultDashboardSettingsDialog.js +3 -1
  76. package/esm/presentation/dashboardSettingsDialog/TimezoneOption.d.ts.map +1 -1
  77. package/esm/presentation/dashboardSettingsDialog/TimezoneOption.js +5 -6
  78. package/esm/presentation/filterBar/filterBar/useExecutionTimestampMessage.d.ts.map +1 -1
  79. package/esm/presentation/filterBar/filterBar/useExecutionTimestampMessage.js +6 -1
  80. package/esm/presentation/localization/bundles/en-US.localization-bundle.d.ts +48 -4
  81. package/esm/presentation/localization/bundles/en-US.localization-bundle.d.ts.map +1 -1
  82. package/esm/presentation/localization/bundles/en-US.localization-bundle.js +51 -7
  83. package/esm/presentation/timezoneDialog/TimezoneDialog.d.ts +1 -1
  84. package/esm/presentation/timezoneDialog/TimezoneDialog.d.ts.map +1 -1
  85. package/esm/presentation/timezoneDialog/TimezoneDialog.js +7 -6
  86. package/esm/presentation/topBar/menuButton/useDefaultMenuItems.d.ts.map +1 -1
  87. package/esm/presentation/topBar/menuButton/useDefaultMenuItems.js +6 -2
  88. package/esm/presentation/topBar/timezoneIndicator/TimezoneIndicator.d.ts +4 -3
  89. package/esm/presentation/topBar/timezoneIndicator/TimezoneIndicator.d.ts.map +1 -1
  90. package/esm/presentation/topBar/timezoneIndicator/TimezoneIndicator.js +10 -9
  91. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/hooks/useEditAlert.d.ts.map +1 -1
  92. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/hooks/useEditAlert.js +6 -1
  93. package/esm/sdk-ui-dashboard.d.ts +134 -3
  94. package/package.json +21 -21
  95. package/styles/css/main.css +41 -0
  96. package/styles/css/main.css.map +1 -1
  97. package/styles/css/scheduleTimezone.css +30 -0
  98. package/styles/css/scheduleTimezone.css.map +1 -0
  99. package/styles/scss/main.scss +1 -0
  100. package/styles/scss/scheduleTimezone.scss +37 -0
  101. package/esm/presentation/automations/alerting/DefaultAlertingManagementDialog/components/PauseAlertRunner.test.d.ts +0 -2
  102. package/esm/presentation/automations/alerting/DefaultAlertingManagementDialog/components/PauseAlertRunner.test.d.ts.map +0 -1
  103. package/esm/presentation/automations/alerting/DefaultAlertingManagementDialog/components/PauseAlertRunner.test.js +0 -39
  104. package/esm/presentation/automations/connectors/AlertingConnector.test.d.ts +0 -2
  105. package/esm/presentation/automations/connectors/AlertingConnector.test.d.ts.map +0 -1
  106. package/esm/presentation/automations/connectors/AlertingConnector.test.js +0 -201
  107. package/esm/presentation/automations/connectors/ScheduledEmailConnector.test.d.ts +0 -2
  108. package/esm/presentation/automations/connectors/ScheduledEmailConnector.test.d.ts.map +0 -1
  109. package/esm/presentation/automations/connectors/ScheduledEmailConnector.test.js +0 -225
  110. package/esm/presentation/automations/connectors/hooks/useBuildAlertingDialogContext.test.d.ts +0 -2
  111. package/esm/presentation/automations/connectors/hooks/useBuildAlertingDialogContext.test.d.ts.map +0 -1
  112. package/esm/presentation/automations/connectors/hooks/useBuildAlertingDialogContext.test.js +0 -95
  113. package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.test.d.ts +0 -2
  114. package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.test.d.ts.map +0 -1
  115. package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.test.js +0 -185
  116. package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailDialogContext.test.d.ts +0 -2
  117. package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailDialogContext.test.d.ts.map +0 -1
  118. package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailDialogContext.test.js +0 -175
  119. package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailManagementDialogContext.test.d.ts +0 -2
  120. package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailManagementDialogContext.test.d.ts.map +0 -1
  121. package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailManagementDialogContext.test.js +0 -48
  122. package/esm/presentation/automations/contexts/AutomationsContext.test.d.ts +0 -2
  123. package/esm/presentation/automations/contexts/AutomationsContext.test.d.ts.map +0 -1
  124. package/esm/presentation/automations/contexts/AutomationsContext.test.js +0 -9
  125. package/esm/presentation/automations/shared/automationFilters/components/AutomationDateFilter.test.d.ts +0 -2
  126. package/esm/presentation/automations/shared/automationFilters/components/AutomationDateFilter.test.d.ts.map +0 -1
  127. package/esm/presentation/automations/shared/automationFilters/components/AutomationDateFilter.test.js +0 -159
  128. package/esm/presentation/export/DefaultDashboardExportVariables.test.d.ts +0 -2
  129. package/esm/presentation/export/DefaultDashboardExportVariables.test.d.ts.map +0 -1
  130. package/esm/presentation/export/DefaultDashboardExportVariables.test.js +0 -58
  131. package/esm/presentation/widget/insight/LayeredTableView.test.d.ts +0 -2
  132. package/esm/presentation/widget/insight/LayeredTableView.test.d.ts.map +0 -1
  133. package/esm/presentation/widget/insight/LayeredTableView.test.js +0 -149
  134. package/esm/presentation/widget/insight/configuration/InsightAlertsNew.test.d.ts +0 -2
  135. package/esm/presentation/widget/insight/configuration/InsightAlertsNew.test.d.ts.map +0 -1
  136. package/esm/presentation/widget/insight/configuration/InsightAlertsNew.test.js +0 -124
  137. package/esm/presentation/widget/insight/geoDefaultDisplayFormRefs.test.d.ts +0 -2
  138. package/esm/presentation/widget/insight/geoDefaultDisplayFormRefs.test.d.ts.map +0 -1
  139. package/esm/presentation/widget/insight/geoDefaultDisplayFormRefs.test.js +0 -139
  140. package/esm/presentation/widget/insight/insightToTable.test.d.ts +0 -2
  141. package/esm/presentation/widget/insight/insightToTable.test.d.ts.map +0 -1
  142. package/esm/presentation/widget/insight/insightToTable.test.js +0 -325
@@ -1 +0,0 @@
1
- {"version":3,"file":"useBuildAutomationsContext.test.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/connectors/hooks/useBuildAutomationsContext.test.tsx"],"names":[],"mappings":""}
@@ -1,185 +0,0 @@
1
- // (C) 2026 GoodData Corporation
2
- import { renderHook } from "@testing-library/react";
3
- import { describe, expect, it, vi } from "vitest";
4
- const selectors = vi.hoisted(() => {
5
- const availableGranularities = ["GDC.time.date"];
6
- const dateFilterOptions = {
7
- allTime: {
8
- localIdentifier: "allTime",
9
- type: "allTime",
10
- name: "All time",
11
- visible: true,
12
- },
13
- };
14
- const granularitiesPerTab = {
15
- tab1: ["GDC.time.month"],
16
- };
17
- const optionsPerTab = {
18
- tab1: {
19
- relativeForm: {
20
- fromLimit: -30,
21
- toLimit: 0,
22
- localIdentifier: "relative",
23
- type: "relativeForm",
24
- name: "Relative",
25
- visible: true,
26
- },
27
- },
28
- };
29
- // Every mocked selector must return one of these. A mock that allocates per call
30
- // (`() => []`) would make the context value change identity on every render, which the
31
- // referential-stability test below exists to catch. In production every one of these
32
- // selectors is a createSelector and returns a stable reference.
33
- return {
34
- availableGranularities,
35
- dateFilterOptions,
36
- granularitiesPerTab,
37
- optionsPerTab,
38
- emptyArray: [],
39
- emptyRecord: {},
40
- emptyMap: new Map(),
41
- separators: { decimal: ".", thousand: "," },
42
- currentUser: { login: "test@example.com", ref: { identifier: "test" } },
43
- widgetsMap: { get: () => undefined },
44
- parameterCatalog: [],
45
- dashboardParametersByTab: {},
46
- tabs: [{ localIdentifier: "tab1" }],
47
- widgetTabMap: { "widget-1": "tab1" },
48
- };
49
- });
50
- vi.mock("../../../../model/react/DashboardStoreProvider.js", () => ({
51
- useDashboardSelector: vi.fn((selector) => selector()),
52
- }));
53
- vi.mock("../../../../model/store/catalog/catalogSelectors.js", () => ({
54
- selectAllCatalogAttributesMap: () => selectors.emptyMap,
55
- selectAllCatalogDisplayFormsMap: () => selectors.emptyMap,
56
- selectCatalogAttributes: () => selectors.emptyArray,
57
- selectCatalogDateDatasets: () => selectors.emptyArray,
58
- selectCatalogMeasures: () => selectors.emptyArray,
59
- selectCatalogParameters: () => selectors.parameterCatalog,
60
- selectCatalogParametersIsLoaded: () => true,
61
- }));
62
- vi.mock("../../../../model/store/config/configSelectors.js", () => ({
63
- selectDateFormat: () => "MM/dd/yyyy",
64
- selectEnableAlertOncePerInterval: () => false,
65
- selectEnableAnomalyDetectionAlert: () => false,
66
- selectEnableAutomationEvaluationMode: () => false,
67
- selectEnableParameters: () => true,
68
- selectEnableSlideshowExports: () => false,
69
- selectEnableStringParameters: () => true,
70
- selectExternalRecipient: () => undefined,
71
- selectIsWhiteLabeled: () => false,
72
- selectLocale: () => "en-US",
73
- selectSeparators: () => selectors.separators,
74
- selectSettings: () => undefined,
75
- selectTimezone: () => undefined,
76
- selectWeekStart: () => "Sunday",
77
- }));
78
- vi.mock("../../../../model/store/drill/drillSelectors.js", () => ({
79
- selectIsCrossFiltering: () => false,
80
- }));
81
- vi.mock("../../../../model/store/tabs/tabsSelectors.js", () => ({
82
- selectTabs: () => selectors.tabs,
83
- }));
84
- vi.mock("../../../../model/store/tabs/parameters/parametersSelectors.js", () => ({
85
- selectSmartPersistedTabsParameters: () => selectors.dashboardParametersByTab,
86
- }));
87
- vi.mock("../../../../model/store/permissions/permissionsSelectors.js", () => ({
88
- selectCanCreateAutomation: () => true,
89
- selectCanManageWorkspace: () => false,
90
- selectCanUseAiAssistant: () => false,
91
- }));
92
- vi.mock("../../../../model/store/user/userSelectors.js", () => ({
93
- selectCurrentUser: () => selectors.currentUser,
94
- }));
95
- vi.mock("../../../../model/store/filtering/dashboardFilterSelectors.js", () => ({
96
- selectAutomationAvailableDashboardFilters: () => selectors.emptyArray,
97
- selectAutomationCommonDateFilterId: () => undefined,
98
- selectAutomationDefaultSelectedFilters: () => selectors.emptyArray,
99
- selectAutomationFiltersByTab: () => selectors.emptyArray,
100
- selectDashboardFiltersWithoutCrossFiltering: () => selectors.emptyArray,
101
- selectDashboardHiddenFilters: () => selectors.emptyArray,
102
- selectDashboardLockedFilters: () => selectors.emptyArray,
103
- }));
104
- vi.mock("../../../../model/store/meta/metaSelectors.js", () => ({
105
- selectPersistedDashboardFilterContextDateFilterConfig: () => undefined,
106
- }));
107
- vi.mock("../../../../model/store/tabs/attributeFilterConfigs/attributeFilterConfigsSelectors.js", () => ({
108
- selectAttributeFilterConfigsOverrides: () => selectors.emptyArray,
109
- selectAttributeFilterConfigsOverridesByTab: () => selectors.emptyRecord,
110
- selectAttributeFilterConfigsSelectionTypeMap: () => selectors.emptyMap,
111
- selectAttributeFilterConfigsSelectionTypeMapByTab: () => selectors.emptyRecord,
112
- selectEffectiveAttributeFiltersModeMap: () => selectors.emptyMap,
113
- }));
114
- vi.mock("../../../../model/store/tabs/dateFilterConfig/dateFilterConfigSelectors.js", () => ({
115
- selectDateFilterConfigOverridesByTab: () => selectors.emptyRecord,
116
- selectEffectiveDateFilterAvailableGranularities: () => selectors.availableGranularities,
117
- selectEffectiveDateFilterGranularitiesPerTab: () => selectors.granularitiesPerTab,
118
- selectEffectiveDateFilterMode: () => "active",
119
- selectEffectiveDateFilterOptions: () => selectors.dateFilterOptions,
120
- selectEffectiveDateFilterOptionsPerTab: () => selectors.optionsPerTab,
121
- }));
122
- vi.mock("../../../../model/store/tabs/dateFilterConfigs/dateFilterConfigsSelectors.js", () => ({
123
- selectDateFilterConfigsOverrides: () => selectors.emptyArray,
124
- selectDateFilterConfigsOverridesByTab: () => selectors.emptyRecord,
125
- selectEffectiveDateFiltersModeMap: () => selectors.emptyMap,
126
- }));
127
- vi.mock("../../../../model/store/tabs/filterContext/filterContextSelectors.js", () => ({
128
- selectAttributeFilterDisplayFormsMap: () => selectors.emptyMap,
129
- }));
130
- vi.mock("../../../../model/store/entitlements/entitlementsSelectors.js", () => ({
131
- selectMaxAutomationRecipients: () => 10,
132
- selectEntitlementMinimumRecurrenceMinutes: () => undefined,
133
- }));
134
- vi.mock("../../../../model/store/ui/uiSelectors.js", () => ({
135
- selectExecutionTimestamp: () => undefined,
136
- selectScheduleEmailDialogReturnFocusTo: () => undefined,
137
- }));
138
- vi.mock("../../../../model/store/tabs/measureValueFilterConfigs/measureValueFilterConfigsSelectors.js", () => ({
139
- selectMeasureValueFilterConfigsOverrides: () => selectors.emptyArray,
140
- selectMeasureValueFilterConfigsOverridesByTab: () => selectors.emptyRecord,
141
- }));
142
- vi.mock("../../../../model/store/tabs/layout/layoutSelectors.js", () => ({
143
- selectWidgetsMap: () => selectors.widgetsMap,
144
- selectWidgetLocalIdToTabIdMap: () => selectors.widgetTabMap,
145
- }));
146
- import { useBuildAutomationsContext } from "./useBuildAutomationsContext.js";
147
- describe("useBuildAutomationsContext", () => {
148
- it("preserves per-tab date filter configuration in the automations context bridge", () => {
149
- const { result } = renderHook(() => useBuildAutomationsContext());
150
- expect(result.current.dateFilterConfig.availableGranularities).toEqual(selectors.availableGranularities);
151
- expect(result.current.dateFilterConfig.dateFilterOptions).toEqual(selectors.dateFilterOptions);
152
- expect(result.current.dateFilterConfig.getGranularitiesForTab("tab1")).toEqual(selectors.granularitiesPerTab["tab1"]);
153
- expect(result.current.dateFilterConfig.getOptionsForTab("tab1")).toEqual(selectors.optionsPerTab["tab1"]);
154
- expect(result.current.dateFilterConfig.getGranularitiesForTab("missing-tab")).toEqual([]);
155
- expect(result.current.dateFilterConfig.getOptionsForTab("missing-tab")).toBeUndefined();
156
- expect(result.current.features.canCreateAutomation).toBe(true);
157
- });
158
- });
159
- describe("useBuildAutomationsContext — parameter data", () => {
160
- it("exposes the dashboard-global parameter data the shared automationFilters hooks need", () => {
161
- const { result } = renderHook(() => useBuildAutomationsContext());
162
- expect(result.current.parameters).toEqual({
163
- enabled: true,
164
- stringParametersEnabled: true,
165
- catalog: selectors.parameterCatalog,
166
- catalogIsLoaded: true,
167
- dashboardParametersByTab: selectors.dashboardParametersByTab,
168
- });
169
- expect(result.current.tabIds).toEqual(["tab1"]);
170
- expect(result.current.widgetLocalIdToTabIdMap).toBe(selectors.widgetTabMap);
171
- });
172
- });
173
- describe("useBuildAutomationsContext — referential stability", () => {
174
- it("returns a referentially identical context value when re-rendered with unchanged store state", () => {
175
- const { result, rerender } = renderHook(() => useBuildAutomationsContext());
176
- const first = result.current;
177
- rerender();
178
- // The whole context value, not just its members: an unmemoized `tabIds` or `parameters`
179
- // would land in the top-level useMemo's dependency array and change this identity on
180
- // every render, re-rendering every consumer in both dialog trees.
181
- expect(result.current).toBe(first);
182
- expect(result.current.tabIds).toBe(first.tabIds);
183
- expect(result.current.parameters).toBe(first.parameters);
184
- });
185
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=useBuildScheduledEmailDialogContext.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useBuildScheduledEmailDialogContext.test.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/connectors/hooks/useBuildScheduledEmailDialogContext.test.tsx"],"names":[],"mappings":""}
@@ -1,175 +0,0 @@
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
- selectDashboardHiddenFilters: () => [],
35
- }));
36
- vi.mock("../../../../model/store/meta/metaSelectors.js", () => ({
37
- selectDashboardId: () => "dashboard-1",
38
- selectDashboardTitle: () => "My Dashboard",
39
- }));
40
- vi.mock("../../../../model/store/config/configSelectors.js", () => ({
41
- selectDateFormat: () => "MM/dd/yyyy",
42
- }));
43
- vi.mock("../../../../model/store/drill/drillSelectors.js", () => ({
44
- selectIsCrossFiltering: () => false,
45
- }));
46
- vi.mock("../../../../model/store/tabs/dateFilterConfig/dateFilterConfigSelectors.js", () => ({
47
- selectEffectiveDateFilterMode: () => "active",
48
- }));
49
- vi.mock("../../../../model/store/tabs/dateFilterConfigs/dateFilterConfigsSelectors.js", () => ({
50
- selectEffectiveDateFiltersModeMap: () => new Map(),
51
- }));
52
- vi.mock("../../../../model/store/tabs/attributeFilterConfigs/attributeFilterConfigsSelectors.js", () => ({
53
- selectEffectiveAttributeFiltersModeMap: () => new Map(),
54
- }));
55
- vi.mock("../../../../model/store/tabs/tabsSelectors.js", () => ({
56
- selectTabs: () => [],
57
- }));
58
- vi.mock("../../../../model/store/tabs/parameters/parametersSelectors.js", () => ({
59
- selectExportEffectiveParameters: () => () => ({}),
60
- }));
61
- vi.mock("../../../../model/react/useExportTemplates.js", () => ({
62
- useExportTemplates: () => [],
63
- }));
64
- vi.mock("../../../../model/utils/dashboardItemUtils.js", () => ({
65
- getWidgetTitle: () => "widget title",
66
- }));
67
- vi.mock("./sanitizeAutomationForSave.js", () => ({
68
- sanitizeAutomationForSave: vi.fn((automation) => ({
69
- ...automation,
70
- __sanitized: true,
71
- })),
72
- }));
73
- import { createScheduledEmail as createScheduledEmailCmd, saveScheduledEmail as saveScheduledEmailCmd, } from "../../../../model/commands/scheduledEmail.js";
74
- import { sanitizeAutomationForSave } from "./sanitizeAutomationForSave.js";
75
- import { useBuildScheduledEmailDialogContext, } from "./useBuildScheduledEmailDialogContext.js";
76
- // ---------------------------------------------------------------------------
77
- // Tests
78
- // ---------------------------------------------------------------------------
79
- // The builder's create/edit inputs (notificationChannels, isLoading) are required options;
80
- // tests that don't care about them use this minimal, valid base and override what they need.
81
- const BASE_OPTS = {
82
- notificationChannels: [],
83
- isLoading: false,
84
- };
85
- describe("useBuildScheduledEmailDialogContext", () => {
86
- it("exposes dashboardId and dashboardTitle from the store selectors", () => {
87
- const { result } = renderHook(() => useBuildScheduledEmailDialogContext(BASE_OPTS));
88
- expect(result.current.dashboardId).toBe("dashboard-1");
89
- expect(result.current.dashboardTitle).toBe("My Dashboard");
90
- });
91
- it("passes the create/edit inputs through and carries the effective dashboard filters", () => {
92
- const scheduledExportToEdit = { id: "schedule-1", title: "Weekly" };
93
- const notificationChannels = [
94
- { id: "channel-1", type: "notificationChannel" },
95
- ];
96
- const dashboardFilters = [];
97
- const { result } = renderHook(() => useBuildScheduledEmailDialogContext({
98
- scheduledExportToEdit,
99
- notificationChannels,
100
- isLoading: true,
101
- dashboardFilters,
102
- }));
103
- expect(result.current.scheduledExportToEdit).toBe(scheduledExportToEdit);
104
- expect(result.current.notificationChannels).toBe(notificationChannels);
105
- expect(result.current.isLoading).toBe(true);
106
- // the connector computes `saved ?? getAppliedDashboardFilters(...)` and passes the result in;
107
- // the builder must not re-derive it from selectAutomationDefaultSelectedFilters
108
- expect(result.current.dashboardFilters).toBe(dashboardFilters);
109
- });
110
- it("createScheduledEmail applies sanitizeAutomationForSave before dispatching the command", async () => {
111
- const { result } = renderHook(() => useBuildScheduledEmailDialogContext(BASE_OPTS));
112
- const draft = {
113
- type: "automation",
114
- title: "New Schedule",
115
- };
116
- // Kick off the create (do not await yet)
117
- let promise;
118
- act(() => {
119
- promise = result.current.createScheduledEmail(draft);
120
- });
121
- // sanitizeAutomationForSave must have been called with the raw draft
122
- expect(sanitizeAutomationForSave).toHaveBeenCalledWith(draft);
123
- // The command creator must have received the sanitized draft (sanitize runs inside commandCreator)
124
- expect(createScheduledEmailCmd).toHaveBeenCalledWith(expect.objectContaining({ __sanitized: true }));
125
- // Simulate the CREATED event resolving
126
- const createdSE = {
127
- type: "automation",
128
- id: "se-1",
129
- title: "New Schedule",
130
- ref: idRef("se-1"),
131
- };
132
- act(() => {
133
- runCreateMock.__onSuccess({
134
- payload: { scheduledEmail: createdSE },
135
- });
136
- });
137
- await expect(promise).resolves.toEqual(createdSE);
138
- });
139
- it("saveScheduledEmail applies sanitizeAutomationForSave before dispatching the command", async () => {
140
- const { result } = renderHook(() => useBuildScheduledEmailDialogContext(BASE_OPTS));
141
- const existing = {
142
- type: "automation",
143
- id: "se-2",
144
- title: "Existing Schedule",
145
- ref: idRef("se-2"),
146
- };
147
- let promise;
148
- act(() => {
149
- promise = result.current.saveScheduledEmail(existing);
150
- });
151
- expect(sanitizeAutomationForSave).toHaveBeenCalledWith(existing);
152
- expect(saveScheduledEmailCmd).toHaveBeenCalledWith(expect.objectContaining({ __sanitized: true }));
153
- // Simulate SAVED event — no payload on the SE saved event, so resolve with input
154
- act(() => {
155
- runSaveMock.__onSuccess({});
156
- });
157
- await expect(promise).resolves.toEqual(existing);
158
- });
159
- it("createScheduledEmail rejects with error when the command fails", async () => {
160
- const { result } = renderHook(() => useBuildScheduledEmailDialogContext(BASE_OPTS));
161
- const draft = {
162
- type: "automation",
163
- title: "Fail Schedule",
164
- };
165
- let promise;
166
- act(() => {
167
- promise = result.current.createScheduledEmail(draft);
168
- });
169
- const err = new Error("Backend failure");
170
- act(() => {
171
- runCreateMock.__onError({ payload: { error: err } });
172
- });
173
- await expect(promise).rejects.toThrow("Backend failure");
174
- });
175
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=useBuildScheduledEmailManagementDialogContext.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useBuildScheduledEmailManagementDialogContext.test.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/connectors/hooks/useBuildScheduledEmailManagementDialogContext.test.ts"],"names":[],"mappings":""}
@@ -1,48 +0,0 @@
1
- // (C) 2026 GoodData Corporation
2
- import { renderHook } from "@testing-library/react";
3
- import { describe, expect, it, vi } from "vitest";
4
- // ---------------------------------------------------------------------------
5
- // Mocks
6
- // ---------------------------------------------------------------------------
7
- vi.mock("../../../../model/react/DashboardStoreProvider.js", () => ({
8
- useDashboardSelector: vi.fn((selector) => selector()),
9
- }));
10
- vi.mock("../../../../model/store/config/configSelectors.js", () => ({
11
- selectEnableAccessibilityMode: () => false,
12
- selectIsEmbedded: () => false,
13
- }));
14
- vi.mock("../../../../model/store/meta/metaSelectors.js", () => ({
15
- selectDashboardId: () => "dashboard-id",
16
- selectDashboardTitle: () => "Dashboard Title",
17
- }));
18
- vi.mock("../../../../model/store/entitlements/entitlementsSelectors.js", () => ({
19
- selectEntitlementMaxAutomations: () => ({ value: "10" }),
20
- selectEntitlementUnlimitedAutomations: () => undefined,
21
- }));
22
- vi.mock("../../../../model/store/ui/uiSelectors.js", () => ({
23
- selectIsScheduleEmailDialogOpen: () => false,
24
- selectAutomationsInvalidationId: () => 42,
25
- }));
26
- import { useBuildScheduledEmailManagementDialogContext } from "./useBuildScheduledEmailManagementDialogContext.js";
27
- // ---------------------------------------------------------------------------
28
- // Tests
29
- // ---------------------------------------------------------------------------
30
- describe("useBuildScheduledEmailManagementDialogContext", () => {
31
- it("returns store-derived fields correctly", () => {
32
- const { result } = renderHook(() => useBuildScheduledEmailManagementDialogContext({ automations: [], isLoading: false }));
33
- expect(result.current.isScheduleEmailDialogOpen).toBe(false);
34
- expect(result.current.automationsInvalidationId).toBe(42);
35
- expect(result.current.isEmbedded).toBe(false);
36
- expect(result.current.enableAccessibilityMode).toBe(false);
37
- expect(result.current.dashboardId).toBe("dashboard-id");
38
- expect(result.current.dashboardTitle).toBe("Dashboard Title");
39
- expect(result.current.maxAutomations).toBe(10);
40
- expect(result.current.unlimitedAutomations).toBe(false);
41
- });
42
- it("passes the automation list and loading flag through to the context", () => {
43
- const automations = [{ id: "schedule-1", title: "Weekly" }];
44
- const { result } = renderHook(() => useBuildScheduledEmailManagementDialogContext({ automations, isLoading: true }));
45
- expect(result.current.automations).toBe(automations);
46
- expect(result.current.isLoading).toBe(true);
47
- });
48
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=AutomationsContext.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AutomationsContext.test.d.ts","sourceRoot":"","sources":["../../../../src/presentation/automations/contexts/AutomationsContext.test.ts"],"names":[],"mappings":""}
@@ -1,9 +0,0 @@
1
- // (C) 2026 GoodData Corporation
2
- import { renderHook } from "@testing-library/react";
3
- import { describe, expect, it } from "vitest";
4
- import { useAutomationsContext } from "./AutomationsContext.js";
5
- describe("useAutomationsContext", () => {
6
- it("throws when used outside provider", () => {
7
- expect(() => renderHook(() => useAutomationsContext())).toThrow("useAutomationsContext must be used within an AutomationsContextProvider");
8
- });
9
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=AutomationDateFilter.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AutomationDateFilter.test.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/automations/shared/automationFilters/components/AutomationDateFilter.test.tsx"],"names":[],"mappings":""}
@@ -1,159 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- // (C) 2026 GoodData Corporation
3
- import { render } from "@testing-library/react";
4
- import { describe, expect, it, vi } from "vitest";
5
- import { newRelativeDashboardDateFilter } from "@gooddata/sdk-model";
6
- import { AutomationsContextProvider, } from "../../../contexts/AutomationsContext.js";
7
- const captured = vi.hoisted(() => ({
8
- lastConfig: undefined,
9
- }));
10
- vi.mock("react-intl", () => ({
11
- useIntl: () => ({
12
- formatMessage: ({ id }) => id,
13
- }),
14
- }));
15
- vi.mock("../../../../../model/react/DashboardStoreProvider.js", () => ({
16
- useDashboardSelector: vi.fn(() => {
17
- throw new Error("AutomationDateFilter must not read dashboard selectors directly");
18
- }),
19
- }));
20
- vi.mock("../../../../filterBar/dateFilter/DefaultDashboardDateFilter.js", () => ({
21
- DefaultDashboardDateFilter: vi.fn((props) => {
22
- captured.lastConfig = props.config;
23
- return null;
24
- }),
25
- }));
26
- import { AutomationDateFilter } from "./AutomationDateFilter.js";
27
- function createAutomationsContextValue(overrides) {
28
- return {
29
- locale: "en-US",
30
- separators: { decimal: ".", thousand: "," },
31
- settings: undefined,
32
- catalogAttributes: [],
33
- catalogDateDatasets: overrides.catalogDateDatasets,
34
- catalogMeasures: [],
35
- dateFilterConfig: overrides.dateFilterConfig,
36
- dateFilterContextConfig: undefined,
37
- attributeFilterConfigs: [],
38
- attributeFilterConfigsByTab: {},
39
- attributeFilterSelectionTypeMap: new Map(),
40
- attributeFilterSelectionTypeMapByTab: {},
41
- dateFilterConfigs: [],
42
- dateFilterConfigsByTab: {},
43
- dateFilterConfigOverridesByTab: {},
44
- measureValueFilterConfigs: [],
45
- measureValueFilterConfigsByTab: {},
46
- commonDateFilterId: undefined,
47
- lockedFilters: [],
48
- hiddenFilters: [],
49
- availableFilters: [],
50
- automationFiltersByTab: [],
51
- defaultSelectedFilters: [],
52
- automationAvailableFilters: [],
53
- maxAutomationsRecipients: 10,
54
- isExecutionTimestampMode: false,
55
- allowHourlyRecurrence: true,
56
- currentUser: { login: "test@example.com", ref: { identifier: "test" } },
57
- weekStart: "Sunday",
58
- timezone: undefined,
59
- isWhiteLabeled: false,
60
- isSecondaryTitleVisible: false,
61
- externalRecipient: undefined,
62
- features: {
63
- canCreateAutomation: false,
64
- enableAlertOncePerInterval: false,
65
- enableAnomalyDetectionAlert: false,
66
- canUseAiAssistant: false,
67
- canManageWorkspace: false,
68
- enableSlideshowExports: false,
69
- enableAutomationEvaluationMode: false,
70
- },
71
- parameters: {
72
- enabled: false,
73
- stringParametersEnabled: false,
74
- catalog: [],
75
- catalogIsLoaded: true,
76
- dashboardParametersByTab: {},
77
- },
78
- tabIds: [],
79
- widgetLocalIdToTabIdMap: {},
80
- getCatalogAttributeByRef: () => undefined,
81
- getAttributeFilterDisplayForm: () => undefined,
82
- widgetExistsByRef: () => false,
83
- scheduleEmailDialogReturnFocusTo: undefined,
84
- };
85
- }
86
- describe("AutomationDateFilter", () => {
87
- const activeGranularities = ["GDC.time.date"];
88
- const tabGranularities = ["GDC.time.month"];
89
- const activeOptions = {
90
- allTime: {
91
- localIdentifier: "allTime",
92
- type: "allTime",
93
- name: "All time",
94
- visible: true,
95
- },
96
- };
97
- const tabOptions = {
98
- relativeForm: {
99
- fromLimit: -30,
100
- toLimit: 0,
101
- localIdentifier: "relative",
102
- type: "relativeForm",
103
- name: "Relative",
104
- visible: true,
105
- },
106
- };
107
- const filter = newRelativeDashboardDateFilter("GDC.time.date", -6, 0);
108
- it("uses tab-specific values from AutomationsContext without reading dashboard selectors", () => {
109
- captured.lastConfig = undefined;
110
- const value = createAutomationsContextValue({
111
- catalogDateDatasets: [],
112
- dateFilterConfig: {
113
- availableGranularities: activeGranularities,
114
- dateFilterOptions: activeOptions,
115
- getGranularitiesForTab: (tabId) => (tabId === "tab1" ? tabGranularities : []),
116
- getOptionsForTab: (tabId) => (tabId === "tab1" ? tabOptions : undefined),
117
- },
118
- });
119
- render(_jsx(AutomationsContextProvider, { value: value, children: _jsx(AutomationDateFilter, { filter: filter, onChange: vi.fn(), onDelete: vi.fn(), tabId: "tab1" }) }));
120
- expect(captured.lastConfig).toMatchObject({
121
- availableGranularities: tabGranularities,
122
- dateFilterOptions: tabOptions,
123
- });
124
- });
125
- it("falls back to active values when the tab-specific config is empty", () => {
126
- captured.lastConfig = undefined;
127
- const value = createAutomationsContextValue({
128
- catalogDateDatasets: [],
129
- dateFilterConfig: {
130
- availableGranularities: activeGranularities,
131
- dateFilterOptions: activeOptions,
132
- getGranularitiesForTab: () => [],
133
- getOptionsForTab: () => undefined,
134
- },
135
- });
136
- render(_jsx(AutomationsContextProvider, { value: value, children: _jsx(AutomationDateFilter, { filter: filter, onChange: vi.fn(), onDelete: vi.fn(), tabId: "missing-tab" }) }));
137
- expect(captured.lastConfig).toMatchObject({
138
- availableGranularities: activeGranularities,
139
- dateFilterOptions: activeOptions,
140
- });
141
- });
142
- it("falls back to active options when tab-specific options map is empty", () => {
143
- captured.lastConfig = undefined;
144
- const value = createAutomationsContextValue({
145
- catalogDateDatasets: [],
146
- dateFilterConfig: {
147
- availableGranularities: activeGranularities,
148
- dateFilterOptions: activeOptions,
149
- getGranularitiesForTab: () => tabGranularities,
150
- getOptionsForTab: () => ({}),
151
- },
152
- });
153
- render(_jsx(AutomationsContextProvider, { value: value, children: _jsx(AutomationDateFilter, { filter: filter, onChange: vi.fn(), onDelete: vi.fn(), tabId: "tab1" }) }));
154
- expect(captured.lastConfig).toMatchObject({
155
- availableGranularities: tabGranularities,
156
- dateFilterOptions: activeOptions,
157
- });
158
- });
159
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=DefaultDashboardExportVariables.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DefaultDashboardExportVariables.test.d.ts","sourceRoot":"","sources":["../../../src/presentation/export/DefaultDashboardExportVariables.test.tsx"],"names":[],"mappings":""}