@gooddata/sdk-ui-dashboard 11.52.0-alpha.4 → 11.52.0-alpha.6

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 (112) hide show
  1. package/NOTICE +22 -22
  2. package/esm/__version.d.ts +1 -1
  3. package/esm/__version.js +1 -1
  4. package/esm/index.d.ts +3 -3
  5. package/esm/index.d.ts.map +1 -1
  6. package/esm/index.js +3 -3
  7. package/esm/model/commandHandlers/index.d.ts.map +1 -1
  8. package/esm/model/commandHandlers/index.js +2 -0
  9. package/esm/model/commandHandlers/widgets/changeVisualizationSwitcherActiveVisualizationHandler.d.ts +6 -0
  10. package/esm/model/commandHandlers/widgets/changeVisualizationSwitcherActiveVisualizationHandler.d.ts.map +1 -0
  11. package/esm/model/commandHandlers/widgets/changeVisualizationSwitcherActiveVisualizationHandler.js +12 -0
  12. package/esm/model/commands/base.d.ts +1 -1
  13. package/esm/model/commands/base.d.ts.map +1 -1
  14. package/esm/model/commands/index.d.ts +2 -2
  15. package/esm/model/commands/index.d.ts.map +1 -1
  16. package/esm/model/commands/visualizationSwitcher.d.ts +33 -0
  17. package/esm/model/commands/visualizationSwitcher.d.ts.map +1 -1
  18. package/esm/model/commands/visualizationSwitcher.js +21 -0
  19. package/esm/model/events/base.d.ts +1 -1
  20. package/esm/model/events/base.d.ts.map +1 -1
  21. package/esm/model/events/index.d.ts +2 -2
  22. package/esm/model/events/index.d.ts.map +1 -1
  23. package/esm/model/events/visualizationSwitcher.d.ts +34 -0
  24. package/esm/model/events/visualizationSwitcher.d.ts.map +1 -1
  25. package/esm/model/events/visualizationSwitcher.js +21 -0
  26. package/esm/model/react/useDashboardCommand.d.ts +1 -0
  27. package/esm/model/react/useDashboardCommand.d.ts.map +1 -1
  28. package/esm/model/react/useDashboardCommandProcessing.d.ts +4 -0
  29. package/esm/model/react/useDashboardCommandProcessing.d.ts.map +1 -1
  30. package/esm/model/store/ui/index.d.ts +4 -0
  31. package/esm/model/store/ui/index.d.ts.map +1 -1
  32. package/esm/model/store/ui/uiReducers.d.ts +7 -0
  33. package/esm/model/store/ui/uiReducers.d.ts.map +1 -1
  34. package/esm/model/store/ui/uiReducers.js +6 -0
  35. package/esm/model/store/ui/uiSelectors.d.ts +8 -0
  36. package/esm/model/store/ui/uiSelectors.d.ts.map +1 -1
  37. package/esm/model/store/ui/uiSelectors.js +10 -0
  38. package/esm/model/store/ui/uiState.d.ts +6 -0
  39. package/esm/model/store/ui/uiState.d.ts.map +1 -1
  40. package/esm/model/store/ui/uiState.js +1 -0
  41. package/esm/presentation/automations/alerting/AlertingDialog.d.ts +3 -0
  42. package/esm/presentation/automations/alerting/AlertingDialog.d.ts.map +1 -1
  43. package/esm/presentation/automations/alerting/AlertingDialog.js +5 -1
  44. package/esm/presentation/automations/alerting/DefaultAlertingDialog/DefaultAlertingDialog.d.ts +9 -6
  45. package/esm/presentation/automations/alerting/DefaultAlertingDialog/DefaultAlertingDialog.d.ts.map +1 -1
  46. package/esm/presentation/automations/alerting/DefaultAlertingDialog/DefaultAlertingDialog.js +33 -12
  47. package/esm/presentation/automations/alerting/DefaultAlertingDialog/hooks/useAlertThreshold.d.ts +9 -0
  48. package/esm/presentation/automations/alerting/DefaultAlertingDialog/hooks/useAlertThreshold.d.ts.map +1 -1
  49. package/esm/presentation/automations/alerting/DefaultAlertingDialog/hooks/useAlertThreshold.js +9 -0
  50. package/esm/presentation/automations/alerting/state/AlertActionsContext.d.ts +23 -0
  51. package/esm/presentation/automations/alerting/state/AlertActionsContext.d.ts.map +1 -0
  52. package/esm/presentation/automations/alerting/state/AlertActionsContext.js +19 -0
  53. package/esm/presentation/automations/alerting/state/AlertDataContext.d.ts +24 -0
  54. package/esm/presentation/automations/alerting/state/AlertDataContext.d.ts.map +1 -0
  55. package/esm/presentation/automations/alerting/state/AlertDataContext.js +19 -0
  56. package/esm/presentation/automations/alerting/state/AlertDraftContext.d.ts +24 -0
  57. package/esm/presentation/automations/alerting/state/AlertDraftContext.d.ts.map +1 -0
  58. package/esm/presentation/automations/alerting/state/AlertDraftContext.js +19 -0
  59. package/esm/presentation/automations/alerting/state/AlertFiltersContext.d.ts +26 -0
  60. package/esm/presentation/automations/alerting/state/AlertFiltersContext.d.ts.map +1 -0
  61. package/esm/presentation/automations/alerting/state/AlertFiltersContext.js +19 -0
  62. package/esm/presentation/automations/alerting/state/AlertingDialogStateProvider.d.ts +21 -0
  63. package/esm/presentation/automations/alerting/state/AlertingDialogStateProvider.d.ts.map +1 -0
  64. package/esm/presentation/automations/alerting/state/AlertingDialogStateProvider.js +168 -0
  65. package/esm/presentation/automations/alerting/state/missingAlertStateProvider.d.ts +7 -0
  66. package/esm/presentation/automations/alerting/state/missingAlertStateProvider.d.ts.map +1 -0
  67. package/esm/presentation/automations/alerting/state/missingAlertStateProvider.js +9 -0
  68. package/esm/presentation/automations/alerting/state/useAlertDialogValidity.d.ts +15 -0
  69. package/esm/presentation/automations/alerting/state/useAlertDialogValidity.d.ts.map +1 -0
  70. package/esm/presentation/automations/alerting/state/useAlertDialogValidity.js +45 -0
  71. package/esm/presentation/automations/alerting/{DefaultAlertingDialog/hooks/useAlertFilters.d.ts → state/useAlertFiltersModel.d.ts} +6 -6
  72. package/esm/presentation/automations/alerting/state/useAlertFiltersModel.d.ts.map +1 -0
  73. package/esm/presentation/automations/alerting/{DefaultAlertingDialog/hooks/useAlertFilters.js → state/useAlertFiltersModel.js} +4 -4
  74. package/esm/presentation/automations/alerting/{DefaultAlertingDialog/hooks → state}/useAlertFormState.d.ts +4 -4
  75. package/esm/presentation/automations/alerting/state/useAlertFormState.d.ts.map +1 -0
  76. package/esm/presentation/automations/alerting/{DefaultAlertingDialog/hooks → state}/useAlertFormState.js +14 -14
  77. package/esm/presentation/automations/alerting/state/useAlertFormValidation.d.ts.map +1 -0
  78. package/esm/presentation/automations/alerting/{DefaultAlertingDialog/hooks → state}/useAlertFormValidation.js +3 -3
  79. package/esm/presentation/automations/alerting/{DefaultAlertingDialog/hooks → state}/useAlertSelectedValues.d.ts +17 -7
  80. package/esm/presentation/automations/alerting/state/useAlertSelectedValues.d.ts.map +1 -0
  81. package/esm/presentation/automations/alerting/{DefaultAlertingDialog/hooks → state}/useAlertSelectedValues.js +27 -4
  82. package/esm/presentation/automations/alerting/{DefaultAlertingDialog/hooks → state}/useAlertSupportedMetrics.d.ts +3 -3
  83. package/esm/presentation/automations/alerting/state/useAlertSupportedMetrics.d.ts.map +1 -0
  84. package/esm/presentation/automations/alerting/{DefaultAlertingDialog/hooks → state}/useAlertSupportedMetrics.js +5 -5
  85. package/esm/presentation/automations/shared/automationFilters/hooks/useDefaultSelectedFiltersForNewAutomation.d.ts.map +1 -1
  86. package/esm/presentation/automations/shared/automationFilters/hooks/useDefaultSelectedFiltersForNewAutomation.js +2 -1
  87. package/esm/presentation/dashboard/components/DashboardLoading.js +1 -1
  88. package/esm/presentation/dashboardSettingsDialog/TimezoneOption.d.ts.map +1 -1
  89. package/esm/presentation/dashboardSettingsDialog/TimezoneOption.js +12 -10
  90. package/esm/presentation/localization/bundles/en-US.localization-bundle.d.ts +8 -0
  91. package/esm/presentation/localization/bundles/en-US.localization-bundle.d.ts.map +1 -1
  92. package/esm/presentation/localization/bundles/en-US.localization-bundle.js +18 -10
  93. package/esm/presentation/timezoneDialog/TimezoneDialog.d.ts.map +1 -1
  94. package/esm/presentation/timezoneDialog/TimezoneDialog.js +2 -4
  95. package/esm/presentation/widget/visualizationSwitcher/ViewModeDashboardVisualizationSwitcher.d.ts.map +1 -1
  96. package/esm/presentation/widget/visualizationSwitcher/ViewModeDashboardVisualizationSwitcher.js +11 -2
  97. package/esm/sdk-ui-dashboard.d.ts +114 -10
  98. package/package.json +21 -21
  99. package/styles/css/dashboardSettingsDialog.css +3 -0
  100. package/styles/css/dashboardSettingsDialog.css.map +1 -1
  101. package/styles/css/main.css +3 -0
  102. package/styles/css/main.css.map +1 -1
  103. package/styles/scss/dashboardSettingsDialog.scss +4 -0
  104. package/esm/presentation/automations/alerting/DefaultAlertingDialog/hooks/useAlertFilters.d.ts.map +0 -1
  105. package/esm/presentation/automations/alerting/DefaultAlertingDialog/hooks/useAlertFormState.d.ts.map +0 -1
  106. package/esm/presentation/automations/alerting/DefaultAlertingDialog/hooks/useAlertFormValidation.d.ts.map +0 -1
  107. package/esm/presentation/automations/alerting/DefaultAlertingDialog/hooks/useAlertSelectedValues.d.ts.map +0 -1
  108. package/esm/presentation/automations/alerting/DefaultAlertingDialog/hooks/useAlertSupportedMetrics.d.ts.map +0 -1
  109. package/esm/presentation/automations/alerting/DefaultAlertingDialog/hooks/useEditAlert.d.ts +0 -69
  110. package/esm/presentation/automations/alerting/DefaultAlertingDialog/hooks/useEditAlert.d.ts.map +0 -1
  111. package/esm/presentation/automations/alerting/DefaultAlertingDialog/hooks/useEditAlert.js +0 -145
  112. /package/esm/presentation/automations/alerting/{DefaultAlertingDialog/hooks → state}/useAlertFormValidation.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultAlertingDialog.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/alerting/DefaultAlertingDialog/DefaultAlertingDialog.tsx"],"names":[],"mappings":"AAwCA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AA4BxD,wBAAgB,sBAAsB,CAAC,EACnC,QAAQ,EACR,eAAe,EACf,aAAa,EACb,OAAO,EACP,SAAS,EACT,WAAW,EACX,aAAa,EAChB,EAAE,oBAAoB,2CAwhBtB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,oBAAoB,2CAchE"}
