PromucFlow_constructor/app/client/src/reducers/uiReducers/analyticsReducer.ts

38 lines
875 B
TypeScript
Raw Normal View History

import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
import { createReducer } from "utils/ReducerUtils";
export type SegmentState = "INIT_SUCCESS" | "INIT_UNCERTAIN";
export const initialState: AnalyticsReduxState = {
telemetry: {},
};
export interface AnalyticsReduxState {
telemetry: {
segmentState?: SegmentState;
};
}
export const handlers = {
[ReduxActionTypes.SEGMENT_INITIALIZED]: (
state: AnalyticsReduxState,
): AnalyticsReduxState => ({
...state,
telemetry: {
...state.telemetry,
segmentState: "INIT_SUCCESS",
},
}),
[ReduxActionTypes.SEGMENT_INIT_UNCERTAIN]: (
state: AnalyticsReduxState,
): AnalyticsReduxState => ({
...state,
telemetry: {
...state.telemetry,
segmentState: "INIT_UNCERTAIN",
},
}),
};
export default createReducer(initialState, handlers);