-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: UsagePulse initialisation flow (#38555)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- Loading branch information
1 parent
dfd7fde
commit 388fd81
Showing
7 changed files
with
125 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { ReduxActionTypes } from "ee/constants/ReduxActionConstants"; | ||
|
||
export const segmentInitSuccess = () => ({ | ||
type: ReduxActionTypes.SEGMENT_INITIALIZED, | ||
}); | ||
export const segmentInitUncertain = () => ({ | ||
type: ReduxActionTypes.SEGMENT_INIT_UNCERTAIN, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { ReduxActionTypes } from "ee/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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import type { AppState } from "ee/reducers"; | ||
|
||
export const getSegmentState = (state: AppState) => | ||
state.ui.analytics.telemetry.segmentState; |