1
+ {"version":3,"file":"DefaultAlertingDialog.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/alerting/DefaultAlertingDialog/DefaultAlertingDialog.tsx"],"names":[],"mappings":"AA8CA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AA4BxD,wBAAgB,sBAAsB,CAAC,EACnC,QAAQ,EACR,eAAe,EACf,aAAa,EACb,OAAO,EACP,SAAS,EACT,WAAW,EACX,aAAa,EAChB,EAAE,oBAAoB,2CAwiBtB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,oBAAoB,2CAchE"}
@@ -12,6 +12,12 @@ import { RecipientsSelect } from "../../scheduledEmail/DefaultScheduledEmailDial
12
12
  import { ApplyCurrentFiltersConfirmDialog } from "../../shared/automationFilters/components/ApplyLatestFiltersConfirmDialog.js";
13
13
  import { AutomationFiltersSelect } from "../../shared/automationFilters/components/AutomationFiltersSelect.js";
14
14
  import { DeleteAlertConfirmDialog } from "../DefaultAlertingManagementDialog/components/DeleteAlertConfirmDialog.js";
15
+ import { useAlertActions } from "../state/AlertActionsContext.js";
16
+ import { useAlertData } from "../state/AlertDataContext.js";
17
+ import { useAlertDraft } from "../state/AlertDraftContext.js";
18
+ import { useAlertFilters } from "../state/AlertFiltersContext.js";
19
+ import { useAlertDialogValidity } from "../state/useAlertDialogValidity.js";
20
+ import { useAlertSelectedValues } from "../state/useAlertSelectedValues.js";
15
21
  import { AlertingDialogHeader } from "./AlertingDialogHeader.js";
16
22
  import { AlertAttributeSelect } from "./components/AlertAttributeSelect.js";
17
23
  import { AlertComparisonOperatorSelect } from "./components/AlertComparisonOperatorSelect.js";
@@ -28,7 +34,7 @@ import { AlertTriggerModeSelect } from "./components/AlertTriggerModeSelect.js";
28
34
  import { ALERTING_DIALOG_ID } from "./constants.js";
29
35
  import { DefaultLoadingAlertingDialog } from "./DefaultLoadingAlertingDialog.js";
30
36
  import { useAlertSubmit } from "./hooks/useAlertSubmit.js";
31
- import { useEditAlert } from "./hooks/useEditAlert.js";
37
+ import { useAlertThreshold } from "./hooks/useAlertThreshold.js";
32
38
  import { getValueSuffix } from "./utils/getters.js";
33
39
  import { isAnomalyDetection, isChangeOrDifferenceOperator } from "./utils/guards.js";
34
40
  import { isMobileView } from "./utils/responsive.js";
@@ -38,17 +44,29 @@ const overlayController = OverlayController.getInstance(DASHBOARD_DIALOG_OVERS_Z
38
44
  export function AlertingDialogRenderer({ onCancel, onDeleteSuccess, onDeleteError, onError, onSuccess, onSaveError, onSaveSuccess, }) {
39
45
  const intl = useIntl();
40
46
  const dialogTitleRef = useRef(null);
41
- const { isWhiteLabeled, isSecondaryTitleVisible, externalRecipient: externalRecipientOverride, maxAutomationsRecipients, isExecutionTimestampMode, features: { enableAlertOncePerInterval, enableAnomalyDetectionAlert, canUseAiAssistant: enableAiAssistant, }, } = useAutomationsContext();
42
- const { widgetTitle, alertToEdit } = useAlertingDialogContext();
47
+ const { isWhiteLabeled, isSecondaryTitleVisible, externalRecipient: externalRecipientOverride, maxAutomationsRecipients, isExecutionTimestampMode, features: { enableAlertOncePerInterval, enableAnomalyDetectionAlert, canUseAiAssistant: enableAiAssistant, }, catalogAttributes, catalogDateDatasets, separators, allowHourlyRecurrence, } = useAutomationsContext();
48
+ const { widgetTitle, alertToEdit, notificationChannels } = useAlertingDialogContext();
43
49
  const [alertToDelete, setAlertToDelete] = useState(null);
44
50
  const handleAlertDeleteSuccess = (alert) => {
45
51
  onDeleteSuccess?.(alert);
46
52
  setAlertToDelete(null);
47
53
  };
48
- const { onTitleChange, onRecipientsChange, selectedFilters, availableFilters, onFiltersChange, onApplyCurrentFilters, automationIsValid, filtersAreStale, dropStaleParameters, automationParameters, availableParameters, onParameterChange, onParameterDelete, onParameterAdd, onMeasureChange, getAttributeValues, onAttributeChange, onComparisonOperatorChange, onRelativeOperatorChange, onAnomalyDetectionChange, onChange, onBlur, onComparisonTypeChange, onDestinationChange, onTriggerModeChange, onTriggerIntervalChange, selectedMeasure, canChangeMeasure, supportedMeasures, selectedAttribute, selectedValue, supportedAttributes, catalogAttributes, catalogDateDatasets, isResultLoading, selectedComparisonOperator, selectedRelativeOperator, selectedAiOperator, value, selectedComparator, selectedSensitivity, onSensitivityChange, selectedGranularity, onGranularityChange, separators, defaultUser, originalAutomation, editedAutomation, allowOnlyLoggedUserRecipients, allowExternalRecipients, warningMessage, validationErrorMessage, isInvalidConnectionToInsight, isSubmitDisabled, isParentValid, thresholdErrorMessage, allowHourlyRecurrence, notificationChannels, } = useEditAlert({
49
- maxAutomationsRecipients,
50
- externalRecipientOverride,
54
+ const { editedAutomation, originalAutomation, warningMessage } = useAlertDraft();
55
+ const { onTitleChange, onRecipientsChange, onMeasureChange, onAttributeChange, onComparisonOperatorChange, onRelativeOperatorChange, onAnomalyDetectionChange, onComparisonTypeChange, onDestinationChange, onTriggerModeChange, onTriggerIntervalChange, onSensitivityChange, onGranularityChange, setEditedAutomation, } = useAlertActions();
56
+ const { supportedMeasures, supportedAttributes, isResultLoading, getAttributeValues, defaultUser, getMetricValue, } = useAlertData();
57
+ const { selectedFilters, availableFilters, onFiltersChange, onApplyCurrentFilters, automationIsValid, filtersAreStale, automationParameters, availableParameters, onParameterChange, onParameterDelete, onParameterAdd, dropStaleParameters, } = useAlertFilters();
58
+ const { selectedMeasure, selectedComparisonOperator, selectedRelativeOperator, selectedAiOperator, selectedComparator, selectedSensitivity, selectedGranularity, selectedAttribute, selectedValue, allowExternalRecipients, allowOnlyLoggedUserRecipients, } = useAlertSelectedValues();
59
+ const { value, onChange, onBlur, thresholdErrorMessage } = useAlertThreshold({
60
+ setEditedAutomation,
61
+ editedAutomation,
62
+ getMetricValue,
63
+ isNewAlert: !alertToEdit,
64
+ selectedRelativeOperator,
65
+ selectedMeasure,
66
+ selectedAttribute,
67
+ selectedValue,
51
68
  });
69
+ const { isSubmitDisabled, validationErrorMessage, isParentValid, canChangeMeasure, isInvalidConnectionToInsight, } = useAlertDialogValidity();
52
70
  const [isApplyCurrentFiltersDialogOpen, setIsApplyCurrentFiltersDialogOpen] = useState(!automationIsValid);
53
71
  const { isSaving, submit } = useAlertSubmit({
54
72
  editedAutomation,
@@ -142,12 +160,15 @@ export function AlertingDialogRenderer({ onCancel, onDeleteSuccess, onDeleteErro
142
160
  /**
143
161
  * Default implementation of the alerting create/edit dialog.
144
162
  *
145
- * This component is a pure consumer of `AutomationsContext` and `AlertingDialogContext`: it reads
146
- * org/workspace data and per-dialog state from those contexts rather than from the dashboard store.
147
- * It must therefore be rendered within an `AutomationsContextProvider` (and, for the create/edit
148
- * flow, an `AlertingDialogContextProvider`). Inside a `Dashboard`, the alerting connector supplies
149
- * both providers above the `AlertingDialogComponent` slot — so the default component, and any
150
- * wholesale slot replacement, inherit the contexts automatically and require no extra wiring.
163
+ * This component is a pure consumer of `AutomationsContext`, `AlertingDialogContext`, and the
164
+ * alerting dialog state contexts: it reads org/workspace data, per-dialog state, and the alert
165
+ * draft's state from those contexts rather than from the dashboard store. It must therefore be
166
+ * rendered within an `AutomationsContextProvider`, an `AlertingDialogContextProvider` (for the
167
+ * create/edit flow), and an `AlertingDialogStateProvider`. Inside a `Dashboard`, the alerting
168
+ * connector supplies the first two providers above the `AlertingDialogComponent` slot, and mounts
169
+ * `AlertingDialogStateProvider` around the resolved slot component once
170
+ * `useAlertingDialogContext().isLoading` is false — so the default component, and any wholesale
171
+ * slot replacement, inherit all three contexts automatically and require no extra wiring.
151
172
  *
152
173
  * The providers are intentionally hoisted above the slot rather than built inside this component:
153
174
  * that is what lets a wholesale replacement receive the same contexts. Rendering this component
@@ -11,6 +11,15 @@ export interface IUseAlertThresholdProps {
11
11
  selectedAttribute: AlertAttribute | undefined;
12
12
  selectedValue: string | null | undefined;
13
13
  }
14
+ /**
15
+ * Owns the alerting dialog's threshold field: the displayed value, its change and blur handlers,
16
+ * and its validation message.
17
+ *
18
+ * Writes the draft — its effect auto-computes the comparison threshold when the selection changes
19
+ * and clears it for relative operators — so exactly one consumer per dialog tree may call it.
20
+ *
21
+ * @internal
22
+ */
14
23
  export declare function useAlertThreshold({ setEditedAutomation, editedAutomation, getMetricValue, isNewAlert, selectedRelativeOperator, selectedMeasure, selectedAttribute, selectedValue }: IUseAlertThresholdProps): {
15
24
  value: number | undefined;
16
25
  onChange: (e: string | number, event?: import("react").ChangeEvent<HTMLInputElement> | undefined) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"useAlertThreshold.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/automations/alerting/DefaultAlertingDialog/hooks/useAlertThreshold.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAe,MAAM,OAAO,CAAC;AAExE,OAAO,EACH,KAAK,gCAAgC,EACrC,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EAEf,KAAK,mCAAmC,EACxC,KAAK,QAAQ,EAChB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAKvE,MAAM,WAAW,uBAAuB;IACpC,mBAAmB,EAAE,QAAQ,CAAC,cAAc,CAAC,mCAAmC,GAAG,SAAS,CAAC,CAAC,CAAC;IAC/F,gBAAgB,EAAE,mCAAmC,GAAG,SAAS,CAAC;IAClE,cAAc,EAAE,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,MAAM,GAAG,SAAS,CAAC;IACrG,UAAU,EAAE,OAAO,CAAC;IACpB,wBAAwB,EAAE,CAAC,sBAAsB,EAAE,gCAAgC,CAAC,GAAG,SAAS,CAAC;IACjG,eAAe,EAAE,WAAW,GAAG,SAAS,CAAC;IACzC,iBAAiB,EAAE,cAAc,GAAG,SAAS,CAAC;IAC9C,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CAC5C;AAED,wBAAgB,iBAAiB,CAAC,EAC9B,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,wBAAwB,EACxB,eAAe,EACf,iBAAiB,EACjB,aAAa,EAChB,EAAE,uBAAuB;;;;;EAgCzB"}
1
+ {"version":3,"file":"useAlertThreshold.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/automations/alerting/DefaultAlertingDialog/hooks/useAlertThreshold.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAe,MAAM,OAAO,CAAC;AAExE,OAAO,EACH,KAAK,gCAAgC,EACrC,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EAEf,KAAK,mCAAmC,EACxC,KAAK,QAAQ,EAChB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAKvE,MAAM,WAAW,uBAAuB;IACpC,mBAAmB,EAAE,QAAQ,CAAC,cAAc,CAAC,mCAAmC,GAAG,SAAS,CAAC,CAAC,CAAC;IAC/F,gBAAgB,EAAE,mCAAmC,GAAG,SAAS,CAAC;IAClE,cAAc,EAAE,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,MAAM,GAAG,SAAS,CAAC;IACrG,UAAU,EAAE,OAAO,CAAC;IACpB,wBAAwB,EAAE,CAAC,sBAAsB,EAAE,gCAAgC,CAAC,GAAG,SAAS,CAAC;IACjG,eAAe,EAAE,WAAW,GAAG,SAAS,CAAC;IACzC,iBAAiB,EAAE,cAAc,GAAG,SAAS,CAAC;IAC9C,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CAC5C;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,EAC9B,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,wBAAwB,EACxB,eAAe,EACf,iBAAiB,EACjB,aAAa,EAChB,EAAE,uBAAuB;;;;;EAgCzB"}
@@ -2,6 +2,15 @@
2
2
  import { useCallback } from "react";
3
3
  import { transformAlertByValue } from "../utils/transformation.js";
4
4
  import { useThresholdValue } from "./useThresholdValue.js";
5
+ /**
6
+ * Owns the alerting dialog's threshold field: the displayed value, its change and blur handlers,
7
+ * and its validation message.
8
+ *
9
+ * Writes the draft — its effect auto-computes the comparison threshold when the selection changes
10
+ * and clears it for relative operators — so exactly one consumer per dialog tree may call it.
11
+ *
12
+ * @internal
13
+ */
5
14
  export function useAlertThreshold({ setEditedAutomation, editedAutomation, getMetricValue, isNewAlert, selectedRelativeOperator, selectedMeasure, selectedAttribute, selectedValue, }) {
6
15
  const onValueChange = useCallback((value) => {
7
16
  setEditedAutomation((alert) => alert ? transformAlertByValue(alert, value) : undefined);
@@ -0,0 +1,23 @@
1
+ import { type useAlertFormState } from "./useAlertFormState.js";
2
+ /**
3
+ * The alerting dialog's mutators: the draft setter and every form change-handler.
4
+ *
5
+ * Changes rarely: `onGranularityChange` is re-created when `triggerIntervalDirty` toggles or the
6
+ * supported measures load. The shape is derived from `useAlertFormState`, which owns them.
7
+ *
8
+ * @internal
9
+ */
10
+ export type IAlertActionsContextValue = Pick<ReturnType<typeof useAlertFormState>, "setEditedAutomation" | "onTitleChange" | "onMeasureChange" | "onAttributeChange" | "onComparisonOperatorChange" | "onRelativeOperatorChange" | "onAnomalyDetectionChange" | "onComparisonTypeChange" | "onSensitivityChange" | "onTriggerIntervalChange" | "onGranularityChange" | "onDestinationChange" | "onTriggerModeChange" | "onRecipientsChange">;
11
+ export declare const AlertActionsContextProvider: import("react").Provider<IAlertActionsContextValue | undefined>;
12
+ /**
13
+ * Reads the alerting dialog's mutators.
14
+ *
15
+ * Throws outside the alerting dialog's state providers, which mount only once
16
+ * `useAlertingDialogContext().isLoading` is false — a replacement for `AlertingDialogComponent`
17
+ * must check that flag before calling this. On the alerting side that state is reached only by an
18
+ * automations refresh while the dialog is open, so it will not appear in manual testing.
19
+ *
20
+ * @internal
21
+ */
22
+ export declare function useAlertActions(): IAlertActionsContextValue;
23
+ //# sourceMappingURL=AlertActionsContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AlertActionsContext.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/alerting/state/AlertActionsContext.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE;;;;;;;GAOG;AACH,MAAM,MAAM,yBAAyB,GAAG,IAAI,CACxC,UAAU,CAAC,OAAO,iBAAiB,CAAC,EAClC,qBAAqB,GACrB,eAAe,GACf,iBAAiB,GACjB,mBAAmB,GACnB,4BAA4B,GAC5B,0BAA0B,GAC1B,0BAA0B,GAC1B,wBAAwB,GACxB,qBAAqB,GACrB,yBAAyB,GACzB,qBAAqB,GACrB,qBAAqB,GACrB,qBAAqB,GACrB,oBAAoB,CACzB,CAAC;AAKF,eAAO,MAAM,2BAA2B,iEAA+B,CAAC;AAExE;;;;;;;;;GASG;AACH,wBAAgB,eAAe,IAAI,yBAAyB,CAE3D"}
@@ -0,0 +1,19 @@
1
+ // (C) 2026 GoodData Corporation
2
+ import { createContext, useContext } from "react";
3
+ import { missingAlertStateProvider } from "./missingAlertStateProvider.js";
4
+ const AlertActionsContext = createContext(undefined);
5
+ AlertActionsContext.displayName = "AlertActionsContext";
6
+ export const AlertActionsContextProvider = AlertActionsContext.Provider;
7
+ /**
8
+ * Reads the alerting dialog's mutators.
9
+ *
10
+ * Throws outside the alerting dialog's state providers, which mount only once
11
+ * `useAlertingDialogContext().isLoading` is false — a replacement for `AlertingDialogComponent`
12
+ * must check that flag before calling this. On the alerting side that state is reached only by an
13
+ * automations refresh while the dialog is open, so it will not appear in manual testing.
14
+ *
15
+ * @internal
16
+ */
17
+ export function useAlertActions() {
18
+ return useContext(AlertActionsContext) ?? missingAlertStateProvider("useAlertActions");
19
+ }
@@ -0,0 +1,24 @@
1
+ import { type useAlertFormState } from "./useAlertFormState.js";
2
+ import { type useAlertSupportedMetrics } from "./useAlertSupportedMetrics.js";
3
+ /**
4
+ * The data the alerting dialog loads asynchronously: the supported measures and attributes with
5
+ * their formats, the execution-result readers, and the current user's default recipients.
6
+ *
7
+ * Changes when an async load resolves, not per keystroke.
8
+ *
9
+ * @internal
10
+ */
11
+ export type IAlertDataContextValue = Pick<ReturnType<typeof useAlertSupportedMetrics>, "supportedMeasures" | "supportedAttributes" | "measureFormatMap" | "isResultLoading" | "getAttributeValues" | "getMetricValue"> & Pick<ReturnType<typeof useAlertFormState>, "defaultUser" | "defaultRecipient">;
12
+ export declare const AlertDataContextProvider: import("react").Provider<IAlertDataContextValue | undefined>;
13
+ /**
14
+ * Reads the data the alerting dialog loads asynchronously.
15
+ *
16
+ * Throws outside the alerting dialog's state providers, which mount only once
17
+ * `useAlertingDialogContext().isLoading` is false — a replacement for `AlertingDialogComponent`
18
+ * must check that flag before calling this. On the alerting side that state is reached only by an
19
+ * automations refresh while the dialog is open, so it will not appear in manual testing.
20
+ *
21
+ * @internal
22
+ */
23
+ export declare function useAlertData(): IAlertDataContextValue;
24
+ //# sourceMappingURL=AlertDataContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AlertDataContext.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/alerting/state/AlertDataContext.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAE9E;;;;;;;GAOG;AACH,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACrC,UAAU,CAAC,OAAO,wBAAwB,CAAC,EACzC,mBAAmB,GACnB,qBAAqB,GACrB,kBAAkB,GAClB,iBAAiB,GACjB,oBAAoB,GACpB,gBAAgB,CACrB,GACG,IAAI,CAAC,UAAU,CAAC,OAAO,iBAAiB,CAAC,EAAE,aAAa,GAAG,kBAAkB,CAAC,CAAC;AAKnF,eAAO,MAAM,wBAAwB,8DAA4B,CAAC;AAElE;;;;;;;;;GASG;AACH,wBAAgB,YAAY,IAAI,sBAAsB,CAErD"}
@@ -0,0 +1,19 @@
1
+ // (C) 2026 GoodData Corporation
2
+ import { createContext, useContext } from "react";
3
+ import { missingAlertStateProvider } from "./missingAlertStateProvider.js";
4
+ const AlertDataContext = createContext(undefined);
5
+ AlertDataContext.displayName = "AlertDataContext";
6
+ export const AlertDataContextProvider = AlertDataContext.Provider;
7
+ /**
8
+ * Reads the data the alerting dialog loads asynchronously.
9
+ *
10
+ * Throws outside the alerting dialog's state providers, which mount only once
11
+ * `useAlertingDialogContext().isLoading` is false — a replacement for `AlertingDialogComponent`
12
+ * must check that flag before calling this. On the alerting side that state is reached only by an
13
+ * automations refresh while the dialog is open, so it will not appear in manual testing.
14
+ *
15
+ * @internal
16
+ */
17
+ export function useAlertData() {
18
+ return useContext(AlertDataContext) ?? missingAlertStateProvider("useAlertData");
19
+ }
@@ -0,0 +1,24 @@
1
+ import { type useAlertFormState } from "./useAlertFormState.js";
2
+ /**
3
+ * The alerting dialog's edit draft: the automation being edited, the baseline it is compared
4
+ * against, and the form-level warning and title-validity flag that move with it.
5
+ *
6
+ * Changes on every keystroke; consumers re-render by design. The shape is derived from
7
+ * `useAlertFormState`, which owns these values.
8
+ *
9
+ * @internal
10
+ */
11
+ export type IAlertDraftContextValue = Pick<ReturnType<typeof useAlertFormState>, "editedAutomation" | "originalAutomation" | "warningMessage" | "isTitleValid">;
12
+ export declare const AlertDraftContextProvider: import("react").Provider<IAlertDraftContextValue | undefined>;
13
+ /**
14
+ * Reads the alerting dialog's edit draft.
15
+ *
16
+ * Throws outside the alerting dialog's state providers, which mount only once
17
+ * `useAlertingDialogContext().isLoading` is false — a replacement for `AlertingDialogComponent`
18
+ * must check that flag before calling this. On the alerting side that state is reached only by an
19
+ * automations refresh while the dialog is open, so it will not appear in manual testing.
20
+ *
21
+ * @internal
22
+ */
23
+ export declare function useAlertDraft(): IAlertDraftContextValue;
24
+ //# sourceMappingURL=AlertDraftContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AlertDraftContext.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/alerting/state/AlertDraftContext.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE;;;;;;;;GAQG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACtC,UAAU,CAAC,OAAO,iBAAiB,CAAC,EACpC,kBAAkB,GAAG,oBAAoB,GAAG,gBAAgB,GAAG,cAAc,CAChF,CAAC;AAKF,eAAO,MAAM,yBAAyB,+DAA6B,CAAC;AAEpE;;;;;;;;;GASG;AACH,wBAAgB,aAAa,IAAI,uBAAuB,CAEvD"}
@@ -0,0 +1,19 @@
1
+ // (C) 2026 GoodData Corporation
2
+ import { createContext, useContext } from "react";
3
+ import { missingAlertStateProvider } from "./missingAlertStateProvider.js";
4
+ const AlertDraftContext = createContext(undefined);
5
+ AlertDraftContext.displayName = "AlertDraftContext";
6
+ export const AlertDraftContextProvider = AlertDraftContext.Provider;
7
+ /**
8
+ * Reads the alerting dialog's edit draft.
9
+ *
10
+ * Throws outside the alerting dialog's state providers, which mount only once
11
+ * `useAlertingDialogContext().isLoading` is false — a replacement for `AlertingDialogComponent`
12
+ * must check that flag before calling this. On the alerting side that state is reached only by an
13
+ * automations refresh while the dialog is open, so it will not appear in manual testing.
14
+ *
15
+ * @internal
16
+ */
17
+ export function useAlertDraft() {
18
+ return useContext(AlertDraftContext) ?? missingAlertStateProvider("useAlertDraft");
19
+ }
@@ -0,0 +1,26 @@
1
+ import { type useAlertFiltersModel } from "./useAlertFiltersModel.js";
2
+ import { type useAlertFormState } from "./useAlertFormState.js";
3
+ /**
4
+ * The alerting dialog's filter and export-parameter model: the current selection, the available
5
+ * filters, the two filter mutators and the staleness flags, plus the automation's execution
6
+ * parameters and their mutators.
7
+ *
8
+ * Changes when a filter or a parameter is edited. The shape is derived from
9
+ * `useAlertFiltersModel` and from the parameter members `useAlertFormState` re-exports.
10
+ *
11
+ * @internal
12
+ */
13
+ export type IAlertFiltersContextValue = Pick<ReturnType<typeof useAlertFiltersModel>, "selectedFilters" | "availableFilters" | "onFiltersChange" | "onApplyCurrentFilters" | "automationIsValid" | "filtersAreStale"> & Pick<ReturnType<typeof useAlertFormState>, "automationParameters" | "availableParameters" | "onParameterChange" | "onParameterDelete" | "onParameterAdd" | "dropStaleParameters">;
14
+ export declare const AlertFiltersContextProvider: import("react").Provider<IAlertFiltersContextValue | undefined>;
15
+ /**
16
+ * Reads the alerting dialog's filter and export-parameter model.
17
+ *
18
+ * Throws outside the alerting dialog's state providers, which mount only once
19
+ * `useAlertingDialogContext().isLoading` is false — a replacement for `AlertingDialogComponent`
20
+ * must check that flag before calling this. On the alerting side that state is reached only by an
21
+ * automations refresh while the dialog is open, so it will not appear in manual testing.
22
+ *
23
+ * @internal
24
+ */
25
+ export declare function useAlertFilters(): IAlertFiltersContextValue;
26
+ //# sourceMappingURL=AlertFiltersContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AlertFiltersContext.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/alerting/state/AlertFiltersContext.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE;;;;;;;;;GASG;AACH,MAAM,MAAM,yBAAyB,GAAG,IAAI,CACxC,UAAU,CAAC,OAAO,oBAAoB,CAAC,EACrC,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,GACjB,uBAAuB,GACvB,mBAAmB,GACnB,iBAAiB,CACtB,GACG,IAAI,CACA,UAAU,CAAC,OAAO,iBAAiB,CAAC,EAClC,sBAAsB,GACtB,qBAAqB,GACrB,mBAAmB,GACnB,mBAAmB,GACnB,gBAAgB,GAChB,qBAAqB,CAC1B,CAAC;AAKN,eAAO,MAAM,2BAA2B,iEAA+B,CAAC;AAExE;;;;;;;;;GASG;AACH,wBAAgB,eAAe,IAAI,yBAAyB,CAE3D"}
@@ -0,0 +1,19 @@
1
+ // (C) 2026 GoodData Corporation
2
+ import { createContext, useContext } from "react";
3
+ import { missingAlertStateProvider } from "./missingAlertStateProvider.js";
4
+ const AlertFiltersContext = createContext(undefined);
5
+ AlertFiltersContext.displayName = "AlertFiltersContext";
6
+ export const AlertFiltersContextProvider = AlertFiltersContext.Provider;
7
+ /**
8
+ * Reads the alerting dialog's filter and export-parameter model.
9
+ *
10
+ * Throws outside the alerting dialog's state providers, which mount only once
11
+ * `useAlertingDialogContext().isLoading` is false — a replacement for `AlertingDialogComponent`
12
+ * must check that flag before calling this. On the alerting side that state is reached only by an
13
+ * automations refresh while the dialog is open, so it will not appear in manual testing.
14
+ *
15
+ * @internal
16
+ */
17
+ export function useAlertFilters() {
18
+ return useContext(AlertFiltersContext) ?? missingAlertStateProvider("useAlertFilters");
19
+ }
@@ -0,0 +1,21 @@
1
+ import { type ReactNode } from "react";
2
+ /**
3
+ * Publishes the alerting create/edit dialog's state as the four alert state contexts once the
4
+ * dialog's data has loaded.
5
+ *
6
+ * Mounts above the resolved `AlertingDialogComponent`, so the default dialog, a shell of blocks
7
+ * and a wholesale replacement all read the same state with no extra wiring. Defers mounting the
8
+ * state model itself until `useAlertingDialogContext().isLoading` is false, because the state
9
+ * model seeds its draft from the dialog's loaded data in `useState` initializers that never
10
+ * re-run — mounting earlier would freeze that seed against not-yet-loaded data.
11
+ *
12
+ * Runs `useIntl`-calling hooks, so an `IntlProvider` must sit above it. Inside a `Dashboard` the
13
+ * ambient wrapper in `DashboardInner` supplies one with the same locale; a mount site without one
14
+ * throws in react-intl.
15
+ *
16
+ * @internal
17
+ */
18
+ export declare function AlertingDialogStateProvider({ children }: {
19
+ children: ReactNode;
20
+ }): import("react/jsx-runtime").JSX.Element;
21
+ //# sourceMappingURL=AlertingDialogStateProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AlertingDialogStateProvider.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/alerting/state/AlertingDialogStateProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAehD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,2BAA2B,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAIhF"}
@@ -0,0 +1,168 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ // (C) 2026 GoodData Corporation
3
+ import { useMemo } from "react";
4
+ import { useAlertingDialogContext } from "../../contexts/AlertingDialogContext.js";
5
+ import { useAutomationsContext } from "../../contexts/AutomationsContext.js";
6
+ import { useAutomationFiltersSelect } from "../../shared/automationFilters/useAutomationFiltersSelect.js";
7
+ import { AlertActionsContextProvider } from "./AlertActionsContext.js";
8
+ import { AlertDataContextProvider } from "./AlertDataContext.js";
9
+ import { AlertDraftContextProvider } from "./AlertDraftContext.js";
10
+ import { AlertFiltersContextProvider } from "./AlertFiltersContext.js";
11
+ import { useAlertFiltersModel } from "./useAlertFiltersModel.js";
12
+ import { useAlertFormState } from "./useAlertFormState.js";
13
+ import { getAlertSelectedValues } from "./useAlertSelectedValues.js";
14
+ import { useAlertSupportedMetrics } from "./useAlertSupportedMetrics.js";
15
+ /**
16
+ * Publishes the alerting create/edit dialog's state as the four alert state contexts once the
17
+ * dialog's data has loaded.
18
+ *
19
+ * Mounts above the resolved `AlertingDialogComponent`, so the default dialog, a shell of blocks
20
+ * and a wholesale replacement all read the same state with no extra wiring. Defers mounting the
21
+ * state model itself until `useAlertingDialogContext().isLoading` is false, because the state
22
+ * model seeds its draft from the dialog's loaded data in `useState` initializers that never
23
+ * re-run — mounting earlier would freeze that seed against not-yet-loaded data.
24
+ *
25
+ * Runs `useIntl`-calling hooks, so an `IntlProvider` must sit above it. Inside a `Dashboard` the
26
+ * ambient wrapper in `DashboardInner` supplies one with the same locale; a mount site without one
27
+ * throws in react-intl.
28
+ *
29
+ * @internal
30
+ */
31
+ export function AlertingDialogStateProvider({ children }) {
32
+ const { isLoading } = useAlertingDialogContext();
33
+ return isLoading ? _jsx(_Fragment, { children: children }) : _jsx(LoadedAlertingDialogState, { children: children });
34
+ }
35
+ function LoadedAlertingDialogState({ children }) {
36
+ const { weekStart, timezone, externalRecipient } = useAutomationsContext();
37
+ const { hiddenFilters: dashboardHiddenFilters, commonDateFilterId, alertToEdit, notificationChannels, widget, insight, } = useAlertingDialogContext();
38
+ const { editedAutomationFilters, setEditedAutomationFilters, availableFilters, availableFiltersAsVisibleFilters, filtersForNewAutomation, } = useAutomationFiltersSelect({ automationToEdit: alertToEdit, widget });
39
+ const { measureFormatMap, supportedMeasures, supportedAttributes, isResultLoading, getAttributeValues, getMetricValue, } = useAlertSupportedMetrics({ insight, widget, alertToEdit });
40
+ const formState = useAlertFormState({
41
+ alertToEdit,
42
+ insight,
43
+ widget,
44
+ notificationChannels,
45
+ editedAutomationFilters,
46
+ availableFiltersAsVisibleFilters,
47
+ externalRecipientOverride: externalRecipient,
48
+ supportedMeasures,
49
+ supportedAttributes,
50
+ measureFormatMap,
51
+ });
52
+ const { selectedMeasure, selectedAttribute, selectedValue } = getAlertSelectedValues({
53
+ editedAutomation: formState.editedAutomation,
54
+ supportedMeasures,
55
+ supportedAttributes,
56
+ notificationChannels,
57
+ });
58
+ const filtersModel = useAlertFiltersModel({
59
+ setEditedAutomation: formState.setEditedAutomation,
60
+ alertToEdit,
61
+ editedAutomationFilters,
62
+ setEditedAutomationFilters,
63
+ availableFilters,
64
+ filtersForNewAutomation,
65
+ availableFiltersAsVisibleFilters,
66
+ dashboardHiddenFilters,
67
+ commonDateFilterId,
68
+ widget,
69
+ insight,
70
+ supportedMeasures,
71
+ supportedAttributes,
72
+ measureFormatMap,
73
+ selectedMeasure,
74
+ selectedAttribute,
75
+ selectedValue,
76
+ weekStart,
77
+ timezone,
78
+ });
79
+ const draft = useMemo(() => ({
80
+ editedAutomation: formState.editedAutomation,
81
+ originalAutomation: formState.originalAutomation,
82
+ warningMessage: formState.warningMessage,
83
+ isTitleValid: formState.isTitleValid,
84
+ }), [
85
+ formState.editedAutomation,
86
+ formState.originalAutomation,
87
+ formState.warningMessage,
88
+ formState.isTitleValid,
89
+ ]);
90
+ const actions = useMemo(() => ({
91
+ setEditedAutomation: formState.setEditedAutomation,
92
+ onTitleChange: formState.onTitleChange,
93
+ onMeasureChange: formState.onMeasureChange,
94
+ onAttributeChange: formState.onAttributeChange,
95
+ onComparisonOperatorChange: formState.onComparisonOperatorChange,
96
+ onRelativeOperatorChange: formState.onRelativeOperatorChange,
97
+ onAnomalyDetectionChange: formState.onAnomalyDetectionChange,
98
+ onComparisonTypeChange: formState.onComparisonTypeChange,
99
+ onSensitivityChange: formState.onSensitivityChange,
100
+ onTriggerIntervalChange: formState.onTriggerIntervalChange,
101
+ onGranularityChange: formState.onGranularityChange,
102
+ onDestinationChange: formState.onDestinationChange,
103
+ onTriggerModeChange: formState.onTriggerModeChange,
104
+ onRecipientsChange: formState.onRecipientsChange,
105
+ }), [
106
+ formState.setEditedAutomation,
107
+ formState.onTitleChange,
108
+ formState.onMeasureChange,
109
+ formState.onAttributeChange,
110
+ formState.onComparisonOperatorChange,
111
+ formState.onRelativeOperatorChange,
112
+ formState.onAnomalyDetectionChange,
113
+ formState.onComparisonTypeChange,
114
+ formState.onSensitivityChange,
115
+ formState.onTriggerIntervalChange,
116
+ formState.onGranularityChange,
117
+ formState.onDestinationChange,
118
+ formState.onTriggerModeChange,
119
+ formState.onRecipientsChange,
120
+ ]);
121
+ const data = useMemo(() => ({
122
+ supportedMeasures,
123
+ supportedAttributes,
124
+ measureFormatMap,
125
+ isResultLoading,
126
+ getAttributeValues,
127
+ getMetricValue,
128
+ defaultUser: formState.defaultUser,
129
+ defaultRecipient: formState.defaultRecipient,
130
+ }), [
131
+ supportedMeasures,
132
+ supportedAttributes,
133
+ measureFormatMap,
134
+ isResultLoading,
135
+ getAttributeValues,
136
+ getMetricValue,
137
+ formState.defaultUser,
138
+ formState.defaultRecipient,
139
+ ]);
140
+ const filters = useMemo(() => ({
141
+ selectedFilters: filtersModel.selectedFilters,
142
+ availableFilters: filtersModel.availableFilters,
143
+ onFiltersChange: filtersModel.onFiltersChange,
144
+ onApplyCurrentFilters: filtersModel.onApplyCurrentFilters,
145
+ automationIsValid: filtersModel.automationIsValid,
146
+ filtersAreStale: filtersModel.filtersAreStale,
147
+ automationParameters: formState.automationParameters,
148
+ availableParameters: formState.availableParameters,
149
+ onParameterChange: formState.onParameterChange,
150
+ onParameterDelete: formState.onParameterDelete,
151
+ onParameterAdd: formState.onParameterAdd,
152
+ dropStaleParameters: formState.dropStaleParameters,
153
+ }), [
154
+ filtersModel.selectedFilters,
155
+ filtersModel.availableFilters,
156
+ filtersModel.onFiltersChange,
157
+ filtersModel.onApplyCurrentFilters,
158
+ filtersModel.automationIsValid,
159
+ filtersModel.filtersAreStale,
160
+ formState.automationParameters,
161
+ formState.availableParameters,
162
+ formState.onParameterChange,
163
+ formState.onParameterDelete,
164
+ formState.onParameterAdd,
165
+ formState.dropStaleParameters,
166
+ ]);
167
+ return (_jsx(AlertDraftContextProvider, { value: draft, children: _jsx(AlertActionsContextProvider, { value: actions, children: _jsx(AlertDataContextProvider, { value: data, children: _jsx(AlertFiltersContextProvider, { value: filters, children: children }) }) }) }));
168
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The single error every alerting dialog state accessor throws when no provider is above it.
3
+ *
4
+ * @internal
5
+ */
6
+ export declare function missingAlertStateProvider(accessor: string): never;
7
+ //# sourceMappingURL=missingAlertStateProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"missingAlertStateProvider.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/alerting/state/missingAlertStateProvider.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,CAIjE"}
@@ -0,0 +1,9 @@
1
+ // (C) 2026 GoodData Corporation
2
+ /**
3
+ * The single error every alerting dialog state accessor throws when no provider is above it.
4
+ *
5
+ * @internal
6
+ */
7
+ export function missingAlertStateProvider(accessor) {
8
+ throw new Error(`${accessor} must be used within AlertingDialogStateProvider. The provider mounts only once the dialog's data has loaded, so check useAlertingDialogContext().isLoading before reading alerting dialog state.`);
9
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Reads the alerting dialog's validity: whether submit is enabled, the validation message to show,
3
+ * whether the parent widget is still valid, whether the measure may be changed, and whether the
4
+ * saved alert points at a widget whose insight is gone.
5
+ *
6
+ * @internal
7
+ */
8
+ export declare function useAlertDialogValidity(): {
9
+ isSubmitDisabled: boolean;
10
+ validationErrorMessage: string | undefined;
11
+ isParentValid: boolean;
12
+ canChangeMeasure: boolean;
13
+ isInvalidConnectionToInsight: boolean;
14
+ };
15
+ //# sourceMappingURL=useAlertDialogValidity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAlertDialogValidity.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/alerting/state/useAlertDialogValidity.ts"],"names":[],"mappings":"AAUA;;;;;;GAMG;AACH,wBAAgB,sBAAsB,IAAI;IACtC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,sBAAsB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,4BAA4B,EAAE,OAAO,CAAC;CACzC,CAkCA"}
@@ -0,0 +1,45 @@
1
+ // (C) 2026 GoodData Corporation
2
+ import { useAlertingDialogContext } from "../../contexts/AlertingDialogContext.js";
3
+ import { useAutomationsContext } from "../../contexts/AutomationsContext.js";
4
+ import { useAlertData } from "./AlertDataContext.js";
5
+ import { useAlertDraft } from "./AlertDraftContext.js";
6
+ import { useAlertFormValidation } from "./useAlertFormValidation.js";
7
+ import { useAlertSelectedValues } from "./useAlertSelectedValues.js";
8
+ /**
9
+ * Reads the alerting dialog's validity: whether submit is enabled, the validation message to show,
10
+ * whether the parent widget is still valid, whether the measure may be changed, and whether the
11
+ * saved alert points at a widget whose insight is gone.
12
+ *
13
+ * @internal
14
+ */
15
+ export function useAlertDialogValidity() {
16
+ const { catalogDateDatasets, maxAutomationsRecipients } = useAutomationsContext();
17
+ const { alertToEdit, widget, insight } = useAlertingDialogContext();
18
+ const { editedAutomation, originalAutomation, isTitleValid } = useAlertDraft();
19
+ const { defaultRecipient } = useAlertData();
20
+ const { selectedNotificationChannel, allowExternalRecipients, allowOnlyLoggedUserRecipients } = useAlertSelectedValues();
21
+ const canChangeMeasure = !!insight;
22
+ const isInvalidConnectionToInsight = !!alertToEdit?.metadata?.widget && !insight;
23
+ const { isSubmitDisabled, validationErrorMessage, isParentValid } = useAlertFormValidation({
24
+ editedAutomation,
25
+ originalAutomation,
26
+ alertToEdit,
27
+ widget,
28
+ insight,
29
+ catalogDateDatasets,
30
+ isInvalidConnectionToInsight,
31
+ selectedNotificationChannel,
32
+ allowExternalRecipients,
33
+ allowOnlyLoggedUserRecipients,
34
+ maxAutomationsRecipients,
35
+ defaultRecipient,
36
+ isTitleValid,
37
+ });
38
+ return {
39
+ isSubmitDisabled,
40
+ validationErrorMessage,
41
+ isParentValid,
42
+ canChangeMeasure,
43
+ isInvalidConnectionToInsight,
44
+ };
45
+ }